activemerchant 1.79.2 → 1.80.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (219) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +33 -0
  3. data/README.md +10 -2
  4. data/lib/active_merchant.rb +1 -1
  5. data/lib/active_merchant/billing/check.rb +4 -4
  6. data/lib/active_merchant/billing/compatibility.rb +1 -1
  7. data/lib/active_merchant/billing/credit_card.rb +21 -21
  8. data/lib/active_merchant/billing/credit_card_formatting.rb +2 -2
  9. data/lib/active_merchant/billing/credit_card_methods.rb +2 -2
  10. data/lib/active_merchant/billing/gateway.rb +13 -13
  11. data/lib/active_merchant/billing/gateways/adyen.rb +31 -15
  12. data/lib/active_merchant/billing/gateways/allied_wallet.rb +22 -22
  13. data/lib/active_merchant/billing/gateways/authorize_net.rb +72 -72
  14. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +3 -3
  15. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +3 -3
  16. data/lib/active_merchant/billing/gateways/axcessms.rb +51 -51
  17. data/lib/active_merchant/billing/gateways/balanced.rb +29 -29
  18. data/lib/active_merchant/billing/gateways/bank_frick.rb +3 -3
  19. data/lib/active_merchant/billing/gateways/banwire.rb +8 -8
  20. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +5 -5
  21. data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +6 -6
  22. data/lib/active_merchant/billing/gateways/be2bill.rb +2 -2
  23. data/lib/active_merchant/billing/gateways/beanstream.rb +1 -1
  24. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +69 -69
  25. data/lib/active_merchant/billing/gateways/blue_pay.rb +19 -19
  26. data/lib/active_merchant/billing/gateways/blue_snap.rb +42 -42
  27. data/lib/active_merchant/billing/gateways/bogus.rb +10 -10
  28. data/lib/active_merchant/billing/gateways/borgun.rb +10 -10
  29. data/lib/active_merchant/billing/gateways/bpoint.rb +1 -1
  30. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +2 -2
  31. data/lib/active_merchant/billing/gateways/braintree_blue.rb +94 -94
  32. data/lib/active_merchant/billing/gateways/braintree_orange.rb +1 -1
  33. data/lib/active_merchant/billing/gateways/bridge_pay.rb +39 -39
  34. data/lib/active_merchant/billing/gateways/cams.rb +12 -12
  35. data/lib/active_merchant/billing/gateways/card_connect.rb +38 -13
  36. data/lib/active_merchant/billing/gateways/card_stream.rb +116 -116
  37. data/lib/active_merchant/billing/gateways/cardknox.rb +7 -7
  38. data/lib/active_merchant/billing/gateways/cardprocess.rb +1 -1
  39. data/lib/active_merchant/billing/gateways/cashnet.rb +10 -10
  40. data/lib/active_merchant/billing/gateways/cc5.rb +3 -5
  41. data/lib/active_merchant/billing/gateways/cecabank.rb +6 -6
  42. data/lib/active_merchant/billing/gateways/cenpos.rb +36 -36
  43. data/lib/active_merchant/billing/gateways/checkout.rb +5 -5
  44. data/lib/active_merchant/billing/gateways/checkout_v2.rb +31 -31
  45. data/lib/active_merchant/billing/gateways/clearhaus.rb +5 -5
  46. data/lib/active_merchant/billing/gateways/commercegate.rb +6 -6
  47. data/lib/active_merchant/billing/gateways/conekta.rb +24 -19
  48. data/lib/active_merchant/billing/gateways/creditcall.rb +41 -41
  49. data/lib/active_merchant/billing/gateways/credorax.rb +104 -103
  50. data/lib/active_merchant/billing/gateways/culqi.rb +25 -25
  51. data/lib/active_merchant/billing/gateways/cyber_source.rb +65 -65
  52. data/lib/active_merchant/billing/gateways/data_cash.rb +4 -4
  53. data/lib/active_merchant/billing/gateways/dibs.rb +24 -24
  54. data/lib/active_merchant/billing/gateways/digitzs.rb +35 -35
  55. data/lib/active_merchant/billing/gateways/ebanx.rb +26 -26
  56. data/lib/active_merchant/billing/gateways/efsnet.rb +10 -10
  57. data/lib/active_merchant/billing/gateways/elavon.rb +5 -5
  58. data/lib/active_merchant/billing/gateways/element.rb +35 -35
  59. data/lib/active_merchant/billing/gateways/epay.rb +4 -4
  60. data/lib/active_merchant/billing/gateways/evo_ca.rb +1 -1
  61. data/lib/active_merchant/billing/gateways/eway.rb +65 -65
  62. data/lib/active_merchant/billing/gateways/eway_managed.rb +11 -11
  63. data/lib/active_merchant/billing/gateways/eway_rapid.rb +31 -31
  64. data/lib/active_merchant/billing/gateways/exact.rb +12 -12
  65. data/lib/active_merchant/billing/gateways/ezic.rb +13 -13
  66. data/lib/active_merchant/billing/gateways/fat_zebra.rb +24 -24
  67. data/lib/active_merchant/billing/gateways/federated_canada.rb +3 -3
  68. data/lib/active_merchant/billing/gateways/first_giving.rb +16 -16
  69. data/lib/active_merchant/billing/gateways/first_pay.rb +7 -4
  70. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +71 -71
  71. data/lib/active_merchant/billing/gateways/flo2cash.rb +12 -12
  72. data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +1 -1
  73. data/lib/active_merchant/billing/gateways/forte.rb +26 -16
  74. data/lib/active_merchant/billing/gateways/garanti.rb +10 -12
  75. data/lib/active_merchant/billing/gateways/global_collect.rb +88 -88
  76. data/lib/active_merchant/billing/gateways/global_transport.rb +4 -4
  77. data/lib/active_merchant/billing/gateways/hdfc.rb +33 -33
  78. data/lib/active_merchant/billing/gateways/hps.rb +28 -28
  79. data/lib/active_merchant/billing/gateways/iats_payments.rb +26 -26
  80. data/lib/active_merchant/billing/gateways/inspire.rb +15 -15
  81. data/lib/active_merchant/billing/gateways/instapay.rb +4 -4
  82. data/lib/active_merchant/billing/gateways/ipp.rb +17 -17
  83. data/lib/active_merchant/billing/gateways/iridium.rb +207 -207
  84. data/lib/active_merchant/billing/gateways/iveri.rb +8 -8
  85. data/lib/active_merchant/billing/gateways/jetpay.rb +134 -134
  86. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +141 -141
  87. data/lib/active_merchant/billing/gateways/komoju.rb +15 -15
  88. data/lib/active_merchant/billing/gateways/kushki.rb +31 -37
  89. data/lib/active_merchant/billing/gateways/latitude19.rb +64 -64
  90. data/lib/active_merchant/billing/gateways/linkpoint.rb +22 -22
  91. data/lib/active_merchant/billing/gateways/litle.rb +4 -4
  92. data/lib/active_merchant/billing/gateways/mastercard.rb +3 -3
  93. data/lib/active_merchant/billing/gateways/maxipago.rb +2 -2
  94. data/lib/active_merchant/billing/gateways/mercado_pago.rb +28 -28
  95. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +9 -9
  96. data/lib/active_merchant/billing/gateways/merchant_one.rb +6 -6
  97. data/lib/active_merchant/billing/gateways/merchant_partners.rb +24 -24
  98. data/lib/active_merchant/billing/gateways/merchant_ware.rb +49 -49
  99. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +36 -36
  100. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +4 -4
  101. data/lib/active_merchant/billing/gateways/mercury.rb +28 -28
  102. data/lib/active_merchant/billing/gateways/metrics_global.rb +7 -7
  103. data/lib/active_merchant/billing/gateways/micropayment.rb +31 -31
  104. data/lib/active_merchant/billing/gateways/migs.rb +11 -9
  105. data/lib/active_merchant/billing/gateways/modern_payments.rb +1 -1
  106. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +16 -16
  107. data/lib/active_merchant/billing/gateways/monei.rb +5 -5
  108. data/lib/active_merchant/billing/gateways/moneris.rb +26 -26
  109. data/lib/active_merchant/billing/gateways/moneris_us.rb +81 -37
  110. data/lib/active_merchant/billing/gateways/money_movers.rb +3 -3
  111. data/lib/active_merchant/billing/gateways/mundipagg.rb +1 -1
  112. data/lib/active_merchant/billing/gateways/nab_transact.rb +6 -6
  113. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +3 -3
  114. data/lib/active_merchant/billing/gateways/netaxept.rb +15 -15
  115. data/lib/active_merchant/billing/gateways/netbanx.rb +2 -2
  116. data/lib/active_merchant/billing/gateways/netbilling.rb +1 -1
  117. data/lib/active_merchant/billing/gateways/netpay.rb +5 -5
  118. data/lib/active_merchant/billing/gateways/nmi.rb +18 -18
  119. data/lib/active_merchant/billing/gateways/ogone.rb +22 -22
  120. data/lib/active_merchant/billing/gateways/omise.rb +3 -3
  121. data/lib/active_merchant/billing/gateways/openpay.rb +6 -4
  122. data/lib/active_merchant/billing/gateways/opp.rb +4 -4
  123. data/lib/active_merchant/billing/gateways/optimal_payment.rb +2 -2
  124. data/lib/active_merchant/billing/gateways/orbital.rb +61 -61
  125. data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +4 -4
  126. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +5 -5
  127. data/lib/active_merchant/billing/gateways/pagarme.rb +27 -27
  128. data/lib/active_merchant/billing/gateways/pago_facil.rb +8 -8
  129. data/lib/active_merchant/billing/gateways/pay_conex.rb +25 -25
  130. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +32 -32
  131. data/lib/active_merchant/billing/gateways/pay_hub.rb +29 -29
  132. data/lib/active_merchant/billing/gateways/pay_junction.rb +7 -7
  133. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +30 -30
  134. data/lib/active_merchant/billing/gateways/pay_secure.rb +4 -4
  135. data/lib/active_merchant/billing/gateways/paybox_direct.rb +15 -15
  136. data/lib/active_merchant/billing/gateways/payeezy.rb +5 -5
  137. data/lib/active_merchant/billing/gateways/payex.rb +4 -4
  138. data/lib/active_merchant/billing/gateways/payflow.rb +7 -7
  139. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +23 -22
  140. data/lib/active_merchant/billing/gateways/payflow_express.rb +2 -2
  141. data/lib/active_merchant/billing/gateways/payment_express.rb +40 -37
  142. data/lib/active_merchant/billing/gateways/paymentez.rb +11 -3
  143. data/lib/active_merchant/billing/gateways/paymill.rb +115 -115
  144. data/lib/active_merchant/billing/gateways/paypal.rb +1 -1
  145. data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +1 -1
  146. data/lib/active_merchant/billing/gateways/payscout.rb +1 -1
  147. data/lib/active_merchant/billing/gateways/paystation.rb +14 -14
  148. data/lib/active_merchant/billing/gateways/payu_in.rb +43 -43
  149. data/lib/active_merchant/billing/gateways/payu_latam.rb +41 -41
  150. data/lib/active_merchant/billing/gateways/payway.rb +6 -6
  151. data/lib/active_merchant/billing/gateways/pin.rb +7 -7
  152. data/lib/active_merchant/billing/gateways/plugnpay.rb +62 -62
  153. data/lib/active_merchant/billing/gateways/pro_pay.rb +123 -123
  154. data/lib/active_merchant/billing/gateways/psigate.rb +16 -16
  155. data/lib/active_merchant/billing/gateways/psl_card.rb +13 -13
  156. data/lib/active_merchant/billing/gateways/qbms.rb +52 -52
  157. data/lib/active_merchant/billing/gateways/quantum.rb +5 -5
  158. data/lib/active_merchant/billing/gateways/quickbooks.rb +10 -10
  159. data/lib/active_merchant/billing/gateways/quickpay.rb +1 -1
  160. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +11 -11
  161. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +3 -3
  162. data/lib/active_merchant/billing/gateways/qvalent.rb +55 -55
  163. data/lib/active_merchant/billing/gateways/realex.rb +16 -15
  164. data/lib/active_merchant/billing/gateways/redsys.rb +128 -121
  165. data/lib/active_merchant/billing/gateways/s5.rb +5 -5
  166. data/lib/active_merchant/billing/gateways/safe_charge.rb +16 -16
  167. data/lib/active_merchant/billing/gateways/sage.rb +20 -20
  168. data/lib/active_merchant/billing/gateways/sage_pay.rb +32 -32
  169. data/lib/active_merchant/billing/gateways/sallie_mae.rb +11 -11
  170. data/lib/active_merchant/billing/gateways/secure_net.rb +19 -19
  171. data/lib/active_merchant/billing/gateways/secure_pay.rb +5 -5
  172. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +7 -7
  173. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +9 -9
  174. data/lib/active_merchant/billing/gateways/securion_pay.rb +12 -12
  175. data/lib/active_merchant/billing/gateways/skip_jack.rb +28 -28
  176. data/lib/active_merchant/billing/gateways/smart_ps.rb +31 -31
  177. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +3 -3
  178. data/lib/active_merchant/billing/gateways/spreedly_core.rb +1 -1
  179. data/lib/active_merchant/billing/gateways/stripe.rb +63 -63
  180. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +5 -5
  181. data/lib/active_merchant/billing/gateways/telr.rb +26 -26
  182. data/lib/active_merchant/billing/gateways/trans_first.rb +28 -28
  183. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +224 -224
  184. data/lib/active_merchant/billing/gateways/transact_pro.rb +7 -7
  185. data/lib/active_merchant/billing/gateways/transnational.rb +1 -1
  186. data/lib/active_merchant/billing/gateways/trexle.rb +5 -5
  187. data/lib/active_merchant/billing/gateways/trust_commerce.rb +38 -38
  188. data/lib/active_merchant/billing/gateways/usa_epay.rb +3 -3
  189. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +37 -37
  190. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +3 -3
  191. data/lib/active_merchant/billing/gateways/vanco.rb +25 -25
  192. data/lib/active_merchant/billing/gateways/verifi.rb +40 -40
  193. data/lib/active_merchant/billing/gateways/viaklix.rb +5 -5
  194. data/lib/active_merchant/billing/gateways/visanet_peru.rb +64 -36
  195. data/lib/active_merchant/billing/gateways/webpay.rb +8 -8
  196. data/lib/active_merchant/billing/gateways/wepay.rb +25 -25
  197. data/lib/active_merchant/billing/gateways/wirecard.rb +26 -26
  198. data/lib/active_merchant/billing/gateways/worldpay.rb +15 -15
  199. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +42 -42
  200. data/lib/active_merchant/billing/gateways/worldpay_us.rb +17 -17
  201. data/lib/active_merchant/billing/model.rb +2 -2
  202. data/lib/active_merchant/billing/network_tokenization_credit_card.rb +1 -1
  203. data/lib/active_merchant/billing/rails.rb +1 -1
  204. data/lib/active_merchant/connection.rb +10 -8
  205. data/lib/active_merchant/country.rb +1 -1
  206. data/lib/active_merchant/net_http_ssl_connection.rb +1 -0
  207. data/lib/active_merchant/network_connection_retries.rb +12 -12
  208. data/lib/active_merchant/post_data.rb +1 -1
  209. data/lib/active_merchant/posts_data.rb +1 -1
  210. data/lib/active_merchant/version.rb +1 -1
  211. data/lib/certs/cacert.pem +37 -0
  212. data/lib/support/gateway_support.rb +2 -2
  213. data/lib/support/ssl_verify.rb +5 -5
  214. data/lib/support/ssl_version.rb +7 -7
  215. metadata +3 -7
  216. data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +0 -246
  217. data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +0 -13
  218. data/lib/active_merchant/billing/gateways/ideal/ideal_response.rb +0 -29
  219. data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +0 -66
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e03115d421b0031a4c73b44ed64febbc0f3df381
4
- data.tar.gz: d85fde5fb880eced27ce54395af62f37e9dbd7d3
3
+ metadata.gz: 2a370014b9b3f630ef74788e39ed2f70166e825b
4
+ data.tar.gz: ada89dc3c89779f200933eb9ce9ec03af4e4b68b
5
5
  SHA512:
