commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
PaymentDraftBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
23 use stdClass;
24 
28 final class PaymentDraftBuilder implements Builder
29 {
34  private $customer;
35 
40  private $anonymousId;
41 
46  private $interfaceId;
47 
52  private $amountPlanned;
53 
58  private $paymentMethodInfo;
59 
64  private $paymentStatus;
65 
70  private $transactions;
71 
76  private $interfaceInteractions;
77 
82  private $custom;
83 
88  private $key;
89 
96  public function getCustomer()
97  {
98  return $this->customer instanceof CustomerResourceIdentifierBuilder ? $this->customer->build() : $this->customer;
99  }
100 
107  public function getAnonymousId()
108  {
109  return $this->anonymousId;
110  }
111 
120  public function getInterfaceId()
121  {
122  return $this->interfaceId;
123  }
124 
132  public function getAmountPlanned()
133  {
134  return $this->amountPlanned instanceof MoneyBuilder ? $this->amountPlanned->build() : $this->amountPlanned;
135  }
136 
143  public function getPaymentMethodInfo()
144  {
145  return $this->paymentMethodInfo instanceof PaymentMethodInfoBuilder ? $this->paymentMethodInfo->build() : $this->paymentMethodInfo;
146  }
147 
154  public function getPaymentStatus()
155  {
156  return $this->paymentStatus instanceof PaymentStatusDraftBuilder ? $this->paymentStatus->build() : $this->paymentStatus;
157  }
158 
165  public function getTransactions()
166  {
167  return $this->transactions;
168  }
169 
176  public function getInterfaceInteractions()
177  {
178  return $this->interfaceInteractions;
179  }
180 
187  public function getCustom()
188  {
189  return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
190  }
191 
198  public function getKey()
199  {
200  return $this->key;
201  }
202 
207  public function withCustomer(?CustomerResourceIdentifier $customer)
208  {
209  $this->customer = $customer;
210 
211  return $this;
212  }
213 
218  public function withAnonymousId(?string $anonymousId)
219  {
220  $this->anonymousId = $anonymousId;
221 
222  return $this;
223  }
224 
229  public function withInterfaceId(?string $interfaceId)
230  {
231  $this->interfaceId = $interfaceId;
232 
233  return $this;
234  }
235 
240  public function withAmountPlanned(?Money $amountPlanned)
241  {
242  $this->amountPlanned = $amountPlanned;
243 
244  return $this;
245  }
246 
251  public function withPaymentMethodInfo(?PaymentMethodInfo $paymentMethodInfo)
252  {
253  $this->paymentMethodInfo = $paymentMethodInfo;
254 
255  return $this;
256  }
257 
262  public function withPaymentStatus(?PaymentStatusDraft $paymentStatus)
263  {
264  $this->paymentStatus = $paymentStatus;
265 
266  return $this;
267  }
268 
273  public function withTransactions(?TransactionDraftCollection $transactions)
274  {
275  $this->transactions = $transactions;
276 
277  return $this;
278  }
279 
284  public function withInterfaceInteractions(?CustomFieldsDraftCollection $interfaceInteractions)
285  {
286  $this->interfaceInteractions = $interfaceInteractions;
287 
288  return $this;
289  }
290 
295  public function withCustom(?CustomFieldsDraft $custom)
296  {
297  $this->custom = $custom;
298 
299  return $this;
300  }
301 
306  public function withKey(?string $key)
307  {
308  $this->key = $key;
309 
310  return $this;
311  }
312 
318  {
319  $this->customer = $customer;
320 
321  return $this;
322  }
323 
328  public function withAmountPlannedBuilder(?MoneyBuilder $amountPlanned)
329  {
330  $this->amountPlanned = $amountPlanned;
331 
332  return $this;
333  }
334 
339  public function withPaymentMethodInfoBuilder(?PaymentMethodInfoBuilder $paymentMethodInfo)
340  {
341  $this->paymentMethodInfo = $paymentMethodInfo;
342 
343  return $this;
344  }
345 
350  public function withPaymentStatusBuilder(?PaymentStatusDraftBuilder $paymentStatus)
351  {
352  $this->paymentStatus = $paymentStatus;
353 
354  return $this;
355  }
356 
361  public function withCustomBuilder(?CustomFieldsDraftBuilder $custom)
362  {
363  $this->custom = $custom;
364 
365  return $this;
366  }
367 
368  public function build(): PaymentDraft
369  {
370  return new PaymentDraftModel(
371  $this->customer instanceof CustomerResourceIdentifierBuilder ? $this->customer->build() : $this->customer,
372  $this->anonymousId,
373  $this->interfaceId,
374  $this->amountPlanned instanceof MoneyBuilder ? $this->amountPlanned->build() : $this->amountPlanned,
375  $this->paymentMethodInfo instanceof PaymentMethodInfoBuilder ? $this->paymentMethodInfo->build() : $this->paymentMethodInfo,
376  $this->paymentStatus instanceof PaymentStatusDraftBuilder ? $this->paymentStatus->build() : $this->paymentStatus,
377  $this->transactions,
378  $this->interfaceInteractions,
379  $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom,
380  $this->key
381  );
382  }
383 
384  public static function of(): PaymentDraftBuilder
385  {
386  return new self();
387  }
388 }
withTransactions(?TransactionDraftCollection $transactions)
withPaymentMethodInfoBuilder(?PaymentMethodInfoBuilder $paymentMethodInfo)
withInterfaceInteractions(?CustomFieldsDraftCollection $interfaceInteractions)
withPaymentStatus(?PaymentStatusDraft $paymentStatus)
withCustomerBuilder(?CustomerResourceIdentifierBuilder $customer)
withCustomer(?CustomerResourceIdentifier $customer)
withPaymentMethodInfo(?PaymentMethodInfo $paymentMethodInfo)
withPaymentStatusBuilder(?PaymentStatusDraftBuilder $paymentStatus)