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
@@ -23,7 +23,7 @@ module ActiveMerchant
23
23
  add_payment(post, payment)
24
24
  add_customer_data(post, options)
25
25
 
26
- commit("S", post)
26
+ commit('S', post)
27
27
  end
28
28
 
29
29
  def authorize(money, payment, options={})
@@ -34,7 +34,7 @@ module ActiveMerchant
34
34
  add_payment(post, payment)
35
35
  add_customer_data(post, options)
36
36
 
37
- commit("A", post)
37
+ commit('A', post)
38
38
  end
39
39
 
40
40
  def capture(money, authorization, options={})
@@ -45,7 +45,7 @@ module ActiveMerchant
45
45
  add_authorization(post, authorization)
46
46
  add_pay_type(post)
47
47
 
48
- commit("D", post)
48
+ commit('D', post)
49
49
  end
50
50
 
51
51
  def refund(money, authorization, options={})
@@ -56,7 +56,7 @@ module ActiveMerchant
56
56
  add_authorization(post, authorization)
57
57
  add_pay_type(post)
58
58
 
59
- commit("R", post)
59
+ commit('R', post)
60
60
  end
61
61
 
62
62
  def void(authorization, options={})
@@ -66,7 +66,7 @@ module ActiveMerchant
66
66
  add_authorization(post, authorization)
67
67
  add_pay_type(post)
68
68
 
69
- commit("U", post)
69
+ commit('U', post)
70
70
  end
71
71
 
72
72
  def verify(credit_card, options={})
@@ -143,7 +143,7 @@ module ActiveMerchant
143
143
  end
144
144
 
145
145
  def add_pay_type(post)
146
- post[:pay_type] = "C"
146
+ post[:pay_type] = 'C'
147
147
  end
148
148
 
149
149
  def parse(body)
@@ -160,8 +160,8 @@ module ActiveMerchant
160
160
  message_from(response),
161
161
  response,
162
162
  authorization: authorization_from(response),
163
- avs_result: AVSResult.new(code: response["avs_code"]),
164
- cvv_result: CVVResult.new(response["cvv2_code"]),
163
+ avs_result: AVSResult.new(code: response['avs_code']),
164
+ cvv_result: CVVResult.new(response['cvv2_code']),
165
165
  test: test?
166
166
  )
167
167
  rescue ResponseError => e
@@ -170,24 +170,24 @@ module ActiveMerchant
170
170
  end
171
171
 
172
172
  def success_from(response)
173
- response["status_code"] == "1" || response["status_code"] == "T"
173
+ response['status_code'] == '1' || response['status_code'] == 'T'
174
174
  end
175
175
 
176
176
  def message_from(response)
177
- response["auth_msg"]
177
+ response['auth_msg']
178
178
  end
179
179
 
180
180
  def authorization_from(response)
181
- response["trans_id"]
181
+ response['trans_id']
182
182
  end
183
183
 
184
184
  def post_data(parameters = {})
185
- parameters.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&")
185
+ parameters.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
186
186
  end
187
187
 
188
188
  def headers
189
189
  {
190
- "User-Agent" => "ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
190
+ 'User-Agent' => "ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
191
191
  }
192
192
  end
193
193
  end
@@ -3,8 +3,8 @@ require 'json'
3
3
  module ActiveMerchant #:nodoc:
4
4
  module Billing #:nodoc:
5
5
  class FatZebraGateway < Gateway
6
- self.live_url = "https://gateway.fatzebra.com.au/v1.0"
7
- self.test_url = "https://gateway.sandbox.fatzebra.com.au/v1.0"
6
+ self.live_url = 'https://gateway.fatzebra.com.au/v1.0'
7
+ self.test_url = 'https://gateway.sandbox.fatzebra.com.au/v1.0'
8
8
 
9
9
  self.supported_countries = ['AU']
10
10
  self.default_currency = 'AUD'
