activemerchant 1.100.0 → 1.133.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (267) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +1057 -0
  3. data/README.md +11 -9
  4. data/lib/active_merchant/billing/avs_result.rb +9 -9
  5. data/lib/active_merchant/billing/base.rb +0 -13
  6. data/lib/active_merchant/billing/check.rb +49 -17
  7. data/lib/active_merchant/billing/compatibility.rb +5 -4
  8. data/lib/active_merchant/billing/credit_card.rb +55 -8
  9. data/lib/active_merchant/billing/credit_card_formatting.rb +1 -0
  10. data/lib/active_merchant/billing/credit_card_methods.rb +209 -36
  11. data/lib/active_merchant/billing/cvv_result.rb +0 -1
  12. data/lib/active_merchant/billing/gateway.rb +38 -36
  13. data/lib/active_merchant/billing/gateways/adyen.rb +399 -78
  14. data/lib/active_merchant/billing/gateways/airwallex.rb +370 -0
  15. data/lib/active_merchant/billing/gateways/alelo.rb +256 -0
  16. data/lib/active_merchant/billing/gateways/allied_wallet.rb +14 -14
  17. data/lib/active_merchant/billing/gateways/authorize_net.rb +200 -130
  18. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +27 -20
  19. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +48 -51
  20. data/lib/active_merchant/billing/gateways/axcessms.rb +13 -15
  21. data/lib/active_merchant/billing/gateways/balanced.rb +43 -36
  22. data/lib/active_merchant/billing/gateways/bambora_apac.rb +16 -20
  23. data/lib/active_merchant/billing/gateways/bank_frick.rb +13 -13
  24. data/lib/active_merchant/billing/gateways/banwire.rb +5 -5
  25. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +43 -30
  26. data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +1 -1
  27. data/lib/active_merchant/billing/gateways/be2bill.rb +5 -5
  28. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +37 -36
  29. data/lib/active_merchant/billing/gateways/beanstream.rb +21 -3
  30. data/lib/active_merchant/billing/gateways/beanstream_interac.rb +1 -1
  31. data/lib/active_merchant/billing/gateways/blue_pay.rb +53 -28
  32. data/lib/active_merchant/billing/gateways/blue_snap.rb +176 -54
  33. data/lib/active_merchant/billing/gateways/bogus.rb +24 -20
  34. data/lib/active_merchant/billing/gateways/borgun.rb +92 -38
  35. data/lib/active_merchant/billing/gateways/bpoint.rb +15 -15
  36. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +8 -2
  37. data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +113 -0
  38. data/lib/active_merchant/billing/gateways/braintree.rb +1 -1
  39. data/lib/active_merchant/billing/gateways/braintree_blue.rb +387 -175
  40. data/lib/active_merchant/billing/gateways/bridge_pay.rb +13 -13
  41. data/lib/active_merchant/billing/gateways/cams.rb +10 -10
  42. data/lib/active_merchant/billing/gateways/card_connect.rb +33 -14
  43. data/lib/active_merchant/billing/gateways/card_save.rb +3 -4
  44. data/lib/active_merchant/billing/gateways/card_stream.rb +67 -40
  45. data/lib/active_merchant/billing/gateways/cardknox.rb +13 -13
  46. data/lib/active_merchant/billing/gateways/cardprocess.rb +4 -2
  47. data/lib/active_merchant/billing/gateways/cashnet.rb +28 -12
  48. data/lib/active_merchant/billing/gateways/cc5.rb +9 -9
  49. data/lib/active_merchant/billing/gateways/cecabank.rb +38 -38
  50. data/lib/active_merchant/billing/gateways/cenpos.rb +29 -28
  51. data/lib/active_merchant/billing/gateways/checkout.rb +7 -9
  52. data/lib/active_merchant/billing/gateways/checkout_v2.rb +316 -68
  53. data/lib/active_merchant/billing/gateways/citrus_pay.rb +1 -2
  54. data/lib/active_merchant/billing/gateways/clearhaus.rb +32 -33
  55. data/lib/active_merchant/billing/gateways/commerce_hub.rb +370 -0
  56. data/lib/active_merchant/billing/gateways/commercegate.rb +4 -4
  57. data/lib/active_merchant/billing/gateways/conekta.rb +8 -6
  58. data/lib/active_merchant/billing/gateways/creditcall.rb +18 -17
  59. data/lib/active_merchant/billing/gateways/credorax.rb +152 -63
  60. data/lib/active_merchant/billing/gateways/ct_payment.rb +15 -14
  61. data/lib/active_merchant/billing/gateways/culqi.rb +30 -28
  62. data/lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb +36 -0
  63. data/lib/active_merchant/billing/gateways/cyber_source.rb +496 -187
  64. data/lib/active_merchant/billing/gateways/cyber_source_rest.rb +454 -0
  65. data/lib/active_merchant/billing/gateways/d_local.rb +148 -31
  66. data/lib/active_merchant/billing/gateways/data_cash.rb +34 -37
  67. data/lib/active_merchant/billing/gateways/decidir.rb +134 -21
  68. data/lib/active_merchant/billing/gateways/decidir_plus.rb +344 -0
  69. data/lib/active_merchant/billing/gateways/dibs.rb +10 -10
  70. data/lib/active_merchant/billing/gateways/digitzs.rb +11 -8
  71. data/lib/active_merchant/billing/gateways/ebanx.rb +90 -40
  72. data/lib/active_merchant/billing/gateways/efsnet.rb +36 -36
  73. data/lib/active_merchant/billing/gateways/elavon.rb +349 -194
  74. data/lib/active_merchant/billing/gateways/element.rb +71 -21
  75. data/lib/active_merchant/billing/gateways/epay.rb +43 -43
  76. data/lib/active_merchant/billing/gateways/evo_ca.rb +12 -13
  77. data/lib/active_merchant/billing/gateways/eway.rb +9 -9
  78. data/lib/active_merchant/billing/gateways/eway_managed.rb +55 -56
  79. data/lib/active_merchant/billing/gateways/eway_rapid.rb +37 -22
  80. data/lib/active_merchant/billing/gateways/exact.rb +19 -20
  81. data/lib/active_merchant/billing/gateways/ezic.rb +9 -9
  82. data/lib/active_merchant/billing/gateways/fat_zebra.rb +24 -19
  83. data/lib/active_merchant/billing/gateways/federated_canada.rb +6 -7
  84. data/lib/active_merchant/billing/gateways/finansbank.rb +3 -3
  85. data/lib/active_merchant/billing/gateways/first_giving.rb +5 -4
  86. data/lib/active_merchant/billing/gateways/first_pay.rb +7 -7
  87. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +39 -38
  88. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +51 -31
  89. data/lib/active_merchant/billing/gateways/flo2cash.rb +24 -24
  90. data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +1 -1
  91. data/lib/active_merchant/billing/gateways/forte.rb +38 -22
  92. data/lib/active_merchant/billing/gateways/garanti.rb +12 -15
  93. data/lib/active_merchant/billing/gateways/global_collect.rb +333 -89
  94. data/lib/active_merchant/billing/gateways/global_transport.rb +8 -9
  95. data/lib/active_merchant/billing/gateways/hdfc.rb +22 -23
  96. data/lib/active_merchant/billing/gateways/hps.rb +171 -50
  97. data/lib/active_merchant/billing/gateways/iats_payments.rb +47 -25
  98. data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +1 -1
  99. data/lib/active_merchant/billing/gateways/inspire.rb +22 -27
  100. data/lib/active_merchant/billing/gateways/instapay.rb +5 -8
  101. data/lib/active_merchant/billing/gateways/ipg.rb +420 -0
  102. data/lib/active_merchant/billing/gateways/ipp.rb +9 -9
  103. data/lib/active_merchant/billing/gateways/iridium.rb +30 -31
  104. data/lib/active_merchant/billing/gateways/itransact.rb +11 -10
  105. data/lib/active_merchant/billing/gateways/iveri.rb +62 -23
  106. data/lib/active_merchant/billing/gateways/ixopay.rb +320 -0
  107. data/lib/active_merchant/billing/gateways/jetpay.rb +10 -17
  108. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +13 -18
  109. data/lib/active_merchant/billing/gateways/komoju.rb +1 -1
  110. data/lib/active_merchant/billing/gateways/kushki.rb +100 -22
  111. data/lib/active_merchant/billing/gateways/latitude19.rb +20 -19
  112. data/lib/active_merchant/billing/gateways/linkpoint.rb +71 -72
  113. data/lib/active_merchant/billing/gateways/litle.rb +181 -45
  114. data/lib/active_merchant/billing/gateways/mastercard.rb +16 -22
  115. data/lib/active_merchant/billing/gateways/maxipago.rb +2 -2
  116. data/lib/active_merchant/billing/gateways/mercado_pago.rb +89 -18
  117. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +58 -24
  118. data/lib/active_merchant/billing/gateways/merchant_one.rb +7 -10
  119. data/lib/active_merchant/billing/gateways/merchant_partners.rb +19 -19
  120. data/lib/active_merchant/billing/gateways/merchant_ware.rb +18 -22
  121. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +15 -17
  122. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +46 -8
  123. data/lib/active_merchant/billing/gateways/mercury.rb +19 -23
  124. data/lib/active_merchant/billing/gateways/metrics_global.rb +24 -33
  125. data/lib/active_merchant/billing/gateways/micropayment.rb +11 -12
  126. data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -7
  127. data/lib/active_merchant/billing/gateways/migs.rb +18 -21
  128. data/lib/active_merchant/billing/gateways/mit.rb +260 -0
  129. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +10 -12
  130. data/lib/active_merchant/billing/gateways/moka.rb +290 -0
  131. data/lib/active_merchant/billing/gateways/monei.rb +236 -150
  132. data/lib/active_merchant/billing/gateways/moneris.rb +122 -53
  133. data/lib/active_merchant/billing/gateways/money_movers.rb +6 -7
  134. data/lib/active_merchant/billing/gateways/mundipagg.rb +69 -23
  135. data/lib/active_merchant/billing/gateways/nab_transact.rb +18 -20
  136. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +10 -12
  137. data/lib/active_merchant/billing/gateways/net_registry.rb +8 -9
  138. data/lib/active_merchant/billing/gateways/netaxept.rb +12 -12
  139. data/lib/active_merchant/billing/gateways/netbanx.rb +128 -46
  140. data/lib/active_merchant/billing/gateways/netbilling.rb +18 -21
  141. data/lib/active_merchant/billing/gateways/netpay.rb +5 -4
  142. data/lib/active_merchant/billing/gateways/network_merchants.rb +7 -10
  143. data/lib/active_merchant/billing/gateways/nmi.rb +69 -27
  144. data/lib/active_merchant/billing/gateways/ogone.rb +62 -31
  145. data/lib/active_merchant/billing/gateways/omise.rb +15 -16
  146. data/lib/active_merchant/billing/gateways/openpay.rb +33 -15
  147. data/lib/active_merchant/billing/gateways/opp.rb +39 -33
  148. data/lib/active_merchant/billing/gateways/optimal_payment.rb +43 -42
  149. data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +3 -5
  150. data/lib/active_merchant/billing/gateways/orbital.rb +623 -362
  151. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +20 -20
  152. data/lib/active_merchant/billing/gateways/pagarme.rb +16 -23
  153. data/lib/active_merchant/billing/gateways/pago_facil.rb +4 -6
  154. data/lib/active_merchant/billing/gateways/pay_arc.rb +392 -0
  155. data/lib/active_merchant/billing/gateways/pay_conex.rb +17 -17
  156. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +30 -33
  157. data/lib/active_merchant/billing/gateways/pay_hub.rb +10 -10
  158. data/lib/active_merchant/billing/gateways/pay_junction.rb +31 -31
  159. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +36 -18
  160. data/lib/active_merchant/billing/gateways/pay_secure.rb +10 -11
  161. data/lib/active_merchant/billing/gateways/pay_trace.rb +450 -0
  162. data/lib/active_merchant/billing/gateways/paybox_direct.rb +64 -40
  163. data/lib/active_merchant/billing/gateways/payeezy.rb +130 -27
  164. data/lib/active_merchant/billing/gateways/payex.rb +24 -25
  165. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +17 -17
  166. data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +1 -1
  167. data/lib/active_merchant/billing/gateways/payflow.rb +103 -25
  168. data/lib/active_merchant/billing/gateways/payflow_express.rb +4 -4
  169. data/lib/active_merchant/billing/gateways/payflow_uk.rb +1 -1
  170. data/lib/active_merchant/billing/gateways/payment_express.rb +22 -18
  171. data/lib/active_merchant/billing/gateways/paymentez.rb +89 -24
  172. data/lib/active_merchant/billing/gateways/paymill.rb +14 -16
  173. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +2 -1
  174. data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +4 -0
  175. data/lib/active_merchant/billing/gateways/paypal.rb +13 -5
  176. data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
  177. data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +1 -1
  178. data/lib/active_merchant/billing/gateways/paypal_express.rb +4 -1
  179. data/lib/active_merchant/billing/gateways/paypal_express_common.rb +1 -1
  180. data/lib/active_merchant/billing/gateways/paysafe.rb +420 -0
  181. data/lib/active_merchant/billing/gateways/payscout.rb +8 -9
  182. data/lib/active_merchant/billing/gateways/paystation.rb +6 -9
  183. data/lib/active_merchant/billing/gateways/payu_in.rb +20 -19
  184. data/lib/active_merchant/billing/gateways/payu_latam.rb +70 -37
  185. data/lib/active_merchant/billing/gateways/payway.rb +22 -22
  186. data/lib/active_merchant/billing/gateways/payway_dot_com.rb +253 -0
  187. data/lib/active_merchant/billing/gateways/pin.rb +60 -21
  188. data/lib/active_merchant/billing/gateways/plexo.rb +308 -0
  189. data/lib/active_merchant/billing/gateways/plugnpay.rb +20 -21
  190. data/lib/active_merchant/billing/gateways/priority.rb +392 -0
  191. data/lib/active_merchant/billing/gateways/pro_pay.rb +13 -14
  192. data/lib/active_merchant/billing/gateways/psigate.rb +29 -29
  193. data/lib/active_merchant/billing/gateways/psl_card.rb +7 -8
  194. data/lib/active_merchant/billing/gateways/qbms.rb +25 -26
  195. data/lib/active_merchant/billing/gateways/quantum.rb +9 -11
  196. data/lib/active_merchant/billing/gateways/quickbooks.rb +126 -39
  197. data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +98 -98
  198. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +19 -23
  199. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +3 -3
  200. data/lib/active_merchant/billing/gateways/quickpay.rb +0 -1
  201. data/lib/active_merchant/billing/gateways/qvalent.rb +36 -20
  202. data/lib/active_merchant/billing/gateways/rapyd.rb +319 -0
  203. data/lib/active_merchant/billing/gateways/reach.rb +277 -0
  204. data/lib/active_merchant/billing/gateways/realex.rb +42 -16
  205. data/lib/active_merchant/billing/gateways/redsys.rb +191 -86
  206. data/lib/active_merchant/billing/gateways/s5.rb +10 -9
  207. data/lib/active_merchant/billing/gateways/safe_charge.rb +70 -33
  208. data/lib/active_merchant/billing/gateways/sage.rb +19 -21
  209. data/lib/active_merchant/billing/gateways/sage_pay.rb +57 -57
  210. data/lib/active_merchant/billing/gateways/sallie_mae.rb +3 -4
  211. data/lib/active_merchant/billing/gateways/secure_net.rb +19 -26
  212. data/lib/active_merchant/billing/gateways/secure_pay.rb +24 -33
  213. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +18 -20
  214. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +4 -5
  215. data/lib/active_merchant/billing/gateways/securion_pay.rb +48 -7
  216. data/lib/active_merchant/billing/gateways/shift4.rb +345 -0
  217. data/lib/active_merchant/billing/gateways/simetrik.rb +368 -0
  218. data/lib/active_merchant/billing/gateways/skip_jack.rb +19 -19
  219. data/lib/active_merchant/billing/gateways/smart_ps.rb +26 -32
  220. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +24 -25
  221. data/lib/active_merchant/billing/gateways/spreedly_core.rb +27 -21
  222. data/lib/active_merchant/billing/gateways/stripe.rb +126 -53
  223. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +441 -113
  224. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +7 -8
  225. data/lib/active_merchant/billing/gateways/telr.rb +17 -18
  226. data/lib/active_merchant/billing/gateways/tns.rb +3 -7
  227. data/lib/active_merchant/billing/gateways/trans_first.rb +10 -9
  228. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +28 -24
  229. data/lib/active_merchant/billing/gateways/transact_pro.rb +13 -15
  230. data/lib/active_merchant/billing/gateways/transax.rb +1 -2
  231. data/lib/active_merchant/billing/gateways/trexle.rb +5 -2
  232. data/lib/active_merchant/billing/gateways/trust_commerce.rb +57 -47
  233. data/lib/active_merchant/billing/gateways/usa_epay.rb +1 -2
  234. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +176 -184
  235. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +60 -48
  236. data/lib/active_merchant/billing/gateways/vanco.rb +17 -8
  237. data/lib/active_merchant/billing/gateways/verifi.rb +13 -14
  238. data/lib/active_merchant/billing/gateways/viaklix.rb +9 -14
  239. data/lib/active_merchant/billing/gateways/visanet_peru.rb +26 -21
  240. data/lib/active_merchant/billing/gateways/vpos.rb +223 -0
  241. data/lib/active_merchant/billing/gateways/webpay.rb +4 -4
  242. data/lib/active_merchant/billing/gateways/wepay.rb +14 -16
  243. data/lib/active_merchant/billing/gateways/wirecard.rb +14 -16
  244. data/lib/active_merchant/billing/gateways/wompi.rb +197 -0
  245. data/lib/active_merchant/billing/gateways/world_net.rb +36 -35
  246. data/lib/active_merchant/billing/gateways/worldpay.rb +556 -190
  247. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +47 -54
  248. data/lib/active_merchant/billing/gateways/worldpay_us.rb +16 -16
  249. data/lib/active_merchant/billing/network_tokenization_credit_card.rb +2 -2
  250. data/lib/active_merchant/billing/response.rb +25 -6
  251. data/lib/active_merchant/billing/three_d_secure_eci_mapper.rb +27 -0
  252. data/lib/active_merchant/billing.rb +1 -0
  253. data/lib/active_merchant/connection.rb +14 -15
  254. data/lib/active_merchant/country.rb +3 -1
  255. data/lib/active_merchant/errors.rb +4 -1
  256. data/lib/active_merchant/net_http_ssl_connection.rb +1 -0
  257. data/lib/active_merchant/network_connection_retries.rb +15 -17
  258. data/lib/active_merchant/post_data.rb +3 -2
  259. data/lib/active_merchant/posts_data.rb +2 -2
  260. data/lib/active_merchant/version.rb +1 -1
  261. data/lib/active_merchant.rb +2 -2
  262. data/lib/certs/cacert.pem +1587 -2361
  263. data/lib/support/gateway_support.rb +1 -1
  264. data/lib/support/ssl_verify.rb +3 -7
  265. data/lib/support/ssl_version.rb +2 -3
  266. metadata +86 -34
  267. data/lib/active_merchant/billing/gateways/moneris_us.rb +0 -352
