activemerchant 1.79.2 → 1.80.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -72,9 +72,15 @@ module ActiveMerchant #:nodoc:
72
72
  add_payment_source(post, creditcard_or_datakey, options)
73
73
  post[:amount] = amount(money)
74
74
  post[:order_id] = options[:order_id]
75
- post[:address] = options[:billing_address] || options[:address]
75
+ add_address(post, creditcard_or_datakey, options)
76
76
  post[:crypt_type] = options[:crypt_type] || @options[:crypt_type]
77
- action = (post[:data_key].blank?) ? 'us_purchase' : 'us_res_purchase_cc'
77
+ action = if creditcard_or_datakey.is_a?(String)
78
+ 'us_res_purchase_cc'
79
+ elsif card_brand(creditcard_or_datakey) == 'check'
80
+ 'us_ach_debit'
81
+ elsif post[:data_key].blank?
82
+ 'us_purchase'
83
+ end
78
84
  commit(action, post)
79
85
  end
80
86
 
@@ -114,12 +120,11 @@ module ActiveMerchant #:nodoc:
114
120
  commit 'us_refund', crediting_params(authorization, :amount => amount(money))
115
121
  end
116
122
 
117
- def store(credit_card, options = {})
123
+ def store(payment_source, options = {})
118
124
  post = {}
119
- post[:pan] = credit_card.number
120
- post[:expdate] = expdate(credit_card)
125
+ add_payment_source(post, payment_source, options)
121
126
  post[:crypt_type] = options[:crypt_type] || @options[:crypt_type]
122
- commit('us_res_add_cc', post)
127
+ card_brand(payment_source) == 'check' ? commit('us_res_add_ach', post) : commit('us_res_add_cc', post)
123
128
  end
124
129
 
125
130
  def unstore(data_key, options = {})
@@ -128,13 +133,11 @@ module ActiveMerchant #:nodoc:
128
133
  commit('us_res_delete', post)
129
134
  end
130
135
 
131
- def update(data_key, credit_card, options = {})
136
+ def update(data_key, payment_source, options = {})
132
137
  post = {}
133
- post[:pan] = credit_card.number
134
- post[:expdate] = expdate(credit_card)
138
+ add_payment_source(post, payment_source, options)
135
139
  post[:data_key] = data_key
136
- post[:crypt_type] = options[:crypt_type] || @options[:crypt_type]
137
- commit('us_res_update_cc', post)
140
+ card_brand(payment_source) == 'check' ? commit('us_res_update_ach', post) : commit('us_res_update_cc', post)
138
141
  end
139
142
 
140
143
  def supports_scrubbing?
@@ -151,17 +154,44 @@ module ActiveMerchant #:nodoc:
151
154
  private # :nodoc: all
152
155
 
153
156
  def expdate(creditcard)
154
- sprintf("%.4i", creditcard.year)[-2..-1] + sprintf("%.2i", creditcard.month)
157
+ sprintf('%.4i', creditcard.year)[-2..-1] + sprintf('%.2i', creditcard.month)
158
+ end
159
+
160
+ def add_address(post, payment_method, options)
161
+ if !payment_method.is_a?(String) && card_brand(payment_method) == 'check'
162
+ post[:ach_info][:cust_first_name] = payment_method.first_name if payment_method.first_name
163
+ post[:ach_info][:cust_last_name] = payment_method.last_name if payment_method.last_name
164
+ if address = options[:billing_address] || options[:address]
165
+ post[:ach_info][:cust_address1] = address[:address1] if address[:address1]
166
+ post[:ach_info][:cust_address2] = address[:address2] if address[:address2]
167
+ post[:ach_info][:city] = address[:city] if address[:city]
168
+ post[:ach_info][:state] = address[:state] if address[:state]
169
+ post[:ach_info][:zip] = address[:zip] if address[:zip]
170
+ end
171
+ else
172
+ post[:address] = options[:billing_address] || options[:address]
173
+ end
155
174
  end
156
175
 
157
176
  def add_payment_source(post, source, options)
