activemerchant 1.114.0 → 1.120.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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
@@ -29,13 +29,13 @@ module ActiveMerchant #:nodoc:
29
29
  '135' => STANDARD_ERROR_CODE[:incorrect_address]
30
30
  }
31
31
 
32
- def initialize(options={})
32
+ def initialize(options = {})
33
33
  requires!(options, :username, :password, :merchant_account)
34
34
  @username, @password, @merchant_account = options.values_at(:username, :password, :merchant_account)
35
35
  super
36
36
  end
37
37
 
38
- def purchase(money, payment, options={})
38
+ def purchase(money, payment, options = {})
39
39
  if options[:execute_threed] || options[:threed_dynamic]
40
40
  authorize(money, payment, options)
41
41
  else
@@ -46,7 +46,7 @@ module ActiveMerchant #:nodoc:
46
46
  end
47
47
  end
48
48
 
49
- def authorize(money, payment, options={})
49
+ def authorize(money, payment, options = {})
50
50
  requires!(options, :order_id)
51
51
  post = init_post(options)
52
52
  add_invoice(post, money, options)
@@ -62,7 +62,7 @@ module ActiveMerchant #:nodoc:
62
62
  commit('authorise', post, options)
63
63
  end
64
64
 
65
- def capture(money, authorization, options={})
65
+ def capture(money, authorization, options = {})
66
66
  post = init_post(options)
67
67
  add_invoice_for_modification(post, money, options)
68
68
  add_reference(post, authorization, options)
@@ -70,7 +70,7 @@ module ActiveMerchant #:nodoc:
70
70
  commit('capture', post, options)
71
71
  end
72
72
 
73
- def refund(money, authorization, options={})
73
+ def refund(money, authorization, options = {})
74
74
  post = init_post(options)
75
75
  add_invoice_for_modification(post, money, options)
76
76
  add_original_reference(post, authorization, options)
@@ -78,13 +78,22 @@ module ActiveMerchant #:nodoc:
78
78
  commit('refund', post, options)
79
79
  end
80
80
 
81
- def void(authorization, options={})
81
+ def credit(money, payment, options = {})
82
82
  post = init_post(options)
83
+ add_invoice(post, money, options)
84
+ add_payment(post, payment, options)
85
+ add_shopper_reference(post, options)
86
+ commit('refundWithData', post, options)
87
+ end
88
+
89
+ def void(authorization, options = {})
90
+ post = init_post(options)
91
+ endpoint = options[:cancel_or_refund] ? 'cancelOrRefund' : 'cancel'
83
92
  add_reference(post, authorization, options)
84
- commit('cancel', post, options)
93
+ commit(endpoint, post, options)
85
94
  end
86
95
 
87
- def adjust(money, authorization, options={})
96
+ def adjust(money, authorization, options = {})
88
97
  post = init_post(options)
89
98
  add_invoice_for_modification(post, money, options)
90
99
  add_reference(post, authorization, options)
@@ -92,7 +101,7 @@ module ActiveMerchant #:nodoc:
92
101
  commit('adjustAuthorisation', post, options)
93
102
  end
94
103
 
95
- def store(credit_card, options={})
104
+ def store(credit_card, options = {})
96
105
  requires!(options, :order_id)
97
106
  post = init_post(options)
98
107
  add_invoice(post, 0, options)
@@ -115,7 +124,7 @@ module ActiveMerchant #:nodoc:
115
124
  end
116
125
  end
117
126
 
118
- def unstore(options={})
127
+ def unstore(options = {})
119
128
  requires!(options, :shopper_reference, :recurring_detail_reference)
120
129
  post = {}
121
130
 
@@ -126,7 +135,7 @@ module ActiveMerchant #:nodoc:
126
135
  commit('disable', post, options)
127
136
  end
128
137
 
129
- def verify(credit_card, options={})
138
+ def verify(credit_card, options = {})
130
139
  MultiResponse.run(:use_first_response) do |r|
131
140
  r.process { authorize(0, credit_card, options) }
132
141
  options[:idempotency_key] = nil
@@ -227,7 +236,16 @@ module ActiveMerchant #:nodoc:
227
236
  end
228
237
 
229
238
  def add_merchant_data(post, options)
