Class: PaymentMethod::Check
Constant Summary
DISPLAY
Instance Method Summary
collapse
active?, available, current, #destroy, find_with_destroyed, #method_type, #payment_profiles_supported?, #payment_source_class, #provider_class, providers, register
Instance Method Details
#actions ⇒ Object
2
3
4
|
# File 'app/models/payment_method/check.rb', line 2
def actions
%w{capture void}
end
|
#can_capture?(payment) ⇒ Boolean
Indicates whether its possible to capture the payment
7
8
9
|
# File 'app/models/payment_method/check.rb', line 7
def can_capture?(payment)
['checkout', 'pending'].include?(payment.state)
end
|
#can_void?(payment) ⇒ Boolean
Indicates whether its possible to void the payment.
12
13
14
|
# File 'app/models/payment_method/check.rb', line 12
def can_void?(payment)
payment.state != 'void'
end
|
#capture(payment) ⇒ Object
16
17
18
19
20
|
# File 'app/models/payment_method/check.rb', line 16
def capture(payment)
payment.update_attribute(:state, 'pending') if payment.state == 'checkout'
payment.complete
true
end
|
#source_required? ⇒ Boolean
28
29
30
|
# File 'app/models/payment_method/check.rb', line 28
def source_required?
false
end
|
#void(payment) ⇒ Object
22
23
24
25
26
|
# File 'app/models/payment_method/check.rb', line 22
def void(payment)
payment.update_attribute(:state, 'pending') if payment.state == 'checkout'
payment.void
true
end
|