currency: a wallet row's amount is AUD, so show its native figure, not the AUD one under a foreign label
ci / lint-test (push) Successful in 1m41s
ci / lint-test (push) Successful in 1m41s
Wallet rows store the provisional AUD figure in amount and amount_aud and the native figure in foreign_currency_amount. NATIVE_CURRENCY labelled every statement-less row with foreign_currency_code (the order-lane convention, where amount IS native and amount_aud is NULL), so an INR 524 tap rendered as "$9.42 / INR 9.42" (txn 8162). amount_aud being present now marks amount as AUD. Measured live: exactly the 38 foreign wallet rows change label, nothing else. The transactions list's second line prints foreign_currency_amount where one exists, which also surfaces the native figure on statement rows that carry one. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -105,6 +105,19 @@ describe("NATIVE_CURRENCY", () => {
|
||||
expect(unconverted).toBe(true);
|
||||
});
|
||||
|
||||
it("labels a statement-less wallet row AUD, because its amount already is", async () => {
|
||||
// Wallet rows store a provisional AUD figure in amount AND amount_aud, and
|
||||
// the native figure in foreign_currency_amount. Reading the foreign code
|
||||
// here printed "INR 9.42" for an INR 524 tap (txn 8162).
|
||||
const id = await scratchTxn(
|
||||
"transaction_date, description, amount, amount_aud, transaction_type, payment_method, source, source_ref, foreign_currency_amount, foreign_currency_code",
|
||||
"'2026-10-03','Wallet foreign fixture', 9.42, 9.42, 'debit', 'card', 'wallet', 'evt:fixture-native-ccy', 524.00, 'INR'"
|
||||
);
|
||||
const { ccy, unconverted } = await currencyOf(id);
|
||||
expect(ccy).toBe("AUD");
|
||||
expect(unconverted).toBe(false);
|
||||
});
|
||||
|
||||
it("prefers the statement's currency over the foreign-charge record", async () => {
|
||||
// Opposite convention: on an AUD statement, `amount` is AUD and
|
||||
// foreign_currency_code merely notes what was originally charged. Reading
|
||||
|
||||
Reference in New Issue
Block a user