You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug AttributeError: 'str' object has no attribute 'get' because Invoice.api_list returns Invoice objs where the discounts attribute is a list of discount IDs. But must be JSON Object with full data
To Reproduce
Call retry_unpaid_invoices on Invoices with discounts applied. (Line Item Discounts, Product specific discounts)
Software versions
Dj-Stripe version: 2.8.1
Python version: 3.8
Django version: 4+
Stripe API version: 2017
Database type and version: PSQL
** Proposed solution **
for stripe_invoice in Invoice.api_list(customer=self.id, **kwargs):
# hack: list returns discounts as id list, must be obj list.
invoice = Invoice.objects.get(id=stripe_invoice.id)
stripe_invoice = invoice.api_retrieve()
Invoice.sync_from_stripe_data(stripe_invoice, api_key=api_key)
The text was updated successfully, but these errors were encountered:
I can confirm this is a bug. We simply need to add expand=["data.discounts"] in the _sync_invoices() method to fix. I am not sure if this will get fixed before 3.0 unfortunately.
Describe the bug
AttributeError: 'str' object has no attribute 'get'
becauseInvoice.api_list
returns Invoice objs where thediscounts
attribute is a list of discount IDs. But must be JSON Object with full dataTo Reproduce
Call
retry_unpaid_invoices
on Invoices with discounts applied. (Line Item Discounts, Product specific discounts)Software versions
** Proposed solution **
The text was updated successfully, but these errors were encountered: