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
@@ -13,10 +13,10 @@ module ActiveMerchant #:nodoc:
13
13
  self.supported_cardtypes = [:visa, :master, :american_express, :diners_club]
14
14
 
15
15
  BRAND_MAP = {
16
- "visa" => "VISA",
17
- "master" => "MC",
18
- "american_express" => "AMEX",
19
- "diners_club" => "DINERS"
16
+ 'visa' => 'VISA',
17
+ 'master' => 'MC',
18
+ 'american_express' => 'AMEX',
19
+ 'diners_club' => 'DINERS'
20
20
  }
21
21
 
22
22
  def initialize(options={})
@@ -37,7 +37,7 @@ module ActiveMerchant #:nodoc:
37
37
  add_payment_method(post, payment_method)
38
38
  add_customer_data(post, options)
39
39
 
40
- commit("ProcessAuthorise", post)
40
+ commit('ProcessAuthorise', post)
41
41
  end
42
42
 
43
43
  def capture(amount, authorization, options={})
@@ -46,7 +46,7 @@ module ActiveMerchant #:nodoc:
46
46
  add_reference(post, authorization)
47
47
  add_customer_data(post, options)
48
48
 
49
- commit("ProcessCapture", post)
49
+ commit('ProcessCapture', post)
50
50
  end
51
51
 
52
52
  def refund(amount, authorization, options={})
@@ -55,7 +55,7 @@ module ActiveMerchant #:nodoc:
55
55
  add_reference(post, authorization)
56
56
  add_customer_data(post, options)
57
57
 
58
- commit("ProcessRefund", post)
58
+ commit('ProcessRefund', post)
59
59
  end
60
60
 
61
61
  def supports_scrubbing?
@@ -72,7 +72,7 @@ module ActiveMerchant #:nodoc:
72
72
  private
73
73
 
74
74
  CURRENCY_CODES = Hash.new{|h,k| raise ArgumentError.new("Unsupported currency: #{k}")}
75
- CURRENCY_CODES["NZD"] = "554"
75
+ CURRENCY_CODES['NZD'] = '554'
76
76
 
77
77
  def add_invoice(post, money, options)
78
78
  post[:Amount] = amount(money)
@@ -107,7 +107,7 @@ module ActiveMerchant #:nodoc:
107
107
  begin
108
108
  raw = parse(ssl_post(url, data, headers(action)), action)
109
109
  rescue ActiveMerchant::ResponseError => e
110
- if(e.response.code == "500" && e.response.body.start_with?("<?xml"))
110
+ if(e.response.code == '500' && e.response.body.start_with?('<?xml'))
111
111
  raw = parse(e.response.body, action)
112
112
  else
113
113
  raise
@@ -161,7 +161,7 @@ module ActiveMerchant #:nodoc:
161
161
  def parse(body, action)
162
162
  response = {}
163
163
  xml = REXML::Document.new(body)
164
- root = (REXML::XPath.first(xml, "//#{action}Response") || REXML::XPath.first(xml, "//detail"))
164
+ root = (REXML::XPath.first(xml, "//#{action}Response") || REXML::XPath.first(xml, '//detail'))
165
165
 
166
166
  root.elements.to_a.each do |node|
167
167
  parse_element(response, node)
@@ -184,9 +184,9 @@ module ActiveMerchant #:nodoc:
184
184
 
185
185
  def message_from(succeeded, response)
186
186
  if succeeded
187
- "Succeeded"
187
+ 'Succeeded'
188
188
  else
189
- response[:message] || response[:errormessage] || "Unable to read error message"
189
+ response[:message] || response[:errormessage] || 'Unable to read error message'
190
190
  end
191
191
  end
192
192
 
@@ -9,7 +9,7 @@ module ActiveMerchant #:nodoc:
9
9
  add_payment_method(post, payment_method)
10
10
  add_customer_data(post, options)
11
11
 
12
- commit("ProcessPurchase", post)
12
+ commit('ProcessPurchase', post)
13
13
  end
14
14
 
15
15
  # Flo2Cash's "simple mode" does not support auth/capture
@@ -27,7 +27,7 @@ module ActiveMerchant #:nodoc:
27
27
  add_payment_method(post, payment_method)
28
28
  add_billing_address(post, payment_method, options)
29
29
  add_shipping_address(post, options)
30
- post[:action] = "sale"
30
+ post[:action] = 'sale'
31
31
 
32
32
  commit(:post, post)
33
33
  end
@@ -39,7 +39,7 @@ module ActiveMerchant #:nodoc:
39
39
  add_payment_method(post, payment_method)
40
40
  add_billing_address(post, payment_method, options)
41
41
  add_shipping_address(post, options)
42
- post[:action] = "authorize"
42
+ post[:action] = 'authorize'
43
43
 
44
44
  commit(:post, post)
45
45
  end
@@ -47,8 +47,8 @@ module ActiveMerchant #:nodoc:
47
47
  def capture(money, authorization, options={})
48
48
  post = {}
49
49
  post[:transaction_id] = transaction_id_from(authorization)
50
- post[:authorization_code] = authorization_code_from(authorization) || ""
51
- post[:action] = "capture"
50
+ post[:authorization_code] = authorization_code_from(authorization) || ''
51
+ post[:action] = 'capture'
52
52
 
53
53
  commit(:put, post)
54
54
  end
@@ -59,7 +59,17 @@ module ActiveMerchant #:nodoc:
59
59
  add_invoice(post, options)
60
60
  add_payment_method(post, payment_method)
61
61
  add_billing_address(post, payment_method, options)
62
- post[:action] = "disburse"
62
+ post[:action] = 'disburse'
63
+
64
+ commit(:post, post)
65
+ end
66
+
67
+ def refund(money, authorization, options={})
68
+ post = {}
69
+ add_amount(post, money, options)
70
+ post[:original_transaction_id] = transaction_id_from(authorization)
71
+ post[:authorization_code] = authorization_code_from(authorization)
72
+ post[:action] = 'reverse'
63
73
 
64
74
  commit(:post, post)
65
75
  end
@@ -68,7 +78,7 @@ module ActiveMerchant #:nodoc:
68
78
  post = {}
69
79
  post[:transaction_id] = transaction_id_from(authorization)
70
80
  post[:authorization_code] = authorization_code_from(authorization)
71
- post[:action] = "void"
81
+ post[:action] = 'void'
72
82
 
73
83
  commit(:put, post)
74
84
  end
@@ -120,11 +130,11 @@ module ActiveMerchant #:nodoc:
120
130
  post[:billing_address][:physical_address][:locality] = address[:city] if address[:city]
121
131
  end
122
132
 
123
- if empty?(post[:billing_address][:first_name] && payment.first_name)
133
+ if empty?(post[:billing_address][:first_name]) && payment.first_name
124
134
  post[:billing_address][:first_name] = payment.first_name
125
135
  end
126
136
 
127
- if empty?(post[:billing_address][:last_name] && payment.last_name)
137
+ if empty?(post[:billing_address][:last_name]) && payment.last_name
128
138
  post[:billing_address][:last_name] = payment.last_name
129
139
  end
130
140
  end
@@ -182,8 +192,8 @@ module ActiveMerchant #:nodoc:
182
192
  message_from(response),
183
193
  response,
184
194
  authorization: authorization_from(response),
185
- avs_result: AVSResult.new(code: response["response"]["avs_result"]),
186
- cvv_result: CVVResult.new(response["response"]["cvv_code"]),
195
+ avs_result: AVSResult.new(code: response['response']['avs_result']),
196
+ cvv_result: CVVResult.new(response['response']['cvv_code']),
187
197
  test: test?
188
198
  )
189
199
  end
@@ -202,24 +212,24 @@ module ActiveMerchant #:nodoc:
202
212
  end
203
213
 
204
214
  def success_from(response)
205
- response["response"]["response_code"] == "A01"
215
+ response['response']['response_code'] == 'A01'
206
216
  end
207
217
 
208
218
  def message_from(response)
209
- response["response"]["response_desc"]
219
+ response['response']['response_desc']
210
220
  end
211
221
 
212
222
  def authorization_from(response)
213
- [response.try(:[], "transaction_id"), response.try(:[], "response").try(:[], "authorization_code")].join("#")
223
+ [response.try(:[], 'transaction_id'), response.try(:[], 'response').try(:[], 'authorization_code')].join('#')
214
224
  end
215
225
 
216
226
  def endpoint
