$json = '{"cb7d2554b0ce847cd82f3ac9bd1c0dfca":{"net":5.0,"gross":5.0,"currencyId":"b7d2554b0ce847cd82f3ac9bd1c0dfca","linked":true,"listPrice":{"net":"10","gross":"10","currencyId":"b7d2554b0ce847cd82f3ac9bd1c0dfca","linked":true},"regulationPrice":{"net":"10","gross":"10","currencyId":"b7d2554b0ce847cd82f3ac9bd1c0dfca","linked":true}}}';
$field =
new PriceField('test', 'test'
);
$decoded =
$this->serializer->
decode($field,
$json);
$price =
$decoded->
get(Defaults::CURRENCY
);
static::
assertSame(5.0,
$price->
getNet());
static::
assertSame(5.0,
$price->
getGross());
static::
assertSame(10.0,
$price->
getListPrice()->
getNet());
static::
assertSame(10.0,
$price->
getListPrice()->
getGross());
static::
assertSame(10.0,
$price->
getRegulationPrice()->
getNet());
static::
assertSame(10.0,
$price->
getRegulationPrice()->
getGross());
static::
assertNull($price->
getPercentage());
} private function encode(array
$data): string
{ $field =
new PriceField('test', 'test'
);
$existence =
new EntityExistence('test',
['someId' => true
], true, false, false,
[]);