only report the paddle error if it's not 147

This commit is contained in:
Son NK 2020-11-14 12:55:53 +01:00
parent f16676e921
commit a072d6c0cd
1 changed files with 3 additions and 4 deletions

View File

@ -91,15 +91,14 @@ def change_plan(subscription_id: str, plan_id) -> (bool, str):
)
res = r.json()
if not res["success"]:
LOG.exception(
f"cannot change subscription {subscription_id} to {plan_id}, paddle response: {res}"
)
try:
# "unable to complete the resubscription because we could not charge the customer for the resubscription"
if res["error"]["code"] == 147:
return False, "Your card cannot be charged"
except:
LOG.warning("Cannot parse error code from %s", res)
LOG.exception(
f"cannot change subscription {subscription_id} to {plan_id}, paddle response: {res}"
)
return False, ""
return False, ""