activemerchant 1.114.0 → 1.120.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (206) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +183 -0
  3. data/README.md +4 -2
  4. data/lib/active_merchant.rb +1 -1
  5. data/lib/active_merchant/billing/avs_result.rb +1 -1
  6. data/lib/active_merchant/billing/check.rb +10 -0
  7. data/lib/active_merchant/billing/compatibility.rb +3 -3
  8. data/lib/active_merchant/billing/credit_card.rb +3 -0
  9. data/lib/active_merchant/billing/credit_card_methods.rb +80 -15
  10. data/lib/active_merchant/billing/gateways/adyen.rb +44 -20
  11. data/lib/active_merchant/billing/gateways/allied_wallet.rb +7 -7
  12. data/lib/active_merchant/billing/gateways/authorize_net.rb +50 -12
  13. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +3 -4
  14. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +5 -1
  15. data/lib/active_merchant/billing/gateways/axcessms.rb +8 -9
  16. data/lib/active_merchant/billing/gateways/balanced.rb +4 -3
  17. data/lib/active_merchant/billing/gateways/bambora_apac.rb +7 -7
  18. data/lib/active_merchant/billing/gateways/bank_frick.rb +7 -7
  19. data/lib/active_merchant/billing/gateways/banwire.rb +1 -1
  20. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +6 -4
  21. data/lib/active_merchant/billing/gateways/beanstream.rb +3 -3
  22. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +4 -5
  23. data/lib/active_merchant/billing/gateways/blue_pay.rb +2 -3
  24. data/lib/active_merchant/billing/gateways/blue_snap.rb +22 -18
  25. data/lib/active_merchant/billing/gateways/bogus.rb +19 -19
  26. data/lib/active_merchant/billing/gateways/borgun.rb +11 -11
  27. data/lib/active_merchant/billing/gateways/bpoint.rb +8 -8
  28. data/lib/active_merchant/billing/gateways/braintree.rb +1 -1
  29. data/lib/active_merchant/billing/gateways/braintree_blue.rb +60 -17
  30. data/lib/active_merchant/billing/gateways/bridge_pay.rb +7 -7
  31. data/lib/active_merchant/billing/gateways/cams.rb +8 -8
  32. data/lib/active_merchant/billing/gateways/card_connect.rb +1 -1
  33. data/lib/active_merchant/billing/gateways/card_save.rb +1 -1
  34. data/lib/active_merchant/billing/gateways/card_stream.rb +2 -2
  35. data/lib/active_merchant/billing/gateways/cardknox.rb +7 -7
  36. data/lib/active_merchant/billing/gateways/cardprocess.rb +1 -1
  37. data/lib/active_merchant/billing/gateways/cashnet.rb +7 -2
  38. data/lib/active_merchant/billing/gateways/cecabank.rb +5 -5
  39. data/lib/active_merchant/billing/gateways/cenpos.rb +10 -10
  40. data/lib/active_merchant/billing/gateways/checkout.rb +2 -2
  41. data/lib/active_merchant/billing/gateways/checkout_v2.rb +38 -20
  42. data/lib/active_merchant/billing/gateways/clearhaus.rb +7 -7
  43. data/lib/active_merchant/billing/gateways/commercegate.rb +1 -1
  44. data/lib/active_merchant/billing/gateways/conekta.rb +2 -2
  45. data/lib/active_merchant/billing/gateways/creditcall.rb +10 -10
  46. data/lib/active_merchant/billing/gateways/credorax.rb +39 -23
  47. data/lib/active_merchant/billing/gateways/ct_payment.rb +10 -10
  48. data/lib/active_merchant/billing/gateways/culqi.rb +9 -9
  49. data/lib/active_merchant/billing/gateways/cyber_source.rb +81 -39
  50. data/lib/active_merchant/billing/gateways/d_local.rb +12 -12
  51. data/lib/active_merchant/billing/gateways/data_cash.rb +2 -3
  52. data/lib/active_merchant/billing/gateways/decidir.rb +31 -10
  53. data/lib/active_merchant/billing/gateways/dibs.rb +8 -8
  54. data/lib/active_merchant/billing/gateways/digitzs.rb +5 -5
  55. data/lib/active_merchant/billing/gateways/ebanx.rb +9 -9
  56. data/lib/active_merchant/billing/gateways/efsnet.rb +2 -3
  57. data/lib/active_merchant/billing/gateways/elavon.rb +296 -225
  58. data/lib/active_merchant/billing/gateways/element.rb +8 -8
  59. data/lib/active_merchant/billing/gateways/evo_ca.rb +5 -6
  60. data/lib/active_merchant/billing/gateways/eway.rb +3 -4
  61. data/lib/active_merchant/billing/gateways/eway_managed.rb +6 -7
  62. data/lib/active_merchant/billing/gateways/eway_rapid.rb +19 -6
  63. data/lib/active_merchant/billing/gateways/exact.rb +8 -9
  64. data/lib/active_merchant/billing/gateways/ezic.rb +7 -7
  65. data/lib/active_merchant/billing/gateways/fat_zebra.rb +4 -4
  66. data/lib/active_merchant/billing/gateways/federated_canada.rb +2 -3
  67. data/lib/active_merchant/billing/gateways/first_giving.rb +1 -1
  68. data/lib/active_merchant/billing/gateways/first_pay.rb +6 -6
  69. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +7 -7
  70. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +21 -10
  71. data/lib/active_merchant/billing/gateways/flo2cash.rb +8 -8
  72. data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +1 -1
  73. data/lib/active_merchant/billing/gateways/forte.rb +26 -8
  74. data/lib/active_merchant/billing/gateways/global_collect.rb +35 -16
  75. data/lib/active_merchant/billing/gateways/global_transport.rb +7 -7
  76. data/lib/active_merchant/billing/gateways/hdfc.rb +9 -9
  77. data/lib/active_merchant/billing/gateways/hps.rb +72 -9
  78. data/lib/active_merchant/billing/gateways/iats_payments.rb +9 -4
  79. data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +1 -1
  80. data/lib/active_merchant/billing/gateways/inspire.rb +3 -4
  81. data/lib/active_merchant/billing/gateways/instapay.rb +1 -2
  82. data/lib/active_merchant/billing/gateways/ipp.rb +5 -5
  83. data/lib/active_merchant/billing/gateways/iridium.rb +14 -15
  84. data/lib/active_merchant/billing/gateways/iveri.rb +7 -7
  85. data/lib/active_merchant/billing/gateways/ixopay.rb +7 -7
  86. data/lib/active_merchant/billing/gateways/jetpay.rb +1 -2
  87. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +4 -5
  88. data/lib/active_merchant/billing/gateways/kushki.rb +6 -6
  89. data/lib/active_merchant/billing/gateways/latitude19.rb +14 -14
  90. data/lib/active_merchant/billing/gateways/linkpoint.rb +4 -5
  91. data/lib/active_merchant/billing/gateways/litle.rb +32 -16
  92. data/lib/active_merchant/billing/gateways/mastercard.rb +10 -10
  93. data/lib/active_merchant/billing/gateways/mercado_pago.rb +9 -9
  94. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +1 -2
  95. data/lib/active_merchant/billing/gateways/merchant_one.rb +1 -1
  96. data/lib/active_merchant/billing/gateways/merchant_partners.rb +10 -10
  97. data/lib/active_merchant/billing/gateways/merchant_ware.rb +5 -7
  98. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +4 -6
  99. data/lib/active_merchant/billing/gateways/mercury.rb +4 -4
  100. data/lib/active_merchant/billing/gateways/metrics_global.rb +4 -5
  101. data/lib/active_merchant/billing/gateways/micropayment.rb +8 -8
  102. data/lib/active_merchant/billing/gateways/migs.rb +3 -4
  103. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +2 -4
  104. data/lib/active_merchant/billing/gateways/monei.rb +7 -7
  105. data/lib/active_merchant/billing/gateways/moneris.rb +4 -3
  106. data/lib/active_merchant/billing/gateways/money_movers.rb +2 -3
  107. data/lib/active_merchant/billing/gateways/mundipagg.rb +37 -10
  108. data/lib/active_merchant/billing/gateways/nab_transact.rb +2 -4
  109. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +7 -7
  110. data/lib/active_merchant/billing/gateways/net_registry.rb +1 -2
  111. data/lib/active_merchant/billing/gateways/netaxept.rb +6 -6
  112. data/lib/active_merchant/billing/gateways/netbanx.rb +45 -10
  113. data/lib/active_merchant/billing/gateways/netbilling.rb +4 -5
  114. data/lib/active_merchant/billing/gateways/network_merchants.rb +2 -3
  115. data/lib/active_merchant/billing/gateways/nmi.rb +21 -7
  116. data/lib/active_merchant/billing/gateways/ogone.rb +3 -3
  117. data/lib/active_merchant/billing/gateways/omise.rb +13 -13
  118. data/lib/active_merchant/billing/gateways/openpay.rb +3 -4
  119. data/lib/active_merchant/billing/gateways/opp.rb +9 -9
  120. data/lib/active_merchant/billing/gateways/optimal_payment.rb +2 -3
  121. data/lib/active_merchant/billing/gateways/orbital.rb +225 -105
  122. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +3 -4
  123. data/lib/active_merchant/billing/gateways/pagarme.rb +8 -8
  124. data/lib/active_merchant/billing/gateways/pago_facil.rb +2 -2
  125. data/lib/active_merchant/billing/gateways/pay_conex.rb +8 -8
  126. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +6 -7
  127. data/lib/active_merchant/billing/gateways/pay_hub.rb +7 -8
  128. data/lib/active_merchant/billing/gateways/pay_junction.rb +2 -3
  129. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +9 -9
  130. data/lib/active_merchant/billing/gateways/pay_secure.rb +2 -3
  131. data/lib/active_merchant/billing/gateways/paybox_direct.rb +23 -1
  132. data/lib/active_merchant/billing/gateways/payeezy.rb +62 -20
  133. data/lib/active_merchant/billing/gateways/payex.rb +6 -7
  134. data/lib/active_merchant/billing/gateways/payflow.rb +1 -1
  135. data/lib/active_merchant/billing/gateways/payment_express.rb +11 -7
  136. data/lib/active_merchant/billing/gateways/paymentez.rb +26 -6
  137. data/lib/active_merchant/billing/gateways/paymill.rb +7 -7
  138. data/lib/active_merchant/billing/gateways/paypal.rb +10 -2
  139. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +1 -0
  140. data/lib/active_merchant/billing/gateways/paypal_express.rb +1 -1
  141. data/lib/active_merchant/billing/gateways/paypal_express_common.rb +1 -1
  142. data/lib/active_merchant/billing/gateways/payscout.rb +1 -2
  143. data/lib/active_merchant/billing/gateways/paystation.rb +3 -4
  144. data/lib/active_merchant/billing/gateways/payu_in.rb +3 -3
  145. data/lib/active_merchant/billing/gateways/payu_latam.rb +17 -10
  146. data/lib/active_merchant/billing/gateways/payway.rb +8 -9
  147. data/lib/active_merchant/billing/gateways/payway_dot_com.rb +253 -0
  148. data/lib/active_merchant/billing/gateways/pin.rb +11 -0
  149. data/lib/active_merchant/billing/gateways/plugnpay.rb +1 -2
  150. data/lib/active_merchant/billing/gateways/pro_pay.rb +8 -8
  151. data/lib/active_merchant/billing/gateways/psigate.rb +2 -3
  152. data/lib/active_merchant/billing/gateways/psl_card.rb +1 -2
  153. data/lib/active_merchant/billing/gateways/qbms.rb +1 -2
  154. data/lib/active_merchant/billing/gateways/quantum.rb +1 -2
  155. data/lib/active_merchant/billing/gateways/quickbooks.rb +1 -1
  156. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +3 -4
  157. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +1 -2
  158. data/lib/active_merchant/billing/gateways/qvalent.rb +31 -17
  159. data/lib/active_merchant/billing/gateways/realex.rb +1 -1
  160. data/lib/active_merchant/billing/gateways/redsys.rb +105 -9
  161. data/lib/active_merchant/billing/gateways/s5.rb +7 -7
  162. data/lib/active_merchant/billing/gateways/safe_charge.rb +51 -18
  163. data/lib/active_merchant/billing/gateways/sage.rb +3 -5
  164. data/lib/active_merchant/billing/gateways/sage_pay.rb +2 -3
  165. data/lib/active_merchant/billing/gateways/sallie_mae.rb +1 -2
  166. data/lib/active_merchant/billing/gateways/secure_net.rb +1 -2
  167. data/lib/active_merchant/billing/gateways/secure_pay.rb +3 -4
  168. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +2 -4
  169. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +1 -2
  170. data/lib/active_merchant/billing/gateways/securion_pay.rb +5 -6
  171. data/lib/active_merchant/billing/gateways/skip_jack.rb +2 -3
  172. data/lib/active_merchant/billing/gateways/smart_ps.rb +5 -6
  173. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +7 -7
  174. data/lib/active_merchant/billing/gateways/spreedly_core.rb +6 -6
  175. data/lib/active_merchant/billing/gateways/stripe.rb +18 -18
  176. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +91 -25
  177. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +3 -4
  178. data/lib/active_merchant/billing/gateways/telr.rb +8 -8
  179. data/lib/active_merchant/billing/gateways/trans_first.rb +2 -2
  180. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +12 -12
  181. data/lib/active_merchant/billing/gateways/transact_pro.rb +9 -9
  182. data/lib/active_merchant/billing/gateways/trust_commerce.rb +1 -2
  183. data/lib/active_merchant/billing/gateways/usa_epay.rb +1 -1
  184. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +32 -32
  185. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +3 -4
  186. data/lib/active_merchant/billing/gateways/vanco.rb +3 -3
  187. data/lib/active_merchant/billing/gateways/verifi.rb +1 -2
  188. data/lib/active_merchant/billing/gateways/viaklix.rb +1 -2
  189. data/lib/active_merchant/billing/gateways/visanet_peru.rb +10 -10
  190. data/lib/active_merchant/billing/gateways/vpos.rb +172 -0
  191. data/lib/active_merchant/billing/gateways/webpay.rb +2 -2
  192. data/lib/active_merchant/billing/gateways/wepay.rb +3 -2
  193. data/lib/active_merchant/billing/gateways/wirecard.rb +1 -2
  194. data/lib/active_merchant/billing/gateways/worldpay.rb +43 -22
  195. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +14 -16
  196. data/lib/active_merchant/billing/gateways/worldpay_us.rb +7 -7
  197. data/lib/active_merchant/billing/response.rb +3 -2
  198. data/lib/active_merchant/country.rb +1 -1
  199. data/lib/active_merchant/network_connection_retries.rb +2 -2
  200. data/lib/active_merchant/post_data.rb +1 -1
  201. data/lib/active_merchant/posts_data.rb +1 -1
  202. data/lib/active_merchant/version.rb +1 -1
  203. data/lib/certs/cacert.pem +1582 -2431
  204. data/lib/support/ssl_verify.rb +2 -2
  205. data/lib/support/ssl_version.rb +2 -2
  206. metadata +5 -3