6
- metadata.gz: cd18cb5c3152ba192c43ae33c764b778e288a98395f66f2a95950ea34832aded9ad77925dda23eedba356f9ef23c47dde7c7a357c18cf923fca2cef125a50a6a
7
- data.tar.gz: 1d68b1b83141f74a72fa17e0ebb4cfddd476116fb1af1b3014351ff88d2041927b47c0146c9c25b97223268f55902b70ca50aabb26fda0293713f3c71b27506c
6
+ metadata.gz: 9e98a44739681282c53fd421e39903830656a97bab74dab4c8d7ea34cf103f09b2c091fd6941b97cc72962e43f1aba3f104c89074089b5b2d3c53ae215f26a33
7
+ data.tar.gz: 255f0dab0c7aaf55f4d111fac977e5cd058fa5e8a86b4d6f424fe87bdb056d730bc5ea50830887fa1f69f72c58c24929ce3c3bf296f05b3c0196803e5a2702b5
data/CHANGELOG CHANGED
@@ -2,6 +2,39 @@
2
2
 
3
3
  == HEAD
4
4
 
5
+ == Version 1.80.0 (July 4, 2018)
6
+ * Default SSL min_version to TLS 1.1 to comply with June 30 PCI DSS deadline [bdewater] #2909
7
+ * Paymentez: return a Result object even when the upstream server 500s [bpollack] #2871
8
+ * Drop support for Ruby versions older than 2.3 [bpollack] #2863
9
+ * Bridge Pay: don't throw an exception when bank account type is omitted [bpollack] #2873
10
+ * Avoid making actual connections in Blue Snap and Mundipagg unit tests [bpollack] #2875
11
+ * Avoid making actual connections in the connection unit tests [bpollack] #2876
12
+ * Openpay: support payment installments [bpollack] #2865
13
+ * First Pay: support recurring charges [bpollack] #2877
14
+ * Bridge Pay: pass full name of account type for echeck transactions [bpollack] #2878
15
+ * Kushki: do not send 0 for tax values if tax values are not provided [bpollack] #2886
16
+ * Payflow: Update ACH tests [curiousepic] #2887
17
+ * Credorax: support passing billing description [bpollack] #2889
18
+ * MiGS: scrub 3DS fields [abarrak] #2771
19
+ * Forte: avoid crashing when location_id or account_id have spaces [bpollack] #2890
20
+ * Adyen: Support Network Tokenization Cards via mpiData fields [curiousepic] #2891
21
+ * Moneris US: Add ACH [nfarve] #2888
22
+ * Realex: Pass amount for captures [curiousepic] #2895
23
+ * Card Connect: support storing cards [bpollack] #2896
24
+ * Avoid mutating headers passed in for Active Merchant connections [grantbdev] #2892
25
+ * Forte: add support for refunds [bpollack] #2898
26
+ * Forte: fix a bug in logic for selecting billing names [whitby3001] #2381
27
+ * Paymentez: allow capture amount to exceed authorization amount [bpollack] #2900
28
+ * JetPay: fix typo in error messages [reynhout] #2749
29
+ * Braintree: add support for Maestro cards [matthewheath] #2571
30
+ * Visanet Peru: Refund on unsettled transactions [nfarve] #2772
31
+ * Remove iDeal offsite gateway references [bdewater] #2807
32
+ * Conekta: Allow customer application in headers [curiousepic] #2908
33
+ * Payment Express: use testing URLs when testing [oklas] #2231
34
+ * Redsys: Fix payments with cc token [Leonardo Diez] #2586
35
+ * Redsys: Missing cardnumber params in xml_signed_fields [nerburish] #2628
36
+ * Bogus: allow authorizing with a tokenized card [Azdaroth] #2703
37
+
5
38
  == Version 1.79.2 (June 2, 2018)
