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
@@ -7,7 +7,7 @@ module ActiveMerchant #:nodoc:
7
7
  include BraintreeCommon
8
8
 
9
9
  self.display_name = 'Braintree (Orange Platform)'
10
- self.supported_countries = ["US"]
10
+ self.supported_countries = ['US']
11
11
 
12
12
  self.live_url = self.test_url = 'https://secure.braintreepaymentgateway.com/api/transact.php'
13
13
 
@@ -1,16 +1,16 @@
1
- require "nokogiri"
1
+ require 'nokogiri'
2
2
 
3
3
  module ActiveMerchant #:nodoc:
4
4
  module Billing #:nodoc:
5
5
  class BridgePayGateway < Gateway
6
- self.display_name = "BridgePay"
7
- self.homepage_url = "http://www.bridgepaynetwork.com/"
6
+ self.display_name = 'BridgePay'
7
+ self.homepage_url = 'http://www.bridgepaynetwork.com/'
8
8
 
9
- self.test_url = "https://gatewaystage.itstgate.com/SmartPayments/transact3.asmx"
10
- self.live_url = "https://gateway.itstgate.com/SmartPayments/transact3.asmx"
9
+ self.test_url = 'https://gatewaystage.itstgate.com/SmartPayments/transact3.asmx'
10
+ self.live_url = 'https://gateway.itstgate.com/SmartPayments/transact3.asmx'
11
11
 
12
- self.supported_countries = ["CA", "US"]
13
- self.default_currency = "USD"
12
+ self.supported_countries = ['CA', 'US']
13
+ self.default_currency = 'USD'
14
14
  self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb]
15
15
 
16
16
 
@@ -20,10 +20,10 @@ module ActiveMerchant #:nodoc:
20
20
  end
21
21
 
22
22
  def purchase(amount, payment_method, options={})
23
- post = initialize_required_fields("Sale")
23
+ post = initialize_required_fields('Sale')
24
24
 
25
25
  # Allow the same amount in multiple transactions.
26
- post[:ExtData] = "<Force>T</Force>"
26
+ post[:ExtData] = '<Force>T</Force>'
27
27
  add_invoice(post, amount, options)
28
28
  add_payment_method(post, payment_method)
29
29
  add_customer_data(post, options)
@@ -32,7 +32,7 @@ module ActiveMerchant #:nodoc:
32
32
  end
33
33
 
34
34
  def authorize(amount, payment_method, options={})
35
- post = initialize_required_fields("Auth")
35
+ post = initialize_required_fields('Auth')
36
36
 
37
37
  add_invoice(post, amount, options)
38
38
  add_payment_method(post, payment_method)
@@ -42,7 +42,7 @@ module ActiveMerchant #:nodoc:
42
42
  end
43
43
 
44
44
  def capture(amount, authorization, options={})
45
- post = initialize_required_fields("Force")
45
+ post = initialize_required_fields('Force')
46
46
 
47
47
  add_invoice(post, amount, options)
48
48
  add_reference(post, authorization)
@@ -52,7 +52,7 @@ module ActiveMerchant #:nodoc:
52
52
  end
53
53
 
54
54
  def refund(amount, authorization, options={})
55
- post = initialize_required_fields("Return")
55
+ post = initialize_required_fields('Return')
56
56
 
57
57
  add_invoice(post, amount, options)
58
58
  add_reference(post, authorization)
@@ -61,7 +61,7 @@ module ActiveMerchant #:nodoc:
61
61
  end
62
62
 
63
63
  def void(authorization, options={})
64
- post = initialize_required_fields("Void")
64
+ post = initialize_required_fields('Void')
65
65
 
66
66
  add_reference(post, authorization)
67
67
 
@@ -114,36 +114,36 @@ module ActiveMerchant #:nodoc:
114
114
  post[:TransitNum] = payment_method.routing_number
115
115
  post[:AccountNum] = payment_method.account_number
116
116
  post[:NameOnCheck] = payment_method.name
117
- post[:ExtData] = "<AccountType>#{payment_method.account_type.capitalize}</AccountType>"
117
+ post[:ExtData] = "<AccountType>#{payment_method.account_type.capitalize}</AccountType>" if payment_method.account_type
118
118
  end
119
119
  end
120
120
 
121
121
  def add_token(post, payment_method)
