fix(billing): exclude verify + zero-amount rows from payment history

Helcim's card-transactions list includes auth-only "verify" rows
and $0 entries that have no value on the member-facing history.
This commit is contained in:
Jennie Robinson Faber 2026-04-19 18:32:08 +01:00
parent 5d6fcdd78d
commit 9a407c2a38

View file

@ -191,7 +191,13 @@ export async function listHelcimCustomerTransactions(customerCode) {
? response
: (response?.transactions || response?.data || [])
const sorted = [...rows].sort((a, b) => {
const filtered = rows.filter((t) => {
const type = String(t?.type || '').toLowerCase()
const amount = typeof t?.amount === 'number' ? t.amount : Number(t?.amount) || 0
return type !== 'verify' && amount > 0
})
const sorted = [...filtered].sort((a, b) => {
const da = Date.parse(a?.dateCreated || '') || 0
const db = Date.parse(b?.dateCreated || '') || 0
return db - da