Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit 3fd8bd5

Browse files
cleanup
1 parent b569e50 commit 3fd8bd5

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

billing/views.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,13 @@ def invoice_payment_failed(self, invoice: stripe.Invoice) -> None:
107107
card = (
108108
payment_intent.payment_method.card
109109
if payment_intent.payment_method
110-
and not isinstance(payment_intent.payment_method, str)
110+
and hasattr(payment_intent.payment_method, 'card')
111+
else None
112+
)
113+
us_bank_account = (
114+
payment_intent.payment_method.us_bank_account
115+
if payment_intent.payment_method
116+
and hasattr(payment_intent.payment_method, 'us_bank_account')
111117
else None
112118
)
113119
template_vars = {
@@ -119,8 +125,8 @@ def invoice_payment_failed(self, invoice: stripe.Invoice) -> None:
119125
"is_credit_card": True if card else False,
120126
"card_type": card.brand if card else None,
121127
# us bank params
122-
"is_us_bank": True if payment_intent.payment_method and hasattr(payment_intent.payment_method, 'us_bank_account') else False,
123-
"bank_name": payment_intent.payment_method.us_bank_account.bank_name if payment_intent.payment_method and hasattr(payment_intent.payment_method, 'us_bank_account') else None,
128+
"is_us_bank": True if us_bank_account else False,
129+
"bank_name": us_bank_account.bank_name if us_bank_account else None,
124130
}
125131

126132
for admin in admins:

0 commit comments

Comments
 (0)