@@ -14,12 +14,12 @@ module ActiveMerchant #:nodoc:
14
14
  self.money_format = :dollars
15
15
  self.supported_cardtypes = %i[visa master discover diners_club]
16
16
 
17
- def initialize(options={})
17
+ def initialize(options = {})
18
18
  requires!(options, :login, :password)
19
19
  super
20
20
  end
21
21
 
22
- def purchase(amount, payment_method, options={})
22
+ def purchase(amount, payment_method, options = {})
23
23
  post = {}
24
24
  add_invoice(post, amount, options)
25
25
  add_payment_method(post, payment_method)
@@ -28,7 +28,7 @@ module ActiveMerchant #:nodoc:
28
28
  commit('purchase', post)
29
29
  end
30
30
 
31
- def authorize(amount, payment_method, options={})
31
+ def authorize(amount, payment_method, options = {})
32
32
  post = {}
33
33
  add_invoice(post, amount, options)
34
34
  add_payment_method(post, payment_method)
@@ -37,7 +37,7 @@ module ActiveMerchant #:nodoc:
37
37
  commit('authorize', post)
38
38
  end
39
39
 
40
- def capture(amount, authorization, options={})
40
+ def capture(amount, authorization, options = {})
41
41
  post = {}
42
42
  add_invoice(post, amount, options)
