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

View File

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