Update routes/subscription.py
Browse files- routes/subscription.py +6 -2
routes/subscription.py
CHANGED
@@ -119,13 +119,17 @@ async def subscription_details(data: SubscriptionRequest):
|
|
119 |
else:
|
120 |
payment_info = "No default payment method found"
|
121 |
|
|
|
|
|
|
|
122 |
return {
|
123 |
"status": subscription_status,
|
124 |
"subscription_id": subscription_id,
|
125 |
"current_price": f"{current_price} {currency}",
|
126 |
"next_invoice_amount": f"{next_invoice_amount} {currency}" if next_invoice_amount else "N/A",
|
127 |
"next_billing_date": next_billing_date,
|
128 |
-
"payment_method": payment_info
|
|
|
129 |
}
|
130 |
|
131 |
except stripe.error.StripeError as e:
|
@@ -134,7 +138,7 @@ async def subscription_details(data: SubscriptionRequest):
|
|
134 |
except Exception as e:
|
135 |
logger.error(f"Error retrieving subscription details: {str(e)}")
|
136 |
raise HTTPException(status_code=500, detail="Error retrieving subscription details.")
|
137 |
-
|
138 |
@router.post("/generate_dashboard_link")
|
139 |
async def generate_dashboard_link(data: UserIDRequest):
|
140 |
try:
|
|
|
119 |
else:
|
120 |
payment_info = "No default payment method found"
|
121 |
|
122 |
+
# Pegando o stylist_id dos metadados
|
123 |
+
stylist_id = subscription["metadata"].get("stylist_id", "N/A")
|
124 |
+
|
125 |
return {
|
126 |
"status": subscription_status,
|
127 |
"subscription_id": subscription_id,
|
128 |
"current_price": f"{current_price} {currency}",
|
129 |
"next_invoice_amount": f"{next_invoice_amount} {currency}" if next_invoice_amount else "N/A",
|
130 |
"next_billing_date": next_billing_date,
|
131 |
+
"payment_method": payment_info,
|
132 |
+
"stylist_id": stylist_id
|
133 |
}
|
134 |
|
135 |
except stripe.error.StripeError as e:
|
|
|
138 |
except Exception as e:
|
139 |
logger.error(f"Error retrieving subscription details: {str(e)}")
|
140 |
raise HTTPException(status_code=500, detail="Error retrieving subscription details.")
|
141 |
+
|
142 |
@router.post("/generate_dashboard_link")
|
143 |
async def generate_dashboard_link(data: UserIDRequest):
|
144 |
try:
|