Appearance
0025: Internal amounts are GBP pence by construction; currency is checked at every boundary
Context
Standing rule M1 asks for money that is never a float, as integer pence with a currency code. Part (a) removed the last float arithmetic. Part (b) asked whether every amount should carry its currency (a Money type) or whether the currency should be fixed for the whole system and checked where money comes in. GetMy Books serves UK limited companies filing with HMRC only; every figure it produces (VAT boxes, reconciliation totals, journals) is in pounds.
Decision
Decided by the Product Owner on 2026-09-29.
- No
Moneytype. Every internal amount (amountPence,lineAmountPence,netAmountPence, box totals) is an integer number of GBP pence. The name says pence; the currency is GBP by construction. - Currency is checked at each boundary where money enters, and anything that is not GBP is refused with a plain message rather than read as pence. Nothing is converted except where Xero has already given its own rate for a foreign-currency document on a GBP organisation (below).
| Boundary | Where | On a non-GBP value |
|---|---|---|
| Xero organisation, at connect | scripts/xero-connect.ts, rule src/rules/currency.ts | Reads BaseCurrency from GET /Organisation. Not GBP, or not given: "Not connected. This Xero organisation's base currency is X. GetMy Books works only in pounds sterling (GBP)...". No connection is saved. |
| Xero organisation, on every VAT read | vat_prepare_return, vat_verify_return in src/mcp/vat-tools.ts | Same GET /Organisation call as the scheme check, so no extra call. Not GBP: { blocked: true, reason } before any document is read. |
| Xero organisation, on every bank read | openReconciliation in src/mcp/reconciliation.ts (all bank_* reconciliation tools) | One extra GET /Organisation call. Not GBP: the tool returns an error before the bank or the ledger is read. |
| Xero VAT documents | linesFromXeroDocuments in src/vat/from-xero-documents.ts | Takes the organisation's base currency and refuses unless it is GBP, so a document with no currency (which Xero means as the base currency) can never be taken as pounds on another organisation. A document in another currency is converted at Xero's own CurrencyRate into whole pence; one with no rate stops the draft. |
| Xero bank records | fromBankTransaction in src/xero/bank-records.ts | A bank transaction whose CurrencyCode is not GBP stops the read. Payments are read from BankAmount, which Xero gives in the bank account's currency; batch payments carry no currency field, so openReconciliation also refuses a linked bank account whose CurrencyCode in the chart of accounts (already read) is not GBP (SPEC-003 S54). |
| Starling | toBankLine in src/starling/client.ts; scripts/starling-connect.ts | A feed item whose amount.currency is not GBP stops the read ("only GBP accounts are supported"). The connect script only offers GBP accounts. |
| Statement files (Amex CSV) | parseAmexCsv in src/banks/amex-csv.ts | The Amex UK export has no currency column: its Amount is in the card's currency, which is sterling. Statement files are GBP by the account's definition. The place to check that is the account setup (scripts/statement-account-add.ts), which links the file source to a Xero bank account on an organisation already checked as GBP. |
Consequences
- No type change ripples through the rules;
src/rules/andsrc/vat/stay plain integers. - A company with a non-GBP base currency cannot be connected, and an existing connection whose base currency changed is refused on every read.
- A new source of money (another bank, another file format) must add its own boundary check and a row to the table above.
- Not yet checked: the currency of the Xero bank account itself, which
statement-account-add.tsdoes not read. A foreign-currency bank account on a GBP organisation would today be caught only through its bank transactions'CurrencyCode.