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
@@ -27,16 +27,16 @@ module ActiveMerchant #:nodoc:
27
27
  def validate
28
28
  errors = []
29
29
 
30
- errors << [:merchant_name, "is required"] if self.merchant_name.blank?
31
- errors << [:merchant_name, "is required to be 25 bytes or less"] if self.merchant_name.bytesize > 25
30
+ errors << [:merchant_name, 'is required'] if self.merchant_name.blank?
31
+ errors << [:merchant_name, 'is required to be 25 bytes or less'] if self.merchant_name.bytesize > 25
32
32
 
33
33
  if(!empty?(self.merchant_phone) && !self.merchant_phone.match(PHONE_FORMAT_1) && !self.merchant_phone.match(PHONE_FORMAT_2))
34
- errors << [:merchant_phone, "is required to follow \"NNN-NNN-NNNN\" or \"NNN-AAAAAAA\" format"]
34
+ errors << [:merchant_phone, 'is required to follow "NNN-NNN-NNNN" or "NNN-AAAAAAA" format']
35
35
  end
36
36
 
37
37
  [:merchant_email, :merchant_url].each do |attr|
38
38
  unless self.send(attr).blank?
39
- errors << [attr, "is required to be 13 bytes or less"] if(self.send(attr).bytesize > 13)
39
+ errors << [attr, 'is required to be 13 bytes or less'] if(self.send(attr).bytesize > 13)
40
40
  end
41
41
  end
42
42
 
@@ -159,11 +159,11 @@ module ActiveMerchant #:nodoc:
159
159
  return response['Message'] if response['Message']
160
160
 
161
161
  if response['Status'] == 'Approved'
162
- "This transaction has been approved"
162
+ 'This transaction has been approved'
163
163
  elsif response['Status'] == 'Declined'
164
- "This transaction has been declined"
164
+ 'This transaction has been declined'
165
165
  elsif response['Status'] == 'Voided'
166
- "This transaction has been voided"
166
+ 'This transaction has been voided'
167
167
  else
168
168
  response['Status']
169
169
  end
@@ -179,12 +179,12 @@ module ActiveMerchant #:nodoc:
179
179
  post['RequestID'] = request_id
180
180
  post['Signature'] = signature(action, post, parameters)
181
181
 
182
- request = post.merge(parameters).collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&")
182
+ request = post.merge(parameters).collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
183
183
  request
184
184
  end
185
185
 
186
186
  def timestamp
187
- Time.now.strftime("%Y-%m-%dT%H:%M:%S.Z")
187
+ Time.now.strftime('%Y-%m-%dT%H:%M:%S.Z')
188
188
  end
189
189
 
190
190
  def request_id
@@ -132,18 +132,18 @@ module ActiveMerchant #:nodoc:
132
132
  end
133
133
  post_data(h)
134
134
  elsif value.is_a?(Array)
135
- value.map { |v| "#{key}[]=#{CGI.escape(v.to_s)}" }.join("&")
135
+ value.map { |v| "#{key}[]=#{CGI.escape(v.to_s)}" }.join('&')
136
136
  else
137
137
  "#{key}=#{CGI.escape(value.to_s)}"
138
138
  end
139
- end.compact.join("&")
139
+ end.compact.join('&')
140
140
  end
141
141
 
142
142
  def headers(options = {})
143
143
  {
144
- "Authorization" => "Basic " + Base64.encode64(@api_key.to_s + ":x").strip,
145
- "User-Agent" => "Pagar.me/1 ActiveMerchant/#{ActiveMerchant::VERSION}",
146
- "Accept-Encoding" => "deflate"
144
+ 'Authorization' => 'Basic ' + Base64.encode64(@api_key.to_s + ':x').strip,
145
+ 'User-Agent' => "Pagar.me/1 ActiveMerchant/#{ActiveMerchant::VERSION}",
146
+ 'Accept-Encoding' => 'deflate'
147
147
  }
148
148
  end
149
149
 
@@ -186,61 +186,61 @@ module ActiveMerchant #:nodoc:
186
186
  msg = 'Resposta inválida retornada pela API do Pagar.me. Por favor entre em contato com suporte@pagar.me se você continuar recebendo essa mensagem.'
187
187
  msg += " (A resposta retornada pela API foi #{raw_response.inspect})"