122
- payment_method = payment_method.split("|")
122
+ payment_method = payment_method.split('|')
123
123
  post[:ExtData] = "<Force>T</Force><CardVault><Transaction>Read</Transaction><CustomerPaymentInfoKey>#{payment_method[1]}</CustomerPaymentInfoKey><Token>#{payment_method[0]}</Token><ExpDate>#{payment_method[2]}</ExpDate></CardVault>"
124
124
  end
125
125
 
126
126
  def initialize_required_fields(transaction_type)
127
127
  post = {}
128
128
  post[:TransType] = transaction_type
129
- post[:Amount] = ""
130
- post[:PNRef] = ""
131
- post[:InvNum] = ""
132
- post[:CardNum] = ""
133
- post[:ExpDate] = ""
134
- post[:MagData] = ""
135
- post[:NameOnCard] = ""
136
- post[:Zip] = ""
137
- post[:Street] = ""
138
- post[:CVNum] = ""
139
- post[:MagData] = ""
140
- post[:ExtData] = ""
141
- post[:MICR] = ""
142
- post[:DL] = ""
143
- post[:SS] = ""
144
- post[:DOB] = ""
145
- post[:StateCode] = ""
146
- post[:CheckType] = ""
129
+ post[:Amount] = ''
130
+ post[:PNRef] = ''
131
+ post[:InvNum] = ''
132
+ post[:CardNum] = ''
133
+ post[:ExpDate] = ''
134
+ post[:MagData] = ''
135
+ post[:NameOnCard] = ''
136
+ post[:Zip] = ''
137
+ post[:Street] = ''
138
+ post[:CVNum] = ''
139
+ post[:MagData] = ''
140
+ post[:ExtData] = ''
141
+ post[:MICR] = ''
142
+ post[:DL] = ''
143
+ post[:SS] = ''
144
+ post[:DOB] = ''
145
+ post[:StateCode] = ''
146
+ post[:CheckType] = ''
147
147
  post
148
148
  end
149
149
 
@@ -167,7 +167,7 @@ module ActiveMerchant #:nodoc:
167
167
  response = {}
168
168
 
169
169
  doc = Nokogiri::XML(xml)
170
- doc.root.xpath("*").each do |node|
170
+ doc.root.xpath('*').each do |node|
171
171
  if (node.elements.size == 0)
172
172
  response[node.name.downcase.to_sym] = node.text
173
173
  else
@@ -208,7 +208,7 @@ module ActiveMerchant #:nodoc:
208
208
  end
209
209
 
210
210
  def success_from(response)
211
- response[:result] == "0"
211
+ response[:result] == '0'
212
212
  end
213
213
 
214
214
  def message_from(response)
@@ -217,14 +217,14 @@ module ActiveMerchant #:nodoc:
217
217
 
218
218
  def authorization_from(response)
219
219
  if response[:token]
220
- [response[:token], response[:customerpaymentinfokey], response[:expdate]].join("|")
220
+ [response[:token], response[:customerpaymentinfokey], response[:expdate]].join('|')
221
221
  else
222
- [response[:authcode], response[:pnref]].join("|")
222
+ [response[:authcode], response[:pnref]].join('|')
223
223
  end
224
224
  end
225
225
 
226
226
  def split_authorization(authorization)
227
- authcode, pnref = authorization.split("|")
227
+ authcode, pnref = authorization.split('|')
228
228
  [authcode, pnref]
229
229
  end
230
230
 
@@ -238,7 +238,7 @@ module ActiveMerchant #:nodoc:
238
238
  {
239
239
  :UserName => @options[:user_name],
240
240
  :Password => @options[:password]
241
- }.merge(post).collect{|k,v| "#{k}=#{CGI.escape(v.to_s)}"}.join("&")
241
+ }.merge(post).collect{|k,v| "#{k}=#{CGI.escape(v.to_s)}"}.join('&')
242
242
  end
243
243
  end
244
244
  end
@@ -1,7 +1,7 @@
1
1
  module ActiveMerchant #:nodoc:
2
2
  module Billing #:nodoc:
3
3
  class CamsGateway < Gateway
4
- self.live_url = "https://secure.centralams.com/gw/api/transact.php"
4
+ self.live_url = 'https://secure.centralams.com/gw/api/transact.php'
5
5
 
6
6
  self.supported_countries = ['US']
7
7
  self.default_currency = 'USD'
@@ -83,7 +83,7 @@ module ActiveMerchant #:nodoc:
83
83
  post[:transactionid] = split_authorization(payment)[0]