@@ -61,14 +61,14 @@ module ActiveMerchant #:nodoc:
61
61
  post[:transaction_id] = txn_id
62
62
  add_order_id(post, options)
63
63
 
64
- commit(:post, "refunds", post)
64
+ commit(:post, 'refunds', post)
65
65
  end
66
66
 
67
67
  def store(creditcard, options={})
68
68
  post = {}
69
69
  add_creditcard(post, creditcard)
70
70
 
71
- commit(:post, "credit_cards", post)
71
+ commit(:post, 'credit_cards', post)
72
72
  end
73
73
 
74
74
  def supports_scrubbing?
@@ -100,7 +100,7 @@ module ActiveMerchant #:nodoc:
100
100
  post[:card_token] = creditcard
101
101
  post[:cvv] = options[:cvv]
102
102
  elsif creditcard.is_a?(Hash)
103
- ActiveMerchant.deprecated "Passing the credit card as a Hash is deprecated. Use a String and put the (optional) CVV in the options hash instead."
103
+ ActiveMerchant.deprecated 'Passing the credit card as a Hash is deprecated. Use a String and put the (optional) CVV in the options hash instead.'
104
104
  post[:card_token] = creditcard[:token]
105
105
  post[:cvv] = creditcard[:cvv]
106
106
  else
@@ -110,7 +110,7 @@ module ActiveMerchant #:nodoc:
110
110
 
111
111
  def add_extra_options(post, options)
112
112
  extra = {}
113
- extra[:ecm] = "32" if options[:recurring]
113
+ extra[:ecm] = '32' if options[:recurring]
114
114
  extra[:cavv] = options[:cavv] if options[:cavv]
115
115
  extra[:xid] = options[:xid] if options[:xid]
116
116
  extra[:sli] = options[:sli] if options[:sli]
@@ -124,14 +124,14 @@ module ActiveMerchant #:nodoc:
124
124
  end
125
125
 
126
126
  def add_ip(post, options)
127
- post[:customer_ip] = options[:ip] || "127.0.0.1"
127
+ post[:customer_ip] = options[:ip] || '127.0.0.1'
128
128
  end
129
129
 
130
130
  def commit(method, uri, parameters=nil)
131
131
  response = begin
132
132
  parse(ssl_request(method, get_url(uri), parameters.to_json, headers))
133
133
  rescue ResponseError => e
134
- return Response.new(false, "Invalid Login") if(e.response.code == "401")
134
+ return Response.new(false, 'Invalid Login') if(e.response.code == '401')
135
135
  parse(e.response.body)
136
136
  end
137
137
 
@@ -140,34 +140,34 @@ module ActiveMerchant #:nodoc:
140
140
  success,
141
141
  message_from(response),
142
142
  response,
143
- :test => response["test"],
143
+ :test => response['test'],
144
144
  :authorization => authorization_from(response, success)
145
145
  )
146
146
  end
147
147
 
148
148
  def success_from(response)
149
149
  (
150
- response["successful"] &&
151
- response["response"] &&
152
- (response["response"]["successful"] || response["response"]["token"])
150
+ response['successful'] &&
151
+ response['response'] &&
152
+ (response['response']['successful'] || response['response']['token'])
153
153
  )
154
154
  end
155
155
 
156
156
  def authorization_from(response, success)
157
157
  if success
158
- (response["response"]["id"] || response["response"]["token"])
158
+ (response['response']['id'] || response['response']['token'])
159
159
  else
160
160
  nil
161
161
  end
162
162
  end
163
163
 
164
164
  def message_from(response)
165
- if !response["errors"].empty?
166
- response["errors"].join(", ")
167
- elsif response["response"]["message"]
168
- response["response"]["message"]
165
+ if !response['errors'].empty?
166
+ response['errors'].join(', ')
167
+ elsif response['response']['message']
168
+ response['response']['message']
169
169
  else
170
- "Unknown Error"
170
+ 'Unknown Error'
171
171
  end
172
172
  end
173
173
 
