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
@@ -135,7 +135,7 @@ module ActiveMerchant #:nodoc:
135
135
  def fill_card(soap, card)
136
136
  soap.tag!('cardNumber', card.number.to_s)
137
137
  soap.tag!('cardSecurityCode', card.verification_value.to_s)
138
- soap.tag!('cardExpireMonth', card.month.to_s.rjust(2, "0"))
138
+ soap.tag!('cardExpireMonth', card.month.to_s.rjust(2, '0'))
139
139
  soap.tag!('cardExpireYear', card.year.to_s)
140
140
  end
141
141
 
@@ -157,8 +157,8 @@ module ActiveMerchant #:nodoc:
157
157
  end
158
158
 
159
159
  def commit(soap_action, soap, options)
160
- headers = {"SOAPAction" => "\"urn:Interface##{soap_action}\"",
161
- "Content-Type" => "text/xml; charset=utf-8"}
160
+ headers = {'SOAPAction' => "\"urn:Interface##{soap_action}\"",
161
+ 'Content-Type' => 'text/xml; charset=utf-8'}
162
162
  response_string = ssl_post(test? ? self.test_url : self.live_url, soap, headers)
163
163
  response = parse(response_string, soap_action)
164
164
  return Response.new(response['errorcode'] == '000',
@@ -152,7 +152,7 @@ module ActiveMerchant #:nodoc:
152
152
  doc.retained(true) if retain
153
153
  end
154
154
 
155
- commit("payment_methods.xml", request, :post, :payment_method_token)
155
+ commit('payment_methods.xml', request, :post, :payment_method_token)
156
156
  end
157
157
 
158
158
  def purchase_with_token(money, payment_method_token, options)
@@ -48,24 +48,24 @@ module ActiveMerchant #:nodoc:
48
48
  }
49
49
 
50
50
  BANK_ACCOUNT_HOLDER_TYPE_MAPPING = {
51
- "personal" => "individual",
52
- "business" => "company",
51
+ 'personal' => 'individual',
52
+ 'business' => 'company',
53
53
  }
54
54
 
55
55
  MINIMUM_AUTHORIZE_AMOUNTS = {
56
- "USD" => 100,
57
- "CAD" => 100,
58
- "GBP" => 60,
59
- "EUR" => 100,
60
- "DKK" => 500,
61
- "NOK" => 600,
62
- "SEK" => 600,
63
- "CHF" => 100,
64
- "AUD" => 100,
65
- "JPY" => 100,
66
- "MXN" => 2000,
67
- "SGD" => 100,
68
- "HKD" => 800
56
+ 'USD' => 100,
57
+ 'CAD' => 100,
58
+ 'GBP' => 60,
59
+ 'EUR' => 100,
60
+ 'DKK' => 500,
61
+ 'NOK' => 600,
62
+ 'SEK' => 600,
63
+ 'CHF' => 100,
64
+ 'AUD' => 100,
65
+ 'JPY' => 100,
66
+ 'MXN' => 2000,
67
+ 'SGD' => 100,
68
+ 'HKD' => 800
69
69
  }
70
70
 
71
71
  def initialize(options = {})
@@ -79,14 +79,14 @@ module ActiveMerchant #:nodoc:
79
79
  MultiResponse.run do |r|
80
80
  if payment.is_a?(ApplePayPaymentToken)
81
81
  r.process { tokenize_apple_pay_token(payment) }
82
- payment = StripePaymentToken.new(r.params["token"]) if r.success?
82
+ payment = StripePaymentToken.new(r.params['token']) if r.success?
83
83
  end
84
84
  r.process do
85
85
  post = create_post_for_auth_or_purchase(money, payment, options)
86
86
  if emv_payment?(payment)
87
87
  add_application_fee(post, options)
88
88
  else
89
- post[:capture] = "false"
89
+ post[:capture] = 'false'
90
90
  end
91
91
  commit(:post, 'charges', post, options)
92
92
  end
@@ -102,14 +102,14 @@ module ActiveMerchant #:nodoc:
102
102
  # purchase(money, nil, { :customer => id, ... })
103
103
  def purchase(money, payment, options = {})
104
104
  if ach?(payment)
105
- direct_bank_error = "Direct bank account transactions are not supported. Bank accounts must be stored and verified before use."
105
+ direct_bank_error = 'Direct bank account transactions are not supported. Bank accounts must be stored and verified before use.'
106
106
  return Response.new(false, direct_bank_error)
