close #166 support promotion, tax, adjustments in payouts #167
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.
I. Why?
In previous payout implementations, we disabled payouts when the order had promotions, adjustments, taxes, etc. This PR is intended to support them.
To support all types of adjustments, we need to understand who is running those adjustments to calculate the correct commission and exact money that merchant expect for each of their products. We want to automate the process as much as possible.
Example:
If the item is 50$ with 10% promotion run by the merchant, user will pay 45$. We can safely send that 45$ to the merchant since 45$ is what merchant expect.
If the item is 50$ with 10% promotion run by the store, user will also pay 45$, but the merchant expected 50$. In this case, we can only send 45$ to the merchant and record the remaining $5 as an outstanding balance, which we (the store) will cover. After recorded, we can clear this amount later.
II. Table Design
This is the database designed to support the above use cases & records all financial data.
III. Test with use cases
1.
Use case #1
2.
Use case #2
3.
Use case #3
4.
Use case #4
5.
Use case #5
6.
Use case #6
Related PR (UI for this changes):