Completed
Push — develop ( d93a45...37db8d )
by
unknown
10:41
created

Order::fieldDefinitions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 47
Code Lines 41

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 37
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 47
ccs 37
cts 37
cp 1
rs 9.0303
c 0
b 0
f 0
cc 1
eloc 41
nc 1
nop 0
crap 1
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
use DateTime;
24
25
/**
26
 * @package Commercetools\Core\Model\Order
27
 * @link https://dev.commercetools.com/http-api-projects-orders.html#order
28
 * @method string getId()
29
 * @method Order setId(string $id = null)
30
 * @method int getVersion()
31
 * @method Order setVersion(int $version = null)
32
 * @method DateTimeDecorator getCreatedAt()
33
 * @method Order setCreatedAt(DateTime $createdAt = null)
34
 * @method DateTimeDecorator getLastModifiedAt()
35
 * @method Order setLastModifiedAt(DateTime $lastModifiedAt = null)
36
 * @method string getOrderNumber()
37
 * @method Order setOrderNumber(string $orderNumber = null)
38
 * @method string getCustomerId()
39
 * @method Order setCustomerId(string $customerId = null)
40
 * @method string getCustomerEmail()
41
 * @method Order setCustomerEmail(string $customerEmail = null)
42
 * @method LineItemCollection getLineItems()
43
 * @method Order setLineItems(LineItemCollection $lineItems = null)
44
 * @method CustomLineItemCollection getCustomLineItems()
45
 * @method Order setCustomLineItems(CustomLineItemCollection $customLineItems = null)
46
 * @method Money getTotalPrice()
47
 * @method Order setTotalPrice(Money $totalPrice = null)
48
 * @method TaxedPrice getTaxedPrice()
49
 * @method Order setTaxedPrice(TaxedPrice $taxedPrice = null)
50
 * @method Address getShippingAddress()
51
 * @method Order setShippingAddress(Address $shippingAddress = null)
52
 * @method Address getBillingAddress()
53
 * @method Order setBillingAddress(Address $billingAddress = null)
54
 * @method string getInventoryMode()
55
 * @method Order setInventoryMode(string $inventoryMode = null)
56
 * @method CustomerGroupReference getCustomerGroup()
57
 * @method Order setCustomerGroup(CustomerGroupReference $customerGroup = null)
58
 * @method string getCountry()
59
 * @method Order setCountry(string $country = null)
60
 * @method string getOrderState()
61
 * @method Order setOrderState(string $orderState = null)
62
 * @method string getShipmentState()
63
 * @method Order setShipmentState(string $shipmentState = null)
64
 * @method string getPaymentState()
65
 * @method Order setPaymentState(string $paymentState = null)
66
 * @method ShippingInfo getShippingInfo()
67
 * @method Order setShippingInfo(ShippingInfo $shippingInfo = null)
68
 * @method SyncInfoCollection getSyncInfo()
69
 * @method Order setSyncInfo(SyncInfoCollection $syncInfo = null)
70
 * @method ReturnInfoCollection getReturnInfo()
71
 * @method Order setReturnInfo(ReturnInfoCollection $returnInfo = null)
72
 * @method DiscountCodeInfoCollection getDiscountCodes()
73
 * @method Order setDiscountCodes(DiscountCodeInfoCollection $discountCodes = null)
74
 * @method int getLastMessageSequenceNumber()
75
 * @method Order setLastMessageSequenceNumber(int $lastMessageSequenceNumber = null)
76
 * @method CartReference getCart()
77
 * @method Order setCart(CartReference $cart = null)
78
 * @method CustomFieldObject getCustom()
79
 * @method Order setCustom(CustomFieldObject $custom = null)
80
 * @method StateReference getState()
81
 * @method Order setState(StateReference $state = null)
82
 * @method PaymentInfo getPaymentInfo()
83
 * @method Order setPaymentInfo(PaymentInfo $paymentInfo = null)
84
 * @method DateTimeDecorator getCompletedAt()
85
 * @method Order setCompletedAt(DateTime $completedAt = null)
86
 * @method string getAnonymousId()
87
 * @method Order setAnonymousId(string $anonymousId = null)
88
 * @method string getLocale()
89
 * @method string getTaxRoundingMode()
90
 * @method Order setTaxRoundingMode(string $taxRoundingMode = null)
91
 * @method string getOrigin()
92
 * @method Order setOrigin(string $origin = null)
93
 * @method OrderReference getReference()
94
 */
