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

feat: Add ACH to stripe email template #1105

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions billing/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,27 @@ 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 = {
"amount": invoice.total / 100,
"card_type": card.brand if card else None,
"last_four": card.last4 if card else None,
"cta_link": invoice.hosted_invoice_url,
"date": datetime.now().strftime("%B %-d, %Y"),
# card params
"is_credit_card": True if card else False,
"card_type": card.brand if card else None,
"last_four": card.last4 if card else None,
# us bank params
"is_us_bank": True if us_bank_account else False,
"bank_name": us_bank_account.bank_name if us_bank_account else None,
"bank_last_four": us_bank_account.last4 if us_bank_account else None,
}

for admin in admins:
Expand Down
Loading