@@ -178,22 +178,22 @@ module ActiveMerchant #:nodoc:
178
178
  msg = 'Invalid JSON response received from Fat Zebra. Please contact support@fatzebra.com.au if you continue to receive this message.'
179
179
  msg += " (The raw response returned by the API was #{response.inspect})"
180
180
  {
181
- "successful" => false,
182
- "response" => {},
183
- "errors" => [msg]
181
+ 'successful' => false,
182
+ 'response' => {},
183
+ 'errors' => [msg]
184
184
  }
185
185
  end
186
186
  end
187
187
 
188
188
  def get_url(uri)
189
189
  base = test? ? self.test_url : self.live_url
190
- base + "/" + uri
190
+ base + '/' + uri
191
191
  end
192
192
 
193
193
  def headers
194
194
  {
195
- "Authorization" => "Basic " + Base64.strict_encode64(@options[:username].to_s + ":" + @options[:token].to_s).strip,
196
- "User-Agent" => "Fat Zebra v1.0/ActiveMerchant #{ActiveMerchant::VERSION}"
195
+ 'Authorization' => 'Basic ' + Base64.strict_encode64(@options[:username].to_s + ':' + @options[:token].to_s).strip,
196
+ 'User-Agent' => "Fat Zebra v1.0/ActiveMerchant #{ActiveMerchant::VERSION}"
197
197
  }
198
198
  end
199
199
  end
@@ -140,11 +140,11 @@ module ActiveMerchant #:nodoc:
140
140
  def message_from(response)
141
141
  case response['response'].to_i
142
142
  when APPROVED
143
- "Transaction Approved"
143
+ 'Transaction Approved'
144
144
  when DECLINED
145
- "Transaction Declined"
145
+ 'Transaction Declined'
146
146
  else
147
- "Error in transaction data or system error"
147
+ 'Error in transaction data or system error'
148
148
  end
149
149
  end
150
150
 
@@ -31,7 +31,7 @@ module ActiveMerchant #:nodoc:
31
31
  get = {}
32
32
  get[:transactionId] = identifier
33
33
  get[:tranType] = 'REFUNDREQUEST'
34
- commit("/transaction/refundrequest?" + encode(get))
34
+ commit('/transaction/refundrequest?' + encode(get))
35
35
  end
36
36
 
37
37
  private
@@ -39,13 +39,13 @@ module ActiveMerchant #:nodoc:
39
39
  def add_donation_data(post, money, options)
40
40
  post[:amount] = amount(money)
41
41
  post[:charityId] = @options[:charity_id]
42
- post[:description] = (options[:description] || "Purchase")
42
+ post[:description] = (options[:description] || 'Purchase')
43
43
  post[:currencyCode] = (options[:currency] || currency(money))
44
44
  end
45
45
 
46
46
  def add_customer_data(post, options)
47
- post[:billToEmail] = (options[:email] || "activemerchant@example.com")
48
- post[:remoteAddr] = (options[:ip] || "127.0.0.1")
47
+ post[:billToEmail] = (options[:email] || 'activemerchant@example.com')
48
+ post[:remoteAddr] = (options[:ip] || '127.0.0.1')
49
49
  end
50
50
 
51
51
  def add_address(post, options)
@@ -76,7 +76,7 @@ module ActiveMerchant #:nodoc:
76
76
  response = {}
77
77
 
78
78
  xml = Nokogiri::XML(body)
79
- element = xml.xpath("//firstGivingDonationApi/firstGivingResponse").first
79
+ element = xml.xpath('//firstGivingDonationApi/firstGivingResponse').first
80
80
 
81
81
  element.attributes.each do |name, attribute|
82
82
  response[name] = attribute.content
@@ -103,16 +103,16 @@ module ActiveMerchant #:nodoc:
103
103
  end
104
104
 
