1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* MIT License |
5
|
|
|
* For full license information, please view the LICENSE file that was distributed with this source code. |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace SprykerEco\Zed\CrefoPayApi\Business\Request\Converter; |
9
|
|
|
|
10
|
|
|
use Generated\Shared\Transfer\CrefoPayApiAmountTransfer; |
|
|
|
|
11
|
|
|
use Generated\Shared\Transfer\CrefoPayApiRequestTransfer; |
|
|
|
|
12
|
|
|
use SprykerEco\Zed\CrefoPayApi\CrefoPayApiConfig; |
13
|
|
|
|
14
|
|
|
class RefundRequestConverter implements CrefoPayApiRequestConverterInterface |
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* @var \SprykerEco\Zed\CrefoPayApi\CrefoPayApiConfig |
18
|
|
|
*/ |
19
|
|
|
protected $config; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @param \SprykerEco\Zed\CrefoPayApi\CrefoPayApiConfig $config |
23
|
|
|
*/ |
24
|
|
|
public function __construct(CrefoPayApiConfig $config) |
25
|
|
|
{ |
26
|
|
|
$this->config = $config; |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @param \Generated\Shared\Transfer\CrefoPayApiRequestTransfer $requestTransfer |
31
|
|
|
* |
32
|
|
|
* @return array |
33
|
|
|
*/ |
34
|
|
|
public function convertRequestTransferToArray(CrefoPayApiRequestTransfer $requestTransfer): array |
35
|
|
|
{ |
36
|
|
|
$refundRequest = $requestTransfer->getRefundRequest(); |
37
|
|
|
if ($refundRequest === null) { |
38
|
|
|
return []; |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
return [ |
42
|
|
|
$this->config->getApiFieldMerchantId() => $refundRequest->getMerchantID(), |
43
|
|
|
$this->config->getApiFieldStoreId() => $refundRequest->getStoreID(), |
44
|
|
|
$this->config->getApiFieldOrderId() => $refundRequest->getOrderID(), |
45
|
|
|
$this->config->getApiFieldCaptureId() => $refundRequest->getCaptureID(), |
46
|
|
|
$this->config->getApiFieldAmount() => $this->getAmountData($refundRequest->getAmount()), |
47
|
|
|
$this->config->getApiFieldRefundDescription() => $refundRequest->getRefundDescription(), |
48
|
|
|
]; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @param \Generated\Shared\Transfer\CrefoPayApiAmountTransfer|null $amountTransfer |
53
|
|
|
* |
54
|
|
|
* @return array|null |
55
|
|
|
*/ |
56
|
|
|
protected function getAmountData(?CrefoPayApiAmountTransfer $amountTransfer): ?array |
57
|
|
|
{ |
58
|
|
|
return $amountTransfer ? $this->convertAmountTransferToArray($amountTransfer) : null; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @param \Generated\Shared\Transfer\CrefoPayApiAmountTransfer $amountTransfer |
63
|
|
|
* |
64
|
|
|
* @return array |
65
|
|
|
*/ |
66
|
|
|
protected function convertAmountTransferToArray(CrefoPayApiAmountTransfer $amountTransfer): array |
67
|
|
|
{ |
68
|
|
|
return [ |
69
|
|
|
$this->config->getApiObjectAmountFieldAmount() => $amountTransfer->getAmount(), |
70
|
|
|
$this->config->getApiObjectAmountFieldVatAmount() => $amountTransfer->getVatAmount(), |
71
|
|
|
$this->config->getApiObjectAmountFieldVatRate() => $amountTransfer->getVatRate(), |
72
|
|
|
]; |
73
|
|
|
} |
74
|
|
|
} |
75
|
|
|
|
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