Skip to content
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

[Vouchers] Percentage rate #10821

Merged
merged 17 commits into from
Aug 11, 2023

Commits on Aug 11, 2023

  1. Add specs to cover re calculation

    It is important that the calculated voucher adjustments don't change
    if they are recalculated and it is equally important that they are
    updated if the order has changed
    rioug committed Aug 11, 2023
    Configuration menu
    Copy the full SHA
    1be8daa View commit details
    Browse the repository at this point in the history
  2. Add voucher_type to voucher

    And update related specs
    voucher_type doesn't do anything for now.
    rioug committed Aug 11, 2023
    Configuration menu
    Copy the full SHA
    619285a View commit details
    Browse the repository at this point in the history
  3. Add voucher type to admin screen

    Plus specs
    rioug committed Aug 11, 2023
    Configuration menu
    Copy the full SHA
    cc9069e View commit details
    Browse the repository at this point in the history
  4. Add calculation for percentage voucher

    It include calculation for order with taxes included in the price
    rioug committed Aug 11, 2023
    Configuration menu
    Copy the full SHA
    cdb33aa View commit details
    Browse the repository at this point in the history
  5. Finish calculation for percentage voucher

    Add calculation when tax is not included in price
    rioug committed Aug 11, 2023
    Configuration menu
    Copy the full SHA
    70bd714 View commit details
    Browse the repository at this point in the history
  6. Add system specs for percentage based voucher

    Similar to tax included in price scenario, adds a test for percentage
    based voucher to check the adjustments are recalculated when needed.
    Plus fix tax incluced in price specs to use new factory
    rioug committed Aug 11, 2023
    Configuration menu
    Copy the full SHA
    959e230 View commit details
    Browse the repository at this point in the history
  7. Refactor voucher: 1 base voucher class

    Refactor voucher to use a single table inheritance. It will simplify the
    code and remove a bunch of conditional
    rioug committed Aug 11, 2023
    Configuration menu
    Copy the full SHA
    204f393 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    def594a View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    46e04ca View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    29a3846 View commit details
    Browse the repository at this point in the history
  11. Refactor VoucherAdjustment service

    We are taking advantage of having a FlatRate and a PercentageRate
    model to simplify the code a little
    rioug committed Aug 11, 2023
    Configuration menu
    Copy the full SHA
    2828bd0 View commit details
    Browse the repository at this point in the history
  12. Remove left over comment

    rioug committed Aug 11, 2023
    Configuration menu
    Copy the full SHA
    e8b374d View commit details
    Browse the repository at this point in the history
  13. Fix Rubocop warning

    rioug committed Aug 11, 2023
    Configuration menu
    Copy the full SHA
    3f63cfb View commit details
    Browse the repository at this point in the history
  14. Per review , Simplify creation of Voucher

    We now check against known type to instanciate the correct voucher
    instead of using a case
    rioug committed Aug 11, 2023
    Configuration menu
    Copy the full SHA
    e6b53c0 View commit details
    Browse the repository at this point in the history
  15. Use a better describe

    Co-authored-by: David Cook <david@redcliffs.net>
    rioug and dacook committed Aug 11, 2023
    Configuration menu
    Copy the full SHA
    054eac0 View commit details
    Browse the repository at this point in the history
  16. Per review, clean up voucher specs

    Add explicit 'order.item_total' to make specs more readable
    rioug committed Aug 11, 2023
    Configuration menu
    Copy the full SHA
    9c9a623 View commit details
    Browse the repository at this point in the history
  17. Add a comment around the use of safe_constantize

    It triggers a Brakeman error that can be safely ignored
    rioug committed Aug 11, 2023
    Configuration menu
    Copy the full SHA
    a2def24 View commit details
    Browse the repository at this point in the history