Class: PaymentMethod::DelhiveryCod

Inherits:
PaymentMethod
  • Object
show all
Defined in:
app/models/spree/payment_method/delhivery_cod.rb

Instance Method Summary collapse

Instance Method Details

#actionsObject



27
28
29
# File 'app/models/spree/payment_method/delhivery_cod.rb', line 27

def actions
  %w{authorize capture void purchase}
end

#authorize(*args) ⇒ Object

Satisfies the Spree API and Rails Checkout authorization step



40
41
42
# File 'app/models/spree/payment_method/delhivery_cod.rb', line 40

def authorize(*args)
  ActiveMerchant::Billing::Response.new(true, "Delhivery COD Authorized", {}, {})
end

#auto_capture?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'app/models/spree/payment_method/delhivery_cod.rb', line 23

def auto_capture?
  false
end

#can_capture?(payment) ⇒ Boolean

Returns:

  • (Boolean)


31
32
33
# File 'app/models/spree/payment_method/delhivery_cod.rb', line 31

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

#can_void?(payment) ⇒ Boolean

Returns:

  • (Boolean)


35
36
37
# File 'app/models/spree/payment_method/delhivery_cod.rb', line 35

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

#capture(*args) ⇒ Object



49
50
51
# File 'app/models/spree/payment_method/delhivery_cod.rb', line 49

def capture(*args)
  ActiveMerchant::Billing::Response.new(true, "Delhivery COD Captured", {}, {})
end

#configuration_guide_partial_nameObject



15
16
17
# File 'app/models/spree/payment_method/delhivery_cod.rb', line 15

def configuration_guide_partial_name
  'delhivery_cod'
end

#description_partial_nameObject



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

def description_partial_name
  'delhivery_cod'
end

#method_typeObject



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

def method_type
  'delhivery_cod'
end

#payment_icon_nameObject



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

def payment_icon_name
  'delhivery_cod'
end

#purchase(*args) ⇒ Object

Satisfies checkout engines that try to purchase immediately



45
46
47
# File 'app/models/spree/payment_method/delhivery_cod.rb', line 45

def purchase(*args)
  ActiveMerchant::Billing::Response.new(true, "Delhivery COD Purchased", {}, {})
end

#source_required?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'app/models/spree/payment_method/delhivery_cod.rb', line 19

def source_required?
  false
end

#void(*args) ⇒ Object



53
54
55
# File 'app/models/spree/payment_method/delhivery_cod.rb', line 53

def void(*args)
  ActiveMerchant::Billing::Response.new(true, "Delhivery COD Voided", {}, {})
end