activemerchant 1.79.2 → 1.80.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +33 -0
  3. data/README.md +10 -2
  4. data/lib/active_merchant.rb +1 -1
  5. data/lib/active_merchant/billing/check.rb +4 -4
  6. data/lib/active_merchant/billing/compatibility.rb +1 -1
  7. data/lib/active_merchant/billing/credit_card.rb +21 -21
  8. data/lib/active_merchant/billing/credit_card_formatting.rb +2 -2
  9. data/lib/active_merchant/billing/credit_card_methods.rb +2 -2
  10. data/lib/active_merchant/billing/gateway.rb +13 -13
  11. data/lib/active_merchant/billing/gateways/adyen.rb +31 -15
  12. data/lib/active_merchant/billing/gateways/allied_wallet.rb +22 -22
  13. data/lib/active_merchant/billing/gateways/authorize_net.rb +72 -72
  14. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +3 -3
  15. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +3 -3
  16. data/lib/active_merchant/billing/gateways/axcessms.rb +51 -51
  17. data/lib/active_merchant/billing/gateways/balanced.rb +29 -29
  18. data/lib/active_merchant/billing/gateways/bank_frick.rb +3 -3
  19. data/lib/active_merchant/billing/gateways/banwire.rb +8 -8
  20. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +5 -5
  21. data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +6 -6
  22. data/lib/active_merchant/billing/gateways/be2bill.rb +2 -2
  23. data/lib/active_merchant/billing/gateways/beanstream.rb +1 -1
  24. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +69 -69
  25. data/lib/active_merchant/billing/gateways/blue_pay.rb +19 -19
  26. data/lib/active_merchant/billing/gateways/blue_snap.rb +42 -42
  27. data/lib/active_merchant/billing/gateways/bogus.rb +10 -10
  28. data/lib/active_merchant/billing/gateways/borgun.rb +10 -10
  29. data/lib/active_merchant/billing/gateways/bpoint.rb +1 -1
  30. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +2 -2
  31. data/lib/active_merchant/billing/gateways/braintree_blue.rb +94 -94
  32. data/lib/active_merchant/billing/gateways/braintree_orange.rb +1 -1
  33. data/lib/active_merchant/billing/gateways/bridge_pay.rb +39 -39
  34. data/lib/active_merchant/billing/gateways/cams.rb +12 -12
  35. data/lib/active_merchant/billing/gateways/card_connect.rb +38 -13
  36. data/lib/active_merchant/billing/gateways/card_stream.rb +116 -116
  37. data/lib/active_merchant/billing/gateways/cardknox.rb +7 -7
  38. data/lib/active_merchant/billing/gateways/cardprocess.rb +1 -1
  39. data/lib/active_merchant/billing/gateways/cashnet.rb +10 -10
  40. data/lib/active_merchant/billing/gateways/cc5.rb +3 -5
  41. data/lib/active_merchant/billing/gateways/cecabank.rb +6 -6
  42. data/lib/active_merchant/billing/gateways/cenpos.rb +36 -36
  43. data/lib/active_merchant/billing/gateways/checkout.rb +5 -5
  44. data/lib/active_merchant/billing/gateways/checkout_v2.rb +31 -31
  45. data/lib/active_merchant/billing/gateways/clearhaus.rb +5 -5
  46. data/lib/active_merchant/billing/gateways/commercegate.rb +6 -6
  47. data/lib/active_merchant/billing/gateways/conekta.rb +24 -19
  48. data/lib/active_merchant/billing/gateways/creditcall.rb +41 -41
  49. data/lib/active_merchant/billing/gateways/credorax.rb +104 -103
  50. data/lib/active_merchant/billing/gateways/culqi.rb +25 -25
  51. data/lib/active_merchant/billing/gateways/cyber_source.rb +65 -65
  52. data/lib/active_merchant/billing/gateways/data_cash.rb +4 -4
  53. data/lib/active_merchant/billing/gateways/dibs.rb +24 -24
  54. data/lib/active_merchant/billing/gateways/digitzs.rb +35 -35
  55. data/lib/active_merchant/billing/gateways/ebanx.rb +26 -26
  56. data/lib/active_merchant/billing/gateways/efsnet.rb +10 -10
  57. data/lib/active_merchant/billing/gateways/elavon.rb +5 -5
  58. data/lib/active_merchant/billing/gateways/element.rb +35 -35
  59. data/lib/active_merchant/billing/gateways/epay.rb +4 -4
  60. data/lib/active_merchant/billing/gateways/evo_ca.rb +1 -1
  61. data/lib/active_merchant/billing/gateways/eway.rb +65 -65
  62. data/lib/active_merchant/billing/gateways/eway_managed.rb +11 -11
  63. data/lib/active_merchant/billing/gateways/eway_rapid.rb +31 -31
  64. data/lib/active_merchant/billing/gateways/exact.rb +12 -12
  65. data/lib/active_merchant/billing/gateways/ezic.rb +13 -13
  66. data/lib/active_merchant/billing/gateways/fat_zebra.rb +24 -24
  67. data/lib/active_merchant/billing/gateways/federated_canada.rb +3 -3
  68. data/lib/active_merchant/billing/gateways/first_giving.rb +16 -16
  69. data/lib/active_merchant/billing/gateways/first_pay.rb +7 -4
  70. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +71 -71
  71. data/lib/active_merchant/billing/gateways/flo2cash.rb +12 -12
  72. data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +1 -1
  73. data/lib/active_merchant/billing/gateways/forte.rb +26 -16
  74. data/lib/active_merchant/billing/gateways/garanti.rb +10 -12
  75. data/lib/active_merchant/billing/gateways/global_collect.rb +88 -88
  76. data/lib/active_merchant/billing/gateways/global_transport.rb +4 -4
  77. data/lib/active_merchant/billing/gateways/hdfc.rb +33 -33
  78. data/lib/active_merchant/billing/gateways/hps.rb +28 -28
  79. data/lib/active_merchant/billing/gateways/iats_payments.rb +26 -26
  80. data/lib/active_merchant/billing/gateways/inspire.rb +15 -15
  81. data/lib/active_merchant/billing/gateways/instapay.rb +4 -4
  82. data/lib/active_merchant/billing/gateways/ipp.rb +17 -17
  83. data/lib/active_merchant/billing/gateways/iridium.rb +207 -207
  84. data/lib/active_merchant/billing/gateways/iveri.rb +8 -8
  85. data/lib/active_merchant/billing/gateways/jetpay.rb +134 -134
  86. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +141 -141
  87. data/lib/active_merchant/billing/gateways/komoju.rb +15 -15
  88. data/lib/active_merchant/billing/gateways/kushki.rb +31 -37
  89. data/lib/active_merchant/billing/gateways/latitude19.rb +64 -64
  90. data/lib/active_merchant/billing/gateways/linkpoint.rb +22 -22
  91. data/lib/active_merchant/billing/gateways/litle.rb +4 -4
  92. data/lib/active_merchant/billing/gateways/mastercard.rb +3 -3
  93. data/lib/active_merchant/billing/gateways/maxipago.rb +2 -2
  94. data/lib/active_merchant/billing/gateways/mercado_pago.rb +28 -28
  95. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +9 -9
  96. data/lib/active_merchant/billing/gateways/merchant_one.rb +6 -6
  97. data/lib/active_merchant/billing/gateways/merchant_partners.rb +24 -24
  98. data/lib/active_merchant/billing/gateways/merchant_ware.rb +49 -49
  99. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +36 -36
  100. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +4 -4
  101. data/lib/active_merchant/billing/gateways/mercury.rb +28 -28
  102. data/lib/active_merchant/billing/gateways/metrics_global.rb +7 -7
  103. data/lib/active_merchant/billing/gateways/micropayment.rb +31 -31
  104. data/lib/active_merchant/billing/gateways/migs.rb +11 -9
  105. data/lib/active_merchant/billing/gateways/modern_payments.rb +1 -1
  106. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +16 -16
  107. data/lib/active_merchant/billing/gateways/monei.rb +5 -5
  108. data/lib/active_merchant/billing/gateways/moneris.rb +26 -26
  109. data/lib/active_merchant/billing/gateways/moneris_us.rb +81 -37
  110. data/lib/active_merchant/billing/gateways/money_movers.rb +3 -3
  111. data/lib/active_merchant/billing/gateways/mundipagg.rb +1 -1
  112. data/lib/active_merchant/billing/gateways/nab_transact.rb +6 -6
  113. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +3 -3
  114. data/lib/active_merchant/billing/gateways/netaxept.rb +15 -15
  115. data/lib/active_merchant/billing/gateways/netbanx.rb +2 -2
  116. data/lib/active_merchant/billing/gateways/netbilling.rb +1 -1
  117. data/lib/active_merchant/billing/gateways/netpay.rb +5 -5
  118. data/lib/active_merchant/billing/gateways/nmi.rb +18 -18
  119. data/lib/active_merchant/billing/gateways/ogone.rb +22 -22
  120. data/lib/active_merchant/billing/gateways/omise.rb +3 -3
  121. data/lib/active_merchant/billing/gateways/openpay.rb +6 -4
  122. data/lib/active_merchant/billing/gateways/opp.rb +4 -4
  123. data/lib/active_merchant/billing/gateways/optimal_payment.rb +2 -2
  124. data/lib/active_merchant/billing/gateways/orbital.rb +61 -61
  125. data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +4 -4
  126. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +5 -5
  127. data/lib/active_merchant/billing/gateways/pagarme.rb +27 -27
  128. data/lib/active_merchant/billing/gateways/pago_facil.rb +8 -8
  129. data/lib/active_merchant/billing/gateways/pay_conex.rb +25 -25
  130. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +32 -32
  131. data/lib/active_merchant/billing/gateways/pay_hub.rb +29 -29
  132. data/lib/active_merchant/billing/gateways/pay_junction.rb +7 -7
  133. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +30 -30
  134. data/lib/active_merchant/billing/gateways/pay_secure.rb +4 -4
  135. data/lib/active_merchant/billing/gateways/paybox_direct.rb +15 -15
  136. data/lib/active_merchant/billing/gateways/payeezy.rb +5 -5
  137. data/lib/active_merchant/billing/gateways/payex.rb +4 -4
  138. data/lib/active_merchant/billing/gateways/payflow.rb +7 -7
  139. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +23 -22
  140. data/lib/active_merchant/billing/gateways/payflow_express.rb +2 -2
  141. data/lib/active_merchant/billing/gateways/payment_express.rb +40 -37
  142. data/lib/active_merchant/billing/gateways/paymentez.rb +11 -3
  143. data/lib/active_merchant/billing/gateways/paymill.rb +115 -115
  144. data/lib/active_merchant/billing/gateways/paypal.rb +1 -1
  145. data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +1 -1
  146. data/lib/active_merchant/billing/gateways/payscout.rb +1 -1
  147. data/lib/active_merchant/billing/gateways/paystation.rb +14 -14
  148. data/lib/active_merchant/billing/gateways/payu_in.rb +43 -43
  149. data/lib/active_merchant/billing/gateways/payu_latam.rb +41 -41
  150. data/lib/active_merchant/billing/gateways/payway.rb +6 -6
  151. data/lib/active_merchant/billing/gateways/pin.rb +7 -7
  152. data/lib/active_merchant/billing/gateways/plugnpay.rb +62 -62
  153. data/lib/active_merchant/billing/gateways/pro_pay.rb +123 -123
  154. data/lib/active_merchant/billing/gateways/psigate.rb +16 -16
  155. data/lib/active_merchant/billing/gateways/psl_card.rb +13 -13
  156. data/lib/active_merchant/billing/gateways/qbms.rb +52 -52
  157. data/lib/active_merchant/billing/gateways/quantum.rb +5 -5
  158. data/lib/active_merchant/billing/gateways/quickbooks.rb +10 -10
  159. data/lib/active_merchant/billing/gateways/quickpay.rb +1 -1
  160. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +11 -11
  161. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +3 -3
  162. data/lib/active_merchant/billing/gateways/qvalent.rb +55 -55
  163. data/lib/active_merchant/billing/gateways/realex.rb +16 -15
  164. data/lib/active_merchant/billing/gateways/redsys.rb +128 -121
  165. data/lib/active_merchant/billing/gateways/s5.rb +5 -5
  166. data/lib/active_merchant/billing/gateways/safe_charge.rb +16 -16
  167. data/lib/active_merchant/billing/gateways/sage.rb +20 -20
  168. data/lib/active_merchant/billing/gateways/sage_pay.rb +32 -32
  169. data/lib/active_merchant/billing/gateways/sallie_mae.rb +11 -11
  170. data/lib/active_merchant/billing/gateways/secure_net.rb +19 -19
  171. data/lib/active_merchant/billing/gateways/secure_pay.rb +5 -5
  172. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +7 -7
  173. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +9 -9
  174. data/lib/active_merchant/billing/gateways/securion_pay.rb +12 -12
  175. data/lib/active_merchant/billing/gateways/skip_jack.rb +28 -28
  176. data/lib/active_merchant/billing/gateways/smart_ps.rb +31 -31
  177. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +3 -3
  178. data/lib/active_merchant/billing/gateways/spreedly_core.rb +1 -1
  179. data/lib/active_merchant/billing/gateways/stripe.rb +63 -63
  180. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +5 -5
  181. data/lib/active_merchant/billing/gateways/telr.rb +26 -26
  182. data/lib/active_merchant/billing/gateways/trans_first.rb +28 -28
  183. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +224 -224
  184. data/lib/active_merchant/billing/gateways/transact_pro.rb +7 -7
  185. data/lib/active_merchant/billing/gateways/transnational.rb +1 -1
  186. data/lib/active_merchant/billing/gateways/trexle.rb +5 -5
  187. data/lib/active_merchant/billing/gateways/trust_commerce.rb +38 -38
  188. data/lib/active_merchant/billing/gateways/usa_epay.rb +3 -3
  189. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +37 -37
  190. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +3 -3
  191. data/lib/active_merchant/billing/gateways/vanco.rb +25 -25
  192. data/lib/active_merchant/billing/gateways/verifi.rb +40 -40
  193. data/lib/active_merchant/billing/gateways/viaklix.rb +5 -5
  194. data/lib/active_merchant/billing/gateways/visanet_peru.rb +64 -36
  195. data/lib/active_merchant/billing/gateways/webpay.rb +8 -8
  196. data/lib/active_merchant/billing/gateways/wepay.rb +25 -25
  197. data/lib/active_merchant/billing/gateways/wirecard.rb +26 -26
  198. data/lib/active_merchant/billing/gateways/worldpay.rb +15 -15
  199. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +42 -42
  200. data/lib/active_merchant/billing/gateways/worldpay_us.rb +17 -17
  201. data/lib/active_merchant/billing/model.rb +2 -2
  202. data/lib/active_merchant/billing/network_tokenization_credit_card.rb +1 -1
  203. data/lib/active_merchant/billing/rails.rb +1 -1
  204. data/lib/active_merchant/connection.rb +10 -8
  205. data/lib/active_merchant/country.rb +1 -1
  206. data/lib/active_merchant/net_http_ssl_connection.rb +1 -0
  207. data/lib/active_merchant/network_connection_retries.rb +12 -12
  208. data/lib/active_merchant/post_data.rb +1 -1
  209. data/lib/active_merchant/posts_data.rb +1 -1
  210. data/lib/active_merchant/version.rb +1 -1
  211. data/lib/certs/cacert.pem +37 -0
  212. data/lib/support/gateway_support.rb +2 -2
  213. data/lib/support/ssl_verify.rb +5 -5
  214. data/lib/support/ssl_version.rb +7 -7
  215. metadata +3 -7
  216. data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +0 -246
  217. data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +0 -13
  218. data/lib/active_merchant/billing/gateways/ideal/ideal_response.rb +0 -29
  219. data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +0 -66
