|
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\PayoneStandardParameterTransfer; |
|
|
|
|
|
|
11
|
|
|
use Orm\Zed\Payone\Persistence\SpyPaymentPayone; |
|
|
|
|
|
|
12
|
|
|
use Orm\Zed\Sales\Persistence\SpySalesOrderAddress; |
|
|
|
|
|
|
13
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\PersonalContainer; |
|
14
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\RedirectContainer; |
|
15
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\ShippingContainer; |
|
16
|
|
|
use SprykerEco\Zed\Payone\Business\Key\HmacGeneratorInterface; |
|
17
|
|
|
use SprykerEco\Zed\Payone\Business\Payment\PaymentMethodMapperInterface; |
|
18
|
|
|
use SprykerEco\Zed\Payone\Business\SequenceNumber\SequenceNumberProviderInterface; |
|
19
|
|
|
|
|
20
|
|
|
abstract class AbstractMapper implements PaymentMethodMapperInterface |
|
21
|
|
|
{ |
|
22
|
|
|
/** |
|
23
|
|
|
* @var \Generated\Shared\Transfer\PayoneStandardParameterTransfer |
|
24
|
|
|
*/ |
|
25
|
|
|
private $standardParameter; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* @var \SprykerEco\Zed\Payone\Business\SequenceNumber\SequenceNumberProviderInterface |
|
29
|
|
|
*/ |
|
30
|
|
|
private $sequenceNumberProvider; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* @var \SprykerEco\Zed\Payone\Business\Key\HmacGeneratorInterface |
|
34
|
|
|
*/ |
|
35
|
|
|
private $urlHmacGenerator; |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* @param \Generated\Shared\Transfer\PayoneStandardParameterTransfer $standardParameterTransfer |
|
39
|
|
|
* |
|
40
|
|
|
* @return void |
|
41
|
|
|
*/ |
|
42
|
|
|
public function setStandardParameter(PayoneStandardParameterTransfer $standardParameterTransfer): void |
|
43
|
|
|
{ |
|
44
|
|
|
$this->standardParameter = $standardParameterTransfer; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @return \Generated\Shared\Transfer\PayoneStandardParameterTransfer |
|
49
|
|
|
*/ |
|
50
|
|
|
protected function getStandardParameter() |
|
51
|
|
|
{ |
|
52
|
|
|
return $this->standardParameter; |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* @param \SprykerEco\Zed\Payone\Business\Key\HmacGeneratorInterface $urlHmacGenerator |
|
57
|
|
|
* |
|
58
|
|
|
* @return void |
|
59
|
|
|
*/ |
|
60
|
|
|
public function setUrlHmacGenerator(HmacGeneratorInterface $urlHmacGenerator): void |
|
61
|
|
|
{ |
|
62
|
|
|
$this->urlHmacGenerator = $urlHmacGenerator; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Key\HmacGeneratorInterface |
|
67
|
|
|
*/ |
|
68
|
|
|
protected function getUrlHmacGenerator() |
|
69
|
|
|
{ |
|
70
|
|
|
return $this->urlHmacGenerator; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* @param \SprykerEco\Zed\Payone\Business\SequenceNumber\SequenceNumberProviderInterface $sequenceNumberProvider |
|
75
|
|
|
* |
|
76
|
|
|
* @return void |
|
77
|
|
|
*/ |
|
78
|
|
|
public function setSequenceNumberProvider(SequenceNumberProviderInterface $sequenceNumberProvider): void |
|
79
|
|
|
{ |
|
80
|
|
|
$this->sequenceNumberProvider = $sequenceNumberProvider; |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* @return \SprykerEco\Zed\Payone\Business\SequenceNumber\SequenceNumberProviderInterface |
|
85
|
|
|
*/ |
|
86
|
|
|
protected function getSequenceNumberProvider() |
|
87
|
|
|
{ |
|
88
|
|
|
return $this->sequenceNumberProvider; |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
|
|
/** |
|
92
|
|
|
* @param int $transactionId |
|
93
|
|
|
* |
|
94
|
|
|
* @return int |
|
95
|
|
|
*/ |
|
96
|
|
|
protected function getNextSequenceNumber($transactionId) |
|
97
|
|
|
{ |
|
98
|
|
|
$nextSequenceNumber = $this->getSequenceNumberProvider()->getNextSequenceNumber($transactionId); |
|
99
|
|
|
|
|
100
|
|
|
return $nextSequenceNumber; |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
/** |
|
104
|
|
|
* @param string $orderReference |
|
105
|
|
|
* |
|
106
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\RedirectContainer |
|
107
|
|
|
*/ |
|
108
|
|
|
protected function createRedirectContainer($orderReference) |
|
109
|
|
|
{ |
|
110
|
|
|
$redirectContainer = new RedirectContainer(); |
|
111
|
|
|
|
|
112
|
|
|
$sig = $this->getUrlHmacGenerator()->hash($orderReference, $this->getStandardParameter()->getKey()); |
|
113
|
|
|
$params = '?orderReference=' . $orderReference . '&sig=' . $sig; |
|
114
|
|
|
|
|
115
|
|
|
$redirectContainer->setSuccessUrl($this->getStandardParameter()->getRedirectSuccessUrl() . $params); |
|
116
|
|
|
$redirectContainer->setBackUrl($this->getStandardParameter()->getRedirectBackUrl() . $params); |
|
117
|
|
|
$redirectContainer->setErrorUrl($this->getStandardParameter()->getRedirectErrorUrl() . $params); |
|
118
|
|
|
|
|
119
|
|
|
return $redirectContainer; |
|
120
|
|
|
} |
|
121
|
|
|
|
|
122
|
|
|
/** |
|
123
|
|
|
* @param \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\PersonalContainer $personalContainer |
|
124
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
|
125
|
|
|
* |
|
126
|
|
|
* @return void |
|
127
|
|
|
*/ |
|
128
|
|
|
protected function mapBillingAddressToPersonalContainer(PersonalContainer $personalContainer, SpyPaymentPayone $paymentEntity) |
|
129
|
|
|
{ |
|
130
|
|
|
$orderEntity = $paymentEntity->getSpySalesOrder(); |
|
131
|
|
|
$billingAddressEntity = $orderEntity->getBillingAddress(); |
|
132
|
|
|
$personalContainer->setCountry($billingAddressEntity->getCountry()->getIso2Code()); |
|
133
|
|
|
$personalContainer->setFirstName($billingAddressEntity->getFirstName()); |
|
134
|
|
|
$personalContainer->setLastName($billingAddressEntity->getLastName()); |
|
135
|
|
|
$personalContainer->setSalutation($billingAddressEntity->getSalutation()); |
|
136
|
|
|
$personalContainer->setCompany($billingAddressEntity->getCompany()); |
|
137
|
|
|
$personalContainer->setStreet(implode(' ', [$billingAddressEntity->getAddress1(), $billingAddressEntity->getAddress2()])); |
|
138
|
|
|
$personalContainer->setAddressAddition($billingAddressEntity->getAddress3()); |
|
139
|
|
|
$personalContainer->setZip($billingAddressEntity->getZipCode()); |
|
140
|
|
|
$personalContainer->setCity($billingAddressEntity->getCity()); |
|
141
|
|
|
$personalContainer->setEmail($billingAddressEntity->getEmail()); |
|
142
|
|
|
$personalContainer->setTelephoneNumber($billingAddressEntity->getPhone()); |
|
143
|
|
|
$personalContainer->setLanguage($this->getStandardParameter()->getLanguage()); |
|
144
|
|
|
$personalContainer->setPersonalId($orderEntity->getCustomerReference()); |
|
145
|
|
|
} |
|
146
|
|
|
|
|
147
|
|
|
/** |
|
148
|
|
|
* @param \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\ShippingContainer $shippingContainer |
|
149
|
|
|
* @param \Orm\Zed\Sales\Persistence\SpySalesOrderAddress $shippingAddressEntity |
|
150
|
|
|
* |
|
151
|
|
|
* @return void |
|
152
|
|
|
*/ |
|
153
|
|
|
protected function mapShippingAddressToShippingContainer(ShippingContainer $shippingContainer, SpySalesOrderAddress $shippingAddressEntity) |
|
154
|
|
|
{ |
|
155
|
|
|
$shippingContainer->setShippingFirstName($shippingAddressEntity->getFirstName()); |
|
156
|
|
|
$shippingContainer->setShippingLastName($shippingAddressEntity->getLastName()); |
|
157
|
|
|
$shippingContainer->setShippingCompany($shippingAddressEntity->getCompany()); |
|
158
|
|
|
$shippingContainer->setShippingStreet( |
|
159
|
|
|
implode(' ', [$shippingAddressEntity->getAddress1(), $shippingAddressEntity->getAddress2()]) |
|
160
|
|
|
); |
|
161
|
|
|
$shippingContainer->setShippingZip($shippingAddressEntity->getZipCode()); |
|
162
|
|
|
$shippingContainer->setShippingCity($shippingAddressEntity->getCity()); |
|
163
|
|
|
$shippingContainer->setShippingCountry($shippingAddressEntity->getCountry()->getIso2Code()); |
|
164
|
|
|
} |
|
165
|
|
|
} |
|
166
|
|
|
|
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