PaymentLogger::error()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 3
rs 10
1
<?php
2
3
/**
4
 * MIT License
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Zed\Ratepay\Business\Log;
9
10
use Orm\Zed\Ratepay\Persistence\SpyPaymentRatepayLog;
0 ignored issues
show
Bug introduced by
The type Orm\Zed\Ratepay\Persistence\SpyPaymentRatepayLog 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 Psr\Log\LoggerInterface;
12
13
class PaymentLogger implements LoggerInterface
14
{
15
    /**
16
     * @param string $message
17
     * @param array $context
18
     *
19
     * @return void
20
     */
21
    public function emergency($message, array $context = [])
22
    {
23
        $this->persist($message, $context);
24
    }
25
26
    /**
27
     * @param string $message
28
     * @param array $context
29
     *
30
     * @return void
31
     */
32
    public function alert($message, array $context = [])
33
    {
34
        $this->persist($message, $context);
35
    }
36
37
    /**
38
     * @param string $message
39
     * @param array $context
40
     *
41
     * @return void
42
     */
43
    public function critical($message, array $context = [])
44
    {
45
        $this->persist($message, $context);
46
    }
47
48
    /**
49
     * @param string $message
50
     * @param array $context
51
     *
52
     * @return void
53
     */
54
    public function error($message, array $context = [])
55
    {
56
        $this->persist($message, $context);
57
    }
58
59
    /**
60
     * @param string $message
61
     * @param array $context
62
     *
63
     * @return void
64
     */
65
    public function warning($message, array $context = [])
66
    {
67
        $this->persist($message, $context);
68
    }
69
70
    /**
71
     * @param string $message
72
     * @param array $context
73
     *
74
     * @return void
75
     */
76
    public function notice($message, array $context = [])
77
    {
78
        $this->persist($message, $context);
79
    }
80
81
    /**
82
     * @param string $message
83
     * @param array $context
84
     *
85
     * @return void
86
     */
87
    public function info($message, array $context = [])
88
    {
89
        $this->persist($message, $context);
90
    }
91
92
    /**
93
     * @param string $message
94
     * @param array $context
95
     *
96
     * @return void
97
     */
98
    public function debug($message, array $context = [])
99
    {
100
        $this->persist($message, $context);
101
    }
102
103
    /**
104
     * @param mixed $level
105
     * @param string $message
106
     * @param array $context
107
     *
108
     * @return void
109
     */
110
    public function log($level, $message, array $context = [])
111
    {
112
        $this->persist($message, $context);
113
    }
114
115
    /**
116
     * @param string $message
117
     * @param array $context
118
     *
119
     * @return void
120
     */
121
    protected function persist($message, array $context = [])
122
    {
123
        $paymentLogEntity = new SpyPaymentRatepayLog();
124
125
        $paymentLogEntity->setFkSalesOrder($context['order_id']);
126
        $paymentLogEntity->setMessage($message);
127
128
        $paymentLogEntity->setPaymentMethod($context['payment_method']);
129
        $paymentLogEntity->setRequestType($context['request_type']);
130
        $paymentLogEntity->setRequestTransactionId($context['request_transaction_id']);
131
        $paymentLogEntity->setRequestTransactionShortId($context['request_transaction_short_id']);
132
        $paymentLogEntity->setRequestBody($context['request_body']);
133
134
        $paymentLogEntity->setResponseType($context['response_type']);
135
        $paymentLogEntity->setResponseResultCode($context['response_result_code']);
136
        $paymentLogEntity->setResponseResultText($context['response_result_text']);
137
        $paymentLogEntity->setResponseTransactionId($context['response_transaction_id']);
138
        $paymentLogEntity->setResponseTransactionShortId($context['response_transaction_short_id']);
139
        $paymentLogEntity->setResponseReasonCode($context['response_reason_code']);
140
        $paymentLogEntity->setResponseReasonText($context['response_reason_text']);
141
        $paymentLogEntity->setResponseStatusCode($context['response_status_code']);
142
        $paymentLogEntity->setResponseStatusText($context['response_status_text']);
143
        $paymentLogEntity->setResponseCustomerMessage($context['response_customer_message']);
144
        $paymentLogEntity->setItemCount($context['item_count']);
145
146
        $paymentLogEntity->save();
147
    }
148
}
149