43
43
  add_reference(post, authorization)
@@ -46,7 +46,7 @@ module ActiveMerchant #:nodoc:
46
46
  commit('capture', post)
47
47
  end
48
48
 
49
- def refund(amount, authorization, options={})
49
+ def refund(amount, authorization, options = {})
50
50
  post = {}
51
51
  add_invoice(post, amount, options)
52
52
  add_reference(post, authorization)
@@ -57,7 +57,7 @@ module ActiveMerchant #:nodoc:
57
57
 
58
58
  private
59
59
 
60
- CURRENCY_CODES = Hash.new { |h, k| raise ArgumentError.new("Unsupported currency for HDFC: #{k}") }
60
+ CURRENCY_CODES = Hash.new { |_h, k| raise ArgumentError.new("Unsupported currency for HDFC: #{k}") }
61
61
  CURRENCY_CODES['AED'] = '784'
62
62
  CURRENCY_CODES['AUD'] = '036'
63
63
  CURRENCY_CODES['CAD'] = '124'
@@ -81,14 +81,14 @@ module ActiveMerchant #:nodoc:
81
81
  post[:udf2] = escape(options[:email]) if options[:email]
82
82
  if address = (options[:billing_address] || options[:address])
83
83
  post[:udf3] = escape(address[:phone]) if address[:phone]