@@ -55,7 +55,7 @@ module ActiveMerchant #:nodoc:
55
55
 
56
56
  action = if payment.respond_to?(:number)
57
57
  add_payment(post, payment)
58
- "/authorizations"
58
+ '/authorizations'
59
59
  elsif payment.kind_of?(String)
60
60
  "/cards/#{payment}/authorizations"
61
61
  else
@@ -97,7 +97,7 @@ module ActiveMerchant #:nodoc:
97
97
  post = {}
98
98
  add_payment(post, credit_card)
99
99
 
100
- commit("/cards", post)
100
+ commit('/cards', post)
101
101
  end
102
102
 
103
103
  def supports_scrubbing?
@@ -139,8 +139,8 @@ module ActiveMerchant #:nodoc:
139
139
 
140
140
  def headers(api_key)
141
141
  {
142
- "Authorization" => "Basic " + Base64.strict_encode64("#{api_key}:"),
143
- "User-Agent" => "Clearhaus ActiveMerchantBindings/#{ActiveMerchant::VERSION}"
142
+ 'Authorization' => 'Basic ' + Base64.strict_encode64("#{api_key}:"),
143
+ 'User-Agent' => "Clearhaus ActiveMerchantBindings/#{ActiveMerchant::VERSION}"
144
144
  }
