satellite/payments/stripecoinpayments: fix listing issue for coupon

usages and credit spendings

Test will be added as a separate change.

Change-Id: I9341d2ecb736fdbd45beb96f778f04448df68bd7
This commit is contained in:
Michal Niewrzal 2020-05-20 14:54:32 +02:00 committed by Stefan Benten
parent bef84a5f9d
commit 83cc80ef06

View File

@ -670,7 +670,8 @@ func (service *Service) InvoiceApplyCoupons(ctx context.Context, period time.Tim
return Error.Wrap(err)
}
usagePage, err = service.db.Coupons().ListUnapplied(ctx, usagePage.NextOffset, fetchLimit, start)
// we are always starting from offset 0 because applyCoupons is changing coupon usage state to applied
usagePage, err = service.db.Coupons().ListUnapplied(ctx, 0, fetchLimit, start)
if err != nil {
return Error.Wrap(err)
}
@ -778,7 +779,8 @@ func (service *Service) InvoiceApplyCredits(ctx context.Context, period time.Tim
return Error.Wrap(err)
}
spendingsPage, err = service.db.Credits().ListCreditsSpendingsPaged(ctx, int(CreditsSpendingStatusUnapplied), spendingsPage.NextOffset, fetchLimit, start)
// we are always starting from offset 0 because applySpendings is changing credits spendings state to applied
spendingsPage, err = service.db.Credits().ListCreditsSpendingsPaged(ctx, int(CreditsSpendingStatusUnapplied), 0, fetchLimit, start)
if err != nil {
return Error.Wrap(err)
}