Class: ActiveMerchant::Billing::TransFirstTransactionExpressGateway

Inherits:
Gateway
  • Object
show all
Defined in:
lib/active_merchant/billing/gateways/trans_first_transaction_express.rb

Constant Summary collapse

V1_NAMESPACE =
'http://postilion/realtime/merchantframework/xsd/v1/'
SOAPENV_NAMESPACE =
'http://schemas.xmlsoap.org/soap/envelope/'
AUTHORIZATION_FIELD_SEPARATOR =
'|'
APPROVAL_CODES =
%w(00 10)
RESPONSE_MESSAGES =
{
  '00' => 'Approved',
  '01' => 'Refer to card issuer',
  '02' => 'Refer to card issuer, special condition',
  '03' => 'Invalid merchant',
  '04' => 'Pick-up card',
  '05' => 'Do not honor',
  '06' => 'Error',
  '07' => 'Pick-up card, special condition',
  '08' => 'Honor with identification',
  '09' => 'Request in progress',
  '10' => 'Approved, partial authorization',
  '11' => 'VIP Approval',
  '12' => 'Invalid transaction',
  '13' => 'Invalid amount',
  '14' => 'Invalid card number',
  '15' => 'No such issuer',
  '16' => 'Approved, update track 3',
  '17' => 'Customer cancellation',
  '18' => 'Customer dispute',
  '19' => 'Re-enter transaction',
  '20' => 'Invalid response',
  '21' => 'No action taken',
  '22' => 'Suspected malfunction',
  '23' => 'Unacceptable transaction fee',
  '24' => 'File update not supported',
  '25' => 'Unable to locate record',
  '26' => 'Duplicate record',
  '27' => 'File update field edit error',
  '28' => 'File update file locked',
  '29' => 'File update failed',
  '30' => 'Format error',
  '31' => 'Bank not supported',
  '33' => 'Expired card, pick-up',
  '34' => 'Suspected fraud, pick-up',
  '35' => 'Contact acquirer, pick-up',
  '36' => 'Restricted card, pick-up',
  '37' => 'Call acquirer security, pick-up',
  '38' => 'PIN tries exceeded, pick-up',
  '39' => 'No credit account',
  '40' => 'Function not supported',
  '41' => 'Lost card, pick-up',
  '42' => 'No universal account',
  '43' => 'Stolen card, pick-up',
  '44' => 'No investment account',
  '45' => 'Account closed',
  '46' => 'Identification required',
  '47' => 'Identification cross-check required',
  '48' => 'No customer record',
  '49' => 'Reserved for future Realtime use',
  '50' => 'Reserved for future Realtime use',
  '51' => 'Not sufficient funds',
  '52' => 'No checking account',
  '53' => 'No savings account',
  '54' => 'Expired card',
  '55' => 'Incorrect PIN',
  '56' => 'No card record',
  '57' => 'Transaction not permitted to cardholder',
  '58' => 'Transaction not permitted on terminal',
  '59' => 'Suspected fraud',
  '60' => 'Contact acquirer',
  '61' => 'Exceeds withdrawal limit',
  '62' => 'Restricted card',
  '63' => 'Security violation',
  '64' => 'Original amount incorrect',
  '65' => 'Exceeds withdrawal frequency',
  '66' => 'Call acquirer security',
  '67' => 'Hard capture',
  '68' => 'Response received too late',
  '69' => 'Advice received too late (the response from a request was received too late )',
  '70' => 'Reserved for future use',
  '71' => 'Reserved for future Realtime use',
  '72' => 'Reserved for future Realtime use',
  '73' => 'Reserved for future Realtime use',
  '74' => 'Reserved for future Realtime use',
  '75' => 'PIN tries exceeded',
  '76' => 'Reversal: Unable to locate previous message (no match on Retrieval Reference Number)/ Reserved for future Realtime use',
  '77' => 'Previous message located for a repeat or reversal, but repeat or reversal data is inconsistent with original message/ Intervene, bank approval required',
  '78' => 'Invalid/non-existent account – Decline (MasterCard specific)/ Intervene, bank approval required for partial amount',
  '79' => 'Already reversed (by Switch)/ Reserved for client-specific use (declined)',
  '80' => 'No financial Impact (Reserved for declined debit)/ Reserved for client-specific use (declined)',
  '81' => 'PIN cryptographic error found by the Visa security module during PIN decryption/ Reserved for client-specific use (declined)',
  '82' => 'Incorrect CVV/ Reserved for client-specific use (declined)',
  '83' => 'Unable to verify PIN/ Reserved for client-specific use (declined)',
  '84' => 'Invalid Authorization Life Cycle – Decline (MasterCard) or Duplicate Transaction Detected (Visa)/ Reserved for client-specific use (declined)',
  '85' => 'No reason to decline a request for Account Number Verification or Address Verification/ Reserved for client-specific use (declined)',
  '86' => 'Cannot verify PIN/ Reserved for client-specific use (declined)',
  '87' => 'Reserved for client-specific use (declined)',
  '88' => 'Reserved for client-specific use (declined)',
  '89' => 'Reserved for client-specific use (declined)',
  '90' => 'Cut-off in progress',
  '91' => 'Issuer or switch inoperative',
  '92' => 'Routing error',
  '93' => 'Violation of law',
  '94' => 'Duplicate Transmission (Integrated Debit and MasterCard)',
  '95' => 'Reconcile error',
  '96' => 'System malfunction',
  '97' => 'Reserved for future Realtime use',
  '98' => 'Exceeds cash limit',
  '99' => 'Reserved for future Realtime use',
  '1106' => 'Reserved for future Realtime use',
  '0A' => 'Reserved for future Realtime use',
  'A0' => 'Reserved for future Realtime use',
  'A1' => 'ATC not incremented',
  'A2' => 'ATC limit exceeded',
  'A3' => 'ATC configuration error',
  'A4' => 'CVR check failure',
  'A5' => 'CVR configuration error',
  'A6' => 'TVR check failure',
  'A7' => 'TVR configuration error',
  'A8' => 'Reserved for future Realtime use',
  'B1' => 'Surcharge amount not permitted on Visa cards or EBT Food Stamps/ Reserved for future Realtime use',
  'B2' => 'Surcharge amount not supported by debit network issuer/ Reserved for future Realtime use',
  'C1' => 'Unacceptable PIN',
  'C2' => 'PIN Change failed',
  'C3' => 'PIN Unblock failed',
  'D1' => 'MAC Error',
  'E1' => 'Prepay error',
  'N1' => 'Network Error within the TXP platform',
  'N0' => 'Force STIP/ Reserved for client-specific use (declined)',
  'N3' => 'Cash service not available/ Reserved for client-specific use (declined)',
  'N4' => 'Cash request exceeds Issuer limit/ Reserved for client-specific use (declined)',
  'N5' => 'Ineligible for re-submission/ Reserved for client-specific use (declined)',
  'N7' => 'Decline for CVV2 failure/ Reserved for client-specific use (declined)',
  'N8' => 'Transaction amount exceeds preauthorized approval amount/ Reserved for client-specific use (declined)',
  'P0' => 'Approved; PVID code is missing, invalid, or has expired',
  'P1' => 'Declined; PVID code is missing, invalid, or has expired/ Reserved for client-specific use (declined)',
  'P2' => 'Invalid biller Information/ Reserved for client-specific use (declined)/ Reserved for client-specific use (declined)',
  'R0' => 'The transaction was declined or returned, because the cardholder requested that payment of a specific recurring or installment payment transaction be stopped/ Reserved for client-specific use (declined)',
  'R1' => 'The transaction was declined or returned, because the cardholder requested that payment of all recurring or installment payment transactions for a specific merchant account be stopped/ Reserved for client-specific use (declined)',
  'Q1' => 'Card Authentication failed/ Reserved for client-specific use (declined)',
  'XA' => 'Forward to Issuer/ Reserved for client-specific use (declined)',
  'XD' => 'Forward to Issuer/ Reserved for client-specific use (declined)'
}
EXTENDED_RESPONSE_MESSAGES =
{
  'B40K' => 'Declined Post – Credit linked to unextracted settle transaction'
}
TRANSACTION_CODES =
{
  authorize: 0,
  void_authorize: 2,

  purchase: 1,
  capture: 3,
  void_purchase: 6,
  void_capture: 6,

  refund: 4,
  credit: 5,
  void_refund: 13,
  void_credit: 13,

  verify: 9,

  purchase_echeck: 11,
  refund_echeck: 16,
  void_echeck: 16,

  wallet_sale: 14
}