145
145
  end
146
146
 
@@ -155,7 +155,7 @@ module ActiveMerchant #:nodoc:
155
155
 
156
156
  if @options[:signing_key] && @options[:private_key]
157
157
  begin
158
- headers["Signature"] = generate_signature(body)
158
+ headers['Signature'] = generate_signature(body)
159
159
  rescue OpenSSL::PKey::RSAError => e
160
160
  return Response.new(false, e.message)
161
161
  end
@@ -65,15 +65,15 @@ module ActiveMerchant #:nodoc:
65
65
  post[:state] = address[:state]
66
66
  post[:postalCode] = address[:zip]
67
67
  end
68
- post[:countryCode] = ((address && address[:country]) || "US")
68
+ post[:countryCode] = ((address && address[:country]) || 'US')
69
69
  end
70
70
 
71
71
  def add_auth_purchase_options(post, money, options)
72
72
  add_address(post, options[:address])
73
73
 
74
- post[:customerIP] = options[:ip] || "127.0.0.1"
74
+ post[:customerIP] = options[:ip] || '127.0.0.1'
75
75
  post[:amount] = amount(money)
76
- post[:email] = options[:email] || "unknown@example.com"
76
+ post[:email] = options[:email] || 'unknown@example.com'
77
77
  post[:currencyCode]= options[:currency] || currency(money)
