|
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\Yves\Computop\Mapper\Init\PostPlace; |
|
9
|
|
|
|
|
10
|
|
|
use Generated\Shared\Transfer\ComputopEasyCreditPaymentTransfer; |
|
|
|
|
|
|
11
|
|
|
use Generated\Shared\Transfer\QuoteTransfer; |
|
|
|
|
|
|
12
|
|
|
use SprykerEco\Shared\Computop\Config\ComputopApiConfig; |
|
13
|
|
|
use SprykerEco\Yves\Computop\Mapper\Init\AbstractMapper; |
|
14
|
|
|
use SprykerEco\Yves\Computop\Plugin\Provider\ComputopControllerProvider; |
|
15
|
|
|
|
|
16
|
|
|
class EasyCreditMapper extends AbstractMapper |
|
17
|
|
|
{ |
|
18
|
|
|
/** |
|
19
|
|
|
* @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer |
|
20
|
|
|
* |
|
21
|
|
|
* @return \Generated\Shared\Transfer\ComputopEasyCreditPaymentTransfer |
|
22
|
|
|
*/ |
|
23
|
|
|
public function createComputopPaymentTransfer(QuoteTransfer $quoteTransfer) |
|
24
|
|
|
{ |
|
25
|
|
|
/** @var \Generated\Shared\Transfer\ComputopEasyCreditPaymentTransfer $computopPaymentTransfer */ |
|
26
|
|
|
$computopPaymentTransfer = parent::createComputopPaymentTransfer($quoteTransfer); |
|
27
|
|
|
|
|
28
|
|
|
$addressData = $this->getAdditionalAddressData($quoteTransfer); |
|
29
|
|
|
$computopPaymentTransfer = $this->mapAddressDataToEasyCreditPayment($addressData, $computopPaymentTransfer); |
|
30
|
|
|
|
|
31
|
|
|
$computopPaymentTransfer->setUrlNotify( |
|
32
|
|
|
$this->getAbsoluteUrl($this->application->path(ComputopControllerProvider::NOTIFY_PATH_NAME)) |
|
|
|
|
|
|
33
|
|
|
); |
|
34
|
|
|
$computopPaymentTransfer->setMac( |
|
35
|
|
|
$this->computopApiService->generateEncryptedMac( |
|
36
|
|
|
$this->createRequestTransfer($computopPaymentTransfer) |
|
37
|
|
|
) |
|
38
|
|
|
); |
|
39
|
|
|
|
|
40
|
|
|
$decryptedValues = $this->computopApiService->getEncryptedArray( |
|
41
|
|
|
$this->getDataSubArray($computopPaymentTransfer), |
|
42
|
|
|
$this->config->getBlowfishPassword() |
|
43
|
|
|
); |
|
44
|
|
|
|
|
45
|
|
|
$computopPaymentTransfer->setData($decryptedValues[ComputopApiConfig::DATA]); |
|
46
|
|
|
$computopPaymentTransfer->setLen($decryptedValues[ComputopApiConfig::LENGTH]); |
|
47
|
|
|
$computopPaymentTransfer->setUrl( |
|
48
|
|
|
$this->getActionUrl( |
|
49
|
|
|
$this->config->getEasyCreditInitActionUrl(), |
|
50
|
|
|
$this->getQueryParameters( |
|
51
|
|
|
$computopPaymentTransfer->getMerchantId(), |
|
52
|
|
|
$decryptedValues[ComputopApiConfig::DATA], |
|
53
|
|
|
$decryptedValues[ComputopApiConfig::LENGTH] |
|
54
|
|
|
) |
|
55
|
|
|
) |
|
56
|
|
|
); |
|
57
|
|
|
|
|
58
|
|
|
return $computopPaymentTransfer; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer |
|
63
|
|
|
* |
|
64
|
|
|
* @return \Generated\Shared\Transfer\ComputopEasyCreditPaymentTransfer |
|
65
|
|
|
*/ |
|
66
|
|
|
protected function createTransferWithUnencryptedValues(QuoteTransfer $quoteTransfer) |
|
67
|
|
|
{ |
|
68
|
|
|
$computopPaymentTransfer = new ComputopEasyCreditPaymentTransfer(); |
|
69
|
|
|
|
|
70
|
|
|
$computopPaymentTransfer->setTransId($this->generateTransId($quoteTransfer)); |
|
71
|
|
|
$computopPaymentTransfer->setUrlSuccess( |
|
72
|
|
|
$this->getAbsoluteUrl($this->application->path(ComputopControllerProvider::EASY_CREDIT_SUCCESS)) |
|
73
|
|
|
); |
|
74
|
|
|
|
|
75
|
|
|
return $computopPaymentTransfer; |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* @param \Generated\Shared\Transfer\ComputopEasyCreditPaymentTransfer $cardPaymentTransfer |
|
80
|
|
|
* |
|
81
|
|
|
* @return array |
|
82
|
|
|
*/ |
|
83
|
|
|
protected function getDataSubArray(ComputopEasyCreditPaymentTransfer $cardPaymentTransfer) |
|
84
|
|
|
{ |
|
85
|
|
|
$dataSubArray[ComputopApiConfig::TRANS_ID] = $cardPaymentTransfer->getTransId(); |
|
|
|
|
|
|
86
|
|
|
$dataSubArray[ComputopApiConfig::AMOUNT] = $cardPaymentTransfer->getAmount(); |
|
87
|
|
|
$dataSubArray[ComputopApiConfig::CURRENCY] = $cardPaymentTransfer->getCurrency(); |
|
88
|
|
|
$dataSubArray[ComputopApiConfig::URL_SUCCESS] = $cardPaymentTransfer->getUrlSuccess(); |
|
89
|
|
|
$dataSubArray[ComputopApiConfig::URL_FAILURE] = $cardPaymentTransfer->getUrlFailure(); |
|
90
|
|
|
$dataSubArray[ComputopApiConfig::URL_NOTIFY] = $cardPaymentTransfer->getUrlNotify(); |
|
91
|
|
|
$dataSubArray[ComputopApiConfig::RESPONSE] = $cardPaymentTransfer->getResponse(); |
|
92
|
|
|
$dataSubArray[ComputopApiConfig::EVENT_TOKEN] = ComputopApiConfig::EVENT_TOKEN_INIT; |
|
93
|
|
|
$dataSubArray[ComputopApiConfig::ETI_ID] = $this->config->getEtiId(); |
|
94
|
|
|
$dataSubArray[ComputopApiConfig::IP_ADDRESS] = $cardPaymentTransfer->getClientIp(); |
|
95
|
|
|
$dataSubArray[ComputopApiConfig::SHIPPING_ZIP] = $cardPaymentTransfer->getShippingZip(); |
|
96
|
|
|
$dataSubArray[ComputopApiConfig::SHIPPING_CITY] = $cardPaymentTransfer->getShippingCity(); |
|
97
|
|
|
$dataSubArray[ComputopApiConfig::SHIPPING_COUNTRY_CODE] = $cardPaymentTransfer->getShippingCountryCode(); |
|
98
|
|
|
$dataSubArray[ComputopApiConfig::SHIPPING_STREET] = $cardPaymentTransfer->getShippingStreet(); |
|
99
|
|
|
$dataSubArray[ComputopApiConfig::SHIPPING_STREET_NUMBER] = $cardPaymentTransfer->getShippingStreetNumber(); |
|
100
|
|
|
|
|
101
|
|
|
return $dataSubArray; |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* @param array $addressData |
|
106
|
|
|
* @param \Generated\Shared\Transfer\ComputopEasyCreditPaymentTransfer $computopEasyCreditPaymentTransfer |
|
107
|
|
|
* |
|
108
|
|
|
* @return \Generated\Shared\Transfer\ComputopEasyCreditPaymentTransfer |
|
109
|
|
|
*/ |
|
110
|
|
|
protected function mapAddressDataToEasyCreditPayment( |
|
111
|
|
|
array $addressData, |
|
112
|
|
|
ComputopEasyCreditPaymentTransfer $computopEasyCreditPaymentTransfer |
|
113
|
|
|
): ComputopEasyCreditPaymentTransfer { |
|
114
|
|
|
|
|
115
|
|
|
$computopEasyCreditPaymentTransfer->setShippingCity($addressData[ComputopEasyCreditPaymentTransfer::SHIPPING_CITY]); |
|
116
|
|
|
$computopEasyCreditPaymentTransfer->setShippingStreet($addressData[ComputopEasyCreditPaymentTransfer::SHIPPING_STREET]); |
|
117
|
|
|
$computopEasyCreditPaymentTransfer->setShippingStreetNumber($addressData[ComputopEasyCreditPaymentTransfer::SHIPPING_STREET_NUMBER]); |
|
118
|
|
|
$computopEasyCreditPaymentTransfer->setShippingCountryCode($addressData[ComputopEasyCreditPaymentTransfer::SHIPPING_COUNTRY_CODE]); |
|
119
|
|
|
|
|
120
|
|
|
return $computopEasyCreditPaymentTransfer; |
|
121
|
|
|
} |
|
122
|
|
|
|
|
123
|
|
|
/** |
|
124
|
|
|
* @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer |
|
125
|
|
|
* |
|
126
|
|
|
* @return array |
|
127
|
|
|
*/ |
|
128
|
|
|
protected function getAdditionalAddressData(QuoteTransfer $quoteTransfer): array |
|
129
|
|
|
{ |
|
130
|
|
|
$addressTransfer = $quoteTransfer->getBillingSameAsShipping() ? $quoteTransfer->getBillingAddress() : $quoteTransfer->getShippingAddress(); |
|
131
|
|
|
|
|
132
|
|
|
$addressData[ComputopEasyCreditPaymentTransfer::SHIPPING_CITY] = $addressTransfer->getCity(); |
|
|
|
|
|
|
133
|
|
|
$addressData[ComputopEasyCreditPaymentTransfer::SHIPPING_STREET] = $addressTransfer->getAddress1(); |
|
134
|
|
|
$addressData[ComputopEasyCreditPaymentTransfer::SHIPPING_STREET_NUMBER] = $addressTransfer->getAddress2(); |
|
135
|
|
|
$addressData[ComputopEasyCreditPaymentTransfer::SHIPPING_COUNTRY_CODE] = $addressTransfer->getIso2Code(); |
|
136
|
|
|
|
|
137
|
|
|
return $addressData; |
|
138
|
|
|
} |
|
139
|
|
|
} |
|
140
|
|
|
|
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