84
- post[:udf4] = escape(<<~EOA)
84
+ post[:udf4] = escape(<<~ADDRESS)
85
85
  #{address[:name]}
86
86
  #{address[:company]}
87
87
  #{address[:address1]}
88
88
  #{address[:address2]}
89
89
  #{address[:city]} #{address[:state]} #{address[:zip]}
90
90
  #{address[:country]}
91
- EOA
91
+ ADDRESS
92
92
  end
93
93
  end
94
94
 
@@ -194,7 +194,7 @@ module ActiveMerchant #:nodoc:
194
194
  [tranid, member]
195
195
  end
196
196
 
197
- def escape(string, max_length=250)
197
+ def escape(string, max_length = 250)
198
198
  return '' unless string
199
199
 
200
200
  string = string[0...max_length] if max_length
@@ -25,12 +25,12 @@ module ActiveMerchant #:nodoc:
25
25
  google_pay: 'GooglePayApp'
26
26
  }
27
27
 
28
- def initialize(options={})
28
+ def initialize(options = {})
29
29
  requires!(options, :secret_api_key)
30
30
  super
31
31
  end
32
32
 
33
- def authorize(money, card_or_token, options={})
33
+ def authorize(money, card_or_token, options = {})
34
34
  commit('CreditAuth') do |xml|
