Show minimum_subscription_period only for recurring products

This commit is contained in:
PCoder 2019-09-19 21:24:33 +05:30
parent 72d651ea76
commit 8da25be8b8

View file

@ -64,15 +64,18 @@ def get_pricing(price_in_chf_cents, product_type, recurring_period):
return "CHF {} (One time charge)".format(price_in_chf_cents/100) return "CHF {} (One time charge)".format(price_in_chf_cents/100)
def get_user_friendly_product(product_dict): def get_user_friendly_product(product_dict):
return { uf_product = {
"name": product_dict["name"], "name": product_dict["name"],
"description": product_dict["description"], "description": product_dict["description"],
"product_id": product_dict["product_id"], "product_id": product_dict["product_id"],
"pricing": get_pricing(product_dict["price"], product_dict["type"], "pricing": get_pricing(product_dict["price"], product_dict["type"],
product_dict["recurring_period"]), product_dict["recurring_period"])
"minimum_subscription_period":
product_dict["minimum_subscription_period"]
} }
if product_dict["type"] == "recurring":
uf_product["minimum_subscription_period"] = (
product_dict["minimum_subscription_period"]
)
return uf_product