|
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\OrderTransfer; |
|
|
|
|
|
|
11
|
|
|
use Generated\Shared\Transfer\PayoneBankAccountCheckTransfer; |
|
|
|
|
|
|
12
|
|
|
use Orm\Zed\Payone\Persistence\SpyPaymentPayone; |
|
|
|
|
|
|
13
|
|
|
use SprykerEco\Shared\Payone\PayoneApiConstants; |
|
14
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\AbstractAuthorizationContainer; |
|
15
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\PaymentMethod\OnlineBankTransferContainer; |
|
16
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\PersonalContainer; |
|
17
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\AuthorizationContainer; |
|
18
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\BankAccountCheckContainer; |
|
19
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\CaptureContainer; |
|
20
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\CaptureContainerInterface; |
|
21
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\DebitContainer; |
|
22
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\DebitContainerInterface; |
|
23
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\PreAuthorizationContainer; |
|
24
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\PreAuthorizationContainerInterface; |
|
25
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\RefundContainer; |
|
26
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\RefundContainerInterface; |
|
27
|
|
|
|
|
28
|
|
|
class OnlineBankTransfer extends AbstractMapper |
|
29
|
|
|
{ |
|
30
|
|
|
/** |
|
31
|
|
|
* @return string |
|
32
|
|
|
*/ |
|
33
|
|
|
public function getName(): string |
|
34
|
|
|
{ |
|
35
|
|
|
return PayoneApiConstants::PAYMENT_METHOD_ONLINE_BANK_TRANSFER; |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
|
40
|
|
|
* @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer |
|
41
|
|
|
* |
|
42
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\AuthorizationContainer |
|
43
|
|
|
*/ |
|
44
|
|
|
public function mapPaymentToAuthorization(SpyPaymentPayone $paymentEntity, OrderTransfer $orderTransfer): AbstractAuthorizationContainer |
|
45
|
|
|
{ |
|
46
|
|
|
$authorizationContainer = new AuthorizationContainer(); |
|
47
|
|
|
$authorizationContainer = $this->mapPaymentToAbstractAuthorization($paymentEntity, $authorizationContainer); |
|
48
|
|
|
|
|
49
|
|
|
return $authorizationContainer; |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
|
54
|
|
|
* |
|
55
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\CaptureContainerInterface |
|
56
|
|
|
*/ |
|
57
|
|
|
public function mapPaymentToCapture(SpyPaymentPayone $paymentEntity): CaptureContainerInterface |
|
58
|
|
|
{ |
|
59
|
|
|
$paymentDetailEntity = $paymentEntity->getSpyPaymentPayoneDetail(); |
|
60
|
|
|
|
|
61
|
|
|
$captureContainer = new CaptureContainer(); |
|
62
|
|
|
$captureContainer->setAmount($paymentDetailEntity->getAmount()); |
|
63
|
|
|
$captureContainer->setCurrency($this->getStandardParameter()->getCurrency()); |
|
64
|
|
|
$captureContainer->setTxid($paymentEntity->getTransactionId()); |
|
65
|
|
|
$captureContainer->setSequenceNumber($this->getNextSequenceNumber($paymentEntity->getTransactionId())); |
|
66
|
|
|
|
|
67
|
|
|
return $captureContainer; |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
|
72
|
|
|
* |
|
73
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\PreAuthorizationContainerInterface |
|
74
|
|
|
*/ |
|
75
|
|
|
public function mapPaymentToPreAuthorization(SpyPaymentPayone $paymentEntity): PreAuthorizationContainerInterface |
|
76
|
|
|
{ |
|
77
|
|
|
$preAuthorizationContainer = new PreAuthorizationContainer(); |
|
78
|
|
|
$preAuthorizationContainer = $this->mapPaymentToAbstractAuthorization($paymentEntity, $preAuthorizationContainer); |
|
79
|
|
|
|
|
80
|
|
|
return $preAuthorizationContainer; |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
|
85
|
|
|
* @param \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\AbstractAuthorizationContainer $authorizationContainer |
|
86
|
|
|
* |
|
87
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\AbstractAuthorizationContainer |
|
88
|
|
|
*/ |
|
89
|
|
|
protected function mapPaymentToAbstractAuthorization(SpyPaymentPayone $paymentEntity, AbstractAuthorizationContainer $authorizationContainer) |
|
90
|
|
|
{ |
|
91
|
|
|
$paymentDetailEntity = $paymentEntity->getSpyPaymentPayoneDetail(); |
|
92
|
|
|
|
|
93
|
|
|
$authorizationContainer->setAid($this->getStandardParameter()->getAid()); |
|
94
|
|
|
$authorizationContainer->setClearingType(PayoneApiConstants::CLEARING_TYPE_ONLINE_BANK_TRANSFER); |
|
95
|
|
|
$authorizationContainer->setReference($paymentEntity->getReference()); |
|
96
|
|
|
$authorizationContainer->setAmount($paymentDetailEntity->getAmount()); |
|
97
|
|
|
$authorizationContainer->setCurrency($this->getStandardParameter()->getCurrency()); |
|
98
|
|
|
$authorizationContainer->setPaymentMethod($this->createPaymentMethodContainerFromPayment($paymentEntity)); |
|
99
|
|
|
|
|
100
|
|
|
$personalContainer = new PersonalContainer(); |
|
101
|
|
|
$this->mapBillingAddressToPersonalContainer($personalContainer, $paymentEntity); |
|
102
|
|
|
$personalContainer->setLanguage($this->getStandardParameter()->getLanguage()); |
|
103
|
|
|
|
|
104
|
|
|
$authorizationContainer->setPersonalData($personalContainer); |
|
105
|
|
|
|
|
106
|
|
|
return $authorizationContainer; |
|
107
|
|
|
} |
|
108
|
|
|
|
|
109
|
|
|
/** |
|
110
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
|
111
|
|
|
* |
|
112
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\DebitContainerInterface |
|
113
|
|
|
*/ |
|
114
|
|
|
public function mapPaymentToDebit(SpyPaymentPayone $paymentEntity): DebitContainerInterface |
|
115
|
|
|
{ |
|
116
|
|
|
$debitContainer = new DebitContainer(); |
|
117
|
|
|
|
|
118
|
|
|
$debitContainer->setTxid($paymentEntity->getTransactionId()); |
|
119
|
|
|
$debitContainer->setSequenceNumber($this->getNextSequenceNumber($paymentEntity->getTransactionId())); |
|
120
|
|
|
$debitContainer->setCurrency($this->getStandardParameter()->getCurrency()); |
|
121
|
|
|
$debitContainer->setAmount($paymentEntity->getSpyPaymentPayoneDetail()->getAmount()); |
|
122
|
|
|
|
|
123
|
|
|
return $debitContainer; |
|
124
|
|
|
} |
|
125
|
|
|
|
|
126
|
|
|
/** |
|
127
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
|
128
|
|
|
* |
|
129
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\RefundContainerInterface |
|
130
|
|
|
*/ |
|
131
|
|
|
public function mapPaymentToRefund(SpyPaymentPayone $paymentEntity): RefundContainerInterface |
|
132
|
|
|
{ |
|
133
|
|
|
$refundContainer = new RefundContainer(); |
|
134
|
|
|
|
|
135
|
|
|
$refundContainer->setTxid($paymentEntity->getTransactionId()); |
|
136
|
|
|
$refundContainer->setSequenceNumber($this->getNextSequenceNumber($paymentEntity->getTransactionId())); |
|
137
|
|
|
$refundContainer->setCurrency($this->getStandardParameter()->getCurrency()); |
|
138
|
|
|
|
|
139
|
|
|
$refundContainer->setBankcountry($paymentEntity->getSpyPaymentPayoneDetail()->getBankCountry()); |
|
140
|
|
|
$refundContainer->setBankaccount($paymentEntity->getSpyPaymentPayoneDetail()->getBankAccount()); |
|
141
|
|
|
$refundContainer->setBankcode($paymentEntity->getSpyPaymentPayoneDetail()->getBankCode()); |
|
142
|
|
|
$refundContainer->setBankbranchcode($paymentEntity->getSpyPaymentPayoneDetail()->getBankBranchCode()); |
|
143
|
|
|
$refundContainer->setBankcheckdigit($paymentEntity->getSpyPaymentPayoneDetail()->getBankCheckDigit()); |
|
144
|
|
|
$refundContainer->setIban($paymentEntity->getSpyPaymentPayoneDetail()->getIban()); |
|
145
|
|
|
$refundContainer->setBic($paymentEntity->getSpyPaymentPayoneDetail()->getBic()); |
|
146
|
|
|
|
|
147
|
|
|
return $refundContainer; |
|
148
|
|
|
} |
|
149
|
|
|
|
|
150
|
|
|
/** |
|
151
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
|
152
|
|
|
* |
|
153
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\PaymentMethod\OnlineBankTransferContainer |
|
154
|
|
|
*/ |
|
155
|
|
|
protected function createPaymentMethodContainerFromPayment(SpyPaymentPayone $paymentEntity) |
|
156
|
|
|
{ |
|
157
|
|
|
$paymentDetailEntity = $paymentEntity->getSpyPaymentPayoneDetail(); |
|
158
|
|
|
|
|
159
|
|
|
$paymentMethodContainer = new OnlineBankTransferContainer(); |
|
160
|
|
|
|
|
161
|
|
|
$paymentMethodContainer->setOnlineBankTransferType($paymentDetailEntity->getType()); |
|
162
|
|
|
$paymentMethodContainer->setRedirect($this->createRedirectContainer($paymentEntity->getSpySalesOrder()->getOrderReference())); |
|
163
|
|
|
$paymentMethodContainer->setBankCountry($paymentDetailEntity->getBankCountry()); |
|
164
|
|
|
$paymentMethodContainer->setBankAccount($paymentDetailEntity->getBankAccount()); |
|
165
|
|
|
$paymentMethodContainer->setBankCode($paymentDetailEntity->getBankCode()); |
|
166
|
|
|
$paymentMethodContainer->setBankGroupType($paymentDetailEntity->getBankGroupType()); |
|
167
|
|
|
$paymentMethodContainer->setIban($paymentDetailEntity->getIban()); |
|
168
|
|
|
$paymentMethodContainer->setBic($paymentDetailEntity->getBic()); |
|
169
|
|
|
|
|
170
|
|
|
return $paymentMethodContainer; |
|
171
|
|
|
} |
|
172
|
|
|
|
|
173
|
|
|
/** |
|
174
|
|
|
* @param \Generated\Shared\Transfer\PayoneBankAccountCheckTransfer $bankAccountCheckTransfer |
|
175
|
|
|
* |
|
176
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\BankAccountCheckContainer |
|
177
|
|
|
*/ |
|
178
|
|
|
public function mapBankAccountCheck(PayoneBankAccountCheckTransfer $bankAccountCheckTransfer) |
|
179
|
|
|
{ |
|
180
|
|
|
$bankAccountCheckContainer = new BankAccountCheckContainer(); |
|
181
|
|
|
|
|
182
|
|
|
$bankAccountCheckContainer->setAid($this->getStandardParameter()->getAid()); |
|
183
|
|
|
$bankAccountCheckContainer->setBankCountry($bankAccountCheckTransfer->getBankCountry()); |
|
184
|
|
|
$bankAccountCheckContainer->setBankAccount($bankAccountCheckTransfer->getBankAccount()); |
|
185
|
|
|
$bankAccountCheckContainer->setBankCode($bankAccountCheckTransfer->getBankCode()); |
|
186
|
|
|
$bankAccountCheckContainer->setIban($bankAccountCheckTransfer->getIban()); |
|
187
|
|
|
$bankAccountCheckContainer->setBic($bankAccountCheckTransfer->getBic()); |
|
188
|
|
|
$bankAccountCheckContainer->setLanguage($this->getStandardParameter()->getLanguage()); |
|
189
|
|
|
|
|
190
|
|
|
return $bankAccountCheckContainer; |
|
191
|
|
|
} |
|
192
|
|
|
} |
|
193
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths