Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: getLowestRate() doesn't account for difference currencies #421

Open
pauldraper opened this issue Nov 14, 2023 · 2 comments
Open

[Bug]: getLowestRate() doesn't account for difference currencies #421

pauldraper opened this issue Nov 14, 2023 · 2 comments
Labels
triage Issue is being researched

Comments

@pauldraper
Copy link

pauldraper commented Nov 14, 2023

Software Version

Language Version

Operating System

What happened?

getLowestRate() gives a bad result with different currencies, e.g. mixing CAD and USD sometimes chooses a numerically lower USD even if CAD quote is better.

I can't imagine any case where this is desirable behavior.

getLowestRate(rates, carriers = null, services = null) {

What was expected?

Not sure, but the existence of getLowestRate() is a footgun.

Sample Code

No response

Relevant logs

No response

@pauldraper pauldraper added the triage Issue is being researched label Nov 14, 2023
@nwithan8
Copy link
Member

nwithan8 commented Nov 14, 2023

Hello, thank you for reaching out! We are triaging the issue currently. Do you perhaps have any logs you could share to help us reproduce the issue, specifically how you retrieved a combination of USD and non-USD rates?

@Harrison-Burgess
Copy link

Harrison-Burgess commented Nov 14, 2023

Hey, what I did to produce this was creating a shipment
const shipmentData = { to_address: toAddress, from_address: fromAddress, parcel: await easypost.Parcel.create({ weight: getLineItemWeight(productWithQty), }), options: { currency: "USD", }, mode, };

shipment = await easypost.Shipment.create(shipmentData);
Where the addresses were from 2 different countries
This requested rates where we preferred them in USD. Some of the carriers didn't seem to work for the currency option though and still gave us back rates in the local currency.
const lowestRate = shipment.lowestRate([ "UPS", "CanadaPost", "FedExDefault", "USPSReturns", ]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage Issue is being researched
Projects
None yet
Development

No branches or pull requests

3 participants