Class: ActiveMerchant::Billing::CredoraxGateway

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

Constant Summary collapse

RESPONSE_MESSAGES =
{
  '00' => 'Approved or completed successfully',
  '01' => 'Refer to card issuer',
  '02' => 'Refer to card issuer special condition',
  '03' => 'Invalid merchant',
  '04' => 'Pick up card',
  '05' => 'Do not Honour',
  '06' => 'Error',
  '07' => 'Pick up card special condition',
  '08' => 'Honour with identification',
  '09' => 'Request in progress',
  '10' => 'Approved for partial amount',
  '11' => 'Approved (VIP)',
  '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 by receiver',
  '25' => 'No such record',
  '26' => 'Duplicate record update, old record replaced',
  '27' => 'File update field edit error',
  '28' => 'File locked out while update',
  '29' => 'File update error, contact acquirer',
  '30' => 'Format error',
  '31' => 'Issuer signed-off',
  '32' => 'Completed partially',
  '33' => 'Pick-up, expired card',
  '34' => 'Suspect Fraud',
  '35' => 'Pick-up, card acceptor contact acquirer',
  '36' => 'Pick up, card restricted',
  '37' => 'Pick up, call acquirer security',
  '38' => 'Pick up, Allowable PIN tries exceeded',
  '39' => 'Transaction Not Allowed',
  '40' => 'Requested function not supported',
  '41' => 'Lost Card, Pickup',
  '42' => 'No universal account',
  '43' => 'Pick up, stolen card',
  '44' => 'No investment account',
  '50' => 'Do not renew',
  '51' => 'Not sufficient funds',
  '52' => 'No checking Account',
  '53' => 'No savings account',
  '54' => 'Expired card',
  '55' => 'Pin incorrect',
  '56' => 'No card record',
  '57' => 'Transaction not allowed for cardholder',
  '58' => 'Transaction not allowed for merchant',
  '59' => 'Suspected Fraud',
  '60' => 'Card acceptor contact acquirer',
  '61' => 'Exceeds withdrawal amount limit',
  '62' => 'Restricted card',
  '63' => 'Security violation',
  '64' => 'Wrong original amount',
  '65' => 'Activity count limit exceeded',
  '66' => 'Call acquirers security department',
  '67' => 'Card to be picked up at ATM',
  '68' => 'Response received too late.',
  '70' => 'Invalid transaction; contact card issuer',
  '71' => 'Decline PIN not changed',
  '75' => 'Pin tries exceeded',
  '76' => 'Wrong PIN, number of PIN tries exceeded',
  '77' => 'Wrong Reference No.',
  '78' => 'Record Not Found',
  '79' => 'Already reversed',
  '80' => 'Network error',
  '81' => 'Foreign network error / PIN cryptographic error',
  '82' => 'Time out at issuer system',
  '83' => 'Transaction failed',
  '84' => 'Pre-authorization timed out',
  '85' => 'No reason to decline',
  '86' => 'Cannot verify pin',
  '87' => 'Purchase amount only, no cashback allowed',
  '88' => 'MAC sync Error',
  '89' => 'Authentication failure',
  '91' => 'Issuer not available',
  '92' => 'Unable to route at acquirer Module',
  '93' => 'Cannot be completed, violation of law',
  '94' => 'Duplicate Transmission',
  '95' => 'Reconcile error / Auth Not found',
  '96' => 'System malfunction',
  'R0' => 'Stop Payment Order',
  'R1' => 'Revocation of Authorisation Order',
  'R3' => 'Revocation of all Authorisations Order'
}

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

#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 = {}) ⇒ CredoraxGateway

Returns a new instance of CredoraxGateway.



119
120
121
122
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 119

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

Instance Method Details

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



137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 137

def authorize(amount, payment_method, options={})
  post = {}
  add_invoice(post, amount, options)
  add_payment_method(post, payment_method)
  add_customer_data(post, options)
  add_email(post, options)
  add_3d_secure(post, options)
  add_echo(post, options)
  add_transaction_type(post, options)

  commit(:authorize, post)
end

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



150
151
152
153
154
155
156
157
158
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 150

def capture(amount, authorization, options={})
  post = {}
  add_invoice(post, amount, options)
  add_reference(post, authorization)
  add_customer_data(post, options)
  add_echo(post, options)

  commit(:capture, post)
end

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



180
181
182
183
184
185
186
187
188
189
190
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 180

def credit(amount, payment_method, options={})
  post = {}
  add_invoice(post, amount, options)
  add_payment_method(post, payment_method)
  add_customer_data(post, options)
  add_email(post, options)
  add_echo(post, options)
  add_transaction_type(post, options)
  
  commit(:credit, post)
end

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



124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 124

def purchase(amount, payment_method, options={})
  post = {}
  add_invoice(post, amount, options)
  add_payment_method(post, payment_method)
  add_customer_data(post, options)
  add_email(post, options)
  add_3d_secure(post, options)
  add_echo(post, options)
  add_transaction_type(post, options)

  commit(:purchase, post)
end

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



170
171
172
173
174
175
176
177
178
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 170

def refund(amount, authorization, options={})
  post = {}
  add_invoice(post, amount, options)
  add_reference(post, authorization)
  add_customer_data(post, options)
  add_echo(post, options)

  commit(:refund, post)
end

#scrub(transcript) ⇒ Object



203
204
205
206
207
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 203

def scrub(transcript)
  transcript.
    gsub(%r((b1=)\d+), '\1[FILTERED]').
    gsub(%r((b5=)\d+), '\1[FILTERED]')
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


199
200
201
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 199

def supports_scrubbing?
  true
end

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



192
193
194
195
196
197
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 192

def verify(credit_card, options={})
  MultiResponse.run(:use_first_response) do |r|
    r.process { authorize(100, credit_card, options) }
    r.process(:ignore_result) { void(r.authorization, options) }
  end
end

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



160
161
162
163
164
165
166
167
168
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 160

def void(authorization, options={})
  post = {}
  add_customer_data(post, options)
  reference_action = add_reference(post, authorization)
  add_echo(post, options)
  post[:a1] = generate_unique_id

  commit(:void, post, reference_action)
end