@@ -7,7 +7,7 @@ module ActiveMerchant #:nodoc:
7
7
  self.supported_countries = ['AR']
8
8
  self.money_format = :cents
9
9
  self.default_currency = 'ARS'
10
- self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :naranja, :cabal]
10
+ self.supported_cardtypes = %i[visa master american_express diners_club naranja cabal]
11
11
 
12
12
  self.homepage_url = 'http://www.decidir.com'
13
13
  self.display_name = 'Decidir'
@@ -37,17 +37,18 @@ module ActiveMerchant #:nodoc:
37
37
  56 => STANDARD_ERROR_CODE[:card_declined],
38
38
  57 => STANDARD_ERROR_CODE[:card_declined],
39
39
  76 => STANDARD_ERROR_CODE[:call_issuer],
40
+ 91 => STANDARD_ERROR_CODE[:call_issuer],
40
41
  96 => STANDARD_ERROR_CODE[:processing_error],
41
- 97 => STANDARD_ERROR_CODE[:processing_error],
42
+ 97 => STANDARD_ERROR_CODE[:processing_error]
42
43
  }
43
44
 
44
- def initialize(options={})
45
+ def initialize(options = {})
45
46
  requires!(options, :api_key)
46
47
  super
47
48
  @options[:preauth_mode] ||= false
