Class: Gateway::WingSdk

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

Instance Method Summary collapse

Instance Method Details

#auto_capture?Boolean

force to purchase instead of authorize

Returns:

  • (Boolean)


32
33
34
# File 'app/models/spree/gateway/wing_sdk.rb', line 32

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)


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

def available_for_order?(_order)
  true
end

#basic_auth_usernameObject

for basic authentication on checking transaction on vtenh



14
# File 'app/models/spree/gateway/wing_sdk.rb', line 14

preference :basic_auth_username, :string

#cancel(_response_code) ⇒ Object



43
44
45
46
47
48
49
# File 'app/models/spree/gateway/wing_sdk.rb', line 43

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, 'Wing Sdk order has been cancelled.')
end

#payment_profiles_supported?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'app/models/spree/gateway/wing_sdk.rb', line 21

def payment_profiles_supported?
  false
end

#payment_source_classObject



17
18
19
# File 'app/models/spree/gateway/wing_sdk.rb', line 17

def payment_source_class
  Spree::VpagoPaymentSource
end

#process(_money, _source, gateway_options) ⇒ Object



36
37
38
39
40
41
# File 'app/models/spree/gateway/wing_sdk.rb', line 36

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