Pn 84 apply discount on total instead of subtotal - #353
Open
MostafaKadry wants to merge 54 commits into
Open
Conversation
Implemented functionality to check if an item qualifies for active promotions based on quantity, affecting discount editing capabilities. Updated UI to reflect promotional offer statuses and adjusted related computed properties for better user experience. Enhanced backend API to support promotional checks for items.
- Introduced new fields for coupon management: apply_scope, applicable_brand, applicable_item_group, and excluded_brands. - Updated coupon validation to compute line-level discounts based on eligible items. - Enhanced the UI components for coupon application, allowing users to specify scope and exclusions. - Improved the logic for applying discounts to ensure compliance with new coupon rules. - Added functionality to revalidate applied coupons based on cart changes, ensuring accurate discount application.
…support - Introduced a new resource for calculating coupon discounts with item-level exclusions. - Updated CouponDialog to build invoice payloads for coupon validation. - Enhanced CouponManagement to include an option for excluding already discounted items. - Modified applyCoupon logic to handle new discount calculations and validations. - Added item-level discount flags and logic to ensure proper discount application in the cart. - Updated API endpoints to support new promotion types and constraints. - Enhanced test coverage for coupon and promotion functionalities, ensuring correct behavior with item-level discounts.
…iscount_support' into staging
…iscount_support' into staging
…al schemes - Introduced a new validation function to prevent duplicate promotion types for the same item across active promotional schemes. - Updated the validation logic in the Promotional Scheme to include the new check, enhancing the integrity of promotional configurations.
- Refactored coupon validation logic to utilize a new API call for reliable response parsing. - Introduced a Promotion Interaction Matrix to determine item eligibility for promotions based on various states. - Updated the coupon handling logic to exclude already discounted items and apply brand exclusions effectively. - Enhanced test coverage for coupon eligibility and interaction scenarios, ensuring accurate discount application.
Pn 79 accumulative discount
- Introduced GWP (Gift With Purchase) promotion type, allowing free items based on purchase quantities. - Updated invoice and cart logic to calculate GWP discounts accurately, ensuring correct display of free item quantities. - Enhanced promotional scheme management to include GWP-specific fields and validation. - Refactored discount calculation methods to accommodate GWP logic, ensuring seamless integration with existing discount structures. - Improved test coverage for GWP scenarios, validating correct application of promotions across various conditions.
- Introduced a dedicated method to check for GWP promotions, improving code readability and maintainability. - Updated validation and cleanup methods to utilize the new GWP check, ensuring accurate handling of promotional conditions. - Enhanced logic to correctly manage same item conditions for GWP promotions, aligning with the overall discount structure.
- Introduced functions to identify and clear offer discounts from cart items, improving the handling of promotional discounts. - Updated the logic to ensure that discounts are accurately applied or removed based on server responses and item conditions. - Refactored existing discount handling to streamline the process of clearing discounts when offers are invalidated.
…ment and validation
feat: implement accumulative discount mode with automated slab management and validation
test: add regression test suite for promotion precedence and scoping
…Checking how other files in the project import it.
- Refactored the loading of CSS and JS assets for the Nexus demo to utilize template variables, improving flexibility and maintainability. - Removed hardcoded asset paths in favor of conditional checks for asset availability.
- Added validation to ensure a customer and company are selected before applying a coupon, improving user experience and preventing errors. - Updated the coupon application logic to utilize the new company prop across relevant components, ensuring consistent data handling. - Enhanced API methods to require customer and company parameters, returning appropriate error messages when they are missing.
- Introduced a new utility function, unwrapCouponValidation, to normalize API responses from the coupon validation process, ensuring accurate interpretation of success and error messages. - Updated the CouponDialog and posCart store to utilize the new validation function, enhancing the reliability of coupon application feedback.
- Updated the logic in sync_promotion_fields_to_pricing_rules to differentiate between GWP and non-GWP product discounts. - Ensured that GWP rules maintain a same_item value of 1, while allowing non-GWP discounts to retain their configured same_item/free_item values.
…lidation - Updated cart hash generation, snapshot building, and offer eligibility checks to filter out free items, ensuring that only paid items are considered in calculations. - Enhanced logic to prevent free gifts from affecting minimum and maximum quantity checks, improving the reliability of promotional offer processing.
- Changed the GWP paid quantity basis labels from "Min Qty" and "Max Qty" to "Min Price" and "Max Price" for clarity and consistency. - Updated related logic in the POS cart store and various API files to reflect the new basis options. - Added normalization function for legacy basis labels to ensure backward compatibility. - Enhanced test coverage for the new basis options and their handling in promotions.
- Introduced a computed property to merge free items into a single line for better clarity in the invoice cart. - Updated item display logic to show combined quantities of free items and adjusted related badge texts accordingly. - Refactored quantity handling to ensure accurate updates for both paid and free items, improving user experience during item interactions.
…sing - Enhanced the display logic in the invoice cart to differentiate between free and paid items, improving user clarity. - Updated the cart calculations to ensure free items do not interfere with offer validations and discounts. - Introduced new utility functions for flooring free item quantities, ensuring accurate handling of free items in promotions. - Refactored related API logic to maintain consistency in free item processing across the application.
…ce handling - Added support for Magento loyalty program in customer creation, requiring first and last names when loyalty is enabled. - Enhanced invoice submission to handle loyalty points redemption and added transaction tracking for loyalty points. - Updated customer wallet balance retrieval to include loyalty points when applicable. - Introduced new fields in the sales invoice for tracking loyalty transactions and points added. - Refactored related API methods to ensure compatibility with the new loyalty features.
- Introduced a computed property to determine if the customer name is valid based on Magento loyalty program settings. - Added a new computed property, canSubmitCustomer, to centralize the logic for enabling the customer submission button based on name, phone number, and permission checks. - Updated the button's disabled state to utilize the new validation logic, improving user experience during customer creation.
…t coverage - Modified customer creation to defer Magento sync until after the primary contact is created, ensuring proper validation. - Introduced a flag to control publishing to Magento based on the new logic. - Enhanced unit tests to include email ID and verify customer document save operations, improving test coverage and reliability.
…eme-valid-up-to-time feat: implement time-based schedule gating for pricing rules and promotional schemes
…ion with integrated date and time ranges
…eme-valid-up-to-time Pn 80 jor cr promotion scheme valid up to time
…eme-valid-up-to-time feat: update Pricing Rule configuration fields
…eme-valid-up-to-time feat: add patch to resolve Custom Field duplication issues
… POS promotional and pricing doctypes
…eme-valid-up-to-time [PN 80] Standardize custom field configurations and metadata for POS
…justments to discount calculations and item handling
…t for Magento sync
…andling during sales invoice processing
… updating validation and settings handling
…S, enhancing validation and invoice processing
…ring customer data is applied to each item row
…calculations and ensuring accurate item display for bundled promotions
…unts by syncing pricing items before evaluation
MostafaKadry
force-pushed
the
PN-84-apply-discount-on-total-instead-of-subtotal
branch
from
August 5, 2026 15:38
a9d89a5 to
4b2797f
Compare
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
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.
No description provided.