35
35
  add_amount(xml, money)
36
36
  add_allow_dup(xml)
@@ -39,25 +39,28 @@ module ActiveMerchant #:nodoc:
39
39
  add_descriptor_name(xml, options)
40
40
  add_card_or_token_payment(xml, card_or_token, options)
41
41
  add_three_d_secure(xml, card_or_token, options)
42
+ add_stored_credentials(xml, options)
42
43
  end
43
44
  end
44
45
 
45
- def capture(money, transaction_id, options={})
46
+ def capture(money, transaction_id, options = {})
46
47
  commit('CreditAddToBatch', transaction_id) do |xml|
47
48
  add_amount(xml, money)
48
49
  add_reference(xml, transaction_id)
49
50
  end
50
51
  end
51
52
 
52
- def purchase(money, payment_method, options={})
53
+ def purchase(money, payment_method, options = {})
53
54
  if payment_method.is_a?(Check)
54
55
  commit_check_sale(money, payment_method, options)
56
+ elsif options.dig(:stored_credential, :reason_type) == 'recurring'
57
+ commit_recurring_billing_sale(money, payment_method, options)
55
58
  else
56
59
  commit_credit_sale(money, payment_method, options)
57
60
  end
58
61
  end
59
62
 
60
- def refund(money, transaction_id, options={})
63
+ def refund(money, transaction_id, options = {})
61
64
  commit('CreditReturn') do |xml|
62
65
  add_amount(xml, money)
63
66
  add_allow_dup(xml)
@@ -67,7 +70,16 @@ module ActiveMerchant #:nodoc:
67
70
  end
68
71
  end
69
72
 
70
- def verify(card_or_token, options={})
73
+ def credit(money, payment_method, options = {})
74
+ commit('CreditReturn') do |xml|
75
+ add_amount(xml, money)
76
+ add_allow_dup(xml)
77
+ add_card_or_token_payment(xml, payment_method, options)
78
+ add_details(xml, options)
79
+ end
80
+ end
81
+
82
+ def verify(card_or_token, options = {})
71
83
  commit('CreditAccountVerify') do |xml|
72
84
  add_card_or_token_customer_data(xml, card_or_token, options)
73
85
  add_descriptor_name(xml, options)
@@ -75,7 +87,7 @@ module ActiveMerchant #:nodoc:
75
87
  end
76
88
  end
77
89
 
78
- def void(transaction_id, options={})
90
+ def void(transaction_id, options = {})
79
91
  if options[:check_void]
80
92
  commit('CheckVoid') do |xml|
81
93
  add_reference(xml, transaction_id)
@@ -122,6 +134,21 @@ module ActiveMerchant #:nodoc:
122
134
  add_descriptor_name(xml, options)
123
135
  add_card_or_token_payment(xml, card_or_token, options)
124
136
  add_three_d_secure(xml, card_or_token, options)
137
+ add_stored_credentials(xml, options)
138
+ end
139
+ end
140
+
141
+ def commit_recurring_billing_sale(money, card_or_token, options)
142
+ commit('RecurringBilling') do |xml|
143
+ add_amount(xml, money)
144
+ add_allow_dup(xml)
145
+ add_card_or_token_customer_data(xml, card_or_token, options)
146
+ add_details(xml, options)
147
+ add_descriptor_name(xml, options)
148
+ add_card_or_token_payment(xml, card_or_token, options)
149
+ add_three_d_secure(xml, card_or_token, options)
150
+ add_stored_credentials(xml, options)
151
+ add_stored_credentials_for_recurring_billing(xml, options)
125
152
  end
126
153
  end
127
154
 
@@ -148,7 +175,7 @@ module ActiveMerchant #:nodoc:
148
175
  xml.hps :CardHolderAddr, billing_address[:address1] if billing_address[:address1]
149
176
  xml.hps :CardHolderCity, billing_address[:city] if billing_address[:city]
150
177
  xml.hps :CardHolderState, billing_address[:state] if billing_address[:state]
151
- xml.hps :CardHolderZip, billing_address[:zip] if billing_address[:zip]
178
+ xml.hps :CardHolderZip, alphanumeric_zip(billing_address[:zip]) if billing_address[:zip]
152
179
  end
