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',
  '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

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.


124
125
126
127
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 124

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

Instance Method Details

#add_3ds_2_optional_fields(post, options) ⇒ Object


235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 235

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?

      if key == :'3ds_homephonecountry'
        next unless options[:billing_address] && options[:billing_address][:phone]
      end

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

  post
end

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


145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 145

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_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


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

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


204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 204

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_submerchant_id(post, options)
  add_transaction_type(post, options)
  add_processor(post, options)

  commit(:credit, post)
end

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


129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 129

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_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


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

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)

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

#scrub(transcript) ⇒ Object


229
230
231
232
233
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 229

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

#supports_scrubbing?Boolean

Returns:

  • (Boolean)

225
226
227
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 225

def supports_scrubbing?
  true
end

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


218
219
220
221
222
223
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 218

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


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

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