Class: Braspag::Order::PaymentMethodValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/cbraspag/core/order.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



42
43
44
45
46
# File 'lib/cbraspag/core/order.rb', line 42

def validate_each(record, attribute, value)
  if Braspag::PAYMENT_METHOD.key(value).nil?
    record.errors.add attribute, "invalid payment code"
  end
end