stripe: Pass ids, not objects, to pagination API.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2024-04-30 10:21:01 -07:00 committed by Tim Abbott
parent 9ca64b21f3
commit 385cd038b0
2 changed files with 5 additions and 2 deletions

View File

@ -5264,8 +5264,9 @@ def get_all_invoices_for_customer(customer: Customer) -> Generator[stripe.Invoic
for invoice in invoices:
yield invoice
last_invoice = invoice
assert last_invoice.id is not None
invoices = stripe.Invoice.list(
customer=customer.stripe_customer_id, starting_after=last_invoice, limit=100
customer=customer.stripe_customer_id, starting_after=last_invoice.id, limit=100
)

View File

@ -557,7 +557,9 @@ class StripeTestCase(ZulipTestCase):
def send_stripe_webhook_events(self, most_recent_event: stripe.Event) -> None:
while True:
events_old_to_new = list(reversed(stripe.Event.list(ending_before=most_recent_event)))
events_old_to_new = list(
reversed(stripe.Event.list(ending_before=most_recent_event.id))
)
if len(events_old_to_new) == 0:
break
for event in events_old_to_new: