-
Notifications
You must be signed in to change notification settings - Fork 55
Add coupon and refund ratio parameters to order generator #182
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
Merged
Merged
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
161c802
Add --coupon-ratio parameter to order generator
layoutd df0fda0
Add --refund-ratio parameter to order generator
layoutd 4d3eb9d
Improve refund logic to properly handle line items and fees
layoutd 4dd4a96
Fix refund tax calculation to properly handle tax rate IDs
layoutd 84a81bc
Calculate explicit refund amount from line items
layoutd 368e5b7
Fix refund ratio logic and add multiple refund support
layoutd 479a1a8
Update partial refund reason to show products and items
layoutd 4f98a67
Force partial refunds for orders with existing refunds
layoutd a3e1536
Recalculate order totals after applying coupon
layoutd 74ae8e1
Update includes/Generator/Order.php
layoutd e2494ec
Doc update
layoutd ff277e2
Fix array_rand edge case for orders with exactly 2 items
layoutd f80b01e
Refactor coupon creation to use Coupon::generate()
layoutd ee9ff32
Move coupon retrieval logic to Coupon::get_random()
layoutd 07daacb
Use WordPress get_posts() API instead of raw SQL queries
layoutd 57daab8
Add discount_type parameter to Coupon generator
layoutd 24b2493
Refactor Order generator to use Coupon::batch()
layoutd f8d718c
Add discount_type parameter to CLI coupon command
layoutd 080ee99
Update README with new coupon and order parameters
layoutd b9c85f9
Clarify that refunds are split evenly between partial and full
layoutd 86a499c
Fix backwards compatibility: only set discount_type when explicitly p…
layoutd 2c9940e
Add input validation for coupon-ratio and refund-ratio parameters
layoutd 5b53925
Add performance comment for get_posts() in Coupon::get_random()
layoutd 0816747
Clarify that --coupons flag is equivalent to --coupon-ratio=1.0
layoutd 0f5dd77
Fix ratio probability calculation using integer-based random generation
layoutd f69d126
Add check to prevent refunds with empty line items
layoutd 73cdb1b
Improve refund error handling and logging
layoutd ae9b6a6
Add validation to prevent refunds with invalid amounts
layoutd ac5f820
Fix refund amount validation to prevent exceeding order total
layoutd 0b3faa5
Fix refund amount calculations to prevent rounding errors and ensure …
layoutd 9894e7e
Fix partial refunds to track already-refunded quantities and prevent …
layoutd c6d22b4
Fix code quality issues in refund calculations
layoutd 323a1a7
Add realistic date handling for refunds
layoutd 5734f42
Refactor refund generation: extract constants and helper methods
layoutd f08714c
Make default 'fixed_cart' Coupon generator explicit
layoutd 20f415b
Clarify memory impact
layoutd 553d847
Clarify that decimal ratios for coupons and refunds are converted to …
layoutd e17884b
Add error logging for order generation and coupon application failures
layoutd 810e614
Fix indentation
layoutd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.