Class: ActiveMerchant::Billing::NexioBaseGateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::NexioBaseGateway
show all
- Defined in:
- lib/active_merchant/billing/gateways/nexio_base_gateway.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of NexioBaseGateway.
21
22
23
24
|
# File 'lib/active_merchant/billing/gateways/nexio_base_gateway.rb', line 21
def initialize(options = {})
requires!(options, :merchant_id, :auth_token)
super
end
|
Instance Method Details
#capture(money, authorization, _options = {}) ⇒ Object
26
27
28
|
# File 'lib/active_merchant/billing/gateways/nexio_base_gateway.rb', line 26
def capture(money, authorization, _options = {})
commit('capture', { id: authorization, data: { amount: amount(money).to_f } })
end
|
#get_transaction(id) ⇒ Object
69
70
71
72
73
74
|
# File 'lib/active_merchant/billing/gateways/nexio_base_gateway.rb', line 69
def get_transaction(id)
data = parse(ssl_get(action_url("/transaction/v3/paymentId/#{id}"), ))
::NexioActivemerchant::Transaction.new(data)
rescue ResponseError
nil
end
|
#refund(money, authorization, _options = {}) ⇒ Object
Also known as:
credit
30
31
32
|
# File 'lib/active_merchant/billing/gateways/nexio_base_gateway.rb', line 30
def refund(money, authorization, _options = {})
commit('refund', { id: authorization, data: { amount: amount(money).to_f } })
end
|
#scrub(transcript) ⇒ Object
43
44
45
|
# File 'lib/active_merchant/billing/gateways/nexio_base_gateway.rb', line 43
def scrub(transcript)
transcript
end
|
#set_secret ⇒ Object
65
66
67
|
# File 'lib/active_merchant/billing/gateways/nexio_base_gateway.rb', line 65
def set_secret
commit('secret', { merchantId: options[:merchant_id].to_s }).params['secret']
end
|
#setup_webhooks(data) ⇒ Object
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/active_merchant/billing/gateways/nexio_base_gateway.rb', line 47
def setup_webhooks(data)
post = { merchantId: options[:merchant_id].to_s }
if data.is_a?(String)
post[:webhooks] = {
TRANSACTION_AUTHORIZED: { url: data },
TRANSACTION_CAPTURED: { url: data },
TRANSACTION_SETTLED: { url: data }
}
else
webhooks = {}
webhooks[:TRANSACTION_AUTHORIZED] = { url: data[:authorized] } if data.key?(:authorized)
webhooks[:TRANSACTION_CAPTURED] = { url: data[:captured] } if data.key?(:captured)
webhooks[:TRANSACTION_SETTLED] = { url: data[:settled] } if data.key?(:settled)
post[:webhooks] = webhooks
end
commit('webhook', post)
end
|
#supports_scrubbing? ⇒ Boolean
39
40
41
|
# File 'lib/active_merchant/billing/gateways/nexio_base_gateway.rb', line 39
def supports_scrubbing?
false
end
|
#void(authorization, _options = {}) ⇒ Object
35
36
37
|
# File 'lib/active_merchant/billing/gateways/nexio_base_gateway.rb', line 35
def void(authorization, _options = {})
commit('void', { id: authorization })
end
|