commercetools / commercetools-sdk-java-v2

The e-commerce SDK from commercetools for Java.
https://commercetools.github.io/commercetools-sdk-java-v2/javadoc/index.html
Apache License 2.0
35 stars 15 forks source link

Money class does not have fractionDigits #213

Closed ApoorvaB0403 closed 2 years ago

ApoorvaB0403 commented 2 years ago

Describe the bug The "DiscountedPrice" class of CommerceTools SDK has a property named "value". This property is of "Money" type. In the Money class, "fractionDigits" property is missing.

In the SDK's Cart response from carts endpoint, we see that in discounted price we do not have fraction digits. Whereas in normal price like total price we have it. As a result, the raw cart response from CT(the one received from Impex API) has fraction digits in it but the SDK omits this value, and we cannot use fraction digits in our java logic.

To Reproduce

  1. Create a cart with discount applied on a line item.
  2. Get the cart from Impex API and through SDK
  3. Check for lineItems --> variant --> prices --> discounted --> value property.
  4. The cart response from Impex API has discountedPrice with fractionDigits.
  5. The cart response received through SDK in CartImpl does not has discountedPrice with fractionDigits.

Expected behavior In the "DiscountedPrice" section of Cart response, we should get the fraction digits and the SDK should not omit this information.

Screenshots/Code snippet If applicable, add screenshots or code samples to help explain your problem.

Stack information (please complete the following information):

Additional context Add any other context about the problem here.

jenschude commented 2 years ago

I opened a fix in the upstream repository.

To be precise we will have to split the read and write models for discounted price. This will be a breaking change.

jenschude commented 2 years ago

Fixed with release 7.0.0