|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @author @jayS-de <[email protected]> |
|
4
|
|
|
*/ |
|
5
|
|
|
|
|
6
|
|
|
namespace Commercetools\Core\Model\Cart; |
|
7
|
|
|
|
|
8
|
|
|
use Commercetools\Core\Model\Common\Context; |
|
9
|
|
|
use Commercetools\Core\Model\Common\JsonObject; |
|
10
|
|
|
use Commercetools\Core\Model\CustomField\CustomFieldObjectDraft; |
|
11
|
|
|
use Commercetools\Core\Model\Common\Address; |
|
12
|
|
|
use Commercetools\Core\Model\ShippingMethod\ShippingMethodReference; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* @package Commercetools\Core\Model\Cart |
|
16
|
|
|
* @link http://dev.commercetools.com/http-api-projects-me-carts.html#mycartdraft |
|
17
|
|
|
* @method string getCurrency() |
|
18
|
|
|
* @method MyCartDraft setCurrency(string $currency = null) |
|
19
|
|
|
* @method string getCustomerEmail() |
|
20
|
|
|
* @method MyCartDraft setCustomerEmail(string $customerEmail = null) |
|
21
|
|
|
* @method string getCountry() |
|
22
|
|
|
* @method MyCartDraft setCountry(string $country = null) |
|
23
|
|
|
* @method string getInventoryMode() |
|
24
|
|
|
* @method MyCartDraft setInventoryMode(string $inventoryMode = null) |
|
25
|
|
|
* @method MyLineItemDraftCollection getLineItems() |
|
26
|
|
|
* @method MyCartDraft setLineItems(MyLineItemDraftCollection $lineItems = null) |
|
27
|
|
|
* @method Address getShippingAddress() |
|
28
|
|
|
* @method MyCartDraft setShippingAddress(Address $shippingAddress = null) |
|
29
|
|
|
* @method Address getBillingAddress() |
|
30
|
|
|
* @method MyCartDraft setBillingAddress(Address $billingAddress = null) |
|
31
|
|
|
* @method ShippingMethodReference getShippingMethod() |
|
32
|
|
|
* @method MyCartDraft setShippingMethod(ShippingMethodReference $shippingMethod = null) |
|
33
|
|
|
* @method CustomFieldObjectDraft getCustom() |
|
34
|
|
|
* @method MyCartDraft setCustom(CustomFieldObjectDraft $custom = null) |
|
35
|
|
|
*/ |
|
36
|
|
|
class MyCartDraft extends JsonObject |
|
37
|
|
|
{ |
|
38
|
|
|
public function fieldDefinitions() |
|
39
|
|
|
{ |
|
40
|
|
|
return [ |
|
41
|
|
|
'currency' => [static::TYPE => 'string'], |
|
42
|
|
|
'customerEmail' => [static::TYPE => 'string'], |
|
43
|
|
|
'country' => [static::TYPE => 'string'], |
|
44
|
|
|
'inventoryMode' => [static::TYPE => 'string'], |
|
45
|
|
|
'lineItems' => [static::TYPE => '\Commercetools\Core\Model\Cart\MyLineItemDraftCollection'], |
|
46
|
|
|
'shippingAddress' => [static::TYPE => '\Commercetools\Core\Model\Common\Address'], |
|
47
|
|
|
'billingAddress' => [static::TYPE => '\Commercetools\Core\Model\Common\Address'], |
|
48
|
|
|
'shippingMethod' => [static::TYPE => '\Commercetools\Core\Model\ShippingMethod\ShippingMethodReference'], |
|
49
|
|
|
'custom' => [static::TYPE => '\Commercetools\Core\Model\CustomField\CustomFieldObjectDraft'], |
|
50
|
|
|
]; |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* @param string $currency |
|
55
|
|
|
* @param Context|callable $context |
|
56
|
|
|
* @return CartDraft |
|
57
|
|
|
*/ |
|
58
|
|
|
public static function ofCurrency($currency, $context = null) |
|
59
|
|
|
{ |
|
60
|
|
|
$draft = static::of($context); |
|
61
|
|
|
return $draft->setCurrency($currency); |
|
62
|
|
|
} |
|
63
|
|
|
} |
|
64
|
|
|
|