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