Passed
Pull Request — master (#13)
by Volodymyr
11:21 queued 04:52
created

CaptureOrderTransaction   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 32
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getTransactionType() 0 3 1
A doTransaction() 0 3 1
A getTransactionCode() 0 3 1
A capture() 0 3 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\Braintree\Business\Payment\Transaction;
9
10
use Braintree\Transaction as BraintreeTransaction;
11
use SprykerEco\Zed\Braintree\Business\Payment\Method\ApiConstants;
12
13
class CaptureOrderTransaction extends AbstractTransaction
14
{
15
    /**
16
     * @return string
17
     */
18
    protected function getTransactionType(): string
19
    {
20
        return ApiConstants::SALE;
21
    }
22
23
    /**
24
     * @return string
25
     */
26
    protected function getTransactionCode(): string
27
    {
28
        return ApiConstants::TRANSACTION_CODE_CAPTURE;
29
    }
30
31
    /**
32
     * @return \Braintree\Result\Error|\Braintree\Result\Successful
33
     */
34
    protected function doTransaction()
35
    {
36
        return $this->capture();
37
    }
38
39
    /**
40
     * @return \Braintree\Result\Error|\Braintree\Result\Successful
41
     */
42
    protected function capture()
43
    {
44
        return BraintreeTransaction::submitForSettlement($this->getTransactionIdentifier());
45
    }
46
}
47