230
- post[:additionalData][:subMerchantId] = options[:sub_merchant_id] if options[:sub_merchant_id]
239
+ post[:additionalData][:subMerchantID] = options[:sub_merchant_id] if options[:sub_merchant_id]
240
+ post[:additionalData][:subMerchantName] = options[:sub_merchant_name] if options[:sub_merchant_name]
241
+ post[:additionalData][:subMerchantStreet] = options[:sub_merchant_street] if options[:sub_merchant_street]
242
+ post[:additionalData][:subMerchantCity] = options[:sub_merchant_city] if options[:sub_merchant_city]
243
+ post[:additionalData][:subMerchantState] = options[:sub_merchant_state] if options[:sub_merchant_state]
244
+ post[:additionalData][:subMerchantPostalCode] = options[:sub_merchant_postal_code] if options[:sub_merchant_postal_code]
245
+ post[:additionalData][:subMerchantCountry] = options[:sub_merchant_country] if options[:sub_merchant_country]
246
+ post[:additionalData][:subMerchantTaxId] = options[:sub_merchant_tax_id] if options[:sub_merchant_tax_id]
247
+ post[:additionalData][:subMerchantMCC] = options[:sub_merchant_mcc] if options[:sub_merchant_mcc]
248
+ post[:additionalData] = post[:additionalData].merge(options[:sub_merchant_data]) if options[:sub_merchant_data]
231
249
  end
232
250
 
233
251
  def add_risk_data(post, options)
@@ -271,7 +289,7 @@ module ActiveMerchant #:nodoc:
271
289
  post[:shopperReference] = options[:shopper_reference] if options[:shopper_reference]
272
290
  end
273
291
 
274
- def add_shopper_interaction(post, payment, options={})
292
+ def add_shopper_interaction(post, payment, options = {})
275
293
  if (options.dig(:stored_credential, :initial_transaction) && options.dig(:stored_credential, :initiator) == 'cardholder') ||
276
294
  (payment.respond_to?(:verification_value) && payment.verification_value && options.dig(:stored_credential, :initial_transaction).nil?) ||
277
295
  payment.is_a?(NetworkTokenizationCreditCard)
@@ -364,8 +382,8 @@ module ActiveMerchant #:nodoc:
364
382
  cvc: credit_card.verification_value
365
383
  }
366
384
 
367
- card.delete_if { |k, v| v.blank? }
368
- card[:holderName] ||= 'Not Provided' if credit_card.is_a?(NetworkTokenizationCreditCard)
385
+ card.delete_if { |_k, v| v.blank? }
386
+ card[:holderName] ||= 'Not Provided'
369
387
  requires!(card, :expiryMonth, :expiryYear, :holderName, :number)
370
388
  post[:card] = card
371
389
  end
@@ -382,7 +400,11 @@ module ActiveMerchant #:nodoc:
382
400
  end
383
401
 
384
402
  def add_original_reference(post, authorization, options = {})
385
- original_psp_reference, = authorization.split('#')
403
+ if authorization.start_with?('#')
404
+ _, original_psp_reference, = authorization.split('#')
405
+ else
406
+ original_psp_reference, = authorization.split('#')
407
+ end
386
408
  post[:originalReference] = single_reference(authorization) || original_psp_reference
387
409
  end
388
410
 
@@ -432,7 +454,8 @@ module ActiveMerchant #:nodoc:
432
454
  return unless !options[:execute_threed].nil? || !options[:threed_dynamic].nil?
433
455
 
434
456
  post[:browserInfo] = { userAgent: options[:user_agent], acceptHeader: options[:accept_header] } if options[:execute_threed] || options[:threed_dynamic]
435
- post[:additionalData] = { executeThreeD: options[:execute_threed] } if !options[:execute_threed].nil?
457
+ post[:additionalData] ||= {}
458
+ post[:additionalData][:executeThreeD] = options[:execute_threed] if !options[:execute_threed].nil?
436
459
  end
437
460
  end
438
461
 
@@ -542,11 +565,10 @@ module ActiveMerchant #:nodoc:
542
565
  response['refusalReason'] = 'Received unexpected 3DS authentication response. Use the execute_threed and/or threed_dynamic options to initiate a proper 3DS flow.'
543
566
  return false
544
567
  end
545
-
546
568
  case action.to_s
547
569
  when 'authorise', 'authorise3d'
548
570
  %w[Authorised Received RedirectShopper].include?(response['resultCode'])
549
- when 'capture', 'refund', 'cancel'
571
+ when 'capture', 'refund', 'cancel', 'cancelOrRefund'
550
572
  response['response'] == "[#{action}-received]"
551
573
  when 'adjustAuthorisation'
552
574
  response['response'] == 'Authorised' || response['response'] == '[adjustAuthorisation-received]'
@@ -554,6 +576,8 @@ module ActiveMerchant #:nodoc:
554
576
  response['result'] == 'Success'