78
78
  post[:merchAcct] = options[:merchant]
79
79
 
@@ -127,8 +127,8 @@ module ActiveMerchant #:nodoc:
127
127
  if response['returnText'].present?
128
128
  response['returnText']
129
129
  else
130
- "Invalid response received from the CommerceGate API. " +
131
- "Please contact CommerceGate support if you continue to receive this message. " +
130
+ 'Invalid response received from the CommerceGate API. ' +
131
+ 'Please contact CommerceGate support if you continue to receive this message. ' +
132
132
  "(The raw response returned by the API was #{response.inspect})"
133
133
  end
134
134
  end
@@ -136,7 +136,7 @@ module ActiveMerchant #:nodoc:
136
136
  def post_data(parameters)
137
137
  parameters.collect do |key, value|
138
138
  "#{key}=#{CGI.escape(value.to_s)}"
139
- end.join("&")
139
+ end.join('&')
140
140
  end
141
141
  end
142
142
  end
@@ -23,7 +23,7 @@ module ActiveMerchant #:nodoc:
23
23
  add_payment_source(post, payment_source, options)
24
24
  add_details_data(post, options)
25
25
 
26
- commit(:post, 'charges', post)
26
+ commit(:post, 'charges', post, options)
27
27
  end
28
28
 
29
29
  def authorize(money, payment_source, options = {})
@@ -34,7 +34,7 @@ module ActiveMerchant #:nodoc:
34
34
  add_details_data(post, options)
35
35
 
36
36
  post[:capture] = false
37
- commit(:post, "charges", post)
37
+ commit(:post, 'charges', post, options)
38
38
  end
39
39
 
40
40
  def capture(money, identifier, options = {})
@@ -43,7 +43,7 @@ module ActiveMerchant #:nodoc:
43
43
  post[:order_id] = identifier
44
44
  add_order(post, money, options)
45
45
 
46
- commit(:post, "charges/#{identifier}/capture", post)
46
+ commit(:post, "charges/#{identifier}/capture", post, options)
47
47
  end
48
48
 
49
49
  def refund(money, identifier, options)
@@ -52,12 +52,12 @@ module ActiveMerchant #:nodoc:
52
52
  post[:order_id] = identifier
53
53
  add_order(post, money, options)
54
54
 
55
- commit(:post, "charges/#{identifier}/refund", post)
55
+ commit(:post, "charges/#{identifier}/refund", post, options)
56
56
  end
57
57
 
58
58
  def void(identifier, options = {})
59
59
  post = {}
60
- commit(:post, "charges/#{identifier}/void", post)
60
+ commit(:post, "charges/#{identifier}/void", post, options)
61
61
  end
62
62
 
63
63
  def supports_scrubbing
@@ -74,7 +74,7 @@ module ActiveMerchant #:nodoc:
74
74
  private
75
75
 
76
76
  def add_order(post, money, options)
77
- post[:description] = options[:description] || "Active Merchant Purchase"
77
+ post[:description] = options[:description] || 'Active Merchant Purchase'
78
78
  post[:reference_id] = options[:order_id] if options[:order_id]
79
79
  post[:currency] = (options[:currency] || currency(money)).downcase
80
80
  post[:monthly_installments] = options[:monthly_installments] if options[:monthly_installments]
@@ -173,23 +173,28 @@ module ActiveMerchant #:nodoc:
173
173
  JSON.parse(body)
174
174
  end
175
175
 
176
- def headers(meta)
176
+ def headers(options)
177
177
  {
178
- "Accept" => "application/vnd.conekta-v#{options[:version]}+json",
179
- "Accept-Language" => "es",
180
- "Authorization" => "Basic " + Base64.encode64("#{options[:key]}:"),
181
- "RaiseHtmlError" => "false",
182
- "Conekta-Client-User-Agent" => {"agent"=>"Conekta ActiveMerchantBindings/#{ActiveMerchant::VERSION}"}.to_json,
183
- "X-Conekta-Client-User-Agent" => user_agent,
184
- "X-Conekta-Client-User-Metadata" => meta.to_json
178
+ 'Accept' => "application/vnd.conekta-v#{@options[:version]}+json",
179
+ 'Accept-Language' => 'es',
180
+ 'Authorization' => 'Basic ' + Base64.encode64("#{@options[:key]}:"),
181
+ 'RaiseHtmlError' => 'false',
182
+ 'Conekta-Client-User-Agent' => {'agent'=>"Conekta ActiveMerchantBindings/#{ActiveMerchant::VERSION}"}.to_json,
183
+ 'X-Conekta-Client-User-Agent' => conekta_client_user_agent(options),
184
+ 'X-Conekta-Client-User-Metadata' => options[:meta].to_json
185
185
  }