105
105
  Response.new(
106
- (response["acknowledgement"] == "Success"),
107
- (response["friendlyErrorMessage"] || response["verboseErrorMessage"] || response["acknowledgement"]),
106
+ (response['acknowledgement'] == 'Success'),
107
+ (response['friendlyErrorMessage'] || response['verboseErrorMessage'] || response['acknowledgement']),
108
108
  response,
109
- authorization: response["transactionId"],
109
+ authorization: response['transactionId'],
110
110
  test: test?,
111
111
  )
112
112
  end
113
113
 
114
114
  def post_data(post)
115
- post.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&")
115
+ post.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
116
116
  end
117
117
 
118
118
  def encode(hash)
@@ -121,10 +121,10 @@ module ActiveMerchant #:nodoc:
121
121
 
122
122
  def creditcard_brand(brand)
123
123
  case brand
124
- when "visa" then "VI"
125
- when "master" then "MC"
126
- when "discover" then "DI"
127
- when "american_express" then "AX"
124
+ when 'visa' then 'VI'
125
+ when 'master' then 'MC'
126
+ when 'discover' then 'DI'
127
+ when 'american_express' then 'AX'
128
128
  else
129
129
  raise "Unhandled credit card brand #{brand}"
130
130
  end
@@ -132,9 +132,9 @@ module ActiveMerchant #:nodoc:
132
132
 
133
133
  def headers
134
134
  {
135
- "User-Agent" => "ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
136
- "JG_APPLICATIONKEY" => "#{@options[:application_key]}",
137
- "JG_SECURITYTOKEN" => "#{@options[:security_token]}"
135
+ 'User-Agent' => "ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
136
+ 'JG_APPLICATIONKEY' => "#{@options[:application_key]}",
137
+ 'JG_SECURITYTOKEN' => "#{@options[:security_token]}"
138
138
  }
139
139
  end
140
140
  end
@@ -21,7 +21,7 @@ module ActiveMerchant #:nodoc:
21
21
  def purchase(money, payment, options={})
22
22
  post = {}
23
23
  add_invoice(post, money, options)
24
- add_payment(post, payment)
24
+ add_payment(post, payment, options)
25
25
  add_address(post, payment, options)
26
26
  add_customer_data(post, options)
27
27
 
@@ -31,7 +31,7 @@ module ActiveMerchant #:nodoc:
31
31
  def authorize(money, payment, options={})
32
32
  post = {}
33
33
  add_invoice(post, money, options)
34
- add_payment(post, payment)
34
+ add_payment(post, payment, options)
35
35
  add_address(post, payment, options)
36
36
  add_customer_data(post, options)
37
37
 
@@ -87,11 +87,14 @@ module ActiveMerchant #:nodoc:
87
87
  post[:total] = amount(money)
88
88
  end
89
89
 
90
- def add_payment(post, payment)
90
+ def add_payment(post, payment, options)
91
91
  post[:card_name] = payment.brand # Unclear if need to map to known names or open text field??
92
92
  post[:card_number] = payment.number
93
93
  post[:card_exp] = expdate(payment)
94
94
  post[:cvv2] = payment.verification_value
95
+ post[:recurring] = options[:recurring] if options[:recurring]
96
+ post[:recurringStartDate] = options[:recurring_start_date] if options[:recurring_start_date]
97
+ post[:recurringEndDate] = options[:recurring_end_date] if options[:recurring_end_date]
95
98
  end
96
99
 
97
100
  def add_reference(post, action, money, authorization)
@@ -104,7 +107,7 @@ module ActiveMerchant #:nodoc:
104
107
  response = {}
105
108
 
106
109
  doc = Nokogiri::XML(xml)
107
- doc.root.xpath("//RESPONSE/FIELDS/FIELD").each do |field|
110
+ doc.root.xpath('//RESPONSE/FIELDS/FIELD').each do |field|
108
111
  response[field['KEY']] = field.text
109
112
  end unless doc.root.nil?
110
113
 
@@ -2,45 +2,45 @@ module ActiveMerchant #:nodoc:
2
2
  module Billing #:nodoc:
