commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
MyPaymentBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
25 use stdClass;
26 
30 final class MyPaymentBuilder implements Builder
31 {
36  private $id;
37 
42  private $version;
43 
48  private $customer;
49 
54  private $anonymousId;
55 
60  private $amountPlanned;
61 
66  private $paymentMethodInfo;
67 
72  private $transactions;
73 
78  private $custom;
79 
86  public function getId()
87  {
88  return $this->id;
89  }
90 
97  public function getVersion()
98  {
99  return $this->version;
100  }
101 
108  public function getCustomer()
109  {
110  return $this->customer instanceof CustomerReferenceBuilder ? $this->customer->build() : $this->customer;
111  }
112 
119  public function getAnonymousId()
120  {
121  return $this->anonymousId;
122  }
123 
131  public function getAmountPlanned()
132  {
133  return $this->amountPlanned instanceof CentPrecisionMoneyBuilder ? $this->amountPlanned->build() : $this->amountPlanned;
134  }
135 
142  public function getPaymentMethodInfo()
143  {
144  return $this->paymentMethodInfo instanceof PaymentMethodInfoBuilder ? $this->paymentMethodInfo->build() : $this->paymentMethodInfo;
145  }
146 
153  public function getTransactions()
154  {
155  return $this->transactions;
156  }
157 
164  public function getCustom()
165  {
166  return $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom;
167  }
168 
173  public function withId(?string $id)
174  {
175  $this->id = $id;
176 
177  return $this;
178  }
179 
184  public function withVersion(?int $version)
185  {
186  $this->version = $version;
187 
188  return $this;
189  }
190 
195  public function withCustomer(?CustomerReference $customer)
196  {
197  $this->customer = $customer;
198 
199  return $this;
200  }
201 
206  public function withAnonymousId(?string $anonymousId)
207  {
208  $this->anonymousId = $anonymousId;
209 
210  return $this;
211  }
212 
217  public function withAmountPlanned(?CentPrecisionMoney $amountPlanned)
218  {
219  $this->amountPlanned = $amountPlanned;
220 
221  return $this;
222  }
223 
228  public function withPaymentMethodInfo(?PaymentMethodInfo $paymentMethodInfo)
229  {
230  $this->paymentMethodInfo = $paymentMethodInfo;
231 
232  return $this;
233  }
234 
239  public function withTransactions(?TransactionCollection $transactions)
240  {
241  $this->transactions = $transactions;
242 
243  return $this;
244  }
245 
250  public function withCustom(?CustomFields $custom)
251  {
252  $this->custom = $custom;
253 
254  return $this;
255  }
256 
261  public function withCustomerBuilder(?CustomerReferenceBuilder $customer)
262  {
263  $this->customer = $customer;
264 
265  return $this;
266  }
267 
272  public function withAmountPlannedBuilder(?CentPrecisionMoneyBuilder $amountPlanned)
273  {
274  $this->amountPlanned = $amountPlanned;
275 
276  return $this;
277  }
278 
283  public function withPaymentMethodInfoBuilder(?PaymentMethodInfoBuilder $paymentMethodInfo)
284  {
285  $this->paymentMethodInfo = $paymentMethodInfo;
286 
287  return $this;
288  }
289 
294  public function withCustomBuilder(?CustomFieldsBuilder $custom)
295  {
296  $this->custom = $custom;
297 
298  return $this;
299  }
300 
301  public function build(): MyPayment
302  {
303  return new MyPaymentModel(
304  $this->id,
305  $this->version,
306  $this->customer instanceof CustomerReferenceBuilder ? $this->customer->build() : $this->customer,
307  $this->anonymousId,
308  $this->amountPlanned instanceof CentPrecisionMoneyBuilder ? $this->amountPlanned->build() : $this->amountPlanned,
309  $this->paymentMethodInfo instanceof PaymentMethodInfoBuilder ? $this->paymentMethodInfo->build() : $this->paymentMethodInfo,
310  $this->transactions,
311  $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom
312  );
313  }
314 
315  public static function of(): MyPaymentBuilder
316  {
317  return new self();
318  }
319 }
withPaymentMethodInfo(?PaymentMethodInfo $paymentMethodInfo)
withTransactions(?TransactionCollection $transactions)
withPaymentMethodInfoBuilder(?PaymentMethodInfoBuilder $paymentMethodInfo)
withCustomer(?CustomerReference $customer)
withAmountPlannedBuilder(?CentPrecisionMoneyBuilder $amountPlanned)
withCustomBuilder(?CustomFieldsBuilder $custom)
withAmountPlanned(?CentPrecisionMoney $amountPlanned)
withCustomerBuilder(?CustomerReferenceBuilder $customer)