158
177
  if source.is_a?(String)
159
178
  post[:data_key] = source
160
179
  post[:cust_id] = options[:customer]
180
+ elsif card_brand(source) == 'check'
181
+ ach_info = {}
182
+ ach_info[:sec] = 'web'
183
+ ach_info[:routing_num] = source.routing_number
184
+ ach_info[:account_num] = source.account_number
185
+ ach_info[:account_type] = source.account_type
186
+ ach_info[:check_num] = source.number if source.number
187
+ post[:ach_info] = ach_info
161
188
  else
162
189
  post[:pan] = source.number
163
190
  post[:expdate] = expdate(source)
164
191
  post[:cvd_value] = source.verification_value if source.verification_value?
192
+ if crypt_type = options[:crypt_type] || @options[:crypt_type]
193
+ post[:crypt_type] = crypt_type
194
+ end
165
195
  post[:cust_id] = options[:customer] || source.name
166
196
  end
167
197
  end
@@ -214,7 +244,7 @@ module ActiveMerchant #:nodoc:
214
244
  end
215
245
 
216
246
  def parse(xml)
217
- response = { :message => "Global Error Receipt", :complete => false }
247
+ response = { :message => 'Global Error Receipt', :complete => false }
218
248
  hashify_xml!(xml, response)
219
249
  response
220
250
  end
@@ -229,9 +259,9 @@ module ActiveMerchant #:nodoc:
229
259
 
230
260
  def post_data(action, parameters = {})
231
261
  xml = REXML::Document.new
232
- root = xml.add_element("request")
233
- root.add_element("store_id").text = options[:login]
234
- root.add_element("api_token").text = options[:password]
262
+ root = xml.add_element('request')
263
+ root.add_element('store_id').text = options[:login]
264
+ root.add_element('api_token').text = options[:password]
235
265
  root.add_element(transaction_element(action, parameters))
236
266
 
237
267
  xml.to_s
@@ -247,6 +277,8 @@ module ActiveMerchant #:nodoc:
247
277
  transaction.add_element(avs_element(parameters[:address])) if @avs_enabled && parameters[:address]
248
278
  when :cvd_info
249
279
  transaction.add_element(cvd_element(parameters[:cvd_value])) if @cvv_enabled
280
+ when :ach_info
281
+ transaction.add_element(ach_element(parameters[:ach_info]))
250
282
  else
251
283
  transaction.add_element(key.to_s).text = parameters[key] unless parameters[key].blank?
252
284
  end
@@ -269,39 +301,51 @@ module ActiveMerchant #:nodoc:
269
301
  def cvd_element(cvd_value)
270
302
  element = REXML::Element.new('cvd_info')
271
303
  if cvd_value
272
- element.add_element('cvd_indicator').text = "1"
304
+ element.add_element('cvd_indicator').text = '1'
273
305
  element.add_element('cvd_value').text = cvd_value
274
306
  else
275
- element.add_element('cvd_indicator').text = "0"
307
+ element.add_element('cvd_indicator').text = '0'
308
+ end
309
+ element
310
+ end
311
+
312
+ def ach_element(ach_info)
313
+ element = REXML::Element.new('ach_info')
314
+ actions['ach_info'].each do |key|
315
+ element.add_element(key.to_s).text = ach_info[key] unless ach_info[key].blank?
276
316
  end
277
317
  element
278
318
  end
279
319
 
280
320
  def message_from(message)
281
321
  return 'Unspecified error' if message.blank?
282
- message.gsub(/[^\w]/, ' ').split.join(" ").capitalize
322
+ message.gsub(/[^\w]/, ' ').split.join(' ').capitalize
283
323
  end
284
324
 
285
325
  def actions
