Class: ActiveMerchant::Billing::NexioApmGateway
- Inherits:
-
NexioBaseGateway
- Object
- Gateway
- NexioBaseGateway
- ActiveMerchant::Billing::NexioApmGateway
- Defined in:
- lib/active_merchant/billing/gateways/nexio_apm_gateway.rb
Defined Under Namespace
Classes: OneTimeToken
Instance Method Summary collapse
- #authorize(money, payment, options = {}) ⇒ Object
- #generate_token(money, options = {}) ⇒ Object
- #purchase(money, payment, options = {}) ⇒ Object
Methods inherited from NexioBaseGateway
#capture, #get_transaction, #initialize, #refund, #scrub, #set_secret, #setup_webhooks, #supports_scrubbing?, #void
Constructor Details
This class inherits a constructor from ActiveMerchant::Billing::NexioBaseGateway
Instance Method Details
#authorize(money, payment, options = {}) ⇒ Object
43 44 45 |
# File 'lib/active_merchant/billing/gateways/nexio_apm_gateway.rb', line 43 def (money, payment, = {}) purchase(money, payment, .merge(is_auth_only: true)) end |
#generate_token(money, options = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/active_merchant/billing/gateways/nexio_apm_gateway.rb', line 14 def generate_token(money, = {}) post = build_payload() add_invoice(post, money, ) post[:data][:paymentMethod] = [:payment_method] if [:payment_method].present? add_order_data(post, ) post[:customerRedirectUrl] = [:callback_url] if [:callback_url].present? post[:processingOptions][:saveRecurringToken] = true if [:save_token] post[:isAuthOnly] = true if [:is_auth_only] resp = commit('token', post) return unless resp.success? OneTimeToken.new( resp.params['token'], resp.params['expressIFrameUrl'], resp.params['scriptUrl'], map_urls(resp.params['redirectUrls']), map_urls(resp.params['buttonIFrameUrls']) ) end |
#purchase(money, payment, options = {}) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/active_merchant/billing/gateways/nexio_apm_gateway.rb', line 34 def purchase(money, payment, = {}) post = build_payload() add_invoice(post, money, ) post[:apm] = { token: payment.is_a?(Spree::PaymentSource) ? payment.gateway_payment_profile_id : payment } add_order_data(post, ) post[:isAuthOnly] = true if [:is_auth_only] commit('process', post) end |