186
186
  end
187
187
 
188
+ def conekta_client_user_agent(options)
189
+ return user_agent unless options[:application]
190
+ JSON.dump(JSON.parse(user_agent).merge!({application: options[:application]}))
191
+ end
192
+
188
193
  def commit(method, url, parameters, options = {})
189
194
  success = false
190
195
  begin
191
- raw_response = parse(ssl_request(method, live_url + url, (parameters ? parameters.to_query : nil), headers(options[:meta])))
192
- success = (raw_response.key?("object") && (raw_response["object"] != "error"))
196
+ raw_response = parse(ssl_request(method, live_url + url, (parameters ? parameters.to_query : nil), headers(options)))
197
+ success = (raw_response.key?('object') && (raw_response['object'] != 'error'))
193
198
  rescue ResponseError => e
194
199
  raw_response = response_error(e.response.body)
195
200
  rescue JSON::ParserError
@@ -198,10 +203,10 @@ module ActiveMerchant #:nodoc:
198
203
 
199
204
  Response.new(
200
205
  success,
201
- raw_response["message_to_purchaser"],
206
+ raw_response['message_to_purchaser'],
202
207
  raw_response,
203
208
  test: test?,
204
- authorization: raw_response["id"]
209
+ authorization: raw_response['id']
205
210
  )
206
211
  end
207
212
 
@@ -217,7 +222,7 @@ module ActiveMerchant #:nodoc:
217
222
  msg = 'Invalid response received from the Conekta API.'
218
223
  msg += " (The raw response returned by the API was #{raw_response.inspect})"
219
224
  {
220
- "message" => msg
225
+ 'message' => msg
221
226
  }
222
227
  end
223
228
  end
@@ -16,29 +16,29 @@ module ActiveMerchant #:nodoc:
16
16
  self.display_name = 'Creditcall'
17
17
 
18
18
  CVV_CODE = {
19
- "matched" => "M",
20
- "notmatched" => "N",
21
- "notchecked" => "P",
22
- "partialmatch" => "N"
19
+ 'matched' => 'M',
20
+ 'notmatched' => 'N',
21
+ 'notchecked' => 'P',
22
+ 'partialmatch' => 'N'
23
23
  }
24
24
 
25
25
  AVS_CODE = {
26
- "matched;matched" => "D",
27
- "matched;notchecked" =>"B",
28
- "matched;notmatched" => "A",
29
- "matched;partialmatch" => "A",
30
- "notchecked;matched" => "P",
31
- "notchecked;notchecked" =>"I",
32
- "notchecked;notmatched" => "I",
33
- "notchecked;partialmatch" => "I",
34
- "notmatched;matched" => "W",
35
- "notmatched;notchecked" =>"C",
36
- "notmatched;notmatched" => "C",
37
- "notmatched;partialmatch" => "C",
38
- "partialmatched;matched" => "W",
39
- "partialmatched;notchecked" =>"C",
40
- "partialmatched;notmatched" => "C",
41
- "partialmatched;partialmatch" => "C"
26
+ 'matched;matched' => 'D',
27
+ 'matched;notchecked' =>'B',
28
+ 'matched;notmatched' => 'A',
29
+ 'matched;partialmatch' => 'A',
30
+ 'notchecked;matched' => 'P',
31
+ 'notchecked;notchecked' =>'I',
32
+ 'notchecked;notmatched' => 'I',
33
+ 'notchecked;partialmatch' => 'I',
34
+ 'notmatched;matched' => 'W',
35
+ 'notmatched;notchecked' =>'C',
36
+ 'notmatched;notmatched' => 'C',
37
+ 'notmatched;partialmatch' => 'C',
38
+ 'partialmatched;matched' => 'W',
39
+ 'partialmatched;notchecked' =>'C',
40
+ 'partialmatched;notmatched' => 'C',
41
+ 'partialmatched;partialmatch' => 'C'
42
42
  }
43
43
 
44
44
  def initialize(options={})
@@ -68,7 +68,7 @@ module ActiveMerchant #:nodoc:
68
68
 
69
69
  def authorize(money, payment_method, options={})
70
70
  request = build_xml_request do |xml|
71
- add_transaction_details(xml, money, nil, "Auth", options)
71
+ add_transaction_details(xml, money, nil, 'Auth', options)
72
72
  add_terminal_details(xml, options)
73
73
  add_card_details(xml, payment_method, options)
74
74
  end
@@ -78,7 +78,7 @@ module ActiveMerchant #:nodoc:
78
78
 
79
79
  def capture(money, authorization, options={})
80
80
  request = build_xml_request do |xml|
81
- add_transaction_details(xml, money, authorization, "Conf", options)
81
+ add_transaction_details(xml, money, authorization, 'Conf', options)
82
82
  add_terminal_details(xml, options)
83
83
  end
84
84
 
@@ -87,7 +87,7 @@ module ActiveMerchant #:nodoc:
87
87
 
88
88
  def refund(money, authorization, options={})
89
89
  request = build_xml_request do |xml|
90
- add_transaction_details(xml, money, authorization, "Refund", options)
90
+ add_transaction_details(xml, money, authorization, 'Refund', options)
91
91
  add_terminal_details(xml, options)
92
92
  end
93
93
 
@@ -96,7 +96,7 @@ module ActiveMerchant #:nodoc:
96
96
 
97
97
  def void(authorization, options={})
98
98
  request = build_xml_request do |xml|
99
- add_transaction_details(xml, nil, authorization, "Void", options)
99
+ add_transaction_details(xml, nil, authorization, 'Void', options)
100
100
  add_terminal_details(xml, options)
