Class: ActiveMerchant::Billing::JetpayGateway

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

Constant Summary collapse

ACTION_CODE_MESSAGES =
{
  '000' =>  'Approved.',
  '001' =>  'Refer to card issuer.',
  '002' =>  'Refer to card issuer, special condition.',
  '003' =>  'Invalid merchant or service provider.',
  '004' =>  'Pick up card.',
  '005' =>  'Do not honor.',
  '006' =>  'Error.',
  '007' =>  'Pick up card, special condition.',
  '008' =>  'Honor with ID (Show ID).',
  '010' =>  'Partial approval.',
  '011' =>  'VIP approval.',
  '012' =>  'Invalid transaction.',
  '013' =>  'Invalid amount or exceeds maximum for card program.',
  '014' =>  'Invalid account number (no such number).',
  '015' =>  'No such issuer.',
  '019' =>  'Re-enter Transaction.',
  '021' =>  'No action taken (unable to back out prior transaction).',
  '025' =>  'Transaction Not Found.',
  '027' =>  'File update field edit error.',
  '028' =>  'File is temporarily unavailable.',
  '030' =>  'Format error.',
  '039' =>  'No credit account.',
  '041' =>  'Pick up card (lost card).',
  '043' =>  'Pick up card (stolen card).',
  '051' =>  'Insufficient funds.',
  '052' =>  'No checking account.',
  '053' =>  'No savings account.',
  '054' =>  'Expired Card.',
  '055' =>  'Incorrect PIN.',
  '057' =>  'Transaction not permitted to cardholder.',
  '058' =>  'Transaction not allowed at terminal.',
  '061' =>  'Exceeds withdrawal limit.',
  '062' =>  'Restricted card (eg, Country Exclusion).',
  '063' =>  'Security violation.',
  '065' =>  'Activity count limit exceeded.',
  '068' =>  'Response late.',
  '070' =>  'Contact card issuer.',
  '071' =>  'PIN not changed.',
  '075' =>  'Allowable number of PIN-entry tries exceeded.',
  '076' =>  'Unable to locate previous message (no matching retrieval reference number).',
  '077' =>  'Repeat or reversal data are inconsistent with original message.',
  '078' =>  'Blocked (first use), or non-existent account.',
  '079' =>  'Key exchange validation failed.',
  '080' =>  'Credit issuer unavailable or invalid date.',
  '081' =>  'PIN cryptographic error found.',
  '082' =>  'Negative online CVV results.',
  '084' =>  'Invalid auth life cycle.',
  '085' =>  'No reason to decline - CVV or AVS approved.',
  '086' =>  'Cannot verify PIN.',
  '087' =>  'Cashback not allowed.',
  '089' =>  'Issuer Down.',
  '091' =>  'Issuer Down.',
  '092' =>  'Unable to route transaction.',
  '093' =>  'Transaction cannot be completed - violation of law.',
  '094' =>  'Duplicate transmission.',
  '096' =>  'System error.',
  '100' =>  'Deny.',
  '101' =>  'Expired Card.',
  '103' =>  'Deny - Invalid manual Entry 4DBC.',
  '104' =>  'Deny - New card issued.',
  '105' =>  'Deny - Account Cancelled.',
  '106' =>  'Exceeded PIN Attempts.',
  '107' =>  'Please Call Issuer.',
  '109' =>  'Invalid merchant.',
  '110' =>  'Invalid amount.',
  '111' =>  'Invalid account.',
  '115' =>  'Service not permitted.',
  '122' =>  'Invalid card (CID) security code.',
  '125' =>  'Invalid effective date.',
  '181' =>  'Format error.',
  '182' =>  'Please wait.',
  '183' =>  'Invalid currency code.',
  '187' =>  'Deny - new card issued.',
  '188' =>  'Deny - Expiration date required.',
  '189' =>  'Deny - Cancelled or Closed Merchant/SE.',
  '200' =>  'Deny - Pick up card.',
  '400' =>  'Reversal accepted.',
  '601' =>  'Reject - EMV Chip Declined Transaction.',
  '602' =>  'Reject - Suspected Fraud.',
  '603' =>  'Reject - Communications Error.',
  '604' =>  'Reject - Insufficient Approval.',
  '750' =>  'Velocity Check Fail.',
  '899' =>  'Misc Decline.',
  '900' =>  'Invalid Message Type.',
  '901' =>  'Invalid Merchant ID.',
  '903' =>  'Debit not supported.',
  '904' =>  'Private label not supported.',
  '905' =>  'Invalid card type.',
  '906' =>  'Unit not active.',
  '908' =>  'Manual card entry invalid.',
  '909' =>  'Invalid track information.',
  '911' =>  'Master merchant not found.',
  '912' =>  'Invalid card format.',
  '913' =>  'Invalid card type.',
  '914' =>  'Invalid card length.',
  '917' =>  'Expired card.',
  '919' =>  'Invalid entry type.',
  '920' =>  'Invalid amount.',
  '921' =>  'Invalid messge format.',
  '923' =>  'Invalid ABA.',
  '924' =>  'Invalid DDA.',
  '925' =>  'Invalid TID.',
  '926' =>  'Invalid Password.',
  '930' =>  'Invalid zipcode.',
  '931' =>  'Invalid Address.',
  '932' =>  'Invalid ZIP and Address.',
  '933' =>  'Invalid CVV2.',
  '934' =>  'Program Not Allowed.',
  '940' =>  'Record Not Found.',
  '941' =>  'Merchant ID error.',
  '942' =>  'Refund Not Allowed.',
  '943' =>  'Refund denied.',
  '955' =>  'Invalid PIN block.',
  '956' =>  'Invalid KSN.',
  '958' =>  'Bad Status.',
  '959' =>  'Seek Record limit exceeded.',
  '962' =>  'Invalid PIN key (Unknown KSN).',
  '981' =>  'Invalid AVS.',
  '987' =>  'Issuer Unavailable.',
  '988' =>  'System error SD.',
  '989' =>  'Database Error.',
  '992' =>  'Transaction Timeout.',
  '996' =>  'Bad Terminal ID.',
  '997' =>  'Message rejected by association.',
  '999' =>  'Communication failure',
  nil   =>  'No response returned (missing credentials?).'
}

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?, #supports_scrubbing?, #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 = {}) ⇒ JetpayGateway

