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
@@ -57,7 +57,7 @@ module ActiveMerchant #:nodoc:
57
57
  # * <tt>:test</tt> -- +true+ or +false+. If true, perform transactions against the test server.
58
58
  # Otherwise, perform transactions against the production server.
59
59
  def initialize(options = {})
60
- ActiveMerchant.deprecated "ARB functionality in ActiveMerchant is deprecated and will be removed in a future version. Please contact the ActiveMerchant maintainers if you have an interest in taking ownership of a separate gem that continues support for it."
60
+ ActiveMerchant.deprecated 'ARB functionality in ActiveMerchant is deprecated and will be removed in a future version. Please contact the ActiveMerchant maintainers if you have an interest in taking ownership of a separate gem that continues support for it.'
61
61
  requires!(options, :login, :password)
62
62
  super
63
63
  end
@@ -377,7 +377,7 @@ module ActiveMerchant #:nodoc:
377
377
 
378
378
  def recurring_commit(action, request)
379
379
  url = test? ? test_url : live_url
380
- xml = ssl_post(url, request, "Content-Type" => "text/xml")
380
+ xml = ssl_post(url, request, 'Content-Type' => 'text/xml')
381
381
 
382
382
  response = recurring_parse(action, xml)
383
383
 
@@ -395,7 +395,7 @@ module ActiveMerchant #:nodoc:
395
395
  response = {}
396
396
  xml = REXML::Document.new(xml)
397
397
  root = REXML::XPath.first(xml, "//#{RECURRING_ACTIONS[action]}Response") ||
398
- REXML::XPath.first(xml, "//ErrorResponse")
398
+ REXML::XPath.first(xml, '//ErrorResponse')
399
399
  if root
400
400
  root.elements.to_a.each do |node|
401
401
  recurring_parse_element(response, node)
@@ -854,11 +854,11 @@ module ActiveMerchant #:nodoc:
854
854
 
855
855
  def commit(action, request)
856
856
  url = test? ? test_url : live_url
857
- xml = ssl_post(url, request, "Content-Type" => "text/xml")
857
+ xml = ssl_post(url, request, 'Content-Type' => 'text/xml')
858
858
 
859
859
  response_params = parse(action, xml)
860
860
 
861
- message_element= response_params["messages"]["message"]
861
+ message_element= response_params['messages']['message']
862
862
  first_error = message_element.is_a?(Array) ? message_element.first : message_element
863
863
  message = first_error['text']
864
864
  test_mode = @options[:test_requests] || message =~ /Test Mode/
@@ -942,7 +942,7 @@ module ActiveMerchant #:nodoc:
942
942
  def parse(action, xml)
943
943
  xml = REXML::Document.new(xml)
944
944
  root = REXML::XPath.first(xml, "//#{CIM_ACTIONS[action]}Response") ||
945
- REXML::XPath.first(xml, "//ErrorResponse")
945
+ REXML::XPath.first(xml, '//ErrorResponse')
946
946
  if root
947
947
  response = parse_element(root)
948
948
  end
@@ -1,8 +1,8 @@
1
1
  module ActiveMerchant #:nodoc:
2
2
  module Billing #:nodoc:
3
3
  class AxcessmsGateway < Gateway
4
- self.test_url = "https://test.ctpe.io/payment/ctpe"
5
- self.live_url = "https://ctpe.io/payment/ctpe"
4
+ self.test_url = 'https://test.ctpe.io/payment/ctpe'
5
+ self.live_url = 'https://ctpe.io/payment/ctpe'
6
6
 
7
7
  self.supported_countries = %w(AD AT BE BG BR CA CH CY CZ DE DK EE ES FI FO FR GB
8
8
  GI GR HR HU IE IL IM IS IT LI LT LU LV MC MT MX NL
@@ -10,18 +10,18 @@ module ActiveMerchant #:nodoc:
10
10
 
11
11
  self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb, :maestro, :solo]
12
12
 
13
- self.homepage_url = "http://www.axcessms.com/"
14
- self.display_name = "Axcess MS"
13
+ self.homepage_url = 'http://www.axcessms.com/'
14
+ self.display_name = 'Axcess MS'
15
15
  self.money_format = :dollars
16
- self.default_currency = "GBP"
16
+ self.default_currency = 'GBP'
17
17
 
