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
@@ -102,7 +102,7 @@ module ActiveMerchant #:nodoc:
102
102
  response,
103
103
  authorization: response['transID'],
104
104
  test: test?,
105
- avs_result: {code: response['avsCode']},
105
+ avs_result: { code: response['avsCode'] },
106
106
  cvv_result: response['cvvCode']
107
107
  )
108
108
  end
@@ -180,7 +180,7 @@ module ActiveMerchant #:nodoc:
180
180
  'Accept-Language' => 'es',
181
181
  'Authorization' => 'Basic ' + Base64.encode64("#{@options[:key]}:"),
182
182
  'RaiseHtmlError' => 'false',
183
- 'Conekta-Client-User-Agent' => {'agent' => "Conekta ActiveMerchantBindings/#{ActiveMerchant::VERSION}"}.to_json,
183
+ 'Conekta-Client-User-Agent' => { 'agent' => "Conekta ActiveMerchantBindings/#{ActiveMerchant::VERSION}" }.to_json,
184
184
  'X-Conekta-Client-User-Agent' => conekta_client_user_agent(options),
185
185
  'X-Conekta-Client-User-Metadata' => options[:meta].to_json
186
186
  }
@@ -189,7 +189,7 @@ module ActiveMerchant #:nodoc:
189
189
  def conekta_client_user_agent(options)
190
190
  return user_agent unless options[:application]
191
191
 
192
- JSON.dump(JSON.parse(user_agent).merge!({application: options[:application]}))
192
+ JSON.dump(JSON.parse(user_agent).merge!({ application: options[:application] }))
193
193
  end
194
194
 
195
195
  def commit(method, url, parameters, options = {})
@@ -41,12 +41,12 @@ module ActiveMerchant #:nodoc:
41
41
  'partialmatched;partialmatch' => 'C'
42
42
  }
43
43
 
44
- def initialize(options={})
44
+ def initialize(options = {})
45
45
  requires!(options, :terminal_id, :transaction_key)
46
46
  super
47
47
  end
48
48
 
49
- def purchase(money, payment_method, options={})
49
+ def purchase(money, payment_method, options = {})
50
50
  multi_response = MultiResponse.run do |r|
51
51
  r.process { authorize(money, payment_method, options) }
52
52
  r.process { capture(money, r.authorization, options) }
@@ -66,7 +66,7 @@ module ActiveMerchant #:nodoc:
66
66
  )
67
67
  end
68
68
 
69
- def authorize(money, payment_method, options={})
69
+ def authorize(money, payment_method, options = {})
70
70
  request = build_xml_request do |xml|
71
71
  add_transaction_details(xml, money, nil, 'Auth', options)
72
72
  add_terminal_details(xml, options)
@@ -76,7 +76,7 @@ module ActiveMerchant #:nodoc:
76
76
  commit(request)
77
77
  end
78
78
 
79
- def capture(money, authorization, options={})
79
+ def capture(money, authorization, options = {})
80
80
  request = build_xml_request do |xml|
81
81
  add_transaction_details(xml, money, authorization, 'Conf', options)
82
82
  add_terminal_details(xml, options)
@@ -85,7 +85,7 @@ module ActiveMerchant #:nodoc:
85
85
  commit(request)
86
86
  end
87
87
 
88
- def refund(money, authorization, options={})
88
+ def refund(money, authorization, options = {})
89
89
  request = build_xml_request do |xml|
90
90
  add_transaction_details(xml, money, authorization, 'Refund', options)
91
91
  add_terminal_details(xml, options)
@@ -94,7 +94,7 @@ module ActiveMerchant #:nodoc:
94
94
  commit(request)
95
95
  end
96
96
 
97
- def void(authorization, options={})
97
+ def void(authorization, options = {})
98
98
  request = build_xml_request do |xml|
99
99
  add_transaction_details(xml, nil, authorization, 'Void', options)
100
100
  add_terminal_details(xml, options)
@@ -103,7 +103,7 @@ module ActiveMerchant #:nodoc:
103
103
  commit(request)
104
104
  end
105
105
 
106
- def verify(credit_card, options={})
106
+ def verify(credit_card, options = {})
107
107
  MultiResponse.run(:use_first_response) do |r|
108
108
  r.process { authorize(100, credit_card, options) }
109
109
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -144,7 +144,7 @@ module ActiveMerchant #:nodoc:
144
144
  builder.to_xml
145
145
  end
146
146
 
147
- def add_transaction_details(xml, amount, authorization, type, options={})
147
+ def add_transaction_details(xml, amount, authorization, type, options = {})
148
148
  xml.TransactionDetails do
149
149
  xml.MessageType type
150
150
  xml.Amount(unit: 'Minor') { xml.text(amount) } if amount
@@ -153,7 +153,7 @@ module ActiveMerchant #:nodoc:
153
153
  end
154
154
  end
155
155
 
156
- def add_terminal_details(xml, options={})
156
+ def add_terminal_details(xml, options = {})
157
157
  xml.TerminalDetails do
158
158
  xml.TerminalID @options[:terminal_id]
