|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Copyright © 2016-present Spryker Systems GmbH. All rights reserved. |
|
5
|
|
|
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
namespace SprykerEco\Zed\CrefoPayApi\Communication\Console; |
|
9
|
|
|
|
|
10
|
|
|
use ArrayObject; |
|
11
|
|
|
use Generated\Shared\Transfer\CrefoPayApiAddressTransfer; |
|
|
|
|
|
|
12
|
|
|
use Generated\Shared\Transfer\CrefoPayApiAmountTransfer; |
|
|
|
|
|
|
13
|
|
|
use Generated\Shared\Transfer\CrefoPayApiBasketItemTransfer; |
|
|
|
|
|
|
14
|
|
|
use Generated\Shared\Transfer\CrefoPayApiCreateTransactionRequestTransfer; |
|
|
|
|
|
|
15
|
|
|
use Generated\Shared\Transfer\CrefoPayApiPersonTransfer; |
|
|
|
|
|
|
16
|
|
|
use Generated\Shared\Transfer\CrefoPayApiRequestTransfer; |
|
|
|
|
|
|
17
|
|
|
use Spryker\Zed\Kernel\Communication\Console\Console; |
|
|
|
|
|
|
18
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
|
|
|
|
|
|
19
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
|
|
|
|
|
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* @method \SprykerEco\Zed\CrefoPayApi\Business\CrefoPayApiFacadeInterface getFacade() |
|
23
|
|
|
* @method \SprykerEco\Zed\CrefoPayApi\Communication\CrefoPayApiCommunicationFactory getFactory() |
|
24
|
|
|
*/ |
|
25
|
|
|
class CreateTransactionCallConsole extends Console |
|
26
|
|
|
{ |
|
27
|
|
|
public const COMMAND_NAME = 'crefo-pay-api:create-transaction'; |
|
28
|
|
|
public const COMMAND_DESCRIPTION = 'Perform CreateTransaction API call to CrefoPay'; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* @return void |
|
32
|
|
|
*/ |
|
33
|
|
|
protected function configure() |
|
34
|
|
|
{ |
|
35
|
|
|
parent::configure(); |
|
36
|
|
|
$this |
|
37
|
|
|
->setName(static::COMMAND_NAME) |
|
38
|
|
|
->setDescription(static::COMMAND_DESCRIPTION) |
|
39
|
|
|
->setHelp('<info>' . static::COMMAND_NAME . ' -h</info>'); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* @param \Symfony\Component\Console\Input\InputInterface $input |
|
44
|
|
|
* @param \Symfony\Component\Console\Output\OutputInterface $output |
|
45
|
|
|
* |
|
46
|
|
|
* @return void |
|
47
|
|
|
*/ |
|
48
|
|
|
public function execute(InputInterface $input, OutputInterface $output) |
|
49
|
|
|
{ |
|
50
|
|
|
$response = $this->getFacade()->performCreateTransactionApiCall($this->createRequestTransfer()); |
|
51
|
|
|
echo json_encode($response->toArray(true, true), JSON_PRETTY_PRINT); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* @return \Generated\Shared\Transfer\CrefoPayApiRequestTransfer |
|
56
|
|
|
*/ |
|
57
|
|
|
protected function createRequestTransfer(): CrefoPayApiRequestTransfer |
|
58
|
|
|
{ |
|
59
|
|
|
$request = new CrefoPayApiRequestTransfer(); |
|
60
|
|
|
$request->setCreateTransactionRequest($this->createRequestCallTransfer()); |
|
61
|
|
|
|
|
62
|
|
|
return $request; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
protected function createRequestCallTransfer() |
|
66
|
|
|
{ |
|
67
|
|
|
return (new CrefoPayApiCreateTransactionRequestTransfer()) |
|
68
|
|
|
->setMerchantID(265) |
|
69
|
|
|
->setStoreID('sprykerdevelEUR') |
|
70
|
|
|
->setOrderID('test-order-id') |
|
71
|
|
|
->setUserID('user-id') |
|
72
|
|
|
->setIntegrationType('API') |
|
73
|
|
|
->setAutoCapture(false) |
|
74
|
|
|
->setMerchantReference('reference') |
|
75
|
|
|
->setContext('ONLINE') |
|
76
|
|
|
->setUserType('PRIVATE') |
|
77
|
|
|
->setUserRiskClass(0) |
|
78
|
|
|
->setUserIpAddress('127.0.0.1') |
|
79
|
|
|
->setUserData( |
|
80
|
|
|
(new CrefoPayApiPersonTransfer()) |
|
81
|
|
|
->setSalutation('M') |
|
82
|
|
|
->setName('Aleksey') |
|
83
|
|
|
->setSurname('Kotsuba') |
|
84
|
|
|
->setDateOfBirth('1988-10-22') |
|
85
|
|
|
->setEmail('[email protected]') |
|
86
|
|
|
->setPhoneNumber('0380937880368') |
|
87
|
|
|
) |
|
88
|
|
|
->setBillingAddress( |
|
89
|
|
|
(new CrefoPayApiAddressTransfer()) |
|
90
|
|
|
->setZip('123456') |
|
91
|
|
|
->setCountry('DE') |
|
92
|
|
|
->setCity('Berlin') |
|
93
|
|
|
->setStreet('Test street') |
|
94
|
|
|
->setNo('12') |
|
95
|
|
|
) |
|
96
|
|
|
->setAmount( |
|
97
|
|
|
(new CrefoPayApiAmountTransfer()) |
|
98
|
|
|
->setAmount(1922) |
|
99
|
|
|
->setVatAmount(19) |
|
100
|
|
|
->setVatRate(10.00) |
|
101
|
|
|
) |
|
102
|
|
|
->setBasketItems($this->createBasket()) |
|
103
|
|
|
->setLocale('EN'); |
|
104
|
|
|
} |
|
105
|
|
|
|
|
106
|
|
|
protected function createBasket() |
|
107
|
|
|
{ |
|
108
|
|
|
$basket = new ArrayObject(); |
|
109
|
|
|
$basket->append( |
|
110
|
|
|
(new CrefoPayApiBasketItemTransfer()) |
|
111
|
|
|
->setBasketItemAmount( |
|
112
|
|
|
(new CrefoPayApiAmountTransfer()) |
|
113
|
|
|
->setAmount(1922) |
|
114
|
|
|
->setVatAmount(19) |
|
115
|
|
|
->setVatRate(10.00) |
|
116
|
|
|
) |
|
117
|
|
|
->setBasketItemCount(1) |
|
118
|
|
|
->setBasketItemID('sku') |
|
119
|
|
|
->setBasketItemText('Description') |
|
120
|
|
|
->setBasketItemRiskClass(0) |
|
121
|
|
|
->setBasketItemType('DEFAULT') |
|
122
|
|
|
); |
|
123
|
|
|
|
|
124
|
|
|
return $basket; |
|
125
|
|
|
} |
|
126
|
|
|
} |
|
127
|
|
|
|
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