286
326
  {
287
- "us_purchase" => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type, :avs_info, :cvd_info],
288
- "us_preauth" => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type, :avs_info, :cvd_info],
289
- "us_command" => [:order_id],
290
- "us_refund" => [:order_id, :amount, :txn_number, :crypt_type],
291
- "us_indrefund" => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type],
292
- "us_completion" => [:order_id, :comp_amount, :txn_number, :crypt_type],
293
- "us_purchasecorrection" => [:order_id, :txn_number, :crypt_type],
294
- "us_cavvpurcha" => [:order_id, :cust_id, :amount, :pan, :expdate, :cav],
295
- "us_cavvpreaut" => [:order_id, :cust_id, :amount, :pan, :expdate, :cavv],
296
- "us_transact" => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type],
297
- "us_Batchcloseall" => [],
298
- "us_opentotals" => [:ecr_number],
299
- "us_batchclose" => [:ecr_number],
300
- "us_res_add_cc" => [:pan, :expdate, :crypt_type],
301
- "us_res_delete" => [:data_key],
302
- "us_res_update_cc" => [:data_key, :pan, :expdate, :crypt_type],
303
- "us_res_purchase_cc" => [:data_key, :order_id, :cust_id, :amount, :crypt_type],
304
- "us_res_preauth_cc" => [:data_key, :order_id, :cust_id, :amount, :crypt_type]
327
+ 'us_purchase' => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type, :avs_info, :cvd_info],
328
+ 'us_preauth' => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type, :avs_info, :cvd_info],
329
+ 'us_command' => [:order_id],
330
+ 'us_refund' => [:order_id, :amount, :txn_number, :crypt_type],
331
+ 'us_indrefund' => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type],
332
+ 'us_completion' => [:order_id, :comp_amount, :txn_number, :crypt_type],
333
+ 'us_purchasecorrection' => [:order_id, :txn_number, :crypt_type],
334
+ 'us_cavvpurcha' => [:order_id, :cust_id, :amount, :pan, :expdate, :cav],
335
+ 'us_cavvpreaut' => [:order_id, :cust_id, :amount, :pan, :expdate, :cavv],
336
+ 'us_transact' => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type],
337
+ 'us_Batchcloseall' => [],
338
+ 'us_opentotals' => [:ecr_number],
339
+ 'us_batchclose' => [:ecr_number],
340
+ 'us_res_add_cc' => [:pan, :expdate, :crypt_type],
341
+ 'us_res_delete' => [:data_key],
342
+ 'us_res_update_cc' => [:data_key, :pan, :expdate, :crypt_type],
343
+ 'us_res_purchase_cc' => [:data_key, :order_id, :cust_id, :amount, :crypt_type],
344
+ 'us_res_preauth_cc' => [:data_key, :order_id, :cust_id, :amount, :crypt_type],
345
+ 'us_ach_debit' => [:order_id, :cust_id, :amount, :ach_info],
346
+ 'us_res_add_ach' => [:order_id, :cust_id, :amount, :ach_info],
347
+ 'us_res_update_ach' => [:order_id, :data_key, :cust_id, :amount, :ach_info],
348
+ 'ach_info' => [:sec, :cust_first_name, :cust_last_name, :cust_address1, :cust_address2, :cust_city, :cust_state, :cust_zip, :routing_num, :account_num, :check_num, :account_type]
305
349
  }
306
350
  end
307
351
  end
@@ -132,11 +132,11 @@ module ActiveMerchant #:nodoc:
132
132
  def message_from(response)
133
133
  case response['response'].to_i
134
134
  when APPROVED
135
- "Transaction Approved"
135
+ 'Transaction Approved'
136
136
  when DECLINED
137
- "Transaction Declined"
137
+ 'Transaction Declined'
138
138
  else
139
- "Error in transaction data or system error"
139
+ 'Error in transaction data or system error'
140
140
  end
141
141
  end
142
142
 
@@ -66,7 +66,7 @@ module ActiveMerchant #:nodoc:
66
66
  end
67
67
 
68
68
  def void(authorization, options={})
69
- commit('void', post=nil, authorization)
69
+ commit('void', nil, authorization)
70
70
  end
71
71
 
72
72
  def store(payment, options={})