153
180
  end
154
181
  end
@@ -210,7 +237,7 @@ module ActiveMerchant #:nodoc:
210
237
  def add_details(xml, options)
211
238
  xml.hps :AdditionalTxnFields do
212
239
  xml.hps :Description, options[:description] if options[:description]
213
- xml.hps :InvoiceNbr, options[:order_id] if options[:order_id]
240
+ xml.hps :InvoiceNbr, options[:order_id][0..59] if options[:order_id]
214
241
  xml.hps :CustomerID, options[:customer_id] if options[:customer_id]
215
242
  end
216
243
  end
@@ -256,6 +283,38 @@ module ActiveMerchant #:nodoc:
256
283
  end
257
284
  end
258
285
 
286
+ # We do not currently support installments on this gateway.
287
+ # The HPS gateway treats recurring transactions as a seperate transaction type
288
+ def add_stored_credentials(xml, options)
289
+ return unless options[:stored_credential]
290
+
291
+ xml.hps :CardOnFileData do
292
+ if options[:stored_credential][:initiator] == 'customer'
293
+ xml.hps :CardOnFile, 'C'
294
+ elsif options[:stored_credential][:initiator] == 'merchant'
295
+ xml.hps :CardOnFile, 'M'
296
+ else
297
+ return
298
+ end
299
+
300
+ if options[:stored_credential][:network_transaction_id]
301
+ xml.hps :CardBrandTxnId, options[:stored_credential][:network_transaction_id]
302
+ else
303
+ return
304
+ end
305
+ end
306
+ end
307
+
308
+ def add_stored_credentials_for_recurring_billing(xml, options)
309
+ xml.hps :RecurringData do
310
+ if options[:stored_credential][:reason_type] = 'recurring'
311
+ xml.hps :OneTime, 'N'
312
+ else
313
+ xml.hps :OneTime, 'Y'
314
+ end
315
+ end
316
+ end
317
+
259
318
  def strip_leading_zero(value)
260
319
  return value unless value[0] == '0'
261
320
 
@@ -380,6 +439,10 @@ module ActiveMerchant #:nodoc:
380
439
  @options[:secret_api_key]&.include?('_cert_')
381
440
  end
382
441
 
442
+ def alphanumeric_zip(zip)
443
+ zip.gsub(/[^0-9a-z]/i, '')
444
+ end
445
+
383
446
  ISSUER_MESSAGES = {
384
447
  '13' => 'Must be greater than or equal 0.',
385
448
  '14' => 'The card number is incorrect.',
@@ -23,7 +23,7 @@ module ActiveMerchant #:nodoc:
23
23
  unstore: 'DeleteCustomerCode'
24
24
  }
25
25
 
26
- def initialize(options={})
26
+ def initialize(options = {})
27
27
  if options[:login]
28
28
  ActiveMerchant.deprecated("The 'login' option is deprecated in favor of 'agent_code' and will be removed in a future version.")
29
29
  options[:agent_code] = options[:login]
@@ -35,18 +35,19 @@ module ActiveMerchant #:nodoc:
35
35
  super
36
36
  end
37
37
 
38
- def purchase(money, payment, options={})
38
+ def purchase(money, payment, options = {})
39
39
  post = {}
40
40
  add_invoice(post, money, options)
41
41
  add_payment(post, payment)
42
42
  add_address(post, options)
43
43
  add_ip(post, options)
44
44
  add_description(post, options)
45
+ add_customer_details(post, options)
45
46
 
46
47
  commit(determine_purchase_type(payment), post)
47
48
  end
48
49
 
49
- def refund(money, authorization, options={})
50
+ def refund(money, authorization, options = {})
50
51
  post = {}
51
52
  transaction_id, payment_type = split_authorization(authorization)
52
53
  post[:transaction_id] = transaction_id
@@ -160,6 +161,10 @@ module ActiveMerchant #:nodoc:
160
161
  post[:amount] = 0
161
162
  end
162
163
 
164
+ def add_customer_details(post, options)
165
+ post[:email] = options[:email] if options[:email]
166
+ end
167
+
163
168
  def expdate(creditcard)
164
169
  year = sprintf('%.4i', creditcard.year)
165
170
  month = sprintf('%.2i', creditcard.month)
@@ -181,7 +186,7 @@ module ActiveMerchant #:nodoc:
181
186
 
182
187
  def commit(action, parameters)
183
188
  response = parse(ssl_post(url(action), post_data(action, parameters),
184
- { 'Content-Type' => 'application/soap+xml; charset=utf-8'}))
189
+ { 'Content-Type' => 'application/soap+xml; charset=utf-8' }))
185
190
 
