Class: ActiveMerchant::Billing::CredoraxGateway

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

Constant Summary collapse

NETWORK_TOKENIZATION_CARD_SOURCE =
{
  'apple_pay' => 'applepay',
  'google_pay' => 'googlepay',
  'network_token' => 'vts_mdes_token'
}
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' => 'Implausible card data',
  '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' => 'No credit account',
  '40' => 'Requested function not supported',
  '41' => 'Lost Card, Pickup',
  '42' => 'No universal account',
  '43' => 'Pick up, stolen card',
  '44' => 'No investment account',
  '46' => 'Closed account',
  '50' => 'Do not renew',
  '51' => 'Insufficient funds',
  '52' => 'No checking Account',
  '53' => 'No savings account',
  '54' => 'Expired card',
  '55' => 'Incorrect PIN',
  '56' => 'No card record',
  '57' => 'Transaction not allowed for cardholder',
  '58' => 'Transaction not permitted to terminal',
  '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' => 'PIN data required',
  '71' => 'Decline PIN not changed',
  '75' => 'Pin tries exceeded',
  '76' => 'Wrong PIN, number of PIN tries exceeded',
  '77' => 'Wrong Reference No.',
  '78' => 'Blocked, first used/ Record not found',
  '79' => 'Declined due to lifecycle event',
  '80' => 'Network error',
  '81' => 'PIN cryptographic error',
  '82' => 'Bad CVV/ Declined due to policy event',
  '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' => 'Cryptographic failure',
  '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',
  '97' => 'Transaction has been declined by the processor',
  'N3' => 'Cash service not available',
  'N4' => 'Cash request exceeds issuer or approved limit',
  'N7' => 'CVV2 failure',
  'R0' => 'Stop Payment Order',
  'R1' => 'Revocation of Authorisation Order',
  'R3' => 'Revocation of all Authorisation Orders',
  '1A' => 'Strong Customer Authentication required'
}

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, #strftime_yyyymm

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.



136
137
138
139
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 136

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

Instance Method Details

#add_3ds_2_optional_fields(post, options) ⇒ Object



249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 249

def add_3ds_2_optional_fields(post, options)
  three_ds = options[:three_ds_2] || {}

  if three_ds.has_key?(:optional)
    three_ds[:optional].each do |key, value|
      normalized_value = normalize(value)
      next if normalized_value.nil?

      next if key == :'3ds_homephonecountry' && !(options[:billing_address] && options[:billing_address][:phone])

      post[key] = normalized_value unless post[key]
    end
  end

  post
end

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



157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 157

def authorize(amount, payment_method, options = {})
  post = {}
  add_invoice(post, amount, options)
  add_payment_method(post, payment_method, options)
  add_customer_data(post, options)
  add_email(post, options)
  add_3d_secure(post, options)
  add_3ds_2_optional_fields(post, options)
  add_echo(post, options)
  add_submerchant_id(post, options)
  add_stored_credential(post, options)
  add_processor(post, options)
  add_authorization_details(post, options)

  commit(:authorize, post)
end

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



174
175
176
177
178
179
180
181
182
183
184
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 174

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

  commit(:capture, post)
end

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



217
218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 217

def credit(amount, payment_method, options = {})
  post = {}
  add_invoice(post, amount, options)
  add_payment_method(post, payment_method, options)
  add_customer_data(post, options)
  add_email(post, options)
  add_echo(post, options)
  add_submerchant_id(post, options)
  add_transaction_type(post, options)
  add_processor(post, options)
  add_customer_name(post, options)

  commit(:credit, post)
end

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



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 141

def purchase(amount, payment_method, options = {})
  post = {}
  add_invoice(post, amount, options)
  add_payment_method(post, payment_method, options)
  add_customer_data(post, options)
  add_email(post, options)
  add_3d_secure(post, options)
  add_3ds_2_optional_fields(post, options)
  add_echo(post, options)
  add_submerchant_id(post, options)
  add_stored_credential(post, options)
  add_processor(post, options)

  commit(:purchase, post)
end

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



198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 198

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

  if options[:referral_cft]
    add_customer_name(post, options)
    commit(:referral_cft, post)
  else
    commit(:refund, post)
  end
end

#scrub(transcript) ⇒ Object



243
244
245
246
247
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 243

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

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


239
240
241
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 239

def supports_scrubbing?
  true
end

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



232
233
234
235
236
237
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 232

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



186
187
188
189
190
191
192
193
194
195
196
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 186

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

  commit(:void, post, reference_action)
end