Completed
Push — develop ( 17c567...8b47e8 )
by Jens
08:20
created

Order::toJson()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 7
ccs 0
cts 0
cp 0
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * @author @jayS-de <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Model\Order;
7
8
use Commercetools\Core\Model\Cart\CustomLineItemCollection;
9
use Commercetools\Core\Model\Cart\LineItemCollection;
10
use Commercetools\Core\Model\Cart\ShippingInfo;
11
use Commercetools\Core\Model\Common\Address;
12
use Commercetools\Core\Model\Common\LocaleTrait;
13
use Commercetools\Core\Model\Common\Resource;
14
use Commercetools\Core\Model\Common\Money;
15
use Commercetools\Core\Model\Common\TaxedPrice;
16
use Commercetools\Core\Model\CustomerGroup\CustomerGroupReference;
17
use Commercetools\Core\Model\Cart\DiscountCodeInfoCollection;
18
use Commercetools\Core\Model\Cart\CartReference;
19
use Commercetools\Core\Model\CustomField\CustomFieldObject;
20
use Commercetools\Core\Model\Common\DateTimeDecorator;
21
use Commercetools\Core\Model\State\StateReference;
22
use Commercetools\Core\Model\Payment\PaymentInfo;
23
24
/**
25
 * @package Commercetools\Core\Model\Order
26
 * @link https://dev.commercetools.com/http-api-projects-orders.html#order
27
 * @method string getId()
28
 * @method Order setId(string $id = null)
29
 * @method int getVersion()
30
 * @method Order setVersion(int $version = null)
31
 * @method DateTimeDecorator getCreatedAt()
32
 * @method Order setCreatedAt(\DateTime $createdAt = null)
33
 * @method DateTimeDecorator getLastModifiedAt()
34
 * @method Order setLastModifiedAt(\DateTime $lastModifiedAt = null)
35
 * @method string getOrderNumber()
36
 * @method Order setOrderNumber(string $orderNumber = null)
37
 * @method string getCustomerId()
38
 * @method Order setCustomerId(string $customerId = null)
39
 * @method string getCustomerEmail()
40
 * @method Order setCustomerEmail(string $customerEmail = null)
41
 * @method LineItemCollection getLineItems()
42
 * @method Order setLineItems(LineItemCollection $lineItems = null)
43
 * @method CustomLineItemCollection getCustomLineItems()
44
 * @method Order setCustomLineItems(CustomLineItemCollection $customLineItems = null)
45
 * @method Money getTotalPrice()
46
 * @method Order setTotalPrice(Money $totalPrice = null)
47
 * @method TaxedPrice getTaxedPrice()
48
 * @method Order setTaxedPrice(TaxedPrice $taxedPrice = null)
49
 * @method Address getShippingAddress()
50
 * @method Order setShippingAddress(Address $shippingAddress = null)
51
 * @method Address getBillingAddress()
52
 * @method Order setBillingAddress(Address $billingAddress = null)
53
 * @method string getInventoryMode()
54
 * @method Order setInventoryMode(string $inventoryMode = null)
55
 * @method CustomerGroupReference getCustomerGroup()
56
 * @method Order setCustomerGroup(CustomerGroupReference $customerGroup = null)
57
 * @method string getCountry()
58
 * @method Order setCountry(string $country = null)
59
 * @method string getOrderState()
60
 * @method Order setOrderState(string $orderState = null)
61
 * @method string getShipmentState()
62
 * @method Order setShipmentState(string $shipmentState = null)
63
 * @method string getPaymentState()
64
 * @method Order setPaymentState(string $paymentState = null)
65
 * @method ShippingInfo getShippingInfo()
66
 * @method Order setShippingInfo(ShippingInfo $shippingInfo = null)
67
 * @method SyncInfoCollection getSyncInfo()
68
 * @method Order setSyncInfo(SyncInfoCollection $syncInfo = null)
69
 * @method ReturnInfoCollection getReturnInfo()
70
 * @method Order setReturnInfo(ReturnInfoCollection $returnInfo = null)
71
 * @method DiscountCodeInfoCollection getDiscountCodes()
72
 * @method Order setDiscountCodes(DiscountCodeInfoCollection $discountCodes = null)
73
 * @method int getLastMessageSequenceNumber()
74
 * @method Order setLastMessageSequenceNumber(int $lastMessageSequenceNumber = null)
75
 * @method CartReference getCart()
76
 * @method Order setCart(CartReference $cart = null)
77
 * @method CustomFieldObject getCustom()
78
 * @method Order setCustom(CustomFieldObject $custom = null)
79
 * @method StateReference getState()
80
 * @method Order setState(StateReference $state = null)
81
 * @method PaymentInfo getPaymentInfo()
82
 * @method Order setPaymentInfo(PaymentInfo $paymentInfo = null)
83
 * @method DateTimeDecorator getCompletedAt()
84
 * @method Order setCompletedAt(\DateTime $completedAt = null)
85
 * @method string getAnonymousId()
86
 * @method Order setAnonymousId(string $anonymousId = null)
87
 * @method string getLocale()
88
 * @method OrderReference getReference()
89
 */
90
class Order extends Resource
91
{
92
    use LocaleTrait;
93
94 31
    public function fieldDefinitions()
95
    {
96
        return [
97 31
            'id' => [static::TYPE => 'string'],
98 31
            'version' => [static::TYPE => 'int'],
99
            'createdAt' => [
100 31
                static::TYPE => '\DateTime',
101 31
                static::DECORATOR => '\Commercetools\Core\Model\Common\DateTimeDecorator'
102
            ],
103
            'lastModifiedAt' => [
104 31
                static::TYPE => '\DateTime',
105 31
                static::DECORATOR => '\Commercetools\Core\Model\Common\DateTimeDecorator'
106
            ],
107
            'completedAt' => [
108 31
                static::TYPE => '\DateTime',
109 31
                static::DECORATOR => '\Commercetools\Core\Model\Common\DateTimeDecorator'
110
            ],
111 31
            'orderNumber' => [static::TYPE => 'string'],
112 31
            'customerId' => [static::TYPE => 'string'],
113 31
            'customerEmail' => [static::TYPE => 'string'],
114 31
            'lineItems' => [static::TYPE => '\Commercetools\Core\Model\Cart\LineItemCollection'],
115 31
            'customLineItems' => [static::TYPE => '\Commercetools\Core\Model\Cart\CustomLineItemCollection'],
116 31
            'totalPrice' => [static::TYPE => '\Commercetools\Core\Model\Common\Money'],
117 31
            'taxedPrice' => [static::TYPE => '\Commercetools\Core\Model\Common\TaxedPrice'],
118 31
            'shippingAddress' => [static::TYPE => '\Commercetools\Core\Model\Common\Address'],
119 31
            'billingAddress' => [static::TYPE => '\Commercetools\Core\Model\Common\Address'],
120 31
            'inventoryMode' => [static::TYPE => 'string'],
121 31
            'customerGroup' => [static::TYPE => '\Commercetools\Core\Model\CustomerGroup\CustomerGroupReference'],
122 31
            'country' => [static::TYPE => 'string'],
123 31
            'orderState' => [static::TYPE => 'string'],
124 31
            'shipmentState' => [static::TYPE => 'string'],
125 31
            'paymentState' => [static::TYPE => 'string'],
126 31
            'shippingInfo' => [static::TYPE => '\Commercetools\Core\Model\Cart\ShippingInfo'],
127 31
            'syncInfo' => [static::TYPE => '\Commercetools\Core\Model\Order\SyncInfoCollection'],
128 31
            'returnInfo' => [static::TYPE => '\Commercetools\Core\Model\Order\ReturnInfoCollection'],
129 31
            'discountCodes' => [static::TYPE => '\Commercetools\Core\Model\Cart\DiscountCodeInfoCollection'],
130 31
            'lastMessageSequenceNumber' => [static::TYPE => 'int'],
131 31
            'cart' => [static::TYPE => '\Commercetools\Core\Model\Cart\CartReference'],
132 31
            'custom' => [static::TYPE => '\Commercetools\Core\Model\CustomField\CustomFieldObject'],
133 31
            'state' => [static::TYPE => '\Commercetools\Core\Model\State\StateReference'],
134 31
            'paymentInfo' => [static::TYPE => '\Commercetools\Core\Model\Payment\PaymentInfo'],
135 31
            'anonymousId' => [static::TYPE => 'string'],
136 31
            'locale' => [static::TYPE => 'string'],
137
        ];
138
    }
139
}
140