18
- API_VERSION = "1.0"
19
- PAYMENT_CODE_PREAUTHORIZATION = "CC.PA"
20
- PAYMENT_CODE_DEBIT = "CC.DB"
21
- PAYMENT_CODE_CAPTURE = "CC.CP"
22
- PAYMENT_CODE_REVERSAL = "CC.RV"
23
- PAYMENT_CODE_REFUND = "CC.RF"
24
- PAYMENT_CODE_REBILL = "CC.RB"
18
+ API_VERSION = '1.0'
19
+ PAYMENT_CODE_PREAUTHORIZATION = 'CC.PA'
20
+ PAYMENT_CODE_DEBIT = 'CC.DB'
21
+ PAYMENT_CODE_CAPTURE = 'CC.CP'
22
+ PAYMENT_CODE_REVERSAL = 'CC.RV'
23
+ PAYMENT_CODE_REFUND = 'CC.RF'
24
+ PAYMENT_CODE_REBILL = 'CC.RB'
25
25
 
26
26
  def initialize(options={})
27
27
  requires!(options, :sender, :login, :password, :channel)
@@ -59,21 +59,21 @@ module ActiveMerchant #:nodoc:
59
59
  private
60
60
 
61
61
  def commit(paymentcode, money, payment, options)
62
- options[:mode] ||= (test? ? "INTEGRATOR_TEST" : "LIVE")
62
+ options[:mode] ||= (test? ? 'INTEGRATOR_TEST' : 'LIVE')
63
63
  request = build_request(paymentcode, money, payment, options)
64
64
 
65
65
  headers = {
66
- "Content-Type" => "application/x-www-form-urlencoded;charset=UTF-8"
66
+ 'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8'
67
67
  }
68
68
 
69
69
  response = parse(ssl_post((test? ? test_url : live_url), "load=#{CGI.escape(request)}", headers))
70
- success = (response[:result] == "ACK")
70
+ success = (response[:result] == 'ACK')
71
71
  message = "#{response[:reason]} - #{response[:return]}"
72
72
  authorization = response[:unique_id]
73
73
 
74
74
  Response.new(success, message, response,
75
75
  :authorization => authorization,
76
- :test => (response[:mode] != "LIVE")
76
+ :test => (response[:mode] != 'LIVE')
77
77
  )
78
78
  end
79
79
 
@@ -87,7 +87,7 @@ module ActiveMerchant #:nodoc:
87
87
  parse_element(response, node)
88
88
  end
89
89
 
90
- response[:mode] = REXML::XPath.first(xml, "//Transaction").attributes["mode"]
90
+ response[:mode] = REXML::XPath.first(xml, '//Transaction').attributes['mode']
91
91
 
92
92
  response
93
93
  end
@@ -107,30 +107,30 @@ module ActiveMerchant #:nodoc:
107
107
  def build_request(payment_code, money, payment, options)
108
108
  xml = Builder::XmlMarkup.new :indent => 2
109
109
  xml.instruct!
110
- xml.tag! "Request", "version" => API_VERSION do
111
- xml.tag! "Header" do
112
- xml.tag! "Security", "sender" => @options[:sender]
110
+ xml.tag! 'Request', 'version' => API_VERSION do
111
+ xml.tag! 'Header' do
112
+ xml.tag! 'Security', 'sender' => @options[:sender]
113
113
  end
114
- xml.tag! "Transaction", "mode" => options[:mode], "channel" => @options[:channel], "response" => "SYNC" do
115
- xml.tag! "User", "login" => @options[:login], "pwd" => @options[:password]
116
- xml.tag! "Identification" do
117
- xml.tag! "TransactionID", options[:order_id] || generate_unique_id
118
- xml.tag! "ReferenceID", payment unless payment.respond_to?(:number)
114
+ xml.tag! 'Transaction', 'mode' => options[:mode], 'channel' => @options[:channel], 'response' => 'SYNC' do
115
+ xml.tag! 'User', 'login' => @options[:login], 'pwd' => @options[:password]
116
+ xml.tag! 'Identification' do
117
+ xml.tag! 'TransactionID', options[:order_id] || generate_unique_id
118
+ xml.tag! 'ReferenceID', payment unless payment.respond_to?(:number)
119
119
  end
120
120
 
121
- xml.tag! "Payment", "code" => payment_code do
122
- xml.tag! "Memo", options[:memo] unless options[:memo].blank?
123
- xml.tag! "Presentation" do
124
- xml.tag! "Amount", amount(money)
125
- xml.tag! "Currency", (options[:currency] || currency(money))
126
- xml.tag! "Usage", options[:description]
121
+ xml.tag! 'Payment', 'code' => payment_code do
122
+ xml.tag! 'Memo', options[:memo] unless options[:memo].blank?
123
+ xml.tag! 'Presentation' do
124
+ xml.tag! 'Amount', amount(money)
125
+ xml.tag! 'Currency', (options[:currency] || currency(money))
126
+ xml.tag! 'Usage', options[:description]
127
127
  end