6
39
  * Fix Gateway#max_version= overwriting min_version [bdewater]
7
40
 
data/README.md CHANGED
@@ -31,11 +31,15 @@ You can check out the latest source from git:
31
31
 
32
32
  Installation from RubyGems:
33
33
 
34
- gem install activemerchant
34
+ ```console
35
+ gem install activemerchant
36
+ ```
35
37
 
36
38
  Or, if you're using Bundler, just add the following to your Gemfile:
37
39
 
38
- gem 'activemerchant'
40
+ ```ruby
41
+ gem 'activemerchant'
42
+ ```
39
43
 
40
44
  ## Usage
41
45
 
@@ -232,3 +236,7 @@ The [ActiveMerchant Wiki](http://github.com/activemerchant/active_merchant/wikis
232
236
  ## API stability policy
233
237
 
234
238
  Functionality or APIs that are deprecated will be marked as such. Deprecated functionality is removed on major version changes - for example, deprecations from 2.x are removed in 3.x.
239
+
240
+ ## Ruby and Rails compatibility policies
241
+
242
+ Because Active Merchant is a payment library, it needs to take security seriously. For this reason, Active Merchant guarantees compatibility only with actively supported versions of Ruby and Rails. At the time of this writing, that means that Ruby 2.3+ and Rails 4.2+ are supported.
@@ -51,7 +51,7 @@ require 'active_merchant/country'
51
51
 
52
52
  module ActiveMerchant
53
53
  def self.deprecated(message, caller=Kernel.caller[1])
54
- warning = caller + ": " + message
54
+ warning = caller + ': ' + message
55
55
  if(respond_to?(:logger) && logger.present?)
56
56
  logger.warn(warning)
57
57
  else
@@ -30,17 +30,17 @@ module ActiveMerchant #:nodoc:
30
30
  errors = []
31
31
 
32
32
  [:name, :routing_number, :account_number].each do |attr|
33
- errors << [attr, "cannot be empty"] if empty?(self.send(attr))
33
+ errors << [attr, 'cannot be empty'] if empty?(self.send(attr))
34
34
  end
35
35
 
36
- errors << [:routing_number, "is invalid"] unless valid_routing_number?
36
+ errors << [:routing_number, 'is invalid'] unless valid_routing_number?
37
37
 
38
38
  if(!empty?(account_holder_type) && !%w[business personal].include?(account_holder_type.to_s))
39
- errors << [:account_holder_type, "must be personal or business"]
39
+ errors << [:account_holder_type, 'must be personal or business']
40
40
  end
41
41
 
42
42
  if(!empty?(account_type) && !%w[checking savings].include?(account_type.to_s))
43
- errors << [:account_type, "must be checking or savings"]
43
+ errors << [:account_type, 'must be checking or savings']
44
44
  end
45
45
 
46
46
  errors_hash(errors)
@@ -27,7 +27,7 @@ module ActiveMerchant
27
27
 
28
28
  def self.humanize(lower_case_and_underscored_word)
29
29
  result = lower_case_and_underscored_word.to_s.dup
30
- result.gsub!(/_id$/, "")
30
+ result.gsub!(/_id$/, '')
31
31
  result.gsub!(/_/, ' ')
32
32
  result.gsub(/([a-z\d]*)/i) { |match|
33
33
  match.downcase
@@ -1,6 +1,6 @@
1
1
  require 'time'
2
2
  require 'date'
3
- require "active_merchant/billing/model"
3
+ require 'active_merchant/billing/model'
4
4
 
5
5
  module ActiveMerchant #:nodoc:
6
6
  module Billing #:nodoc:
@@ -65,7 +65,7 @@ module ActiveMerchant #:nodoc:
65
65
  attr_reader :number
66
66
 
67
67
  def number=(value)
68
- @number = (empty?(value) ? value : value.to_s.gsub(/[^\d]/, ""))
68
+ @number = (empty?(value) ? value : value.to_s.gsub(/[^\d]/, ''))
69
69
  end
70
70
 
71
71
  # Returns or sets the expiry month for the card.
@@ -202,12 +202,12 @@ module ActiveMerchant #:nodoc:
202
202
  attr_accessor :encrypted_pin_ksn
203
203
 
204
204
  def type
205
- ActiveMerchant.deprecated "CreditCard#type is deprecated and will be removed from a future release of ActiveMerchant. Please use CreditCard#brand instead."
205
+ ActiveMerchant.deprecated 'CreditCard#type is deprecated and will be removed from a future release of ActiveMerchant. Please use CreditCard#brand instead.'
206
206
  brand
207
207
  end
208
208
 
209
209
  def type=(value)
210
- ActiveMerchant.deprecated "CreditCard#type is deprecated and will be removed from a future release of ActiveMerchant. Please use CreditCard#brand instead."
210
+ ActiveMerchant.deprecated 'CreditCard#type is deprecated and will be removed from a future release of ActiveMerchant. Please use CreditCard#brand instead.'
211
211
  self.brand = value
212
212
  end
213
213
 
@@ -250,7 +250,7 @@ module ActiveMerchant #:nodoc:
250
250
  def name=(full_name)
251
251
  names = full_name.split
252
252
  self.last_name = names.pop
253
- self.first_name = names.join(" ")
253
+ self.first_name = names.join(' ')
254
254
  end
255
255
 
256
256
  %w(month year start_month start_year).each do |m|
@@ -326,20 +326,20 @@ module ActiveMerchant #:nodoc:
326
326
  errors = []
327
327
 
328
328
  if self.class.requires_name?
329
- errors << [:first_name, "cannot be empty"] if first_name.blank?
330
- errors << [:last_name, "cannot be empty"] if last_name.blank?
329
+ errors << [:first_name, 'cannot be empty'] if first_name.blank?
330
+ errors << [:last_name, 'cannot be empty'] if last_name.blank?
331
331
  end
332
332
 
333
333
  if(empty?(month) || empty?(year))
334
- errors << [:month, "is required"] if empty?(month)
335
- errors << [:year, "is required"] if empty?(year)
334
+ errors << [:month, 'is required'] if empty?(month)
335
+ errors << [:year, 'is required'] if empty?(year)
336
336
  else
337
- errors << [:month, "is not a valid month"] if !valid_month?(month)
337
+ errors << [:month, 'is not a valid month'] if !valid_month?(month)
338
338
 
339
339
  if expired?
340
- errors << [:year, "expired"]
340
+ errors << [:year, 'expired']
341
341
  else
342
- errors << [:year, "is not a valid year"] if !valid_expiry_year?(year)
342
+ errors << [:year, 'is not a valid year'] if !valid_expiry_year?(year)
343
343
  end
344
344
  end
345
345
 
@@ -350,17 +350,17 @@ module ActiveMerchant #:nodoc:
350
350
  errors = []
351
351
 
352
352
  if !empty?(brand)
353
- errors << [:brand, "is invalid"] if !CreditCard.card_companies.keys.include?(brand)
353
+ errors << [:brand, 'is invalid'] if !CreditCard.card_companies.keys.include?(brand)
354
354
  end
355
355
 
356
356
  if empty?(number)
357
- errors << [:number, "is required"]
357
+ errors << [:number, 'is required']
358
358
  elsif !CreditCard.valid_number?(number)
359
- errors << [:number, "is not a valid credit card number"]
359
+ errors << [:number, 'is not a valid credit card number']
360
360
  end
361
361
 
362
362
  if errors.empty?
363
- errors << [:brand, "does not match the card number"] if !CreditCard.matching_brand?(number, brand)
363
+ errors << [:brand, 'does not match the card number'] if !CreditCard.matching_brand?(number, brand)
364
364
  end
365
365
 
366
366
  errors
@@ -374,7 +374,7 @@ module ActiveMerchant #:nodoc:
374
374
  errors << [:verification_value, "should be #{card_verification_value_length(brand)} digits"]
375
375
  end
376
376
  elsif requires_verification_value?
377
- errors << [:verification_value, "is required"]
377
+ errors << [:verification_value, 'is required']
378
378
  end
379
379
  errors
380
380
  end
@@ -388,11 +388,11 @@ module ActiveMerchant #:nodoc:
388
388
 
389
389
  if((!valid_start_month || !valid_start_year) && !valid_issue_number?(issue_number))
390
390
  if empty?(issue_number)
391
- errors << [:issue_number, "cannot be empty"]
392
- errors << [:start_month, "is invalid"] if !valid_start_month
393
- errors << [:start_year, "is invalid"] if !valid_start_year
391
+ errors << [:issue_number, 'cannot be empty']
392
+ errors << [:start_month, 'is invalid'] if !valid_start_month
393
+ errors << [:start_year, 'is invalid'] if !valid_start_year
394
394
  else
395
- errors << [:issue_number, "is invalid"] if !valid_issue_number?(issue_number)
395
+ errors << [:issue_number, 'is invalid'] if !valid_issue_number?(issue_number)
396
396
  end
397
397
  end
398
398
  end
@@ -14,8 +14,8 @@ module ActiveMerchant #:nodoc:
14
14
  return '' if number.blank?
15
15
 
16
16
  case option
17
- when :two_digits ; sprintf("%.2i", number.to_i)[-2..-1]
18
- when :four_digits ; sprintf("%.4i", number.to_i)[-4..-1]
17
+ when :two_digits then sprintf('%.2i', number.to_i)[-2..-1]
18
+ when :four_digits then sprintf('%.4i', number.to_i)[-4..-1]
19
19
  else number
20
20
  end
21
21
  end
@@ -149,7 +149,7 @@ module ActiveMerchant #:nodoc:
149
149
  end
150
150
 
151
151
  def type?(number)
152
- ActiveMerchant.deprecated "CreditCard#type? is deprecated and will be removed from a future release of ActiveMerchant. Please use CreditCard#brand? instead."
152
+ ActiveMerchant.deprecated 'CreditCard#type? is deprecated and will be removed from a future release of ActiveMerchant. Please use CreditCard#brand? instead.'
153
153
  brand?(number)
154
154
  end
155
155
 
@@ -171,7 +171,7 @@ module ActiveMerchant #:nodoc:
171
171
  end
172
172
 
173
173
  def matching_type?(number, brand)
174
- ActiveMerchant.deprecated "CreditCard#matching_type? is deprecated and will be removed from a future release of ActiveMerchant. Please use CreditCard#matching_brand? instead."
174
+ ActiveMerchant.deprecated 'CreditCard#matching_type? is deprecated and will be removed from a future release of ActiveMerchant. Please use CreditCard#matching_brand? instead.'
175
175
  matching_brand?(number, brand)
176
176
  end
177
177
 
@@ -58,8 +58,8 @@ module ActiveMerchant #:nodoc:
58
58
 
59
59
  DEBIT_CARDS = [ :switch, :solo ]
60
60
 
61
- CREDIT_DEPRECATION_MESSAGE = "Support for using credit to refund existing transactions is deprecated and will be removed from a future release of ActiveMerchant. Please use the refund method instead."
62
- RECURRING_DEPRECATION_MESSAGE = "Recurring functionality in ActiveMerchant is deprecated and will be removed in a future version. Please contact the ActiveMerchant maintainers if you have an interest in taking ownership of a separate gem that continues support for it."
61
+ CREDIT_DEPRECATION_MESSAGE = 'Support for using credit to refund existing transactions is deprecated and will be removed from a future release of ActiveMerchant. Please use the refund method instead.'
62
+ RECURRING_DEPRECATION_MESSAGE = 'Recurring functionality in ActiveMerchant is deprecated and will be removed in a future version. Please contact the ActiveMerchant maintainers if you have an interest in taking ownership of a separate gem that continues support for it.'
63
63
 
64
64
  # == Standardized Error Codes
65
65
  #
@@ -195,7 +195,7 @@ module ActiveMerchant #:nodoc:
195
195
  end
196
196
 
197
197
  def scrub(transcript)
198
- raise RuntimeError.new("This gateway does not support scrubbing.")
198
+ raise RuntimeError.new('This gateway does not support scrubbing.')
199
199
  end
200
200
 
201
201
  def supports_network_tokenization?
@@ -206,10 +206,10 @@ module ActiveMerchant #:nodoc:
206
206
 
207
207
  def normalize(field)
208
208
  case field
209
- when "true" then true
210
- when "false" then false
211
- when "" then nil
212
- when "null" then nil
209
+ when 'true' then true
210
+ when 'false' then false
211
+ when '' then nil
212
+ when 'null' then nil
213
213
  else field
214
214
  end
215
215
  end
@@ -243,7 +243,7 @@ module ActiveMerchant #:nodoc:
243
243
  def amount(money)
244
244
  return nil if money.nil?
245
245
  cents = if money.respond_to?(:cents)
246
- ActiveMerchant.deprecated "Support for Money objects is deprecated and will be removed from a future release of ActiveMerchant. Please use an Integer value in cents"
246
+ ActiveMerchant.deprecated 'Support for Money objects is deprecated and will be removed from a future release of ActiveMerchant. Please use an Integer value in cents'
247
247
  money.cents
248
248
  else
249
249
  money
@@ -256,7 +256,7 @@ module ActiveMerchant #:nodoc:
256
256
  if self.money_format == :cents
257
257
  cents.to_s
258
258
  else
259
- sprintf("%.2f", cents.to_f / 100)
259
+ sprintf('%.2f', cents.to_f / 100)
260
260
  end
261
261
  end
262
262
 
@@ -274,7 +274,7 @@ module ActiveMerchant #:nodoc:
274
274
  return amount unless non_fractional_currency?(currency) || three_decimal_currency?(currency)
275
275
  if non_fractional_currency?(currency)
276
276
  if self.money_format == :cents
277
- sprintf("%.0f", amount.to_f / 100)
277
+ sprintf('%.0f', amount.to_f / 100)
278
278
  else
279
279
  amount.split('.').first
280
280
  end
@@ -282,7 +282,7 @@ module ActiveMerchant #:nodoc:
282
282
  if self.money_format == :cents
283
283
  amount.to_s
284
284
  else
285
- sprintf("%.3f", (amount.to_f / 10))
285
+ sprintf('%.3f', (amount.to_f / 10))
286
286
  end
287
287
  end
288
288
  end
@@ -297,11 +297,11 @@ module ActiveMerchant #:nodoc:
297
297
  end
298
298
 
299
299
  def split_names(full_name)
300
- names = (full_name || "").split
300
+ names = (full_name || '').split
301
301
  return [nil, nil] if names.size == 0
302
302
 
303
303
  last_name = names.pop
304
- first_name = names.join(" ")
304
+ first_name = names.join(' ')
305
305
  [first_name, last_name]
306
306
  end
307
307
 
@@ -44,7 +44,7 @@ module ActiveMerchant #:nodoc:
44
44
  post = init_post(options)
45
45
  add_invoice(post, money, options)
46
46
  add_payment(post, payment)
47
- add_extra_data(post, options)
47
+ add_extra_data(post, payment, options)
48
48
  add_shopper_interaction(post, payment, options)
49
49
  add_address(post, options)
50
50
  add_installments(post, options) if options[:installments]
@@ -76,7 +76,7 @@ module ActiveMerchant #:nodoc:
76
76
  post = init_post(options)
77
77
  add_invoice(post, 0, options)
78
78
  add_payment(post, credit_card)
79
- add_extra_data(post, options)
79
+ add_extra_data(post, credit_card, options)
80
80
  add_recurring_contract(post, options)
81
81
  add_address(post, options)
82
82
  commit('authorise', post)
@@ -97,26 +97,33 @@ module ActiveMerchant #:nodoc:
97
97
  transcript.
98
98
  gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
99
99
  gsub(%r(("number\\?":\\?")[^"]*)i, '\1[FILTERED]').
100
- gsub(%r(("cvc\\?":\\?")[^"]*)i, '\1[FILTERED]')
100
+ gsub(%r(("cvc\\?":\\?")[^"]*)i, '\1[FILTERED]').
101
+ gsub(%r(("cavv\\?":\\?")[^"]*)i, '\1[FILTERED]')
101
102
  end
102
103
 
103
104
  private
104
105
 
105
- def add_extra_data(post, options)
106
+ NETWORK_TOKENIZATION_CARD_SOURCE = {
107
+ 'apple_pay' => 'applepay',
108
+ 'android_pay' => 'androidpay',
109
+ 'google_pay' => 'paywithgoogle'
110
+ }
111
+
112
+ def add_extra_data(post, payment, options)
106
113
  post[:shopperEmail] = options[:shopper_email] if options[:shopper_email]
107
114
  post[:shopperIP] = options[:shopper_ip] if options[:shopper_ip]
108
115
  post[:shopperReference] = options[:shopper_reference] if options[:shopper_reference]
109
116
  post[:fraudOffset] = options[:fraud_offset] if options[:fraud_offset]
110
- post[:selectedBrand] = options[:selected_brand] if options[:selected_brand]
117
+ post[:selectedBrand] = options[:selected_brand] || NETWORK_TOKENIZATION_CARD_SOURCE[payment.source.to_s] if payment.is_a?(NetworkTokenizationCreditCard)
111
118
  post[:deliveryDate] = options[:delivery_date] if options[:delivery_date]
112
119
  post[:merchantOrderReference] = options[:merchant_order_reference] if options[:merchant_order_reference]
113
120
  end
114
121
 
115
122
  def add_shopper_interaction(post, payment, options={})
116
- if payment.respond_to?(:verification_value) && payment.verification_value
117
- shopper_interaction = "Ecommerce"
123
+ if (payment.respond_to?(:verification_value) && payment.verification_value) || payment.is_a?(NetworkTokenizationCreditCard)
124
+ shopper_interaction = 'Ecommerce'
118
125
  else
119
- shopper_interaction = "ContAuth"
126
+ shopper_interaction = 'ContAuth'
120
127
  end
121
128
 
122
129
  post[:shopperInteraction] = options[:shopper_interaction] || shopper_interaction
@@ -153,10 +160,11 @@ module ActiveMerchant #:nodoc:
153
160
 
154
161
  def add_payment(post, payment)
155
162
  if payment.is_a?(String)
156
- _, _, recurring_detail_reference = payment.split("#")
163
+ _, _, recurring_detail_reference = payment.split('#')
157
164
  post[:selectedRecurringDetailReference] = recurring_detail_reference
158
165
  add_recurring_contract(post, options)
159
166
  else
167
+ add_mpi_data_for_network_tokenization_card(post, payment) if payment.is_a?(NetworkTokenizationCreditCard)
160
168
  add_card(post, payment)
161
169
  end
162
170
  end
@@ -176,22 +184,30 @@ module ActiveMerchant #:nodoc:
176
184
  end
177
185
 
178
186
  def add_reference(post, authorization, options = {})
179
- _, psp_reference, _ = authorization.split("#")
187
+ _, psp_reference, _ = authorization.split('#')
180
188
  post[:originalReference] = single_reference(authorization) || psp_reference
181
189
  end
182
190
 
183
191
  def add_original_reference(post, authorization, options = {})
184
- original_psp_reference, _, _ = authorization.split("#")
192
+ original_psp_reference, _, _ = authorization.split('#')
185
193
  post[:originalReference] = single_reference(authorization) || original_psp_reference
186
194
  end
187
195
 
196
+ def add_mpi_data_for_network_tokenization_card(post, payment)
197
+ post[:mpiData] = {}
198
+ post[:mpiData][:authenticationResponse] = 'Y'
199
+ post[:mpiData][:cavv] = payment.payment_cryptogram
200
+ post[:mpiData][:directoryResponse] = 'Y'
201
+ post[:mpiData][:eci] = payment.eci || '07'
202
+ end
203
+
188
204
  def single_reference(authorization)
189
- authorization if !authorization.include?("#")
205
+ authorization if !authorization.include?('#')
190
206
  end
191
207
 
192
208
  def add_recurring_contract(post, options = {})
193
209
  recurring = {
194
- contract: "RECURRING"
210
+ contract: 'RECURRING'
195
211
  }
196
212
 
197
213
  post[:recurring] = recurring
@@ -245,8 +261,8 @@ module ActiveMerchant #:nodoc:
245
261
 
246
262
  def request_headers
247
263
  {
248
- "Content-Type" => "application/json",
249
- "Authorization" => "Basic #{basic_auth}"
264
+ 'Content-Type' => 'application/json',
265
+ 'Authorization' => "Basic #{basic_auth}"
250
266
  }
251
267
  end
252
268