Class: SolidusOpenPay::PaymentSource

Inherits:
Spree::PaymentSource
  • Object
show all
Includes:
AttributesAccess
Defined in:
app/models/solidus_open_pay/payment_source.rb

Instance Method Summary collapse

Instance Method Details

#actionsObject



9
10
11
# File 'app/models/solidus_open_pay/payment_source.rb', line 9

def actions
  %w[capture void credit]
end

#can_capture?(payment) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'app/models/solidus_open_pay/payment_source.rb', line 13

def can_capture?(payment)
  payment.pending? || payment.checkout?
end

#can_credit?(payment) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'app/models/solidus_open_pay/payment_source.rb', line 21

def can_credit?(payment)
  payment.completed? && payment.credit_allowed.positive?
end

#can_void?(payment) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'app/models/solidus_open_pay/payment_source.rb', line 17

def can_void?(payment)
  can_capture?(payment)
end