Completed
Push — master ( db6b3b...545c49 )
by Oss
02:55
created

Cart::validate()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 23
Code Lines 17

Duplication

Lines 23
Ratio 100 %

Importance

Changes 0
Metric Value
cc 3
eloc 17
nc 2
nop 0
dl 23
loc 23
rs 9.0856
c 0
b 0
f 0
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
 * Cart Model.
12
 *
13
 * @method  Cart    setId($id)                                  Set cart reference.
14
 * @method  Cart    setSiteId($siteId)                          Set siteId.
15
 * @method  Cart    setCreationDate($creationDate)              Set date of the cart.
16
 * @method  Cart    setTotalATI($totalATI)                      Set total price including taxes.
17
 * @method  Cart    setTotalET($totalET)                        Set total price excluding taxes.
18
 * @method  Cart    setCurrency($currency)                      Set currency, ISO code.
19
 * @method  Cart    setAccountId($accountId)                    Set account id of the buyer.
20
 * @method  Cart    setIp($ip)                                  Set visitor IP address.
21
 * @method  Cart    setRecoverUrl($recoverUrl)                  Set link to recover the cart.
22
 * @method  Cart    setCivility($civility)                      Set string in this list : 'mister','madam','miss'.
23
 * @method  Cart    setLastname($lastname)                      Set lastname of the buyer.
24
 * @method  Cart    setFirstname($firstname)                    Set firstname of the buyer.
25
 * @method  Cart    setEmail($email)                            Set email address.
26
 * @method  Cart    setHomePhoneNumber($homePhoneNumber)        Set landline phone number.
27
 * @method  Cart    setMobilePhoneNumber($mobilePhoneNumber)    Set mobile phone number.
28
 * @method  Cart    setPhoneNumber($phoneNumber)                Set phone number of buyer.
29
 * @method  Cart    setCountry($country)                        Set country of the buyer.
30
 * @method  Cart    setCountryCode($countryCode)                Set country ISO code of the buyer.
31
 * @method  Cart    setCustom($custom)                          Set any custom fields.
32
 */
33
class Cart extends DataModel
34
{
35
36
    /**
37
     * List of supported fields.
38
     *
39
     * @var array
40
     */
41
    protected $fields = array(
42
        'id' => null,                   // Cart reference (use SessionId if you don’t have specific ID).
43
        'siteId' => null,               // SiteId is part of configuration.
44
        'creationDate' => null,         // Date of the cart as string in json format
45
                                        //      (2016-07-26T08:21:25.689Z) (optional).
46
        'totalATI' => null,             // Total price including taxes.
47
        'totalET' => null,              // Total price excluding taxes.
48
        'currency' => null,             // Currency, ISO code (optional).
49
        'accountId' => null,            // Account id of the buyer (we advise to use the email address).
50
        'ip' => null,                   // Visitor IP address (optional).
51
        'recoverUrl' => null,           // Link to recover the cart.
52
                                        //      (link to cart with security token included) (optional).
53
        'civility' => null,             // Use string in this list : 'mister','madam','miss' (optional).
54
        'lastname' => null,             // Lastname of the buyer (optional).
55
        'firstname' => null,            // Firstname of the buyer.
56
        'email' => null,                // Email address.
57
        'homePhoneNumber' => null,      // Landline phone number (optional).
58
        'mobilePhoneNumber' => null,    // Mobile phone number (optional).
59
        'phoneNumber' => null,          // Phone number of buyer, if you don’t know the kind of it (optional).
60
        'country' => null,              // Country of the buyer (you can send country or country code).
61
        'countryCode' => null,          // Country ISO code of the buyer (you can send country or country code).
62
        'custom' => null,               // Any custom fields you want to send with the cart
63
                                        //      Standard fields are language (ISO code),
64
                                        //      customerGroup and isNewCustomer (Boolean).
65
        'items' => null,                // Details of each items.
66
    );
67
68
    /**
69
     * List of required fields.
70
     *
71
     * @var array
72
     */
73
    protected $requiredFields = array(
74
        'id',
75
        'siteId',
76
        'totalATI',
77
        'totalET',
78
        'accountId',
79
        'firstname',
80
        'email',
81
        'country',
82
        'countryCode',
83
        'items',
84
    );
85
}
86