159
159
  xml.TransactionKey @options[:transaction_key]
@@ -161,7 +161,7 @@ module ActiveMerchant #:nodoc:
161
161
  end
162
162
  end
163
163
 
164
- def add_card_details(xml, payment_method, options={})
164
+ def add_card_details(xml, payment_method, options = {})
165
165
  xml.CardDetails do
166
166
  xml.Manual(type: manual_type(options)) do
167
167
  xml.PAN payment_method.number
@@ -25,7 +25,7 @@ module ActiveMerchant #:nodoc:
25
25
  self.currencies_with_three_decimal_places = %w(BHD IQD JOD KWD LYD OMR TND)
26
26
 
27
27
  self.money_format = :cents
28
- self.supported_cardtypes = %i[visa master maestro]
28
+ self.supported_cardtypes = %i[visa master maestro american_express]
29
29
 
30
30
  RESPONSE_MESSAGES = {
31
31
  '00' => 'Approved or completed successfully',
@@ -117,15 +117,16 @@ module ActiveMerchant #:nodoc:
117
117
  '96' => 'System malfunction',
118
118
  'R0' => 'Stop Payment Order',
119
119
  'R1' => 'Revocation of Authorisation Order',
120
- 'R3' => 'Revocation of all Authorisations Order'
120
+ 'R3' => 'Revocation of all Authorisations Order',
121
+ '1A' => 'Strong Customer Authentication required'
121
122
  }
122
123
 
123
- def initialize(options={})
124
+ def initialize(options = {})
124
125
  requires!(options, :merchant_id, :cipher_key)
125
126
  super
126
127
  end
127
128
 
128
- def purchase(amount, payment_method, options={})
129
+ def purchase(amount, payment_method, options = {})
129
130
  post = {}
130
131
  add_invoice(post, amount, options)
131
132
  add_payment_method(post, payment_method)
@@ -141,7 +142,7 @@ module ActiveMerchant #:nodoc:
141
142
  commit(:purchase, post)
142
143
  end
143
144
 
144
- def authorize(amount, payment_method, options={})
145
+ def authorize(amount, payment_method, options = {})
145
146
  post = {}
146
147
  add_invoice(post, amount, options)
147
148
  add_payment_method(post, payment_method)
@@ -158,7 +159,7 @@ module ActiveMerchant #:nodoc:
158
159
  commit(:authorize, post)
159
160
  end
160
161
 
161
- def capture(amount, authorization, options={})
162
+ def capture(amount, authorization, options = {})
162
163
  post = {}
163
164
  add_invoice(post, amount, options)
164
165
  add_reference(post, authorization)
@@ -170,7 +171,7 @@ module ActiveMerchant #:nodoc:
170
171
  commit(:capture, post)
171
172
  end
172
173
 
173
- def void(authorization, options={})
174
+ def void(authorization, options = {})
174
175
  post = {}
175
176
  add_customer_data(post, options)
176
177
  reference_action = add_reference(post, authorization)
@@ -182,7 +183,7 @@ module ActiveMerchant #:nodoc:
182
183
  commit(:void, post, reference_action)
183
184
  end
184
185
 
185
- def refund(amount, authorization, options={})
186
+ def refund(amount, authorization, options = {})
186
187
  post = {}
187
188
  add_invoice(post, amount, options)
188
189
  add_reference(post, authorization)
@@ -200,7 +201,7 @@ module ActiveMerchant #:nodoc:
200
201
  end
201
202
  end
202
203
 
203
- def credit(amount, payment_method, options={})
204
+ def credit(amount, payment_method, options = {})
204
205
  post = {}
205
206
  add_invoice(post, amount, options)
206
207
  add_payment_method(post, payment_method)
@@ -214,7 +215,7 @@ module ActiveMerchant #:nodoc:
214
215
  commit(:credit, post)
215
216
  end
216
217
 
217
- def verify(credit_card, options={})
218
+ def verify(credit_card, options = {})
218
219
  MultiResponse.run(:use_first_response) do |r|
219
220
  r.process { authorize(100, credit_card, options) }
220
221
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -324,14 +325,16 @@ module ActiveMerchant #:nodoc:
324
325
  end
325
326
 
326
327
  def add_3d_secure(post, options)
327
- if options[:eci] && options[:xid]
328
+ if (options[:eci] && options[:xid]) || (options[:three_d_secure] && options[:three_d_secure][:version]&.start_with?('1'))
328
329
  add_3d_secure_1_data(post, options)
329
330
  elsif options[:execute_threed] && options[:three_ds_2]
330
331
  three_ds_2_options = options[:three_ds_2]
331
332
  browser_info = three_ds_2_options[:browser_info]
332
333
  post[:'3ds_initiate'] = options[:three_ds_initiate] || '01'
334
+ post[:f23] = options[:f23] if options[:f23]
333
335
  post[:'3ds_purchasedate'] = Time.now.utc.strftime('%Y%m%d%I%M%S')
334
336
  options.dig(:stored_credential, :initiator) == 'merchant' ? post[:'3ds_channel'] = '03' : post[:'3ds_channel'] = '02'