48
49
  end
49
50
 
50
- def purchase(money, payment, options={})
51
+ def purchase(money, payment, options = {})
51
52
  raise ArgumentError, 'Purchase is not supported on Decidir gateways configured with the preauth_mode option' if @options[:preauth_mode]
52
53
 
53
54
  post = {}
@@ -55,7 +56,7 @@ module ActiveMerchant #:nodoc:
55
56
  commit(:post, 'payments', post)
56
57
  end
57
58
 
58
- def authorize(money, payment, options={})
59
+ def authorize(money, payment, options = {})
59
60
  raise ArgumentError, 'Authorize is not supported on Decidir gateways unless the preauth_mode option is enabled' unless @options[:preauth_mode]
60
61
 
61
62
  post = {}
@@ -63,7 +64,7 @@ module ActiveMerchant #:nodoc:
63
64
  commit(:post, 'payments', post)
64
65
  end
65
66
 
66
- def capture(money, authorization, options={})
67
+ def capture(money, authorization, options = {})
67
68
  raise ArgumentError, 'Capture is not supported on Decidir gateways unless the preauth_mode option is enabled' unless @options[:preauth_mode]
68
69
 
69
70
  post = {}
@@ -71,18 +72,23 @@ module ActiveMerchant #:nodoc:
71
72
  commit(:put, "payments/#{authorization}", post)
