Class: Spree::PaypalAccount
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Spree::PaypalAccount
- Defined in:
- app/models/spree/paypal_account.rb
Instance Method Summary collapse
- #actions ⇒ Object
- #can_capture?(payment) ⇒ Boolean
- #can_credit?(payment) ⇒ Boolean
- #echeck?(payment) ⇒ Boolean
-
#payment_gateway ⇒ Object
fix for Payment#payment_profiles_supported?.
Instance Method Details
#actions ⇒ Object
5 6 7 |
# File 'app/models/spree/paypal_account.rb', line 5 def actions %w{capture credit} end |
#can_capture?(payment) ⇒ Boolean
9 10 11 |
# File 'app/models/spree/paypal_account.rb', line 9 def can_capture?(payment) !echeck?(payment) && payment.state == "pending" end |
#can_credit?(payment) ⇒ Boolean
13 14 15 16 17 18 |
# File 'app/models/spree/paypal_account.rb', line 13 def can_credit?(payment) return false unless payment.state == "completed" return false unless payment.order.payment_state == "credit_owed" payment.credit_allowed > 0 !payment.payment_method.find_capture(payment).nil? end |
#echeck?(payment) ⇒ Boolean
25 26 27 28 29 30 31 32 33 34 |
# File 'app/models/spree/paypal_account.rb', line 25 def echeck?(payment) logs = payment.log_entries.all(:order => 'created_at DESC') logs.each do |log| details = YAML.load(log.details) # return the transaction details if details.params['payment_type'] == 'echeck' return true end end return false end |
#payment_gateway ⇒ Object
fix for Payment#payment_profiles_supported?
21 22 23 |
# File 'app/models/spree/paypal_account.rb', line 21 def payment_gateway false end |