128
128
  end
129
129
 
130
130
  if payment.respond_to?(:number)
131
131
  add_payment(xml, payment)
132
132
 
133
- xml.tag! "Customer" do
133
+ xml.tag! 'Customer' do
134
134
  add_customer_name(xml, payment)
135
135
  add_address(xml, options[:billing_address] || options[:address])
136
136
  add_contact(xml, options)
@@ -143,37 +143,37 @@ module ActiveMerchant #:nodoc:
143
143
  end
144
144
 
145
145
  def add_contact(xml, options)
146
- xml.tag! "Contact" do
147
- xml.tag! "Email", (options[:email] || "unknown@example.com")
148
- xml.tag! "Ip", (options[:ip] || "127.0.0.1")
146
+ xml.tag! 'Contact' do
147
+ xml.tag! 'Email', (options[:email] || 'unknown@example.com')
148
+ xml.tag! 'Ip', (options[:ip] || '127.0.0.1')
149
149
  end
150
150
  end
151
151
 
152
152
  def add_customer_name(xml, payment)
153
- xml.tag! "Name" do
154
- xml.tag! "Given", payment.first_name
155
- xml.tag! "Family", payment.last_name
153
+ xml.tag! 'Name' do
154
+ xml.tag! 'Given', payment.first_name
155
+ xml.tag! 'Family', payment.last_name
156
156
  end
157
157
  end
158
158
 
159
159
  def add_payment(xml, payment)
160
- xml.tag! "Account" do
161
- xml.tag! "Number", payment.number
162
- xml.tag! "Holder", payment.name
163
- xml.tag! "Brand", payment.brand
164
- xml.tag! "Expiry", "month" => payment.month, "year" => payment.year
165
- xml.tag! "Verification", payment.verification_value
160
+ xml.tag! 'Account' do
161
+ xml.tag! 'Number', payment.number
162
+ xml.tag! 'Holder', payment.name
163
+ xml.tag! 'Brand', payment.brand
164
+ xml.tag! 'Expiry', 'month' => payment.month, 'year' => payment.year
165
+ xml.tag! 'Verification', payment.verification_value
166
166
  end
167
167
  end
168
168
 
169
169
  def add_address(xml, address)
170
- raise ArgumentError.new("Address is required") unless address
171
- xml.tag! "Address" do
172
- xml.tag! "Street", "#{address[:address1]} #{address[:address2]}".strip
173
- xml.tag! "City", address[:city]
174
- xml.tag! "State", address[:state]
175
- xml.tag! "Zip", address[:zip]
176
- xml.tag! "Country", address[:country]
170
+ raise ArgumentError.new('Address is required') unless address
171
+ xml.tag! 'Address' do
172
+ xml.tag! 'Street', "#{address[:address1]} #{address[:address2]}".strip
173
+ xml.tag! 'City', address[:city]
174
+ xml.tag! 'State', address[:state]
175
+ xml.tag! 'Zip', address[:zip]
176
+ xml.tag! 'Country', address[:country]
177
177
  end
178
178
  end
179
179
  end
@@ -17,7 +17,7 @@ module ActiveMerchant #:nodoc:
17
17
  # live" button on the Balanced dashboard and fill in your marketplace
18
18
  # details.
19
19
  class BalancedGateway < Gateway
20
- VERSION = "2.0.0"
20
+ VERSION = '2.0.0'
21
21
 
22
22
  self.live_url = 'https://api.balancedpayments.com'
23
23
 
@@ -50,7 +50,7 @@ module ActiveMerchant #:nodoc:
50
50
  else
51
51
  payment_method
52
52
  end
53
- r.process{commit("debits", "cards/#{card_identifier_from(identifier)}/debits", post)}
53
+ r.process{commit('debits', "cards/#{card_identifier_from(identifier)}/debits", post)}
54
54
  end
55
55
  end
56
56
 
@@ -67,7 +67,7 @@ module ActiveMerchant #:nodoc:
67
67
  else
68
68
  payment_method
69
69
  end
70
- r.process{commit("card_holds", "cards/#{card_identifier_from(identifier)}/card_holds", post)}
70
+ r.process{commit('card_holds', "cards/#{card_identifier_from(identifier)}/card_holds", post)}
71
71
  end
