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 {
530
 		return "Void"
530
 		return "Void"
531
 	case userbilling.InvoiceStatusUncollectible:
531
 	case userbilling.InvoiceStatusUncollectible:
532
 		return "Uncollectible"
532
 		return "Uncollectible"
533
+	case userbilling.InvoiceStatusRefunded:
534
+		return "Refunded"
533
 	default:
535
 	default:
534
 		return "Draft"
536
 		return "Draft"
535
 	}
537
 	}
@@ -544,6 +546,8 @@ func userBillingPeriodLabel(inv billingdb.BillingInvoice) string {
544
 
546
 
545
 func userBillingDueLabel(inv billingdb.BillingInvoice) string {
547
 func userBillingDueLabel(inv billingdb.BillingInvoice) string {
546
 	switch {
548
 	switch {
549
+	case inv.RefundedAt.Valid:
550
+		return "Refunded " + inv.RefundedAt.Time.Format("Jan 2, 2006")
547
 	case inv.PaidAt.Valid:
551
 	case inv.PaidAt.Valid:
548
 		return "Paid " + inv.PaidAt.Time.Format("Jan 2, 2006")
552
 		return "Paid " + inv.PaidAt.Time.Format("Jan 2, 2006")
549
 	case inv.VoidedAt.Valid:
553
 	case inv.VoidedAt.Valid:
internal/web/handlers/orgs/billing_settings.gomodified
@@ -541,6 +541,8 @@ func billingInvoiceStatusLabel(status orgbilling.InvoiceStatus) string {
541
 		return "Void"
541
 		return "Void"
542
 	case orgbilling.InvoiceStatusUncollectible:
542
 	case orgbilling.InvoiceStatusUncollectible:
543
 		return "Uncollectible"
543
 		return "Uncollectible"
544
+	case orgbilling.InvoiceStatusRefunded:
545
+		return "Refunded"
544
 	default:
546
 	default:
545
 		return "Draft"
547
 		return "Draft"
546
 	}
548
 	}
@@ -555,6 +557,8 @@ func billingPeriodLabel(inv billingdb.BillingInvoice) string {
555
 
557
 
556
 func billingDueLabel(inv billingdb.BillingInvoice) string {
558
 func billingDueLabel(inv billingdb.BillingInvoice) string {
557
 	switch {
559
 	switch {
560
+	case inv.RefundedAt.Valid:
561
+		return "Refunded " + inv.RefundedAt.Time.Format("Jan 2, 2006")
558
 	case inv.PaidAt.Valid:
562
 	case inv.PaidAt.Valid:
559
 		return "Paid " + inv.PaidAt.Time.Format("Jan 2, 2006")
563
 		return "Paid " + inv.PaidAt.Time.Format("Jan 2, 2006")
560
 	case inv.VoidedAt.Valid:
564
 	case inv.VoidedAt.Valid: