tenseleyflow/shithub / 3ca141a

Browse files

Fix billing lint findings

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
3ca141a6346be34e71cf26b5f5ca19459cc08261
Parents
eaedf22
Tree
986e40d

1 changed file

StatusFile+-
M internal/billing/billing.go 8 72
internal/billing/billing.gomodified
@@ -24,9 +24,11 @@ type Deps struct {
2424
 	Pool *pgxpool.Pool
2525
 }
2626
 
27
-type Plan = billingdb.OrgPlan
28
-type SubscriptionStatus = billingdb.BillingSubscriptionStatus
29
-type State = billingdb.OrgBillingState
27
+type (
28
+	Plan               = billingdb.OrgPlan
29
+	SubscriptionStatus = billingdb.BillingSubscriptionStatus
30
+	State              = billingdb.OrgBillingState
31
+)
3032
 
3133
 const (
3234
 	PlanFree       = billingdb.OrgPlanFree
@@ -295,79 +297,13 @@ func jsonObject(payload []byte) bool {
295297
 }
296298
 
297299
 func stateFromApply(row billingdb.ApplySubscriptionSnapshotRow) State {
298
-	return State{
299
-		OrgID:                    row.OrgID,
300
-		Provider:                 row.Provider,
301
-		StripeCustomerID:         row.StripeCustomerID,
302
-		StripeSubscriptionID:     row.StripeSubscriptionID,
303
-		StripeSubscriptionItemID: row.StripeSubscriptionItemID,
304
-		Plan:                     row.Plan,
305
-		SubscriptionStatus:       row.SubscriptionStatus,
306
-		BillableSeats:            row.BillableSeats,
307
-		SeatSnapshotAt:           row.SeatSnapshotAt,
308
-		CurrentPeriodStart:       row.CurrentPeriodStart,
309
-		CurrentPeriodEnd:         row.CurrentPeriodEnd,
310
-		CancelAtPeriodEnd:        row.CancelAtPeriodEnd,
311
-		TrialEnd:                 row.TrialEnd,
312
-		PastDueAt:                row.PastDueAt,
313
-		CanceledAt:               row.CanceledAt,
314
-		LockedAt:                 row.LockedAt,
315
-		LockReason:               row.LockReason,
316
-		GraceUntil:               row.GraceUntil,
317
-		LastWebhookEventID:       row.LastWebhookEventID,
318
-		CreatedAt:                row.CreatedAt,
319
-		UpdatedAt:                row.UpdatedAt,
320
-	}
300
+	return State(row)
321301
 }
322302
 
323303
 func stateFromCanceled(row billingdb.MarkCanceledRow) State {
324
-	return State{
325
-		OrgID:                    row.OrgID,
326
-		Provider:                 row.Provider,
327
-		StripeCustomerID:         row.StripeCustomerID,
328
-		StripeSubscriptionID:     row.StripeSubscriptionID,
329
-		StripeSubscriptionItemID: row.StripeSubscriptionItemID,
330
-		Plan:                     row.Plan,
331
-		SubscriptionStatus:       row.SubscriptionStatus,
332
-		BillableSeats:            row.BillableSeats,
333
-		SeatSnapshotAt:           row.SeatSnapshotAt,
334
-		CurrentPeriodStart:       row.CurrentPeriodStart,
335
-		CurrentPeriodEnd:         row.CurrentPeriodEnd,
336
-		CancelAtPeriodEnd:        row.CancelAtPeriodEnd,
337
-		TrialEnd:                 row.TrialEnd,
338
-		PastDueAt:                row.PastDueAt,
339
-		CanceledAt:               row.CanceledAt,
340
-		LockedAt:                 row.LockedAt,
341
-		LockReason:               row.LockReason,
342
-		GraceUntil:               row.GraceUntil,
343
-		LastWebhookEventID:       row.LastWebhookEventID,
344
-		CreatedAt:                row.CreatedAt,
345
-		UpdatedAt:                row.UpdatedAt,
346
-	}
304
+	return State(row)
347305
 }
348306
 
349307
 func stateFromClear(row billingdb.ClearBillingLockRow) State {
350
-	return State{
351
-		OrgID:                    row.OrgID,
352
-		Provider:                 row.Provider,
353
-		StripeCustomerID:         row.StripeCustomerID,
354
-		StripeSubscriptionID:     row.StripeSubscriptionID,
355
-		StripeSubscriptionItemID: row.StripeSubscriptionItemID,
356
-		Plan:                     row.Plan,
357
-		SubscriptionStatus:       row.SubscriptionStatus,
358
-		BillableSeats:            row.BillableSeats,
359
-		SeatSnapshotAt:           row.SeatSnapshotAt,
360
-		CurrentPeriodStart:       row.CurrentPeriodStart,
361
-		CurrentPeriodEnd:         row.CurrentPeriodEnd,
362
-		CancelAtPeriodEnd:        row.CancelAtPeriodEnd,
363
-		TrialEnd:                 row.TrialEnd,
364
-		PastDueAt:                row.PastDueAt,
365
-		CanceledAt:               row.CanceledAt,
366
-		LockedAt:                 row.LockedAt,
367
-		LockReason:               row.LockReason,
368
-		GraceUntil:               row.GraceUntil,
369
-		LastWebhookEventID:       row.LastWebhookEventID,
370
-		CreatedAt:                row.CreatedAt,
371
-		UpdatedAt:                row.UpdatedAt,
372
-	}
308
+	return State(row)
373309
 }