Class: Spree::PaymentMethod::Check

Inherits:
Spree::PaymentMethod show all
Defined in:
app/models/spree/payment_method/check.rb

Constant Summary

Constants included from DisplayOn

DisplayOn::DISPLAY

Instance Method Summary collapse

Methods inherited from Spree::PaymentMethod

#auto_capture?, #available_for_order?, #available_for_store?, #complete_payment_session, #complete_payment_setup_session, #confirmation_required?, #create_payment_session, #create_payment_setup_session, #default_name, find_with_destroyed, #method_type, #parse_webhook_event, #payment_icon_name, #payment_profiles_supported?, #payment_session_class, #payment_setup_session_class, #payment_source_class, #provider_class, providers, #public_preferences, #reusable_sources, #session_required?, #setup_session_supported?, #show_in_admin?, #store_credit?, #supports?, #update_payment_session, #webhook_url

Methods included from Metadata

#metadata, #metadata=, #public_metadata=

Instance Method Details

#actionsObject



3
4
5
# File 'app/models/spree/payment_method/check.rb', line 3

def actions
  %w{capture void}
end

#authorizeObject



7
8
9
# File 'app/models/spree/payment_method/check.rb', line 7

def authorize(*)
  simulated_successful_billing_response
end

#can_capture?(payment) ⇒ Boolean

Indicates whether its possible to capture the payment

Returns:



16
17
18
# File 'app/models/spree/payment_method/check.rb', line 16

def can_capture?(payment)
  ['checkout', 'pending'].include?(payment.state)
end

#can_void?(payment) ⇒ Boolean

Indicates whether its possible to void the payment.

Returns:



21
22
23
# File 'app/models/spree/payment_method/check.rb', line 21

def can_void?(payment)
  payment.state != 'void'
end

#cancelObject



29
30
31
# File 'app/models/spree/payment_method/check.rb', line 29

def cancel(*)
  simulated_successful_billing_response
end

#captureObject



25
26
27
# File 'app/models/spree/payment_method/check.rb', line 25

def capture(*)
  simulated_successful_billing_response
end

#creditObject



41
42
43
# File 'app/models/spree/payment_method/check.rb', line 41

def credit(*)
  simulated_successful_billing_response
end

#purchaseObject



11
12
13
# File 'app/models/spree/payment_method/check.rb', line 11

def purchase(*)
  simulated_successful_billing_response
end

#source_required?Boolean

Returns:



37
38
39
# File 'app/models/spree/payment_method/check.rb', line 37

def source_required?
  false
end

#voidObject



33
34
35
# File 'app/models/spree/payment_method/check.rb', line 33

def void(*)
  simulated_successful_billing_response
end