|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* MIT License |
|
5
|
|
|
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
namespace SprykerEco\Zed\Payone\Business\Payment\MethodMapper; |
|
9
|
|
|
|
|
10
|
|
|
use Generated\Shared\Transfer\ExpenseTransfer; |
|
11
|
|
|
use Generated\Shared\Transfer\OrderTransfer; |
|
12
|
|
|
use Generated\Shared\Transfer\PayoneAuthorizationTransfer; |
|
13
|
|
|
use Generated\Shared\Transfer\PayoneGetSecurityInvoiceTransfer; |
|
14
|
|
|
use Orm\Zed\Payone\Persistence\SpyPaymentPayone; |
|
15
|
|
|
use Spryker\Shared\Kernel\Store; |
|
16
|
|
|
use SprykerEco\Shared\Payone\PayoneApiConstants; |
|
17
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\AbstractRequestContainer; |
|
18
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\AbstractAuthorizationContainer; |
|
19
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\PaymentMethod\SecurityInvoiceContainer; |
|
20
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\PersonalContainer; |
|
21
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\AuthorizationContainer; |
|
22
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\AuthorizationContainerInterface; |
|
23
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\CaptureContainer; |
|
24
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\ContainerInterface; |
|
25
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\DebitContainer; |
|
26
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\GetSecurityInvoiceContainer; |
|
27
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\Invoicing\ItemContainer; |
|
28
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\PreAuthorizationContainer; |
|
29
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\RefundContainer; |
|
30
|
|
|
use SprykerEco\Zed\Payone\PayoneConfig; |
|
31
|
|
|
|
|
32
|
|
|
class SecurityInvoice extends AbstractMapper |
|
33
|
|
|
{ |
|
34
|
|
|
/** |
|
35
|
|
|
* @var \SprykerEco\Zed\Payone\PayoneConfig |
|
36
|
|
|
*/ |
|
37
|
|
|
protected $payoneConfig; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* @param \Spryker\Shared\Kernel\Store $storeConfig |
|
41
|
|
|
* @param \SprykerEco\Zed\Payone\PayoneConfig $payoneConfig |
|
42
|
|
|
*/ |
|
43
|
|
|
public function __construct(Store $storeConfig, PayoneConfig $payoneConfig) |
|
44
|
|
|
{ |
|
45
|
|
|
parent::__construct($storeConfig); |
|
46
|
|
|
$this->payoneConfig = $payoneConfig; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* @return string |
|
51
|
|
|
*/ |
|
52
|
|
|
public function getName(): string |
|
53
|
|
|
{ |
|
54
|
|
|
return PayoneApiConstants::PAYMENT_METHOD_SECURITY_INVOICE; |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
|
59
|
|
|
* @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer |
|
60
|
|
|
* |
|
61
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\AuthorizationContainerInterface |
|
62
|
|
|
*/ |
|
63
|
|
View Code Duplication |
public function mapPaymentToAuthorization(SpyPaymentPayone $paymentEntity, OrderTransfer $orderTransfer): AuthorizationContainerInterface |
|
|
|
|
|
|
64
|
|
|
{ |
|
65
|
|
|
$authorizationContainer = new AuthorizationContainer(); |
|
66
|
|
|
$authorizationContainer = $this->mapPaymentToAbstractAuthorization($paymentEntity, $authorizationContainer); |
|
67
|
|
|
$authorizationContainer = $this->mapOrderItems($orderTransfer, $authorizationContainer); |
|
68
|
|
|
$authorizationContainer = $this->mapEmail($paymentEntity, $authorizationContainer); |
|
|
|
|
|
|
69
|
|
|
$authorizationContainer = $this->mapBusinessRelation($authorizationContainer); |
|
70
|
|
|
|
|
71
|
|
|
return $authorizationContainer; |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
|
76
|
|
|
* |
|
77
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\AuthorizationContainerInterface |
|
78
|
|
|
*/ |
|
79
|
|
View Code Duplication |
public function mapPaymentToPreAuthorization(SpyPaymentPayone $paymentEntity): AuthorizationContainerInterface |
|
|
|
|
|
|
80
|
|
|
{ |
|
81
|
|
|
$preAuthorizationContainer = new PreAuthorizationContainer(); |
|
82
|
|
|
$preAuthorizationContainer = $this->mapPaymentToAbstractAuthorization($paymentEntity, $preAuthorizationContainer); |
|
83
|
|
|
$preAuthorizationContainer = $this->mapEmail($paymentEntity, $preAuthorizationContainer); |
|
84
|
|
|
$preAuthorizationContainer = $this->mapAmount($paymentEntity, $preAuthorizationContainer); |
|
85
|
|
|
$preAuthorizationContainer = $this->mapBusinessRelation($preAuthorizationContainer); |
|
86
|
|
|
|
|
87
|
|
|
return $preAuthorizationContainer; |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer |
|
92
|
|
|
* @param \SprykerEco\Zed\Payone\Business\Api\Request\Container\AbstractRequestContainer $authorizationContainer |
|
93
|
|
|
* |
|
94
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\ContainerInterface |
|
95
|
|
|
*/ |
|
96
|
|
View Code Duplication |
public function mapOrderItems(OrderTransfer $orderTransfer, AbstractRequestContainer $authorizationContainer): ContainerInterface |
|
|
|
|
|
|
97
|
|
|
{ |
|
98
|
|
|
$arrayIt = []; |
|
99
|
|
|
$arrayId = []; |
|
100
|
|
|
$arrayPr = []; |
|
101
|
|
|
$arrayNo = []; |
|
102
|
|
|
$arrayDe = []; |
|
103
|
|
|
$arrayVa = []; |
|
104
|
|
|
|
|
105
|
|
|
$key = 1; |
|
106
|
|
|
|
|
107
|
|
|
$amount = 0; |
|
108
|
|
|
|
|
109
|
|
|
foreach ($orderTransfer->getItems() as $itemTransfer) { |
|
110
|
|
|
$arrayIt[$key] = PayoneApiConstants::INVOICING_ITEM_TYPE_GOODS; |
|
111
|
|
|
$arrayId[$key] = $itemTransfer->getSku(); |
|
112
|
|
|
$arrayPr[$key] = $itemTransfer->getSumPrice(); |
|
113
|
|
|
$arrayNo[$key] = $itemTransfer->getQuantity(); |
|
114
|
|
|
$arrayDe[$key] = $itemTransfer->getName(); |
|
115
|
|
|
$arrayVa[$key] = (int)$itemTransfer->getTaxRate(); |
|
116
|
|
|
$key++; |
|
117
|
|
|
$amount += $itemTransfer->getSumPrice(); |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
$authorizationContainer->setIt($arrayIt); |
|
121
|
|
|
$authorizationContainer->setId($arrayId); |
|
122
|
|
|
$authorizationContainer->setPr($arrayPr); |
|
123
|
|
|
$authorizationContainer->setNo($arrayNo); |
|
124
|
|
|
$authorizationContainer->setDe($arrayDe); |
|
125
|
|
|
$authorizationContainer->setVa($arrayVa); |
|
126
|
|
|
$authorizationContainer->setAmount($amount); |
|
|
|
|
|
|
127
|
|
|
|
|
128
|
|
|
return $authorizationContainer; |
|
129
|
|
|
} |
|
130
|
|
|
|
|
131
|
|
|
/** |
|
132
|
|
|
* @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer |
|
133
|
|
|
* @param \SprykerEco\Zed\Payone\Business\Api\Request\Container\AbstractRequestContainer $authorizationContainer |
|
134
|
|
|
* |
|
135
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\ContainerInterface |
|
136
|
|
|
*/ |
|
137
|
|
View Code Duplication |
public function mapRefundOrderItems(OrderTransfer $orderTransfer, AbstractRequestContainer $authorizationContainer): ContainerInterface |
|
|
|
|
|
|
138
|
|
|
{ |
|
139
|
|
|
$arrayIt = []; |
|
140
|
|
|
$arrayId = []; |
|
141
|
|
|
$arrayPr = []; |
|
142
|
|
|
$arrayNo = []; |
|
143
|
|
|
$arrayDe = []; |
|
144
|
|
|
$arrayVa = []; |
|
145
|
|
|
|
|
146
|
|
|
$key = 1; |
|
147
|
|
|
|
|
148
|
|
|
$amount = 0; |
|
149
|
|
|
|
|
150
|
|
|
foreach ($orderTransfer->getItems() as $itemTransfer) { |
|
151
|
|
|
$arrayIt[$key] = PayoneApiConstants::INVOICING_ITEM_TYPE_GOODS; |
|
152
|
|
|
$arrayId[$key] = $itemTransfer->getSku(); |
|
153
|
|
|
$arrayPr[$key] = $itemTransfer->getSumPrice(); |
|
154
|
|
|
$arrayNo[$key] = $itemTransfer->getQuantity(); |
|
155
|
|
|
$arrayDe[$key] = $itemTransfer->getName(); |
|
156
|
|
|
$arrayVa[$key] = (int)$itemTransfer->getTaxRate(); |
|
157
|
|
|
$amount += $itemTransfer->getSumPrice(); |
|
158
|
|
|
$key++; |
|
159
|
|
|
} |
|
160
|
|
|
|
|
161
|
|
|
$authorizationContainer->setIt($arrayIt); |
|
162
|
|
|
$authorizationContainer->setId($arrayId); |
|
163
|
|
|
$authorizationContainer->setPr($arrayPr); |
|
164
|
|
|
$authorizationContainer->setNo($arrayNo); |
|
165
|
|
|
$authorizationContainer->setDe($arrayDe); |
|
166
|
|
|
$authorizationContainer->setVa($arrayVa); |
|
167
|
|
|
$authorizationContainer->setAmount(0 - $amount); |
|
|
|
|
|
|
168
|
|
|
|
|
169
|
|
|
return $authorizationContainer; |
|
170
|
|
|
} |
|
171
|
|
|
|
|
172
|
|
|
/** |
|
173
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
|
174
|
|
|
* @param \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\AbstractAuthorizationContainer $container |
|
175
|
|
|
* |
|
176
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\AbstractAuthorizationContainer |
|
177
|
|
|
*/ |
|
178
|
|
|
public function mapEmail(SpyPaymentPayone $paymentEntity, AbstractAuthorizationContainer $container): AbstractAuthorizationContainer |
|
179
|
|
|
{ |
|
180
|
|
|
$container->setEmail($paymentEntity->getSpySalesOrder()->getEmail()); |
|
181
|
|
|
|
|
182
|
|
|
return $container; |
|
183
|
|
|
} |
|
184
|
|
|
|
|
185
|
|
|
/** |
|
186
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
|
187
|
|
|
* @param \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\AbstractAuthorizationContainer $container |
|
188
|
|
|
* |
|
189
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\AbstractAuthorizationContainer |
|
190
|
|
|
*/ |
|
191
|
|
|
public function mapAmount(SpyPaymentPayone $paymentEntity, AbstractAuthorizationContainer $container): AbstractAuthorizationContainer |
|
192
|
|
|
{ |
|
193
|
|
|
$container->setAmount($paymentEntity->getSpySalesOrder()->getOrderTotals()->get(0)->getSubTotal()); |
|
194
|
|
|
|
|
195
|
|
|
return $container; |
|
196
|
|
|
} |
|
197
|
|
|
|
|
198
|
|
|
/** |
|
199
|
|
|
* @param \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\AbstractAuthorizationContainer $container |
|
200
|
|
|
* |
|
201
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\AbstractAuthorizationContainer |
|
202
|
|
|
*/ |
|
203
|
|
|
public function mapBusinessRelation(AbstractAuthorizationContainer $container): AbstractAuthorizationContainer |
|
204
|
|
|
{ |
|
205
|
|
|
$container->setBusinessrelation($this->payoneConfig->getBusinessRelation()); |
|
206
|
|
|
|
|
207
|
|
|
return $container; |
|
208
|
|
|
} |
|
209
|
|
|
|
|
210
|
|
|
/** |
|
211
|
|
|
* @param \Generated\Shared\Transfer\ExpenseTransfer $expense |
|
212
|
|
|
* |
|
213
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\Invoicing\ItemContainer |
|
214
|
|
|
*/ |
|
215
|
|
View Code Duplication |
public function mapExpenseToItemContainer(ExpenseTransfer $expense) |
|
|
|
|
|
|
216
|
|
|
{ |
|
217
|
|
|
$itemContainer = new ItemContainer(); |
|
218
|
|
|
$itemContainer->setIt(PayoneApiConstants::INVOICING_ITEM_TYPE_SHIPMENT); |
|
219
|
|
|
$itemContainer->setId('-'); |
|
220
|
|
|
$itemContainer->setPr($expense->getUnitGrossPrice()); |
|
221
|
|
|
$itemContainer->setNo($expense->getQuantity()); |
|
222
|
|
|
$itemContainer->setDe($expense->getName()); |
|
223
|
|
|
$itemContainer->setVa($expense->getTaxRate()); |
|
224
|
|
|
|
|
225
|
|
|
return $itemContainer; |
|
226
|
|
|
} |
|
227
|
|
|
|
|
228
|
|
|
/** |
|
229
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
|
230
|
|
|
* @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer |
|
231
|
|
|
* |
|
232
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\AbstractRequestContainer |
|
233
|
|
|
*/ |
|
234
|
|
View Code Duplication |
public function mapPaymentToCapture(SpyPaymentPayone $paymentEntity, OrderTransfer $orderTransfer): AbstractRequestContainer |
|
|
|
|
|
|
235
|
|
|
{ |
|
236
|
|
|
$paymentDetailEntity = $paymentEntity->getSpyPaymentPayoneDetail(); |
|
|
|
|
|
|
237
|
|
|
|
|
238
|
|
|
$captureContainer = new CaptureContainer(); |
|
239
|
|
|
$captureContainer = $this->mapOrderItems($orderTransfer, $captureContainer); |
|
240
|
|
|
$captureContainer->setCurrency($this->getStandardParameter()->getCurrency()); |
|
241
|
|
|
$captureContainer->setTxid($paymentEntity->getTransactionId()); |
|
242
|
|
|
|
|
243
|
|
|
return $captureContainer; |
|
244
|
|
|
} |
|
245
|
|
|
|
|
246
|
|
|
/** |
|
247
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
|
248
|
|
|
* @param \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\AbstractAuthorizationContainer $authorizationContainer |
|
249
|
|
|
* |
|
250
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\AbstractAuthorizationContainer |
|
251
|
|
|
*/ |
|
252
|
|
View Code Duplication |
protected function mapPaymentToAbstractAuthorization(SpyPaymentPayone $paymentEntity, AbstractAuthorizationContainer $authorizationContainer): AbstractAuthorizationContainer |
|
|
|
|
|
|
253
|
|
|
{ |
|
254
|
|
|
$paymentDetailEntity = $paymentEntity->getSpyPaymentPayoneDetail(); |
|
|
|
|
|
|
255
|
|
|
|
|
256
|
|
|
$authorizationContainer->setAid($this->getStandardParameter()->getAid()); |
|
257
|
|
|
$authorizationContainer->setClearingType(PayoneApiConstants::CLEARING_TYPE_SECURITY_INVOICE); |
|
258
|
|
|
$authorizationContainer->setClearingsubtype(PayoneApiConstants::CLEARING_SUBTYPE_SECURITY_INVOICE); |
|
259
|
|
|
$authorizationContainer->setReference($paymentEntity->getReference()); |
|
260
|
|
|
$authorizationContainer->setCurrency($this->getStandardParameter()->getCurrency()); |
|
261
|
|
|
$authorizationContainer->setPaymentMethod($this->createPaymentMethodContainerFromPayment($paymentEntity)); |
|
|
|
|
|
|
262
|
|
|
|
|
263
|
|
|
$personalContainer = new PersonalContainer(); |
|
264
|
|
|
$this->mapBillingAddressToPersonalContainer($personalContainer, $paymentEntity); |
|
265
|
|
|
|
|
266
|
|
|
$authorizationContainer->setPersonalData($personalContainer); |
|
267
|
|
|
|
|
268
|
|
|
return $authorizationContainer; |
|
269
|
|
|
} |
|
270
|
|
|
|
|
271
|
|
|
/** |
|
272
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
|
273
|
|
|
* |
|
274
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\ContainerInterface |
|
275
|
|
|
*/ |
|
276
|
|
|
public function mapPaymentToDebit(SpyPaymentPayone $paymentEntity): ContainerInterface |
|
277
|
|
|
{ |
|
278
|
|
|
$debitContainer = new DebitContainer(); |
|
279
|
|
|
|
|
280
|
|
|
$debitContainer->setTxid($paymentEntity->getTransactionId()); |
|
281
|
|
|
$debitContainer->setSequenceNumber($this->getNextSequenceNumber($paymentEntity->getTransactionId())); |
|
282
|
|
|
$debitContainer->setCurrency($this->getStandardParameter()->getCurrency()); |
|
283
|
|
|
$debitContainer->setAmount($paymentEntity->getSpyPaymentPayoneDetail()->getAmount()); |
|
284
|
|
|
|
|
285
|
|
|
return $debitContainer; |
|
286
|
|
|
} |
|
287
|
|
|
|
|
288
|
|
|
/** |
|
289
|
|
|
* @param \Generated\Shared\Transfer\PayoneGetSecurityInvoiceTransfer $getSecurityInvoiceTransfer |
|
290
|
|
|
* |
|
291
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\ContainerInterface |
|
292
|
|
|
*/ |
|
293
|
|
|
public function mapGetSecurityInvoice(PayoneGetSecurityInvoiceTransfer $getSecurityInvoiceTransfer): ContainerInterface |
|
294
|
|
|
{ |
|
295
|
|
|
$getInvoiceContainer = new GetSecurityInvoiceContainer(); |
|
296
|
|
|
$getInvoiceContainer->setInvoiceTitle($getSecurityInvoiceTransfer->getReference()); |
|
297
|
|
|
|
|
298
|
|
|
return $getInvoiceContainer; |
|
299
|
|
|
} |
|
300
|
|
|
|
|
301
|
|
|
/** |
|
302
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
|
303
|
|
|
* @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer |
|
304
|
|
|
* |
|
305
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\AbstractRequestContainer |
|
306
|
|
|
*/ |
|
307
|
|
|
public function mapPaymentToRefund(SpyPaymentPayone $paymentEntity, OrderTransfer $orderTransfer): AbstractRequestContainer |
|
308
|
|
|
{ |
|
309
|
|
|
$refundContainer = new RefundContainer(); |
|
310
|
|
|
|
|
311
|
|
|
$refundContainer = $this->mapRefundOrderItems($orderTransfer, $refundContainer); |
|
312
|
|
|
$refundContainer->setTxid($paymentEntity->getTransactionId()); |
|
313
|
|
|
$refundContainer->setSequenceNumber($this->getNextSequenceNumber($paymentEntity->getTransactionId())); |
|
314
|
|
|
$refundContainer->setCurrency($this->getStandardParameter()->getCurrency()); |
|
315
|
|
|
$refundContainer->setBankcountry($paymentEntity->getSpyPaymentPayoneDetail()->getBankCountry()); |
|
316
|
|
|
$refundContainer->setBankaccount($paymentEntity->getSpyPaymentPayoneDetail()->getBankAccount()); |
|
317
|
|
|
$refundContainer->setBankcode($paymentEntity->getSpyPaymentPayoneDetail()->getBankCode()); |
|
318
|
|
|
$refundContainer->setBankbranchcode($paymentEntity->getSpyPaymentPayoneDetail()->getBankBranchCode()); |
|
319
|
|
|
$refundContainer->setBankcheckdigit($paymentEntity->getSpyPaymentPayoneDetail()->getBankCheckDigit()); |
|
320
|
|
|
$refundContainer->setIban($paymentEntity->getSpyPaymentPayoneDetail()->getIban()); |
|
321
|
|
|
$refundContainer->setBic($paymentEntity->getSpyPaymentPayoneDetail()->getBic()); |
|
322
|
|
|
|
|
323
|
|
|
return $refundContainer; |
|
324
|
|
|
} |
|
325
|
|
|
|
|
326
|
|
|
/** |
|
327
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
|
328
|
|
|
* |
|
329
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\ContainerInterface |
|
330
|
|
|
*/ |
|
331
|
|
|
protected function createPaymentMethodContainerFromPayment(SpyPaymentPayone $paymentEntity): ContainerInterface |
|
|
|
|
|
|
332
|
|
|
{ |
|
333
|
|
|
$paymentMethodContainer = new SecurityInvoiceContainer(); |
|
334
|
|
|
|
|
335
|
|
|
return $paymentMethodContainer; |
|
336
|
|
|
} |
|
337
|
|
|
|
|
338
|
|
|
/** |
|
339
|
|
|
* @param \Generated\Shared\Transfer\PayoneAuthorizationTransfer $payoneAuthorizationTransfer |
|
340
|
|
|
* |
|
341
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\ContainerInterface |
|
342
|
|
|
*/ |
|
343
|
|
View Code Duplication |
protected function createAuthorizationPersonalData(PayoneAuthorizationTransfer $payoneAuthorizationTransfer): ContainerInterface |
|
|
|
|
|
|
344
|
|
|
{ |
|
345
|
|
|
$personalContainer = new PersonalContainer(); |
|
346
|
|
|
|
|
347
|
|
|
$personalContainer->setFirstName($payoneAuthorizationTransfer->getOrder()->getFirstName()); |
|
348
|
|
|
$personalContainer->setLastName($payoneAuthorizationTransfer->getOrder()->getLastName()); |
|
349
|
|
|
$personalContainer->setCountry($this->storeConfig->getCurrentCountry()); |
|
350
|
|
|
|
|
351
|
|
|
return $personalContainer; |
|
352
|
|
|
} |
|
353
|
|
|
} |
|
354
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.