Add user delete process
This commit is contained in:
@@ -49,6 +49,8 @@ class Invoice:
|
||||
created_at: datetime
|
||||
due_date: Optional[datetime] = None
|
||||
description: Optional[str] = None
|
||||
invoice_pdf: Optional[str] = None # URL to PDF invoice
|
||||
hosted_invoice_url: Optional[str] = None # URL to hosted invoice page
|
||||
|
||||
|
||||
class PaymentProvider(abc.ABC):
|
||||
|
||||
@@ -151,10 +151,11 @@ class StripeProvider(PaymentProvider):
|
||||
"""
|
||||
try:
|
||||
stripe_invoices = stripe.Invoice.list(customer=customer_id, limit=100)
|
||||
|
||||
|
||||
invoices = []
|
||||
for stripe_invoice in stripe_invoices:
|
||||
invoices.append(Invoice(
|
||||
# Create base invoice object
|
||||
invoice = Invoice(
|
||||
id=stripe_invoice.id,
|
||||
customer_id=stripe_invoice.customer,
|
||||
subscription_id=stripe_invoice.subscription,
|
||||
@@ -164,8 +165,14 @@ class StripeProvider(PaymentProvider):
|
||||
created_at=datetime.fromtimestamp(stripe_invoice.created),
|
||||
due_date=datetime.fromtimestamp(stripe_invoice.due_date) if stripe_invoice.due_date else None,
|
||||
description=stripe_invoice.description
|
||||
))
|
||||
|
||||
)
|
||||
|
||||
# Add Stripe-specific URLs as custom attributes
|
||||
invoice.invoice_pdf = stripe_invoice.invoice_pdf if hasattr(stripe_invoice, 'invoice_pdf') else None
|
||||
invoice.hosted_invoice_url = stripe_invoice.hosted_invoice_url if hasattr(stripe_invoice, 'hosted_invoice_url') else None
|
||||
|
||||
invoices.append(invoice)
|
||||
|
||||
return invoices
|
||||
except stripe.error.StripeError as e:
|
||||
logger.error("Failed to retrieve Stripe invoices", error=str(e))
|
||||
|
||||
Reference in New Issue
Block a user