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\PayoneCreditCardTransfer; |
|
|
|
|
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\CreditCardPseudoContainer; |
16
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\PersonalContainer; |
17
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\ThreeDSecureContainer; |
18
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\AuthorizationContainer; |
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\CreditCardCheckContainer; |
22
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\DebitContainer; |
23
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\DebitContainerInterface; |
24
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\PreAuthorizationContainer; |
25
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\PreAuthorizationContainerInterface; |
26
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\RefundContainer; |
27
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\RefundContainerInterface; |
28
|
|
|
|
29
|
|
|
class CreditCardPseudo extends AbstractMapper implements CreditCardPseudoInterface |
30
|
|
|
{ |
31
|
|
|
/** |
32
|
|
|
* @return string |
33
|
|
|
*/ |
34
|
|
|
public function getName(): string |
35
|
|
|
{ |
36
|
|
|
return PayoneApiConstants::PAYMENT_METHOD_CREDITCARD_PSEUDO; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
41
|
|
|
* @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer |
42
|
|
|
* |
43
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\AuthorizationContainer |
44
|
|
|
*/ |
45
|
|
|
public function mapPaymentToAuthorization(SpyPaymentPayone $paymentEntity, OrderTransfer $orderTransfer): AbstractAuthorizationContainer |
46
|
|
|
{ |
47
|
|
|
$authorizationContainer = new AuthorizationContainer(); |
48
|
|
|
$authorizationContainer = $this->mapPaymentToAbstractAuthorization($paymentEntity, $authorizationContainer); |
49
|
|
|
|
50
|
|
|
return $authorizationContainer; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
55
|
|
|
* |
56
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\CaptureContainerInterface |
57
|
|
|
*/ |
58
|
|
|
public function mapPaymentToCapture(SpyPaymentPayone $paymentEntity): CaptureContainerInterface |
59
|
|
|
{ |
60
|
|
|
$paymentDetailEntity = $paymentEntity->getSpyPaymentPayoneDetail(); |
61
|
|
|
|
62
|
|
|
$captureContainer = new CaptureContainer(); |
63
|
|
|
$captureContainer->setAmount($paymentDetailEntity->getAmount()); |
64
|
|
|
$captureContainer->setCurrency($this->getStandardParameter()->getCurrency()); |
65
|
|
|
$captureContainer->setTxid($paymentEntity->getTransactionId()); |
66
|
|
|
$captureContainer->setSequenceNumber($this->getNextSequenceNumber($paymentEntity->getTransactionId())); |
67
|
|
|
|
68
|
|
|
return $captureContainer; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
73
|
|
|
* |
74
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\PreAuthorizationContainerInterface |
75
|
|
|
*/ |
76
|
|
|
public function mapPaymentToPreAuthorization(SpyPaymentPayone $paymentEntity): PreAuthorizationContainerInterface |
77
|
|
|
{ |
78
|
|
|
$preAuthorizationContainer = new PreAuthorizationContainer(); |
79
|
|
|
$preAuthorizationContainer = $this->mapPaymentToAbstractAuthorization($paymentEntity, $preAuthorizationContainer); |
80
|
|
|
|
81
|
|
|
return $preAuthorizationContainer; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
86
|
|
|
* @param \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\AbstractAuthorizationContainer $authorizationContainer |
87
|
|
|
* |
88
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\AbstractAuthorizationContainer |
89
|
|
|
*/ |
90
|
|
|
protected function mapPaymentToAbstractAuthorization(SpyPaymentPayone $paymentEntity, AbstractAuthorizationContainer $authorizationContainer) |
91
|
|
|
{ |
92
|
|
|
$paymentDetailEntity = $paymentEntity->getSpyPaymentPayoneDetail(); |
93
|
|
|
|
94
|
|
|
$authorizationContainer->setAid($this->getStandardParameter()->getAid()); |
95
|
|
|
$authorizationContainer->setClearingType(PayoneApiConstants::CLEARING_TYPE_CREDIT_CARD); |
96
|
|
|
$authorizationContainer->setReference($paymentEntity->getReference()); |
97
|
|
|
$authorizationContainer->setAmount($paymentDetailEntity->getAmount()); |
98
|
|
|
$authorizationContainer->setCurrency($this->getStandardParameter()->getCurrency()); |
99
|
|
|
$authorizationContainer->setPaymentMethod($this->createPaymentMethodContainerFromPayment($paymentEntity)); |
100
|
|
|
|
101
|
|
|
$personalContainer = new PersonalContainer(); |
102
|
|
|
$this->mapBillingAddressToPersonalContainer($personalContainer, $paymentEntity); |
103
|
|
|
|
104
|
|
|
$authorizationContainer->setPersonalData($personalContainer); |
105
|
|
|
|
106
|
|
|
return $authorizationContainer; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* @param \Generated\Shared\Transfer\PayoneCreditCardTransfer $payoneCreditCardTransfer |
111
|
|
|
* |
112
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\CreditCardCheckContainer |
113
|
|
|
*/ |
114
|
|
|
public function mapCreditCardCheck(PayoneCreditCardTransfer $payoneCreditCardTransfer): CreditCardCheckContainer |
115
|
|
|
{ |
116
|
|
|
$creditCardCheckContainer = new CreditCardCheckContainer(); |
117
|
|
|
|
118
|
|
|
$creditCardCheckContainer->setAid($this->getStandardParameter()->getAid()); |
119
|
|
|
$creditCardCheckContainer->setCardPan($payoneCreditCardTransfer->getCardPan()); |
120
|
|
|
$creditCardCheckContainer->setCardType($payoneCreditCardTransfer->getCardType()); |
121
|
|
|
$creditCardCheckContainer->setCardExpireDate($payoneCreditCardTransfer->getCardExpireDate()); |
122
|
|
|
$creditCardCheckContainer->setCardCvc2($payoneCreditCardTransfer->getCardCvc2()); |
123
|
|
|
$creditCardCheckContainer->setCardIssueNumber($payoneCreditCardTransfer->getCardIssueNumber()); |
124
|
|
|
$creditCardCheckContainer->setStoreCardData($payoneCreditCardTransfer->getStoreCardData()); |
125
|
|
|
$creditCardCheckContainer->setLanguage($this->getStandardParameter()->getLanguage()); |
126
|
|
|
|
127
|
|
|
return $creditCardCheckContainer; |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
132
|
|
|
* |
133
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\DebitContainerInterface |
134
|
|
|
*/ |
135
|
|
|
public function mapPaymentToDebit(SpyPaymentPayone $paymentEntity): DebitContainerInterface |
136
|
|
|
{ |
137
|
|
|
$debitContainer = new DebitContainer(); |
138
|
|
|
|
139
|
|
|
$debitContainer->setTxid($paymentEntity->getTransactionId()); |
140
|
|
|
$debitContainer->setSequenceNumber($this->getNextSequenceNumber($paymentEntity->getTransactionId())); |
141
|
|
|
$debitContainer->setCurrency($this->getStandardParameter()->getCurrency()); |
142
|
|
|
$debitContainer->setAmount($paymentEntity->getSpyPaymentPayoneDetail()->getAmount()); |
143
|
|
|
|
144
|
|
|
return $debitContainer; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
149
|
|
|
* |
150
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\RefundContainerInterface |
151
|
|
|
*/ |
152
|
|
|
public function mapPaymentToRefund(SpyPaymentPayone $paymentEntity): RefundContainerInterface |
153
|
|
|
{ |
154
|
|
|
$refundContainer = new RefundContainer(); |
155
|
|
|
|
156
|
|
|
$refundContainer->setTxid($paymentEntity->getTransactionId()); |
157
|
|
|
$refundContainer->setSequenceNumber($this->getNextSequenceNumber($paymentEntity->getTransactionId())); |
158
|
|
|
$refundContainer->setCurrency($this->getStandardParameter()->getCurrency()); |
159
|
|
|
|
160
|
|
|
return $refundContainer; |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
165
|
|
|
* |
166
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\PaymentMethod\CreditCardPseudoContainer |
167
|
|
|
*/ |
168
|
|
|
protected function createPaymentMethodContainerFromPayment(SpyPaymentPayone $paymentEntity) |
169
|
|
|
{ |
170
|
|
|
$paymentMethodContainer = new CreditCardPseudoContainer(); |
171
|
|
|
|
172
|
|
|
$pseudoCardPan = $paymentEntity->getSpyPaymentPayoneDetail()->getPseudoCardPan(); |
173
|
|
|
$paymentMethodContainer->setPseudoCardPan($pseudoCardPan); |
174
|
|
|
|
175
|
|
|
$threeDSecure = $this->createThreeDSecureData($paymentEntity); |
176
|
|
|
$paymentMethodContainer->setThreeDSecure($threeDSecure); |
177
|
|
|
|
178
|
|
|
return $paymentMethodContainer; |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
/** |
182
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
183
|
|
|
* |
184
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\ThreeDSecureContainer |
185
|
|
|
*/ |
186
|
|
|
protected function createThreeDSecureData(SpyPaymentPayone $paymentEntity) |
187
|
|
|
{ |
188
|
|
|
$threeDContainer = new ThreeDSecureContainer(); |
189
|
|
|
|
190
|
|
|
$threeDContainer->setRedirect($this->createRedirectContainer($paymentEntity->getSpySalesOrder()->getOrderReference())); |
191
|
|
|
|
192
|
|
|
return $threeDContainer; |
193
|
|
|
} |
194
|
|
|
} |
195
|
|
|
|
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