Class: ActiveMerchant::Billing::NexioGateway
Defined Under Namespace
Classes: OneTimeToken
Instance Method Summary
collapse
#capture, #get_transaction, #initialize, #refund, #scrub, #set_secret, #setup_webhooks, #supports_scrubbing?, #void
Instance Method Details
#authorize(money, source, options = {}) ⇒ Object
35
36
37
|
# File 'lib/active_merchant/billing/gateways/nexio_gateway.rb', line 35
def authorize(money, source, options = {})
purchase(money, source, options.merge(payload: options.fetch(:payload, {}).merge(isAuthOnly: true)))
end
|
#generate_token(options = {}) ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/active_merchant/billing/gateways/nexio_gateway.rb', line 14
def generate_token(options = {})
post = build_payload(options)
post[:data][:allowedCardTypes] = %w[amex discover jcb mastercard visa]
add_currency(post, options)
add_order_data(post, options)
add_card_data(post, options)
resp = commit('token', post)
return unless resp.success?
token, expiration, fraud_url = resp.params.values_at('token', 'expiration', 'fraudUrl')
OneTimeToken.new(token, Time.parse(expiration), fraud_url)
end
|
#purchase(money, source, options = {}) ⇒ Object
27
28
29
30
31
32
33
|
# File 'lib/active_merchant/billing/gateways/nexio_gateway.rb', line 27
def purchase(money, source, options = {})
post = build_payload(options)
add_invoice(post, money, options)
add_payment(post, source, options)
add_order_data(post, options)
commit('process', post)
end
|
#store(source, options = {}) ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/active_merchant/billing/gateways/nexio_gateway.rb', line 46
def store(source, options = {})
post = build_payload(options)
post[:merchantId] ||= options[:merchant_id]
add_card_details(post, source, options)
add_currency(post, options)
add_order_data(post, options)
resp = commit('saveCard', post)
return unless resp.success?
resp.params.fetch('token', {}).fetch('token', nil)
end
|
#verify(credit_card, options = {}) ⇒ Object
39
40
41
42
43
44
|
# File 'lib/active_merchant/billing/gateways/nexio_gateway.rb', line 39
def verify(credit_card, options = {})
MultiResponse.run(:use_first_response) do |r|
r.process { authorize(100, credit_card, options) }
r.process(:ignore_result) { void(r.authorization, options) }
end
end
|