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" => "Invalid Transaction for Terminal",
  "07" => "Pick up card special condition",
  "08" => "Time-Out",
  "09" => "No Original",
  "10" => "Approved for partial amount",
  "11" => "Partial Approval",
  "12" => "Invalid transaction card / issuer / acquirer",
  "13" => "Invalid amount",
  "14" => "Invalid card number",
  "17" => "Invalid Capture date (terminal business date)",
  "19" => "System Error; Re-enter transaction",
  "20" => "No From Account",
  "21" => "No To Account",
  "22" => "No Checking Account",
  "23" => "No Saving Account",
  "24" => "No Credit Account",
  "30" => "Format error",
  "34" => "Implausible card data",
  "39" => "Transaction Not Allowed",
  "41" => "Lost Card, Pickup",
  "42" => "Special Pickup",
  "43" => "Hot Card, Pickup (if possible)",
  "44" => "Pickup Card",
  "51" => "Not sufficient funds",
  "52" => "No checking Account",
  "53" => "No savings account",
  "54" => "Expired card",
  "55" => "Pin incorrect",
  "57" => "Transaction not allowed for cardholder",
  "58" => "Transaction not allowed for merchant",
  "59" => "Suspected Fraud",
  "61" => "Exceeds withdrawal amount limit",
  "62" => "Restricted card",
  "63" => "MAC Key Error",
  "65" => "Activity count limit exceeded",
  "66" => "Exceeds Acquirer Limit",
  "67" => "Retain Card; no reason specified",
  "68" => "Response received too late",
  "75" => "Pin tries exceeded",
  "76" => "Invalid Account",
  "77" => "Issuer Does Not Participate In The Service",
  "78" => "Function Not Available",
  "79" => "Key Validation Error",
  "80" => "Approval for Purchase Amount Only",
  "81" => "Unable to Verify PIN",
  "82" => "Time out at issuer system",
  "83" => "Not declined (Valid for all zero amount transactions)",
  "84" => "Invalid Life Cycle of transaction",
  "85" => "Not declined",
  "86" => "Cannot verify pin",
  "87" => "Purchase amount only, no cashback allowed",
  "88" => "MAC sync Error",
  "89" => "Security Violation",
  "91" => "Issuer not available",
  "92" => "Unable to route at acquirer Module",
  "93" => "Transaction cannot be completed",
  "94" => "Duplicate transaction",
  "95" => "Contact Acquirer",
  "96" => "System malfunction",
  "97" => "No Funds Transfer",
  "98" => "Duplicate Reversal",
  "99" => "Duplicate Transaction",
  "N3" => "Cash Service Not Available",
  "N4" => "Cash Back Request Exceeds Issuer Limit",
  "N7" => "N7 (visa), Decline CVV2 failure",
  "R0" => "Stop Payment Order",
  "R1" => "Revocation of Authorisation Order",
  "R3" => "Revocation of all Authorisations Order"
}

Constants inherited from Gateway

Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::DEBIT_CARDS, 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.



103
104
105
106
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 103

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

Instance Method Details

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



120
121
122
123
124
125
126
127
128
129
130
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 120

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)

  commit(:authorize, post)
end

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



132
133
134
135
136
137
138
139
140
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 132

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



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

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)

  commit(:credit, post)
end

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



108
109
110
111
112
113
114
115
116
117
118
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 108

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)

  commit(:purchase, post)
end

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



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

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



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

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

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


180
181
182
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 180

def supports_scrubbing?
  true
end

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



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

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



142
143
144
145
146
147
148
149
150
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 142

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