commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
MyPaymentModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
24 use stdClass;
25 
29 final class MyPaymentModel extends JsonObjectModel implements MyPayment
30 {
35  protected $id;
36 
41  protected $version;
42 
47  protected $customer;
48 
53  protected $anonymousId;
54 
59  protected $amountPlanned;
60 
65  protected $paymentMethodInfo;
66 
71  protected $transactions;
72 
77  protected $custom;
78 
79 
83  public function __construct(
84  ?string $id = null,
85  ?int $version = null,
87  ?string $anonymousId = null,
91  ?CustomFields $custom = null
92  ) {
93  $this->id = $id;
94  $this->version = $version;
95  $this->customer = $customer;
96  $this->anonymousId = $anonymousId;
97  $this->amountPlanned = $amountPlanned;
98  $this->paymentMethodInfo = $paymentMethodInfo;
99  $this->transactions = $transactions;
100  $this->custom = $custom;
101  }
102 
109  public function getId()
110  {
111  if (is_null($this->id)) {
113  $data = $this->raw(self::FIELD_ID);
114  if (is_null($data)) {
115  return null;
116  }
117  $this->id = (string) $data;
118  }
119 
120  return $this->id;
121  }
122 
129  public function getVersion()
130  {
131  if (is_null($this->version)) {
133  $data = $this->raw(self::FIELD_VERSION);
134  if (is_null($data)) {
135  return null;
136  }
137  $this->version = (int) $data;
138  }
139 
140  return $this->version;
141  }
142 
149  public function getCustomer()
150  {
151  if (is_null($this->customer)) {
153  $data = $this->raw(self::FIELD_CUSTOMER);
154  if (is_null($data)) {
155  return null;
156  }
157 
158  $this->customer = CustomerReferenceModel::of($data);
159  }
160 
161  return $this->customer;
162  }
163 
170  public function getAnonymousId()
171  {
172  if (is_null($this->anonymousId)) {
174  $data = $this->raw(self::FIELD_ANONYMOUS_ID);
175  if (is_null($data)) {
176  return null;
177  }
178  $this->anonymousId = (string) $data;
179  }
180 
181  return $this->anonymousId;
182  }
183 
191  public function getAmountPlanned()
192  {
193  if (is_null($this->amountPlanned)) {
195  $data = $this->raw(self::FIELD_AMOUNT_PLANNED);
196  if (is_null($data)) {
197  return null;
198  }
199 
200  $this->amountPlanned = CentPrecisionMoneyModel::of($data);
201  }
202 
203  return $this->amountPlanned;
204  }
205 
212  public function getPaymentMethodInfo()
213  {
214  if (is_null($this->paymentMethodInfo)) {
216  $data = $this->raw(self::FIELD_PAYMENT_METHOD_INFO);
217  if (is_null($data)) {
218  return null;
219  }
220 
221  $this->paymentMethodInfo = PaymentMethodInfoModel::of($data);
222  }
223 
225  }
226 
233  public function getTransactions()
234  {
235  if (is_null($this->transactions)) {
237  $data = $this->raw(self::FIELD_TRANSACTIONS);
238  if (is_null($data)) {
239  return null;
240  }
241  $this->transactions = TransactionCollection::fromArray($data);
242  }
243 
244  return $this->transactions;
245  }
246 
253  public function getCustom()
254  {
255  if (is_null($this->custom)) {
257  $data = $this->raw(self::FIELD_CUSTOM);
258  if (is_null($data)) {
259  return null;
260  }
261 
262  $this->custom = CustomFieldsModel::of($data);
263  }
264 
265  return $this->custom;
266  }
267 
268 
272  public function setId(?string $id): void
273  {
274  $this->id = $id;
275  }
276 
280  public function setVersion(?int $version): void
281  {
282  $this->version = $version;
283  }
284 
288  public function setCustomer(?CustomerReference $customer): void
289  {
290  $this->customer = $customer;
291  }
292 
296  public function setAnonymousId(?string $anonymousId): void
297  {
298  $this->anonymousId = $anonymousId;
299  }
300 
305  {
306  $this->amountPlanned = $amountPlanned;
307  }
308 
313  {
314  $this->paymentMethodInfo = $paymentMethodInfo;
315  }
316 
321  {
322  $this->transactions = $transactions;
323  }
324 
328  public function setCustom(?CustomFields $custom): void
329  {
330  $this->custom = $custom;
331  }
332 }
setPaymentMethodInfo(?PaymentMethodInfo $paymentMethodInfo)
setAmountPlanned(?CentPrecisionMoney $amountPlanned)
setCustomer(?CustomerReference $customer)
__construct(?string $id=null, ?int $version=null, ?CustomerReference $customer=null, ?string $anonymousId=null, ?CentPrecisionMoney $amountPlanned=null, ?PaymentMethodInfo $paymentMethodInfo=null, ?TransactionCollection $transactions=null, ?CustomFields $custom=null)
setTransactions(?TransactionCollection $transactions)