1 | <?php |
||
30 | class PriceDraft extends JsonObject |
||
31 | { |
||
32 | const VALUE = 'value'; |
||
33 | const COUNTRY = 'country'; |
||
34 | const CUSTOMER_GROUP = 'customerGroup'; |
||
35 | const CHANNEL = 'channel'; |
||
36 | const VALID_FROM = 'validFrom'; |
||
37 | const VALID_UNTIL = 'validUntil'; |
||
38 | const DISCOUNTED = 'discounted'; |
||
39 | const CUSTOM = 'custom'; |
||
40 | |||
41 | 4 | public function fieldDefinitions() |
|
42 | { |
||
43 | return [ |
||
44 | 4 | static::VALUE => [self::TYPE => '\Commercetools\Core\Model\Common\Money'], |
|
45 | 4 | static::COUNTRY => [self::TYPE => 'string'], |
|
46 | 4 | static::CUSTOMER_GROUP => [self::TYPE => '\Commercetools\Core\Model\CustomerGroup\CustomerGroupReference'], |
|
47 | 4 | static::CHANNEL => [self::TYPE => '\Commercetools\Core\Model\Channel\ChannelReference'], |
|
48 | 4 | static::VALID_FROM => [ |
|
49 | 4 | self::TYPE => '\DateTime', |
|
50 | 4 | self::DECORATOR => '\Commercetools\Core\Model\Common\DateTimeDecorator' |
|
51 | 4 | ], |
|
52 | 4 | static::VALID_UNTIL => [ |
|
53 | 4 | self::TYPE => '\DateTime', |
|
54 | 4 | self::DECORATOR => '\Commercetools\Core\Model\Common\DateTimeDecorator' |
|
55 | 4 | ], |
|
56 | 4 | static::CUSTOM => [static::TYPE => '\Commercetools\Core\Model\CustomField\CustomFieldObject'], |
|
57 | 4 | ]; |
|
58 | } |
||
59 | |||
60 | /** |
||
61 | * @param Money $money |
||
62 | * @param Context|callable $context |
||
63 | * @return PriceDraft |
||
64 | */ |
||
65 | 4 | public static function ofMoney(Money $money, $context = null) |
|
66 | { |
||
67 | 4 | $price = static::of($context); |
|
68 | 4 | return $price->setValue($money); |
|
69 | } |
||
70 | |||
71 | /** |
||
72 | * @return string |
||
73 | */ |
||
74 | public function __toString() |
||
78 | } |
||
79 |