Method: ActiveMerchant::Billing::TrustCommerceGateway#void

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

#void(authorization, options = {}) ⇒ Object

void() clears an existing authorization and releases the reserved fund s back to the cardholder. The TC API refers to this transaction as a reversal. After voiding, you will no longer be able to capture funds from this authorization. TrustCommerce seems to always return a status of “accepted” even if the transid you are trying to deauthorize has already been captured. Note: Your account needs to be configured by TrustCommerce to allow for reversal transactions before you can use this method.

void() is also used to to cancel a capture (postauth), purchase (sale), or refund (credit) or a before it is sent for settlement.

NOTE: AMEX preauth’s cannot be reversed. If you want to clear it more quickly than the automatic expiration (7-10 days), you will have to capture it and then immediately issue a credit for the same amount which should clear the customers credit card with 48 hours according to TC.



237
238
239
240
241
242
243
244
245
246
247
248
249
# File 'lib/active_merchant/billing/gateways/trust_commerce.rb', line 237

def void(authorization, options = {})
  transaction_id, original_action = split_authorization(authorization)
  action = (VOIDABLE_ACTIONS - ['preauth']).include?(original_action) ? 'void' : 'reversal'

  parameters = {
    transid: transaction_id
  }

  add_aggregator(parameters, options)
  add_custom_fields(parameters, options)

  commit(action, parameters)
end