shipperhq / module-shipper

Base ShipperHQ Repo
Open Software License 3.0
21 stars 20 forks source link

Error getting rates when using JPY and MXN currencies when applying coupon #129

Closed VictorSoaresRedstage closed 1 year ago

VictorSoaresRedstage commented 1 year ago

Hello,

On cart/checkout, when getting shipping rates, if I'm using JPY or MXN currency and apply a coupon code, I receive a message "No Valid Rates found for Carrier". If I removes coupon, it works.

Current version: "20.51.6"

Error is returning from ShipperHQ API: "error":{ "errorCode":508, "internalErrorMessage":"No Valid Rates found for Carrier", "externalErrorMessage":null, "priority":999 },

I think there's some issue when calculating discount to send to ShipperHQ. Check "discountedStorePrice" and "discountedTaxInclStorePrice" fields (they are negatives):

MXN request: "qty":1, "weight":"2.600000", "rowTotal":3965.61, "basePrice":199.99, "storePrice":199.99, "taxInclBasePrice":199.99, "taxInclStorePrice":3965.61, "baseRowTotal":199.99, "discountPercent":10, "discountedBasePrice":179.99, "discountedStorePrice":-196.57, "discountedTaxInclBasePrice":179.99, "discountedTaxInclStorePrice":-196.57, "fixedPrice":false, "fixedWeight":false, "discountAmount":396.56, "attributes":[], "baseCurrency":"USD", "packageCurrency":"MXN", "storeBaseCurrency":"USD", "storeCurrentCurrency":"MXN", "taxPercentage":0, "freeShipping":false, "type":"simple"

JPY request: "qty":1, "weight":"2.600000", "rowTotal":29274.93, "basePrice":199.99, "storePrice":199.99, "taxInclBasePrice":199.99, "taxInclStorePrice":29274.93, "baseRowTotal":199.99, "discountPercent":10, "discountedBasePrice":179.99, "discountedStorePrice":-2727.5, "discountedTaxInclBasePrice":179.99, "discountedTaxInclStorePrice":-2727.5, "fixedPrice":false, "fixedWeight":false, "discountAmount":2927.49, "attributes":[], "baseCurrency":"USD", "packageCurrency":"JPY", "storeBaseCurrency":"USD", "storeCurrentCurrency":"JPY", "taxPercentage":0, "freeShipping":false, "type":"simple",

USD request (working fine): "qty":1, "weight":"2.600000", "rowTotal":199.99, "basePrice":199.99, "storePrice":199.99, "taxInclBasePrice":199.99, "taxInclStorePrice":199.99, "baseRowTotal":199.99, "discountPercent":10, "discountedBasePrice":179.99, "discountedStorePrice":179.99, "discountedTaxInclBasePrice":179.99, "discountedTaxInclStorePrice":179.99, "fixedPrice":false, "fixedWeight":false, "discountAmount":20, "attributes":[], "baseCurrency":"USD", "packageCurrency":"USD", "storeBaseCurrency":"USD", "storeCurrentCurrency":"USD", "taxPercentage":0, "freeShipping":false, "type":"simple",

Used same product and coupon (10% discount).

Thanks.

WSAlewis commented 1 year ago

Hello @VictorSoaresRedstage,

Just updating here for visibility as we've conversed through email, our development team are looking into this and we'll reach out once we have further information to share.

Thank you for raising this.

Lewis Kennedy - ShipperHQ Support.

wsajosh commented 1 year ago

Hi @VictorSoaresRedstage Thanks for raising this. I'm the developer looking into the issue. It's stemming from a bug in the core Magento code it would seem. The call to $item->getPrice() used to return the store price in the current currency, indeed the PHPDocs say that's what it should do but it's not. I'm going to add a function to the ShipperHQ code to calculate that value instead to work around this issue. I'm hoping that we should have a new release by early next week to address this. Thanks for raising the issue

VictorSoaresRedstage commented 1 year ago

Hi Josh,

I appreciate your update. Keep me posted on the new release.

Thanks!! Victor.


De: Josh @.> Enviado: quarta-feira, 12 de abril de 2023 07:08 Para: shipperhq/module-shipper @.> Cc: Victor Brito Soares @.>; Mention @.> Assunto: Re: [shipperhq/module-shipper] Error getting rates when using JPY and MXN currencies when applying coupon (Issue #129)

Hi @VictorSoaresRedstagehttps://github.com/VictorSoaresRedstage Thanks for raising this. I'm the developer looking into the issue. It's stemming from a bug in the core Magento code it would seem. The call to $item->getPrice() used to return the store price in the current currency, indeed the PHPDocs say that's what it should do but it's not. I'm going to add a function to the ShipperHQ code to calculate that value instead to work around this issue. I'm hoping that we should have a new release by early next week to address this. Thanks for raising the issue

— Reply to this email directly, view it on GitHubhttps://github.com/shipperhq/module-shipper/issues/129#issuecomment-1505010628, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A4BVSYDDBB3R2DGE7DZVPP3XAZ5JZANCNFSM6AAAAAAVMLPCQ4. You are receiving this because you were mentioned.Message ID: @.***>

VictorSoaresRedstage commented 1 year ago

Hi @wsajosh, any updates on this issue?

Thanks, Victor.

wsajosh commented 1 year ago

Hi @VictorSoaresRedstage

Yes, sorry for the delay. This is still in QA. I'll chase it up.

wsajosh commented 1 year ago

Hi @VictorSoaresRedstage I've just released 20.52.1 which should address this issue. Thanks for raising it and patience while we resolved it.

VictorSoaresRedstage commented 1 year ago

@wsajason Thanks!! I'll test and let you know any issues.

Thank you, Victor.