mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-01 19:23:27 +00:00
PAYMENT_CURRENCIES was copy-pasted into six files — four freight DTOs and two portal zod schemas — with no owner, and @edr/api-common's exchange service kept a seventh copy of its own as a bare "USD" | "ETB" union. They had already drifted: the DTOs and the exchange service did not agree on what the platform could price in, so a form could offer a currency the rate service had never heard of. Adds PAYMENT_CURRENCIES (now including DJF), the PaymentCurrency type and an isPaymentCurrency guard for the free-string currency columns the ORMs hand back. Every existing list re-exports this one instead of becoming a seventh copy. Also carries the two rules that have to travel with the list: CURRENCY_DECIMALS, because DJF is a zero-decimal currency — an amount with centimes is not a more precise payment, it is a malformed one, and CAC Bank rejects it. roundMoney() applies it. PROVIDER_CURRENCIES, which gateway settles which currency. Only CBE_BILL carries a restriction the code can evidence (CBE settles ETB, plan D8); eBirr, Waafi and D-Money each pass input.currency to the provider verbatim with an explicit comment saying so. The other rows are therefore permissive on purpose rather than guessed — settlement currency is really a property of the merchant account, not the provider brand, and tightening a row on a hunch would break a live flow.