diff --git a/changes.md b/changes.md index 7b038d2ae2d..048f1ace496 100644 --- a/changes.md +++ b/changes.md @@ -5,6 +5,8 @@ - :warning: changed property `line` of type `GraphQLErrorLocation` from type `integer` to `number` - :warning: changed property `column` of type `GraphQLErrorLocation` from type `integer` to `number` +- :warning: changed property `totalPrice` of type `StagedOrder` from type `TypedMoney` to `CentPrecisionMoney` +- :warning: changed property `totalPrice` of type `Order` from type `TypedMoney` to `CentPrecisionMoney` diff --git a/lib/commercetools-api/src/Models/Order/Order.php b/lib/commercetools-api/src/Models/Order/Order.php index 7c7528be5ab..aa1e730a263 100644 --- a/lib/commercetools-api/src/Models/Order/Order.php +++ b/lib/commercetools-api/src/Models/Order/Order.php @@ -23,9 +23,9 @@ use Commercetools\Api\Models\Common\Address; use Commercetools\Api\Models\Common\AddressCollection; use Commercetools\Api\Models\Common\BaseResource; +use Commercetools\Api\Models\Common\CentPrecisionMoney; use Commercetools\Api\Models\Common\CreatedBy; use Commercetools\Api\Models\Common\LastModifiedBy; -use Commercetools\Api\Models\Common\TypedMoney; use Commercetools\Api\Models\CustomerGroup\CustomerGroupReference; use Commercetools\Api\Models\OrderEdit\StagedOrder; use Commercetools\Api\Models\Quote\QuoteReference; @@ -190,7 +190,7 @@ public function getCustomLineItems(); *

Taxes are included if TaxRate includedInPrice is true for each price.

* - * @return null|TypedMoney + * @return null|CentPrecisionMoney */ public function getTotalPrice(); @@ -580,9 +580,9 @@ public function setLineItems(?LineItemCollection $lineItems): void; public function setCustomLineItems(?CustomLineItemCollection $customLineItems): void; /** - * @param ?TypedMoney $totalPrice + * @param ?CentPrecisionMoney $totalPrice */ - public function setTotalPrice(?TypedMoney $totalPrice): void; + public function setTotalPrice(?CentPrecisionMoney $totalPrice): void; /** * @param ?TaxedPrice $taxedPrice diff --git a/lib/commercetools-api/src/Models/Order/OrderBuilder.php b/lib/commercetools-api/src/Models/Order/OrderBuilder.php index 97f55666762..77eb23e37b1 100644 --- a/lib/commercetools-api/src/Models/Order/OrderBuilder.php +++ b/lib/commercetools-api/src/Models/Order/OrderBuilder.php @@ -31,12 +31,12 @@ use Commercetools\Api\Models\Common\AddressCollection; use Commercetools\Api\Models\Common\BaseResource; use Commercetools\Api\Models\Common\BaseResourceBuilder; +use Commercetools\Api\Models\Common\CentPrecisionMoney; +use Commercetools\Api\Models\Common\CentPrecisionMoneyBuilder; use Commercetools\Api\Models\Common\CreatedBy; use Commercetools\Api\Models\Common\CreatedByBuilder; use Commercetools\Api\Models\Common\LastModifiedBy; use Commercetools\Api\Models\Common\LastModifiedByBuilder; -use Commercetools\Api\Models\Common\TypedMoney; -use Commercetools\Api\Models\Common\TypedMoneyBuilder; use Commercetools\Api\Models\CustomerGroup\CustomerGroupReference; use Commercetools\Api\Models\CustomerGroup\CustomerGroupReferenceBuilder; use Commercetools\Api\Models\OrderEdit\StagedOrder; @@ -148,7 +148,7 @@ final class OrderBuilder implements Builder /** - * @var null|TypedMoney|TypedMoneyBuilder + * @var null|CentPrecisionMoney|CentPrecisionMoneyBuilder */ private $totalPrice; @@ -530,11 +530,11 @@ public function getCustomLineItems() *

Taxes are included if TaxRate includedInPrice is true for each price.