107
107
  end
108
108
 
109
109
  MultiResponse.run do |r|
110
110
  if payment.is_a?(ApplePayPaymentToken)
111
111
  r.process { tokenize_apple_pay_token(payment) }
112
- payment = StripePaymentToken.new(r.params["token"]) if r.success?
112
+ payment = StripePaymentToken.new(r.params['token']) if r.success?
113
113
  end
114
114
  r.process do
115
115
  post = create_post_for_auth_or_purchase(money, payment, options)
@@ -168,11 +168,11 @@ module ActiveMerchant #:nodoc:
168
168
 
169
169
  def application_fee_from_response(response)
170
170
  return unless response.success?
171
- response.params["application_fee"] unless response.params["application_fee"].empty?
171
+ response.params['application_fee'] unless response.params['application_fee'].empty?
172
172
  end
173
173
 
174
174
  def refund_application_fee(money, identification, options = {})
175
- return Response.new(false, "Application fee id could not be found") unless identification
175
+ return Response.new(false, 'Application fee id could not be found') unless identification
176
176
 
177
177
  post = {}
178
178
  add_amount(post, money, options)
@@ -190,13 +190,13 @@ module ActiveMerchant #:nodoc:
190
190
 
191
191
  if payment.is_a?(ApplePayPaymentToken)
192
192
  token_exchange_response = tokenize_apple_pay_token(payment)
193
- params = { card: token_exchange_response.params["token"]["id"] } if token_exchange_response.success?
193
+ params = { card: token_exchange_response.params['token']['id'] } if token_exchange_response.success?
194
194
  elsif payment.is_a?(StripePaymentToken)
195
195
  add_payment_token(params, payment, options)
196
196
  elsif payment.is_a?(Check)
197
197
  bank_token_response = tokenize_bank_account(payment)
198
198
  return bank_token_response unless bank_token_response.success?
199
- params = { source: bank_token_response.params["token"]["id"] }
199
+ params = { source: bank_token_response.params['token']['id'] }
200
200
  else
201
201
  add_creditcard(params, payment, options)
202
202
  end
@@ -235,10 +235,10 @@ module ActiveMerchant #:nodoc:
235
235
  end
236
236
 
237
237
  def unstore(identification, options = {}, deprecated_options = {})
238
- customer_id, card_id = identification.split("|")
238
+ customer_id, card_id = identification.split('|')
239
239
 
240
240
  if options.kind_of?(String)
241
- ActiveMerchant.deprecated "Passing the card_id as the 2nd parameter is deprecated. The response authorization includes both the customer_id and the card_id."
241
+ ActiveMerchant.deprecated 'Passing the card_id as the 2nd parameter is deprecated. The response authorization includes both the customer_id and the card_id.'
242
242
  card_id ||= options
243
243
  options = deprecated_options
244
244
  end
@@ -248,18 +248,18 @@ module ActiveMerchant #:nodoc:
248
248
 
249
249
  def tokenize_apple_pay_token(apple_pay_payment_token, options = {})
250
250
  token_response = api_request(:post, "tokens?pk_token=#{CGI.escape(apple_pay_payment_token.payment_data.to_json)}")
251
- success = !token_response.key?("error")
251
+ success = !token_response.key?('error')
252
252
 
253
- if success && token_response.key?("id")
253
+ if success && token_response.key?('id')
254
254
  Response.new(success, nil, token: token_response)
255
255
  else
256
- Response.new(success, token_response["error"]["message"])
256
+ Response.new(success, token_response['error']['message'])
257
257
  end
258
258
  end
259
259
 
260
260
  def verify_credentials
261
261
  begin
262
- ssl_get(live_url + "charges/nonexistent", headers)
262
+ ssl_get(live_url + 'charges/nonexistent', headers)
263
263
  rescue ResponseError => e
264
264
  return false if e.response.code.to_i == 401
265
265
  end
@@ -355,7 +355,7 @@ module ActiveMerchant #:nodoc:
355
355
 
356
356
  def add_external_account(post, card_params, payment)
357
357
  external_account = {}
358
- external_account[:object] ="card"
358
+ external_account[:object] ='card'
359
359
  external_account[:currency] = (options[:currency] || currency(payment)).downcase
360
360
  post[:external_account] = external_account.merge(card_params[:card])
361
361
  end
@@ -396,7 +396,7 @@ module ActiveMerchant #:nodoc:
396
396
  card = {}
