Sha256: 0933d0b23dbc86b6b487079fc82b22e1c064f09c58e62bf5d68ad5cbc4fbae33

Contents?: true

Size: 628 Bytes

Versions: 23

Compression:

Stored size: 628 Bytes

Contents

class PaymentMethod::Check < PaymentMethod
  def actions
    %w{capture void}
  end
  
  # Indicates whether its possible to capture the payment
  def can_capture?(payment)
    ['checkout', 'pending'].include?(payment.state)
  end
  
  # Indicates whether its possible to void the payment.
  def can_void?(payment)
    payment.state != 'void'
  end
  
  def capture(payment)
    payment.update_attribute(:state, 'pending') if payment.state == 'checkout'
    payment.complete
    true
  end
  
  def void(payment)
    payment.update_attribute(:state, 'pending') if payment.state == 'checkout'
    payment.void
    true
  end
end

Version data entries

23 entries across 23 versions & 6 rubygems

Version Path
apispree_core-0.0.0 app/models/payment_method/check.rb
My-Commerce_core-1.1.0 app/models/payment_method/check.rb
My-Commerce_core-1.0.0 app/models/payment_method/check.rb
MyCommerceapi-1.0.0 core/app/models/payment_method/check.rb
MyCommerce-0.0.3 core/app/models/payment_method/check.rb
rfcommerce_core-0.0.3 app/models/payment_method/check.rb
spree_core-0.60.5 app/models/payment_method/check.rb
spree_core-0.70.3 app/models/payment_method/check.rb
spree_core-0.70.2 app/models/payment_method/check.rb
spree_core-0.50.4 app/models/payment_method/check.rb
spree_core-0.60.4 app/models/payment_method/check.rb
spree_core-0.50.3 app/models/payment_method/check.rb
spree_core-0.60.3 app/models/payment_method/check.rb
spree_core-0.70.1 app/models/payment_method/check.rb
spree_core-0.70.0 app/models/payment_method/check.rb
spree_core-0.60.2 app/models/payment_method/check.rb
spree_core-0.70.0.rc2 app/models/payment_method/check.rb
spree_core-0.70.RC1 app/models/payment_method/check.rb
spree_core-0.60.1 app/models/payment_method/check.rb
spree_core-0.60.0 app/models/payment_method/check.rb