* - * @return null|TypedMoney + * @return null|CentPrecisionMoney */ public function getTotalPrice() { - return $this->totalPrice instanceof TypedMoneyBuilder ? $this->totalPrice->build() : $this->totalPrice; + return $this->totalPrice instanceof CentPrecisionMoneyBuilder ? $this->totalPrice->build() : $this->totalPrice; } /** @@ -1109,10 +1109,10 @@ public function withCustomLineItems(?CustomLineItemCollection $customLineItems) } /** - * @param ?TypedMoney $totalPrice + * @param ?CentPrecisionMoney $totalPrice * @return $this */ - public function withTotalPrice(?TypedMoney $totalPrice) + public function withTotalPrice(?CentPrecisionMoney $totalPrice) { $this->totalPrice = $totalPrice; @@ -1552,7 +1552,7 @@ public function withStoreBuilder(?StoreKeyReferenceBuilder $store) * @deprecated use withTotalPrice() instead * @return $this */ - public function withTotalPriceBuilder(?TypedMoneyBuilder $totalPrice) + public function withTotalPriceBuilder(?CentPrecisionMoneyBuilder $totalPrice) { $this->totalPrice = $totalPrice; @@ -1741,7 +1741,7 @@ public function build(): Order $this->store instanceof StoreKeyReferenceBuilder ? $this->store->build() : $this->store, $this->lineItems, $this->customLineItems, - $this->totalPrice instanceof TypedMoneyBuilder ? $this->totalPrice->build() : $this->totalPrice, + $this->totalPrice instanceof CentPrecisionMoneyBuilder ? $this->totalPrice->build() : $this->totalPrice, $this->taxedPrice instanceof TaxedPriceBuilder ? $this->taxedPrice->build() : $this->taxedPrice, $this->taxedShippingPrice instanceof TaxedPriceBuilder ? $this->taxedShippingPrice->build() : $this->taxedShippingPrice, $this->discountOnTotalPrice instanceof DiscountOnTotalPriceBuilder ? $this->discountOnTotalPrice->build() : $this->discountOnTotalPrice, diff --git a/lib/commercetools-api/src/Models/Order/OrderModel.php b/lib/commercetools-api/src/Models/Order/OrderModel.php index 2a255d3fe61..2766ca8eea1 100644 --- a/lib/commercetools-api/src/Models/Order/OrderModel.php +++ b/lib/commercetools-api/src/Models/Order/OrderModel.php @@ -31,12 +31,12 @@ use Commercetools\Api\Models\Common\AddressModel; use Commercetools\Api\Models\Common\BaseResource; use Commercetools\Api\Models\Common\BaseResourceModel; +use Commercetools\Api\Models\Common\CentPrecisionMoney; +use Commercetools\Api\Models\Common\CentPrecisionMoneyModel; use Commercetools\Api\Models\Common\CreatedBy; use Commercetools\Api\Models\Common\CreatedByModel; use Commercetools\Api\Models\Common\LastModifiedBy; use Commercetools\Api\Models\Common\LastModifiedByModel; -use Commercetools\Api\Models\Common\TypedMoney; -use Commercetools\Api\Models\Common\TypedMoneyModel; use Commercetools\Api\Models\CustomerGroup\CustomerGroupReference; use Commercetools\Api\Models\CustomerGroup\CustomerGroupReferenceModel; use Commercetools\Api\Models\OrderEdit\StagedOrder; @@ -147,7 +147,7 @@ final class OrderModel extends JsonObjectModel implements Order /** * - * @var ?TypedMoney + * @var ?CentPrecisionMoney */ protected $totalPrice; @@ -386,7 +386,7 @@ public function __construct( ?StoreKeyReference $store = null, ?LineItemCollection $lineItems = null, ?CustomLineItemCollection $customLineItems = null, - ?TypedMoney $totalPrice = null, + ?CentPrecisionMoney $totalPrice = null, ?TaxedPrice $taxedPrice = null, ?TaxedPrice $taxedShippingPrice = null, ?DiscountOnTotalPrice $discountOnTotalPrice = null, @@ -776,7 +776,7 @@ public function getCustomLineItems() *

Taxes are included if TaxRate includedInPrice is true for each price.

* * - * @return null|TypedMoney + * @return null|CentPrecisionMoney */ public function getTotalPrice() { @@ -786,8 +786,8 @@ public function getTotalPrice() if (is_null($data)) { return null; } - $className = TypedMoneyModel::resolveDiscriminatorClass($data); - $this->totalPrice = $className::of($data); + + $this->totalPrice = CentPrecisionMoneyModel::of($data); } return $this->totalPrice; @@ -1667,9 +1667,9 @@ public function setCustomLineItems(?CustomLineItemCollection $customLineItems): } /** - * @param ?TypedMoney $totalPrice + * @param ?CentPrecisionMoney $totalPrice */ - public function setTotalPrice(?TypedMoney $totalPrice): void + public function setTotalPrice(?CentPrecisionMoney $totalPrice): void { $this->totalPrice = $totalPrice; } diff --git a/lib/commercetools-api/src/Models/OrderEdit/StagedOrderBuilder.php b/lib/commercetools-api/src/Models/OrderEdit/StagedOrderBuilder.php index 555cb47f459..a11d685a0e3 100644 --- a/lib/commercetools-api/src/Models/OrderEdit/StagedOrderBuilder.php +++ b/lib/commercetools-api/src/Models/OrderEdit/StagedOrderBuilder.php @@ -29,12 +29,12 @@ use Commercetools\Api\Models\Common\Address; use Commercetools\Api\Models\Common\AddressBuilder; use Commercetools\Api\Models\Common\AddressCollection; +use Commercetools\Api\Models\Common\CentPrecisionMoney; +use Commercetools\Api\Models\Common\CentPrecisionMoneyBuilder; use Commercetools\Api\Models\Common\CreatedBy; use Commercetools\Api\Models\Common\CreatedByBuilder; use Commercetools\Api\Models\Common\LastModifiedBy; use Commercetools\Api\Models\Common\LastModifiedByBuilder; -use Commercetools\Api\Models\Common\TypedMoney; -use Commercetools\Api\Models\Common\TypedMoneyBuilder; use Commercetools\Api\Models\CustomerGroup\CustomerGroupReference; use Commercetools\Api\Models\CustomerGroup\CustomerGroupReferenceBuilder; use Commercetools\Api\Models\Order\Order; @@ -150,7 +150,7 @@ final class StagedOrderBuilder implements Builder /** - * @var null|TypedMoney|TypedMoneyBuilder + * @var null|CentPrecisionMoney|CentPrecisionMoneyBuilder */ private $totalPrice; @@ -532,11 +532,11 @@ public function getCustomLineItems() *

Taxes are included if TaxRate includedInPrice is true for each price.

* - * @return null|TypedMoney + * @return null|CentPrecisionMoney */ public function getTotalPrice() { - return $this->totalPrice instanceof TypedMoneyBuilder ? $this->totalPrice->build() : $this->totalPrice; + return $this->totalPrice instanceof CentPrecisionMoneyBuilder ? $this->totalPrice->build() : $this->totalPrice; } /** @@ -1111,10 +1111,10 @@ public function withCustomLineItems(?CustomLineItemCollection $customLineItems) } /** - * @param ?TypedMoney $totalPrice + * @param ?CentPrecisionMoney $totalPrice * @return $this */ - public function withTotalPrice(?TypedMoney $totalPrice) + public function withTotalPrice(?CentPrecisionMoney $totalPrice) { $this->totalPrice = $totalPrice; @@ -1554,7 +1554,7 @@ public function withStoreBuilder(?StoreKeyReferenceBuilder $store) * @deprecated use withTotalPrice() instead * @return $this */ - public function withTotalPriceBuilder(?TypedMoneyBuilder $totalPrice) + public function withTotalPriceBuilder(?CentPrecisionMoneyBuilder $totalPrice) { $this->totalPrice = $totalPrice; @@ -1743,7 +1743,7 @@ public function build(): StagedOrder $this->store instanceof StoreKeyReferenceBuilder ? $this->store->build() : $this->store, $this->lineItems, $this->customLineItems, - $this->totalPrice instanceof TypedMoneyBuilder ? $this->totalPrice->build() : $this->totalPrice, + $this->totalPrice instanceof CentPrecisionMoneyBuilder ? $this->totalPrice->build() : $this->totalPrice, $this->taxedPrice instanceof TaxedPriceBuilder ? $this->taxedPrice->build() : $this->taxedPrice, $this->taxedShippingPrice instanceof TaxedPriceBuilder ? $this->taxedShippingPrice->build() : $this->taxedShippingPrice, $this->discountOnTotalPrice instanceof DiscountOnTotalPriceBuilder ? $this->discountOnTotalPrice->build() : $this->discountOnTotalPrice, diff --git a/lib/commercetools-api/src/Models/OrderEdit/StagedOrderModel.php b/lib/commercetools-api/src/Models/OrderEdit/StagedOrderModel.php index 370f20700d4..c3ac64a5bcd 100644 --- a/lib/commercetools-api/src/Models/OrderEdit/StagedOrderModel.php +++ b/lib/commercetools-api/src/Models/OrderEdit/StagedOrderModel.php @@ -29,12 +29,12 @@ use Commercetools\Api\Models\Common\Address; use Commercetools\Api\Models\Common\AddressCollection; use Commercetools\Api\Models\Common\AddressModel; +use Commercetools\Api\Models\Common\CentPrecisionMoney; +use Commercetools\Api\Models\Common\CentPrecisionMoneyModel; use Commercetools\Api\Models\Common\CreatedBy; use Commercetools\Api\Models\Common\CreatedByModel; use Commercetools\Api\Models\Common\LastModifiedBy; use Commercetools\Api\Models\Common\LastModifiedByModel; -use Commercetools\Api\Models\Common\TypedMoney; -use Commercetools\Api\Models\Common\TypedMoneyModel; use Commercetools\Api\Models\CustomerGroup\CustomerGroupReference; use Commercetools\Api\Models\CustomerGroup\CustomerGroupReferenceModel; use Commercetools\Api\Models\Order\Order; @@ -149,7 +149,7 @@ final class StagedOrderModel extends JsonObjectModel implements StagedOrder /** * - * @var ?TypedMoney + * @var ?CentPrecisionMoney */ protected $totalPrice; @@ -388,7 +388,7 @@ public function __construct( ?StoreKeyReference $store = null, ?LineItemCollection $lineItems = null, ?CustomLineItemCollection $customLineItems = null, - ?TypedMoney $totalPrice = null, + ?CentPrecisionMoney $totalPrice = null, ?TaxedPrice $taxedPrice = null, ?TaxedPrice $taxedShippingPrice = null, ?DiscountOnTotalPrice $discountOnTotalPrice = null, @@ -778,7 +778,7 @@ public function getCustomLineItems() *

Taxes are included if TaxRate includedInPrice is true for each price.

* * - * @return null|TypedMoney + * @return null|CentPrecisionMoney */ public function getTotalPrice() { @@ -788,8 +788,8 @@ public function getTotalPrice() if (is_null($data)) { return null; } - $className = TypedMoneyModel::resolveDiscriminatorClass($data); - $this->totalPrice = $className::of($data); + + $this->totalPrice = CentPrecisionMoneyModel::of($data); } return $this->totalPrice; @@ -1669,9 +1669,9 @@ public function setCustomLineItems(?CustomLineItemCollection $customLineItems): } /** - * @param ?TypedMoney $totalPrice + * @param ?CentPrecisionMoney $totalPrice */ - public function setTotalPrice(?TypedMoney $totalPrice): void + public function setTotalPrice(?CentPrecisionMoney $totalPrice): void { $this->totalPrice = $totalPrice; } diff --git a/references.txt b/references.txt index 8141c4001fd..25f11908b8b 100644 --- a/references.txt +++ b/references.txt @@ -326,3 +326,4 @@ ccf4522140c12b0093aefe0e2a27d62bcc4834a6 f254d17f05343dcc4299fc53ff9b335b5ef63d69 6892be230f1ad73f1150dd544c9fa7fee0e6b123 971c1b4ce06c29fcb8c2402dc2ca523b2907352c +b747e1fa4f246b748a89bccbfd8a43f5b6f51175