337
+ post[:'3ds_reqchallengeind'] = options[:three_ds_reqchallengeind] if options[:three_ds_reqchallengeind]
335
338
  post[:'3ds_redirect_url'] = three_ds_2_options[:notification_url]
336
339
  post[:'3ds_challengewindowsize'] = options[:three_ds_challenge_window_size] || '03'
337
340
  post[:d5] = browser_info[:user_agent]
@@ -343,22 +346,35 @@ module ActiveMerchant #:nodoc:
343
346
  post[:d6] = browser_info[:language]
344
347
  post[:'3ds_browserjavaenabled'] = browser_info[:java]
345
348
  post[:'3ds_browseracceptheader'] = browser_info[:accept_header]
346
- if (shipping_address = options[:shipping_address])
347
- post[:'3ds_shipaddrstate'] = shipping_address[:state]
348
- post[:'3ds_shipaddrpostcode'] = shipping_address[:zip]
349
- post[:'3ds_shipaddrline2'] = shipping_address[:address2]
350
- post[:'3ds_shipaddrline1'] = shipping_address[:address1]
351
- post[:'3ds_shipaddrcountry'] = shipping_address[:country]
352
- post[:'3ds_shipaddrcity'] = shipping_address[:city]
353
- end
349
+ add_complete_shipping_address(post, options[:shipping_address]) if options[:shipping_address]
354
350
  elsif options[:three_d_secure]
355
351
  add_normalized_3d_secure_2_data(post, options)
356
352
  end
357
353
  end
358
354
 
359
355
  def add_3d_secure_1_data(post, options)
360
- post[:i8] = build_i8(options[:eci], options[:cavv], options[:xid])
361
- post[:'3ds_version'] = options[:three_ds_version].nil? || options[:three_ds_version] == '1' ? '1.0' : options[:three_ds_version]
356
+ if three_d_secure_options = options[:three_d_secure]
357
+ post[:i8] = build_i8(
358
+ three_d_secure_options[:eci],
359
+ three_d_secure_options[:cavv],
360
+ three_d_secure_options[:xid]
361
+ )
362
+ post[:'3ds_version'] = three_d_secure_options[:version]&.start_with?('1') ? '1.0' : three_d_secure_options[:version]
363
+ else
364
+ post[:i8] = build_i8(options[:eci], options[:cavv], options[:xid])
365
+ post[:'3ds_version'] = options[:three_ds_version].nil? || options[:three_ds_version]&.start_with?('1') ? '1.0' : options[:three_ds_version]
366
+ end
367
+ end
368
+
369
+ def add_complete_shipping_address(post, shipping_address)
370
+ return if shipping_address.values.any?(&:blank?)
371
+
372
+ post[:'3ds_shipaddrstate'] = shipping_address[:state]
373
+ post[:'3ds_shipaddrpostcode'] = shipping_address[:zip]
374
+ post[:'3ds_shipaddrline2'] = shipping_address[:address2]
375
+ post[:'3ds_shipaddrline1'] = shipping_address[:address1]
376
+ post[:'3ds_shipaddrcountry'] = shipping_address[:country]
377
+ post[:'3ds_shipaddrcity'] = shipping_address[:city]
362
378
  end
363
379
 
364
380
  def add_normalized_3d_secure_2_data(post, options)
@@ -368,11 +384,11 @@ module ActiveMerchant #:nodoc:
368
384
  three_d_secure_options[:eci],
369
385
  three_d_secure_options[:cavv]
370
386
  )
371
- post[:'3ds_version'] = three_d_secure_options[:version] == '2' ? '2.0' : three_d_secure_options[:version]
387
+ post[:'3ds_version'] = three_d_secure_options[:version]&.start_with?('2') ? '2.0' : three_d_secure_options[:version]
372
388
  post[:'3ds_dstrxid'] = three_d_secure_options[:ds_transaction_id]
373
389
  end
374
390
 
375
- def build_i8(eci, cavv=nil, xid=nil)
391
+ def build_i8(eci, cavv = nil, xid = nil)
376
392
  "#{eci}:#{cavv || 'none'}:#{xid || 'none'}"
377
393
  end
378
394
 
@@ -26,12 +26,12 @@ module ActiveMerchant #:nodoc:
26
26
  'discover' => 'O'
27
27
  }
28
28
 
29
- def initialize(options={})
29
+ def initialize(options = {})
30
30
  requires!(options, :api_key, :company_number, :merchant_number)
31
31
  super
32
32
  end
33
33
 
34
- def purchase(money, payment, options={})
34
+ def purchase(money, payment, options = {})
35
35
  requires!(options, :order_id)
36
36
  post = {}
37
37
  add_terminal_number(post, options)
@@ -45,7 +45,7 @@ module ActiveMerchant #:nodoc:
45
45
  payment.is_a?(String) ? commit('purchaseWithToken', post) : commit('purchase', post)
46
46
  end
47
47
 
48
- def authorize(money, payment, options={})
48
+ def authorize(money, payment, options = {})
49
49
  requires!(options, :order_id)
