Transaction::_container()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Helix\Shopify\Order;
4
5
use Helix\Shopify\Base\AbstractEntity;
6
use Helix\Shopify\Base\AbstractEntity\CreateTrait;
7
use Helix\Shopify\Order;
8
use Helix\Shopify\Order\Transaction\Payment;
9
10
/**
11
 * A transaction.
12
 *
13
 * @see https://help.shopify.com/en/api/reference/orders/transaction
14
 *
15
 * @method string       getAmount       ()
16
 * @method string       getAuthorization()
17
 * @method string       getCreatedAt    ()
18
 * @method string       getCurrency     ()
19
 * @method string       getDeviceId     ()
20
 * @method string       getErrorCode    ()
21
 * @method string       getGateway      ()
22
 * @method string       getKind         ()
23
 * @method string       getLocationId   ()
24
 * @method string       getMessage      ()
25
 * @method string       getOrderId      () injected
26
 * @method string       getParentId     ()
27
 * @method null|Payment getPaymentDetails()
28
 * @method string       getProcessedAt  ()
29
 * @method array        getReceipt      ()
30
 * @method string       getSourceName   ()
31
 * @method string       getStatus       ()
32
 * @method bool         isTest          ()
33
 * @method string       getUserId       ()
34
 *
35
 * @method $this        setAmount       (string $amount)    @when new
36
 * @method $this        setAuthorization(string $auth)      @when new
37
 * @method $this        setCurrency     (string $iso4217)   @when new
38
 * @method $this        setKind         (string $kind)      @when new
39
 * @method $this        setParentId     (string $id)        @when new
40
 * @method $this        setProcessedAt  (string $iso8601)   @when new
41
 * @method $this        setTest         (bool $test)        @when new
42
 * @method $this        setUserId       (string $id)        @when new
43
 */
44
class Transaction extends AbstractEntity
45
{
46
47
    use CreateTrait;
48
49
    const TYPE = 'transaction';
50
    const DIR = 'transactions';
51
52
    const MAP = [
53
        'payment_details' => Payment::class
54
    ];
55
56
    const KIND_AUTH = 'authorization';
57
    const KIND_CAPTURE = 'capture';
58
    const KIND_REFUND = 'refund';
59
    const KIND_SALE = 'sale';
60
    const KIND_VOID = 'void';
61
62
    protected function _container()
63
    {
64
        return $this->getOrder();
65
    }
66
67
    public function getOrder()
68
    {
69
        return Order::load($this, $this->getOrderId());
70
    }
71
}