1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace SprykerEco\Yves\Computop\Handler\ExpressCheckout; |
4
|
|
|
|
5
|
|
|
use Generated\Shared\Transfer\AddressTransfer; |
|
|
|
|
6
|
|
|
use Generated\Shared\Transfer\CustomerTransfer; |
|
|
|
|
7
|
|
|
use Spryker\Client\Quote\QuoteClientInterface; |
8
|
|
|
use Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface; |
9
|
|
|
use SprykerEco\Service\ComputopApi\ComputopApiServiceInterface; |
10
|
|
|
use SprykerEco\Yves\Computop\ComputopConfigInterface; |
11
|
|
|
use SprykerEco\Yves\Computop\Dependency\Client\ComputopToQuoteClientInterface; |
12
|
|
|
use SprykerEco\Yves\Computop\Dependency\External\ComputopToGuzzleHttpClientInterface; |
13
|
|
|
|
14
|
|
|
class ComputopPayPalExpressPrepareHandler implements ComputopPayPalExpressPrepareHandlerInterface |
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* @var QuoteClientInterface |
18
|
|
|
*/ |
19
|
|
|
protected $quoteClient; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @var StepEngineFormDataProviderInterface |
23
|
|
|
*/ |
24
|
|
|
protected $stepEngineFormDataProvider; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @var ComputopToGuzzleHttpClientInterface |
28
|
|
|
*/ |
29
|
|
|
protected $computopToGuzzleHttpClient; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @var ComputopApiServiceInterface |
33
|
|
|
*/ |
34
|
|
|
protected $computopApiService; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @var ComputopConfigInterface |
38
|
|
|
*/ |
39
|
|
|
protected $computopConfig; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* ComputopPayPalExpressPrepareHandler constructor. |
43
|
|
|
*/ |
44
|
|
|
public function __construct( |
45
|
|
|
ComputopToQuoteClientInterface $quoteClient, |
46
|
|
|
StepEngineFormDataProviderInterface $stepEngineFormDataProvider, |
47
|
|
|
ComputopToGuzzleHttpClientInterface $computopToGuzzleHttpClient, |
48
|
|
|
ComputopApiServiceInterface $computopApiService, |
49
|
|
|
ComputopConfigInterface $computopConfig |
50
|
|
|
) |
51
|
|
|
{ |
52
|
|
|
$this->quoteClient = $quoteClient; |
|
|
|
|
53
|
|
|
$this->stepEngineFormDataProvider = $stepEngineFormDataProvider; |
54
|
|
|
$this->computopToGuzzleHttpClient = $computopToGuzzleHttpClient; |
55
|
|
|
$this->computopApiService = $computopApiService; |
56
|
|
|
$this->computopConfig = $computopConfig; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function handle() |
60
|
|
|
{ |
61
|
|
|
$quoteTransfer = $this->quoteClient->getQuote(); |
62
|
|
|
|
63
|
|
|
// $handler = $this->getFactory()->createPayPalExpressInitHandler() |
64
|
|
|
|
65
|
|
|
//Customer kostyl |
66
|
|
|
$customer = new CustomerTransfer(); |
67
|
|
|
$customer->setCustomerReference('123'); |
68
|
|
|
$customer->setIsGuest(true); |
69
|
|
|
$quoteTransfer->setCustomer($customer); |
70
|
|
|
|
71
|
|
|
//zip kostyl |
72
|
|
|
$address = new AddressTransfer(); |
73
|
|
|
$address->setZipCode(65000); |
74
|
|
|
$quoteTransfer->setShippingAddress($address); |
75
|
|
|
|
76
|
|
|
|
77
|
|
|
$quote = $this->stepEngineFormDataProvider->getData($quoteTransfer); |
78
|
|
|
$this->quoteClient->setQuote($quote); |
79
|
|
|
|
80
|
|
|
$payment = $quote->getPayment()->getComputopPayPalExpress(); |
81
|
|
|
|
82
|
|
|
$response = $this->computopToGuzzleHttpClient->request( |
83
|
|
|
'post', |
84
|
|
|
'https://www.computop-paygate.com/ExternalServices/paypalorders.aspx', |
85
|
|
|
[ |
86
|
|
|
'query' => [ |
87
|
|
|
'MerchantID' => $payment->getMerchantId(), |
88
|
|
|
'Data' => $payment->getData(), |
89
|
|
|
'Len' => $payment->getLen() |
90
|
|
|
] |
91
|
|
|
] |
92
|
|
|
); |
93
|
|
|
|
94
|
|
|
$responseContents = $response->getBody()->getContents(); |
95
|
|
|
|
96
|
|
|
$respData = []; |
97
|
|
|
parse_str($responseContents, $respData); |
98
|
|
|
|
99
|
|
|
return $this->computopApiService->decryptResponseHeader($respData, $this->computopConfig->getBlowfishPassword()); |
100
|
|
|
} |
101
|
|
|
} |
102
|
|
|
|
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