188
188
  {
189
- "errors" => [{
190
- "message" => msg
189
+ 'errors' => [{
190
+ 'message' => msg
191
191
  }]
192
192
  }
193
193
  end
194
194
 
195
195
  def success_from(response)
196
- success_purchase = response.key?("status") && response["status"] == "paid"
197
- success_authorize = response.key?("status") && response["status"] == "authorized"
198
- success_refund = response.key?("status") && response["status"] == "refunded"
196
+ success_purchase = response.key?('status') && response['status'] == 'paid'
197
+ success_authorize = response.key?('status') && response['status'] == 'authorized'
198
+ success_refund = response.key?('status') && response['status'] == 'refunded'
199
199
 
200
200
  success_purchase || success_authorize || success_refund
201
201
  end
202
202
 
203
203
  def failure_from(response)
204
- response.key?("status") && response["status"] == "refused"
204
+ response.key?('status') && response['status'] == 'refused'
205
205
  end
206
206
 
207
207
  def message_from(response)
208
208
  if success_from(response)
209
- case response["status"]
210
- when "paid"
211
- "Transação aprovada"
212
- when "authorized"
213
- "Transação autorizada"
214
- when "refunded"
215
- "Transação estornada"
209
+ case response['status']
210
+ when 'paid'
211
+ 'Transação aprovada'
212
+ when 'authorized'
213
+ 'Transação autorizada'
214
+ when 'refunded'
215
+ 'Transação estornada'
216
216
  else
217
217
  "Transação com status '#{response["status"]}'"
218
218
  end
219
219
  elsif failure_from(response)
220
- "Transação recusada"
221
- elsif response.key?("errors")
222
- response["errors"][0]["message"]
220
+ 'Transação recusada'
221
+ elsif response.key?('errors')
222
+ response['errors'][0]['message']
223
223
  else
224
224
  msg = json_error(response)
225
- msg["errors"][0]["message"]
225
+ msg['errors'][0]['message']
226
226
  end
227
227
  end
228
228
 
229
229
  def authorization_from(response)
230
230
  if success_from(response)
231
- response["id"]
231
+ response['id']
232
232
  end
233
233
  end
234
234
 
235
235
  def test?()
236
- @api_key.start_with?("ak_test")
236
+ @api_key.start_with?('ak_test')
237
237
  end
238
238
 
239
239
  def error_code_from(response)
240
240
  if failure_from(response)
241
- STANDARD_ERROR_CODE_MAPPING["refused"]
242
- elsif response.key?("errors")
243
- STANDARD_ERROR_CODE_MAPPING["processing_error"]
241
+ STANDARD_ERROR_CODE_MAPPING['refused']
242
+ elsif response.key?('errors')
243
+ STANDARD_ERROR_CODE_MAPPING['processing_error']
244
244
  end
245
245
  end
246
246
  end
@@ -63,7 +63,7 @@ module ActiveMerchant #:nodoc:
63
63
  post[:apellidos] = credit_card.last_name
64
64
  post[:numeroTarjeta] = credit_card.number
65
65
  post[:cvt] = credit_card.verification_value
66
- post[:mesExpiracion] = sprintf("%02d", credit_card.month)
66
+ post[:mesExpiracion] = sprintf('%02d', credit_card.month)
67
67
  post[:anyoExpiracion] = credit_card.year.to_s.slice(-2, 2)
68
68
  end
69
69
 
@@ -74,7 +74,7 @@ module ActiveMerchant #:nodoc:
74
74
  end
75
75
 
76
76
  def parse(body)
77
- JSON.parse(body)["WebServices_Transacciones"]["transaccion"]
77
+ JSON.parse(body)['WebServices_Transacciones']['transaccion']
78
78
  rescue JSON::ParserError
79
79
  json_error(body)
80
80
  end
@@ -92,16 +92,16 @@ module ActiveMerchant #:nodoc:
92
92
  end
93
93
 
94
94
  def success_from(response)
95
- response["autorizado"] == "1" ||
96
- response["autorizado"] == true
95
+ response['autorizado'] == '1' ||
96
+ response['autorizado'] == true
97
97
  end
98
98
 
99
99
  def message_from(response)
100
- response["texto"]
100
+ response['texto']
101
101
  end
102
102
 
103
103
  def authorization_from(response)
104
- response["autorizacion"]
104
+ response['autorizacion']
105
105
  end
106
106
 
107
107
  def post_data(parameters = {})
@@ -113,8 +113,8 @@ module ActiveMerchant #:nodoc:
113
113
 
114
114
  def json_error(response)
115
115
  {
116
- "texto" => 'Invalid response received from the PagoFacil API.',
117
- "raw_response" => response
116
+ 'texto' => 'Invalid response received from the PagoFacil API.',
117
+ 'raw_response' => response
118
118
  }
119
119
  end
120
120
  end
@@ -3,15 +3,15 @@ module ActiveMerchant #:nodoc:
3
3
  class PayConexGateway < Gateway
4
4
  include Empty
5
5
 
6
- self.test_url = "https://cert.payconex.net/api/qsapi/3.8/"
7
- self.live_url = "https://secure.payconex.net/api/qsapi/3.8/"
6
+ self.test_url = 'https://cert.payconex.net/api/qsapi/3.8/'
7
+ self.live_url = 'https://secure.payconex.net/api/qsapi/3.8/'
8
8
 
9
9
  self.supported_countries = %w(US CA)
10
- self.default_currency = "USD"
10
+ self.default_currency = 'USD'
11
11
  self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb, :diners_club]
12
12
 
13
- self.homepage_url = "http://www.bluefincommerce.com/"
14
- self.display_name = "PayConex"
13
+ self.homepage_url = 'http://www.bluefincommerce.com/'
14
+ self.display_name = 'PayConex'
15
15
 
16
16
  def initialize(options={})
17
17
  requires!(options, :account_id, :api_accesskey)
@@ -21,43 +21,43 @@ module ActiveMerchant #:nodoc:
21
21
  def purchase(money, payment_method, options={})
22
22
  post = {}
23
23
  add_auth_purchase_params(post, money, payment_method, options)
24
- commit("SALE", post)
24
+ commit('SALE', post)
25
25
  end
26
26
 
27
27
  def authorize(money, payment_method, options={})
28
28
  post = {}
29
29
  add_auth_purchase_params(post, money, payment_method, options)
30
- commit("AUTHORIZATION", post)
30
+ commit('AUTHORIZATION', post)
31
31
  end
32
32
 
33
33
  def capture(money, authorization, options={})
34
34
  post = {}
35
35
  add_reference_params(post, authorization, options)
36
36
  add_amount(post, money, options)
37
- commit("CAPTURE", post)
37
+ commit('CAPTURE', post)
38
38
  end
39
39
 
40
40
  def refund(money, authorization, options={})
41
41
  post = {}
42
42
  add_reference_params(post, authorization, options)
43
43
  add_amount(post, money, options)
44
- commit("REFUND", post)
44
+ commit('REFUND', post)
45
45
  end
46
46
 
47
47
  def void(authorization, options = {})
48
48
  post = {}
49
49
  add_reference_params(post, authorization, options)
50
- commit("REVERSAL", post)
50
+ commit('REVERSAL', post)
51
51
  end
52
52
 
53
53
  def credit(money, payment_method, options={})
54
54
  if payment_method.is_a?(String)
55
- raise ArgumentError, "Reference credits are not supported. Please supply the original credit card or use the #refund method."
55
+ raise ArgumentError, 'Reference credits are not supported. Please supply the original credit card or use the #refund method.'
56
56
  end
57
57
 
58
58
  post = {}
59
59
  add_auth_purchase_params(post, money, payment_method, options)
60
- commit("CREDIT", post)
60
+ commit('CREDIT', post)
61
61
  end
62
62
 
63
63
  def verify(payment_method, options={})
@@ -70,7 +70,7 @@ module ActiveMerchant #:nodoc:
70
70
  add_payment_method(post, payment_method)
71
71
  add_address(post, options)
72
72
  add_common_options(post, options)
73
- commit("STORE", post)
73
+ commit('STORE', post)
74
74
  end
75
75
 
76
76
  def supports_scrubbing?
@@ -88,8 +88,8 @@ module ActiveMerchant #:nodoc:
88
88
 
89
89
  def force_utf8(string)
90
90
  return nil unless string
91
- binary = string.encode("BINARY", invalid: :replace, undef: :replace, replace: "?") # Needed for Ruby 2.0 since #encode is a no-op if the string is already UTF-8. It's not needed for Ruby 2.1 and up since it's not a no-op there.
92
- binary.encode("UTF-8", invalid: :replace, undef: :replace, replace: "?")
91
+ binary = string.encode('BINARY', invalid: :replace, undef: :replace, replace: '?') # Needed for Ruby 2.0 since #encode is a no-op if the string is already UTF-8. It's not needed for Ruby 2.1 and up since it's not a no-op there.
92
+ binary.encode('UTF-8', invalid: :replace, undef: :replace, replace: '?')
93
93
  end
94
94
 
95
95
  def add_credentials(post)
@@ -134,7 +134,7 @@ module ActiveMerchant #:nodoc:
134
134
  end
135
135
 
136
136
  def add_credit_card(post, payment_method)
137
- post[:tender_type] = "CARD"
137
+ post[:tender_type] = 'CARD'
138
138
  post[:card_number] = payment_method.number
139
139
  post[:card_expiration] = expdate(payment_method)
140
140
  post[:card_verification] = payment_method.verification_value
@@ -143,18 +143,18 @@ module ActiveMerchant #:nodoc:
143
143
  end
144
144
 
145
145
  def add_token_payment_method(post, payment_method)
146
- post[:tender_type] = "CARD"
146
+ post[:tender_type] = 'CARD'
147
147
  post[:token_id] = payment_method
148
148
  post[:reissue] = true
149
149
  end
150
150
 
151
151
  def add_card_present_payment_method(post, payment_method)
152
- post[:tender_type] = "CARD"
152
+ post[:tender_type] = 'CARD'
153
153
  post[:card_tracks] = payment_method.track_data
154
154
  end
155
155
 
156
156
  def add_check(post, payment_method)
157
- post[:tender_type] = "ACH"
157
+ post[:tender_type] = 'ACH'
158
158
  post[:first_name] = payment_method.first_name
159
159
  post[:last_name] = payment_method.last_name
160
160
  post[:bank_account_number] = payment_method.account_number
@@ -208,9 +208,9 @@ module ActiveMerchant #:nodoc:
208
208
  success_from(response),
209
209
  message_from(response),
210
210
  response,
211
- authorization: response["transaction_id"],
212
- :avs_result => AVSResult.new(code: response["avs_response"]),
213
- :cvv_result => CVVResult.new(response["cvv2_response"]),
211
+ authorization: response['transaction_id'],
212
+ :avs_result => AVSResult.new(code: response['avs_response']),
213
+ :cvv_result => CVVResult.new(response['cvv2_response']),
214
214
  test: test?
215
215
  )
