Amounts and directions
amount is always positive. direction carries the sign. To get a signed figure, negate when direction is debit.
How direction is decided#
From the document, never from the payee name. Issuers encode it four ways:
- A sign on the amount. A leading or trailing minus, or brackets.
- A section heading that owns every row beneath it, such as
CHECKS AND OTHER DEBITS. The rows themselves carry no marker. - Paired columns,
Débit | Crédit, where the column decides the direction. - A marker against a default. On a card statement every row is a charge unless it carries
CR.
Income#
Only count credits on type: "bank" accounts. A credit card's credits are the monthly repayment and merchant refunds. Summing credits across every account in a file inflates income by whatever the customer spent on the card.
const income = doc.accounts .filter((a) => a.type === "bank") .reduce((sum, a) => sum + a.totals.credits, 0);
The same applies in reverse. A payment from a current account to a credit card is not spending if you also hold that card's statement for the month, because the purchases it settles are itemised there.
Totals#
totals | statedTotals | |
|---|---|---|
| Where it comes from | Summed from the rows in this response. | Copied from the figure the issuer printed. |
| Use it to | Add up money. | Check our extraction against the document. |
| Watch out for | Nothing. It agrees with transactions by construction. | Convention. Amex's total new spend is net of refunds; most banks' is not. |
A gap between the two is usually a difference of convention. See Verification.
Something wrong or missing on this page? [email protected]