Class: Spree::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
Instance Method Details
#actions ⇒ Object
3
4
5
|
# File 'app/models/spree/payment_method/check.rb', line 3
def actions
%w{capture void}
end
|
#can_capture?(payment) ⇒ Boolean
Indicates whether its possible to capture the payment
8
9
10
|
# File 'app/models/spree/payment_method/check.rb', line 8
def can_capture?(payment)
['checkout', 'pending'].include?(payment.state)
end
|
#can_void?(payment) ⇒ Boolean
Indicates whether its possible to void the payment.
13
14
15
|
# File 'app/models/spree/payment_method/check.rb', line 13
def can_void?(payment)
payment.state != 'void'
end
|
#capture(payment) ⇒ Object
17
18
19
20
21
|
# File 'app/models/spree/payment_method/check.rb', line 17
def capture(payment)
payment.update_attribute(:state, 'pending') if payment.state == 'checkout'
payment.complete
true
end
|
#source_required? ⇒ Boolean
29
30
31
|
# File 'app/models/spree/payment_method/check.rb', line 29
def source_required?
false
end
|
#void(payment) ⇒ Object
23
24
25
26
27
|
# File 'app/models/spree/payment_method/check.rb', line 23
def void(payment)
payment.update_attribute(:state, 'pending') if payment.state == 'checkout'
payment.void
true
end
|