84
84
  end
85
85
 
86
- commit("sale", post)
86
+ commit('sale', post)
87
87
  end
88
88
 
89
89
  def authorize(money, payment, options={})
@@ -156,8 +156,8 @@ module ActiveMerchant #:nodoc:
156
156
 
157
157
  def add_reference(post, authorization)
158
158
  transaction_id, authcode = split_authorization(authorization)
159
- post["transactionid"] = transaction_id
160
- post["authcode"] = authcode
159
+ post['transactionid'] = transaction_id
160
+ post['authcode'] = authcode
161
161
  end
162
162
 
163
163
  def add_invoice(post, money, options)
@@ -172,10 +172,10 @@ module ActiveMerchant #:nodoc:
172
172
  end
173
173
 
174
174
  def parse(body)
175
- kvs = body.split("&")
175
+ kvs = body.split('&')
176
176
 
177
177
  kvs.inject({}) { |h, kv|
178
- k,v = kv.split("=")
178
+ k,v = kv.split('=')
179
179
  h[k] = v
180
180
  h
181
181
  }
@@ -199,19 +199,19 @@ module ActiveMerchant #:nodoc:
199
199
  end
200
200
 
201
201
  def success_from(response)
202
- response["response_code"] == "100"
202
+ response['response_code'] == '100'
203
203
  end
204
204
 
205
205
  def message_from(response)
206
- response["responsetext"]
206
+ response['responsetext']
207
207
  end
208
208
 
209
209
  def authorization_from(response)
210
- [response["transactionid"], response["authcode"]].join("#")
210
+ [response['transactionid'], response['authcode']].join('#')
211
211
  end
212
212
 
213
213
  def split_authorization(authorization)
214
- transaction_id, authcode = authorization.split("#")
214
+ transaction_id, authcode = authorization.split('#')
215
215
  [transaction_id, authcode]
216
216
  end
217
217
 
@@ -219,11 +219,11 @@ module ActiveMerchant #:nodoc:
219
219
  parameters[:password] = @options[:password]
220
220
  parameters[:username] = @options[:username]
221
221
 
222
- parameters.collect{|k,v| "#{k}=#{v}" }.join("&")
222
+ parameters.collect{|k,v| "#{k}=#{v}" }.join('&')
223
223
  end
224
224
 
225
225
  def error_code_from(response)
226
- STANDARD_ERROR_CODE_MAPPING[response["response_code"]]
226
+ STANDARD_ERROR_CODE_MAPPING[response['response_code']]
227
227
  end
228
228
  end
229
229
  end
@@ -130,6 +130,21 @@ module ActiveMerchant #:nodoc:
130
130
  authorize(0, credit_card, options)
131
131
  end
132
132
 
133
+ def store(payment, options = {})
134
+ post = {}
135
+ add_payment(post, payment)
136
+ add_address(post, options)
137
+ add_customer_data(post, options)
138
+ commit('profile', post)
139
+ end
140
+
141
+ def unstore(authorization, options = {})
142
+ account_id, profile_id = authorization.split('|')
143
+ commit('profile', {},
144
+ verb: :delete,
145
+ path: "/#{profile_id}/#{account_id}/#{@options[:merchant_id]}")
146
+ end
147
+
133
148
  def supports_scrubbing?
134
149
  true
135
150
  end
@@ -175,13 +190,19 @@ module ActiveMerchant #:nodoc:
175
190
  end
176
191
 
177
192
  def add_payment(post, payment)
178
- post[:name] = payment.name
179
- if card_brand(payment) == 'check'
180
- add_echeck(post, payment)
193
+ if payment.is_a?(String)
194
+ account_id, profile_id = payment.split('|')
195
+ post[:profile] = profile_id
196
+ post[:acctid] = account_id
181
197
  else
182
- post[:account] = payment.number
183
- post[:expiry] = expdate(payment)
184
- post[:cvv2] = payment.verification_value
198
+ post[:name] = payment.name
199
+ if card_brand(payment) == 'check'
200
+ add_echeck(post, payment)
201
+ else
202
+ post[:account] = payment.number
203
+ post[:expiry] = expdate(payment)
204
+ post[:cvv2] = payment.verification_value
205
+ end
185
206
  end
186
207
  end
187
208
 
@@ -237,18 +258,18 @@ module ActiveMerchant #:nodoc:
237
258
  JSON.parse(body)
238
259
  end
239
260
 
