Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discount Code to buy trainings (early-birds, organization members, standard users) #1019

Open
jonathanreveille opened this issue Jan 20, 2025 · 0 comments
Labels

Comments

@jonathanreveille
Copy link
Member

jonathanreveille commented Jan 20, 2025

Feature Request

Description

It would be nice to have Discount codes (or Coupon code, or Promo Code) to purchase trainings in Joanie. Not all trainings will be eligible to use a discount code. Those discount will be applied on trainings that are not free.

They can be applied on products with contracts or of type certificate (both have a fee).

Here are some example of discount code that will be available :

  • Members of organizations that produces products (courses) : they will have 50% off the final price.
  • Standard users might be able to get 25% off the final price.
  • early-birds or pre-release that can benefit from a percentage or discount off the price.

Describe the solution you'd like

We need a mechanism where we can set different levels of discounts.

The discount can be applied 2 ways : percentage or as a value.

Create a DiscountCode model with the field ( training (product/course/enrollment), discount_type, discount_value, code_name, issued_on, issued_by, validity_start, validity_end, max_uses, is_active, free_comment, leftover,(maybe a property that calculates it) )

Another model to track who used the Discount Code created: DiscountCodeUsage (discount_code_id , user_id, order_id, used_at, validated_at)

The discount code must be generated beforehand ( Create an admin API to manage this ).

For an order that requires a signature of a contract:

  • The discount code will be acknowledge once the contract is signed by the student, not before (we seem to have some students that don't go sign their contract). We can't wait for the 1st payment, because in some cases the student has 14 days before paying something.
    Thus, some clever students can just say "Waive my right to retraction" and pay before others. This will consume available discount codes.

  • Questions : When should we consider that the coupon is consumed ? When order is created ? When contract is signed by student ? When 1st payment is done ? Will it be only applied to training from Unicamp ? Or will those discount code be used throughout everything that is payable on the platform ?

For orders of product type certificate (do not require a signature of a contract) :

  • The discount code must be passed during the creation of an order, and it must be consumed once the payment is successful (consumed : -1 on max_uses tracking).

Steps of development :

  • Create new enums : discount types (Percentage or Amount)
  • Create model DiscountCode
  • Create model DiscountUsage

  • Create admin API views CRUD to manage DiscountCodeViewset and DiscountUsageViewset
  • Create both serializers DiscountCodeSerializer and DiscountUsageSerializer

  • Update order flows to had the consumption of a discount code on an order....
  • Update order create client API to accept and verify the Discount code if passed.
  • Think of when we can consider a coupon is used depending the different sales tunnel.

Thinking further :

  • Think of when generating the order.payment_schedule that the price should then be product__price * discount_code_percentage or product__price - amount. Make sure that it does not take the initial price, but the discounted price when the discount coupon is used.
@jonathanreveille jonathanreveille changed the title Discout Code for members of organization and generic users Discount Code to buy training for favored users (early-birds, organization members, standard users) Jan 20, 2025
@jonathanreveille jonathanreveille changed the title Discount Code to buy training for favored users (early-birds, organization members, standard users) Discount Code to buy trainings (early-birds, organization members, standard users) Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant