Class: Gateway::AcledaMobile

Inherits:
PaymentMethod
  • Object
show all
Defined in:
app/models/spree/gateway/acleda_mobile.rb

Instance Method Summary collapse

Instance Method Details

#auto_capture?Boolean

force to purchase instead of authorize

Returns:

  • (Boolean)


27
28
29
# File 'app/models/spree/gateway/acleda_mobile.rb', line 27

def auto_capture?
  true
end

#available_for_order?(_order) ⇒ Boolean

Custom PaymentMethod/Gateway can redefine this method to check method availability for concrete order.

Returns:

  • (Boolean)


22
23
24
# File 'app/models/spree/gateway/acleda_mobile.rb', line 22

def available_for_order?(_order)
  true
end

#cancel(_response_code) ⇒ Object



38
39
40
41
42
43
44
# File 'app/models/spree/gateway/acleda_mobile.rb', line 38

def cancel(_response_code)
  # we can use this to send request to payment gateway api to cancel the payment ( void )
  # currently Payway does not support to cancel the gateway

  # in our case don't do anything
  ActiveMerchant::Billing::Response.new(true, 'Acleda Mobile order has been cancelled.')
end

#method_typeObject

partial to render the gateway.



8
9
10
# File 'app/models/spree/gateway/acleda_mobile.rb', line 8

def method_type
  'acleda_mobile'
end

#payment_profiles_supported?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'app/models/spree/gateway/acleda_mobile.rb', line 16

def payment_profiles_supported?
  false
end

#payment_source_classObject



12
13
14
# File 'app/models/spree/gateway/acleda_mobile.rb', line 12

def payment_source_class
  Spree::VpagoPaymentSource
end

#process(_money, _source, gateway_options) ⇒ Object



31
32
33
34
35
36
# File 'app/models/spree/gateway/acleda_mobile.rb', line 31

def process(_money, _source, gateway_options)
  Rails.logger.debug { "About to create payment for order #{gateway_options[:order_id]}" }
  # First of all, invalidate all previous tranx orders to prevent multiple paid orders
  # source.save!
  ActiveMerchant::Billing::Response.new(true, 'Order created')
end