Module: ActiveMerchant::Billing::FlowGatewayFixes
- Defined in:
- lib/active_merchant/billing/flow_gateway.rb
Constant Summary collapse
- FORM_TYPES =
[ :authorization_copy_form, :direct_authorization_form, :merchant_of_record_authorization_form, :paypal_authorization_form, :redirect_authorization_form, :inline_authorization_form, :card_authorization_form, :ach_authorization_form ]
Instance Method Summary collapse
-
#authorize(cc_or_token, order_number, opts = {}) ⇒ Object
Create a new authorization.
- #purchase(credit_card, order_number, options = {}) ⇒ Object
Instance Method Details
#authorize(cc_or_token, order_number, opts = {}) ⇒ Object
Create a new authorization. docs.flow.io/module/payment/resource/authorizations#post-organization-authorizations
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/active_merchant/billing/flow_gateway.rb', line 17 def (cc_or_token, order_number, opts = {}) unless opts[:currency] return error_response('Currency is a required option') end unless opts[:discriminator] return error_response 'Discriminator is not defined, please choose one [%s]' % FORM_TYPES.join(', ') end unless FORM_TYPES.include?(opts[:discriminator].to_sym) return error_response 'Discriminator [%s] not found, please choose one [%s]' % [opts[:discriminator], FORM_TYPES.join(', ')] end body = { amount: opts[:amount] || 0.0, currency: opts[:currency], discriminator: opts[:discriminator], token: store(cc_or_token), order_number: order_number } response = flow_instance..post @flow_organization, body # This is the only changed line, it just sets the response.id as Response#authorizzation Response.new true, 'Flow authorize - Success', { response: response }, { authorization: response.id } rescue => exception error_response exception end |
#purchase(credit_card, order_number, options = {}) ⇒ Object
10 11 12 13 |
# File 'lib/active_merchant/billing/flow_gateway.rb', line 10 def purchase(credit_card, order_number, = {}) response = (credit_card, order_number, ) capture([:amount], response., ) end |