Skip to content

Commit

Permalink
cmd/satellite/billing: don't fail the overall process if an individua…
Browse files Browse the repository at this point in the history
…l invoice fails

Change-Id: I36591a717ef97bdb417cc6d9218e22b2f91f249b
  • Loading branch information
jtolio authored and Storj Robot committed Jul 10, 2023
1 parent 1d62dc6 commit 73d65fc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions satellite/payments/stripe/service.go
Expand Up @@ -1068,8 +1068,6 @@ func (service *Service) PayInvoices(ctx context.Context, createdOnAfter time.Tim
}
params.Filters.AddFilter("created", "gte", strconv.FormatInt(createdOnAfter.Unix(), 10))

var errGrp errs.Group

invoicesIterator := service.stripeClient.Invoices().List(params)
for invoicesIterator.Next() {
stripeInvoice := invoicesIterator.Invoice()
Expand All @@ -1084,11 +1082,13 @@ func (service *Service) PayInvoices(ctx context.Context, createdOnAfter time.Tim
params := &stripe.InvoicePayParams{Params: stripe.Params{Context: ctx}}
_, err = service.stripeClient.Invoices().Pay(stripeInvoice.ID, params)
if err != nil {
errGrp.Add(Error.New("unable to pay invoice %s", stripeInvoice.ID))
service.log.Warn("unable to pay invoice",
zap.String("stripe-invoice-id", stripeInvoice.ID),
zap.Error(err))
continue
}
}
return errGrp.Err()
return invoicesIterator.Err()
}

// projectUsagePrice represents pricing for project usage.
Expand Down

0 comments on commit 73d65fc

Please sign in to comment.