fix(money): zero-decimal currency handling (D7)
Stripe sends zero-decimal currencies (JPY/KRW/VND/...) already in the major unit; the unconditional /100 recorded a JPY dues charge 100x understated in the ledger + receipt. minorToMajor is now currency-aware (shared ZERO_DECIMAL_CURRENCIES/isZeroDecimalCurrency in notifications-logic); formatMoney renders no fractional part for those. Never fires for USD; closes silent ledger corruption for such tenants. Tests added; suite 526+.
This commit is contained in:
@@ -298,7 +298,7 @@ export async function POST(
|
||||
await enqueueDues('dues_renewed', {
|
||||
memberId,
|
||||
fallbackEmail: inv.customer_email ?? null,
|
||||
amount: minorToMajor(inv.amount_paid),
|
||||
amount: minorToMajor(inv.amount_paid, inv.currency),
|
||||
currency: (inv.currency ?? 'usd').toUpperCase(),
|
||||
periodEnd: invoiceLinePeriodEnd(inv),
|
||||
invoiceId: inv.id,
|
||||
@@ -317,7 +317,7 @@ export async function POST(
|
||||
await enqueueDues('dues_payment_failed', {
|
||||
memberId,
|
||||
fallbackEmail: inv.customer_email ?? null,
|
||||
amount: minorToMajor(inv.amount_due),
|
||||
amount: minorToMajor(inv.amount_due, inv.currency),
|
||||
currency: (inv.currency ?? 'usd').toUpperCase(),
|
||||
invoiceId: inv.id,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user