555
577
  when 'disable'
556
578
  response['response'] == '[detail-successfully-disabled]'
579
+ when 'refundWithData'
580
+ response['resultCode'] == 'Received'
557
581
  else
558
582
  false
559
583
  end
@@ -562,7 +586,7 @@ module ActiveMerchant #:nodoc:
562
586
  def message_from(action, response)
563
587
  return authorize_message_from(response) if %w(authorise authorise3d authorise3ds2).include?(action.to_s)
564
588
 
565
- response['response'] || response['message'] || response['result']
589
+ response['response'] || response['message'] || response['result'] || response['resultCode']
566
590
  end
567
591
 
568
592
  def authorize_message_from(response)
@@ -12,12 +12,12 @@ module ActiveMerchant #:nodoc:
12
12
  self.supported_cardtypes = %i[visa master american_express discover
13
13
  diners_club jcb maestro]
14
14
 
15
- def initialize(options={})
15
+ def initialize(options = {})
16
16
  requires!(options, :site_id, :merchant_id, :token)
17
17
  super
18
18
  end
19
19
 
20
- def purchase(amount, payment_method, options={})
20
+ def purchase(amount, payment_method, options = {})
21
21
  post = {}
22
22
  add_invoice(post, amount, options)
23
23
  add_payment_method(post, payment_method)
@@ -26,7 +26,7 @@ module ActiveMerchant #:nodoc:
26
26
  commit(:purchase, post)
27
27
  end
28
28
 
29
- def authorize(amount, payment_method, options={})
29
+ def authorize(amount, payment_method, options = {})
30
30
  post = {}
31
31
  add_invoice(post, amount, options)
32
32
  add_payment_method(post, payment_method)
@@ -35,7 +35,7 @@ module ActiveMerchant #:nodoc:
35
35
  commit(:authorize, post)
36
36
  end
37
37
 
38
- def capture(amount, authorization, options={})
38
+ def capture(amount, authorization, options = {})
39
39
  post = {}
40
40
  add_invoice(post, amount, options)
41
41
  add_reference(post, authorization, :capture)
@@ -44,14 +44,14 @@ module ActiveMerchant #:nodoc:
44
44
  commit(:capture, post)
45
45
  end
46
46
 
47
- def void(authorization, options={})
47
+ def void(authorization, options = {})
48
48
  post = {}
49
49
  add_reference(post, authorization, :void)
50
50
 
51
51
  commit(:void, post)
52
52
  end
53
53
 
54
- def refund(amount, authorization, options={})
54
+ def refund(amount, authorization, options = {})
55
55
  post = {}
56
56
  add_invoice(post, amount, options)
57
57
  add_reference(post, authorization, :refund)
@@ -61,7 +61,7 @@ module ActiveMerchant #:nodoc:
61
61
  commit(:refund, post)
62
62
  end
63
63
 
64
- def verify(credit_card, options={})
64
+ def verify(credit_card, options = {})
65
65
  MultiResponse.run(:use_first_response) do |r|
66
66
  r.process { authorize(100, credit_card, options) }
67
67
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -94,7 +94,7 @@ module ActiveMerchant
94
94
  PAYMENT_METHOD_NOT_SUPPORTED_ERROR = '155'
95
95
  INELIGIBLE_FOR_ISSUING_CREDIT_ERROR = '54'
96
96
 
97
- def initialize(options={})
97
+ def initialize(options = {})
98
98
  requires!(options, :login, :password)
99
99
  super
100
100
  end
@@ -111,7 +111,7 @@ module ActiveMerchant
111
111
  end
112
112
  end
113
113
 
114
- def authorize(amount, payment, options={})
114
+ def authorize(amount, payment, options = {})
115
115
  if payment.is_a?(String)
116
116
  commit(:cim_authorize, options) do |xml|
117
117
  add_cim_auth_purchase(xml, 'profileTransAuthOnly', amount, payment, options)
@@ -123,7 +123,7 @@ module ActiveMerchant
123
123
  end
124
124
  end
125
125
 
126
- def capture(amount, authorization, options={})
126
+ def capture(amount, authorization, options = {})
127
127
  if auth_was_for_cim?(authorization)
128
128
  cim_capture(amount, authorization, options)
129
129
  else
@@ -131,7 +131,7 @@ module ActiveMerchant
131
131
  end
132
132
  end
133
133
 
134
- def refund(amount, authorization, options={})
134
+ def refund(amount, authorization, options = {})
135
135
  response =