50
50
  post = {}
51
51
  add_money(post, money)
@@ -59,7 +59,7 @@ module ActiveMerchant #:nodoc:
59
59
  payment.is_a?(String) ? commit('preAuthorizationWithToken', post) : commit('preAuthorization', post)
60
60
  end
61
61
 
62
- def capture(money, authorization, options={})
62
+ def capture(money, authorization, options = {})
63
63
  requires!(options, :order_id)
64
64
  post = {}
65
65
  add_invoice(post, money, options)
@@ -73,7 +73,7 @@ module ActiveMerchant #:nodoc:
73
73
  commit('completion', post)
74
74
  end
75
75
 
76
- def refund(money, authorization, options={})
76
+ def refund(money, authorization, options = {})
77
77
  requires!(options, :order_id)
78
78
  post = {}
79
79
  add_invoice(post, money, options)
@@ -86,7 +86,7 @@ module ActiveMerchant #:nodoc:
86
86
  commit('refundWithoutCard', post)
87
87
  end
88
88
 
89
- def credit(money, payment, options={})
89
+ def credit(money, payment, options = {})
90
90
  requires!(options, :order_id)
91
91
  post = {}
92
92
  add_terminal_number(post, options)
@@ -100,7 +100,7 @@ module ActiveMerchant #:nodoc:
100
100
  payment.is_a?(String) ? commit('refundWithToken', post) : commit('refund', post)
101
101
  end
102
102
 
103
- def void(authorization, options={})
103
+ def void(authorization, options = {})
104
104
  post = {}
105
105
  post[:InputType] = 'I'
106
106
  post[:LanguageCode] = 'E'
@@ -113,7 +113,7 @@ module ActiveMerchant #:nodoc:
113
113
  commit('void', post)
114
114
  end
115
115
 
116
- def verify(credit_card, options={})
116
+ def verify(credit_card, options = {})
117
117
  requires!(options, :order_id)
118
118
  post = {}
119
119
  add_terminal_number(post, options)
@@ -126,7 +126,7 @@ module ActiveMerchant #:nodoc:
126
126
  commit('verifyAccount', post)
127
127
  end
128
128
 
129
- def store(credit_card, options={})
129
+ def store(credit_card, options = {})
130
130
  requires!(options, :email)