Constants inherited from Gateway

Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods inherited from Gateway

#add_field_to_post_if_present, #add_fields_to_post_if_present, #card_brand, card_brand, #generate_unique_id, inherited, #supported_countries, supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #test?

Methods included from CreditCardFormatting

#expdate, #format

Methods included from PostsData

included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request

Constructor Details

#initialize(options = {}) ⇒ TransFirstTransactionExpressGateway

Returns a new instance of TransFirstTransactionExpressGateway.



185
186
187
188
# File 'lib/active_merchant/billing/gateways/trans_first_transaction_express.rb', line 185

def initialize(options = {})
  requires!(options, :gateway_id, :reg_key)
  super
end

Instance Method Details

#authorize(amount, payment_method, options = {}) ⇒ Object



219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# File 'lib/active_merchant/billing/gateways/trans_first_transaction_express.rb', line 219

def authorize(amount, payment_method, options = {})
  if credit_card?(payment_method)
    request = build_xml_transaction_request do |doc|
      add_credit_card(doc, payment_method)
      add_contact(doc, payment_method.name, options)
      add_amount(doc, amount)
    end
  else
    wallet_id = split_authorization(payment_method).last
    request = build_xml_transaction_request do |doc|
      add_amount(doc, amount)
      add_wallet_id(doc, wallet_id)
    end
  end

  commit(:authorize, request)
