|
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\Business\Request\CrefoPayApiRequestFields; |
|
13
|
|
|
|
|
14
|
|
|
class CaptureRequestConverter implements CrefoPayApiRequestConverterInterface |
|
15
|
|
|
{ |
|
16
|
|
|
/** |
|
17
|
|
|
* @param \Generated\Shared\Transfer\CrefoPayApiRequestTransfer $requestTransfer |
|
18
|
|
|
* |
|
19
|
|
|
* @return array |
|
20
|
|
|
*/ |
|
21
|
|
|
public function convertRequestTransferToArray(CrefoPayApiRequestTransfer $requestTransfer): array |
|
22
|
|
|
{ |
|
23
|
|
|
$captureRequest = $requestTransfer->getCaptureRequest(); |
|
24
|
|
|
if ($captureRequest === null) { |
|
25
|
|
|
return []; |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
return [ |
|
29
|
|
|
CrefoPayApiRequestFields::API_FIELD_MERCHANT_ID => $captureRequest->getMerchantID(), |
|
30
|
|
|
CrefoPayApiRequestFields::API_FIELD_STORE_ID => $captureRequest->getStoreID(), |
|
31
|
|
|
CrefoPayApiRequestFields::API_FIELD_ORDER_ID => $captureRequest->getOrderID(), |
|
32
|
|
|
CrefoPayApiRequestFields::API_FIELD_CAPTURE_ID => $captureRequest->getCaptureID(), |
|
33
|
|
|
CrefoPayApiRequestFields::API_FIELD_AMOUNT => $this->getAmountData($captureRequest->getAmount()), |
|
34
|
|
|
]; |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* @param \Generated\Shared\Transfer\CrefoPayApiAmountTransfer|null $amountTransfer |
|
39
|
|
|
* |
|
40
|
|
|
* @return array|null |
|
41
|
|
|
*/ |
|
42
|
|
|
protected function getAmountData(?CrefoPayApiAmountTransfer $amountTransfer): ?array |
|
43
|
|
|
{ |
|
44
|
|
|
return $amountTransfer ? $this->convertAmountTransferToArray($amountTransfer) : null; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @param \Generated\Shared\Transfer\CrefoPayApiAmountTransfer $amountTransfer |
|
49
|
|
|
* |
|
50
|
|
|
* @return array |
|
51
|
|
|
*/ |
|
52
|
|
|
protected function convertAmountTransferToArray(CrefoPayApiAmountTransfer $amountTransfer): array |
|
53
|
|
|
{ |
|
54
|
|
|
return [ |
|
55
|
|
|
CrefoPayApiRequestFields::API_OBJECT_AMOUNT_FIELD_AMOUNT => $amountTransfer->getAmount(), |
|
56
|
|
|
CrefoPayApiRequestFields::API_OBJECT_AMOUNT_FIELD_VAT_AMOUNT => $amountTransfer->getVatAmount(), |
|
57
|
|
|
CrefoPayApiRequestFields::API_OBJECT_AMOUNT_FIELD_VAT_RATE => $amountTransfer->getVatRate(), |
|
58
|
|
|
]; |
|
59
|
|
|
} |
|
60
|
|
|
} |
|
61
|
|
|
|
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