72
73
  end
73
74
 
74
- def refund(money, authorization, options={})
75
+ def refund(money, authorization, options = {})
75
76
  post = {}
76
77
  add_amount(post, money, options)
77
78
  commit(:post, "payments/#{authorization}/refunds", post)
78
79
  end
79
80
 
80
- def void(authorization, options={})
81
+ def void(authorization, options = {})
81
82
  post = {}
82
83
  commit(:post, "payments/#{authorization}/refunds", post)
83
84
  end
84
85
 
85
- def verify(credit_card, options={})
86
+ def inquire(authorization, options = {})
87
+ options[:action] = 'inquire'
88
+ commit(:get, "payments/#{authorization}", nil, options)
89
+ end
90
+
91
+ def verify(credit_card, options = {})
86
92
  raise ArgumentError, 'Verify is not supported on Decidir gateways unless the preauth_mode option is enabled' unless @options[:preauth_mode]
87
93
 
88
94
  MultiResponse.run(:use_first_response) do |r|
@@ -106,22 +112,42 @@ module ActiveMerchant #:nodoc:
106
112
  private
107
113
 
108
114
  def add_auth_purchase_params(post, money, credit_card, options)
109
- post[:payment_method_id] = add_payment_method_id(credit_card)
115
+ post[:payment_method_id] = add_payment_method_id(credit_card, options)
110
116
  post[:site_transaction_id] = options[:order_id]
111
117
  post[:bin] = credit_card.number[0..5]
112
118
  post[:payment_type] = options[:payment_type] || 'single'
113
119
  post[:installments] = options[:installments] ? options[:installments].to_i : 1
114
120
  post[:description] = options[:description] if options[:description]
115
121
  post[:email] = options[:email] if options[:email]
116
- post[:sub_payments] = []
122
+ post[:establishment_name] = options[:establishment_name] if options[:establishment_name]
123
+ post[:fraud_detection] = add_fraud_detection(options[:fraud_detection]) if options[:fraud_detection].present?
124
+ post[:site_id] = options[:site_id] if options[:site_id]
117
125
 
118
126
  add_invoice(post, money, options)
119
127
  add_payment(post, credit_card, options)
128
+ add_aggregate_data(post, options) if options[:aggregate_data]
129
+ add_sub_payments(post, options)
120
130
  end
121
131
 
122
- def add_payment_method_id(credit_card)
132
+ def add_payment_method_id(credit_card, options)
123
133
  if options[:payment_method_id]
124
134
  options[:payment_method_id].to_i
135
+ elsif options[:debit]
136
+ if CreditCard.brand?(credit_card.number) == 'visa'
137
+ 31
138
+ elsif CreditCard.brand?(credit_card.number) == 'master'
139
+ 105
140
+ elsif CreditCard.brand?(credit_card.number) == 'maestro'
141
+ 106
142
+ elsif CreditCard.brand?(credit_card.number) == 'cabal'
143
+ 108
144
+ end
145
+ elsif CreditCard.brand?(credit_card.number) == 'master'
146
+ 104
147
+ elsif CreditCard.brand?(credit_card.number) == 'american_express'
148
+ 65
149
+ elsif CreditCard.brand?(credit_card.number) == 'diners_club'
150
+ 8
125
151
  elsif CreditCard.brand?(credit_card.number) == 'cabal'
126
152
  63
127
153
  elsif CreditCard.brand?(credit_card.number) == 'naranja'
@@ -149,6 +175,12 @@ module ActiveMerchant #:nodoc:
149
175
  card_data[:security_code] = credit_card.verification_value if credit_card.verification_value?
150
176
  card_data[:card_holder_name] = credit_card.name if credit_card.name
151
177
 
178
+ # the device_unique_id has to be sent in via the card data (as device_unique_identifier) no other fraud detection fields require this
179
+ if options[:fraud_detection].present?
180
+ card_data[:fraud_detection] = {} if (options[:fraud_detection][:device_unique_id]).present?
181
+ card_data[:fraud_detection][:device_unique_identifier] = (options[:fraud_detection][:device_unique_id]) if (options[:fraud_detection][:device_unique_id]).present?
182
+ end
183
+
152
184
  # additional data used for Visa transactions
153
185
  card_data[:card_holder_door_number] = options[:card_holder_door_number].to_i if options[:card_holder_door_number]
154
186
  card_data[:card_holder_birthday] = options[:card_holder_birthday] if options[:card_holder_birthday]
@@ -160,6 +192,67 @@ module ActiveMerchant #:nodoc:
160
192
  post[:card_data] = card_data
161
193
  end
162
194
 
195
+ def add_aggregate_data(post, options)
196
+ aggregate_data = {}
197
+ data = options[:aggregate_data]
198
+ aggregate_data[:indicator] = data[:indicator] if data[:indicator]
199
+ aggregate_data[:identification_number] = data[:identification_number] if data[:identification_number]
200
+ aggregate_data[:bill_to_pay] = data[:bill_to_pay] if data[:bill_to_pay]
201
+ aggregate_data[:bill_to_refund] = data[:bill_to_refund] if data[:bill_to_refund]
202
+ aggregate_data[:merchant_name] = data[:merchant_name] if data[:merchant_name]
203
+ aggregate_data[:street] = data[:street] if data[:street]
204
+ aggregate_data[:number] = data[:number] if data[:number]
205
+ aggregate_data[:postal_code] = data[:postal_code] if data[:postal_code]
206
+ aggregate_data[:category] = data[:category] if data[:category]
207
+ aggregate_data[:channel] = data[:channel] if data[:channel]
208
+ aggregate_data[:geographic_code] = data[:geographic_code] if data[:geographic_code]
209
+ aggregate_data[:city] = data[:city] if data[:city]
210
+ aggregate_data[:merchant_id] = data[:merchant_id] if data[:merchant_id]
211
+ aggregate_data[:province] = data[:province] if data[:province]
212
+ aggregate_data[:country] = data[:country] if data[:country]
213
+ aggregate_data[:merchant_email] = data[:merchant_email] if data[:merchant_email]
214
+ aggregate_data[:merchant_phone] = data[:merchant_phone] if data[:merchant_phone]
215
+ post[:aggregate_data] = aggregate_data
216
+ end
217
+
218
+ def add_sub_payments(post, options)
219
+ # sub_payments field is required for purchase transactions, even if empty
220
+ post[:sub_payments] = []
221
+
222
+ return unless sub_payments = options[:sub_payments]
223
+
224
+ sub_payments.each do |sub_payment|
225
+ sub_payment_hash = {
226
+ site_id: sub_payment[:site_id],
227
+ installments: sub_payment[:installments].to_i,
228
+ amount: sub_payment[:amount].to_i
229
+ }
230
+ post[:sub_payments] << sub_payment_hash
231
+ end
232
+ end
233
+
234
+ def add_fraud_detection(options = {})
235
+ {}.tap do |hsh|
236
+ hsh[:send_to_cs] = options[:send_to_cs] if valid_fraud_detection_option?(options[:send_to_cs]) # true/false
237
+ hsh[:channel] = options[:channel] if valid_fraud_detection_option?(options[:channel])
238
+ hsh[:dispatch_method] = options[:dispatch_method] if valid_fraud_detection_option?(options[:dispatch_method])
239
+ hsh[:csmdds] = options[:csmdds] if valid_fraud_detection_option?(options[:csmdds])
240
+ hsh[:device_unique_id] = options[:device_unique_id] if valid_fraud_detection_option?(options[:device_unique_id])
241
+ hsh[:bill_to] = options[:bill_to] if valid_fraud_detection_option?(options[:bill_to])
242
+ hsh[:purchase_totals] = options[:purchase_totals] if valid_fraud_detection_option?(options[:purchase_totals])
243
+ hsh[:customer_in_site] = options[:customer_in_site] if valid_fraud_detection_option?(options[:customer_in_site])
244
+ hsh[:retail_transaction_data] = options[:retail_transaction_data] if valid_fraud_detection_option?(options[:retail_transaction_data])
245
+ hsh[:ship_to] = options[:ship_to] if valid_fraud_detection_option?(options[:ship_to])
246
+ hsh[:tax_voucher_required] = options[:tax_voucher_required] if valid_fraud_detection_option?(options[:tax_voucher_required])
247
+ hsh[:copy_paste_card_data] = options[:copy_paste_card_data] if valid_fraud_detection_option?(options[:copy_paste_card_data])
248
+ end
249
+ end
250
+
251
+ # Avoid sending fields with empty or null when not populated.
252
+ def valid_fraud_detection_option?(val)
253
+ !val.nil? && val != ''
254
+ end
255
+
163
256
  def headers(options = {})
