tenseleyflow/shithub / 7ea4fee

Browse files

web/handlers: surface 'Refunded' invoice status + 'Refunded on <date>' label

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
7ea4feede701ce2d96f3d9d36d70d96a612aabf6
Parents
f076e26
Tree
75f52b1

2 changed files

StatusFile+-
M internal/web/handlers/auth/billing_settings.go 4 0
M internal/web/handlers/orgs/billing_settings.go 4 0
internal/web/handlers/auth/billing_settings.gomodified
@@ -530,6 +530,8 @@ func userBillingInvoiceStatusLabel(status userbilling.InvoiceStatus) string {
530530
 		return "Void"
531531
 	case userbilling.InvoiceStatusUncollectible:
532532
 		return "Uncollectible"
533
+	case userbilling.InvoiceStatusRefunded:
534
+		return "Refunded"
533535
 	default:
534536
 		return "Draft"
535537
 	}
@@ -544,6 +546,8 @@ func userBillingPeriodLabel(inv billingdb.BillingInvoice) string {
544546
 
545547
 func userBillingDueLabel(inv billingdb.BillingInvoice) string {
546548
 	switch {
549
+	case inv.RefundedAt.Valid:
550
+		return "Refunded " + inv.RefundedAt.Time.Format("Jan 2, 2006")
547551
 	case inv.PaidAt.Valid:
548552
 		return "Paid " + inv.PaidAt.Time.Format("Jan 2, 2006")
549553
 	case inv.VoidedAt.Valid:
internal/web/handlers/orgs/billing_settings.gomodified
@@ -541,6 +541,8 @@ func billingInvoiceStatusLabel(status orgbilling.InvoiceStatus) string {
541541
 		return "Void"
542542
 	case orgbilling.InvoiceStatusUncollectible:
543543
 		return "Uncollectible"
544
+	case orgbilling.InvoiceStatusRefunded:
545
+		return "Refunded"
544546
 	default:
545547
 		return "Draft"
546548
 	}
@@ -555,6 +557,8 @@ func billingPeriodLabel(inv billingdb.BillingInvoice) string {
555557
 
556558
 func billingDueLabel(inv billingdb.BillingInvoice) string {
557559
 	switch {
560
+	case inv.RefundedAt.Valid:
561
+		return "Refunded " + inv.RefundedAt.Time.Format("Jan 2, 2006")
558562
 	case inv.PaidAt.Valid:
559563
 		return "Paid " + inv.PaidAt.Time.Format("Jan 2, 2006")
560564
 	case inv.VoidedAt.Valid: