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
@@ -21,21 +21,21 @@ module ActiveMerchant #:nodoc:
21
21
 
22
22
  def purchase(money, payment, options={})
23
23
  MultiResponse.run do |r|
24
- r.process { commit("auth/token", app_token_request(options)) }
24
+ r.process { commit('auth/token', app_token_request(options)) }
25
25
  r.process { commit('payments', purchase_request(money, payment, options), options.merge({ app_token: app_token_from(r) })) }
26
26
  end
27
27
  end
28
28
 
29
29
  def refund(money, authorization, options={})
30
30
  MultiResponse.run do |r|
31
- r.process { commit("auth/token", app_token_request(options)) }
31
+ r.process { commit('auth/token', app_token_request(options)) }
32
32
  r.process { commit('payments', refund_request(money, authorization, options), options.merge({ app_token: app_token_from(r) })) }
33
33
  end
34
34
  end
35
35
 
36
36
  def store(payment, options = {})
37
37
  MultiResponse.run do |r|
38
- r.process { commit("auth/token", app_token_request(options)) }
38
+ r.process { commit('auth/token', app_token_request(options)) }
39
39
  options.merge!({ app_token: app_token_from(r) })
40
40
 
41
41
  if options[:customer_id].present?
@@ -78,7 +78,7 @@ module ActiveMerchant #:nodoc:
78
78
  end
79
79
 
80
80
  def add_split(post, options)
81
- return unless options[:payment_type] == "card_split" || options[:payment_type] == "token_split"
81
+ return unless options[:payment_type] == 'card_split' || options[:payment_type] == 'token_split'
82
82
 
