commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
PaymentMethodInfoBuilder.php
1<?php
2
3declare(strict_types=1);
10
22use stdClass;
23
27final class PaymentMethodInfoBuilder implements Builder
28{
33 private $paymentInterface;
34
39 private $method;
40
45 private $name;
46
51 private $token;
52
57 private $interfaceAccount;
58
63 private $custom;
64
72 public function getPaymentInterface()
73 {
74 return $this->paymentInterface;
75 }
76
83 public function getMethod()
84 {
85 return $this->method;
86 }
87
94 public function getName()
95 {
96 return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
97 }
98
105 public function getToken()
106 {
107 return $this->token instanceof PaymentMethodTokenBuilder ? $this->token->build() : $this->token;
108 }
109
116 public function getInterfaceAccount()
117 {
118 return $this->interfaceAccount;
119 }
120
127 public function getCustom()
128 {
129 return $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom;
130 }
131
136 public function withPaymentInterface(?string $paymentInterface)
137 {
138 $this->paymentInterface = $paymentInterface;
139
140 return $this;
141 }
142
147 public function withMethod(?string $method)
148 {
149 $this->method = $method;
150
151 return $this;
152 }
153
158 public function withName(?LocalizedString $name)
159 {
160 $this->name = $name;
161
162 return $this;
163 }
164
169 public function withToken(?PaymentMethodToken $token)
170 {
171 $this->token = $token;
172
173 return $this;
174 }
175
180 public function withInterfaceAccount(?string $interfaceAccount)
181 {
182 $this->interfaceAccount = $interfaceAccount;
183
184 return $this;
185 }
186
191 public function withCustom(?CustomFields $custom)
192 {
193 $this->custom = $custom;
194
195 return $this;
196 }
197
203 {
204 $this->name = $name;
205
206 return $this;
207 }
208
214 {
215 $this->token = $token;
216
217 return $this;
218 }
219
224 public function withCustomBuilder(?CustomFieldsBuilder $custom)
225 {
226 $this->custom = $custom;
227
228 return $this;
229 }
230
231 public function build(): PaymentMethodInfo
232 {
233 return new PaymentMethodInfoModel(
234 $this->paymentInterface,
235 $this->method,
236 $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
237 $this->token instanceof PaymentMethodTokenBuilder ? $this->token->build() : $this->token,
238 $this->interfaceAccount,
239 $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom
240 );
241 }
242
243 public static function of(): PaymentMethodInfoBuilder
244 {
245 return new self();
246 }
247}