136
136
  if auth_was_for_cim?(authorization)
137
137
  cim_refund(amount, authorization, options)
@@ -149,7 +149,7 @@ module ActiveMerchant
149
149
  end
150
150
  end
151
151
 
152
- def void(authorization, options={})
152
+ def void(authorization, options = {})
153
153
  if auth_was_for_cim?(authorization)
154
154
  cim_void(authorization, options)
155
155
  else
@@ -157,7 +157,7 @@ module ActiveMerchant
157
157
  end
158
158
  end
159
159
 
160
- def credit(amount, payment, options={})
160
+ def credit(amount, payment, options = {})
161
161
  raise ArgumentError, 'Reference credits are not supported. Please supply the original credit card or use the #refund method.' if payment.is_a?(String)
162
162
 
163
163
  commit(:credit) do |xml|
@@ -257,6 +257,8 @@ module ActiveMerchant
257
257
  add_settings(xml, payment, options)
258
258
  add_user_fields(xml, amount, options)
259
259
  add_ship_from_address(xml, options)
260
+ add_processing_options(xml, options)
261
+ add_subsequent_auth_information(xml, options)
260
262
  end
261
263
  end
262
264
 
@@ -408,7 +410,7 @@ module ActiveMerchant
408
410
 
409
411
  def add_settings(xml, source, options)
410
412
  xml.transactionSettings do
411
- if options[:recurring]
413
+ if options[:recurring] || subsequent_recurring_transaction?(options)
412
414
  xml.setting do
413
415
  xml.settingName('recurringBilling')
414
416
  xml.settingValue('true')
@@ -568,9 +570,11 @@ module ActiveMerchant
568
570
  xml.cardholderAuthentication do
569
571
  three_d_secure = options.fetch(:three_d_secure, {})
570
572
  xml.authenticationIndicator(
571
- options[:authentication_indicator] || three_d_secure[:eci])
573
+ options[:authentication_indicator] || three_d_secure[:eci]
574
+ )
572
575
  xml.cardholderAuthenticationValue(
573
- options[:cardholder_authentication_value] || three_d_secure[:cavv])
576
+ options[:cardholder_authentication_value] || three_d_secure[:cavv]
577
+ )
574
578
  end
575
579
  end
576
580
 
@@ -595,7 +599,7 @@ module ActiveMerchant
595
599
  end
596
600
  end
597
601
 
598
- def add_shipping_address(xml, options, root_node='shipTo')
602
+ def add_shipping_address(xml, options, root_node = 'shipTo')
599
603
  address = options[:shipping_address] || options[:address]
600
604
  return unless address
601
605
 
@@ -619,7 +623,7 @@ module ActiveMerchant
619
623
  end
620
624
  end
621
625
 
622
- def add_ship_from_address(xml, options, root_node='shipFrom')
626
+ def add_ship_from_address(xml, options, root_node = 'shipFrom')
623
627
  address = options[:ship_from_address]
624
628
  return unless address
625
629
 
@@ -700,6 +704,31 @@ module ActiveMerchant
700
704
  xml.extraOptions("x_delim_char=#{options[:delimiter]}") if options[:delimiter]
701
705
  end
702
706
 
707
+ def add_processing_options(xml, options)
708
+ return unless options[:stored_credential]
709
+
710
+ xml.processingOptions do
711
+ if options[:stored_credential][:initial_transaction] && options[:stored_credential][:reason_type] == 'recurring'
712
+ xml.isFirstRecurringPayment 'true'
713
+ elsif options[:stored_credential][:initial_transaction]
714
+ xml.isFirstSubsequentAuth 'true'
715
+ elsif options[:stored_credential][:initiator] == 'cardholder'
716
+ xml.isStoredCredentials 'true'
717
+ else
718
+ xml.isSubsequentAuth 'true'
719
+ end
720
+ end
721
+ end
722
+
723
+ def add_subsequent_auth_information(xml, options)
724
+ return unless options.dig(:stored_credential, :initiator) == 'merchant'
725
+
726
+ xml.subsequentAuthInformation do
727
+ xml.reason options[:stored_credential_reason_type_override] if options[:stored_credential_reason_type_override]
728
+ xml.originalNetworkTransId options[:stored_credential][:network_transaction_id] if options[:stored_credential][:network_transaction_id]
729
+ end
730
+ end
731
+
703
732
  def create_customer_payment_profile(credit_card, options)
704
733
  commit(:cim_store_update, options) do |xml|
705
734
  xml.customerProfileId options[:customer_profile_id]
