- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Ability to Add Discounts and Taxes to Transactions #29
Merged
+723
−0
Conversation
This file contains 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
6 tasks
Didn't use this #16 (comment) for recalculating taxes and discounts. Instead, recalculate taxes and discounts from |
This was referenced Feb 23, 2023
risangbaskoro
added a commit
that referenced
this pull request
Feb 23, 2023
* ability to add discount * ability to add taxes and calculate taxes only after discounts applied * --wip-- [skip ci] * --wip-- [skip ci] * --wip-- [skip ci] * --wip-- [skip ci] * --wip-- [skip ci] * --wip-- [skip ci] * --wip-- [skip ci] * --wip-- [skip ci] * Rename parameters in HasTaxes. * --wip-- [skip ci] * --wip-- discount and taxes docs * docs: Discounts and Taxes Documentation * Taxes and Discounts assignment batch addition. * Removes only() method in TaxesDiscountsTest
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.
This PR should close #16.
The ability to assign
discounts
andtaxes
inKasir
object.Discounts
To add a discount, call the
discount()
method and pass the parameters to create a discount, This method will also automatically calculate thegross_amount
.The available parameters for discount are:
amount
:int
required
The amount of the discount, in fixed amount or percentage of thegross_amount
.percentage
:bool
Determines if the amount is in percentage.name
:string
The name of the discount. This will be displayed in the Midtrans Merchant Account Portal.id
:string
The ID of the discount. This will be displayed in the Midtrans Merchant Account Portal.Adding a Discount
Adding Multiple Discounts
To add multiple discounts, chain the
discount()
method:You can also add multiple discounts by using
discounts()
method and passing an array of discounts with each discount parameters as the keys.or pass an anonymous function:
Taxes
Similar to adding discounts, adding taxes is done by calling
tax()
ortaxes()
method and passing the parameters:or using an array of taxes:
or using an anonymous function:
Default Behavior
By default, the
gross_amount
will be calculated from the discounts first, then the taxes. This behavior is to avoid unrealistic tax charges.