164
257
  {
165
258
  'apikey' => @options[:api_key],
@@ -168,7 +261,7 @@ module ActiveMerchant #:nodoc:
168
261
  }
169
262
  end
170
263
 
171
- def commit(method, endpoint, parameters, options={})
264
+ def commit(method, endpoint, parameters, options = {})
172
265
  url = "#{(test? ? test_url : live_url)}/#{endpoint}"
173
266
 
174
267
  begin
@@ -179,7 +272,7 @@ module ActiveMerchant #:nodoc:
179
272
  response = parse(raw_response)
180
273
  end
181
274
 
182
- success = success_from(response)
275
+ success = success_from(response, options)
183
276
  Response.new(
184
277
  success,
185
278
  message_from(success, response),
@@ -191,7 +284,7 @@ module ActiveMerchant #:nodoc:
191
284
  end
192
285
 
193
286
  def post_data(parameters = {})
194
- parameters.to_json
287
+ parameters&.to_json
195
288
  end
196
289
 
197
290
  def parse(body)
@@ -207,21 +300,30 @@ module ActiveMerchant #:nodoc:
207
300
  return response['message'] if response['message']
208
301
 
209
302
  message = nil
210
-
211
303
  if error = response.dig('status_details', 'error')
212
- message = error.dig('reason', 'description')
304
+ message = "#{error.dig('reason', 'description')} | #{error['type']}"
213
305
  elsif response['error_type']
214
- if response['validation_errors']
306
+ if response['validation_errors'].is_a?(Array)
215
307
  message = response['validation_errors'].map { |errors| "#{errors['code']}: #{errors['param']}" }.join(', ')
308
+ elsif response['validation_errors'].is_a?(Hash)
309
+ errors = response['validation_errors'].map { |k, v| "#{k}: #{v}" }.join(', ')
310
+ message = "#{response['error_type']} - #{errors}"
216
311
  end
312
+
217
313
  message ||= response['error_type']
218
314
  end
219
315
 
220
316
  message
221
317
  end
222
318
 
223
- def success_from(response)
224
- response['status'] == 'approved' || response['status'] == 'pre_approved'
319
+ def success_from(response, options)
320
+ status = %w(approved pre_approved)
321
+
322
+ if options[:action] == 'inquire'
323
+ status.include?(response['status']) || response['status'] == 'rejected'
324
+ else
325
+ status.include?(response['status'])
326
+ end
225
327
  end
226
328
 
227
329
  def authorization_from(response)
@@ -232,10 +334,21 @@ module ActiveMerchant #:nodoc:
232
334
  error_code = nil
233
335
  if error = response.dig('status_details', 'error')
234
336
  code = error.dig('reason', 'id')
235
- error_code = STANDARD_ERROR_CODE_MAPPING[code]
337
+ standard_error_code = STANDARD_ERROR_CODE_MAPPING[code]
338
+ error_code = "#{code}, #{standard_error_code}"
236
339
  error_code ||= error['type']
237
340
  elsif response['error_type']
238
341
  error_code = response['error_type'] if response['validation_errors']
342
+ elsif response.dig('error', 'validation_errors')
343
+ error = response.dig('error')
344
+ validation_errors = error.dig('validation_errors', 0)
345
+ code = validation_errors['code'] if validation_errors && validation_errors['code']
346
+ param = validation_errors['param'] if validation_errors && validation_errors['param']
347
+ error_code = "#{error['error_type']} | #{code} | #{param}" if error['error_type']
348
+ elsif error = response.dig('error')
349
+ code = error.dig('reason', 'id')
350
+ standard_error_code = STANDARD_ERROR_CODE_MAPPING[code]
351
+ error_code = "#{code}, #{standard_error_code}"
239
352
  end
240
353
 
241
354
  error_code || STANDARD_ERROR_CODE[:processing_error]
@@ -0,0 +1,344 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ class DecidirPlusGateway < Gateway
4
+ self.test_url = 'https://developers.decidir.com/api/v2'
5
+ self.live_url = 'https://live.decidir.com/api/v2'
6
+
7
+ self.supported_countries = ['AR']
8
+ self.default_currency = 'ARS'
9
+ self.supported_cardtypes = %i[visa master american_express discover diners_club naranja cabal]
10
+
11
+ self.homepage_url = 'http://decidir.com.ar/home'
12
+ self.display_name = 'Decidir Plus'
13
+
14
+ def initialize(options = {})
15
+ requires!(options, :public_key, :private_key)
16
+ super
17
+ end
18
+
19
+ def purchase(money, payment, options = {})
20
+ post = {}
21
+ build_purchase_authorize_request(post, money, payment, options)
22
+
23
+ commit(:post, 'payments', post)
24
+ end
25
+
26
+ def authorize(money, payment, options = {})
27
+ post = {}
28
+ build_purchase_authorize_request(post, money, payment, options)
29
+
30
+ commit(:post, 'payments', post)
31
+ end
32
+
33
+ def capture(money, authorization, options = {})
34
+ post = {}
35
+ post[:amount] = money
36
+
37
+ commit(:put, "payments/#{add_reference(authorization)}", post)
38
+ end
39
+
40
+ def refund(money, authorization, options = {})
41
+ post = {}
42
+ post[:amount] = money
43
+
44
+ commit(:post, "payments/#{add_reference(authorization)}/refunds", post)
45
+ end
46
+
47
+ def void(authorization, options = {})
48
+ commit(:post, "payments/#{add_reference(authorization)}/refunds")
49
+ end
50
+
51
+ def verify(credit_card, options = {})
52
+ MultiResponse.run(:use_first_response) do |r|
53
+ r.process { store(credit_card, options) }
54
+ r.process { authorize(100, r.authorization, options) }
55
+ r.process(:ignore_result) { void(r.authorization, options) }
56
+ end
57
+ end
58
+
59
+ def store(payment, options = {})
60
+ post = {}
61
+ add_payment(post, payment, options)
62
+
63
+ commit(:post, 'tokens', post)
64
+ end
65
+
66
+ def unstore(customer_token)
67
+ commit(:delete, "cardtokens/#{customer_token}")
68
+ end
69
+
70
+ def supports_scrubbing?
71
+ true
72
+ end
73
+
74
+ def scrub(transcript)
75
+ transcript.
76
+ gsub(%r((Apikey: )\w+), '\1[FILTERED]').
77
+ gsub(%r(("card_number\\?"\s*:\s*\\?")[^"]*)i, '\1[FILTERED]').
78
+ gsub(%r(("security_code\\?"\s*:\s*\\?")[^"]*)i, '\1[FILTERED]')
79
+ end
80
+
81
+ private
82
+
83
+ def build_purchase_authorize_request(post, money, payment, options)
84
+ add_customer_data(post, options)
85
+ add_payment(post, payment, options)
86
+ add_purchase_data(post, money, payment, options)
87
+ add_fraud_detection(post, options)
88
+ end
89
+
90
+ def add_reference(authorization)
91
+ return unless authorization
92
+
93
+ authorization.split('|')[0]
94
+ end
95
+
96
+ def add_payment(post, payment, options = {})
97
+ if payment.is_a?(String)
98
+ token, bin = payment.split('|')
99
+ post[:token] = token
100
+ post[:bin] = bin
101
+ else
102
+ post[:card_number] = payment.number
103
+ post[:card_expiration_month] = format(payment.month, :two_digits)
104
+ post[:card_expiration_year] = format(payment.year, :two_digits)
105
+ post[:security_code] = payment.verification_value.to_s
106
+ post[:card_holder_name] = payment.name.empty? ? options[:name_override] : payment.name
107
+ post[:card_holder_identification] = {}
108
+ post[:card_holder_identification][:type] = options[:card_holder_identification_type] if options[:card_holder_identification_type]
109
+ post[:card_holder_identification][:number] = options[:card_holder_identification_number] if options[:card_holder_identification_number]
110
+
111
+ # additional data used for Visa transactions
112
+ post[:card_holder_door_number] = options[:card_holder_door_number].to_i if options[:card_holder_door_number]
113
+ post[:card_holder_birthday] = options[:card_holder_birthday] if options[:card_holder_birthday]
114
+ end
115
+ end
116
+
117
+ def add_customer_data(post, options = {})
118
+ return unless customer = options[:customer]
119
+
120
+ post[:customer] = {}
121
+ post[:customer][:id] = customer[:id] if customer[:id]
122
+ post[:customer][:email] = customer[:email] if customer[:email]
123
+ end
124
+
125
+ def add_purchase_data(post, money, payment, options = {})
126
+ post[:site_transaction_id] = options[:site_transaction_id] || SecureRandom.hex
127
+ post[:payment_method_id] = add_payment_method_id(options)
128
+ post[:amount] = money
129
+ post[:currency] = options[:currency] || self.default_currency
130
+ post[:installments] = options[:installments] || 1
131
+ post[:payment_type] = options[:payment_type] || 'single'
132
+ post[:establishment_name] = options[:establishment_name] if options[:establishment_name]
133
+
134
+ add_aggregate_data(post, options) if options[:aggregate_data]
135
+ add_sub_payments(post, options)
136
+ end
137
+
138
+ def add_aggregate_data(post, options)
139
+ aggregate_data = {}
140
+ data = options[:aggregate_data]
141
+ aggregate_data[:indicator] = data[:indicator] if data[:indicator]
142
+ aggregate_data[:identification_number] = data[:identification_number] if data[:identification_number]
143
+ aggregate_data[:bill_to_pay] = data[:bill_to_pay] if data[:bill_to_pay]
144
+ aggregate_data[:bill_to_refund] = data[:bill_to_refund] if data[:bill_to_refund]
145
+ aggregate_data[:merchant_name] = data[:merchant_name] if data[:merchant_name]
146
+ aggregate_data[:street] = data[:street] if data[:street]
147
+ aggregate_data[:number] = data[:number] if data[:number]
148
+ aggregate_data[:postal_code] = data[:postal_code] if data[:postal_code]
149
+ aggregate_data[:category] = data[:category] if data[:category]
150
+ aggregate_data[:channel] = data[:channel] if data[:channel]
151
+ aggregate_data[:geographic_code] = data[:geographic_code] if data[:geographic_code]
152
+ aggregate_data[:city] = data[:city] if data[:city]
153
+ aggregate_data[:merchant_id] = data[:merchant_id] if data[:merchant_id]
154
+ aggregate_data[:province] = data[:province] if data[:province]
155
+ aggregate_data[:country] = data[:country] if data[:country]
156
+ aggregate_data[:merchant_email] = data[:merchant_email] if data[:merchant_email]
157
+ aggregate_data[:merchant_phone] = data[:merchant_phone] if data[:merchant_phone]
158
+ post[:aggregate_data] = aggregate_data
159
+ end
160
+
161
+ def add_sub_payments(post, options)
162
+ # sub_payments field is required for purchase transactions, even if empty
163
+ post[:sub_payments] = []
164
+
165
+ return unless sub_payments = options[:sub_payments]
166
+
167
+ sub_payments.each do |sub_payment|
168
+ sub_payment_hash = {
169
+ site_id: sub_payment[:site_id],
170
+ installments: sub_payment[:installments].to_i,
171
+ amount: sub_payment[:amount].to_i
172
+ }
173
+ post[:sub_payments] << sub_payment_hash
174
+ end
175
+ end
176
+
177
+ def add_payment_method_id(options)
178
+ return options[:payment_method_id].to_i if options[:payment_method_id]
179
+
180
+ if options[:debit]
181
+ case options[:card_brand]
182
+ when 'visa'
183
+ 31
184
+ when 'master'
185
+ 105
186
+ when 'maestro'
187
+ 106
188
+ when 'cabal'
189
+ 108
190
+ else
191
+ 31
192
+ end
193
+ else
194
+ case options[:card_brand]
195
+ when 'visa'
196
+ 1
197
+ when 'master'
198
+ 104
199
+ when 'american_express'
200
+ 65
201
+ when 'american_express_prisma'
202
+ 111
203
+ when 'cabal'
204
+ 63
205
+ when 'diners_club'
206
+ 8
207
+ else
208
+ 1
209
+ end
210
+ end
211
+ end
212
+
213
+ def add_fraud_detection(post, options)
214
+ return unless fraud_detection = options[:fraud_detection]
215
+
216
+ {}.tap do |hsh|
217
+ hsh[:send_to_cs] = fraud_detection[:send_to_cs] == 'true' # true/false
218
+ hsh[:channel] = fraud_detection[:channel] if fraud_detection[:channel]
219
+ hsh[:dispatch_method] = fraud_detection[:dispatch_method] if fraud_detection[:dispatch_method]
220
+ add_csmdds(hsh, fraud_detection)
221
+
222
+ post[:fraud_detection] = hsh
223
+ end
224
+ end
225
+
226
+ def add_csmdds(hsh, fraud_detection)
227
+ return unless fraud_detection[:csmdds]
228
+
229
+ csmdds_arr = []
230
+ fraud_detection[:csmdds].each do |csmdds|
231
+ csmdds_hsh = {}
232
+ csmdds_hsh[:code] = csmdds[:code].to_i
233
+ csmdds_hsh[:description] = csmdds[:description]
234
+ csmdds_arr.append(csmdds_hsh)
235
+ end
236
+ hsh[:csmdds] = csmdds_arr unless csmdds_arr.empty?
237
+ end
238
+
239
+ def parse(body)
240
+ return {} if body.nil?
241
+
242
+ JSON.parse(body)
243
+ end
244
+
245
+ def commit(method, endpoint, parameters = {}, options = {})
246
+ begin
247
+ raw_response = ssl_request(method, url(endpoint), post_data(parameters), headers(endpoint))
248
+ response = parse(raw_response)
249
+ rescue ResponseError => e
250
+ raw_response = e.response.body
251
+ response = parse(raw_response)
252
+ end
253
+
254
+ Response.new(
255
+ success_from(response),
256
+ message_from(response),
257
+ response,
258
+ authorization: authorization_from(response),
259
+ avs_result: AVSResult.new(code: response['some_avs_response_key']),
260
+ cvv_result: CVVResult.new(response['some_cvv_response_key']),
261
+ test: test?,
262
+ error_code: error_code_from(response)
263
+ )
264
+ end
265
+
266
+ def headers(endpoint)
267
+ {
268
+ 'Content-Type' => 'application/json',
269
+ 'apikey' => endpoint == 'tokens' ? @options[:public_key] : @options[:private_key]
270
+ }
271
+ end
272
+
273
+ def url(action, options = {})
274
+ base_url = (test? ? test_url : live_url)
275
+
276
+ return "#{base_url}/#{action}"
277
+ end
278
+
279
+ def success_from(response)
280
+ response.dig('status') == 'approved' || response.dig('status') == 'active' || response.dig('status') == 'pre_approved' || response.empty?
281
+ end
282
+
283
+ def message_from(response)
284
+ return '' if response.empty?
285
+
286
+ rejected?(response) ? message_from_status_details(response) : response.dig('status') || error_message(response) || response.dig('message')
287
+ end
288
+
289
+ def authorization_from(response)
290
+ return nil unless response.dig('id') || response.dig('bin')
291
+
292
+ "#{response.dig('id')}|#{response.dig('bin')}"
293
+ end
294
+
295
+ def post_data(parameters = {})
296
+ parameters.to_json
297
+ end
298
+
299
+ def error_code_from(response)
300
+ return if success_from(response)
301
+
302
+ error_code = nil
303
+ if error = response.dig('status_details', 'error')
304
+ error_code = error.dig('reason', 'id') || error['type']
305
+ elsif response['error_type']
306
+ error_code = response['error_type']
307
+ elsif response.dig('error', 'validation_errors')
308
+ error = response.dig('error')
309
+ validation_errors = error.dig('validation_errors', 0)
310
+ code = validation_errors['code'] if validation_errors && validation_errors['code']
311
+ param = validation_errors['param'] if validation_errors && validation_errors['param']
312
+ error_code = "#{error['error_type']} | #{code} | #{param}" if error['error_type']
313
+ elsif error = response.dig('error')
314
+ error_code = error.dig('reason', 'id')
315
+ end
316
+
317
+ error_code
318
+ end
319
+
320
+ def error_message(response)
321
+ return error_code_from(response) unless validation_errors = response.dig('validation_errors')
322
+
323
+ validation_errors = validation_errors[0]
324
+
325
+ "#{validation_errors.dig('code')}: #{validation_errors.dig('param')}"
326
+ end
327
+
328
+ def rejected?(response)
329
+ return response.dig('status') == 'rejected'
330
+ end
331
+
332
+ def message_from_status_details(response)
333
+ return unless error = response.dig('status_details', 'error')
334
+ return message_from_fraud_detection(response) if error.dig('type') == 'cybersource_error'
335
+
336
+ "#{error.dig('type')}: #{error.dig('reason', 'description')}"
337
+ end
338
+
339
+ def message_from_fraud_detection(response)
340
+ return error_message(response.dig('fraud_detection', 'status', 'details'))
341
+ end
342
+ end
343
+ end
344
+ end