end

#capture(amount, authorization, options = {}) ⇒ Object



237
238
239
240
241
242
243
244
245
# File 'lib/active_merchant/billing/gateways/trans_first_transaction_express.rb', line 237

def capture(amount, authorization, options = {})
  transaction_id = split_authorization(authorization)[1]
  request = build_xml_transaction_request do |doc|
    add_amount(doc, amount)
    add_original_transaction_data(doc, transaction_id)
  end

  commit(:capture, request)
end

#credit(amount, payment_method, options = {}) ⇒ Object



268
269
270
271
272
273
274
275
# File 'lib/active_merchant/billing/gateways/trans_first_transaction_express.rb', line 268

def credit(amount, payment_method, options = {})
  request = build_xml_transaction_request do |doc|
    add_pan(doc, payment_method)
    add_amount(doc, amount)
  end

  commit(:credit, request)
end

#purchase(amount, payment_method, options = {}) ⇒ Object



190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/active_merchant/billing/gateways/trans_first_transaction_express.rb', line 190

def purchase(amount, payment_method, options = {})
  if credit_card?(payment_method)
    action = :purchase
    request = build_xml_transaction_request do |doc|
      add_credit_card(doc, payment_method)
      add_contact(doc, payment_method.name, options)
      add_amount(doc, amount)
      add_order_number(doc, options)
    end
  elsif echeck?(payment_method)
    action = :purchase_echeck
    request = build_xml_transaction_request do |doc|
      add_echeck(doc, payment_method)
      add_contact(doc, payment_method.name, options)
      add_amount(doc, amount)
      add_order_number(doc, options)
    end
  else
    action = :wallet_sale
    wallet_id = split_authorization(payment_method).last
    request = build_xml_transaction_request do |doc|
      add_amount(doc, amount)
      add_wallet_id(doc, wallet_id)
    end
  end

  commit(action, request)
end

#refund(amount, authorization, options = {}) ⇒ Object



257
258
259
260
261
262
263
264
265
266
# File 'lib/active_merchant/billing/gateways/trans_first_transaction_express.rb', line 257

def refund(amount, authorization, options = {})
  action, transaction_id = split_authorization(authorization)

  request = build_xml_transaction_request do |doc|
    add_amount(doc, amount) unless action == 'purchase_echeck'
    add_original_transaction_data(doc, transaction_id)
  end

  commit(refund_type(action), request)
end

#scrub(transcript) ⇒ Object



315
316
317
318
319
320
321
322
# File 'lib/active_merchant/billing/gateways/trans_first_transaction_express.rb', line 315

def scrub(transcript)
  transcript.
    gsub(%r((<[^>]+pan>)[^<]+(<))i, '\1[FILTERED]\2').
    gsub(%r((<[^>]+sec>)[^<]+(<))i, '\1[FILTERED]\2').
    gsub(%r((<[^>]+id>)[^<]+(<))i, '\1[FILTERED]\2').
    gsub(%r((<[^>]+regKey>)[^<]+(<))i, '\1[FILTERED]\2').
    gsub(%r((<[^>]+acctNr>)[^<]+(<))i, '\1[FILTERED]\2')
end

#store(payment_method, options = {}) ⇒ Object



286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
# File 'lib/active_merchant/billing/gateways/trans_first_transaction_express.rb', line 286

def store(payment_method, options = {})
  store_customer_request = build_xml_payment_storage_request do |doc|
    store_customer_details(doc, payment_method.name, options)
  end

  MultiResponse.run do |r|
    r.process { commit(:store, store_customer_request) }
    return r unless r.success? && r.params['custId']

    customer_id = r.params['custId']

    store_payment_method_request = build_xml_payment_storage_request do |doc|
      doc['v1'].cust do
        add_customer_id(doc, customer_id)
        doc['v1'].pmt do
          doc['v1'].type 0 # add
          add_credit_card(doc, payment_method)
        end
      end
    end

    r.process { commit(:store, store_payment_method_request) }
  end
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


311
312
313
# File 'lib/active_merchant/billing/gateways/trans_first_transaction_express.rb', line 311

def supports_scrubbing?
  true
end

#verify(credit_card, options = {}) ⇒ Object



277
278
279
280
281
282
283
284
# File 'lib/active_merchant/billing/gateways/trans_first_transaction_express.rb', line 277

def verify(credit_card, options = {})
  request = build_xml_transaction_request do |doc|
    add_credit_card(doc, credit_card)
    add_contact(doc, credit_card.name, options)
  end

  commit(:verify, request)
end

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



247
248
249
250
251
252
253
254
255
# File 'lib/active_merchant/billing/gateways/trans_first_transaction_express.rb', line 247

def void(authorization, options = {})
  action, transaction_id = split_authorization(authorization)

  request = build_xml_transaction_request do |doc|
    add_original_transaction_data(doc, transaction_id)
  end

  commit(void_type(action), request)
end