commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
MyTransactionDraftBuilder.php
1<?php
2
3declare(strict_types=1);
10
20use DateTimeImmutable;
21use stdClass;
22
26final class MyTransactionDraftBuilder implements Builder
27{
32 private $timestamp;
33
38 private $type;
39
44 private $amount;
45
50 private $interactionId;
51
56 private $custom;
57
62 private $interfaceId;
63
70 public function getTimestamp()
71 {
72 return $this->timestamp;
73 }
74
82 public function getType()
83 {
84 return $this->type;
85 }
86
93 public function getAmount()
94 {
95 return $this->amount instanceof MoneyBuilder ? $this->amount->build() : $this->amount;
96 }
97
105 public function getInteractionId()
106 {
107 return $this->interactionId;
108 }
109
116 public function getCustom()
117 {
118 return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
119 }
120
127 public function getInterfaceId()
128 {
129 return $this->interfaceId;
130 }
131
136 public function withTimestamp(?DateTimeImmutable $timestamp)
137 {
138 $this->timestamp = $timestamp;
139
140 return $this;
141 }
142
147 public function withType(?string $type)
148 {
149 $this->type = $type;
150
151 return $this;
152 }
153
158 public function withAmount(?Money $amount)
159 {
160 $this->amount = $amount;
161
162 return $this;
163 }
164
169 public function withInteractionId(?string $interactionId)
170 {
171 $this->interactionId = $interactionId;
172
173 return $this;
174 }
175
180 public function withCustom(?CustomFieldsDraft $custom)
181 {
182 $this->custom = $custom;
183
184 return $this;
185 }
186
191 public function withInterfaceId(?string $interfaceId)
192 {
193 $this->interfaceId = $interfaceId;
194
195 return $this;
196 }
197
202 public function withAmountBuilder(?MoneyBuilder $amount)
203 {
204 $this->amount = $amount;
205
206 return $this;
207 }
208
214 {
215 $this->custom = $custom;
216
217 return $this;
218 }
219
220 public function build(): MyTransactionDraft
221 {
222 return new MyTransactionDraftModel(
223 $this->timestamp,
224 $this->type,
225 $this->amount instanceof MoneyBuilder ? $this->amount->build() : $this->amount,
226 $this->interactionId,
227 $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom,
228 $this->interfaceId
229 );
230 }
231
232 public static function of(): MyTransactionDraftBuilder
233 {
234 return new self();
235 }
236}