Method: ActiveMerchant::Billing::TrustCommerceGateway#authorize

Defined in:
lib/active_merchant/billing/gateways/trust_commerce.rb

#authorize(money, creditcard_or_billing_id, options = {}) ⇒ Object

authorize() is the first half of the preauth(authorize)/postauth(capture) model. The TC API docs call this preauth, we preserve active_merchant’s nomenclature of authorize() for consistency with the rest of the library. This method simply checks to make sure funds are available for a transaction, and returns a transid that can be used later to postauthorize (capture) the funds.



152
153
154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/active_merchant/billing/gateways/trust_commerce.rb', line 152

def authorize(money, creditcard_or_billing_id, options = {})
  parameters = {
    amount: amount(money)
  }

  add_order_id(parameters, options)
  add_aggregator(parameters, options)
  add_customer_data(parameters, options)
  add_payment_source(parameters, creditcard_or_billing_id)
  add_addresses(parameters, options)
  add_custom_fields(parameters, options)

  commit('preauth', parameters)
end