Fix payment method handling for non-default types (apple_pay, google_pay)
Yoco webhook payments are tagged with whatever wallet type the gateway reports, not just cash/card/eft/voucher. Cashup/report totals were silently dropping those into the "other" bucket instead of "card", and the new user payment history page couldn't filter by them and showed raw snake_case values. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -11,11 +11,13 @@ function emptyByMethod(fill = 0) {
|
||||
}
|
||||
|
||||
// Normalizes a free-text Payment.method into one of the fixed cashup buckets.
|
||||
// Card-network wallets (Apple Pay, Google Pay, etc.) settle exactly like a card payment —
|
||||
// no separate float to reconcile — so they belong in the 'card' bucket, not 'other'.
|
||||
function bucketForMethod(method) {
|
||||
const m = String(method || '').toLowerCase();
|
||||
if (m.includes('cash')) return 'cash';
|
||||
if (m.includes('eft')) return 'eft';
|
||||
if (m.includes('card') || m.includes('yoco')) return 'card';
|
||||
if (m.includes('card') || m.includes('yoco') || m.includes('pay')) return 'card';
|
||||
return 'other';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user