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
This commit is contained in:
Moby von Briesen 2021-07-27 12:48:28 -04:00
parent d73b9fff9a
commit 8f072bdeee

View File

@ -191,7 +191,8 @@ func checkPaidTier(ctx context.Context) (err error) {
for _, c := range customersPage.Customers { for _, c := range customersPage.Customers {
user, err := users.Get(ctx, c.UserID) user, err := users.Get(ctx, c.UserID)
if err != nil { if err != nil {
return err fmt.Printf("Couldn't find user in DB; skipping: %v\n", err)
continue
} }
if user.PaidTier { if user.PaidTier {
// already in paid tier; go to next customer // 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) cards, err := creditCards.List(ctx, user.ID)
if err != nil { 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 { if len(cards) == 0 {
// no card added, so no paid tier; go to next customer // no card added, so no paid tier; go to next customer