Commit 2614e4d7 authored by Birin Sanchez's avatar Birin Sanchez
Browse files

parse_subscription: Handle case where next_payment_date is the empty


string. This happens when a subscription is cancelled.
Signed-off-by: Birin Sanchez's avatarBirin Sanchez <birin.sanchez@puri.sm>
parent 07ccebf5
Pipeline #14687 passed with stage
in 38 seconds
......@@ -42,10 +42,12 @@ def parse_subscription(json_entry):
% (quantity, id, ))
# calculate next renewal date
next_renewal_naive = datetime.datetime.strptime(
json_entry["next_payment_date"], "%Y-%m-%dT%H:%M:%S")
next_renewal = timezone.make_aware(next_renewal_naive)
if json_entry["next_payment_date"] != "":
next_renewal_naive = datetime.datetime.strptime(
json_entry["next_payment_date"], "%Y-%m-%dT%H:%M:%S")
next_renewal = timezone.make_aware(next_renewal_naive)
else:
next_renewal = datetime.datetime(1900, 1, 1, 0, 0)
# get account name
username = get_username_from_woo_customer_id(json_entry["customer_id"])
......
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