Fix supervisor payments mobile tabs, reconcile donor, report method buckets, and refund/donation accounting
- Supervisor Payments: mode tabs now wrap on mobile instead of overflowing off-screen. - Reconciling a Yoco transaction as a donation now lets staff pick who it's from. - Reports payment-method breakdown now buckets into Cash/Card/EFT/Other everywhere, folding Apple Pay, Google Pay, and Yoco-portal payments into Card. - Refunds now net against their original method's bucket (Cashup/Finance/Profit reports, My Payments filtering/display) instead of vanishing or falling into "Other". - Refund form's method dropdown mirrors the real payment methods and auto-fills from the payment being refunded, replacing an ambiguous generic "Refund" option. - Fixed donation remaining/unallocated balance inflating instead of shrinking when a donation is refunded (assign-donation endpoint, cashup reports, donations reports, and the Assign Donation panel all summed refund legs with the wrong sign). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -13,8 +13,16 @@ const METHOD_LABELS: Record<string, string> = {
|
||||
other: "Other",
|
||||
};
|
||||
|
||||
// Refund methods are recorded as "<method>-refund" (e.g. "card-refund") so a refund nets
|
||||
// against the same bucket its original payment counted under. Strip that suffix before
|
||||
// bucketing so a card refund still displays as "Card", not "Other" — the negative amount
|
||||
// already signals it's a refund.
|
||||
function stripRefundSuffix(method: string): string {
|
||||
return method.endsWith("-refund") ? method.slice(0, -"-refund".length) : method;
|
||||
}
|
||||
|
||||
export function normalizePaymentMethod(method: string | null | undefined): string {
|
||||
const m = String(method || "").toLowerCase();
|
||||
const m = stripRefundSuffix(String(method || "").toLowerCase());
|
||||
if (USER_FACING_METHODS.includes(m)) return m;
|
||||
if (CARD_ALIASES.includes(m)) return "card";
|
||||
return "other";
|
||||
|
||||
Reference in New Issue
Block a user