397
397
  if emv_payment?(creditcard)
398
398
  add_emv_creditcard(post, creditcard.icc_data)
399
- post[:card][:read_method] = "contactless" if creditcard.read_method == 'contactless'
399
+ post[:card][:read_method] = 'contactless' if creditcard.read_method == 'contactless'
400
400
  if creditcard.encrypted_pin_cryptogram.present? && creditcard.encrypted_pin_ksn.present?
401
401
  post[:card][:encrypted_pin] = creditcard.encrypted_pin_cryptogram
402
402
  post[:card][:encrypted_pin_key_id] = creditcard.encrypted_pin_ksn
@@ -407,7 +407,7 @@ module ActiveMerchant #:nodoc:
407
407
  if creditcard.respond_to?(:read_method)
408
408
  card[:fallback_reason] = 'no_chip' if creditcard.read_method == 'fallback_no_chip'
409
409
  card[:fallback_reason] = 'chip_error' if creditcard.read_method == 'fallback_chip_error'
410
- card[:read_method] = "contactless_magstripe_mode" if creditcard.read_method == 'contactless_magstripe'
410
+ card[:read_method] = 'contactless_magstripe_mode' if creditcard.read_method == 'contactless_magstripe'
411
411
  end
412
412
  else
413
413
  card[:number] = creditcard.number
@@ -428,8 +428,8 @@ module ActiveMerchant #:nodoc:
428
428
  elsif creditcard.kind_of?(String)
429
429
  if options[:track_data]
430
430
  card[:swipe_data] = options[:track_data]
431
- elsif creditcard.include?("|")
432
- customer_id, card_id = creditcard.split("|")
431
+ elsif creditcard.include?('|')
432
+ customer_id, card_id = creditcard.split('|')
433
433
  card = card_id
434
434
  post[:customer] = customer_id
435
435
  else
@@ -444,12 +444,12 @@ module ActiveMerchant #:nodoc:
444
444
  end
445
445
 
446
446
  def add_payment_token(post, token, options = {})
447
- post[:card] = token.payment_data["id"]
447
+ post[:card] = token.payment_data['id']
448
448
  end
449
449
 
450
450
  def add_customer(post, payment, options)
451
451
  if options[:customer] && !payment.respond_to?(:number)
452
- ActiveMerchant.deprecated "Passing the customer in the options is deprecated. Just use the response.authorization instead."
452
+ ActiveMerchant.deprecated 'Passing the customer in the options is deprecated. Just use the response.authorization instead.'
453
453
  post[:customer] = options[:customer]
454
454
  end
455
455
  end
@@ -499,11 +499,11 @@ module ActiveMerchant #:nodoc:
499
499
  end
500
500
  post_data(h)
501
501
  elsif value.is_a?(Array)
502
- value.map { |v| "#{key}[]=#{CGI.escape(v.to_s)}" }.join("&")
502
+ value.map { |v| "#{key}[]=#{CGI.escape(v.to_s)}" }.join('&')
503
503
  else
504
504
  "#{key}=#{CGI.escape(value.to_s)}"
505
505
  end
506
- end.compact.join("&")
506
+ end.compact.join('&')
507
507
  end
508
508
 
509
509
  def headers(options = {})
@@ -511,14 +511,14 @@ module ActiveMerchant #:nodoc:
511
511
  idempotency_key = options[:idempotency_key]
512
512
 
513
513
  headers = {
514
- "Authorization" => "Basic " + Base64.encode64(key.to_s + ":").strip,
515
- "User-Agent" => "Stripe/v1 ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
516
- "Stripe-Version" => api_version(options),
517
- "X-Stripe-Client-User-Agent" => stripe_client_user_agent(options),
518
- "X-Stripe-Client-User-Metadata" => {:ip => options[:ip]}.to_json
514
+ 'Authorization' => 'Basic ' + Base64.encode64(key.to_s + ':').strip,
515
+ 'User-Agent' => "Stripe/v1 ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
516
+ 'Stripe-Version' => api_version(options),
517
+ 'X-Stripe-Client-User-Agent' => stripe_client_user_agent(options),
518
+ 'X-Stripe-Client-User-Metadata' => {:ip => options[:ip]}.to_json
519
519
  }