186
191
  Response.new(
187
192
  success_from(response),
@@ -5,7 +5,7 @@ module ActiveMerchant #:nodoc:
5
5
  self.live_redirect_url = 'https://www.paypal.com/checkoutnow'
6
6
 
7
7
  def redirect_url_for(token, options = {})
8
- options = {review: true}.update(options)
8
+ options = { review: true }.update(options)
9
9
  url = "#{redirect_url}?token=#{token}"
10
10
  url += '&useraction=commit' unless options[:review]
11
11
  url
@@ -96,7 +96,7 @@ module ActiveMerchant #:nodoc:
96
96
  authorize(100, creditcard, options.merge(store: billing_id))
97
97
  end
98
98
 
99
- alias_method :unstore, :delete
99
+ alias unstore delete
100
100
 
101
101
  private
102
102
 
@@ -124,7 +124,7 @@ module ActiveMerchant #:nodoc:
124
124
  post[:orderdescription] = options[:description]
125
125
  end
126
126
 
127
- def add_payment_source(params, source, options={})
127
+ def add_payment_source(params, source, options = {})
128
128
  case determine_funding_source(source)
129
129
  when :vault then add_customer_vault_id(params, source)
130
130
  when :credit_card then add_creditcard(params, source, options)
@@ -176,8 +176,7 @@ module ActiveMerchant #:nodoc:
176
176
  authorization: response['transactionid'],
177
177
  test: test?,
178
178
  cvv_result: response['cvvresponse'],
179
- avs_result: { code: response['avsresponse'] }
180
- )
179
+ avs_result: { code: response['avsresponse'] })
181
180
  end
182
181
 
183
182
  def message_from(response)
@@ -143,8 +143,7 @@ module ActiveMerchant #:nodoc:
143
143
  Response.new(response[:success], response[:message], response,
144
144
  authorization: response[:transaction_id],
145
145
  avs_result: { code: response[:avs_result] },
146
- cvv_result: response[:cvv_result]
147
- )
146
+ cvv_result: response[:cvv_result])
148
147
  end
149
148
 
150
149
  def post_data(action, parameters = {})
@@ -21,13 +21,13 @@ module ActiveMerchant #:nodoc:
21
21
  '54' => STANDARD_ERROR_CODE[:expired_card]
22
22
  }
23
23
 
24
- def initialize(options={})
24
+ def initialize(options = {})
25
25
  ActiveMerchant.deprecated('IPP gateway is now named Bambora Asia-Pacific')
26
26
  requires!(options, :username, :password)
27
27
  super
28
28
  end
29
29
 
30
- def purchase(money, payment, options={})
30
+ def purchase(money, payment, options = {})
31
31
  commit('SubmitSinglePayment') do |xml|
32
32
  xml.Transaction do
33
33
  xml.CustRef options[:order_id]
@@ -40,7 +40,7 @@ module ActiveMerchant #:nodoc:
40
40
  end
41
41
  end
42
42
 
43
- def authorize(money, payment, options={})
43
+ def authorize(money, payment, options = {})
44
44
  commit('SubmitSinglePayment') do |xml|
45
45
  xml.Transaction do
46
46
  xml.CustRef options[:order_id]
@@ -53,7 +53,7 @@ module ActiveMerchant #:nodoc:
53
53
  end
54
54
  end
55
55
 
56
- def capture(money, authorization, options={})
56
+ def capture(money, authorization, options = {})
57
57
  commit('SubmitSingleCapture') do |xml|
58
58
  xml.Capture do
59
59
  xml.Receipt authorization
@@ -63,7 +63,7 @@ module ActiveMerchant #:nodoc:
63
63
  end
64
64
  end
65
65
 
66
- def refund(money, authorization, options={})
66
+ def refund(money, authorization, options = {})
67
67
  commit('SubmitSingleRefund') do |xml|
68
68
  xml.Refund do
69
69
  xml.Receipt authorization
@@ -251,16 +251,16 @@ module ActiveMerchant #:nodoc:
251
251
  commit(build_reference_request('COLLECTION', money, authorization, options), options)
252
252
  end
253
253
 
254
- def credit(money, authorization, options={})
254
+ def credit(money, authorization, options = {})
255
255
  ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE
256
256
  refund(money, authorization, options)
257
257
  end
258
258
 
259
- def refund(money, authorization, options={})
259
+ def refund(money, authorization, options = {})
260
260
  commit(build_reference_request('REFUND', money, authorization, options), options)
261
261
  end
262
262
 
263
- def void(authorization, options={})
263
+ def void(authorization, options = {})
264
264
  commit(build_reference_request('VOID', nil, authorization, options), options)
265
265
  end
266
266
 
@@ -292,12 +292,12 @@ module ActiveMerchant #:nodoc:
292
292
  build_request(options) do |xml|