3
3
  class FirstdataE4Gateway < Gateway
4
4
  # TransArmor support requires v11 or lower
5
- self.test_url = "https://api.demo.globalgatewaye4.firstdata.com/transaction/v11"
6
- self.live_url = "https://api.globalgatewaye4.firstdata.com/transaction/v11"
5
+ self.test_url = 'https://api.demo.globalgatewaye4.firstdata.com/transaction/v11'
6
+ self.live_url = 'https://api.globalgatewaye4.firstdata.com/transaction/v11'
7
7
 
8
8
  TRANSACTIONS = {
9
- sale: "00",
10
- authorization: "01",
11
- verify: "05",
12
- capture: "32",
13
- void: "33",
14
- credit: "34",
15
- store: "05"
9
+ sale: '00',
10
+ authorization: '01',
11
+ verify: '05',
12
+ capture: '32',
13
+ void: '33',
14
+ credit: '34',
15
+ store: '05'
16
16
  }
17
17
 
18
18
  POST_HEADERS = {
19
- "Accepts" => "application/xml",
20
- "Content-Type" => "application/xml"
19
+ 'Accepts' => 'application/xml',
20
+ 'Content-Type' => 'application/xml'
21
21
  }
22
22
 
23
- SUCCESS = "true"
23
+ SUCCESS = 'true'
24
24
 
25
25
  SENSITIVE_FIELDS = [:verification_str2, :expiry_date, :card_number]
26
26
 
27
27
  BRANDS = {
28
28
  :visa => 'Visa',
29
- :master => "Mastercard",
30
- :american_express => "American Express",
31
- :jcb => "JCB",
32
- :discover => "Discover"
29
+ :master => 'Mastercard',
30
+ :american_express => 'American Express',
31
+ :jcb => 'JCB',
32
+ :discover => 'Discover'
33
33
  }
34
34
 
35
- E4_BRANDS = BRANDS.merge({:mastercard => "Mastercard"})
35
+ E4_BRANDS = BRANDS.merge({:mastercard => 'Mastercard'})
36
36
 
37
- DEFAULT_ECI = "07"
37
+ DEFAULT_ECI = '07'
38
38
 
39
39
  self.supported_cardtypes = BRANDS.keys
40
- self.supported_countries = ["CA", "US"]
41
- self.default_currency = "USD"
42
- self.homepage_url = "http://www.firstdata.com"
43
- self.display_name = "FirstData Global Gateway e4"
40
+ self.supported_countries = ['CA', 'US']
41
+ self.default_currency = 'USD'
42
+ self.homepage_url = 'http://www.firstdata.com'
43
+ self.display_name = 'FirstData Global Gateway e4'
44
44
 
