Class: PaymentHandler

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/payment_handler.rb

Constant Summary collapse

SUCCESSFUL_PAYPAL_STATES =
%w[instant echeck completed processed pending]

Instance Method Summary collapse

Instance Method Details

#accept?Boolean

younker [2011-04-16 12:00] We want to create the entry even if it does not pass validation, otherwise we will not insert this into the db. That is why I removed this and created accept? validate do

errors.add(:base, "Secret does not match") unless secrets_match?
errors.add(:base, "Transaction state was invalid") unless valid_state?
errors.add(:base, "Receiver email does not match our paypal email") unless emails_match?

end

Returns:

  • (Boolean)


32
33
34
35
36
37
# File 'app/models/payment_handler.rb', line 32

def accept?
  errors.add(:base, " Secret does not match") unless secrets_match?
  errors.add(:base, " Transaction state was invalid") unless valid_state?
  errors.add(:base, " Receiver email does not match our paypal email") unless emails_match?
  self.errors.empty?
end