Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
suejung-sentry committed Jan 21, 2025
1 parent b569e50 commit 3fd8bd5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions billing/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,13 @@ def invoice_payment_failed(self, invoice: stripe.Invoice) -> None:
card = (
payment_intent.payment_method.card
if payment_intent.payment_method
and not isinstance(payment_intent.payment_method, str)
and hasattr(payment_intent.payment_method, 'card')
else None
)
us_bank_account = (
payment_intent.payment_method.us_bank_account
if payment_intent.payment_method
and hasattr(payment_intent.payment_method, 'us_bank_account')
else None
)
template_vars = {
Expand All @@ -119,8 +125,8 @@ def invoice_payment_failed(self, invoice: stripe.Invoice) -> None:
"is_credit_card": True if card else False,
"card_type": card.brand if card else None,
# us bank params
"is_us_bank": True if payment_intent.payment_method and hasattr(payment_intent.payment_method, 'us_bank_account') else False,
"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,
"is_us_bank": True if us_bank_account else False,
"bank_name": us_bank_account.bank_name if us_bank_account else None,
}

for admin in admins:
Expand Down

0 comments on commit 3fd8bd5

Please sign in to comment.