72
72
  end
73
73
 
@@ -77,7 +77,7 @@ module ActiveMerchant #:nodoc:
77
77
  post[:description] = options[:description] if options[:description]
78
78
  add_common_params(post, options)
79
79
 
80
- commit("debits", "card_holds/#{reference_identifier_from(identifier)}/debits", post)
80
+ commit('debits', "card_holds/#{reference_identifier_from(identifier)}/debits", post)
81
81
  end
82
82
 
83
83
  def void(identifier, options = {})
@@ -85,7 +85,7 @@ module ActiveMerchant #:nodoc:
85
85
  post[:is_void] = true
86
86
  add_common_params(post, options)
87
87
 
88
- commit("card_holds", "card_holds/#{reference_identifier_from(identifier)}", post, :put)
88
+ commit('card_holds', "card_holds/#{reference_identifier_from(identifier)}", post, :put)
89
89
  end
90
90
 
91
91
  def refund(money, identifier, options = {})
@@ -94,7 +94,7 @@ module ActiveMerchant #:nodoc:
94
94
  post[:description] = options[:description]
95
95
  add_common_params(post, options)
96
96
 
97
- commit("refunds", "debits/#{reference_identifier_from(identifier)}/refunds", post)
97
+ commit('refunds', "debits/#{reference_identifier_from(identifier)}/refunds", post)
98
98
  end
99
99
 
100
100
  def store(credit_card, options={})
@@ -108,7 +108,7 @@ module ActiveMerchant #:nodoc:
108
108
 
109
109
  add_address(post, options)
110
110
 
111
- commit("cards", "cards", post)
111
+ commit('cards', 'cards', post)
112
112
  end
113
113
 
114
114
  private
@@ -117,18 +117,18 @@ module ActiveMerchant #:nodoc:
117
117
  case identifier
118
118
  when %r{\|}
119
119
  uri = identifier.
120
- split("|").
120
+ split('|').
121
121
  detect{|part| part.size > 0}
122
- uri.split("/")[2]
122
+ uri.split('/')[2]
123
123
  when %r{\/}
124
- identifier.split("/")[5]
124
+ identifier.split('/')[5]
125
125
  else
126
126
  identifier
127
127
  end
128
128
  end
129
129
 
130
130
  def card_identifier_from(identifier)
131
- identifier.split("/").last
131
+ identifier.split('/').last
132
132
  end
133
133
 
134
134
  def add_amount(post, money)
@@ -180,29 +180,29 @@ module ActiveMerchant #:nodoc:
180
180
  entity = (raw_response[entity_name] || []).first
181
181
  if(!entity)
182
182
  false
183
- elsif((entity_name == "refunds") && entity.include?("status"))
184
- %w(succeeded pending).include?(entity["status"])
185
- elsif(entity.include?("status"))
186
- (entity["status"] == "succeeded")
187
- elsif(entity_name == "cards")
188
- !!entity["id"]
183
+ elsif((entity_name == 'refunds') && entity.include?('status'))
184
+ %w(succeeded pending).include?(entity['status'])
185
+ elsif(entity.include?('status'))
186
+ (entity['status'] == 'succeeded')
187
+ elsif(entity_name == 'cards')
188
+ !!entity['id']
189
189
  else
190
190
  false
191
191
  end
192
192
  end
193
193
 
194
194
  def message_from(raw_response)
195
- if(raw_response["errors"])
196
- error = raw_response["errors"].first
197
- (error["additional"] || error["message"] || error["description"])
195
+ if(raw_response['errors'])
196
+ error = raw_response['errors'].first
197
+ (error['additional'] || error['message'] || error['description'])
198
198
  else
199
- "Success"
199
+ 'Success'
200
200
  end
201
201
  end
202
202
 
203
203
  def authorization_from(entity_name, raw_response)
204
204
  entity = (raw_response[entity_name] || []).first
205
- (entity && entity["id"])
205
+ (entity && entity['id'])
206
206
  end
207
207
 
208
208
  def parse(body)
@@ -211,8 +211,8 @@ module ActiveMerchant #:nodoc:
211
211
  message = 'Invalid response received from the Balanced API. Please contact support@balancedpayments.com if you continue to receive this message.'
212
212
  message += " (The raw response returned by the API was #{raw_response.inspect})"
