Skip to content
This repository was archived by the owner on Oct 24, 2023. It is now read-only.

Commit e4c10ed

Browse files
author
Jens Schulze
committed
refactor(Product): refactor scoped price to separate model from price
1 parent dbc4c48 commit e4c10ed

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

src/Model/Common/ScopedPrice.php

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,39 @@
3434
* @method Money getCurrentValue()
3535
* @method ScopedPrice setCurrentValue(Money $currentValue = null)
3636
*/
37-
class ScopedPrice extends Price
37+
class ScopedPrice extends JsonObject
3838
{
39+
const ID = 'id';
40+
const VALUE = 'value';
3941
const CURRENT_VALUE = 'currentValue';
42+
const COUNTRY = 'country';
43+
const CUSTOMER_GROUP = 'customerGroup';
44+
const CHANNEL = 'channel';
45+
const VALID_FROM = 'validFrom';
46+
const VALID_UNTIL = 'validUntil';
47+
const DISCOUNTED = 'discounted';
48+
const CUSTOM = 'custom';
4049

4150
public function fieldDefinitions()
4251
{
43-
$definitions = parent::fieldDefinitions();
44-
$definitions[static::CURRENT_VALUE] = [static::TYPE => '\Commercetools\Core\Model\Common\Money'];
45-
46-
return $definitions;
52+
return [
53+
static::ID => [static::TYPE => 'string'],
54+
static::VALUE => [self::TYPE => '\Commercetools\Core\Model\Common\Money'],
55+
static::CURRENT_VALUE => [static::TYPE => '\Commercetools\Core\Model\Common\Money'],
56+
static::COUNTRY => [self::TYPE => 'string'],
57+
static::CUSTOMER_GROUP => [self::TYPE => '\Commercetools\Core\Model\CustomerGroup\CustomerGroupReference'],
58+
static::CHANNEL => [self::TYPE => '\Commercetools\Core\Model\Channel\ChannelReference'],
59+
static::VALID_FROM => [
60+
self::TYPE => '\DateTime',
61+
self::DECORATOR => '\Commercetools\Core\Model\Common\DateTimeDecorator'
62+
],
63+
static::VALID_UNTIL => [
64+
self::TYPE => '\DateTime',
65+
self::DECORATOR => '\Commercetools\Core\Model\Common\DateTimeDecorator'
66+
],
67+
static::DISCOUNTED => [self::TYPE => '\Commercetools\Core\Model\Common\DiscountedPrice'],
68+
static::CUSTOM => [static::TYPE => '\Commercetools\Core\Model\CustomField\CustomFieldObject'],
69+
];
4770
}
4871

4972
/**

0 commit comments

Comments
 (0)