CloseOrderTransaction   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 29
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A allowPartialProcessing() 0 3 1
A execute() 0 14 2
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\Transaction;
9
10
use Generated\Shared\Transfer\AmazonpayCallTransfer;
11
use SprykerEco\Shared\AmazonPay\AmazonPayConfig;
12
13
class CloseOrderTransaction extends AbstractAmazonpayTransaction
14
{
15
    /**
16
     * @param \Generated\Shared\Transfer\AmazonpayCallTransfer $amazonPayCallTransfer
17
     *
18
     * @return \Generated\Shared\Transfer\AmazonpayCallTransfer
19
     */
20
    public function execute(AmazonpayCallTransfer $amazonPayCallTransfer)
21
    {
22
        $amazonPayCallTransfer = parent::execute($amazonPayCallTransfer);
23
24
        if (!$this->apiResponse->getResponseHeader()->getIsSuccess()) {
25
            return $amazonPayCallTransfer;
26
        }
27
28
        $this->paymentProcessor->updateStatus(
29
            $amazonPayCallTransfer->getAmazonpayPayment()->getOrderReferenceId(),
30
            AmazonPayConfig::STATUS_CLOSED
31
        );
32
33
        return $amazonPayCallTransfer;
34
    }
35
36
    /**
37
     * @return bool
38
     */
39
    protected function allowPartialProcessing()
40
    {
41
        return false;
42
    }
43
}
44