217
- "/accounts/act_#{@options[:account_id]}/locations/loc_#{@options[:location_id]}/transactions/"
227
+ "/accounts/act_#{@options[:account_id].strip}/locations/loc_#{@options[:location_id].strip}/transactions/"
218
228
  end
219
229
 
220
230
  def headers
221
231
  {
222
- 'Authorization' => ("Basic " + Base64.strict_encode64("#{@options[:api_key]}:#{@options[:secret]}")),
232
+ 'Authorization' => ('Basic ' + Base64.strict_encode64("#{@options[:api_key]}:#{@options[:secret]}")),
223
233
  'X-Forte-Auth-Account-Id' => "act_#{@options[:account_id]}",
224
234
  'Content-Type' => 'application/json'
225
235
  }
@@ -239,7 +249,7 @@ module ActiveMerchant #:nodoc:
239
249
  end
240
250
 
241
251
  def split_authorization(authorization)
242
- authorization.split("#")
252
+ authorization.split('#')
243
253
  end
244
254
 
245
255
  def authorization_code_from(authorization)
@@ -37,24 +37,24 @@ module ActiveMerchant #:nodoc:
37
37
  end
38
38
 
39
39
  def purchase(money, credit_card, options = {})
40
- options = options.merge(:gvp_order_type => "sales")
40
+ options = options.merge(:gvp_order_type => 'sales')
41
41
  commit(money, build_sale_request(money, credit_card, options))
42
42
  end
43
43
 
44
44
  def authorize(money, credit_card, options = {})
45
- options = options.merge(:gvp_order_type => "preauth")
45
+ options = options.merge(:gvp_order_type => 'preauth')
46
46
  commit(money, build_authorize_request(money, credit_card, options))
47
47
  end
48
48
 
49
49
  def capture(money, ref_id, options = {})
50
- options = options.merge(:gvp_order_type => "postauth")
50
+ options = options.merge(:gvp_order_type => 'postauth')
51
51
  commit(money, build_capture_request(money, ref_id, options))
52
52
  end
53
53
 
54
54
  private
55
55
 
56
56
  def security_data
57
- rjusted_terminal_id = @options[:terminal_id].to_s.rjust(9, "0")
57
+ rjusted_terminal_id = @options[:terminal_id].to_s.rjust(9, '0')
58
58
  Digest::SHA1.hexdigest(@options[:password].to_s + rjusted_terminal_id).upcase
59
59
  end
60
60
 
@@ -68,7 +68,7 @@ module ActiveMerchant #:nodoc:
68
68
  hash_data = generate_hash_data(format_order_id(options[:order_id]), @options[:terminal_id], card_number, amount(money), security_data)
69
69
 
70
70
  xml = Builder::XmlMarkup.new(:indent => 2)
71
- xml.instruct! :xml, :version => "1.0", :encoding => "UTF-8"
71
+ xml.instruct! :xml, :version => '1.0', :encoding => 'UTF-8'
72
72
 
73
73
  xml.tag! 'GVPSRequest' do
74
74
  xml.tag! 'Mode', test? ? 'TEST' : 'PROD'
@@ -103,7 +103,7 @@ module ActiveMerchant #:nodoc:
103
103
  end
104
104
 
105
105
  def build_authorize_request(money, credit_card, options)
106
- build_xml_request(money, credit_card, options) do |xml|
106
+ build_xml_request(money, credit_card, options) do |xml|
107
107
  add_customer_data(xml, options)
108
108
  add_order_data(xml, options) do
109
109
  add_addresses(xml, options)
@@ -117,7 +117,7 @@ module ActiveMerchant #:nodoc:
117
117
 
118
118
  def build_capture_request(money, ref_id, options)
119
119
  options = options.merge(:order_id => ref_id)
120
- build_xml_request(money, ref_id, options) do |xml|
120
+ build_xml_request(money, ref_id, options) do |xml|
121
121
  add_customer_data(xml, options)
122
122
  add_order_data(xml, options)
123
123
  add_transaction_data(xml, money, options)
@@ -197,10 +197,8 @@ module ActiveMerchant #:nodoc:
197
197
 
198
198
  if ActiveSupport::Inflector.method(:transliterate).arity == -2
199
199
  ActiveSupport::Inflector.transliterate(text,'')