@@ -762,6 +791,10 @@ module ActiveMerchant
762
791
  end
763
792
  end
764
793
 
794
+ def subsequent_recurring_transaction?(options)
795
+ options.dig(:stored_credential, :reason_type) == 'recurring' && !options.dig(:stored_credential, :initial_transaction)
796
+ end
797
+
765
798
  def headers
766
799
  { 'Content-Type' => 'text/xml' }
767
800
  end
@@ -842,7 +875,7 @@ module ActiveMerchant
842
875
  doc = Nokogiri::XML(body)
843
876
  doc.remove_namespaces!
844
877
 
845
- response = {action: action}
878
+ response = { action: action }
846
879
 
847
880
  response[:response_code] = if (element = doc.at_xpath('//transactionResponse/responseCode'))
848
881
  empty?(element.content) ? nil : element.content.to_i
@@ -902,6 +935,11 @@ module ActiveMerchant
902
935
  empty?(element.content) ? nil : element.content
903
936
  end
904
937
 
938
+ response[:network_trans_id] =
939
+ if element = doc.at_xpath('//networkTransId')
940
+ empty?(element.content) ? nil : element.content
941
+ end
942
+
905
943
  response
906
944
  end
907
945
 
@@ -82,7 +82,7 @@ module ActiveMerchant #:nodoc:
82
82
  # +:interval => { :unit => :months, :length => 3 }+ (REQUIRED)
83
83
  # * <tt>:duration</tt> -- A hash containing keys for the <tt>:start_date</tt> the subscription begins (also the date the
84
84
  # initial billing occurs) and the total number of billing <tt>:occurrences</tt> or payments for the subscription. (REQUIRED)
85
- def recurring(money, creditcard, options={})
85
+ def recurring(money, creditcard, options = {})
86
86
  requires!(options, :interval, :duration, :billing_address)
87
87
  requires!(options[:interval], :length, %i[unit days months])
88
88
  requires!(options[:duration], :start_date, :occurrences)
@@ -110,7 +110,7 @@ module ActiveMerchant #:nodoc:
110
110
  #
111
111
  # * <tt>:subscription_id</tt> -- A string containing the <tt>:subscription_id</tt> of the recurring payment already in place
112
112
  # for a given credit card. (REQUIRED)
113
- def update_recurring(options={})
113
+ def update_recurring(options = {})
114
114
  requires!(options, :subscription_id)
115
115
  request = build_recurring_request(:update, options)
116
116
  recurring_commit(:update, request)
@@ -395,8 +395,7 @@ module ActiveMerchant #:nodoc:
395
395
 
396
396
  Response.new(success, message, response,
397
397
  test: test_mode,
398
- authorization: response[:subscription_id]
399
- )
398
+ authorization: response[:subscription_id])
400
399
  end
401
400
 
402
401
  def recurring_parse(action, xml)
@@ -1,4 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
+
2
3
  module ActiveMerchant #:nodoc:
3
4
  module Billing #:nodoc:
4
5
  # ==== Customer Information Manager (CIM)
@@ -562,6 +563,8 @@ module ActiveMerchant #:nodoc:
562
563
 
563
564
  def build_get_customer_profile_request(xml, options)
564
565
  xml.tag!('customerProfileId', options[:customer_profile_id])
566
+ xml.tag!('unmaskExpirationDate', options[:unmask_expiration_date]) if options[:unmask_expiration_date]
567
+ xml.tag!('includeIssuerInfo', options[:include_issuer_info]) if options[:include_issuer_info]
565
568
  xml.target!
566
569
  end
567
570
 
@@ -573,6 +576,7 @@ module ActiveMerchant #:nodoc:
573
576
  xml.tag!('customerProfileId', options[:customer_profile_id])
574
577
  xml.tag!('customerPaymentProfileId', options[:customer_payment_profile_id])
575
578
  xml.tag!('unmaskExpirationDate', options[:unmask_expiration_date]) if options[:unmask_expiration_date]
579
+ xml.tag!('includeIssuerInfo', options[:include_issuer_info]) if options[:include_issuer_info]
576
580
  xml.target!
577
581
  end
578
582
 
@@ -878,7 +882,7 @@ module ActiveMerchant #:nodoc:
878
882
 
879
883
  def parse_direct_response(params)
880
884
  delimiter = @options[:delimiter] || ','
881
- direct_response = {'raw' => params}
885
+ direct_response = { 'raw' => params }
882
886
  direct_response_fields = params.split(delimiter)
883
887
  direct_response.merge(
884
888
  {