|
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\AfterPay\Business\Payment\Transaction\Logger; |
|
9
|
|
|
|
|
10
|
|
|
use Generated\Shared\Transfer\AfterPayApiResponseTransfer; |
|
|
|
|
|
|
11
|
|
|
use Orm\Zed\AfterPay\Persistence\SpyPaymentAfterPayTransactionLog; |
|
|
|
|
|
|
12
|
|
|
use Spryker\Shared\Kernel\Transfer\AbstractTransfer; |
|
13
|
|
|
use SprykerEco\Zed\AfterPay\Dependency\Service\AfterPayToUtilEncodingServiceInterface; |
|
14
|
|
|
|
|
15
|
|
|
class TransactionLogger implements TransactionLoggerInterface |
|
16
|
|
|
{ |
|
17
|
|
|
/** |
|
18
|
|
|
* @var \SprykerEco\Zed\AfterPay\Dependency\Service\AfterPayToUtilEncodingServiceInterface |
|
19
|
|
|
*/ |
|
20
|
|
|
protected $utilEncoding; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* @param \SprykerEco\Zed\AfterPay\Dependency\Service\AfterPayToUtilEncodingServiceInterface $utilEncoding |
|
24
|
|
|
*/ |
|
25
|
|
|
public function __construct(AfterPayToUtilEncodingServiceInterface $utilEncoding) |
|
26
|
|
|
{ |
|
27
|
|
|
$this->utilEncoding = $utilEncoding; |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* @param string $transactionType |
|
32
|
|
|
* @param string $orderReference |
|
33
|
|
|
* @param \Spryker\Shared\Kernel\Transfer\AbstractTransfer $transactionRequest |
|
34
|
|
|
* @param \Generated\Shared\Transfer\AfterPayApiResponseTransfer $transactionResponse |
|
35
|
|
|
* |
|
36
|
|
|
* @return void |
|
37
|
|
|
*/ |
|
38
|
|
|
public function logTransaction( |
|
39
|
|
|
string $transactionType, |
|
40
|
|
|
string $orderReference, |
|
41
|
|
|
AbstractTransfer $transactionRequest, |
|
42
|
|
|
AfterPayApiResponseTransfer $transactionResponse |
|
43
|
|
|
): void { |
|
44
|
|
|
$transactionLog = new SpyPaymentAfterPayTransactionLog(); |
|
45
|
|
|
$transactionLog |
|
46
|
|
|
->setOrderReference($orderReference) |
|
47
|
|
|
->setTransactionType($transactionType) |
|
48
|
|
|
->setOutcome($transactionResponse->getOutcome()) |
|
49
|
|
|
->setRequestPayload($this->getRequestTransferEncoded($transactionRequest)) |
|
50
|
|
|
->setResponsePayload($transactionResponse->getResponsePayload()) |
|
51
|
|
|
->save(); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* @param \Spryker\Shared\Kernel\Transfer\AbstractTransfer $requestTransfer |
|
56
|
|
|
* |
|
57
|
|
|
* @return string |
|
58
|
|
|
*/ |
|
59
|
|
|
protected function getRequestTransferEncoded(AbstractTransfer $requestTransfer): string |
|
60
|
|
|
{ |
|
61
|
|
|
return $this->utilEncoding->encodeJson($requestTransfer->toArray()); |
|
|
|
|
|
|
62
|
|
|
} |
|
63
|
|
|
} |
|
64
|
|
|
|
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