200
- elsif RUBY_VERSION >= '1.9'
201
- text.gsub(/[^\x00-\x7F]+/, '')
202
200
  else
203
- ActiveSupport::Inflector.transliterate(text).to_s
201
+ text.gsub(/[^\x00-\x7F]+/, '')
204
202
  end
205
203
  end
206
204
 
@@ -219,7 +217,7 @@ module ActiveMerchant #:nodoc:
219
217
 
220
218
  def commit(money,request)
221
219
  url = test? ? self.test_url : self.live_url
222
- raw_response = ssl_post(url, "data=" + request)
220
+ raw_response = ssl_post(url, 'data=' + request)
223
221
  response = parse(raw_response)
224
222
 
225
223
  success = success?(response)
@@ -250,7 +248,7 @@ module ActiveMerchant #:nodoc:
250
248
  end
251
249
 
252
250
  def success?(response)
253
- response[:message] == "Approved"
251
+ response[:message] == 'Approved'
254
252
  end
255
253
 
256
254
  def strip_invalid_xml_chars(xml)
@@ -1,14 +1,14 @@
1
1
  module ActiveMerchant #:nodoc:
2
2
  module Billing #:nodoc:
3
3
  class GlobalCollectGateway < Gateway
4
- self.display_name = "GlobalCollect"
5
- self.homepage_url = "http://www.globalcollect.com/"
4
+ self.display_name = 'GlobalCollect'
5
+ self.homepage_url = 'http://www.globalcollect.com/'
6
6
 
7
- self.test_url = "https://api-sandbox.globalcollect.com/"
8
- self.live_url = "https://api.globalcollect.com/"
7
+ self.test_url = 'https://api-sandbox.globalcollect.com/'
8
+ self.live_url = 'https://api.globalcollect.com/'
9
9
 