45
45
  STANDARD_ERROR_CODE_MAPPING = {
46
46
  # Bank error codes: https://firstdata.zendesk.com/entries/471297-First-Data-Global-Gateway-e4-Bank-Response-Codes
@@ -132,8 +132,8 @@ module ActiveMerchant #:nodoc:
132
132
  end
133
133
 
134
134
  def verify_credentials
135
- response = void("0")
136
- response.message != "Unauthorized Request. Bad or missing credentials."
135
+ response = void('0')
136
+ response.message != 'Unauthorized Request. Bad or missing credentials.'
137
137
  end
138
138
 
139
139
  def supports_scrubbing?
@@ -159,7 +159,7 @@ module ActiveMerchant #:nodoc:
159
159
  xml = Builder::XmlMarkup.new
160
160
 
161
161
  xml.instruct!
162
- xml.tag! "Transaction", xmlns: "http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/encodedTypes" do
162
+ xml.tag! 'Transaction', xmlns: 'http://secure2.e-xact.com/vplug-in/transaction/rpc-enc/encodedTypes' do
163
163
  add_credentials(xml)
164
164
  add_transaction_type(xml, action)
165
165
  xml << body
@@ -208,19 +208,19 @@ module ActiveMerchant #:nodoc:
208
208
  end
209
209
 
210
210
  def add_credentials(xml)
211
- xml.tag! "ExactID", @options[:login]
212
- xml.tag! "Password", @options[:password]
211
+ xml.tag! 'ExactID', @options[:login]
212
+ xml.tag! 'Password', @options[:password]
213
213
  end
214
214
 
215
215
  def add_transaction_type(xml, action)
216
- xml.tag! "Transaction_Type", TRANSACTIONS[action]
216
+ xml.tag! 'Transaction_Type', TRANSACTIONS[action]
217
217
  end
218
218
 
219
219
  def add_identification(xml, identification)
220
- authorization_num, transaction_tag, _ = identification.split(";")
220
+ authorization_num, transaction_tag, _ = identification.split(';')
221
221
 
222
- xml.tag! "Authorization_Num", authorization_num
223
- xml.tag! "Transaction_Tag", transaction_tag
222
+ xml.tag! 'Authorization_Num', authorization_num
223
+ xml.tag! 'Transaction_Tag', transaction_tag
224
224
  end
225
225
 
226
226
  def add_amount(xml, money, options)
@@ -231,13 +231,13 @@ module ActiveMerchant #:nodoc:
231
231
 
232
232
  def add_credit_card(xml, credit_card, options)
233
233
  if credit_card.respond_to?(:track_data) && credit_card.track_data.present?
234
- xml.tag! "Track1", credit_card.track_data
235
- xml.tag! "Ecommerce_Flag", "R"
234
+ xml.tag! 'Track1', credit_card.track_data
235
+ xml.tag! 'Ecommerce_Flag', 'R'
236
236
  else
237
- xml.tag! "Card_Number", credit_card.number
238
- xml.tag! "Expiry_Date", expdate(credit_card)
239
- xml.tag! "CardHoldersName", credit_card.name
240
- xml.tag! "CardType", card_type(credit_card.brand)
237
+ xml.tag! 'Card_Number', credit_card.number
238
+ xml.tag! 'Expiry_Date', expdate(credit_card)
239
+ xml.tag! 'CardHoldersName', credit_card.name
240
+ xml.tag! 'CardType', card_type(credit_card.brand)
241
241
 
242
242
  add_credit_card_eci(xml, credit_card, options)
243
243
  add_credit_card_verification_strings(xml, credit_card, options)
@@ -245,16 +245,16 @@ module ActiveMerchant #:nodoc:
245
245
  end
246
246
 
247
247
  def add_credit_card_eci(xml, credit_card, options)
248
- eci = if credit_card.is_a?(NetworkTokenizationCreditCard) && credit_card.source == :apple_pay && card_brand(credit_card) == "discover"
248
+ eci = if credit_card.is_a?(NetworkTokenizationCreditCard) && credit_card.source == :apple_pay && card_brand(credit_card) == 'discover'
249
249
  # Discover requires any Apple Pay transaction, regardless of in-app
250
250
  # or web, and regardless of the ECI contained in the PKPaymentToken,
251
251
  # to have an ECI value explicitly of 04.
252
- "04"
252
+ '04'
253
253
  else
254
254
  (credit_card.respond_to?(:eci) ? credit_card.eci : nil) || options[:eci] || DEFAULT_ECI
255
255
  end
256
256
 
257
- xml.tag! "Ecommerce_Flag", eci.to_s =~ /^[0-9]+$/ ? eci.to_s.rjust(2, '0') : eci
257
+ xml.tag! 'Ecommerce_Flag', eci.to_s =~ /^[0-9]+$/ ? eci.to_s.rjust(2, '0') : eci
258
258
  end
259
259
 
260
260
  def add_credit_card_verification_strings(xml, credit_card, options)
@@ -262,15 +262,15 @@ module ActiveMerchant #:nodoc:
262
262
  if address
263
263
  address_values = []
264
264
  [:address1, :zip, :city, :state, :country].each { |part| address_values << address[part].to_s }
265
- xml.tag! "VerificationStr1", address_values.join("|")
265
+ xml.tag! 'VerificationStr1', address_values.join('|')
266
266
  end
267
267
 
268
268
  if credit_card.is_a?(NetworkTokenizationCreditCard)
269
269
  add_network_tokenization_credit_card(xml, credit_card)
270
270
  else
271
271
  if credit_card.verification_value?
272
- xml.tag! "CVD_Presence_Ind", "1"
273
- xml.tag! "VerificationStr2", credit_card.verification_value
272
+ xml.tag! 'CVD_Presence_Ind', '1'
273
+ xml.tag! 'VerificationStr2', credit_card.verification_value
274
274
  end
275
275
 
276
276
  add_card_authentication_data(xml, options)
@@ -281,21 +281,21 @@ module ActiveMerchant #:nodoc:
281
281
  case card_brand(credit_card).to_sym
282
282
  when :american_express
283
283
  cryptogram = Base64.decode64(credit_card.payment_cryptogram)
284
- xml.tag!("XID", Base64.encode64(cryptogram[20...40]))
285
- xml.tag!("CAVV", Base64.encode64(cryptogram[0...20]))
284
+ xml.tag!('XID', Base64.encode64(cryptogram[20...40]))
285
+ xml.tag!('CAVV', Base64.encode64(cryptogram[0...20]))
286
286
  else
287
- xml.tag!("XID", credit_card.transaction_id) if credit_card.transaction_id
288
- xml.tag!("CAVV", credit_card.payment_cryptogram)
287
+ xml.tag!('XID', credit_card.transaction_id) if credit_card.transaction_id
288
+ xml.tag!('CAVV', credit_card.payment_cryptogram)
289
289
  end
290
290
  end
291
291
 
292
292
  def add_card_authentication_data(xml, options)
293
- xml.tag! "CAVV", options[:cavv]
294
- xml.tag! "XID", options[:xid]
293
+ xml.tag! 'CAVV', options[:cavv]
294
+ xml.tag! 'XID', options[:xid]
295
295
  end
296
296
 
297
297
  def add_credit_card_token(xml, store_authorization, options)
298
- params = store_authorization.split(";")
298
+ params = store_authorization.split(';')
299
299
  credit_card = CreditCard.new(
300
300
  :brand => params[1],
301
301
  :first_name => params[2],
@@ -303,37 +303,37 @@ module ActiveMerchant #:nodoc:
303
303
  :month => params[4],
304
304
  :year => params[5])
305
305
 
306
- xml.tag! "TransarmorToken", params[0]
307
- xml.tag! "Expiry_Date", expdate(credit_card)
308
- xml.tag! "CardHoldersName", credit_card.name
309
- xml.tag! "CardType", card_type(credit_card.brand)
306
+ xml.tag! 'TransarmorToken', params[0]
307
+ xml.tag! 'Expiry_Date', expdate(credit_card)
308
+ xml.tag! 'CardHoldersName', credit_card.name
309
+ xml.tag! 'CardType', card_type(credit_card.brand)
310
310
  add_card_authentication_data(xml, options)
311
311
  end
312
312
 
313
313
  def add_customer_data(xml, options)
314
- xml.tag! "Customer_Ref", options[:customer] if options[:customer]
315
- xml.tag! "Client_IP", options[:ip] if options[:ip]
316
- xml.tag! "Client_Email", options[:email] if options[:email]
314
+ xml.tag! 'Customer_Ref', options[:customer] if options[:customer]
315
+ xml.tag! 'Client_IP', options[:ip] if options[:ip]
316
+ xml.tag! 'Client_Email', options[:email] if options[:email]
317
317
  end
318
318
 
319
319
  def add_address(xml, options)
320
320
  if address = (options[:billing_address] || options[:address])
321
- xml.tag! "ZipCode", address[:zip]
321
+ xml.tag! 'ZipCode', address[:zip]
322
322
  end
323
323
  end
324
324
 
325
325
  def add_invoice(xml, options)
326
- xml.tag! "Reference_No", options[:order_id]
327
- xml.tag! "Reference_3", options[:description] if options[:description]
326
+ xml.tag! 'Reference_No', options[:order_id]
327
+ xml.tag! 'Reference_3', options[:description] if options[:description]
328
328
  end
329
329
 
330
330
  def add_tax_fields(xml, options)
331
- xml.tag! "Tax1Amount", options[:tax1_amount] if options[:tax1_amount]
332
- xml.tag! "Tax1Number", options[:tax1_number] if options[:tax1_number]
331
+ xml.tag! 'Tax1Amount', options[:tax1_amount] if options[:tax1_amount]
332
+ xml.tag! 'Tax1Number', options[:tax1_number] if options[:tax1_number]
333
333
  end
334
334
 
335
335
  def add_level_3(xml, options)
336
- xml.tag!("Level3") { |x| x << options[:level_3] } if options[:level_3]
336
+ xml.tag!('Level3') { |x| x << options[:level_3] } if options[:level_3]
337
337
  end
338
338
 
339
339
  def expdate(credit_card)
@@ -379,9 +379,9 @@ module ActiveMerchant #:nodoc:
379
379
  response[:authorization_num],
380
380
  response[:transaction_tag],
381
381
  (response[:dollar_amount].to_f * 100).round
382
- ].join(";")
382
+ ].join(';')
383
383
  else