101
101
  end
102
102
 
@@ -128,16 +128,16 @@ module ActiveMerchant #:nodoc:
128
128
  end
129
129
 
130
130
  def cvv_result_code_from(params)
131
- CVV_CODE[params["CSC"]]
131
+ CVV_CODE[params['CSC']]
132
132
  end
133
133
 
134
134
  def error_result_code_from(params)
135
- params["ErrorCode"]
135
+ params['ErrorCode']
136
136
  end
137
137
 
138
138
  def build_xml_request
139
139
  builder = Nokogiri::XML::Builder.new do |xml|
140
- xml.Request(type: "CardEaseXML", version: "1.0.0") do
140
+ xml.Request(type: 'CardEaseXML', version: '1.0.0') do
141
141
  yield(xml)
142
142
  end
143
143
  end
@@ -147,9 +147,9 @@ module ActiveMerchant #:nodoc:
147
147
  def add_transaction_details(xml, amount, authorization, type, options={})
148
148
  xml.TransactionDetails do
149
149
  xml.MessageType type
150
- xml.Amount(unit: "Minor"){ xml.text(amount) } if amount
150
+ xml.Amount(unit: 'Minor'){ xml.text(amount) } if amount
151
151
  xml.CardEaseReference authorization if authorization
152
- xml.VoidReason "01" if type == "Void"
152
+ xml.VoidReason '01' if type == 'Void'
153
153
  end
154
154
  end
155
155
 
@@ -157,7 +157,7 @@ module ActiveMerchant #:nodoc:
157
157
  xml.TerminalDetails do
158
158
  xml.TerminalID @options[:terminal_id]
159
159
  xml.TransactionKey @options[:transaction_key]
160
- xml.Software(version: "SoftwareVersion"){ xml.text("SoftwareName") }
160
+ xml.Software(version: 'SoftwareVersion'){ xml.text('SoftwareName') }
161
161
  end
162
162
  end
163
163
 
@@ -191,12 +191,12 @@ module ActiveMerchant #:nodoc:
191
191
  response = {}
192
192
  xml = Nokogiri::XML(body)
193
193
 
194
- node = xml.xpath("//Response/TransactionDetails")
194
+ node = xml.xpath('//Response/TransactionDetails')
195
195
  node.children.each do |childnode|
196
196
  response[childnode.name] = childnode.text
197
197
  end
198
198
 
199
- node = xml.xpath("//Response/Result")
199
+ node = xml.xpath('//Response/Result')
200
200
  node.children.each do |childnode|
201
201
  if childnode.elements.empty?
202
202
  response[childnode.name] = childnode.text
@@ -205,7 +205,7 @@ module ActiveMerchant #:nodoc:
205
205
  end
206
206
  end
207
207
 
208
- node = xml.xpath("//Response/CardDetails")
208
+ node = xml.xpath('//Response/CardDetails')
209
209
  node.children.each do |childnode|
210
210
  if childnode.elements.empty?
211
211
  response[childnode.name] = childnode.text
@@ -220,9 +220,9 @@ module ActiveMerchant #:nodoc:
220
220
 
221
221
  def childnode_to_response(response, childnode)
222
222
  childnode.elements.each do |element|
223
- if element.name == "Error"
224
- response["ErrorCode"] = element.attr("code")
225
- response["ErrorMessage"] = element.text
223
+ if element.name == 'Error'
224
+ response['ErrorCode'] = element.attr('code')
225
+ response['ErrorMessage'] = element.text
226
226
  else
227
227
  response[element.name] = element.text
228
228
  end
@@ -249,23 +249,23 @@ module ActiveMerchant #:nodoc:
249
249
  end
250
250
 
251
251
  def success_from(response)
252
- response["LocalResult"] == "0" || response["LocalResult"] == "00"
252
+ response['LocalResult'] == '0' || response['LocalResult'] == '00'
253
253
  end
254
254
 
255
255
  def message_from(response)
256
256
  if success_from(response)
257
- "Succeeded"
257
+ 'Succeeded'
258
258
  else
259
- response["ErrorMessage"]
259
+ response['ErrorMessage']
260
260
  end
261
261
  end
262
262
 
263
263
  def authorization_from(response)
264
- response["CardEaseReference"]
264
+ response['CardEaseReference']
265
265
  end
266
266
 
267
267
  def manual_type(options)
268
- options[:manual_type] ? options[:manual_type] : "ecommerce"
268
+ options[:manual_type] || 'ecommerce'
269
269
  end
270
270
  end
271
271
  end
@@ -3,10 +3,10 @@ module ActiveMerchant #:nodoc:
3
3
  class CredoraxGateway < Gateway
4
4
  class_attribute :test_url, :live_na_url, :live_eu_url
5
5
 
6
- self.display_name = "Credorax Gateway"
7
- self.homepage_url = "https://www.credorax.com/"
6
+ self.display_name = 'Credorax Gateway'
7
+ self.homepage_url = 'https://www.credorax.com/'
8
8
 
9
- self.test_url = "https://intconsole.credorax.com/intenv/service/gateway"
9
+ self.test_url = 'https://intconsole.credorax.com/intenv/service/gateway'
10
10
 
11
11
  # The live URL is assigned on a per merchant basis once certification has passed
12
12
  # See the Credorax remote tests for the full certification test suite
@@ -16,7 +16,7 @@ module ActiveMerchant #:nodoc:
16
16
  self.live_url = 'https://assigned-subdomain.credorax.net/crax_gate/service/gateway'
17
17
 
18
18
  self.supported_countries = %w(DE GB FR IT ES PL NL BE GR CZ PT SE HU RS AT CH BG DK FI SK NO IE HR BA AL LT MK SI LV EE ME LU MT IS AD MC LI SM)