520
- headers.merge!("Idempotency-Key" => idempotency_key) if idempotency_key
521
- headers.merge!("Stripe-Account" => options[:stripe_account]) if options[:stripe_account]
520
+ headers.merge!('Idempotency-Key' => idempotency_key) if idempotency_key
521
+ headers.merge!('Stripe-Account' => options[:stripe_account]) if options[:stripe_account]
522
522
  headers
523
523
  end
524
524
 
@@ -528,7 +528,7 @@ module ActiveMerchant #:nodoc:
528
528
  end
529
529
 
530
530
  def api_version(options)
531
- options[:version] || @options[:version] || "2015-04-07"
531
+ options[:version] || @options[:version] || '2015-04-07'
532
532
  end
533
533
 
534
534
  def api_request(method, endpoint, parameters = nil, options = {})
@@ -553,7 +553,7 @@ module ActiveMerchant #:nodoc:
553
553
 
554
554
  card = card_from_response(response)
555
555
  avs_code = AVS_CODE_TRANSLATOR["line1: #{card["address_line1_check"]}, zip: #{card["address_zip_check"]}"]
556
- cvc_code = CVC_CODE_TRANSLATOR[card["cvc_check"]]
556
+ cvc_code = CVC_CODE_TRANSLATOR[card['cvc_check']]
557
557
 