213
213
  {
214
- "errors" => [{
215
- "message" => message
214
+ 'errors' => [{
215
+ 'message' => message
216
216
  }]
217
217
  }
218
218
  end
@@ -231,7 +231,7 @@ module ActiveMerchant #:nodoc:
231
231
  else
232
232
  "#{key}=#{CGI.escape(value.to_s)}"
233
233
  end
234
- end.compact.join("&")
234
+ end.compact.join('&')
235
235
  end
236
236
 
237
237
  def headers
@@ -245,10 +245,10 @@ module ActiveMerchant #:nodoc:
245
245
  )
246
246
 
247
247
  {
248
- "Authorization" => "Basic " + Base64.encode64(@options[:login].to_s + ":").strip,
249
- "User-Agent" => "Balanced/v1.1 ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
250
- "Accept" => "application/vnd.api+json;revision=1.1",
251
- "X-Balanced-User-Agent" => @@ua,
248
+ 'Authorization' => 'Basic ' + Base64.encode64(@options[:login].to_s + ':').strip,
249
+ 'User-Agent' => "Balanced/v1.1 ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
250
+ 'Accept' => 'application/vnd.api+json;revision=1.1',
251
+ 'X-Balanced-User-Agent' => @@ua,
252
252
  }
253
253
  end
254
254
  end
@@ -93,7 +93,7 @@ module ActiveMerchant #:nodoc:
93
93
  if address = options[:billing_address] || options[:address]
94
94
  post[:address] = address[:address1].to_s
95
95
  post[:company] = address[:company].to_s
96
- post[:phone] = address[:phone].to_s.gsub(/[^0-9]/, '') || "0000000"
96
+ post[:phone] = address[:phone].to_s.gsub(/[^0-9]/, '') || '0000000'
97
97
  post[:zip] = address[:zip].to_s
98
98
  post[:city] = address[:city].to_s
99
99
  post[:country] = address[:country].to_s
@@ -121,11 +121,11 @@ module ActiveMerchant #:nodoc:
121
121
  def parse(body)
122
122
  results = {}
123
123
  xml = Nokogiri::XML(body)
124
- resp = xml.xpath("//Response/Transaction/Identification")
124
+ resp = xml.xpath('//Response/Transaction/Identification')
125
125
  resp.children.each do |element|
126
126
  results[element.name.downcase.to_sym] = element.text
127
127
  end
128
- resp = xml.xpath("//Response/Transaction/Processing")
128
+ resp = xml.xpath('//Response/Transaction/Processing')
129
129
  resp.children.each do |element|
130
130
  results[element.name.downcase.to_sym] = element.text
131
131
  end
@@ -40,13 +40,13 @@ module ActiveMerchant #:nodoc:
40
40
  private
41
41
 
42
42
  def add_response_type(post)
43
- post[:response_format] = "JSON"
43
+ post[:response_format] = 'JSON'
44
44
  end
45
45
 
46
46
  def add_customer_data(post, options)
47
47
  post[:user] = @options[:login]
48
48
  post[:phone] = options[:billing_address][:phone]
49
- post[:mail] = options[:email] || "unspecified@email.com"
49
+ post[:mail] = options[:email] || 'unspecified@email.com'
50
50
  end
51
51
 
52
52
  def add_order_data(post, options)
@@ -74,7 +74,7 @@ module ActiveMerchant #:nodoc:
74
74
 
75
75
  def card_brand(card)
76
76
  brand = super
77
- ({"master" => "mastercard", "american_express" => "amex"}[brand] || brand)
77
+ ({'master' => 'mastercard', 'american_express' => 'amex'}[brand] || brand)
78
78
  end
79
79
 
80
80
  def parse(body)
@@ -90,25 +90,25 @@ module ActiveMerchant #:nodoc:
90
90
  end
91
91
 
92
92
  Response.new(success?(response),
93
- response["message"],
93
+ response['message'],
94
94
  response,
95
95
  :test => test?,
96
- :authorization => response["code_auth"])
96
+ :authorization => response['code_auth'])
97
97
  end
98
98
 
99
99
  def success?(response)
100
- (response["response"] == "ok")
100
+ (response['response'] == 'ok')
101
101
  end
102
102
 
103
103
  def post_data(parameters = {})
104
- parameters.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&")
104
+ parameters.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
105
105
  end
106
106
 
107
107
  def json_error(raw_response)
108
108
  msg = 'Invalid response received from the Banwire API. Please contact Banwire support if you continue to receive this message.'
109
109
  msg += " (The raw response returned by the API was #{raw_response.inspect})"
110
110
  {
111
- "message" => msg
111
+ 'message' => msg
112
112
  }
113
113
  end
114
114
  end