240
- def url(action)
261
+ def url(action, path)
241
262
  if test?
242
- test_url + action
263
+ test_url + action + path
243
264
  else
244
- (@options[:domain] ? @options[:domain] : live_url) + action
265
+ (@options[:domain] || live_url) + action + path
245
266
  end
246
267
  end
247
268
 
248
- def commit(action, parameters)
269
+ def commit(action, parameters, verb: :put, path: '')
249
270
  parameters[:merchid] = @options[:merchant_id]
250
- url = url(action)
251
- response = parse(ssl_request(:put, url, post_data(parameters), headers))
271
+ url = url(action, path)
272
+ response = parse(ssl_request(verb, url, post_data(parameters), headers))
252
273
 
253
274
  Response.new(
254
275
  success_from(response),
@@ -271,7 +292,11 @@ module ActiveMerchant #:nodoc:
271
292
  end
272
293
 
273
294
  def authorization_from(response)
274
- response['retref']
295
+ if response['profileid']
296
+ "#{response['acctid']}|#{response['profileid']}"
297
+ else
298
+ response['retref']
299
+ end
275
300
  end
276
301
 
277
302
  def post_data(parameters = {})
@@ -2,7 +2,7 @@ module ActiveMerchant #:nodoc:
2
2
  module Billing #:nodoc:
3
3
  class CardStreamGateway < Gateway
4
4
 
5
- THREEDSECURE_REQUIRED_DEPRECATION_MESSAGE = "Specifying the :threeDSRequired initialization option is deprecated. Please use the `:threeds_required => true` *transaction* option instead."
5
+ THREEDSECURE_REQUIRED_DEPRECATION_MESSAGE = 'Specifying the :threeDSRequired initialization option is deprecated. Please use the `:threeds_required => true` *transaction* option instead.'
6
6
 
7
7
  self.test_url = self.live_url = 'https://gateway.cardstream.com/direct/'
8
8
  self.money_format = :cents
@@ -13,96 +13,96 @@ module ActiveMerchant #:nodoc:
13
13
  self.display_name = 'CardStream'
14
14
 
15
15
  CURRENCY_CODES = {
16
- "AED" => "784",
17
- "ALL" => "008",
18
- "AMD" => "051",
19
- "ANG" => "532",
20
- "ARS" => "032",
21
- "AUD" => "036",
22
- "AWG" => "533",
23
- "BAM" => "977",
24
- "BBD" => "052",
25
- "BGN" => "975",
26
- "BMD" => "060",
27
- "BOB" => "068",
28
- "BRL" => "986",
29
- "BSD" => "044",
30
- "BWP" => "072",
31
- "BZD" => "084",
32
- "CAD" => "124",
33
- "CHF" => "756",
34
- "CLP" => "152",
35
- "CNY" => "156",
36
- "COP" => "170",
37
- "CRC" => "188",
38
- "CZK" => "203",
39
- "DKK" => "208",
40
- "DOP" => "214",
41
- "EGP" => "818",
42
- "EUR" => "978",
43
- "GBP" => "826",
44
- "GEL" => "981",
45
- "GIP" => "292",
46
- "GTQ" => "320",
47
- "GYD" => "328",
48
- "HKD" => "344",
49
- "HNL" => "340",
50
- "HRK" => "191",
51
- "HUF" => "348",
52
- "ISK" => "352",
53
- "IDR" => "360",
54
- "ILS" => "376",
55
- "INR" => "356",
56
- "JPY" => "392",
57
- "JMD" => "388",
58
- "KES" => "404",
59
- "KRW" => "410",
60
- "KYD" => "136",
61
- "LBP" => "422",
62
- "LKR" => "144",
63
- "MAD" => "504",
64
- "MVR" => "462",
65
- "MWK" => "454",
66
- "MXN" => "484",
67
- "MYR" => "458",
68
- "NAD" => "516",
69
- "NGN" => "566",
70
- "NIO" => "558",
71
- "NOK" => "578",
72
- "NPR" => "524",
73
- "NZD" => "554",
74
- "PAB" => "590",
75
- "PEN" => "604",
76
- "PGK" => "598",
77
- "PHP" => "608",
78
- "PKR" => "586",
79
- "PLN" => "985",
80
- "PYG" => "600",
81
- "QAR" => "634",
82
- "RON" => "946",
83
- "RSD" => "941",
84
- "RUB" => "643",
85
- "RWF" => "646",
86
- "SAR" => "682",
87
- "SEK" => "752",
88
- "SGD" => "702",
89
- "SRD" => "968",
90
- "THB" => "764",
91
- "TND" => "788",
92
- "TRY" => "949",
93
- "TTD" => "780",
94
- "TWD" => "901",
95
- "TZS" => "834",
96
- "UAH" => "980",
97
- "UGX" => "800",
98
- "USD" => "840",
99
- "UYU" => "858",
100
- "VND" => "704",
101
- "WST" => "882",
102
- "XAF" => "950",
103
- "XCD" => "951",
104
- "XOF" => "952",
105
- "ZAR" => "710"
16
+ 'AED' => '784',
17
+ 'ALL' => '008',
18
+ 'AMD' => '051',
19
+ 'ANG' => '532',
20
+ 'ARS' => '032',
21
+ 'AUD' => '036',
22
+ 'AWG' => '533',
23
+ 'BAM' => '977',
24
+ 'BBD' => '052',
25
+ 'BGN' => '975',
26
+ 'BMD' => '060',
27
+ 'BOB' => '068',
28
+ 'BRL' => '986',
29
+ 'BSD' => '044',
30
+ 'BWP' => '072',
31
+ 'BZD' => '084',
32
+ 'CAD' => '124',
33
+ 'CHF' => '756',
34
+ 'CLP' => '152',
35
+ 'CNY' => '156',
36
+ 'COP' => '170',
37
+ 'CRC' => '188',
38
+ 'CZK' => '203',
39
+ 'DKK' => '208',
40
+ 'DOP' => '214',
41
+ 'EGP' => '818',
42
+ 'EUR' => '978',
43
+ 'GBP' => '826',
44
+ 'GEL' => '981',
45
+ 'GIP' => '292',
46
+ 'GTQ' => '320',
47
+ 'GYD' => '328',
48
+ 'HKD' => '344',
49
+ 'HNL' => '340',
50
+ 'HRK' => '191',
51
+ 'HUF' => '348',
52
+ 'ISK' => '352',
53
+ 'IDR' => '360',
54
+ 'ILS' => '376',
55
+ 'INR' => '356',
56
+ 'JPY' => '392',
57
+ 'JMD' => '388',
58
+ 'KES' => '404',
59
+ 'KRW' => '410',
60
+ 'KYD' => '136',
61
+ 'LBP' => '422',
62
+ 'LKR' => '144',
63
+ 'MAD' => '504',
64
+ 'MVR' => '462',
65
+ 'MWK' => '454',
66
+ 'MXN' => '484',
67
+ 'MYR' => '458',
68
+ 'NAD' => '516',
69
+ 'NGN' => '566',
70
+ 'NIO' => '558',
71
+ 'NOK' => '578',
72
+ 'NPR' => '524',
73
+ 'NZD' => '554',
74
+ 'PAB' => '590',
75
+ 'PEN' => '604',
76
+ 'PGK' => '598',
77
+ 'PHP' => '608',
78
+ 'PKR' => '586',
79
+ 'PLN' => '985',
80
+ 'PYG' => '600',
81
+ 'QAR' => '634',
82
+ 'RON' => '946',
83
+ 'RSD' => '941',
84
+ 'RUB' => '643',
85
+ 'RWF' => '646',
86
+ 'SAR' => '682',
87
+ 'SEK' => '752',
88
+ 'SGD' => '702',
89
+ 'SRD' => '968',
90
+ 'THB' => '764',
91
+ 'TND' => '788',
92
+ 'TRY' => '949',
93
+ 'TTD' => '780',
94
+ 'TWD' => '901',
95
+ 'TZS' => '834',
96
+ 'UAH' => '980',
97
+ 'UGX' => '800',
98
+ 'USD' => '840',
99
+ 'UYU' => '858',
100
+ 'VND' => '704',
101
+ 'WST' => '882',
102
+ 'XAF' => '950',
103
+ 'XCD' => '951',
104
+ 'XOF' => '952',
105
+ 'ZAR' => '710'
106
106
  }
107
107
 
108
108
  CVV_CODE = {
@@ -118,11 +118,11 @@ module ActiveMerchant #:nodoc:
118
118
  # 4 - Postcode not matched.
119
119
  # 8 - Postcode partially matched.
120
120
  AVS_POSTAL_MATCH = {
121
- "0" => nil,
122
- "1" => nil,
123
- "2" => "Y",
124
- "4" => "N",
125
- "8" => "N"
121
+ '0' => nil,
122
+ '1' => nil,
123
+ '2' => 'Y',
124
+ '4' => 'N',
125
+ '8' => 'N'
126
126
  }
127
127
 
128
128
  # 0 - No additional information available.
@@ -131,11 +131,11 @@ module ActiveMerchant #:nodoc:
131
131
  # 4 - Address numeric not matched.
132
132
  # 8 - Address numeric partially matched.
133
133
  AVS_STREET_MATCH = {
134
- "0" => nil,
135
- "1" => nil,
136
- "2" => "Y",
137
- "4" => "N",
138
- "8" => "N"
134
+ '0' => nil,
135
+ '1' => nil,
136
+ '2' => 'Y',
137
+ '4' => 'N',
138
+ '8' => 'N'
139
139
  }
140
140
 
141
141
  def initialize(options = {})
@@ -189,7 +189,7 @@ module ActiveMerchant #:nodoc:
189
189
  return response if response.success?
190
190
  return response unless options[:force_full_refund_if_unsettled]
191
191
 
192
- if response.params["responseCode"] == "65541"
192
+ if response.params['responseCode'] == '65541'
193
193
  void(authorization, options)
194
194
  else
195
195
  response
@@ -295,11 +295,11 @@ module ActiveMerchant #:nodoc:
295
295
  end
296
296
 
297
297
  def normalize_line_endings(str)
298
- str.gsub(/%0D%0A|%0A%0D|%0D/, "%0A")
298
+ str.gsub(/%0D%0A|%0A%0D|%0D/, '%0A')
299
299
  end
300
300
 
301
301
  def add_hmac(post)
302
- result = post.sort.collect { |key, value| "#{key}=#{normalize_line_endings(CGI.escape(value.to_s))}" }.join("&")
302
+ result = post.sort.collect { |key, value| "#{key}=#{normalize_line_endings(CGI.escape(value.to_s))}" }.join('&')
303
303
  result = Digest::SHA512.hexdigest("#{result}#{@options[:shared_secret]}")
304
304
 
305
305
  add_pair(post, :signature, result)
@@ -307,9 +307,9 @@ module ActiveMerchant #:nodoc:
307
307
 
308
308
  def parse(body)
309
309
  result = {}
310
- pairs = body.split("&")
310
+ pairs = body.split('&')
311
311
  pairs.each do |pair|
312
- a = pair.split("=")
312
+ a = pair.split('=')
313
313
  # because some value pairs don't have a value
314
314
  result[a[0].to_sym] = a[1] == nil ? '' : CGI.unescape(a[1])
315
315
  end
@@ -327,8 +327,8 @@ module ActiveMerchant #:nodoc:
327
327
 
328
328
  response = parse(ssl_post(self.live_url, post_data(action, parameters)))
329
329
 
330
- Response.new(response[:responseCode] == "0",
331
- response[:responseCode] == "0" ? "APPROVED" : response[:responseMessage],
330
+ Response.new(response[:responseCode] == '0',
331
+ response[:responseCode] == '0' ? 'APPROVED' : response[:responseMessage],
332
332
  response,
333
333
  :test => test?,
334
334
  :authorization => response[:xref],
@@ -341,14 +341,14 @@ module ActiveMerchant #:nodoc:
341
341
  postal_match = AVS_POSTAL_MATCH[response[:avscv2ResponseCode].to_s[1, 1]]
342
342
  street_match = AVS_STREET_MATCH[response[:avscv2ResponseCode].to_s[2, 1]]
343
343
 
344
- code = if postal_match == "Y" && street_match == "Y"
345
- "M"
346
- elsif postal_match == "Y"
347
- "P"
348
- elsif street_match == "Y"
349
- "A"
344
+ code = if postal_match == 'Y' && street_match == 'Y'
345
+ 'M'
346
+ elsif postal_match == 'Y'
347
+ 'P'
348
+ elsif street_match == 'Y'
349
+ 'A'
350
350
  else
351
- "I"
351
+ 'I'
352
352
  end
353
353
 
354
354
  AVSResult.new({
@@ -364,7 +364,7 @@ module ActiveMerchant #:nodoc:
364
364
  end
365
365
 
366
366
  def post_data(action, parameters = {})
367
- parameters.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&")
367
+ parameters.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
368
368
  end
369
369
 
370
370
  def add_pair(post, key, value, options = {})