@@ -24,9 +24,11 @@ type Deps struct { |
| 24 | 24 | Pool *pgxpool.Pool |
| 25 | 25 | } |
| 26 | 26 | |
| 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 | +) |
| 30 | 32 | |
| 31 | 33 | const ( |
| 32 | 34 | PlanFree = billingdb.OrgPlanFree |
@@ -295,79 +297,13 @@ func jsonObject(payload []byte) bool { |
| 295 | 297 | } |
| 296 | 298 | |
| 297 | 299 | 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) |
| 321 | 301 | } |
| 322 | 302 | |
| 323 | 303 | 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) |
| 347 | 305 | } |
| 348 | 306 | |
| 349 | 307 | 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) |
| 373 | 309 | } |