mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Handling stripe card error.
This commit is contained in:
parent
932b4a489c
commit
fc3f027241
1 changed files with 14 additions and 10 deletions
|
@ -408,16 +408,20 @@ class Profile(models.Model):
|
|||
break
|
||||
if not existing_subscription:
|
||||
return
|
||||
|
||||
stripe.Subscription.modify(
|
||||
existing_subscription.id,
|
||||
cancel_at_period_end=False,
|
||||
proration_behavior='always_invoice',
|
||||
items=[{
|
||||
'id': existing_subscription['items']['data'][0].id,
|
||||
'price': Profile.plan_to_stripe_price(plan)
|
||||
}]
|
||||
)
|
||||
|
||||
try:
|
||||
stripe.Subscription.modify(
|
||||
existing_subscription.id,
|
||||
cancel_at_period_end=False,
|
||||
proration_behavior='always_invoice',
|
||||
items=[{
|
||||
'id': existing_subscription['items']['data'][0].id,
|
||||
'price': Profile.plan_to_stripe_price(plan)
|
||||
}]
|
||||
)
|
||||
except stripe.error.CardError as e:
|
||||
logging.user(self.user, f"~FRStripe switch subscription failed: ~SB{e}")
|
||||
return
|
||||
|
||||
self.setup_premium_history()
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue