-
Notifications
You must be signed in to change notification settings - Fork 14.9k
fix(paypal): preserve unscaled amount for zero-decimal currencies like JPY (#29983) #29993
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import { describe, expect, it } from "vitest"; | ||
| import { convertFromSmallestToPresentableCurrencyUnit } from "@calcom/lib/currencyConversions"; | ||
|
|
||
| describe("PayPal currency conversion for zero-decimal and standard currencies", () => { | ||
| it("converts standard minor unit currencies (USD, EUR) by dividing by 100", () => { | ||
| expect(convertFromSmallestToPresentableCurrencyUnit(5000, "USD").toString()).toBe("50"); | ||
| expect(convertFromSmallestToPresentableCurrencyUnit(1000, "EUR").toString()).toBe("10"); | ||
| }); | ||
|
|
||
| it("preserves unscaled amounts for zero-decimal currencies (JPY, KRW, VND)", () => { | ||
| expect(convertFromSmallestToPresentableCurrencyUnit(10000, "JPY").toString()).toBe("10000"); | ||
| expect(convertFromSmallestToPresentableCurrencyUnit(1050, "JPY").toString()).toBe("1050"); | ||
| expect(convertFromSmallestToPresentableCurrencyUnit(50000, "KRW").toString()).toBe("50000"); | ||
| }); | ||
| }); | ||
|
Comment on lines
+4
to
+15
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win Test the serialized order payload. These tests call the currency helper directly. A regression in 🤖 Prompt for AI Agents |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Add the missing VND assertion or remove VND from the test title.
The title claims coverage for VND, but Lines 11-13 assert only JPY and KRW. Add one VND case to verify the advertised zero-decimal currency contract.
🤖 Prompt for AI Agents