From 8f072bdeee6063d47feffc45955c071b2155ac15 Mon Sep 17 00:00:00 2001 From: Moby von Briesen Date: Tue, 27 Jul 2021 12:48:28 -0400 Subject: [PATCH] cmd/satellite: Skip non-existing users in paid tier conversion There are some users in our QA satellite which are no longer in Stripe, and there are some users in Stripe which are not on our QA satellite. This change allows us to test the paid tier conversion script in QA despite these problems. Change-Id: If94c9e882327841d1fd294d75fd302e6a7feee41 --- cmd/satellite/billing.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/satellite/billing.go b/cmd/satellite/billing.go index bfb0b327c..c0060de2c 100644 --- a/cmd/satellite/billing.go +++ b/cmd/satellite/billing.go @@ -191,7 +191,8 @@ func checkPaidTier(ctx context.Context) (err error) { for _, c := range customersPage.Customers { user, err := users.Get(ctx, c.UserID) if err != nil { - return err + fmt.Printf("Couldn't find user in DB; skipping: %v\n", err) + continue } if user.PaidTier { // already in paid tier; go to next customer @@ -199,7 +200,8 @@ func checkPaidTier(ctx context.Context) (err error) { } cards, err := creditCards.List(ctx, user.ID) if err != nil { - return err + fmt.Printf("Couldn't list user's credit cards in Stripe; skipping: %v\n", err) + continue } if len(cards) == 0 { // no card added, so no paid tier; go to next customer