1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Apache OSL-2 |
5
|
|
|
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace SprykerEco\Zed\Amazonpay\Business\Payment\Handler\Transaction; |
9
|
|
|
|
10
|
|
|
use SprykerEco\Shared\Amazonpay\AmazonpayConfigInterface; |
11
|
|
|
use SprykerEco\Zed\Amazonpay\Business\Api\Adapter\AdapterFactoryInterface; |
12
|
|
|
use SprykerEco\Zed\Amazonpay\Business\Payment\Handler\Transaction\Logger\TransactionLoggerInterface; |
13
|
|
|
use SprykerEco\Zed\Amazonpay\Persistence\AmazonpayQueryContainerInterface; |
14
|
|
|
|
15
|
|
|
class TransactionFactory implements TransactionFactoryInterface |
16
|
|
|
{ |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @var \SprykerEco\Zed\Amazonpay\Business\Api\Adapter\AdapterFactory |
20
|
|
|
*/ |
21
|
|
|
protected $adapterFactory; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @var \SprykerEco\Shared\Amazonpay\AmazonpayConfigInterface |
25
|
|
|
*/ |
26
|
|
|
protected $config; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @var \SprykerEco\Zed\Amazonpay\Persistence\AmazonpayQueryContainerInterface |
30
|
|
|
*/ |
31
|
|
|
protected $amazonpayQueryContainer; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @var \SprykerEco\Zed\Amazonpay\Business\Payment\Method\AmazonpayInterface |
|
|
|
|
35
|
|
|
*/ |
36
|
|
|
protected $amazonpayPaymentMethod; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @var \SprykerEco\Zed\Amazonpay\Business\Payment\Handler\Transaction\Logger\TransactionLoggerInterface |
40
|
|
|
*/ |
41
|
|
|
protected $transactionLogger; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @param \SprykerEco\Zed\Amazonpay\Business\Api\Adapter\AdapterFactoryInterface $adapterFactory |
45
|
|
|
* @param \SprykerEco\Shared\Amazonpay\AmazonpayConfigInterface $config |
46
|
|
|
* @param \SprykerEco\Zed\Amazonpay\Business\Payment\Handler\Transaction\Logger\TransactionLoggerInterface $transactionLogger |
47
|
|
|
* @param \SprykerEco\Zed\Amazonpay\Persistence\AmazonpayQueryContainerInterface $amazonpayQueryContainer |
48
|
|
|
*/ |
49
|
|
|
public function __construct( |
50
|
|
|
AdapterFactoryInterface $adapterFactory, |
51
|
|
|
AmazonpayConfigInterface $config, |
52
|
|
|
TransactionLoggerInterface $transactionLogger, |
53
|
|
|
AmazonpayQueryContainerInterface $amazonpayQueryContainer |
54
|
|
|
) { |
55
|
|
|
$this->adapterFactory = $adapterFactory; |
|
|
|
|
56
|
|
|
$this->config = $config; |
57
|
|
|
$this->transactionLogger = $transactionLogger; |
58
|
|
|
$this->amazonpayQueryContainer = $amazonpayQueryContainer; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @return \SprykerEco\Zed\Amazonpay\Business\Payment\Handler\Transaction\QuoteTransactionInterface |
63
|
|
|
*/ |
64
|
|
|
public function createConfirmOrderReferenceTransaction() |
65
|
|
|
{ |
66
|
|
|
return new ConfirmOrderReferenceTransaction( |
67
|
|
|
$this->adapterFactory->createConfirmOrderReferenceAmazonpayAdapter(), |
68
|
|
|
$this->config, |
69
|
|
|
$this->transactionLogger |
70
|
|
|
); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @return \SprykerEco\Zed\Amazonpay\Business\Payment\Handler\Transaction\QuoteTransactionInterface |
75
|
|
|
*/ |
76
|
|
|
public function createSetOrderReferenceTransaction() |
77
|
|
|
{ |
78
|
|
|
return new SetOrderReferenceDetailsTransaction( |
79
|
|
|
$this->adapterFactory->createSetOrderReferenceDetailsAmazonpayAdapter(), |
80
|
|
|
$this->config, |
81
|
|
|
$this->transactionLogger |
82
|
|
|
); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* @return \SprykerEco\Zed\Amazonpay\Business\Payment\Handler\Transaction\QuoteTransactionInterface |
87
|
|
|
*/ |
88
|
|
|
public function createGetOrderReferenceDetailsTransaction() |
89
|
|
|
{ |
90
|
|
|
return new GetOrderReferenceDetailsTransaction( |
91
|
|
|
$this->adapterFactory->createGetOrderReferenceDetailsAmazonpayAdapter(), |
92
|
|
|
$this->config, |
93
|
|
|
$this->transactionLogger |
94
|
|
|
); |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* @return \SprykerEco\Zed\Amazonpay\Business\Payment\Handler\Transaction\QuoteTransactionInterface |
99
|
|
|
*/ |
100
|
|
|
public function createCancelPreOrderTransaction() |
101
|
|
|
{ |
102
|
|
|
return new CancelPreOrderTransaction( |
|
|
|
|
103
|
|
|
$this->adapterFactory->createCancelPreOrderAdapter(), |
104
|
|
|
$this->config, |
105
|
|
|
$this->transactionLogger |
106
|
|
|
); |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* @return \SprykerEco\Zed\Amazonpay\Business\Payment\Handler\Transaction\OrderTransactionInterface |
111
|
|
|
*/ |
112
|
|
|
public function createCancelOrderTransaction() |
113
|
|
|
{ |
114
|
|
|
return new OrderTransactionCollection( |
115
|
|
|
[ |
116
|
|
|
$this->createRefundOrderTransaction(), |
117
|
|
|
$this->createCancelOrderTransactionObject(), |
118
|
|
|
] |
119
|
|
|
); |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* @return \SprykerEco\Zed\Amazonpay\Business\Payment\Handler\Transaction\OrderTransactionInterface |
124
|
|
|
*/ |
125
|
|
|
protected function createCancelOrderTransactionObject() |
126
|
|
|
{ |
127
|
|
|
return new CancelOrderTransaction( |
128
|
|
|
$this->adapterFactory->createCancelOrderAdapter(), |
129
|
|
|
$this->config, |
130
|
|
|
$this->transactionLogger, |
131
|
|
|
$this->amazonpayQueryContainer |
132
|
|
|
); |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* @return \SprykerEco\Zed\Amazonpay\Business\Payment\Handler\Transaction\QuoteTransactionInterface |
137
|
|
|
*/ |
138
|
|
|
public function createAuthorizeOrderTransaction() |
139
|
|
|
{ |
140
|
|
|
return new AuthorizeOrderTransaction( |
141
|
|
|
$this->adapterFactory->createAuthorizeQuoteAdapter(), |
142
|
|
|
$this->config, |
143
|
|
|
$this->transactionLogger |
144
|
|
|
); |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* @return \SprykerEco\Zed\Amazonpay\Business\Payment\Handler\Transaction\OrderTransactionInterface |
149
|
|
|
*/ |
150
|
|
|
public function createReauthorizeExpiredOrderTransaction() |
151
|
|
|
{ |
152
|
|
|
return new OrderTransactionCollection( |
153
|
|
|
[ |
154
|
|
|
$this->createReauthorizeOrderTransactionObject(), |
155
|
|
|
$this->createUpdateOrderAuthorizationStatusTransaction(), |
156
|
|
|
] |
157
|
|
|
); |
158
|
|
|
} |
159
|
|
|
|
160
|
|
|
/** |
161
|
|
|
* @return \SprykerEco\Zed\Amazonpay\Business\Payment\Handler\Transaction\OrderTransactionInterface |
162
|
|
|
*/ |
163
|
|
|
protected function createReauthorizeOrderTransactionObject() |
164
|
|
|
{ |
165
|
|
|
return new ReauthorizeOrderTransaction( |
166
|
|
|
$this->adapterFactory->createAuthorizeCaptureNowOrderAdapter(), |
167
|
|
|
$this->config, |
168
|
|
|
$this->transactionLogger, |
169
|
|
|
$this->amazonpayQueryContainer |
170
|
|
|
); |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
/** |
174
|
|
|
* @return \SprykerEco\Zed\Amazonpay\Business\Payment\Handler\Transaction\OrderTransactionInterface |
175
|
|
|
*/ |
176
|
|
|
public function createReauthorizeSuspendedOrderTransaction() |
177
|
|
|
{ |
178
|
|
|
return new ReauthorizeOrderTransaction( |
179
|
|
|
$this->adapterFactory->createAuthorizeOrderAdapter(), |
180
|
|
|
$this->config, |
181
|
|
|
$this->transactionLogger, |
182
|
|
|
$this->amazonpayQueryContainer |
183
|
|
|
); |
184
|
|
|
} |
185
|
|
|
|
186
|
|
|
/** |
187
|
|
|
* @return \SprykerEco\Zed\Amazonpay\Business\Payment\Handler\Transaction\OrderTransactionInterface |
188
|
|
|
*/ |
189
|
|
|
protected function createCaptureOrderTransaction() |
190
|
|
|
{ |
191
|
|
|
return new CaptureOrderTransaction( |
192
|
|
|
$this->adapterFactory->createCaptureOrderAdapter(), |
193
|
|
|
$this->config, |
194
|
|
|
$this->transactionLogger, |
195
|
|
|
$this->amazonpayQueryContainer |
196
|
|
|
); |
197
|
|
|
} |
198
|
|
|
|
199
|
|
|
/** |
200
|
|
|
* @return \SprykerEco\Zed\Amazonpay\Business\Payment\Handler\Transaction\OrderTransactionInterface |
201
|
|
|
*/ |
202
|
|
|
public function createCaptureAuthorizedTransaction() |
203
|
|
|
{ |
204
|
|
|
return new OrderTransactionCollection( |
205
|
|
|
[ |
206
|
|
|
$this->createUpdateOrderAuthorizationStatusTransaction(), |
207
|
|
|
$this->createCaptureOrderTransaction(), |
208
|
|
|
] |
209
|
|
|
); |
210
|
|
|
} |
211
|
|
|
|
212
|
|
|
/** |
213
|
|
|
* @return \SprykerEco\Zed\Amazonpay\Business\Payment\Handler\Transaction\OrderTransactionInterface |
214
|
|
|
*/ |
215
|
|
|
public function createCloseOrderTransaction() |
216
|
|
|
{ |
217
|
|
|
return new CloseOrderTransaction( |
218
|
|
|
$this->adapterFactory->createCloseOrderAdapter(), |
219
|
|
|
$this->config, |
220
|
|
|
$this->transactionLogger, |
221
|
|
|
$this->amazonpayQueryContainer |
222
|
|
|
); |
223
|
|
|
} |
224
|
|
|
|
225
|
|
|
/** |
226
|
|
|
* @return \SprykerEco\Zed\Amazonpay\Business\Payment\Handler\Transaction\OrderTransactionInterface |
227
|
|
|
*/ |
228
|
|
|
public function createRefundOrderTransaction() |
229
|
|
|
{ |
230
|
|
|
return new RefundOrderTransaction( |
231
|
|
|
$this->adapterFactory->createRefundOrderAdapter(), |
232
|
|
|
$this->config, |
233
|
|
|
$this->transactionLogger, |
234
|
|
|
$this->amazonpayQueryContainer, |
235
|
|
|
$this->amazonpayPaymentMethod |
|
|
|
|
236
|
|
|
); |
237
|
|
|
} |
238
|
|
|
|
239
|
|
|
/** |
240
|
|
|
* @return \SprykerEco\Zed\Amazonpay\Business\Payment\Handler\Transaction\OrderTransactionInterface |
241
|
|
|
*/ |
242
|
|
|
public function createUpdateOrderRefundStatusTransaction() |
243
|
|
|
{ |
244
|
|
|
return new UpdateOrderRefundStatusTransaction( |
245
|
|
|
$this->adapterFactory->createGetOrderRefundDetailsAdapter(), |
246
|
|
|
$this->config, |
247
|
|
|
$this->transactionLogger, |
248
|
|
|
$this->amazonpayQueryContainer |
249
|
|
|
); |
250
|
|
|
} |
251
|
|
|
|
252
|
|
|
/** |
253
|
|
|
* @return \SprykerEco\Zed\Amazonpay\Business\Payment\Handler\Transaction\OrderTransactionInterface |
254
|
|
|
*/ |
255
|
|
|
public function createUpdateOrderAuthorizationStatusTransaction() |
256
|
|
|
{ |
257
|
|
|
return new UpdateOrderAuthorizationStatusTransaction( |
258
|
|
|
$this->adapterFactory->createGetOrderAuthorizationDetailsAdapter(), |
259
|
|
|
$this->config, |
260
|
|
|
$this->transactionLogger, |
261
|
|
|
$this->amazonpayQueryContainer |
262
|
|
|
); |
263
|
|
|
} |
264
|
|
|
|
265
|
|
|
/** |
266
|
|
|
* @return \SprykerEco\Zed\Amazonpay\Business\Payment\Handler\Transaction\OrderTransactionInterface |
267
|
|
|
*/ |
268
|
|
|
public function createUpdateOrderCaptureStatusTransaction() |
269
|
|
|
{ |
270
|
|
|
return new UpdateOrderCaptureStatusTransaction( |
271
|
|
|
$this->adapterFactory->createGetOrderCaptureDetailsAdapter(), |
272
|
|
|
$this->config, |
273
|
|
|
$this->transactionLogger, |
274
|
|
|
$this->amazonpayQueryContainer |
275
|
|
|
); |
276
|
|
|
} |
277
|
|
|
|
278
|
|
|
/** |
279
|
|
|
* @return \SprykerEco\Zed\Amazonpay\Business\Payment\Handler\Transaction\HandleDeclinedOrderTransaction |
280
|
|
|
*/ |
281
|
|
|
public function createHandleDeclinedOrderTransaction() |
282
|
|
|
{ |
283
|
|
|
return new HandleDeclinedOrderTransaction( |
284
|
|
|
$this->createGetOrderReferenceDetailsTransaction(), |
285
|
|
|
$this->createCancelPreOrderTransaction() |
286
|
|
|
); |
287
|
|
|
} |
288
|
|
|
|
289
|
|
|
/** |
290
|
|
|
* @return \SprykerEco\Zed\Amazonpay\Business\Payment\Handler\Transaction\QuoteTransactionCollection |
291
|
|
|
*/ |
292
|
|
|
public function createConfirmPurchaseTransaction() |
293
|
|
|
{ |
294
|
|
|
return new QuoteTransactionCollection( |
295
|
|
|
[ |
296
|
|
|
$this->createSetOrderReferenceTransaction(), |
297
|
|
|
$this->createConfirmOrderReferenceTransaction(), |
298
|
|
|
$this->createGetOrderReferenceDetailsTransaction(), |
299
|
|
|
$this->createAuthorizeOrderTransaction(), |
300
|
|
|
$this->createHandleDeclinedOrderTransaction(), |
301
|
|
|
] |
302
|
|
|
); |
303
|
|
|
} |
304
|
|
|
|
305
|
|
|
} |
306
|
|
|
|
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