19
- self.default_currency = "EUR"
19
+ self.default_currency = 'EUR'
20
20
  self.currencies_without_fractions = %w(CLP JPY KRW PYG VND)
21
21
  self.currencies_with_three_decimal_places = %w(BHD JOD KWD OMR RSD TND)
22
22
 
@@ -24,96 +24,96 @@ module ActiveMerchant #:nodoc:
24
24
  self.supported_cardtypes = [:visa, :master, :maestro]
25
25
 
26
26
  RESPONSE_MESSAGES = {
27
- "00" => "Approved or completed successfully",
28
- "01" => "Refer to card issuer",
29
- "02" => "Refer to card issuer special condition",
30
- "03" => "Invalid merchant",
31
- "04" => "Pick up card",
32
- "05" => "Do not Honour",
33
- "06" => "Error",
34
- "07" => "Pick up card special condition",
35
- "08" => "Honour with identification",
36
- "09" => "Request in progress",
37
- "10" => "Approved for partial amount",
38
- "11" => "Approved (VIP)",
39
- "12" => "Invalid transaction",
40
- "13" => "Invalid amount",
41
- "14" => "Invalid card number",
42
- "15" => "No such issuer",
43
- "16" => "Approved, update track 3",
44
- "17" => "Customer cancellation",
45
- "18" => "Customer dispute",
46
- "19" => "Re-enter transaction",
47
- "20" => "Invalid response",
48
- "21" => "No action taken",
49
- "22" => "Suspected malfunction",
50
- "23" => "Unacceptable transaction fee",
51
- "24" => "File update not supported by receiver",
52
- "25" => "No such record",
53
- "26" => "Duplicate record update, old record replaced",
54
- "27" => "File update field edit error",
55
- "28" => "File locked out while update",
56
- "29" => "File update error, contact acquirer",
57
- "30" => "Format error",
58
- "31" => "Issuer signed-off",
59
- "32" => "Completed partially",
60
- "33" => "Pick-up, expired card",
61
- "34" => "Suspect Fraud",
62
- "35" => "Pick-up, card acceptor contact acquirer",
63
- "36" => "Pick up, card restricted",
64
- "37" => "Pick up, call acquirer security",
65
- "38" => "Pick up, Allowable PIN tries exceeded",
66
- "39" => "Transaction Not Allowed",
67
- "40" => "Requested function not supported",
68
- "41" => "Lost Card, Pickup",
69
- "42" => "No universal account",
70
- "43" => "Pick up, stolen card",
71
- "44" => "No investment account",
72
- "50" => "Do not renew",
73
- "51" => "Not sufficient funds",
74
- "52" => "No checking Account",
75
- "53" => "No savings account",
76
- "54" => "Expired card",
77
- "55" => "Pin incorrect",
78
- "56" => "No card record",
79
- "57" => "Transaction not allowed for cardholder",
80
- "58" => "Transaction not allowed for merchant",
81
- "59" => "Suspected Fraud",
82
- "60" => "Card acceptor contact acquirer",
83
- "61" => "Exceeds withdrawal amount limit",
84
- "62" => "Restricted card",
85
- "63" => "Security violation",
86
- "64" => "Wrong original amount",
87
- "65" => "Activity count limit exceeded",
88
- "66" => "Call acquirers security department",
89
- "67" => "Card to be picked up at ATM",
90
- "68" => "Response received too late.",
91
- "70" => "Invalid transaction; contact card issuer",
92
- "71" => "Decline PIN not changed",
93
- "75" => "Pin tries exceeded",
94
- "76" => "Wrong PIN, number of PIN tries exceeded",
95
- "77" => "Wrong Reference No.",
96
- "78" => "Record Not Found",
97
- "79" => "Already reversed",
98
- "80" => "Network error",
99
- "81" => "Foreign network error / PIN cryptographic error",
100
- "82" => "Time out at issuer system",
101
- "83" => "Transaction failed",
102
- "84" => "Pre-authorization timed out",
103
- "85" => "No reason to decline",
104
- "86" => "Cannot verify pin",
105
- "87" => "Purchase amount only, no cashback allowed",
106
- "88" => "MAC sync Error",
107
- "89" => "Authentication failure",
108
- "91" => "Issuer not available",
109
- "92" => "Unable to route at acquirer Module",
110
- "93" => "Cannot be completed, violation of law",
111
- "94" => "Duplicate Transmission",
112
- "95" => "Reconcile error / Auth Not found",
113
- "96" => "System malfunction",
114
- "R0" => "Stop Payment Order",
115
- "R1" => "Revocation of Authorisation Order",
116
- "R3" => "Revocation of all Authorisations Order"
27
+ '00' => 'Approved or completed successfully',
28
+ '01' => 'Refer to card issuer',
29
+ '02' => 'Refer to card issuer special condition',
30
+ '03' => 'Invalid merchant',
31
+ '04' => 'Pick up card',
32
+ '05' => 'Do not Honour',
33
+ '06' => 'Error',
34
+ '07' => 'Pick up card special condition',
35
+ '08' => 'Honour with identification',
36
+ '09' => 'Request in progress',
37
+ '10' => 'Approved for partial amount',
38
+ '11' => 'Approved (VIP)',
39
+ '12' => 'Invalid transaction',
40
+ '13' => 'Invalid amount',
41
+ '14' => 'Invalid card number',
42
+ '15' => 'No such issuer',
43
+ '16' => 'Approved, update track 3',
44
+ '17' => 'Customer cancellation',
45
+ '18' => 'Customer dispute',
46
+ '19' => 'Re-enter transaction',
47
+ '20' => 'Invalid response',
48
+ '21' => 'No action taken',
49
+ '22' => 'Suspected malfunction',
50
+ '23' => 'Unacceptable transaction fee',
51
+ '24' => 'File update not supported by receiver',
52
+ '25' => 'No such record',
53
+ '26' => 'Duplicate record update, old record replaced',
54
+ '27' => 'File update field edit error',
55
+ '28' => 'File locked out while update',
56
+ '29' => 'File update error, contact acquirer',
57
+ '30' => 'Format error',
58
+ '31' => 'Issuer signed-off',
59
+ '32' => 'Completed partially',
60
+ '33' => 'Pick-up, expired card',
61
+ '34' => 'Suspect Fraud',
62
+ '35' => 'Pick-up, card acceptor contact acquirer',
63
+ '36' => 'Pick up, card restricted',
64
+ '37' => 'Pick up, call acquirer security',
65
+ '38' => 'Pick up, Allowable PIN tries exceeded',
66
+ '39' => 'Transaction Not Allowed',
67
+ '40' => 'Requested function not supported',
68
+ '41' => 'Lost Card, Pickup',
69
+ '42' => 'No universal account',
70
+ '43' => 'Pick up, stolen card',
71
+ '44' => 'No investment account',
72
+ '50' => 'Do not renew',
73
+ '51' => 'Not sufficient funds',
74
+ '52' => 'No checking Account',
75
+ '53' => 'No savings account',
76
+ '54' => 'Expired card',
77
+ '55' => 'Pin incorrect',
78
+ '56' => 'No card record',
79
+ '57' => 'Transaction not allowed for cardholder',
80
+ '58' => 'Transaction not allowed for merchant',
81
+ '59' => 'Suspected Fraud',
82
+ '60' => 'Card acceptor contact acquirer',
83
+ '61' => 'Exceeds withdrawal amount limit',
84
+ '62' => 'Restricted card',
85
+ '63' => 'Security violation',
86
+ '64' => 'Wrong original amount',
87
+ '65' => 'Activity count limit exceeded',
88
+ '66' => 'Call acquirers security department',
89
+ '67' => 'Card to be picked up at ATM',
90
+ '68' => 'Response received too late.',
91
+ '70' => 'Invalid transaction; contact card issuer',
92
+ '71' => 'Decline PIN not changed',
93
+ '75' => 'Pin tries exceeded',
94
+ '76' => 'Wrong PIN, number of PIN tries exceeded',
95
+ '77' => 'Wrong Reference No.',
96
+ '78' => 'Record Not Found',
97
+ '79' => 'Already reversed',
98
+ '80' => 'Network error',
99
+ '81' => 'Foreign network error / PIN cryptographic error',
100
+ '82' => 'Time out at issuer system',
101
+ '83' => 'Transaction failed',
102
+ '84' => 'Pre-authorization timed out',
103
+ '85' => 'No reason to decline',
104
+ '86' => 'Cannot verify pin',
105
+ '87' => 'Purchase amount only, no cashback allowed',
106
+ '88' => 'MAC sync Error',
107
+ '89' => 'Authentication failure',
108
+ '91' => 'Issuer not available',
109
+ '92' => 'Unable to route at acquirer Module',
110
+ '93' => 'Cannot be completed, violation of law',
111
+ '94' => 'Duplicate Transmission',
112
+ '95' => 'Reconcile error / Auth Not found',
113
+ '96' => 'System malfunction',
114
+ 'R0' => 'Stop Payment Order',
115
+ 'R1' => 'Revocation of Authorisation Order',
116
+ 'R3' => 'Revocation of all Authorisations Order'
117
117
  }