@@ -6,7 +6,7 @@ module ActiveMerchant #:nodoc:
6
6
  # be a rebadged Securepay Australia service, though some differences exist.
7
7
  class NabTransactGateway < Gateway
8
8
  API_VERSION = 'xml-4.2'
9
- PERIODIC_API_VERSION = "spxml-4.2"
9
+ PERIODIC_API_VERSION = 'spxml-4.2'
10
10
 
11
11
  class_attribute :test_periodic_url, :live_periodic_url
12
12
 
@@ -84,7 +84,7 @@ module ActiveMerchant #:nodoc:
84
84
  end
85
85
 
86
86
  def scrub(transcript)
87
- return "" if transcript.blank?
87
+ return '' if transcript.blank?
88
88
  transcript.
89
89
  gsub(%r((<cardNumber>)[^<]+(<))i, '\1[FILTERED]\2').
90
90
  gsub(%r((<cvv>)[^<]+(<))i, '\1[FILTERED]\2').
@@ -156,8 +156,8 @@ module ActiveMerchant #:nodoc:
156
156
 
157
157
  xml.tag! 'RequestType', 'Payment'
158
158
  xml.tag! 'Payment' do
159
- xml.tag! 'TxnList', "count" => 1 do
160
- xml.tag! 'Txn', "ID" => 1 do
159
+ xml.tag! 'TxnList', 'count' => 1 do
160
+ xml.tag! 'Txn', 'ID' => 1 do
161
161
  xml.tag! 'txnType', TRANSACTIONS[action]
162
162
  xml.tag! 'txnSource', 23
163
163
  xml << body
@@ -187,8 +187,8 @@ module ActiveMerchant #:nodoc:
187
187
 
188
188
  xml.tag! 'RequestType', 'Periodic'
189
189
  xml.tag! 'Periodic' do
190
- xml.tag! 'PeriodicList', "count" => 1 do
191
- xml.tag! 'PeriodicItem', "ID" => 1 do
190
+ xml.tag! 'PeriodicList', 'count' => 1 do
191
+ xml.tag! 'PeriodicItem', 'ID' => 1 do
192
192
  xml.tag! 'actionType', action.to_s
193
193
  xml.tag! 'periodicType', PERIODIC_TYPES[action] if PERIODIC_TYPES[action]
194
194
  xml << body
@@ -105,7 +105,7 @@ module ActiveMerchant #:nodoc:
105
105
  def parse(body)
106
106
  doc = Nokogiri::XML(body)
107
107
  doc.remove_namespaces!
108
- response = doc.xpath("/MonetraResp/Resp")[0]
108
+ response = doc.xpath('/MonetraResp/Resp')[0]
109
109
  resp_params = {}
110
110
 
111
111
  response.elements.each do |node|
@@ -129,7 +129,7 @@ module ActiveMerchant #:nodoc:
129
129
  end
130
130
 
131
131
  def success_from(response)
132
- response[:code] == "AUTH"
132
+ response[:code] == 'AUTH'
133
133
  end
134
134
 
135
135
  def message_from(response)
@@ -143,7 +143,7 @@ module ActiveMerchant #:nodoc:
143
143
  def request_body(action, parameters = {})
144
144
  Nokogiri::XML::Builder.new(:encoding => 'utf-8') do |xml|
145
145
  xml.MonetraTrans do
146
- xml.Trans(identifier: parameters.delete(:identifier) || "1") do
146
+ xml.Trans(identifier: parameters.delete(:identifier) || '1') do
147
147
  xml.username(options[:username])
148
148
  xml.password(options[:password])
149
149
  xml.action(action)
@@ -50,24 +50,24 @@ module ActiveMerchant #:nodoc:
50
50
  post = {}
51
51
  add_credentials(post, options)
52
52
  add_authorization(post, authorization, money)
53
- post[:operation] = "Capture"
54
- commit("Netaxept/process.aspx", post)
53
+ post[:operation] = 'Capture'
54
+ commit('Netaxept/process.aspx', post)
55
55
  end
56
56
 
57
57
  def refund(money, authorization, options = {})
