feat(GRO-609): admin refund handling and payment stats dashboard
- Add refund button to invoice detail modal (paid Stripe invoices only) - Full refund (default) and partial refund via confirmation dialog - Call POST /api/invoices/:id/refund on confirmation - Display Stripe payment info (card last4, brand, payment status) - Show refund status when invoice has been refunded - Add payment stats section to InvoicesPage (revenue, outstanding, refunds, method breakdown) - Add GET /api/invoices/:id/stripe-payment endpoint for card details - Add GET /api/invoices/stats endpoint for monthly payment stats - Extend Invoice type with Stripe fields (stripePaymentIntentId, stripeRefundId) Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -153,10 +153,38 @@ export interface Invoice {
|
||||
notes: string | null;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
stripePaymentIntentId?: string | null;
|
||||
stripeRefundId?: string | null;
|
||||
paymentFailureReason?: string | null;
|
||||
lineItems?: InvoiceLineItem[];
|
||||
tipSplits?: InvoiceTipSplit[];
|
||||
}
|
||||
|
||||
export interface StripePaymentInfo {
|
||||
paymentIntentId: string;
|
||||
amountPaidCents: number;
|
||||
status: string;
|
||||
cardLast4: string | null;
|
||||
cardBrand: string | null;
|
||||
refundId: string | null;
|
||||
refundStatus: string | null;
|
||||
}
|
||||
|
||||
export interface PaymentMethodBreakdown {
|
||||
paymentMethod: PaymentMethod;
|
||||
count: number;
|
||||
totalCents: number;
|
||||
}
|
||||
|
||||
export interface PaymentStats {
|
||||
revenueCents: number;
|
||||
outstandingCents: number;
|
||||
refundsCents: number;
|
||||
revenueCount: number;
|
||||
refundCount: number;
|
||||
paymentMethodBreakdown: PaymentMethodBreakdown[];
|
||||
}
|
||||
|
||||
// ─── Impersonation ──────────────────────────────────────────────────────────
|
||||
|
||||
export type ImpersonationSessionStatus = "active" | "ended" | "expired";
|
||||
|
||||
Reference in New Issue
Block a user