commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
PaymentDraftModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
22 use stdClass;
23 
27 final class PaymentDraftModel extends JsonObjectModel implements PaymentDraft
28 {
33  protected $customer;
34 
39  protected $anonymousId;
40 
45  protected $interfaceId;
46 
51  protected $amountPlanned;
52 
57  protected $paymentMethodInfo;
58 
63  protected $paymentStatus;
64 
69  protected $transactions;
70 
76 
81  protected $custom;
82 
87  protected $key;
88 
89 
93  public function __construct(
95  ?string $anonymousId = null,
96  ?string $interfaceId = null,
97  ?Money $amountPlanned = null,
102  ?CustomFieldsDraft $custom = null,
103  ?string $key = null
104  ) {
105  $this->customer = $customer;
106  $this->anonymousId = $anonymousId;
107  $this->interfaceId = $interfaceId;
108  $this->amountPlanned = $amountPlanned;
109  $this->paymentMethodInfo = $paymentMethodInfo;
110  $this->paymentStatus = $paymentStatus;
111  $this->transactions = $transactions;
112  $this->interfaceInteractions = $interfaceInteractions;
113  $this->custom = $custom;
114  $this->key = $key;
115  }
116 
123  public function getCustomer()
124  {
125  if (is_null($this->customer)) {
127  $data = $this->raw(self::FIELD_CUSTOMER);
128  if (is_null($data)) {
129  return null;
130  }
131 
132  $this->customer = CustomerResourceIdentifierModel::of($data);
133  }
134 
135  return $this->customer;
136  }
137 
144  public function getAnonymousId()
145  {
146  if (is_null($this->anonymousId)) {
148  $data = $this->raw(self::FIELD_ANONYMOUS_ID);
149  if (is_null($data)) {
150  return null;
151  }
152  $this->anonymousId = (string) $data;
153  }
154 
155  return $this->anonymousId;
156  }
157 
166  public function getInterfaceId()
167  {
168  if (is_null($this->interfaceId)) {
170  $data = $this->raw(self::FIELD_INTERFACE_ID);
171  if (is_null($data)) {
172  return null;
173  }
174  $this->interfaceId = (string) $data;
175  }
176 
177  return $this->interfaceId;
178  }
179 
187  public function getAmountPlanned()
188  {
189  if (is_null($this->amountPlanned)) {
191  $data = $this->raw(self::FIELD_AMOUNT_PLANNED);
192  if (is_null($data)) {
193  return null;
194  }
195 
196  $this->amountPlanned = MoneyModel::of($data);
197  }
198 
199  return $this->amountPlanned;
200  }
201 
208  public function getPaymentMethodInfo()
209  {
210  if (is_null($this->paymentMethodInfo)) {
212  $data = $this->raw(self::FIELD_PAYMENT_METHOD_INFO);
213  if (is_null($data)) {
214  return null;
215  }
216 
217  $this->paymentMethodInfo = PaymentMethodInfoModel::of($data);
218  }
219 
221  }
222 
229  public function getPaymentStatus()
230  {
231  if (is_null($this->paymentStatus)) {
233  $data = $this->raw(self::FIELD_PAYMENT_STATUS);
234  if (is_null($data)) {
235  return null;
236  }
237 
238  $this->paymentStatus = PaymentStatusDraftModel::of($data);
239  }
240 
241  return $this->paymentStatus;
242  }
243 
250  public function getTransactions()
251  {
252  if (is_null($this->transactions)) {
254  $data = $this->raw(self::FIELD_TRANSACTIONS);
255  if (is_null($data)) {
256  return null;
257  }
258  $this->transactions = TransactionDraftCollection::fromArray($data);
259  }
260 
261  return $this->transactions;
262  }
263 
270  public function getInterfaceInteractions()
271  {
272  if (is_null($this->interfaceInteractions)) {
274  $data = $this->raw(self::FIELD_INTERFACE_INTERACTIONS);
275  if (is_null($data)) {
276  return null;
277  }
278  $this->interfaceInteractions = CustomFieldsDraftCollection::fromArray($data);
279  }
280 
282  }
283 
290  public function getCustom()
291  {
292  if (is_null($this->custom)) {
294  $data = $this->raw(self::FIELD_CUSTOM);
295  if (is_null($data)) {
296  return null;
297  }
298 
299  $this->custom = CustomFieldsDraftModel::of($data);
300  }
301 
302  return $this->custom;
303  }
304 
311  public function getKey()
312  {
313  if (is_null($this->key)) {
315  $data = $this->raw(self::FIELD_KEY);
316  if (is_null($data)) {
317  return null;
318  }
319  $this->key = (string) $data;
320  }
321 
322  return $this->key;
323  }
324 
325 
330  {
331  $this->customer = $customer;
332  }
333 
337  public function setAnonymousId(?string $anonymousId): void
338  {
339  $this->anonymousId = $anonymousId;
340  }
341 
345  public function setInterfaceId(?string $interfaceId): void
346  {
347  $this->interfaceId = $interfaceId;
348  }
349 
353  public function setAmountPlanned(?Money $amountPlanned): void
354  {
355  $this->amountPlanned = $amountPlanned;
356  }
357 
362  {
363  $this->paymentMethodInfo = $paymentMethodInfo;
364  }
365 
370  {
371  $this->paymentStatus = $paymentStatus;
372  }
373 
378  {
379  $this->transactions = $transactions;
380  }
381 
386  {
387  $this->interfaceInteractions = $interfaceInteractions;
388  }
389 
393  public function setCustom(?CustomFieldsDraft $custom): void
394  {
395  $this->custom = $custom;
396  }
397 
401  public function setKey(?string $key): void
402  {
403  $this->key = $key;
404  }
405 }
setInterfaceInteractions(?CustomFieldsDraftCollection $interfaceInteractions)
__construct(?CustomerResourceIdentifier $customer=null, ?string $anonymousId=null, ?string $interfaceId=null, ?Money $amountPlanned=null, ?PaymentMethodInfo $paymentMethodInfo=null, ?PaymentStatusDraft $paymentStatus=null, ?TransactionDraftCollection $transactions=null, ?CustomFieldsDraftCollection $interfaceInteractions=null, ?CustomFieldsDraft $custom=null, ?string $key=null)
setTransactions(?TransactionDraftCollection $transactions)
setPaymentStatus(?PaymentStatusDraft $paymentStatus)
setCustomer(?CustomerResourceIdentifier $customer)
setPaymentMethodInfo(?PaymentMethodInfo $paymentMethodInfo)