558
558
  Response.new(success,
559
559
  message_from(success, response),
@@ -568,23 +568,23 @@ module ActiveMerchant #:nodoc:
568
568
  end
569
569
 
570
570
  def authorization_from(success, url, method, response)
571
- return response.fetch("error", {})["charge"] unless success
571
+ return response.fetch('error', {})['charge'] unless success
572
572
 
573
- if url == "customers"
574
- [response["id"], response["sources"]["data"].first["id"]].join("|")
573
+ if url == 'customers'
574
+ [response['id'], response['sources']['data'].first['id']].join('|')
575
575
  elsif method == :post && url.match(/customers\/.*\/cards/)
576
- [response["customer"], response["id"]].join("|")
576
+ [response['customer'], response['id']].join('|')
577
577
  else
578
- response["id"]
578
+ response['id']
579
579
  end
580
580
  end
581
581
 
582
582
  def message_from(success, response)
583
- success ? "Transaction approved" : response.fetch("error", {"message" => "No error details"})["message"]
583
+ success ? 'Transaction approved' : response.fetch('error', {'message' => 'No error details'})['message']
584
584
  end
585
585
 
586
586
  def success_from(response)
587
- !response.key?("error") && response["status"] != "failed"
587
+ !response.key?('error') && response['status'] != 'failed'
588
588
  end
589
589
 
590
590
  def response_error(raw_response)
@@ -599,8 +599,8 @@ module ActiveMerchant #:nodoc:
599
599
  msg = 'Invalid response received from the Stripe API. Please contact support@stripe.com if you continue to receive this message.'
600
600
  msg += " (The raw response returned by the API was #{raw_response.inspect})"
601
601
  {
602
- "error" => {
603
- "message" => msg
602
+ 'error' => {
603
+ 'message' => msg
604
604
  }
605
605
  }
606
606
  end
@@ -624,13 +624,13 @@ module ActiveMerchant #:nodoc:
624
624
  end
625
625
 
626
626
  def card_from_response(response)
627
- response["card"] || response["active_card"] || response["source"] || {}
627
+ response['card'] || response['active_card'] || response['source'] || {}
628
628
  end
629
629
 
630
630
  def emv_authorization_from_response(response)
631
- return response["error"]["emv_auth_data"] if response["error"]
631
+ return response['error']['emv_auth_data'] if response['error']
632
632
 
633
- card_from_response(response)["emv_auth_data"]
633
+ card_from_response(response)['emv_auth_data']
634
634
  end
635
635
 
636
636
  def error_code_from(response)
@@ -659,12 +659,12 @@ module ActiveMerchant #:nodoc:
659
659
  }
660
660
 
661
661
  token_response = api_request(:post, "tokens?#{post_data(post)}")
662
- success = token_response["error"].nil?
662
+ success = token_response['error'].nil?
663
663
 
664
- if success && token_response["id"]
664
+ if success && token_response['id']
665
665
  Response.new(success, nil, token: token_response)
666
666
  else
667
- Response.new(success, token_response["error"]["message"])
667
+ Response.new(success, token_response['error']['message'])
668
668
  end
669
669
  end
670
670
 
@@ -673,7 +673,7 @@ module ActiveMerchant #:nodoc:
673
673
  when String, nil
674
674
  false
675
675
  else
676
- card_brand(payment_method) == "check"
676
+ card_brand(payment_method) == 'check'
677
677
  end
678
678
  end
679
679
 
@@ -69,7 +69,7 @@ module ActiveMerchant #:nodoc:
69
69
  post[:td_user_data] = options[:order_id] if options[:order_id]
70
70
  post[:td_item] = options[:description] if options[:description]
71
71
  post[:td_description] = options[:description] if options[:description]
72
- post[:item_quantity] = "1"
72
+ post[:item_quantity] = '1'
73
73
  end
74
74
 
75
75
  def add_creditcard(post, creditcard)
@@ -95,16 +95,16 @@ module ActiveMerchant #:nodoc:
95
95
 
96
96
  def commit(action, money, parameters)
97
97
  case action
98
- when "sale"
98
+ when 'sale'
99
99
  begin
100
100
  response = call_api(TRANSACTION_API, parameters)
101
101
 
102
102
  # response code and message params should always be present
103
- code = response["response_code"]
104
- message = response["message"]
103
+ code = response['response_code']
104
+ message = response['message']
105
105
 
106
106
  if code == 200
107
- result = response["data"]["result"]
107
+ result = response['data']['result']
108
108
  success = (result == 'accepted' || (test? && result == 'test-accepted'))
109
109
 
110
110
  Response.new(success,
@@ -3,13 +3,13 @@ require 'nokogiri'
3
3
  module ActiveMerchant #:nodoc:
4
4
  module Billing #:nodoc:
5
5
  class TelrGateway < Gateway
6
- self.display_name = "Telr"
7
- self.homepage_url = "http://www.telr.com/"
6
+ self.display_name = 'Telr'
7
+ self.homepage_url = 'http://www.telr.com/'
8
8
 
9
- self.live_url = "https://secure.telr.com/gateway/remote.xml"
9
+ self.live_url = 'https://secure.telr.com/gateway/remote.xml'
10
10
 
11
- self.supported_countries = ["AE", "IN", "SA"]
12
- self.default_currency = "AED"
11
+ self.supported_countries = ['AE', 'IN', 'SA']
12
+ self.default_currency = 'AED'
13
13
  self.money_format = :dollars
14
14
  self.supported_cardtypes = [:visa, :master, :american_express, :maestro, :solo, :jcb]
15
15
 
@@ -35,7 +35,7 @@ module ActiveMerchant #:nodoc:
35
35
 
36
36
  def purchase(amount, payment_method, options={})
37
37
  commit(:purchase, amount, options[:currency]) do |doc|
38
- add_invoice(doc, "sale", amount, payment_method, options)
38
+ add_invoice(doc, 'sale', amount, payment_method, options)
39
39
  add_payment_method(doc, payment_method, options)
40
40
  add_customer_data(doc, payment_method, options)
41
41
  end
@@ -43,7 +43,7 @@ module ActiveMerchant #:nodoc:
43
43
 
44
44
  def authorize(amount, payment_method, options={})
45
45
  commit(:authorize, amount, options[:currency]) do |doc|
46
- add_invoice(doc, "auth", amount, payment_method, options)
46
+ add_invoice(doc, 'auth', amount, payment_method, options)
47
47
  add_payment_method(doc, payment_method, options)
48
48
  add_customer_data(doc, payment_method, options)
49
49
  end
@@ -51,34 +51,34 @@ module ActiveMerchant #:nodoc:
51
51
 
52
52
  def capture(amount, authorization, options={})
53
53
  commit(:capture) do |doc|
54
- add_invoice(doc, "capture", amount, authorization, options)
54
+ add_invoice(doc, 'capture', amount, authorization, options)
55
55
  end
56
56
  end
57
57
 
58
58
  def void(authorization, options={})
59
59
  _, amount, currency = split_authorization(authorization)
60
60
  commit(:void) do |doc|
61
- add_invoice(doc, "void", amount.to_i, authorization, options.merge(currency: currency))
61
+ add_invoice(doc, 'void', amount.to_i, authorization, options.merge(currency: currency))
62
62
  end
63
63
  end
64
64
 
65
65
  def refund(amount, authorization, options={})
66
66
  commit(:refund) do |doc|
67
- add_invoice(doc, "refund", amount, authorization, options)
67
+ add_invoice(doc, 'refund', amount, authorization, options)
68
68
  end
69
69
  end
70
70
 
71
71
  def verify(credit_card, options={})
72
72
  commit(:verify) do |doc|
73
- add_invoice(doc, "verify", 100, credit_card, options)
73
+ add_invoice(doc, 'verify', 100, credit_card, options)
74
74
  add_payment_method(doc, credit_card, options)
75
75
  add_customer_data(doc, credit_card, options)
76
76
  end
77
77
  end
78
78
 
79
79
  def verify_credentials
80
- response = void("0")
81
- !["01", "04"].include?(response.error_code)
80
+ response = void('0')
81
+ !['01', '04'].include?(response.error_code)
82
82
  end
83
83
 
84
84
  def supports_scrubbing?
@@ -101,7 +101,7 @@ module ActiveMerchant #:nodoc:
101
101
  doc.currency(options[:currency] || currency(money))
102
102
  doc.cartid(options[:order_id])
103
103
  doc.class_(transaction_class(action, payment_method))
104
- doc.description(options[:description] || "Description")
104
+ doc.description(options[:description] || 'Description')
105
105
  doc.test_(test_mode)
106
106
  add_ref(doc, action, payment_method)
107
107
  end
@@ -126,7 +126,7 @@ module ActiveMerchant #:nodoc:
126
126
  doc.first(payment_method.first_name)
127
127
  doc.last(payment_method.last_name)
128
128
  end
129
- doc.email(options[:email] || "unspecified@email.com")
129
+ doc.email(options[:email] || 'unspecified@email.com')
130
130
  doc.ip(options[:ip]) if options[:ip]
131
131
  doc.address do
132
132
  add_address(doc, options)
@@ -136,9 +136,9 @@ module ActiveMerchant #:nodoc:
136
136
 
137
137
  def add_address(doc, options)
138
138
  address = options[:billing_address] || {}
139
- doc.country(address[:country] ? lookup_country_code(address[:country]) : "NA")
140
- doc.city(address[:city] || "City")
141
- doc.line1(address[:address1] || "Address")
139
+ doc.country(address[:country] ? lookup_country_code(address[:country]) : 'NA')
140
+ doc.city(address[:city] || 'City')
141
+ doc.line1(address[:address1] || 'Address')
142
142
  return unless address
143
143
  doc.line2(address[:address2]) if address[:address2]
144
144
  doc.zip(address[:zip]) if address[:zip]
@@ -146,7 +146,7 @@ module ActiveMerchant #:nodoc:
146
146
  end
147
147
 
148
148
  def add_ref(doc, action, payment_method)
149
- if ["capture", "refund", "void"].include?(action) || payment_method.is_a?(String)
149
+ if ['capture', 'refund', 'void'].include?(action) || payment_method.is_a?(String)
150
150
  doc.ref(split_authorization(payment_method)[0])
151
151
  end
152
152
  end
@@ -204,10 +204,10 @@ module ActiveMerchant #:nodoc:
204
204
  end
205
205
 
206
206
  def transaction_class(action, payment_method)
207
- if payment_method.is_a?(String) && action == "sale"
208
- return "cont"
207
+ if payment_method.is_a?(String) && action == 'sale'
208
+ return 'cont'
209
209
  else
210
- return "moto"
210
+ return 'moto'
211
211
  end
212
212
  end
213
213
 
@@ -215,7 +215,7 @@ module ActiveMerchant #:nodoc:
215
215
  response = {}
216
216
 
217
217
  doc = Nokogiri::XML(xml)
218
- doc.root.xpath("*").each do |node|
218
+ doc.root.xpath('*').each do |node|
219
219
  if (node.elements.size == 0)
220
220
  response[node.name.downcase.to_sym] = node.text
221
221
  else
@@ -240,12 +240,12 @@ module ActiveMerchant #:nodoc:
240
240
  end
241
241
 
242
242
  def success_from(response)
243
- response[:status] == "A"
243
+ response[:status] == 'A'
244
244
  end
245
245
 
246
246
  def message_from(succeeded, response)
247
247
  if succeeded
248
- "Succeeded"
248
+ 'Succeeded'
249
249
  else
250
250
  response[:message]
251
251
  end
@@ -267,7 +267,7 @@ module ActiveMerchant #:nodoc:
267
267
 
268
268
  def headers
269
269
  {
270
- "Content-Type" => "text/xml"
270
+ 'Content-Type' => 'text/xml'
271
271
  }
272
272
  end
273
273
  end