AfterPayApiAdapter   A
last analyzed

Complexity

Total Complexity 12

Size/Duplication

Total Lines 145
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 36
c 1
b 0
f 0
dl 0
loc 145
rs 10
wmc 12

12 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A sendLookupCustomerRequest() 0 5 1
A sendValidateCustomerRequest() 0 6 1
A getApiStatus() 0 5 1
A sendCancelRequest() 0 5 1
A sendAvailablePaymentMethodsRequest() 0 6 1
A sendCaptureRequest() 0 5 1
A sendLookupInstallmentPlansRequest() 0 6 1
A getApiVersion() 0 5 1
A sendRefundRequest() 0 5 1
A sendAuthorizationRequest() 0 5 1
A sendValidateBankAccountRequest() 0 6 1
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\Api\Adapter;
9
10
use Generated\Shared\Transfer\AfterPayApiResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...rPayApiResponseTransfer 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 Generated\Shared\Transfer\AfterPayAuthorizeRequestTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...uthorizeRequestTransfer 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 Generated\Shared\Transfer\AfterPayAvailablePaymentMethodsRequestTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...tMethodsRequestTransfer 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 Generated\Shared\Transfer\AfterPayAvailablePaymentMethodsResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...MethodsResponseTransfer 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...
14
use Generated\Shared\Transfer\AfterPayCancelRequestTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...ayCancelRequestTransfer 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...
15
use Generated\Shared\Transfer\AfterPayCancelResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...yCancelResponseTransfer 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...
16
use Generated\Shared\Transfer\AfterPayCaptureRequestTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...yCaptureRequestTransfer 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...
17
use Generated\Shared\Transfer\AfterPayCaptureResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...CaptureResponseTransfer 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...
18
use Generated\Shared\Transfer\AfterPayCustomerLookupRequestTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...erLookupRequestTransfer 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...
19
use Generated\Shared\Transfer\AfterPayCustomerLookupResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...rLookupResponseTransfer 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...
20
use Generated\Shared\Transfer\AfterPayInstallmentPlansRequestTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...entPlansRequestTransfer 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...
21
use Generated\Shared\Transfer\AfterPayInstallmentPlansResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...ntPlansResponseTransfer 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...
22
use Generated\Shared\Transfer\AfterPayRefundRequestTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...ayRefundRequestTransfer 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...
23
use Generated\Shared\Transfer\AfterPayRefundResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...yRefundResponseTransfer 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...
24
use Generated\Shared\Transfer\AfterPayValidateBankAccountRequestTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...kAccountRequestTransfer 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...
25
use Generated\Shared\Transfer\AfterPayValidateBankAccountResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...AccountResponseTransfer 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...
26
use Generated\Shared\Transfer\AfterPayValidateCustomerRequestTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...CustomerRequestTransfer 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...
27
use Generated\Shared\Transfer\AfterPayValidateCustomerResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...ustomerResponseTransfer 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...
28
29
class AfterPayApiAdapter implements AdapterInterface
30
{
31
    /**
32
     * @var \SprykerEco\Zed\AfterPay\Business\Api\Adapter\AdapterFactoryInterface
33
     */
34
    protected $adapterFactory;
35
36
    /**
37
     * @param \SprykerEco\Zed\AfterPay\Business\Api\Adapter\AdapterFactoryInterface $adapterFactory
38
     */
39
    public function __construct(AdapterFactoryInterface $adapterFactory)
40
    {
41
        $this->adapterFactory = $adapterFactory;
42
    }
43
44
    /**
45
     * @param \Generated\Shared\Transfer\AfterPayAvailablePaymentMethodsRequestTransfer $requestTransfer
46
     *
47
     * @return \Generated\Shared\Transfer\AfterPayAvailablePaymentMethodsResponseTransfer
48
     */
49
    public function sendAvailablePaymentMethodsRequest(
50
        AfterPayAvailablePaymentMethodsRequestTransfer $requestTransfer
51
    ): AfterPayAvailablePaymentMethodsResponseTransfer {
52
        return $this->adapterFactory
53
            ->createAvailablePaymentMethodsCall()
54
            ->execute($requestTransfer);
55
    }
56
57
    /**
58
     * @param \Generated\Shared\Transfer\AfterPayAuthorizeRequestTransfer $authorizeRequestTransfer
59
     *
60
     * @return \Generated\Shared\Transfer\AfterPayApiResponseTransfer
61
     */
62
    public function sendAuthorizationRequest(AfterPayAuthorizeRequestTransfer $authorizeRequestTransfer): AfterPayApiResponseTransfer
63
    {
64
        return $this->adapterFactory
65
            ->createAuthorizePaymentCall()
66
            ->execute($authorizeRequestTransfer);
67
    }
68
69
    /**
70
     * @param \Generated\Shared\Transfer\AfterPayValidateCustomerRequestTransfer $validateCustomerRequestTransfer
71
     *
72
     * @return \Generated\Shared\Transfer\AfterPayValidateCustomerResponseTransfer
73
     */
74
    public function sendValidateCustomerRequest(
75
        AfterPayValidateCustomerRequestTransfer $validateCustomerRequestTransfer
76
    ): AfterPayValidateCustomerResponseTransfer {
77
        return $this->adapterFactory
78
            ->createValidateCustomerCall()
79
            ->execute($validateCustomerRequestTransfer);
80
    }
81
82
    /**
83
     * @param \Generated\Shared\Transfer\AfterPayValidateBankAccountRequestTransfer $validateBankAccountRequestTransfer
84
     *
85
     * @return \Generated\Shared\Transfer\AfterPayValidateBankAccountResponseTransfer
86
     */
87
    public function sendValidateBankAccountRequest(
88
        AfterPayValidateBankAccountRequestTransfer $validateBankAccountRequestTransfer
89
    ): AfterPayValidateBankAccountResponseTransfer {
90
        return $this->adapterFactory
91
            ->createValidateBankAccountCall()
92
            ->execute($validateBankAccountRequestTransfer);
93
    }
94
95
    /**
96
     * @param \Generated\Shared\Transfer\AfterPayCustomerLookupRequestTransfer $customerLookupRequestTransfer
97
     *
98
     * @return \Generated\Shared\Transfer\AfterPayCustomerLookupResponseTransfer
99
     */
100
    public function sendLookupCustomerRequest(AfterPayCustomerLookupRequestTransfer $customerLookupRequestTransfer): AfterPayCustomerLookupResponseTransfer
101
    {
102
        return $this->adapterFactory
103
            ->createLookupCustomerCall()
104
            ->execute($customerLookupRequestTransfer);
105
    }
106
107
    /**
108
     * @param \Generated\Shared\Transfer\AfterPayInstallmentPlansRequestTransfer $installmentPlansRequestTransfer
109
     *
110
     * @return \Generated\Shared\Transfer\AfterPayInstallmentPlansResponseTransfer
111
     */
112
    public function sendLookupInstallmentPlansRequest(
113
        AfterPayInstallmentPlansRequestTransfer $installmentPlansRequestTransfer
114
    ): AfterPayInstallmentPlansResponseTransfer {
115
        return $this->adapterFactory
116
            ->createLookupInstallmentPlansCall()
117
            ->execute($installmentPlansRequestTransfer);
118
    }
119
120
    /**
121
     * @param \Generated\Shared\Transfer\AfterPayCaptureRequestTransfer $captureRequestTransfer
122
     *
123
     * @return \Generated\Shared\Transfer\AfterPayCaptureResponseTransfer
124
     */
125
    public function sendCaptureRequest(AfterPayCaptureRequestTransfer $captureRequestTransfer): AfterPayCaptureResponseTransfer
126
    {
127
        return $this->adapterFactory
128
            ->createCaptureCall()
129
            ->execute($captureRequestTransfer);
130
    }
131
132
    /**
133
     * @param \Generated\Shared\Transfer\AfterPayCancelRequestTransfer $cancelRequestTransfer
134
     *
135
     * @return \Generated\Shared\Transfer\AfterPayCancelResponseTransfer
136
     */
137
    public function sendCancelRequest(AfterPayCancelRequestTransfer $cancelRequestTransfer): AfterPayCancelResponseTransfer
138
    {
139
        return $this->adapterFactory
140
            ->createCancelCall()
141
            ->execute($cancelRequestTransfer);
142
    }
143
144
    /**
145
     * @param \Generated\Shared\Transfer\AfterPayRefundRequestTransfer $refundRequestTransfer
146
     *
147
     * @return \Generated\Shared\Transfer\AfterPayRefundResponseTransfer
148
     */
149
    public function sendRefundRequest(AfterPayRefundRequestTransfer $refundRequestTransfer): AfterPayRefundResponseTransfer
150
    {
151
        return $this->adapterFactory
152
            ->createRefundCall()
153
            ->execute($refundRequestTransfer);
154
    }
155
156
    /**
157
     * @return string
158
     */
159
    public function getApiVersion(): string
160
    {
161
        return $this->adapterFactory
162
            ->createApiVersionCall()
163
            ->execute();
164
    }
165
166
    /**
167
     * @return int
168
     */
169
    public function getApiStatus(): int
170
    {
171
        return $this->adapterFactory
172
            ->createGetApiStatusCall()
173
            ->execute();
174
    }
175
}
176