|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @category Brownie/CartsGuru |
|
4
|
|
|
* @author Brownie <[email protected]> |
|
5
|
|
|
* @license http://www.gnu.org/copyleft/lesser.html |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
namespace Brownie\CartsGuru\Model; |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* Order Model. |
|
12
|
|
|
* |
|
13
|
|
|
* @method Order setId($id) Set order reference. |
|
14
|
|
|
* @method Order setSiteId($siteId) Set siteId. |
|
15
|
|
|
* @method Order setCartId($cartId) Set cart reference. |
|
16
|
|
|
* @method Order setCreationDate($creationDate) Set date of the order. |
|
17
|
|
|
* @method Order setTotalATI($totalATI) Set total price including taxes. |
|
18
|
|
|
* @method Order setTotalET($totalET) Set total price excluding taxes. |
|
19
|
|
|
* @method Order setCurrency($currency) Set currency, ISO code. |
|
20
|
|
|
* @method Order setPaymentMethod($paymentMethod) Set payment method. |
|
21
|
|
|
* @method Order setState($state) Set status of the order. |
|
22
|
|
|
* @method Order setIp($ip) Set visitor ip address. |
|
23
|
|
|
* @method Order setAccountId($accountId) Set account id of the buyer. |
|
24
|
|
|
* @method Order setCivility($civility) Set string in this list : 'mister','madam','miss'. |
|
25
|
|
|
* @method Order setLastname($lastName) Set lastname of the buyer. |
|
26
|
|
|
* @method Order setFirstname($firstName) Set firstname of the buyer. |
|
27
|
|
|
* @method Order setEmail($email) Set email address of the buyer. |
|
28
|
|
|
* @method Order setHomePhoneNumber($homePhoneNumber) Set landline phone number. |
|
29
|
|
|
* @method Order setMobilePhoneNumber($mobilePhoneNumber) Set mobile phone number. |
|
30
|
|
|
* @method Order setCountry($country) Set country of the buyer. |
|
31
|
|
|
* @method Order setCountryCode($countryCode) Set country ISO code of the buyer. |
|
32
|
|
|
* @method Order setCustom($custom) Set any custom fields. |
|
33
|
|
|
* @method ItemList getItems() Get items. |
|
34
|
|
|
*/ |
|
35
|
|
|
class Order extends DataModel |
|
36
|
|
|
{ |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* List of supported fields. |
|
40
|
|
|
* |
|
41
|
|
|
* @var array |
|
42
|
|
|
*/ |
|
43
|
|
|
protected $fields = array( |
|
44
|
|
|
'id' => null, // Order reference, the same display to the buyer. |
|
45
|
|
|
'siteId' => null, // SiteId is part of configuration. |
|
46
|
|
|
'cartId' => null, // Cart reference, source of the order (optional). |
|
47
|
|
|
'creationDate' => null, // Date of the order as string in json format |
|
48
|
|
|
// (2016-07-26T08:21:25.689Z) (optional). |
|
49
|
|
|
'totalATI' => null, // Amount included taxes and excluded shipping. |
|
50
|
|
|
'totalET' => null, // Amount excluded taxes and excluded shipping. |
|
51
|
|
|
'currency' => null, // Currency, ISO code (optional). |
|
52
|
|
|
'paymentMethod' => null, // Payment method used (optional). |
|
53
|
|
|
'state' => null, // Status of the order. |
|
54
|
|
|
'ip' => null, // Visitor ip address (optional). |
|
55
|
|
|
'accountId' => null, // Account id of the buyer (use same identifier as Carts). |
|
56
|
|
|
'civility' => null, // Use string in this list : ‘mister','madam','miss' (optional). |
|
57
|
|
|
'lastname' => null, // Lastname of the buyer (optional). |
|
58
|
|
|
'firstname' => null, // Firstname of the buyer. |
|
59
|
|
|
'email' => null, // Email address of the buyer. |
|
60
|
|
|
'homePhoneNumber' => null, // Landline phone number of buyer (optional). |
|
61
|
|
|
'mobilePhoneNumber' => null, // Mobile phone number of buyer (optional). |
|
62
|
|
|
'country' => null, // Country of the buyer (you can send country or country code). |
|
63
|
|
|
'countryCode' => null, // Country ISO code of the buyer (you can send country or country code). |
|
64
|
|
|
'custom' => null, // Any custom fields you want to send with the cart. |
|
65
|
|
|
// Standard fields are language (ISO code), |
|
66
|
|
|
// customerGroup and isNewCustomer (Boolean). |
|
67
|
|
|
'items' => null, // Details of each items. |
|
68
|
|
|
); |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* List of required fields. |
|
72
|
|
|
* |
|
73
|
|
|
* @var array |
|
74
|
|
|
*/ |
|
75
|
|
|
protected $requiredFields = array( |
|
76
|
|
|
'id', |
|
77
|
|
|
'siteId', |
|
78
|
|
|
'totalATI', |
|
79
|
|
|
'totalET', |
|
80
|
|
|
'state', |
|
81
|
|
|
'accountId', |
|
82
|
|
|
'firstname', |
|
83
|
|
|
'email', |
|
84
|
|
|
'country', |
|
85
|
|
|
'countryCode', |
|
86
|
|
|
'items', |
|
87
|
|
|
); |
|
88
|
|
|
} |
|
89
|
|
|
|