10
- self.supported_countries = ["AD", "AE", "AG", "AI", "AL", "AM", "AO", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IS", "IT", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PL", "PN", "PS", "PT", "PW", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SR", "ST", "SV", "SZ", "TC", "TD", "TG", "TH", "TJ", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "US", "UY", "UZ", "VC", "VE", "VG", "VI", "VN", "WF", "WS", "ZA", "ZM", "ZW"]
11
- self.default_currency = "USD"
10
+ self.supported_countries = ['AD', 'AE', 'AG', 'AI', 'AL', 'AM', 'AO', 'AR', 'AS', 'AT', 'AU', 'AW', 'AX', 'AZ', 'BA', 'BB', 'BD', 'BE', 'BF', 'BG', 'BH', 'BI', 'BJ', 'BL', 'BM', 'BN', 'BO', 'BQ', 'BR', 'BS', 'BT', 'BW', 'BY', 'BZ', 'CA', 'CC', 'CD', 'CF', 'CH', 'CI', 'CK', 'CL', 'CM', 'CN', 'CO', 'CR', 'CU', 'CV', 'CW', 'CX', 'CY', 'CZ', 'DE', 'DJ', 'DK', 'DM', 'DO', 'DZ', 'EC', 'EE', 'EG', 'ER', 'ES', 'ET', 'FI', 'FJ', 'FK', 'FM', 'FO', 'FR', 'GA', 'GB', 'GD', 'GE', 'GF', 'GH', 'GI', 'GL', 'GM', 'GN', 'GP', 'GQ', 'GR', 'GS', 'GT', 'GU', 'GW', 'GY', 'HK', 'HN', 'HR', 'HT', 'HU', 'ID', 'IE', 'IL', 'IM', 'IN', 'IS', 'IT', 'JM', 'JO', 'JP', 'KE', 'KG', 'KH', 'KI', 'KM', 'KN', 'KR', 'KW', 'KY', 'KZ', 'LA', 'LB', 'LC', 'LI', 'LK', 'LR', 'LS', 'LT', 'LU', 'LV', 'MA', 'MC', 'MD', 'ME', 'MF', 'MG', 'MH', 'MK', 'MM', 'MN', 'MO', 'MP', 'MQ', 'MR', 'MS', 'MT', 'MU', 'MV', 'MW', 'MX', 'MY', 'MZ', 'NA', 'NC', 'NE', 'NG', 'NI', 'NL', 'NO', 'NP', 'NR', 'NU', 'NZ', 'OM', 'PA', 'PE', 'PF', 'PG', 'PH', 'PL', 'PN', 'PS', 'PT', 'PW', 'QA', 'RE', 'RO', 'RS', 'RU', 'RW', 'SA', 'SB', 'SC', 'SE', 'SG', 'SH', 'SI', 'SJ', 'SK', 'SL', 'SM', 'SN', 'SR', 'ST', 'SV', 'SZ', 'TC', 'TD', 'TG', 'TH', 'TJ', 'TL', 'TM', 'TN', 'TO', 'TR', 'TT', 'TV', 'TW', 'TZ', 'UA', 'UG', 'US', 'UY', 'UZ', 'VC', 'VE', 'VG', 'VI', 'VN', 'WF', 'WS', 'ZA', 'ZM', 'ZW']
11
+ self.default_currency = 'USD'
12
12
  self.money_format = :cents
13
13
  self.supported_cardtypes = [:visa, :master, :american_express, :discover]
14
14
 
@@ -79,25 +79,25 @@ module ActiveMerchant #:nodoc:
79
79
  private
80
80
 
81
81
  BRAND_MAP = {
82
- "visa" => "1",
83
- "american_express" => "2",
84
- "master" => "3",
85
- "discover" => "128",
86
- "jcb" => "125",
87
- "diners_club" => "132"
82
+ 'visa' => '1',
83
+ 'american_express' => '2',
84
+ 'master' => '3',
85
+ 'discover' => '128',
86
+ 'jcb' => '125',
87
+ 'diners_club' => '132'
88
88
  }
89
89
 
90
90
  def add_order(post, money, options)
91
- post["order"]["amountOfMoney"] = {
92
- "amount" => amount(money),
93
- "currencyCode" => options[:currency] || currency(money)
91
+ post['order']['amountOfMoney'] = {
92
+ 'amount' => amount(money),
93
+ 'currencyCode' => options[:currency] || currency(money)
94
94
  }
95
- post["order"]["references"] = {
96
- "merchantReference" => options[:order_id],
97
- "descriptor" => options[:description] # Max 256 chars
95
+ post['order']['references'] = {
96
+ 'merchantReference' => options[:order_id],
97
+ 'descriptor' => options[:description] # Max 256 chars
98
98
  }
99
- post["order"]["references"]["invoiceData"] = {
100
- "invoiceNumber" => options[:invoice]
99
+ post['order']['references']['invoiceData'] = {
100
+ 'invoiceNumber' => options[:invoice]
101
101
  }
102
102
  end
103
103
 
@@ -113,9 +113,9 @@ module ActiveMerchant #:nodoc:
113
113
  end
114
114
 
115
115
  def add_amount(post, money, options={})
116
- post["amountOfMoney"] = {
117
- "amount" => amount(money),
118
- "currencyCode" => options[:currency] || currency(money)
116
+ post['amountOfMoney'] = {
117
+ 'amount' => amount(money),
118
+ 'currencyCode' => options[:currency] || currency(money)
119
119
  }
120
120
  end
121
121
 
@@ -125,53 +125,53 @@ module ActiveMerchant #:nodoc:
125
125
  expirydate = "#{month}#{year}"
126
126
  pre_authorization = options[:pre_authorization] ? 'PRE_AUTHORIZATION' : 'FINAL_AUTHORIZATION'
127
127
 
128
- post["cardPaymentMethodSpecificInput"] = {
129
- "paymentProductId" => BRAND_MAP[payment.brand],
130
- "skipAuthentication" => "true", # refers to 3DSecure
131
- "skipFraudService" => "true",
132
- "authorizationMode" => pre_authorization
128
+ post['cardPaymentMethodSpecificInput'] = {
129
+ 'paymentProductId' => BRAND_MAP[payment.brand],
130
+ 'skipAuthentication' => 'true', # refers to 3DSecure
131
+ 'skipFraudService' => 'true',
132
+ 'authorizationMode' => pre_authorization
133
133
  }
134
- post["cardPaymentMethodSpecificInput"]["card"] = {
135
- "cvv" => payment.verification_value,
136
- "cardNumber" => payment.number,
137
- "expiryDate" => expirydate,
138
- "cardholderName" => payment.name
134
+ post['cardPaymentMethodSpecificInput']['card'] = {
135
+ 'cvv' => payment.verification_value,
136
+ 'cardNumber' => payment.number,
137
+ 'expiryDate' => expirydate,
138
+ 'cardholderName' => payment.name
139
139
  }
140
140
  end
141
141
 
142
142
  def add_customer_data(post, options, payment = nil)
143
- post["order"]["customer"] = {
144
- "merchantCustomerId" => options[:customer]
143
+ post['order']['customer'] = {
144
+ 'merchantCustomerId' => options[:customer]
145
145
  }
146
146
  if payment
147
- post["order"]["customer"]["personalInformation"] = {
148
- "name" => {
149
- "firstName" => payment.first_name[0..14],
150
- "surname" => payment.last_name[0..69]
147
+ post['order']['customer']['personalInformation'] = {
148
+ 'name' => {
149
+ 'firstName' => payment.first_name[0..14],
150
+ 'surname' => payment.last_name[0..69]
151
151
  }
152
152
  }
153
153
  end
154
- post["order"]["companyInformation"] = {
155
- "name" => options[:company]
154
+ post['order']['companyInformation'] = {
155
+ 'name' => options[:company]
156
156
  }
157
- post["order"]["contactDetails"] = {
158
- "emailAddress" => options[:email]
157
+ post['order']['contactDetails'] = {
158
+ 'emailAddress' => options[:email]
159
159
  }
160
160
  if address = options[:billing_address] || options[:address]
161
- post["order"]["contactDetails"] = {
162
- "phoneNumber" => address[:phone]
161
+ post['order']['contactDetails'] = {
162
+ 'phoneNumber' => address[:phone]
163
163
  }
164
164
  end
165
165
  end
166
166
 
167
167
  def add_refund_customer_data(post, options)
168
168
  if address = options[:billing_address] || options[:address]
169
- post["customer"]["address"] = {
170
- "countryCode" => address[:country]
169
+ post['customer']['address'] = {
170
+ 'countryCode' => address[:country]
171
171
  }
172
- post["customer"]["contactDetails"] = {
173
- "emailAddress" => options[:email],
174
- "phoneNumber" => address[:phone]
172
+ post['customer']['contactDetails'] = {
173
+ 'emailAddress' => options[:email],
174
+ 'phoneNumber' => address[:phone]
175
175
  }
176
176
  end
177
177
  end
@@ -180,27 +180,27 @@ module ActiveMerchant #:nodoc:
180
180
  billing_address = options[:billing_address] || options[:address]
181
181
  shipping_address = options[:shipping_address]
182
182
  if billing_address = options[:billing_address] || options[:address]
183
- post["order"]["customer"]["billingAddress"] = {
184
- "street" => billing_address[:address1],
185
- "additionalInfo" => billing_address[:address2],
186
- "zip" => billing_address[:zip],
187
- "city" => billing_address[:city],
188
- "state" => billing_address[:state],
189
- "countryCode" => billing_address[:country]
183
+ post['order']['customer']['billingAddress'] = {
184
+ 'street' => billing_address[:address1],
185
+ 'additionalInfo' => billing_address[:address2],
186
+ 'zip' => billing_address[:zip],
187
+ 'city' => billing_address[:city],
188
+ 'state' => billing_address[:state],
189
+ 'countryCode' => billing_address[:country]
190
190
  }
191
191
  end
192
192
  if shipping_address
193
- post["order"]["customer"]["shippingAddress"] = {
194
- "street" => shipping_address[:address1],
195
- "additionalInfo" => shipping_address[:address2],
196
- "zip" => shipping_address[:zip],
197
- "city" => shipping_address[:city],
198
- "state" => shipping_address[:state],
199
- "countryCode" => shipping_address[:country]
193
+ post['order']['customer']['shippingAddress'] = {
194
+ 'street' => shipping_address[:address1],
195
+ 'additionalInfo' => shipping_address[:address2],
196
+ 'zip' => shipping_address[:zip],
197
+ 'city' => shipping_address[:city],
198
+ 'state' => shipping_address[:state],
199
+ 'countryCode' => shipping_address[:country]
200
200
  }
201
- post["order"]["customer"]["shippingAddress"]["name"] = {
202
- "firstName" => shipping_address[:firstname],
203
- "surname" => shipping_address[:lastname]
201
+ post['order']['customer']['shippingAddress']['name'] = {
202
+ 'firstName' => shipping_address[:firstname],
203
+ 'surname' => shipping_address[:lastname]
204
204
  }
205
205
  end
206
206
  end
@@ -210,7 +210,7 @@ module ActiveMerchant #:nodoc:
210
210
  fraud_fields.merge!(options[:fraud_fields]) if options[:fraud_fields]
211
211
  fraud_fields.merge!({customerIpAddress: options[:ip]}) if options[:ip]
212
212
 
213
- post["fraudFields"] = fraud_fields unless fraud_fields.empty?
213
+ post['fraudFields'] = fraud_fields unless fraud_fields.empty?
214
214
  end
215
215
 
216
216
  def parse(body)
@@ -225,7 +225,7 @@ module ActiveMerchant #:nodoc:
225
225
  uri = "/v1/#{@options[:merchant_id]}/"
226
226
  case action
227
227
  when :authorize
228
- uri + "payments"
228
+ uri + 'payments'
229
229
  when :capture
230
230
  uri + "payments/#{authorization}/approve"
231
231
  when :refund
@@ -258,9 +258,9 @@ module ActiveMerchant #:nodoc:
258
258
 
259
259
  def headers(action, post, authorization = nil)
260
260
  {
261
- "Content-Type" => content_type,
262
- "Authorization" => auth_digest(action, post, authorization),
263
- "Date" => date
261
+ 'Content-Type' => content_type,
262
+ 'Authorization' => auth_digest(action, post, authorization),
263
+ 'Date' => date
264
264
  }
265
265
  end
266
266
 
@@ -277,47 +277,47 @@ EOS
277
277
  end
278
278
 
279
279
  def date
280
- @date ||= Time.now.strftime("%a, %d %b %Y %H:%M:%S %Z") # Must be same in digest and HTTP header
280
+ @date ||= Time.now.strftime('%a, %d %b %Y %H:%M:%S %Z') # Must be same in digest and HTTP header
281
281
  end
282
282
 
283
283
  def content_type
284
- "application/json"
284
+ 'application/json'
285
285
  end
286
286
 
287
287
  def success_from(response)
288
- !response["errorId"] && response["status"] != "REJECTED"
288
+ !response['errorId'] && response['status'] != 'REJECTED'
289
289
  end
290
290
 
291
291
  def message_from(succeeded, response)
292
292
  if succeeded
293
- "Succeeded"
293
+ 'Succeeded'
294
294
  else
295
- if errors = response["errors"]
296
- errors.first.try(:[], "message")
297
- elsif status = response["status"]
298
- "Status: " + status
295
+ if errors = response['errors']
296
+ errors.first.try(:[], 'message')
297
+ elsif status = response['status']
298
+ 'Status: ' + status
299
299
  else
300
- "No message available"
300
+ 'No message available'
301
301
  end
302
302
  end
303
303
  end
304
304
 
305
305
  def authorization_from(succeeded, response)
306
306
  if succeeded
307
- response["id"] || response["payment"]["id"] || response["paymentResult"]["payment"]["id"]
307
+ response['id'] || response['payment']['id'] || response['paymentResult']['payment']['id']
308
308
  else
309
- response["errorId"]
309
+ response['errorId']
310
310
  end
311
311
  end
312
312
 
313
313
  def error_code_from(succeeded, response)
314
314
  unless succeeded
315
- if errors = response["errors"]
316
- errors.first.try(:[], "code")
317
- elsif status = response.try(:[], "statusOutput").try(:[], "statusCode")
315
+ if errors = response['errors']
316
+ errors.first.try(:[], 'code')
317
+ elsif status = response.try(:[], 'statusOutput').try(:[], 'statusCode')
318
318
  status.to_s
319
319
  else
320
- "No error code available"
320
+ 'No error code available'
321
321
  end
322
322
  end
323
323
  end
@@ -327,7 +327,7 @@ EOS
327
327
  end
328
328
 
329
329
  def capture_requested?(response)
330
- response.params.try(:[], "payment").try(:[], "status") == "CAPTURE_REQUESTED"
330
+ response.params.try(:[], 'payment').try(:[], 'status') == 'CAPTURE_REQUESTED'
331
331
  end
332
332
  end
333
333
  end