384
- ""
384
+ ''
385
385
  end
386
386
  end
387
387
 
@@ -394,7 +394,7 @@ module ActiveMerchant #:nodoc:
394
394
  credit_card.last_name,
395
395
  credit_card.month,
396
396
  credit_card.year
397
- ].map { |value| value.to_s.gsub(/;/, "") }.join(";")
397
+ ].map { |value| value.to_s.gsub(/;/, '') }.join(';')
398
398
  else
399
399
  raise StandardError, "TransArmor support is not enabled on your #{display_name} account"
400
400
  end
@@ -408,10 +408,10 @@ module ActiveMerchant #:nodoc:
408
408
  def message_from(response)
409
409
  if(response[:faultcode] && response[:faultstring])
410
410
  response[:faultstring]
411
- elsif(response[:error_number] && response[:error_number] != "0")
411
+ elsif(response[:error_number] && response[:error_number] != '0')
412
412
  response[:error_description]
413
413
  else
414
- result = (response[:exact_message] || "")
414
+ result = (response[:exact_message] || '')
415
415
  result << " - #{response[:bank_message]}" if response[:bank_message].present?
416
416
  result
417
417
  end
@@ -419,7 +419,7 @@ module ActiveMerchant #:nodoc:
419
419
 
420
420
  def parse_error(error)
421
421
  {
422
- :transaction_approved => "false",
422
+ :transaction_approved => 'false',
423
423
  :error_number => error.code,
424
424
  :error_description => error.body,
425
425
  :ecommerce_error_code => error.body.gsub(/[^\d]/, '')
@@ -434,7 +434,7 @@ module ActiveMerchant #:nodoc:
434
434
  response = {}
435
435
  xml = REXML::Document.new(xml)
436
436
 
437
- if root = REXML::XPath.first(xml, "//TransactionResult")
437
+ if root = REXML::XPath.first(xml, '//TransactionResult')
438
438
  parse_elements(response, root)
439
439
  end
440
440
 
@@ -443,7 +443,7 @@ module ActiveMerchant #:nodoc:
443
443
 
444
444
  def parse_elements(response, root)
445
445
  root.elements.to_a.each do |node|
446
- response[node.name.gsub(/EXact/, "Exact").underscore.to_sym] = (node.text || "").strip
446
+ response[node.name.gsub(/EXact/, 'Exact').underscore.to_sym] = (node.text || '').strip
447
447
  end
448
448
  end
449
449
  end