Returns a new instance of JetpayGateway.


154
155
156
157
# File 'lib/active_merchant/billing/gateways/jetpay.rb', line 154

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

Instance Method Details

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


163
164
165
# File 'lib/active_merchant/billing/gateways/jetpay.rb', line 163

def authorize(money, credit_card, options = {})
  commit(money, build_authonly_request(money, credit_card, options))
end

#capture(money, reference, options = {}) ⇒ Object


167
168
169
170
171
172
# File 'lib/active_merchant/billing/gateways/jetpay.rb', line 167

def capture(money, reference, options = {})
  split_authorization = reference.split(';')
  transaction_id = split_authorization[0]
  token = split_authorization[3]
  commit(money, build_capture_request(transaction_id, money, options), token)
end

#credit(money, transaction_id_or_card, options = {}) ⇒ Object


179
180
181
182
183
184
185
186
# File 'lib/active_merchant/billing/gateways/jetpay.rb', line 179

def credit(money, transaction_id_or_card, options = {})
  if transaction_id_or_card.is_a?(String)
    ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE
    refund(money, transaction_id_or_card, options)
  else
    commit(money, build_credit_request('CREDIT', money, nil, transaction_id_or_card, nil, options))
  end
end

#purchase(money, credit_card, options = {}) ⇒ Object


159
160
161
# File 'lib/active_merchant/billing/gateways/jetpay.rb', line 159

def purchase(money, credit_card, options = {})
  commit(money, build_sale_request(money, credit_card, options))
end

#refund(money, reference, options = {}) ⇒ Object


188
189
190
191
192
193
194
# File 'lib/active_merchant/billing/gateways/jetpay.rb', line 188

def refund(money, reference, options = {})
  split_authorization = reference.split(';')
  transaction_id = split_authorization[0]
  token = split_authorization[3]
  credit_card = options[:credit_card]
  commit(money, build_credit_request('CREDIT', money, transaction_id, credit_card, token, options))
end

#scrub(transcript) ⇒ Object


200
201
202
203
204
205
# File 'lib/active_merchant/billing/gateways/jetpay.rb', line 200

def scrub(transcript)
  transcript.
    gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
    gsub(%r((>)\d+(</CardNum>)), '\1[FILTERED]\2').
    gsub(%r((<CVV2>)\d+(</CVV2>)), '\1[FILTERED]\2')
end

#supports_scrubbingObject


196
197
198
# File 'lib/active_merchant/billing/gateways/jetpay.rb', line 196

def supports_scrubbing
  true
end

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


174
175
176
177
# File 'lib/active_merchant/billing/gateways/jetpay.rb', line 174

def void(reference, options = {})
  transaction_id, approval, amount, token = reference.split(';')
  commit(amount.to_i, build_void_request(amount.to_i, transaction_id, approval, token, options), token)
end