Add minimum_subscription_duration to recurring products

This commit is contained in:
PCoder 2019-09-19 10:54:11 +05:30
parent 5e4b105b97
commit b93aefa607

View file

@ -85,7 +85,8 @@ class ListProducts(Resource):
"product_id": product_id,
"pricing": get_pricing(p_json["price"], p_json["type"],
p_json["recurring_duration"]),
"minumum_subscription_duration": "1 month"
"minimum_subscription_duration":
p_json["minumum_subscription_duration"]
}
prod_dict[product_id] = actual_product
logging.debug("Products = {}".format(prod_dict))
@ -119,7 +120,10 @@ class AddProduct(Resource):
"price": data["product_price"],
"recurring_duration": data["product_recurring_duration"],
"recurring_duration_units":
data["product_recurring_duration_units"]
data["product_recurring_duration_units"],
"minimum_subscription_duration":
data["product_minimum_subscription_duration"] if
data["product_type"] == "recurring" else 0
}
logging.debug("Adding product data: {}".format(str(product_value)))
client.put(product_key, product_value, value_in_json=True)