Passed
Pull Request — master (#23)
by
unknown
12:56 queued 05:28
created

AfterPayFacade::authorizePaymentForQuote()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
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;
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\AfterPayAvailablePaymentMethodsTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...ePaymentMethodsTransfer 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\AfterPayCallTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\AfterPayCallTransfer 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\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...
14
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...
15
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...
16
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...
17
use Generated\Shared\Transfer\AfterPayPaymentTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\AfterPayPaymentTransfer 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\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...
19
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...
20
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...
21
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...
22
use Generated\Shared\Transfer\CheckoutResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\CheckoutResponseTransfer 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\OrderTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\OrderTransfer 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\PaymentMethodsTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\PaymentMethodsTransfer 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\QuoteTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\QuoteTransfer 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\SaveOrderTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\SaveOrderTransfer 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 Spryker\Zed\Kernel\Business\AbstractFacade;
28
29
/**
30
 * @method \SprykerEco\Zed\AfterPay\Business\AfterPayBusinessFactory getFactory()
31
 * @method \SprykerEco\Zed\AfterPay\Persistence\AfterPayEntityManagerInterface getEntityManager()
32
 */
33
class AfterPayFacade extends AbstractFacade implements AfterPayFacadeInterface
34
{
35
    /**
36
     * {@inheritDoc}
37
     *
38
     * @api
39
     *
40
     * @param \Generated\Shared\Transfer\PaymentMethodsTransfer $paymentMethodsTransfer
41
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
42
     *
43
     * @return \Generated\Shared\Transfer\PaymentMethodsTransfer
44
     */
45
    public function filterPaymentMethods(
46
        PaymentMethodsTransfer $paymentMethodsTransfer,
47
        QuoteTransfer $quoteTransfer
48
    ): PaymentMethodsTransfer {
49
        return $this->getFactory()
50
            ->createPaymentMethodsFilter()
51
            ->filterPaymentMethods($paymentMethodsTransfer, $quoteTransfer);
52
    }
53
54
    /**
55
     * {@inheritDoc}
56
     *
57
     * @api
58
     *
59
     * @param \Generated\Shared\Transfer\AfterPayValidateCustomerRequestTransfer $validateCustomerRequestTransfer
60
     *
61
     * @return \Generated\Shared\Transfer\AfterPayValidateCustomerResponseTransfer
62
     */
63
    public function validateCustomerAddress(AfterPayValidateCustomerRequestTransfer $validateCustomerRequestTransfer): AfterPayValidateCustomerResponseTransfer
64
    {
65
        return $this->getFactory()
66
            ->createValidateCustomerHandler()
67
            ->validateCustomer($validateCustomerRequestTransfer);
68
    }
69
70
    /**
71
     * {@inheritDoc}
72
     *
73
     * @api
74
     *
75
     * @param \Generated\Shared\Transfer\AfterPayValidateBankAccountRequestTransfer $validateBankAccountRequestTransfer
76
     *
77
     * @return \Generated\Shared\Transfer\AfterPayValidateBankAccountResponseTransfer
78
     */
79
    public function validateBankAccount(
80
        AfterPayValidateBankAccountRequestTransfer $validateBankAccountRequestTransfer
81
    ): AfterPayValidateBankAccountResponseTransfer {
82
        return $this->getFactory()
83
            ->createValidateBankAccountHandler()
84
            ->validateBankAccount($validateBankAccountRequestTransfer);
85
    }
86
87
    /**
88
     * {@inheritDoc}
89
     *
90
     * @api
91
     *
92
     * @param \Generated\Shared\Transfer\AfterPayCustomerLookupRequestTransfer $customerLookupRequestTransfer
93
     *
94
     * @return \Generated\Shared\Transfer\AfterPayCustomerLookupResponseTransfer
95
     */
96
    public function lookupCustomer(AfterPayCustomerLookupRequestTransfer $customerLookupRequestTransfer): AfterPayCustomerLookupResponseTransfer
97
    {
98
        return $this->getFactory()
99
            ->createLookupCustomerHandler()
100
            ->lookupCustomer($customerLookupRequestTransfer);
101
    }
102
103
    /**
104
     * {@inheritDoc}
105
     *
106
     * @api
107
     *
108
     * @param \Generated\Shared\Transfer\AfterPayInstallmentPlansRequestTransfer $installmentPlansRequestTransfer
109
     *
110
     * @return \Generated\Shared\Transfer\AfterPayInstallmentPlansResponseTransfer
111
     */
112
    public function lookupInstallmentPlans(AfterPayInstallmentPlansRequestTransfer $installmentPlansRequestTransfer): AfterPayInstallmentPlansResponseTransfer
113
    {
114
        return $this->getFactory()
115
            ->createLookupInstallmentPlansHandler()
116
            ->lookupInstallmentPlans($installmentPlansRequestTransfer);
117
    }
118
119
    /**
120
     * {@inheritDoc}
121
     *
122
     * @api
123
     *
124
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
125
     * @param \Generated\Shared\Transfer\SaveOrderTransfer $saveOrderTransfer
126
     *
127
     * @return void
128
     */
129
    public function saveOrderPayment(QuoteTransfer $quoteTransfer, SaveOrderTransfer $saveOrderTransfer): void
130
    {
131
        $this->getFactory()
132
            ->createOrderSaver()
133
            ->saveOrderPayment($quoteTransfer, $saveOrderTransfer);
134
    }
135
136
    /**
137
     * {@inheritDoc}
138
     *
139
     * @api
140
     *
141
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
142
     * @param \Generated\Shared\Transfer\CheckoutResponseTransfer $checkoutResponseTransfer
143
     *
144
     * @return \Generated\Shared\Transfer\CheckoutResponseTransfer
145
     */
146
    public function postSaveHook(QuoteTransfer $quoteTransfer, CheckoutResponseTransfer $checkoutResponseTransfer): CheckoutResponseTransfer
147
    {
148
        return $this->getFactory()
149
            ->createPostSaveHook()
150
            ->execute($quoteTransfer, $checkoutResponseTransfer);
151
    }
152
153
    /**
154
     * {@inheritDoc}
155
     *
156
     * @api
157
     *
158
     * @param \Generated\Shared\Transfer\AfterPayCallTransfer $afterPayCallTransfer
159
     *
160
     * @return \Generated\Shared\Transfer\AfterPayApiResponseTransfer
161
     */
162
    public function authorizePayment(AfterPayCallTransfer $afterPayCallTransfer): AfterPayApiResponseTransfer
163
    {
164
        return $this->getFactory()
165
            ->createAuthorizeTransactionHandler()
166
            ->authorize($afterPayCallTransfer);
167
    }
168
169
    /**
170
     * {@inheritDoc}
171
     *
172
     * @api
173
     *
174
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
175
     *
176
     * @return void
177
     */
178
    public function authorizePaymentForQuote(QuoteTransfer $quoteTransfer): void
179
    {
180
        $this->getFactory()
181
            ->createAuthorizeTransactionHandler()
182
            ->authorizePaymentForQuote($quoteTransfer);
183
    }
184
185
    /**
186
     * {@inheritDoc}
187
     *
188
     * @api
189
     *
190
     * @param \Generated\Shared\Transfer\ItemTransfer[] $items
191
     * @param \Generated\Shared\Transfer\AfterPayCallTransfer $afterPayCallTransfer
192
     *
193
     * @return void
194
     */
195
    public function capturePayment(array $items, AfterPayCallTransfer $afterPayCallTransfer): void
196
    {
197
        $this->getFactory()
198
            ->createCaptureTransactionHandler()
199
            ->capture($items, $afterPayCallTransfer);
200
    }
201
202
    /**
203
     * {@inheritDoc}
204
     *
205
     * @api
206
     *
207
     * @param \Generated\Shared\Transfer\ItemTransfer[] $items
208
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
209
     *
210
     * @return void
211
     */
212
    public function refundPayment(array $items, OrderTransfer $orderTransfer): void
213
    {
214
        $this->getFactory()
215
            ->createRefundTransactionHandler()
216
            ->refund($items, $orderTransfer);
217
    }
218
219
    /**
220
     * {@inheritDoc}
221
     *
222
     * @api
223
     *
224
     * @param \Generated\Shared\Transfer\ItemTransfer[] $items
225
     * @param \Generated\Shared\Transfer\AfterPayCallTransfer $afterPayCallTransfer
226
     *
227
     * @return void
228
     */
229
    public function cancelPayment(array $items, AfterPayCallTransfer $afterPayCallTransfer): void
230
    {
231
        $this->getFactory()
232
            ->createCancelTransactionHandler()
233
            ->cancel($items, $afterPayCallTransfer);
234
    }
235
236
    /**
237
     * {@inheritDoc}
238
     *
239
     * @api
240
     *
241
     * @param int $idSalesOrder
242
     *
243
     * @return \Generated\Shared\Transfer\AfterPayPaymentTransfer
244
     */
245
    public function getPaymentByIdSalesOrder(int $idSalesOrder): AfterPayPaymentTransfer
246
    {
247
        return $this->getFactory()
248
            ->createPaymentReader()
249
            ->getPaymentByIdSalesOrder($idSalesOrder);
250
    }
251
252
    /**
253
     * {@inheritDoc}
254
     *
255
     * @api
256
     *
257
     * @return string
258
     */
259
    public function getApiVersion(): string
260
    {
261
        return $this->getFactory()
262
            ->createApiAdapter()
263
            ->getApiVersion();
264
    }
265
266
    /**
267
     * {@inheritDoc}
268
     *
269
     * @api
270
     *
271
     * @return int
272
     */
273
    public function getApiStatus(): int
274
    {
275
        return $this->getFactory()
276
            ->createApiAdapter()
277
            ->getApiStatus();
278
    }
279
280
    /**
281
     * {@inheritDoc}
282
     *
283
     * @api
284
     *
285
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
286
     *
287
     * @return \Generated\Shared\Transfer\AfterPayAvailablePaymentMethodsTransfer
288
     */
289
    public function getAvailablePaymentMethods(QuoteTransfer $quoteTransfer): AfterPayAvailablePaymentMethodsTransfer
290
    {
291
        return $this->getFactory()
292
            ->createPaymentMethodsProvider()
293
            ->getAvailablePaymentMethods($quoteTransfer);
294
    }
295
}
296