Completed
Pull Request — dev (#9)
by Andrey
08:35 queued 04:34
created

IpnRequestLogger::log()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 2
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
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\Ipn\Logger;
9
10
use Generated\Shared\Transfer\AmazonpayIpnPaymentRequestTransfer;
1 ignored issue
show
Bug introduced by
The type Generated\Shared\Transfe...nPaymentRequestTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use Orm\Zed\AmazonPay\Persistence\SpyPaymentAmazonpay;
1 ignored issue
show
Bug introduced by
The type Orm\Zed\AmazonPay\Persistence\SpyPaymentAmazonpay was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use Orm\Zed\AmazonPay\Persistence\SpyPaymentAmazonpayIpnLog;
1 ignored issue
show
Bug introduced by
The type Orm\Zed\AmazonPay\Persis...yPaymentAmazonpayIpnLog was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
use SprykerEco\Zed\AmazonPay\Dependency\Facade\AmazonPayToUtilEncodingInterface;
14
15
class IpnRequestLogger implements IpnRequestLoggerInterface
16
{
17
    /**
18
     * @var \SprykerEco\Zed\AmazonPay\Dependency\Facade\AmazonPayToUtilEncodingInterface
19
     */
20
    protected $utilEncoding;
21
22
    /**
23
     * @param \SprykerEco\Zed\AmazonPay\Dependency\Facade\AmazonPayToUtilEncodingInterface $utilEncoding
24
     */
25
    public function __construct(AmazonPayToUtilEncodingInterface $utilEncoding)
26
    {
27
        $this->utilEncoding = $utilEncoding;
28
    }
29
30
    /**
31
     * @param \Generated\Shared\Transfer\AmazonpayIpnPaymentRequestTransfer $paymentRequestTransfer
32
     * @param \Orm\Zed\AmazonPay\Persistence\SpyPaymentAmazonpay $paymentAmazonpay
33
     *
34
     * @return void
35
     */
36
    public function log(AmazonpayIpnPaymentRequestTransfer $paymentRequestTransfer, SpyPaymentAmazonpay $paymentAmazonpay)
37
    {
38
        $ipnLog = new SpyPaymentAmazonpayIpnLog();
39
40
        $ipnLog->setMessage($this->utilEncoding->encodeJson($paymentRequestTransfer->toArray()));
41
        $ipnLog->setMessageId($paymentRequestTransfer->getMessage()->getMessageId());
42
        $ipnLog->setFkPaymentAmazonpay($paymentAmazonpay->getIdPaymentAmazonpay());
43
        $ipnLog->save();
44
    }
45
}
46