58
58
  post = {}
59
59
  add_credentials(post, options)
60
60
  add_authorization(post, authorization, money)
61
- post[:operation] = "Credit"
62
- commit("Netaxept/process.aspx", post)
61
+ post[:operation] = 'Credit'
62
+ commit('Netaxept/process.aspx', post)
63
63
  end
64
64
 
65
65
  def void(authorization, options = {})
66
66
  post = {}
67
67
  add_credentials(post, options)
68
68
  add_authorization(post, authorization)
69
- post[:operation] = "Annul"
70
- commit("Netaxept/process.aspx", post)
69
+ post[:operation] = 'Annul'
70
+ commit('Netaxept/process.aspx', post)
71
71
  end
72
72
 
73
73
  private
@@ -76,7 +76,7 @@ module ActiveMerchant #:nodoc:
76
76
  post = {}
77
77
  add_credentials(post, options)
78
78
  add_order(post, money, options)
79
- commit("Netaxept/Register.aspx", post)
79
+ commit('Netaxept/Register.aspx', post)
80
80
  end
81
81
 
82
82
  def add_and_auth_credit_card(authorization, creditcard, options)
@@ -84,14 +84,14 @@ module ActiveMerchant #:nodoc:
84
84
  add_credentials(post, options, false)
85
85
  add_authorization(post, authorization)
86
86
  add_creditcard(post, creditcard)
87
- commit("terminal/default.aspx", post, false)
87
+ commit('terminal/default.aspx', post, false)
88
88
  end
89
89
 
90
90
  def query_transaction(authorization, options)
91
91
  post = {}
92
92
  add_credentials(post, options)
93
93
  add_authorization(post, authorization)
94
- commit("Netaxept/query.aspx", post)
94
+ commit('Netaxept/query.aspx', post)
95
95
  end
96
96
 
97
97
  def add_credentials(post, options, secure=true)
@@ -109,7 +109,7 @@ module ActiveMerchant #:nodoc:
109
109
  post[:orderNumber] = options[:order_id]
110
110
  post[:amount] = amount(money)
111
111
  post[:currencyCode] = (options[:currency] || currency(money))
112
- post[:autoAuth] = "true"
112
+ post[:autoAuth] = 'true'
113
113
  end
114
114
 
115
115
  def add_creditcard(post, options)
@@ -122,13 +122,13 @@ module ActiveMerchant #:nodoc:
122
122
  raw = parse(ssl_get(build_url(path, parameters)), xml)
123
123
 
124
124
  success = false
125
- authorization = (raw["TransactionId"] || parameters[:transactionId])
125
+ authorization = (raw['TransactionId'] || parameters[:transactionId])
126
126
  if raw[:container] =~ /Exception|Error/
127
- message = (raw["Message"] || raw["Error"]["Message"])
128
- elsif raw["Error"] && !raw["Error"].empty?
129
- message = (raw["Error"]["ResponseText"] || raw["Error"]["ResponseCode"])
127
+ message = (raw['Message'] || raw['Error']['Message'])
128
+ elsif raw['Error'] && !raw['Error'].empty?
129
+ message = (raw['Error']['ResponseText'] || raw['Error']['ResponseCode'])
130
130
  else
131
- message = (raw["ResponseText"] || raw["ResponseCode"] || "OK")
131
+ message = (raw['ResponseText'] || raw['ResponseCode'] || 'OK')
132
132
  success = true
133
133
  end
134
134
 
@@ -212,7 +212,7 @@ module ActiveMerchant #:nodoc:
212
212
  end
213
213
 
214
214
  def message_from(success, response)
215
- success ? 'OK' : (response['error']['message'] || "Unknown error - please contact Netbanx-Paysafe")
215
+ success ? 'OK' : (response['error']['message'] || 'Unknown error - please contact Netbanx-Paysafe')
216
216
  end
217
217
 
218
218
  def authorization_from(success, url, method, response)
@@ -229,7 +229,7 @@ module ActiveMerchant #:nodoc:
229
229
  #
