Sha256: 5db5e81d58af6f4bf0f39fe1e4ecbf16050cd1e995fb4b07e315e3ffdfa30eab
Contents?: true
Size: 729 Bytes
Versions: 10
Compression:
Stored size: 729 Bytes
Contents
module Spree 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 def source_required? false end end end
Version data entries
10 entries across 10 versions & 1 rubygems