1'use strict';23// Currency is validated against the site, never written.4//5// Two facts, kept separate because conflating them produced an earlier, wrong "currency is a payment6// field" row: (a) a Wix payment record has no currency, so the only available action is to7// validate the source history against the target site's currency and REPORT; (b) multi-currency8// history is a real gap with no workaround, and the honest handling is to HALT before any order9// write rather than import a mixed history at face value. A store can configure two currencies10// while every order uses one -- so this gate is what11// lets a single-currency store proceed and stops a multi-currency one.12//13// Everything here is pure. The caller supplies the settings currency (read from14
75 findings: [...findings, { code: 'store-currency-unreadable', note: 'wc/v3/settings/general did not yield an ISO 4217 code; the order field is not a substitute' }],
76 };
77 }
78 if (!target) {
79 // The currency comparison is against the TARGET SITE. Without its currency there is
80 // nothing to validate against, and "validated" would report a comparison that never happened.
84 findings: [...findings, { code: 'target-currency-unknown', note: 'read the target site currency before validating; the gate cannot pass without it' }],
85 };
86 }
87 if (unresolved > 0) {
88 // An order whose currency could not be resolved is money we cannot place. Not a mismatch, not
89 // a multi-currency store -- an unknown, and unknown halts.