Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

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

Anders Kaseorg385cd038b068
diff --git a/corporate/lib/stripe.py b/corporate/lib/stripe.py
index 2671854e70b..d883f491e29 100644
--- a/corporate/lib/stripe.py
+++ b/corporate/lib/stripe.py
@@ -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
)
diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.py
index d37d0d47593..2472ef7b2c5 100644
--- a/corporate/tests/test_stripe.py
+++ b/corporate/tests/test_stripe.py
@@ -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: