Commit 09eba9f7 authored by Birin Sanchez's avatar Birin Sanchez
Browse files

* Return None subscriptions for users without WC account


* Save error message in ExternalCredit.error_message

Signed-off-by: Birin Sanchez's avatarBirin Sanchez <birin.sanchez@puri.sm>
parent 8cd1e17a
Pipeline #10163 passed with stage
in 40 seconds
......@@ -76,6 +76,9 @@ def parse_subscription(json_entry):
def get_user_subscriptions(user):
user_wc_id = user.get_woocommerce_id()
if user_wc_id is None:
# The user does not have WC account
return None
woo = get_woo_connection()
subscriptions = woo.get(
'subscriptions?customer={}'.format(user_wc_id)).json()
......@@ -160,6 +163,7 @@ def process_pending_registrations_user(user):
if hasattr(user, 'chosenreward'):
user.chosenreward.is_pending = is_pending
user.chosenreward.save()
ext_cred.error_message = error
ext_cred.save()
if is_pending:
logger.info('Subscription {} for user {} found error: '
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment