-
Notifications
You must be signed in to change notification settings - Fork 2
Development #1064
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
Open
jonathanreveille
wants to merge
49
commits into
main
Choose a base branch
from
development
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Development #1064
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f11050f
to
481e664
Compare
Added discount relation to order group that allows a buyer to create an order and benefit from a discount amount or a discount rate on the total price.
We added the discount field into the admin OrderGroup serializers which allows admin user to add a discount to an existing order group. We can only add an existing discount to the group.
Created a viewset to create and list discounts only. This will allow admin user to create the discount that can be added in relation to an order group. We have made on purpose on the admin api that it is not possible to update or delete a discount. If you want to do such action, you may use the django admin backoffice to handle them.
Since we made it manageable to add discount through the admin api, we should now show the information on the client serializer for the order group details when a discount is present.
To ease the life of our admin users, we added into the order group view the possibility to add a discount, or to take it away. We also added the counter on the discount view to give us the information on how many times the discount is used through the order groups. Finally, we updated the view of the column where it displays the value of the discount to make it more human-readable.
We want the backend to assign order groups to an order.
We want to allow users to use a voucher code to get dicounts on orders.
In order to manage ordergroups discount in the frontend, their ids are replacedl by actual object.
As we want to avoid discount duplicates in the select box, rate and amount are now unique.
As we want to allow users to manage discounts through order groups, they have been added to the existing order group form.
Now that we can have order groups without seat limitation, we mast allow an empty string in the payload, like the frontend actually sends.
Just a convenient script alias, and some uniformization.
In front, we have a search feature on the discount select. The API needed to support list query.
A currency were hard coded while developping the discount model.
New ordering rule was added to the OrderGroup model through the `position` field. A little adjust was required for a flaky test that would still based itself on the previous ordering logic.
We want a person from a company to be able to place a batch order for their employees to follow a session. We created this model to track down the session they want to follow, we prepare the estimated total, and the contract.
To facilitate the transition and actions between different steps of the batch order lifecycle, we have decided to add states.
Added new endpoints to submit for signature the contract of a batch order and to submit for payment the batch order. Some adjustments were made into the the signature backend and the payment backend.
To facilitate the evolution to generate different context for contracts, we have decided to refactor the main method into chunks that prepare each sections.
To improve our developers experience, we added a debug view to preview the mail sent when a batch order payment has succeeded.
When the batch order is completed and the orders are generated with voucher codes, the user can use one of the voucher and assign himself to an order in state `to_own`. As a reminder, the batch order generates orders in `to_own` state with a discount rate of 1. The user will only need to insert his voucher code to get access to the course, he won't have to pay because it has been paid through the batch order. The voucher code is only linked to one order in state `to_own`.
Now that we can have order groups with optional limitations, we must allow empty strings in the payload, like the frontend actually sends.
Locale used by mui for date formating was wrong.
As we want to allow users to manage order group start and end dates, they have been added to the existing order group form.
We need to handle the case when a batch order gets canceled. If the batch order was in state `completed`, we need to cancel each generated order in state `to_own` and delete the vouchers associated to them to make sure that they will not be used. Also, if the orders that were in `to_own` state are taken by their rightful owners with the voucher codes, we make sure to unenroll them from the course runs. Otherwise, if the batch order was not yet in `completed` state, which means that no voucher nor orders were generated, we can just mark the batch order as canceled. Fix #1083
The batch order admin viewset allows to create, read, list and cancel a batch order. It does not allow to update the resource.
When running tests locally, if COURSE_WEB_HOOKS is defined, the synchronization is triggered when running tests, slowing them drastically.
We want our orders that are already paid that were generated by a batch order to be accounted as seats taken on an order group if one has been setted on the batch order at their creation. The property available_seats on the order group did not count the orders in state `to_own`, we have changed this behavior to take them in account with the binding states orders. This allows us to keep track of orders that are related to the order group, thus knowing exactly how many seats left are remaining.
Added a new template mjml to use for email that are sent through the django admin of batch orders to invite the batch order owner to sign the contract.
To ease the life of our developers, we have created a debug view to see the render of the email sent to user when it is initiated from the django admin batch order app.
We will need to trigger manually some methods on the batch order from the backoffice. In the meantime, those methods will be used in the django admin to handle a batch order. Those methods regroup assignation of an organization, submitting to signature the contract, validating a successful payment, and send the email with vouchers.
Batch order django admin app allows to create, edit a batch order. We made it more user-friendly by allowing to enter a voucher code in create mode instead of putting the pk. Also to avoid admin user to fill the field input with a JSON list of firstname and lastname, we changed the format to only input : "firstname lastname" per line. We have also added the action to cancel a batch order.
We want admin users to be able to submit to signature the contract, validate a success payment and generate orders and send a mail with the vouchers. All those actions are implemented on the change form of a batch order.
When the batch order payment is successful, admin user should be able to validate the payment once it has been received. This new endpoint ensures that the batch order is in the state `signing` or `pending` before validating the payment. It creates a child invoice of the main invoice and the transaction. Finally, it transitions the batch order flow to `completed`.
Once the batch order is in state `completed`, we allow the admin user to generate the orders if they were not yet generated before. If the state of the batch order is not in completed state, we don't allow to generate the orders. If the orders were already generated, we also block the admin user of this action. When all the orders are generated, we send the voucher codes by email to the batch order owner. The generation of orders and the email are done with a celery task.
We allow admin user to submit for signature the contract of a batch order. It sends an email with the invitation signature link to the batch order owner.
After a rebase, as tests have been split, we need to rework them a bit.
As we want to add a custom text related to a discount, a description is added to the order group model.
Adds CourseProductRelationAdmin to django admin for debugging purpose.
When an order group is updated, related course product relation cache must be invalidated.
When available, a discounted price must be computed for course product relation. It is needed for frontend display.
As we want to allow users to manage order group descriptions, it has been added to the existing order group form.
As we want the payment schedules to take discounts into account, the discounted price computation has been moved to the model.
Order group is an internal model, and should not be exposed to client. Its purpose is to administrate discounts and seats limits.
Setup circle ci to store front e2e tests results as artifacts.
We use babel get_currency_sybol with DEFAULT_CURRENCY settings in several places. Using a dedicated function simplifies this.
As a discount is always removing value, a negative sign is more explicit.
Adding `discount` to the order serializer allows administrators to view the discount applied to an order. Using `get_default_currency_symbol` ensures consistent formatting across the application.
Adding `total` and `discount` columns allows administrators to view the total price and discount applied to orders directly from the table. Accompanying tests ensure the new columns render correctly.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
Development branch for order groups