95
class Order extends Resource
96
{
97
    const TAX_MODE_PLATFORM = 'Platform';
98
    const TAX_MODE_EXTERNAL = 'External';
99
    const TAX_MODE_DISABLED = 'Disabled';
100
    const TAX_ROUNDING_MODE_HALF_EVEN = 'HalfEven';
101
    const TAX_ROUNDING_MODE_HALF_UP = 'HalfUp';
102
    const TAX_ROUNDING_MODE_HALF_DOWN = 'HalfDown';
103
104
    use LocaleTrait;
105
106 40
    public function fieldDefinitions()
107
    {
108
        return [
109 40
            'id' => [static::TYPE => 'string'],
110 40
            'version' => [static::TYPE => 'int'],
111
            'createdAt' => [
112 40
                static::TYPE => DateTime::class,
113 40
                static::DECORATOR => DateTimeDecorator::class
114
            ],
115
            'lastModifiedAt' => [
116 40
                static::TYPE => DateTime::class,
117 40
                static::DECORATOR => DateTimeDecorator::class
118
            ],
119
            'completedAt' => [
120 40
                static::TYPE => DateTime::class,
121 40
                static::DECORATOR => DateTimeDecorator::class
122
            ],
123 40
            'orderNumber' => [static::TYPE => 'string'],
124 40
            'customerId' => [static::TYPE => 'string'],
125 40
            'customerEmail' => [static::TYPE => 'string'],
126 40
            'lineItems' => [static::TYPE => LineItemCollection::class],
127 40
            'customLineItems' => [static::TYPE => CustomLineItemCollection::class],
128 40
            'totalPrice' => [static::TYPE => Money::class],
129 40
            'taxedPrice' => [static::TYPE => TaxedPrice::class],
130 40
            'shippingAddress' => [static::TYPE => Address::class],
131 40
            'billingAddress' => [static::TYPE => Address::class],
132 40
            'inventoryMode' => [static::TYPE => 'string'],
133 40
            'customerGroup' => [static::TYPE => CustomerGroupReference::class],
134 40
            'country' => [static::TYPE => 'string'],
135 40
            'orderState' => [static::TYPE => 'string'],
136 40
            'shipmentState' => [static::TYPE => 'string'],
137 40
            'paymentState' => [static::TYPE => 'string'],
138 40
            'shippingInfo' => [static::TYPE => ShippingInfo::class],
139 40
            'syncInfo' => [static::TYPE => SyncInfoCollection::class],
140 40
            'returnInfo' => [static::TYPE => ReturnInfoCollection::class],
141 40
            'discountCodes' => [static::TYPE => DiscountCodeInfoCollection::class],
142 40
            'lastMessageSequenceNumber' => [static::TYPE => 'int'],
143 40
            'cart' => [static::TYPE => CartReference::class],
144 40
            'custom' => [static::TYPE => CustomFieldObject::class],
145 40
            'state' => [static::TYPE => StateReference::class],
146 40
            'paymentInfo' => [static::TYPE => PaymentInfo::class],
147 40
            'anonymousId' => [static::TYPE => 'string'],
148 40
            'locale' => [static::TYPE => 'string'],
149 40
            'taxRoundingMode' => [static::TYPE => 'string'],
150 40
            'origin' => [static::TYPE => 'string'],
151
        ];
152
    }
153
}
154