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 Orm\Zed\Payone\Persistence\SpyPaymentPayone; |
|
|
|
|
12
|
|
|
use SprykerEco\Shared\Payone\PayoneApiConstants; |
13
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\AbstractAuthorizationContainer; |
14
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\PaymentMethod\EWalletContainer; |
15
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\PersonalContainer; |
16
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\ShippingContainer; |
17
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\AuthorizationContainer; |
18
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\CaptureContainer; |
19
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\CaptureContainerInterface; |
20
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\DebitContainer; |
21
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\DebitContainerInterface; |
22
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\PreAuthorizationContainer; |
23
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\PreAuthorizationContainerInterface; |
24
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\RefundContainer; |
25
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\RefundContainerInterface; |
26
|
|
|
|
27
|
|
|
class EWallet extends AbstractMapper |
28
|
|
|
{ |
29
|
|
|
/** |
30
|
|
|
* @return string |
31
|
|
|
*/ |
32
|
|
|
public function getName(): string |
33
|
|
|
{ |
34
|
|
|
return PayoneApiConstants::PAYMENT_METHOD_E_WALLET; |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
39
|
|
|
* @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer |
40
|
|
|
* |
41
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\AuthorizationContainer |
42
|
|
|
*/ |
43
|
|
|
public function mapPaymentToAuthorization(SpyPaymentPayone $paymentEntity, OrderTransfer $orderTransfer): AbstractAuthorizationContainer |
44
|
|
|
{ |
45
|
|
|
$authorizationContainer = new AuthorizationContainer(); |
46
|
|
|
$authorizationContainer = $this->mapPaymentToAbstractAuthorization($paymentEntity, $authorizationContainer); |
47
|
|
|
|
48
|
|
|
return $authorizationContainer; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
53
|
|
|
* |
54
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\CaptureContainerInterface |
55
|
|
|
*/ |
56
|
|
|
public function mapPaymentToCapture(SpyPaymentPayone $paymentEntity): CaptureContainerInterface |
57
|
|
|
{ |
58
|
|
|
$paymentDetailEntity = $paymentEntity->getSpyPaymentPayoneDetail(); |
59
|
|
|
|
60
|
|
|
$captureContainer = new CaptureContainer(); |
61
|
|
|
$captureContainer->setAmount($paymentDetailEntity->getAmount()); |
62
|
|
|
$captureContainer->setCurrency($this->getStandardParameter()->getCurrency()); |
63
|
|
|
$captureContainer->setTxid($paymentEntity->getTransactionId()); |
64
|
|
|
$captureContainer->setSequenceNumber($this->getNextSequenceNumber($paymentEntity->getTransactionId())); |
65
|
|
|
|
66
|
|
|
return $captureContainer; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
71
|
|
|
* |
72
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\PreAuthorizationContainerInterface |
73
|
|
|
*/ |
74
|
|
|
public function mapPaymentToPreAuthorization(SpyPaymentPayone $paymentEntity): PreAuthorizationContainerInterface |
75
|
|
|
{ |
76
|
|
|
$preAuthorizationContainer = new PreAuthorizationContainer(); |
77
|
|
|
$preAuthorizationContainer = $this->mapPaymentToAbstractAuthorization($paymentEntity, $preAuthorizationContainer); |
78
|
|
|
|
79
|
|
|
return $preAuthorizationContainer; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
84
|
|
|
* @param \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\AbstractAuthorizationContainer $authorizationContainer |
85
|
|
|
* |
86
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\AbstractAuthorizationContainer |
87
|
|
|
*/ |
88
|
|
|
protected function mapPaymentToAbstractAuthorization(SpyPaymentPayone $paymentEntity, AbstractAuthorizationContainer $authorizationContainer) |
89
|
|
|
{ |
90
|
|
|
$paymentDetailEntity = $paymentEntity->getSpyPaymentPayoneDetail(); |
91
|
|
|
|
92
|
|
|
$authorizationContainer->setAid($this->getStandardParameter()->getAid()); |
93
|
|
|
$authorizationContainer->setClearingType(PayoneApiConstants::CLEARING_TYPE_E_WALLET); |
94
|
|
|
$authorizationContainer->setReference($paymentEntity->getReference()); |
95
|
|
|
$authorizationContainer->setAmount($paymentDetailEntity->getAmount()); |
96
|
|
|
$authorizationContainer->setCurrency($this->getStandardParameter()->getCurrency()); |
97
|
|
|
$authorizationContainer->setPaymentMethod($this->createPaymentMethodContainerFromPayment($paymentEntity)); |
98
|
|
|
|
99
|
|
|
$personalContainer = new PersonalContainer(); |
100
|
|
|
$this->mapBillingAddressToPersonalContainer($personalContainer, $paymentEntity); |
101
|
|
|
$authorizationContainer->setPersonalData($personalContainer); |
102
|
|
|
|
103
|
|
|
$shippingAddressEntity = $paymentEntity->getSpySalesOrder()->getShippingAddress(); |
104
|
|
|
$shippingContainer = new ShippingContainer(); |
105
|
|
|
$this->mapShippingAddressToShippingContainer($shippingContainer, $shippingAddressEntity); |
106
|
|
|
$authorizationContainer->setShippingData($shippingContainer); |
107
|
|
|
|
108
|
|
|
return $authorizationContainer; |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
113
|
|
|
* |
114
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\DebitContainerInterface |
115
|
|
|
*/ |
116
|
|
|
public function mapPaymentToDebit(SpyPaymentPayone $paymentEntity): DebitContainerInterface |
117
|
|
|
{ |
118
|
|
|
$debitContainer = new DebitContainer(); |
119
|
|
|
|
120
|
|
|
$debitContainer->setTxid($paymentEntity->getTransactionId()); |
121
|
|
|
$debitContainer->setSequenceNumber($this->getNextSequenceNumber($paymentEntity->getTransactionId())); |
122
|
|
|
$debitContainer->setCurrency($this->getStandardParameter()->getCurrency()); |
123
|
|
|
$debitContainer->setAmount($paymentEntity->getSpyPaymentPayoneDetail()->getAmount()); |
124
|
|
|
|
125
|
|
|
return $debitContainer; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
130
|
|
|
* |
131
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\RefundContainerInterface |
132
|
|
|
*/ |
133
|
|
|
public function mapPaymentToRefund(SpyPaymentPayone $paymentEntity): RefundContainerInterface |
134
|
|
|
{ |
135
|
|
|
$refundContainer = new RefundContainer(); |
136
|
|
|
|
137
|
|
|
$refundContainer->setTxid($paymentEntity->getTransactionId()); |
138
|
|
|
$refundContainer->setSequenceNumber($this->getNextSequenceNumber($paymentEntity->getTransactionId())); |
139
|
|
|
$refundContainer->setCurrency($this->getStandardParameter()->getCurrency()); |
140
|
|
|
|
141
|
|
|
return $refundContainer; |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
146
|
|
|
* |
147
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\PaymentMethod\EWalletContainer |
148
|
|
|
*/ |
149
|
|
|
protected function createPaymentMethodContainerFromPayment(SpyPaymentPayone $paymentEntity) |
150
|
|
|
{ |
151
|
|
|
$paymentMethodContainer = new EWalletContainer(); |
152
|
|
|
$paymentMethodContainer->setRedirect($this->createRedirectContainer($paymentEntity->getSpySalesOrder()->getOrderReference())); |
153
|
|
|
|
154
|
|
|
$paymentMethodContainer->setWalletType($paymentEntity->getSpyPaymentPayoneDetail()->getType()); |
155
|
|
|
|
156
|
|
|
return $paymentMethodContainer; |
157
|
|
|
} |
158
|
|
|
} |
159
|
|
|
|
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