293
293
  if money
294
294
  currency = options[:currency] || currency(money)
295
- details = {'CurrencyCode' => currency_code(currency), 'Amount' => localized_amount(money, currency)}
295
+ details = { 'CurrencyCode' => currency_code(currency), 'Amount' => localized_amount(money, currency) }
296
296
  else
297
- details = {'CurrencyCode' => currency_code(default_currency), 'Amount' => '0'}
297
+ details = { 'CurrencyCode' => currency_code(default_currency), 'Amount' => '0' }
298
298
  end
299
299
  xml.tag! 'TransactionDetails', details do
300
- xml.tag! 'MessageDetails', {'TransactionType' => type, 'CrossReference' => cross_reference}
300
+ xml.tag! 'MessageDetails', { 'TransactionType' => type, 'CrossReference' => cross_reference }
301
301
  xml.tag! 'OrderID', (options[:order_id] || order_id)
302
302
  end
303
303
  end
@@ -309,9 +309,9 @@ module ActiveMerchant #:nodoc:
309
309
  xml.instruct!(:xml, version: '1.0', encoding: 'utf-8')
310
310
  xml.tag! 'soap:Envelope', { 'xmlns:soap' => 'http://schemas.xmlsoap.org/soap/envelope/',
311
311
  'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
312
- 'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema'} do
312
+ 'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema' } do
313
313
  xml.tag! 'soap:Body' do
314
- xml.tag! options[:action], {'xmlns' => 'https://www.thepaymentgateway.net/'} do
314
+ xml.tag! options[:action], { 'xmlns' => 'https://www.thepaymentgateway.net/' } do
315
315
  xml.tag! 'PaymentMessage' do
316
316
  add_merchant_data(xml, options)
317
317
  yield(xml)
@@ -330,8 +330,8 @@ module ActiveMerchant #:nodoc:
330
330
  def add_purchase_data(xml, type, money, options)
331
331
  currency = options[:currency] || currency(money)
332
332
  requires!(options, :order_id)
333
- xml.tag! 'TransactionDetails', {'Amount' => localized_amount(money, currency), 'CurrencyCode' => currency_code(currency)} do
334
- xml.tag! 'MessageDetails', {'TransactionType' => type}
333
+ xml.tag! 'TransactionDetails', { 'Amount' => localized_amount(money, currency), 'CurrencyCode' => currency_code(currency) } do
334
+ xml.tag! 'MessageDetails', { 'TransactionType' => type }
335
335
  xml.tag! 'OrderID', options[:order_id]
336
336
  xml.tag! 'TransactionControl' do
337
337
  xml.tag! 'ThreeDSecureOverridePolicy', 'FALSE'
@@ -371,13 +371,13 @@ module ActiveMerchant #:nodoc:
371
371
  end
372
372
 
373
373
  def add_merchant_data(xml, options)
374
- xml.tag! 'MerchantAuthentication', {'MerchantID' => @options[:login], 'Password' => @options[:password]}
374
+ xml.tag! 'MerchantAuthentication', { 'MerchantID' => @options[:login], 'Password' => @options[:password] }
375
375
  end
376
376
 
377
377
  def commit(request, options)
378
378
  requires!(options, :action)
379
379
  response = parse(ssl_post(test? ? self.test_url : self.live_url, request,
380
- {'SOAPAction' => 'https://www.thepaymentgateway.net/' + options[:action],
380
+ { 'SOAPAction' => 'https://www.thepaymentgateway.net/' + options[:action],
381
381
  'Content-Type' => 'text/xml; charset=utf-8' }))
382
382
 
383
383
  success = response[:transaction_result][:status_code] == '0'
@@ -391,14 +391,13 @@ module ActiveMerchant #:nodoc:
391
391
  street_match: AVS_CODE[ response[:transaction_output_data][:address_numeric_check_result] ],
392
392
  postal_match: AVS_CODE[ response[:transaction_output_data][:post_code_check_result] ]
393
393
  },
394
- cvv_result: CVV_CODE[ response[:transaction_output_data][:cv2_check_result] ]
395
- )
394
+ cvv_result: CVV_CODE[ response[:transaction_output_data][:cv2_check_result] ])
396
395
  end
397
396
 
398
397
  def parse(xml)
399
398
  reply = {}
400
399
  xml = REXML::Document.new(xml)
401
- if (root = REXML::XPath.first(xml, '//CardDetailsTransactionResponse')) or
400
+ if (root = REXML::XPath.first(xml, '//CardDetailsTransactionResponse')) ||
402
401
  (root = REXML::XPath.first(xml, '//CrossReferenceTransactionResponse'))
403
402
  root.elements.to_a.each do |node|
404
403
  case node.name