Add get_user_friendly_product
This commit is contained in:
parent
665c327fc5
commit
9ed0fdf468
1 changed files with 12 additions and 0 deletions
|
@ -62,6 +62,18 @@ def get_pricing(price_in_chf_cents, product_type, recurring_period):
|
|||
elif product_type == "one-time":
|
||||
return "CHF {}".format(price_in_chf_cents/100)
|
||||
|
||||
def get_user_friendly_product(product_dict):
|
||||
return {
|
||||
"name": product_dict["name"],
|
||||
"description": product_dict["description"],
|
||||
"product_id": product_dict["product_id"],
|
||||
"pricing": get_pricing(product_dict["price"], product_dict["type"],
|
||||
product_dict["recurring_period"]),
|
||||
"minimum_subscription_period":
|
||||
product_dict["minimum_subscription_period"]
|
||||
}
|
||||
|
||||
|
||||
|
||||
class ListProducts(Resource):
|
||||
@staticmethod
|
||||
|
|
Loading…
Reference in a new issue