Passed
Pull Request — master (#13)
by Dmitri
05:09
created

PayolutionFacade::reAuthorizePartialPayment()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 9
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
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\Payolution\Business;
9
10
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...
11
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...
12
use Generated\Shared\Transfer\PayolutionOmsOperationRequestTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...perationRequestTransfer 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\PayolutionTransactionResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...sactionResponseTransfer 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\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...
15
use Spryker\Zed\Kernel\Business\AbstractFacade;
16
17
/**
18
 * @method \SprykerEco\Zed\Payolution\Business\PayolutionBusinessFactory getFactory()
19
 */
20
class PayolutionFacade extends AbstractFacade implements PayolutionFacadeInterface
21
{
22
    /**
23
     * @api
24
     *
25
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
26
     * @param \Generated\Shared\Transfer\CheckoutResponseTransfer $checkoutResponseTransfer
27
     *
28
     * @return void
29
     */
30
    public function saveOrderPayment(QuoteTransfer $quoteTransfer, CheckoutResponseTransfer $checkoutResponseTransfer)
31
    {
32
        $this
33
             ->getFactory()
34
             ->createOrderSaver()
35
             ->saveOrderPayment($quoteTransfer, $checkoutResponseTransfer);
36
    }
37
38
    /**
39
     * @api
40
     *
41
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
42
     *
43
     * @return \Generated\Shared\Transfer\PayolutionTransactionResponseTransfer
44
     */
45
    public function preCheckPayment(QuoteTransfer $quoteTransfer)
46
    {
47
        $payolutionResponseTransfer = $this
48
            ->getFactory()
49
            ->createPaymentTransactionHandler()
50
            ->preCheckPayment($quoteTransfer);
51
52
        return $payolutionResponseTransfer;
53
    }
54
55
    /**
56
     * @api
57
     *
58
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
59
     * @param int $idPayment
60
     *
61
     * @return \Generated\Shared\Transfer\PayolutionTransactionResponseTransfer
62
     */
63
    public function preAuthorizePayment(OrderTransfer $orderTransfer, $idPayment)
64
    {
65
        return $this
66
            ->getFactory()
67
            ->createPaymentTransactionHandler()
68
            ->preAuthorizePayment($orderTransfer, $idPayment);
69
    }
70
71
    /**
72
     * @api
73
     *
74
     * @param \Generated\Shared\Transfer\PayolutionOmsOperationRequestTransfer $payolutionOmsOperationRequestTransfer
75
     *
76
     * @return \Generated\Shared\Transfer\PayolutionTransactionResponseTransfer
77
     */
78
    public function preAuthorizePartialPayment(PayolutionOmsOperationRequestTransfer $payolutionOmsOperationRequestTransfer): PayolutionTransactionResponseTransfer
79
    {
80
//        $isAo = $payolutionOmsOperationRequestTransfer->getSelectedItems() instanceof \ArrayObject;
81
//
82
//        echo $isAo ? 'YES' : 'NO';
83
//        exit;
84
85
        return $this
86
            ->getFactory()
87
            ->createPaymentTransactionHandler()
88
            ->preAuthorizePayment(
89
                $payolutionOmsOperationRequestTransfer->getOrder(),
90
                $payolutionOmsOperationRequestTransfer->getIdPayment(),
91
                $payolutionOmsOperationRequestTransfer->getSelectedItems()
92
            );
93
    }
94
95
    /**
96
     * @api
97
     *
98
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
99
     * @param int $idPayment
100
     *
101
     * @return \Generated\Shared\Transfer\PayolutionTransactionResponseTransfer
102
     */
103
    public function reAuthorizePayment(OrderTransfer $orderTransfer, $idPayment)
104
    {
105
        return $this
106
            ->getFactory()
107
            ->createPaymentTransactionHandler()
108
            ->reAuthorizePayment($orderTransfer, $idPayment);
109
    }
110
111
    /**
112
     * @api
113
     *
114
     * @param \Generated\Shared\Transfer\PayolutionOmsOperationRequestTransfer $payolutionOmsOperationRequestTransfer
115
     *
116
     * @return \Generated\Shared\Transfer\PayolutionTransactionResponseTransfer
117
     */
118
    public function reAuthorizePartialPayment(PayolutionOmsOperationRequestTransfer $payolutionOmsOperationRequestTransfer): PayolutionTransactionResponseTransfer
119
    {
120
        return $this
121
            ->getFactory()
122
            ->createPaymentTransactionHandler()
123
            ->reAuthorizePayment(
124
                $payolutionOmsOperationRequestTransfer->getOrder(),
125
                $payolutionOmsOperationRequestTransfer->getIdPayment(),
126
                $payolutionOmsOperationRequestTransfer->getSelectedItems()
127
            );
128
    }
129
130
    /**
131
     * @api
132
     *
133
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
134
     * @param int $idPayment
135
     *
136
     * @return \Generated\Shared\Transfer\PayolutionTransactionResponseTransfer
137
     */
138
    public function revertPayment(OrderTransfer $orderTransfer, $idPayment)
139
    {
140
        return $this
141
            ->getFactory()
142
            ->createPaymentTransactionHandler()
143
            ->revertPayment($orderTransfer, $idPayment);
144
    }
145
146
    /**
147
     * @api
148
     *
149
     * @param \Generated\Shared\Transfer\PayolutionOmsOperationRequestTransfer $payolutionOmsOperationRequestTransfer
150
     *
151
     * @return \Generated\Shared\Transfer\PayolutionTransactionResponseTransfer
152
     */
153
    public function revertPartialPayment(PayolutionOmsOperationRequestTransfer $payolutionOmsOperationRequestTransfer): PayolutionTransactionResponseTransfer
154
    {
155
        return $this
156
            ->getFactory()
157
            ->createPaymentTransactionHandler()
158
            ->revertPayment(
159
                $payolutionOmsOperationRequestTransfer->getOrder(),
160
                $payolutionOmsOperationRequestTransfer->getIdPayment(),
161
                $payolutionOmsOperationRequestTransfer->getSelectedItems()
162
            );
163
    }
164
165
166
    /**
167
     * @api
168
     *
169
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
170
     * @param int $idPayment
171
     *
172
     * @return \Generated\Shared\Transfer\PayolutionTransactionResponseTransfer
173
     */
174
    public function capturePayment(OrderTransfer $orderTransfer, $idPayment)
175
    {
176
        return $this
177
            ->getFactory()
178
            ->createPaymentTransactionHandler()
179
            ->capturePayment($orderTransfer, $idPayment);
180
    }
181
182
    /**
183
     * @api
184
     *
185
     * @param \Generated\Shared\Transfer\PayolutionOmsOperationRequestTransfer $payolutionOmsOperationRequestTransfer
186
     *
187
     * @return \Generated\Shared\Transfer\PayolutionTransactionResponseTransfer
188
     */
189
    public function capturePartialPayment(PayolutionOmsOperationRequestTransfer $payolutionOmsOperationRequestTransfer): PayolutionTransactionResponseTransfer
190
    {
191
        return $this
192
            ->getFactory()
193
            ->createPaymentTransactionHandler()
194
            ->capturePayment(
195
                $payolutionOmsOperationRequestTransfer->getOrder(),
196
                $payolutionOmsOperationRequestTransfer->getIdPayment(),
197
                $payolutionOmsOperationRequestTransfer->getSelectedItems()
198
            );
199
    }
200
201
202
    /**
203
     * @api
204
     *
205
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
206
     * @param int $idPayment
207
     *
208
     * @return \Generated\Shared\Transfer\PayolutionTransactionResponseTransfer
209
     */
210
    public function refundPayment(OrderTransfer $orderTransfer, $idPayment)
211
    {
212
        return $this
213
            ->getFactory()
214
            ->createPaymentTransactionHandler()
215
            ->refundPayment($orderTransfer, $idPayment);
216
    }
217
218
    /**
219
     * @api
220
     *
221
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
222
     *
223
     * @return \Generated\Shared\Transfer\PayolutionCalculationResponseTransfer
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...ulationResponseTransfer 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...
224
     */
225
    public function calculateInstallmentPayments(QuoteTransfer $quoteTransfer)
226
    {
227
        $payolutionResponseTransfer = $this
228
            ->getFactory()
229
            ->createPaymentCalculationHandler()
230
            ->calculateInstallmentPayments($quoteTransfer);
231
232
        return $payolutionResponseTransfer;
233
    }
234
235
    /**
236
     * @api
237
     *
238
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
239
     *
240
     * @return bool
241
     */
242
    public function isPreAuthorizationApproved(OrderTransfer $orderTransfer)
243
    {
244
        return $this
245
            ->getFactory()
246
            ->createTransactionStatusLog()
247
            ->isPreAuthorizationApproved($orderTransfer);
248
    }
249
250
    /**
251
     * @api
252
     *
253
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
254
     *
255
     * @return bool
256
     */
257
    public function isReAuthorizationApproved(OrderTransfer $orderTransfer)
258
    {
259
        return $this
260
            ->getFactory()
261
            ->createTransactionStatusLog()
262
            ->isReAuthorizationApproved($orderTransfer);
263
    }
264
265
    /**
266
     * @api
267
     *
268
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
269
     *
270
     * @return bool
271
     */
272
    public function isReversalApproved(OrderTransfer $orderTransfer)
273
    {
274
        return $this
275
            ->getFactory()
276
            ->createTransactionStatusLog()
277
            ->isReversalApproved($orderTransfer);
278
    }
279
280
    /**
281
     * @api
282
     *
283
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
284
     *
285
     * @return bool
286
     */
287
    public function isCaptureApproved(OrderTransfer $orderTransfer)
288
    {
289
        return $this
290
            ->getFactory()
291
            ->createTransactionStatusLog()
292
            ->isCaptureApproved($orderTransfer);
293
    }
294
295
    /**
296
     * @api
297
     *
298
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
299
     *
300
     * @return bool
301
     */
302
    public function isRefundApproved(OrderTransfer $orderTransfer)
303
    {
304
        return $this
305
            ->getFactory()
306
            ->createTransactionStatusLog()
307
            ->isRefundApproved($orderTransfer);
308
    }
309
}
310