Skip to content

Commit

Permalink
Fix: greater_than usage (#2909)
Browse files Browse the repository at this point in the history
## Context

Credit Note Item model allows amount_cents to be 0; Because of
roundings, applied_coupon.amount_cents can also be 0
  • Loading branch information
annvelents authored Dec 6, 2024
1 parent 582ff83 commit 41cdc73
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/applied_coupon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class AppliedCoupon < ApplicationRecord

monetize :amount_cents, disable_validation: true, allow_nil: true

validates :amount_cents, numericality: {greater_than: 0}, allow_nil: true
validates :amount_cents, numericality: {greater_than_or_equal_to: 0}, allow_nil: true
validates :amount_currency, inclusion: {in: currency_list}, allow_nil: true

def mark_as_terminated!(timestamp = Time.zone.now)
Expand Down

0 comments on commit 41cdc73

Please sign in to comment.