216
216
 
@@ -223,11 +223,11 @@ module ActiveMerchant #:nodoc:
223
223
  end
224
224
 
225
225
  def success_from(response)
226
- response["transaction_approved"] || !response["error"]
226
+ response['transaction_approved'] || !response['error']
227
227
  end
228
228
 
229
229
  def message_from(response)
230
- success_from(response) ? response["authorization_message"] : response["error_message"]
230
+ success_from(response) ? response['authorization_message'] : response['error_message']
231
231
  end
232
232
 
233
233
  def post_data(action, params)
@@ -236,7 +236,7 @@ module ActiveMerchant #:nodoc:
236
236
  end
237
237
 
238
238
  def unparsable_response(raw_response)
239
- message = "Invalid JSON response received from PayConex. Please contact PayConex if you continue to receive this message."
239
+ message = 'Invalid JSON response received from PayConex. Please contact PayConex if you continue to receive this message.'
240
240
  message += " (The raw response returned by the API was #{raw_response.inspect})"
241
241
  return Response.new(false, message)
242
242
  end
@@ -102,45 +102,45 @@ module ActiveMerchant #:nodoc:
102
102
 
103
103
  DECLINE_CODES = {
104
104
  # Credit Card Errors - These RESULT_CODEs are returned if the transaction cannot be authorized due to a problem with the card. The TRANSACTION_STATUS will be 2
105
- 900001 => "Call for Approval",
106
- 900002 => "Card Expired",
107
- 900003 => "Insufficient Funds",
108
- 900004 => "Invalid Card Number",
109
- 900005 => "Bank Interface Timeout", # indicates a communications failure between the banks systems
110
- 900006 => "Invalid Card",
111
- 900007 => "Declined",
112
- 900009 => "Lost Card",
113
- 900010 => "Invalid Card Length",
114
- 900011 => "Suspected Fraud",
115
- 900012 => "Card Reported As Stolen",
116
- 900013 => "Restricted Card",
117
- 900014 => "Excessive Card Usage",
118
- 900015 => "Card Blacklisted",
119
-
120
- 900207 => "Declined; authentication failed", # indicates the cardholder did not enter their MasterCard SecureCode / Verified by Visa password correctly
121
-
122
- 990020 => "Auth Declined",
123
-
124
- 991001 => "Invalid expiry date",
125
- 991002 => "Invalid amount",
105
+ 900001 => 'Call for Approval',
106
+ 900002 => 'Card Expired',
107
+ 900003 => 'Insufficient Funds',
108
+ 900004 => 'Invalid Card Number',
109
+ 900005 => 'Bank Interface Timeout', # indicates a communications failure between the banks systems
110
+ 900006 => 'Invalid Card',
111
+ 900007 => 'Declined',
112
+ 900009 => 'Lost Card',
113
+ 900010 => 'Invalid Card Length',
114
+ 900011 => 'Suspected Fraud',
115
+ 900012 => 'Card Reported As Stolen',
116
+ 900013 => 'Restricted Card',
117
+ 900014 => 'Excessive Card Usage',
118
+ 900015 => 'Card Blacklisted',
119
+
120
+ 900207 => 'Declined; authentication failed', # indicates the cardholder did not enter their MasterCard SecureCode / Verified by Visa password correctly
121
+
122
+ 990020 => 'Auth Declined',
123
+
124
+ 991001 => 'Invalid expiry date',
125
+ 991002 => 'Invalid amount',
126
126
 
127
127
  # Communication Errors - These RESULT_CODEs are returned if the transaction cannot be completed due to an unexpected error. TRANSACTION_STATUS will be 0.
128
- 900205 => "Unexpected authentication result (phase 1)",
129
- 900206 => "Unexpected authentication result (phase 1)",
128
+ 900205 => 'Unexpected authentication result (phase 1)',
129
+ 900206 => 'Unexpected authentication result (phase 1)',
130
130
 
131
- 990001 => "Could not insert into Database",
131
+ 990001 => 'Could not insert into Database',
132
132
 
133
- 990022 => "Bank not available",
133
+ 990022 => 'Bank not available',
134
134
 
135
- 990053 => "Error processing transaction",
135
+ 990053 => 'Error processing transaction',
136
136
 
137
137
  # Miscellaneous - Unless otherwise noted, the TRANSACTION_STATUS will be 0.
138
- 900209 => "Transaction verification failed (phase 2)", # Indicates the verification data returned from MasterCard SecureCode / Verified by Visa has been altered
139
- 900210 => "Authentication complete; transaction must be restarted", # Indicates that the MasterCard SecuerCode / Verified by Visa transaction has already been completed. Most likely caused by the customer clicking the refresh button
138
+ 900209 => 'Transaction verification failed (phase 2)', # Indicates the verification data returned from MasterCard SecureCode / Verified by Visa has been altered
139
+ 900210 => 'Authentication complete; transaction must be restarted', # Indicates that the MasterCard SecuerCode / Verified by Visa transaction has already been completed. Most likely caused by the customer clicking the refresh button
140
140
 
141
- 990024 => "Duplicate Transaction Detected. Please check before submitting",
141
+ 990024 => 'Duplicate Transaction Detected. Please check before submitting',
142
142
 
143
- 990028 => "Transaction cancelled" # Customer clicks the 'Cancel' button on the payment page
143
+ 990028 => 'Transaction cancelled' # Customer clicks the 'Cancel' button on the payment page
144
144
  }
145
145
 
146
146
  SUCCESS_CODES = %w( 990004 990005 990017 990012 990018 990031 )
@@ -210,7 +210,7 @@ module ActiveMerchant #:nodoc:
210
210
  when 'refundtx'
211
211
  build_refund(protocol, money, authorization, options)
212
212
  else
213
- raise "no action specified for build_request"
213
+ raise 'no action specified for build_request'
214
214
  end
215
215
  end
216
216
 
@@ -265,7 +265,7 @@ module ActiveMerchant #:nodoc:
265
265
  response = parse(action, ssl_post(self.live_url, request))
266
266
  Response.new(successful?(response), message_from(response), response,
267
267
  :test => test?,
268
- :authorization => authorization ? authorization : response[:tid]
268
+ :authorization => authorization || response[:tid]
269
269
  )
270
270
  end
271
271