changeset 990a35c49860 in modules/account_payment_stripe:5.0
details:
https://hg.tryton.org/modules/account_payment_stripe?cmd=changeset&node=990a35c49860
description:
Expand sources from customer when needed
issue11717
review421741003
(grafted from 1ab113a47dc2f6aae828f882437ac7aa859be6e4)
diffstat:
payment.py | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diffs (28 lines):
diff -r a2a32051c301 -r 990a35c49860 payment.py
--- a/payment.py Thu Jun 17 21:48:51 2021 +0200
+++ b/payment.py Sun Sep 25 20:26:21 2022 +0200
@@ -902,20 +902,21 @@
customer.save()
Transaction().commit()
- def retrieve(self):
+ def retrieve(self, **params):
if not self.stripe_customer_id:
return
try:
return stripe.Customer.retrieve(
api_key=self.stripe_account.secret_key,
- id=self.stripe_customer_id)
+ id=self.stripe_customer_id,
+ **params)
except (stripe.error.RateLimitError,
stripe.error.APIConnectionError) as e:
logger.warning(str(e))
def sources(self):
sources = []
- customer = self.retrieve()
+ customer = self.retrieve(expand=['sources'])
if customer:
for source in customer.sources:
name = source.id