230
230
  # both id's are used to unstore, the payment token is only used for
231
231
  # purchase transactions
232
- [response['id'], response['cards'].first['id'], response['cards'].first['paymentToken']].join("|")
232
+ [response['id'], response['cards'].first['id'], response['cards'].first['paymentToken']].join('|')
233
233
  end
234
234
  end
235
235
 
@@ -224,7 +224,7 @@ module ActiveMerchant #:nodoc:
224
224
  parameters[:pay_type] = 'C'
225
225
  parameters[:tran_type] = TRANSACTIONS[action]
226
226
 
227
- parameters.reject{|k,v| v.blank?}.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&")
227
+ parameters.reject{|k,v| v.blank?}.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
228
228
  end
229
229
 
230
230
  end
@@ -51,7 +51,7 @@ module ActiveMerchant #:nodoc:
51
51
  self.display_name = 'NETPAY Gateway'
52
52
 
53
53
  CURRENCY_CODES = {
54
- "MXN" => '484'
54
+ 'MXN' => '484'
55
55
  }
56
56
 
57
57
  # The header keys that we will provide in the response params hash
@@ -157,7 +157,7 @@ module ActiveMerchant #:nodoc:
157
157
  end
158
158
 
159
159
  def split_authorization(authorization)
160
- order_id, amount, currency = authorization.split("|")
160
+ order_id, amount, currency = authorization.split('|')
161
161
  [order_id, amount, currency]
162
162
  end
163
163
 
@@ -166,8 +166,8 @@ module ActiveMerchant #:nodoc:
166
166
  end
167
167
 
168
168
  def expdate(credit_card)
169
- year = sprintf("%.4i", credit_card.year)
170
- month = sprintf("%.2i", credit_card.month)
169
+ year = sprintf('%.4i', credit_card.year)
170
+ month = sprintf('%.2i', credit_card.month)
171
171
 
172
172
  "#{month}/#{year[-2..-1]}"
173
173
  end
@@ -191,7 +191,7 @@ module ActiveMerchant #:nodoc:
191
191
  add_login_data(parameters)
192
192
  add_action(parameters, action, options)
193
193
 
194
- post = parameters.collect{|key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&")
194
+ post = parameters.collect{|key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
195
195
  parse(ssl_post(url, post), parameters)
196
196
  end
197
197
 
@@ -3,7 +3,7 @@ module ActiveMerchant #:nodoc:
3
3
  class NmiGateway < Gateway
4
4
  include Empty
5
5
 
6
- DUP_WINDOW_DEPRECATION_MESSAGE = "The class-level duplicate_window variable is deprecated. Please use the :dup_seconds transaction option instead."
6
+ DUP_WINDOW_DEPRECATION_MESSAGE = 'The class-level duplicate_window variable is deprecated. Please use the :dup_seconds transaction option instead.'
7
7
 
8
8
  self.test_url = self.live_url = 'https://secure.nmi.com/api/transact.php'
9
9
  self.default_currency = 'USD'
@@ -34,7 +34,7 @@ module ActiveMerchant #:nodoc:
34
34
  add_customer_data(post, options)
35
35
  add_merchant_defined_fields(post, options)
36
36
 
37
- commit("sale", post)
37
+ commit('sale', post)
38
38
  end
39
39
 
40
40
  def authorize(amount, payment_method, options={})
@@ -44,7 +44,7 @@ module ActiveMerchant #:nodoc:
44
44
  add_customer_data(post, options)
45
45
  add_merchant_defined_fields(post, options)
46
46
 
47
- commit("auth", post)
47
+ commit('auth', post)
48
48
  end
49
49
 
50
50
  def capture(amount, authorization, options={})
@@ -53,7 +53,7 @@ module ActiveMerchant #:nodoc:
53
53
  add_reference(post, authorization)
54
54
  add_merchant_defined_fields(post, options)
55
55
 
56
- commit("capture", post)
56
+ commit('capture', post)
57
57
  end
58
58
 
59
59
  def void(authorization, options={})
@@ -61,7 +61,7 @@ module ActiveMerchant #:nodoc:
61
61
  add_reference(post, authorization)
62
62
  add_payment_type(post, authorization)
63
63
 
64
- commit("void", post)
64
+ commit('void', post)
65
65
  end
66
66
 
67
67
  def refund(amount, authorization, options={})
@@ -70,7 +70,7 @@ module ActiveMerchant #:nodoc:
70
70
  add_reference(post, authorization)
71
71
  add_payment_type(post, authorization)
72
72
 
73
- commit("refund", post)
73
+ commit('refund', post)
74
74
  end
75
75
 
76
76
  def credit(amount, payment_method, options={})
@@ -79,7 +79,7 @@ module ActiveMerchant #:nodoc:
79
79
  add_payment_method(post, payment_method, options)
80
80
  add_customer_data(post, options)
81
81
 
82
- commit("credit", post)
82
+ commit('credit', post)
83
83
  end
84
84
 
85
85
  def verify(payment_method, options={})
@@ -88,7 +88,7 @@ module ActiveMerchant #:nodoc:
88
88
  add_customer_data(post, options)
89
89
  add_merchant_defined_fields(post, options)
90
90
 
91
- commit("validate", post)
91
+ commit('validate', post)
92
92
  end
93
93
 
94
94
  def store(payment_method, options = {})
@@ -98,12 +98,12 @@ module ActiveMerchant #:nodoc:
98
98
  add_customer_data(post, options)
99
99
  add_merchant_defined_fields(post, options)
100
100
 
101
- commit("add_customer", post)
101
+ commit('add_customer', post)
102
102
  end
103
103
 
104
104
  def verify_credentials
105
- response = void("0")
106
- response.message != "Authentication Failed"
105
+ response = void('0')
106
+ response.message != 'Authentication Failed'
107
107
  end
108
108
 
109
109
  def supports_scrubbing?
@@ -131,7 +131,7 @@ module ActiveMerchant #:nodoc:
131
131
  post[:orderid] = options[:order_id]
132
132
  post[:orderdescription] = options[:description]
133
133
  post[:currency] = options[:currency] || currency(money)
134
- post[:billing_method] = "recurring" if options[:recurring]
134
+ post[:billing_method] = 'recurring' if options[:recurring]
135
135
  if (dup_seconds = (options[:dup_seconds] || self.class.duplicate_window))
136
136
  post[:dup_seconds] = dup_seconds
137
137
  end
@@ -215,7 +215,7 @@ module ActiveMerchant #:nodoc:
215
215
 
216
216
  def commit(action, params)
217
217
 
218
- params[action == "add_customer" ? :customer_vault : :type] = action
218
+ params[action == 'add_customer' ? :customer_vault : :type] = action
219
219
  params[:username] = @options[:login]
220
220
  params[:password] = @options[:password]
221
221
 
@@ -235,15 +235,15 @@ module ActiveMerchant #:nodoc:
235
235
  end
236
236
 
237
237
  def authorization_from(response, payment_type)
238
- [ response[:transactionid], payment_type ].join("#")
238
+ [ response[:transactionid], payment_type ].join('#')
239
239
  end
240
240
 
241
241
  def split_authorization(authorization)
242
- authorization.split("#")
242
+ authorization.split('#')
243
243
  end
244
244
 
245
245
  def headers
246
- { "Content-Type" => "application/x-www-form-urlencoded;charset=UTF-8" }
246
+ { 'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8' }
247
247
  end
248
248
 
249
249
  def post_data(action, params)
@@ -259,12 +259,12 @@ module ActiveMerchant #:nodoc:
259
259
  end
260
260
 
261
261
  def success_from(response)
262
- response[:response] == "1"
262
+ response[:response] == '1'
263
263
  end
264
264
 
265
265
  def message_from(succeeded, response)
266
266
  if succeeded
267
- "Succeeded"
267
+ 'Succeeded'
268
268
  else
269
269
  response[:responsetext]
270
270
  end