83
83
  post[:data][:attributes][:split] = {
84
84
  merchantId: options[:split_merchant_id],
@@ -115,19 +115,19 @@ module ActiveMerchant #:nodoc:
115
115
  def add_address(post, options)
116
116
  if address = options[:billing_address] || options[:address]
117
117
  post[:data][:attributes][:billingAddress] = {
118
- line1: address[:address1] || "",
119
- line2: address[:address2] || "",
120
- city: address[:city] || "",
121
- state: address[:state] || "",
122
- zip: address[:zip] || "",
123
- country: address["country"] || "USA"
118
+ line1: address[:address1] || '',
119
+ line2: address[:address2] || '',
120
+ city: address[:city] || '',
121
+ state: address[:state] || '',
122
+ zip: address[:zip] || '',
123
+ country: address['country'] || 'USA'
124
124
  }
125
125
  end
126
126
  end
127
127
 
128
128
  def app_token_request(options)
129
129
  post = new_post
130
- post[:data][:type] = "auth"
130
+ post[:data][:type] = 'auth'
131
131
  post[:data][:attributes] = { appKey: @options[:app_key] }
132
132
 
133
133
  post
@@ -135,7 +135,7 @@ module ActiveMerchant #:nodoc:
135
135
 
136
136
  def purchase_request(money, payment, options)
137
137
  post = new_post
138
- post[:data][:type] = "payments"
138
+ post[:data][:type] = 'payments'
139
139
  post[:data][:attributes][:merchantId] = options[:merchant_id]
140
140
  post[:data][:attributes][:paymentType] = determine_payment_type(payment, options)
141
141
  add_split(post, options)
@@ -148,9 +148,9 @@ module ActiveMerchant #:nodoc:
148
148
 
149
149
  def refund_request(money, authorization, options)
150
150
  post = new_post
151
- post[:data][:type] = "payments"
151
+ post[:data][:type] = 'payments'
152
152
  post[:data][:attributes][:merchantId] = options[:merchant_id]
153
- post[:data][:attributes][:paymentType] = "cardRefund"
153
+ post[:data][:attributes][:paymentType] = 'cardRefund'
154
154
  post[:data][:attributes][:originalTransaction] = {id: authorization}
155
155
  add_transaction(post, money, options)
156
156
 
@@ -159,7 +159,7 @@ module ActiveMerchant #:nodoc:
159
159
 
160
160
  def create_customer_request(payment, options)
161
161
  post = new_post
162
- post[:data][:type] = "customers"
162
+ post[:data][:type] = 'customers'
163
163
  post[:data][:attributes] = {
164
164
  merchantId: options[:merchant_id],
165
165
  name: payment.name,
@@ -171,11 +171,11 @@ module ActiveMerchant #:nodoc:
171
171
 
172
172
  def create_token_request(payment, options)
173
173
  post = new_post
174
- post[:data][:type] = "tokens"
174
+ post[:data][:type] = 'tokens'
175
175
  post[:data][:attributes] = {
176
- tokenType: "card",
176
+ tokenType: 'card',
177
177
  customerId: options[:customer_id],
178
- label: "Credit Card",
178
+ label: 'Credit Card',
179
179
  }
180
180
  add_payment(post, payment, options)
181
181
  add_address(post, options)
@@ -187,7 +187,7 @@ module ActiveMerchant #:nodoc:
187
187
  url = (test? ? test_url : live_url)
188
188
  response = parse(ssl_get(url + "/customers/#{options[:customer_id]}", headers(options)))
189
189
 
190
- return response.try(:[], "data").try(:[], "customerId") if success_from(response)
190
+ return response.try(:[], 'data').try(:[], 'customerId') if success_from(response)
191
191
  return nil
192
192
  end
193
193
 
@@ -222,33 +222,33 @@ module ActiveMerchant #:nodoc:
222
222
  end
223
223
 
224
224
  def success_from(response)
225
- response["errors"].nil? && response["message"].nil?
225
+ response['errors'].nil? && response['message'].nil?
226
226
  end
227
227
 
228
228
  def message_from(response)
229
- return response["message"] if response["message"]
230
- return "Success" if success_from(response)
231
- response["errors"].map {|error_hash| error_hash["detail"] }.join(", ")
229
+ return response['message'] if response['message']
230
+ return 'Success' if success_from(response)
231
+ response['errors'].map {|error_hash| error_hash['detail'] }.join(', ')
232
232
  end
233
233
 
234
234
  def authorization_from(response)
235
- if customer_id = response.try(:[], "data").try(:[], "attributes").try(:[], "customerId")
235
+ if customer_id = response.try(:[], 'data').try(:[], 'attributes').try(:[], 'customerId')
236
236
  "#{customer_id}|#{response.try(:[], "data").try(:[], "id")}"
237
237
  else
238
- response.try(:[], "data").try(:[], "id")
238
+ response.try(:[], 'data').try(:[], 'id')
239
239
  end
240
240
  end
241
241
 
242
242
  def avs_result_from(response)
243
- response.try(:[], "data").try(:[], "attributes").try(:[], "transaction").try(:[], "avsResult")
243
+ response.try(:[], 'data').try(:[], 'attributes').try(:[], 'transaction').try(:[], 'avsResult')
244
244
  end
245
245
 
246
246
  def cvv_result_from(response)
247
- response.try(:[], "data").try(:[], "attributes").try(:[], "transaction").try(:[], "codeResult")
247
+ response.try(:[], 'data').try(:[], 'attributes').try(:[], 'transaction').try(:[], 'codeResult')
248
248
  end
249
249
 
250
250
  def app_token_from(response)
251
- response.params.try(:[], "data").try(:[], "attributes").try(:[], "appToken")
251
+ response.params.try(:[], 'data').try(:[], 'attributes').try(:[], 'appToken')
252
252
  end
253
253
 
254
254
  def headers(options)
@@ -257,26 +257,26 @@ module ActiveMerchant #:nodoc:
257
257
  'x-api-key' => @options[:api_key]
258
258
  }
259
259
 
260
- headers.merge!({"Authorization" => "Bearer #{options[:app_token]}"}) if options[:app_token]
260
+ headers.merge!({'Authorization' => "Bearer #{options[:app_token]}"}) if options[:app_token]
261
261
  headers
262
262
  end
263
263
 
264
264
  def error_code_from(response)
265
265
  unless success_from(response)
266
- response["errors"].nil? ? response["message"] : response["errors"].map {|error_hash| error_hash["code"] }.join(", ")
266
+ response['errors'].nil? ? response['message'] : response['errors'].map {|error_hash| error_hash['code'] }.join(', ')
267
267
  end
268
268
  end
269
269
 
270
270
  def split_authorization(authorization)
271
- customer_id, token = authorization.split("|")
271
+ customer_id, token = authorization.split('|')
272
272
  [customer_id, token]
273
273
  end
274
274
 
275
275
  def determine_payment_type(payment, options)
276
- return "cardSplit" if options[:payment_type] == "card_split"
277
- return "tokenSplit" if options[:payment_type] == "token_split"
278
- return "token" if payment.is_a? String
279
- "card"
276
+ return 'cardSplit' if options[:payment_type] == 'card_split'
277
+ return 'tokenSplit' if options[:payment_type] == 'token_split'
278
+ return 'token' if payment.is_a? String
279
+ 'card'
280
280
  end
281
281
 
282
282
  def handle_response(response)
@@ -12,20 +12,20 @@ module ActiveMerchant #:nodoc:
12
12
  self.display_name = 'Ebanx'
13
13
 
14
14
  CARD_BRAND = {
15
- visa: "visa",
16
- master: "master_card",
17
- american_express: "amex",
18
- discover: "discover",
19
- diners_club: "diners"
15
+ visa: 'visa',
16
+ master: 'master_card',
17
+ american_express: 'amex',
18
+ discover: 'discover',
19
+ diners_club: 'diners'
20
20
  }
21
21
 
22
22
  URL_MAP = {
23
- purchase: "direct",
24
- authorize: "direct",
25
- capture: "capture",
26
- refund: "refund",
27
- void: "cancel",
28
- store: "token"
23
+ purchase: 'direct',
24
+ authorize: 'direct',
25
+ capture: 'capture',
26
+ refund: 'refund',
27
+ void: 'cancel',
28
+ store: 'token'
29
29
  }
30
30
 
31
31
  HTTP_METHOD = {
@@ -131,7 +131,7 @@ module ActiveMerchant #:nodoc:
131
131
  end
132
132
 
133
133
  def add_operation(post)
134
- post[:operation] = "request"
134
+ post[:operation] = 'request'
135
135
  end
136
136
 
137
137
  def add_authorization(post, authorization)
@@ -140,7 +140,7 @@ module ActiveMerchant #:nodoc:
140
140
 
141
141
  def add_customer_data(post, payment, options)
142
142
  post[:payment][:name] = customer_name(payment, options)
143
- post[:payment][:email] = options[:email] || "unspecified@example.com"
143
+ post[:payment][:email] = options[:email] || 'unspecified@example.com'
144
144
  post[:payment][:document] = options[:document]
145
145
  post[:payment][:birth_date] = options[:birth_date] if options[:birth_date]
146
146
  end
@@ -157,7 +157,7 @@ module ActiveMerchant #:nodoc:
157
157
 
158
158
  def add_address(post, options)
159
159
  if address = options[:billing_address] || options[:address]
160
- post[:payment][:address] = address[:address1].split[1..-1].join(" ") if address[:address1]
160
+ post[:payment][:address] = address[:address1].split[1..-1].join(' ') if address[:address1]
161
161
  post[:payment][:street_number] = address[:address1].split.first if address[:address1]
162
162
  post[:payment][:city] = address[:city]
163
163
  post[:payment][:state] = address[:state]
@@ -176,7 +176,7 @@ module ActiveMerchant #:nodoc:
176
176
 
177
177
  def add_card_or_token(post, payment)
178
178
  if payment.is_a?(String)
179
- payment, brand = payment.split("|")
179
+ payment, brand = payment.split('|')
180
180
  end
181
181
  post[:payment][:payment_type_code] = payment.is_a?(String) ? brand : CARD_BRAND[payment.brand.to_sym]
182
182
  post[:payment][:creditcard] = payment_details(payment)
@@ -222,28 +222,28 @@ module ActiveMerchant #:nodoc:
222
222
 
223
223
  def success_from(action, response)
224
224
  if [:purchase, :capture, :refund].include?(action)
225
- response.try(:[], "payment").try(:[], "status") == "CO"
225
+ response.try(:[], 'payment').try(:[], 'status') == 'CO'
226
226
  elsif action == :authorize
227
- response.try(:[], "payment").try(:[], "status") == "PE"
227
+ response.try(:[], 'payment').try(:[], 'status') == 'PE'
228
228
  elsif action == :void
229
- response.try(:[], "payment").try(:[], "status") == "CA"
229
+ response.try(:[], 'payment').try(:[], 'status') == 'CA'
230
230
  elsif action == :store
231
- response.try(:[], "status") == "SUCCESS"
231
+ response.try(:[], 'status') == 'SUCCESS'
232
232
  else
233
233
  false
234
234
  end
235
235
  end
236
236
 
237
237
  def message_from(response)
238
- return response["status_message"] if response["status"] == "ERROR"
239
- response.try(:[], "payment").try(:[], "transaction_status").try(:[], "description")
238
+ return response['status_message'] if response['status'] == 'ERROR'
239
+ response.try(:[], 'payment').try(:[], 'transaction_status').try(:[], 'description')
240
240
  end
241
241
 
242
242
  def authorization_from(action, parameters, response)
243
243
  if action == :store
244
244
  "#{response.try(:[], "token")}|#{CARD_BRAND[parameters[:payment_type_code].to_sym]}"
245
245
  else
246
- response.try(:[], "payment").try(:[], "hash")
246
+ response.try(:[], 'payment').try(:[], 'hash')
247
247
  end
248
248
  end
249
249
 
@@ -267,13 +267,13 @@ module ActiveMerchant #:nodoc:
267
267
  parameters.map do |key, value|
268
268
  next if value != false && value.blank?
269
269
  "#{key}=#{value}"
270
- end.compact.join("&")
270
+ end.compact.join('&')
271
271
  end
272
272
 
273
273
  def error_code_from(response, success)
274
274
  unless success
275
- return response["status_code"] if response["status"] == "ERROR"
276
- response.try(:[], "payment").try(:[], "transaction_status").try(:[], "code")
275
+ return response['status_code'] if response['status'] == 'ERROR'
276
+ response.try(:[], 'payment').try(:[], 'transaction_status').try(:[], 'code')
277
277
  end
278
278
  end
279
279
 
@@ -286,7 +286,7 @@ module ActiveMerchant #:nodoc:
286
286
  def customer_name(payment, options)
287
287
  address_name = options[:billing_address][:name] if options[:billing_address] && options[:billing_address][:name]
288
288
  if payment.is_a?(String)
289
- address_name || "Not Provided"
289
+ address_name || 'Not Provided'
290
290
  else
291
291
  payment.name
292
292
  end
@@ -54,7 +54,7 @@ module ActiveMerchant #:nodoc:
54
54
 
55
55
  def void(identification, options = {})
56
56
  requires!(options, :order_id)
57
- original_transaction_id, _ = identification.split(";")
57
+ original_transaction_id, _ = identification.split(';')
58
58
  commit(:void_transaction, {:reference_number => format_reference_number(options[:order_id]), :transaction_id => original_transaction_id})
59
59
  end
60
60
 
@@ -77,7 +77,7 @@ module ActiveMerchant #:nodoc:
77
77
  private
78
78
 
79
79
  def build_refund_or_settle_request(money, identification, options = {})
80
- original_transaction_id, original_transaction_amount = identification.split(";")
80
+ original_transaction_id, original_transaction_amount = identification.split(';')
81
81
 
82
82
  requires!(options, :order_id)
83
83
 
@@ -139,8 +139,8 @@ module ActiveMerchant #:nodoc:
139
139
  post[:billing_name] = creditcard.name if creditcard.name
140
140
  post[:account_number] = creditcard.number
141
141
  post[:card_verification_value] = creditcard.verification_value if creditcard.verification_value?
142
- post[:expiration_month] = sprintf("%.2i", creditcard.month)
143
- post[:expiration_year] = sprintf("%.4i", creditcard.year)[-2..-1]
142
+ post[:expiration_month] = sprintf('%.2i', creditcard.month)
143
+ post[:expiration_year] = sprintf('%.4i', creditcard.year)[-2..-1]
144
144
  end
145
145
 
146
146
 
@@ -179,10 +179,10 @@ module ActiveMerchant #:nodoc:
179
179
 
180
180
  def post_data(action, parameters = {})
181
181
  xml = REXML::Document.new("<?xml version='1.0' encoding='UTF-8'?>")
182
- root = xml.add_element("Request")
183
- root.attributes["StoreID"] = options[:login]
184
- root.attributes["StoreKey"] = options[:password]
185
- root.attributes["ApplicationID"] = 'ot 1.0'
182
+ root = xml.add_element('Request')
183
+ root.attributes['StoreID'] = options[:login]
184
+ root.attributes['StoreKey'] = options[:password]
185
+ root.attributes['ApplicationID'] = 'ot 1.0'
186
186
  transaction = root.add_element(action.to_s.camelize)
187
187
 
188
188
  actions[action].each do |key|
@@ -194,7 +194,7 @@ module ActiveMerchant #:nodoc:
194
194
 
195
195
  def message_from(message)
196
196
  return 'Unspecified error' if message.blank?
197
- message.gsub(/[^\w]/, ' ').split.join(" ").capitalize
197
+ message.gsub(/[^\w]/, ' ').split.join(' ').capitalize
198
198
  end
199
199
 
200
200
  def actions
@@ -208,7 +208,7 @@ module ActiveMerchant #:nodoc:
208
208
  :credit_card_charge => CREDIT_CARD_FIELDS,
209
209
  :credit_card_voice_authorize => CREDIT_CARD_FIELDS,
210
210
  :credit_card_capture => CREDIT_CARD_FIELDS,
211
- :credit_card_credit => CREDIT_CARD_FIELDS + ["OriginalTransactionAmount"],
211
+ :credit_card_credit => CREDIT_CARD_FIELDS + ['OriginalTransactionAmount'],
212
212
  :credit_card_refund => %w(ReferenceNumber TransactionAmount OriginalTransactionAmount OriginalTransactionID ClientIpAddress),
213
213
  :void_transaction => %w(ReferenceNumber TransactionID),
214
214
  :credit_card_settle => %w(ReferenceNumber TransactionAmount OriginalTransactionAmount OriginalTransactionID ClientIpAddress),
@@ -96,7 +96,7 @@ module ActiveMerchant #:nodoc:
96
96
 
97
97
  def credit(money, creditcard, options = {})
98
98
  if creditcard.is_a?(String)
99
- raise ArgumentError, "Reference credits are not supported. Please supply the original credit card or use the #refund method."
99
+ raise ArgumentError, 'Reference credits are not supported. Please supply the original credit card or use the #refund method.'
100
100
  end
101
101
 
102
102
  form = {}
@@ -271,7 +271,7 @@ module ActiveMerchant #:nodoc:
271
271
  def post_data(parameters, options)
272
272
  result = preamble
273
273
  result.merge!(parameters)
274
- result.collect { |key, value| post_data_string(key, value, options) }.join("&")
274
+ result.collect { |key, value| post_data_string(key, value, options) }.join('&')
275
275
  end
276
276
 
277
277
  def post_data_string(key, value, options)
@@ -302,9 +302,9 @@ module ActiveMerchant #:nodoc:
302
302
  def parse(msg)
303
303
  resp = {}
304
304
  msg.split(self.delimiter).collect{|li|
305
- key, value = li.split("=")
306
- resp[key.to_s.strip.gsub(/^ssl_/, '')] = value.to_s.strip
307
- }
305
+ key, value = li.split('=')
306
+ resp[key.to_s.strip.gsub(/^ssl_/, '')] = value.to_s.strip
307
+ }
308
308
  resp
309
309
  end
310
310
 
@@ -23,10 +23,10 @@ module ActiveMerchant #:nodoc:
23
23
  end
24
24
 
25
25
  def purchase(money, payment, options={})
26
- action = payment.is_a?(Check) ? "CheckSale" : "CreditCardSale"
26
+ action = payment.is_a?(Check) ? 'CheckSale' : 'CreditCardSale'
27
27
 
28
28
  request = build_soap_request do |xml|
29
- xml.send(action, xmlns: "https://transaction.elementexpress.com") do
29
+ xml.send(action, xmlns: 'https://transaction.elementexpress.com') do
30
30
  add_credentials(xml)
31
31
  add_payment_method(xml, payment)
32
32
  add_transaction(xml, money, options)
@@ -40,7 +40,7 @@ module ActiveMerchant #:nodoc:
40
40
 
41
41
  def authorize(money, payment, options={})
42
42
  request = build_soap_request do |xml|
43
- xml.CreditCardAuthorization(xmlns: "https://transaction.elementexpress.com") do
43
+ xml.CreditCardAuthorization(xmlns: 'https://transaction.elementexpress.com') do
44
44
  add_credentials(xml)
45
45
  add_payment_method(xml, payment)
46
46
  add_transaction(xml, money, options)
@@ -57,7 +57,7 @@ module ActiveMerchant #:nodoc:
57
57
  options.merge!({trans_id: trans_id})
58
58
 
59
59
  request = build_soap_request do |xml|
60
- xml.CreditCardAuthorizationCompletion(xmlns: "https://transaction.elementexpress.com") do
60
+ xml.CreditCardAuthorizationCompletion(xmlns: 'https://transaction.elementexpress.com') do
61
61
  add_credentials(xml)
62
62
  add_transaction(xml, money, options)
63
63
  add_terminal(xml, options)
@@ -72,7 +72,7 @@ module ActiveMerchant #:nodoc:
72
72
  options.merge!({trans_id: trans_id})
73
73
 
74
74
  request = build_soap_request do |xml|
75
- xml.CreditCardReturn(xmlns: "https://transaction.elementexpress.com") do
75
+ xml.CreditCardReturn(xmlns: 'https://transaction.elementexpress.com') do
76
76
  add_credentials(xml)
77
77
  add_transaction(xml, money, options)
78
78
  add_terminal(xml, options)
@@ -84,10 +84,10 @@ module ActiveMerchant #:nodoc:
84
84
 
85
85
  def void(authorization, options={})
86
86
  trans_id, trans_amount = split_authorization(authorization)
87
- options.merge!({trans_id: trans_id, trans_amount: trans_amount, reversal_type: "Full"})
87
+ options.merge!({trans_id: trans_id, trans_amount: trans_amount, reversal_type: 'Full'})
88
88
 
89
89
  request = build_soap_request do |xml|
90
- xml.CreditCardReversal(xmlns: "https://transaction.elementexpress.com") do
90
+ xml.CreditCardReversal(xmlns: 'https://transaction.elementexpress.com') do
91
91
  add_credentials(xml)
92
92
  add_transaction(xml, trans_amount, options)
93
93
  add_terminal(xml, options)
@@ -99,7 +99,7 @@ module ActiveMerchant #:nodoc:
99
99
 
100
100
  def store(payment, options = {})
101
101
  request = build_soap_request do |xml|
102
- xml.PaymentAccountCreate(xmlns: "https://services.elementexpress.com") do
102
+ xml.PaymentAccountCreate(xmlns: 'https://services.elementexpress.com') do
103
103
  add_credentials(xml)
104
104
  add_payment_method(xml, payment)
105
105
  add_payment_account(xml, payment, options[:payment_account_reference_number] || SecureRandom.hex(20))
@@ -165,8 +165,8 @@ module ActiveMerchant #:nodoc:
165
165
  def add_payment_account_id(xml, payment)
166
166
  xml.extendedParameters do
167
167
  xml.ExtendedParameters do
168
- xml.Key "PaymentAccount"
169
- xml.Value("xsi:type" => "PaymentAccount") do
168
+ xml.Key 'PaymentAccount'
169
+ xml.Value('xsi:type' => 'PaymentAccount') do
170
170
  xml.PaymentAccountID payment
171
171
  end
172
172
  end
@@ -178,21 +178,21 @@ module ActiveMerchant #:nodoc:
178
178
  xml.ReversalType options[:reversal_type] if options[:reversal_type]
179
179
  xml.TransactionID options[:trans_id] if options[:trans_id]
180
180
  xml.TransactionAmount amount(money.to_i) if money
181
- xml.MarketCode "Default" if money
181
+ xml.MarketCode 'Default' if money
182
182
  xml.ReferenceNumber options[:order_id] || SecureRandom.hex(20)
183
183
  end
184
184
  end
185
185
 
186
186
  def add_terminal(xml, options)
187
187
  xml.terminal do
188
- xml.TerminalID "01"
189
- xml.CardPresentCode "UseDefault"
190
- xml.CardholderPresentCode "UseDefault"
191
- xml.CardInputCode "UseDefault"
192
- xml.CVVPresenceCode "UseDefault"
193
- xml.TerminalCapabilityCode "UseDefault"
194
- xml.TerminalEnvironmentCode "UseDefault"
195
- xml.MotoECICode "NonAuthenticatedSecureECommerceTransaction"
188
+ xml.TerminalID '01'
189
+ xml.CardPresentCode 'UseDefault'
190
+ xml.CardholderPresentCode 'UseDefault'
191
+ xml.CardInputCode 'UseDefault'
192
+ xml.CVVPresenceCode 'UseDefault'
193
+ xml.TerminalCapabilityCode 'UseDefault'
194
+ xml.TerminalEnvironmentCode 'UseDefault'
195
+ xml.MotoECICode 'NonAuthenticatedSecureECommerceTransaction'
196
196
  end
197
197
  end
198
198
 
@@ -201,7 +201,7 @@ module ActiveMerchant #:nodoc:
201
201
  xml.CardNumber payment.number
202
202
  xml.ExpirationMonth format(payment.month, :two_digits)
203
203
  xml.ExpirationYear format(payment.year, :two_digits)
204
- xml.CardholderName payment.first_name + " " + payment.last_name
204
+ xml.CardholderName payment.first_name + ' ' + payment.last_name
205
205
  xml.CVV payment.verification_value
206
206
  end
207
207
  end
@@ -244,10 +244,10 @@ module ActiveMerchant #:nodoc:
244
244
 
245
245
  doc = Nokogiri::XML(xml)
246
246
  doc.remove_namespaces!
247
- root = doc.root.xpath("//response/*")
247
+ root = doc.root.xpath('//response/*')
248
248
 
249
249
  if root.empty?
250
- root = doc.root.xpath("//Response/*")
250
+ root = doc.root.xpath('//Response/*')
251
251
  end
252
252
 
253
253
  root.each do |node|
@@ -281,31 +281,31 @@ module ActiveMerchant #:nodoc:
281
281
  end
282
282
 
283
283
  def authorization_from(action, response, amount)
284
- if action == "PaymentAccountCreate"
285
- response["paymentaccount"]["paymentaccountid"]
284
+ if action == 'PaymentAccountCreate'
285
+ response['paymentaccount']['paymentaccountid']
286
286
  else
287
287
  "#{response['transaction']['transactionid']}|#{amount}" if response['transaction']
288
288
  end
289
289
  end
290
290
 
291
291
  def success_from(response)
292
- response["expressresponsecode"] == "0"
292
+ response['expressresponsecode'] == '0'
293
293
  end
294
294
 
295
295
  def message_from(response)
296
- response["expressresponsemessage"]
296
+ response['expressresponsemessage']
297
297
  end
298
298
 
299
299
  def avs_from(response)
300
- AVSResult.new(code: response["card"]["avsresponsecode"]) if response["card"]
300
+ AVSResult.new(code: response['card']['avsresponsecode']) if response['card']
301
301
  end
302
302
 
303
303
  def cvv_from(response)
304
- CVVResult.new(response["card"]["cvvresponsecode"]) if response["card"]
304
+ CVVResult.new(response['card']['cvvresponsecode']) if response['card']
305
305
  end
306
306
 
307
307
  def split_authorization(authorization)
308
- authorization.split("|")
308
+ authorization.split('|')
309
309
  end
310
310
 
311
311
  def build_soap_request
@@ -327,13 +327,13 @@ module ActiveMerchant #:nodoc:
327
327
  if payment.is_a?(Check)
328
328
  payment_account_type = payment.account_type
329
329
  else
330
- payment_account_type = "CreditCard"
330
+ payment_account_type = 'CreditCard'
331
331
  end
332
332
  payment_account_type
333
333
  end
334
334
 
335
335
  def url(action)
336
- if action == "PaymentAccountCreate"
336
+ if action == 'PaymentAccountCreate'
337
337
  url = (test? ? SERVICE_TEST_URL : SERVICE_LIVE_URL)
338
338
  else
339
339
  url = (test? ? test_url : live_url)
@@ -341,14 +341,14 @@ module ActiveMerchant #:nodoc:
341
341
  end
342
342
 
343
343
  def interface(action)
344
- return "transaction" if action != "PaymentAccountCreate"
345
- return "services" if action == "PaymentAccountCreate"
344
+ return 'transaction' if action != 'PaymentAccountCreate'
345
+ return 'services' if action == 'PaymentAccountCreate'
346
346
  end
347
347
 
348
348
  def headers(action)
349
349
  {
350
- "Content-Type" => "text/xml; charset=utf-8",
351
- "SOAPAction" => "https://#{interface(action)}.elementexpress.com/#{action}"
350
+ 'Content-Type' => 'text/xml; charset=utf-8',
351
+ 'SOAPAction' => "https://#{interface(action)}.elementexpress.com/#{action}"
352
352
  }
353
353
  end
354
354
  end