131
131
  post = {
132
132
  LanguageCode: 'E',
@@ -228,7 +228,7 @@ module ActiveMerchant #:nodoc:
228
228
  r.process {
229
229
  split_auth = split_authorization(r.authorization)
230
230
  auth = (action.include?('recur') ? split_auth[4] : split_auth[0])
231
- action.include?('recur') ? commit_raw('recur/ack', {ID: auth}) : commit_raw('ack', {TransactionNumber: auth})
231
+ action.include?('recur') ? commit_raw('recur/ack', { ID: auth }) : commit_raw('ack', { TransactionNumber: auth })
232
232
  }
233
233
  end
234
234
  end
@@ -20,16 +20,16 @@ module ActiveMerchant #:nodoc:
20
20
  self.money_format = :dollars
21
21
  self.supported_cardtypes = %i[visa master diners_club american_express]
22
22
 
23
- def initialize(options={})
23
+ def initialize(options = {})
24
24
  requires!(options, :merchant_id, :terminal_id, :secret_key)
25
25
  super
26
26
  end
27
27
 
28
- def purchase(amount, payment_method, options={})
28
+ def purchase(amount, payment_method, options = {})
29
29
  authorize(amount, payment_method, options)
30
30
  end
31
31
 
32
- def authorize(amount, payment_method, options={})
32
+ def authorize(amount, payment_method, options = {})
33
33
  if payment_method.is_a?(String)
34
34
  action = :tokenpay
35
35
  else
@@ -45,7 +45,7 @@ module ActiveMerchant #:nodoc:
45
45
  commit(action, post)
46
46
  end
47
47
 
48
- def capture(amount, authorization, options={})
48
+ def capture(amount, authorization, options = {})
49
49
  action = :capture
50
50
  post = {}
51
51
  add_credentials(post)
@@ -56,7 +56,7 @@ module ActiveMerchant #:nodoc:
56
56
  commit(action, post)
57
57
  end
58
58
 
59
- def void(authorization, options={})
59
+ def void(authorization, options = {})
60
60
  action = :void
61
61
  post = {}
62
62
  add_credentials(post)
@@ -67,7 +67,7 @@ module ActiveMerchant #:nodoc:
67
67
  commit(action, post)
68
68
  end
69
69
 
70
- def refund(amount, authorization, options={})
70
+ def refund(amount, authorization, options = {})
71
71
  action = :refund
72
72
  post = {}
73
73
  add_credentials(post)
@@ -78,7 +78,7 @@ module ActiveMerchant #:nodoc:
78
78
  commit(action, post)
79
79
  end
80
80
 
81
- def verify(credit_card, options={})
81
+ def verify(credit_card, options = {})
82
82
  MultiResponse.run(:use_first_response) do |r|
83
83
  r.process { authorize(1000, credit_card, options) }
84
84
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -90,7 +90,7 @@ module ActiveMerchant #:nodoc:
90
90
  response.message.include? 'Transaction not found'
91
91
  end
92
92
 
93
- def store(credit_card, options={})
93
+ def store(credit_card, options = {})
94
94
  action = :tokenize
95
95
  post = {}
96
96
  post[:partnerid] = options[:partner_id] if options[:partner_id]
@@ -103,7 +103,7 @@ module ActiveMerchant #:nodoc:
103
103
  commit(action, post)
104
104
  end
105
105
 
106
- def invalidate(authorization, options={})
106
+ def invalidate(authorization, options = {})
107
107
  action = :invalidate
108
108
  post = {}
109
109
  post[:partnerid] = options[:partner_id] if options[:partner_id]
@@ -25,8 +25,8 @@ module ActiveMerchant #:nodoc:
25
25
  self.live_url = 'https://ics2wsa.ic3.com/commerce/1.x/transactionProcessor'
26
26
 
27
27
  # Schema files can be found here: https://ics2ws.ic3.com/commerce/1.x/transactionProcessor/
28
- TEST_XSD_VERSION = '1.164'
29
- PRODUCTION_XSD_VERSION = '1.164'
28
+ TEST_XSD_VERSION = '1.181'
29
+ PRODUCTION_XSD_VERSION = '1.181'
30
30
  ECI_BRAND_MAPPING = {
31
31
  visa: 'vbv',
32
32
  master: 'spa',
@@ -256,8 +256,9 @@ module ActiveMerchant #:nodoc:
256
256
 
257
257
  private
258
258
 
259
- # Create all address hash key value pairs so that we still function if we
260
- # were only provided with one or two of them or even none
259
+ # Create all required address hash key value pairs
260
+ # If a value of nil is received, that value will be passed on to the gateway and will not be replaced with a default value
261
+ # Billing address fields received without an override value or with an empty string value will be replaced with the default_address values
261
262
  def setup_address_hash(options)
262
263
  default_address = {
263
264
  address1: 'Unspecified',
@@ -268,10 +269,20 @@ module ActiveMerchant #:nodoc:
268
269
  }
269
270
 
270
271
  submitted_address = options[:billing_address] || options[:address] || default_address
271
- options[:billing_address] = default_address.merge(submitted_address.symbolize_keys) { |_k, default, submitted| submitted.blank? ? default : submitted }
272
+ options[:billing_address] = default_address.merge(submitted_address.symbolize_keys) { |_k, default, submitted| check_billing_field_value(default, submitted) }
272
273
  options[:shipping_address] = options[:shipping_address] || {}
273
274
  end
274
275
 
276
+ def check_billing_field_value(default, submitted)
277
+ if submitted.nil?
278
+ nil
279
+ elsif submitted.blank?
280
+ default
281
+ else
282
+ submitted
283
+ end
284
+ end
285
+
275
286
  def build_auth_request(money, creditcard_or_reference, options)
276
287
  xml = Builder::XmlMarkup.new indent: 2
277
288
  add_payment_method_or_subscription(xml, money, creditcard_or_reference, options)
@@ -287,6 +298,8 @@ module ActiveMerchant #:nodoc:
287
298
  add_partner_solution_id(xml)
288
299
  add_stored_credential_options(xml, options)
289
300
  add_merchant_description(xml, options)
301
+ add_sales_slip_number(xml, options)
302
+ add_airline_data(xml, options)
290
303
 
291
304
  xml.target!
292
305
  end
@@ -325,6 +338,8 @@ module ActiveMerchant #:nodoc:
325
338
  add_threeds_2_ucaf_data(xml, payment_method_or_reference, options)
326
339
  add_decision_manager_fields(xml, options)
327
340
  add_mdd_fields(xml, options)
341
+ add_sales_slip_number(xml, options)
342
+ add_airline_data(xml, options)
328
343
  if !payment_method_or_reference.is_a?(String) && card_brand(payment_method_or_reference) == 'check'
329
344
  add_check_service(xml)
330
345
  add_issuer_additional_data(xml, options)
@@ -390,7 +405,7 @@ module ActiveMerchant #:nodoc:
390
405
  end
391
406
 
392
407
  def build_create_subscription_request(payment_method, options)
393
- default_subscription_params = {frequency: 'on-demand', amount: 0, automatic_renew: false}
408
+ default_subscription_params = { frequency: 'on-demand', amount: 0, automatic_renew: false }
394
409
  options[:subscription] = default_subscription_params.update(
395
410
  options[:subscription] || {}
396
411
  )
@@ -472,7 +487,7 @@ module ActiveMerchant #:nodoc:
472
487
 
473
488
  def add_line_item_data(xml, options)
474
489
  options[:line_items].each_with_index do |value, index|
475
- xml.tag! 'item', {'id' => index} do
490
+ xml.tag! 'item', { 'id' => index } do
476
491
  xml.tag! 'unitPrice', localized_amount(value[:declared_value].to_i, options[:currency] || default_currency)
477
492
  xml.tag! 'quantity', value[:quantity]
478
493
  xml.tag! 'productCode', value[:code] || 'shipping_only'
@@ -512,7 +527,19 @@ module ActiveMerchant #:nodoc:
512
527
  end
513
528
  end
514
529
 
515
- def add_purchase_data(xml, money = 0, include_grand_total = false, options={})
530
+ def add_sales_slip_number(xml, options)
531
+ xml.tag! 'salesSlipNumber', options[:sales_slip_number] if options[:sales_slip_number]
532
+ end
533
+
534
+ def add_airline_data(xml, options)
535
+ return unless options[:airline_agent_code]
536
+
537
+ xml.tag! 'airlineData' do
538
+ xml.tag! 'agentCode', options[:airline_agent_code]
539
+ end
540
+ end
541
+
542
+ def add_purchase_data(xml, money = 0, include_grand_total = false, options = {})
516
543
  xml.tag! 'purchaseTotals' do
517
544
  xml.tag! 'currency', options[:currency] || currency(money)
518
545
  xml.tag!('grandTotalAmount', localized_amount(money.to_i, options[:currency] || default_currency)) if include_grand_total
@@ -520,9 +547,12 @@ module ActiveMerchant #:nodoc:
520
547
  end
521
548
 
522
549
  def add_address(xml, payment_method, address, options, shipTo = false)
550
+ first_name, last_name = address_names(address[:name], payment_method)
551
+ bill_to_merchant_tax_id = options[:merchant_tax_id] unless shipTo
552
+
523
553
  xml.tag! shipTo ? 'shipTo' : 'billTo' do
524
- xml.tag! 'firstName', payment_method.first_name if payment_method
525
- xml.tag! 'lastName', payment_method.last_name if payment_method
554
+ xml.tag! 'firstName', first_name if first_name
555
+ xml.tag! 'lastName', last_name if last_name
526
556
  xml.tag! 'street1', address[:address1]
527
557
  xml.tag! 'street2', address[:address2] unless address[:address2].blank?
528
558
  xml.tag! 'city', address[:city]
@@ -536,9 +566,20 @@ module ActiveMerchant #:nodoc:
536
566
  xml.tag! 'ipAddress', options[:ip] unless options[:ip].blank? || shipTo
537
567
  xml.tag! 'driversLicenseNumber', options[:drivers_license_number] unless options[:drivers_license_number].blank?
538
568
  xml.tag! 'driversLicenseState', options[:drivers_license_state] unless options[:drivers_license_state].blank?
569
+ xml.tag! 'merchantTaxID', bill_to_merchant_tax_id unless bill_to_merchant_tax_id.blank?
539
570
  end
540
571
  end
541
572
 
573
+ def address_names(address_name, payment_method)
574
+ names = split_names(address_name)
575
+ return names if names.any?(&:present?)
576
+
577
+ [
578
+ payment_method&.first_name,
579
+ payment_method&.last_name
580
+ ]
581
+ end
582
+
542
583
  def add_creditcard(xml, creditcard)
543
584
  xml.tag! 'card' do
544
585
  xml.tag! 'accountNumber', creditcard.number
@@ -576,12 +617,12 @@ module ActiveMerchant #:nodoc:
576
617
  end
577
618
 
578
619
  def add_mdd_fields(xml, options)
579
- return unless options.keys.any? { |key| key.to_s.start_with?('mdd_field') }
620
+ return unless options.keys.any? { |key| key.to_s.start_with?('mdd_field') && options[key] }
580
621
 
581
622
  xml.tag! 'merchantDefinedData' do
582
623
  (1..100).each do |each|
583
624
  key = "mdd_field_#{each}".to_sym
584
- xml.tag!("field#{each}", options[key]) if options[key]
625
+ xml.tag!('mddField', options[key], 'id' => each) if options[key]
585
626
  end
586
627
  end
587
628
  end
@@ -595,7 +636,7 @@ module ActiveMerchant #:nodoc:
595
636
  end
596
637
 
597
638
  def add_tax_service(xml)
598
- xml.tag! 'taxService', {'run' => 'true'} do
639
+ xml.tag! 'taxService', { 'run' => 'true' } do
599
640
  xml.tag!('nexus', @options[:nexus]) unless @options[:nexus].blank?
600
641
  xml.tag!('sellerRegistration', @options[:vat_reg_number]) unless @options[:vat_reg_number].blank?
601
642
  end
@@ -605,7 +646,7 @@ module ActiveMerchant #:nodoc:
605
646
  if network_tokenization?(payment_method)
606
647
  add_auth_network_tokenization(xml, payment_method, options)
607
648
  else
608
- xml.tag! 'ccAuthService', {'run' => 'true'} do
649
+ xml.tag! 'ccAuthService', { 'run' => 'true' } do
609
650
  if options[:three_d_secure]
610
651
  add_normalized_threeds_2_data(xml, payment_method, options)
611
652
  else
@@ -678,7 +719,7 @@ module ActiveMerchant #:nodoc:
678
719
 
679
720
  case brand
680
721
  when :visa
681
- xml.tag! 'ccAuthService', {'run' => 'true'} do
722
+ xml.tag! 'ccAuthService', { 'run' => 'true' } do
682
723
  xml.tag!('cavv', payment_method.payment_cryptogram)
683
724
  xml.tag!('commerceIndicator', ECI_BRAND_MAPPING[brand])
684
725
  xml.tag!('xid', payment_method.payment_cryptogram)
@@ -689,13 +730,13 @@ module ActiveMerchant #:nodoc:
689
730
  xml.tag!('authenticationData', payment_method.payment_cryptogram)
690
731
  xml.tag!('collectionIndicator', DEFAULT_COLLECTION_INDICATOR)
691
732
  end
692
- xml.tag! 'ccAuthService', {'run' => 'true'} do
733
+ xml.tag! 'ccAuthService', { 'run' => 'true' } do
693
734
  xml.tag!('commerceIndicator', ECI_BRAND_MAPPING[brand])
694
735
  xml.tag!('reconciliationID', options[:reconciliation_id]) if options[:reconciliation_id]
695
736
  end
696
737
  when :american_express
697
738
  cryptogram = Base64.decode64(payment_method.payment_cryptogram)
698
- xml.tag! 'ccAuthService', {'run' => 'true'} do
739
+ xml.tag! 'ccAuthService', { 'run' => 'true' } do
699
740
  xml.tag!('cavv', Base64.encode64(cryptogram[0...20]))
700
741
  xml.tag!('commerceIndicator', ECI_BRAND_MAPPING[brand])
701
742
  xml.tag!('xid', Base64.encode64(cryptogram[20...40]))
@@ -711,7 +752,7 @@ module ActiveMerchant #:nodoc:
711
752
  end
712
753
 
713
754
  def add_capture_service(xml, request_id, request_token)
714
- xml.tag! 'ccCaptureService', {'run' => 'true'} do
755
+ xml.tag! 'ccCaptureService', { 'run' => 'true' } do
715
756
  xml.tag! 'authRequestID', request_id
716
757
  xml.tag! 'authRequestToken', request_token
717
758
  xml.tag! 'reconciliationID', options[:reconciliation_id] if options[:reconciliation_id]
@@ -720,56 +761,56 @@ module ActiveMerchant #:nodoc:
720
761
 
721
762
  def add_purchase_service(xml, payment_method, options)
722
763
  if options[:pinless_debit_card]
723
- xml.tag! 'pinlessDebitService', {'run' => 'true'} do
764
+ xml.tag! 'pinlessDebitService', { 'run' => 'true' } do
724
765
  xml.tag!('reconciliationID', options[:reconciliation_id]) if options[:reconciliation_id]
725
766
  end
726
767
  else
727
768
  add_auth_service(xml, payment_method, options)
728
- xml.tag! 'ccCaptureService', {'run' => 'true'} do
769
+ xml.tag! 'ccCaptureService', { 'run' => 'true' } do
729
770
  xml.tag!('reconciliationID', options[:reconciliation_id]) if options[:reconciliation_id]
730
771
  end
731
772
  end
732
773
  end
733
774
 
734
775
  def add_void_service(xml, request_id, request_token)
735
- xml.tag! 'voidService', {'run' => 'true'} do
776
+ xml.tag! 'voidService', { 'run' => 'true' } do
736
777
  xml.tag! 'voidRequestID', request_id
737
778
  xml.tag! 'voidRequestToken', request_token
738
779
  end
739
780
  end
740
781
 
741
782
  def add_auth_reversal_service(xml, request_id, request_token)
742
- xml.tag! 'ccAuthReversalService', {'run' => 'true'} do
783
+ xml.tag! 'ccAuthReversalService', { 'run' => 'true' } do
743
784
  xml.tag! 'authRequestID', request_id
744
785
  xml.tag! 'authRequestToken', request_token
745
786
  end
746
787
  end
747
788
 
748
789
  def add_credit_service(xml, request_id = nil, request_token = nil)
749
- xml.tag! 'ccCreditService', {'run' => 'true'} do
790
+ xml.tag! 'ccCreditService', { 'run' => 'true' } do
750
791
  xml.tag! 'captureRequestID', request_id if request_id
751
792
  xml.tag! 'captureRequestToken', request_token if request_token
752
793
  end
753
794
  end
754
795
 
755
796
  def add_check_service(xml)
756
- xml.tag! 'ecDebitService', {'run' => 'true'}
797
+ xml.tag! 'ecDebitService', { 'run' => 'true' }
757
798
  end
758
799
 
759
800
  def add_subscription_create_service(xml, options)
760
- xml.tag! 'paySubscriptionCreateService', {'run' => 'true'}
801
+ xml.tag! 'paySubscriptionCreateService', { 'run' => 'true' }
761
802
  end
762
803
 
763
804
  def add_subscription_update_service(xml, options)
764
- xml.tag! 'paySubscriptionUpdateService', {'run' => 'true'}
805
+ xml.tag! 'paySubscriptionUpdateService', { 'run' => 'true' }
765
806
  end
766
807
 
767
808
  def add_subscription_delete_service(xml, options)
768
- xml.tag! 'paySubscriptionDeleteService', {'run' => 'true'}
809
+ xml.tag! 'paySubscriptionDeleteService', { 'run' => 'true' }
769
810
  end
770
811
 
771
812
  def add_subscription_retrieve_service(xml, options)
772
- xml.tag! 'paySubscriptionRetrieveService', {'run' => 'true'}
813
+ xml.tag! 'paySubscriptionRetrieveService', { 'run' => 'true' }
773
814
  end
774
815
 
775
816
  def add_subscription(xml, options, reference = nil)
@@ -830,17 +871,19 @@ module ActiveMerchant #:nodoc:
830
871
 
831
872
  xml.tag! 'installment' do
832
873
  xml.tag! 'totalCount', options[:installment_total_count]
874
+ xml.tag!('planType', options[:installment_plan_type]) if options[:installment_plan_type]
875
+ xml.tag!('firstInstallmentDate', options[:first_installment_date]) if options[:first_installment_date]
833
876
  end
834
877
  end
835
878
 
836
879
  def add_validate_pinless_debit_service(xml)
837
- xml.tag! 'pinlessDebitValidateService', {'run' => 'true'}
880
+ xml.tag! 'pinlessDebitValidateService', { 'run' => 'true' }
838
881
  end
839
882
 
840
883
  def add_threeds_services(xml, options)
841
- xml.tag! 'payerAuthEnrollService', {'run' => 'true'} if options[:payer_auth_enroll_service]
884
+ xml.tag! 'payerAuthEnrollService', { 'run' => 'true' } if options[:payer_auth_enroll_service]
842
885
  if options[:payer_auth_validate_service]
843
- xml.tag! 'payerAuthValidateService', {'run' => 'true'} do
886
+ xml.tag! 'payerAuthValidateService', { 'run' => 'true' } do
844
887
  xml.tag! 'signedPARes', options[:pares]
845
888
  end
846
889
  end
@@ -851,7 +894,7 @@ module ActiveMerchant #:nodoc:
851
894
  country_code&.code(:alpha2)
852
895
  end
853
896
 
854
- def add_stored_credential_subsequent_auth(xml, options={})
897
+ def add_stored_credential_subsequent_auth(xml, options = {})
855
898
  return unless options[:stored_credential] || options[:stored_credential_overrides]
856
899
 
857
900
  stored_credential_subsequent_auth = 'true' if options.dig(:stored_credential, :initiator) == 'merchant'
@@ -861,7 +904,7 @@ module ActiveMerchant #:nodoc:
861
904
  xml.subsequentAuth override_subsequent_auth.nil? ? stored_credential_subsequent_auth : override_subsequent_auth
862
905
  end
863
906
 
864
- def add_stored_credential_options(xml, options={})
907
+ def add_stored_credential_options(xml, options = {})
865
908
  return unless options[:stored_credential] || options[:stored_credential_overrides]
866
909
 
867
910
  stored_credential_subsequent_auth_first = 'true' if options.dig(:stored_credential, :initial_transaction)
@@ -889,17 +932,17 @@ module ActiveMerchant #:nodoc:
889
932
 
890
933
  xml = Builder::XmlMarkup.new indent: 2
891
934
  xml.instruct!
892
- xml.tag! 's:Envelope', {'xmlns:s' => 'http://schemas.xmlsoap.org/soap/envelope/'} do
935
+ xml.tag! 's:Envelope', { 'xmlns:s' => 'http://schemas.xmlsoap.org/soap/envelope/' } do
893
936
  xml.tag! 's:Header' do
894
- xml.tag! 'wsse:Security', {'s:mustUnderstand' => '1', 'xmlns:wsse' => 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd'} do
937
+ xml.tag! 'wsse:Security', { 's:mustUnderstand' => '1', 'xmlns:wsse' => 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd' } do
895
938
  xml.tag! 'wsse:UsernameToken' do
896
939
  xml.tag! 'wsse:Username', @options[:login]
897
940
  xml.tag! 'wsse:Password', @options[:password], 'Type' => 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText'
898
941
  end
899
942
  end
900
943
  end
901
- xml.tag! 's:Body', {'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema'} do
902
- xml.tag! 'requestMessage', {'xmlns' => "urn:schemas-cybersource-com:transaction-data-#{xsd_version}"} do
944
+ xml.tag! 's:Body', { 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema' } do
945
+ xml.tag! 'requestMessage', { 'xmlns' => "urn:schemas-cybersource-com:transaction-data-#{xsd_version}" } do
903
946
  add_merchant_data(xml, options)
904
947
  xml << body
905
948
  end
@@ -932,8 +975,7 @@ module ActiveMerchant #:nodoc:
932
975
  authorization: authorization,
933
976
  fraud_review: in_fraud_review?(response),
934
977
  avs_result: { code: response[:avsCode] },
935
- cvv_result: response[:cvCode]
936
- )
978
+ cvv_result: response[:cvCode])
937
979
  end
938
980
 
939
981
  # Parse the SOAP response