118
118
 
119
119
  def initialize(options={})
@@ -215,12 +215,13 @@ module ActiveMerchant #:nodoc:
215
215
  post[:a1] = generate_unique_id
216
216
  post[:a5] = currency
217
217
  post[:h9] = options[:order_id]
218
+ post[:i2] = options[:billing_descriptor] if options[:billing_descriptor]
218
219
  end
219
220
 
220
221
  CARD_TYPES = {
221
- "visa" => '1',
222
- "mastercard" => '2',
223
- "maestro" => '9'
222
+ 'visa' => '1',
223
+ 'mastercard' => '2',
224
+ 'maestro' => '9'
224
225
  }
225
226
 
226
227
  def add_payment_method(post, payment_method)
@@ -245,7 +246,7 @@ module ActiveMerchant #:nodoc:
245
246
  end
246
247
 
247
248
  def add_reference(post, authorization)
248
- response_id, authorization_code, request_id, action = authorization.split(";")
249
+ response_id, authorization_code, request_id, action = authorization.split(';')
249
250
  post[:g2] = response_id
250
251
  post[:g3] = authorization_code
251
252
  post[:g4] = request_id
@@ -292,8 +293,8 @@ module ActiveMerchant #:nodoc:
292
293
  message_from(response),
293
294
  response,
294
295
  authorization: "#{response["Z1"]};#{response["Z4"]};#{response["A1"]};#{action}",
295
- avs_result: AVSResult.new(code: response["Z9"]),
296
- cvv_result: CVVResult.new(response["Z14"]),
296
+ avs_result: AVSResult.new(code: response['Z9']),
297
+ cvv_result: CVVResult.new(response['Z14']),
297
298
  test: test?
298
299
  )
299
300
  end
@@ -330,14 +331,14 @@ module ActiveMerchant #:nodoc:
330
331
  end
331
332
 
332
333
  def success_from(response)
333
- response["Z2"] == "0"
334
+ response['Z2'] == '0'
334
335
  end
335
336
 
336
337
  def message_from(response)
337
338
  if success_from(response)
338
- "Succeeded"
339
+ 'Succeeded'
339
340
  else
340
- RESPONSE_MESSAGES[response["Z6"]] || response["Z3"] || "Unable to read error message"
341
+ RESPONSE_MESSAGES[response['Z6']] || response['Z3'] || 'Unable to read error message'
341
342
  end
342
343
  end
343
344
  end