activemerchant 1.133.0 → 1.137.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (183) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +240 -0
  3. data/lib/active_merchant/billing/check.rb +2 -2
  4. data/lib/active_merchant/billing/compatibility.rb +4 -4
  5. data/lib/active_merchant/billing/credit_card.rb +11 -8
  6. data/lib/active_merchant/billing/credit_card_formatting.rb +4 -0
  7. data/lib/active_merchant/billing/credit_card_methods.rb +59 -6
  8. data/lib/active_merchant/billing/gateway.rb +9 -0
  9. data/lib/active_merchant/billing/gateways/adyen.rb +162 -43
  10. data/lib/active_merchant/billing/gateways/airwallex.rb +26 -12
  11. data/lib/active_merchant/billing/gateways/alelo.rb +23 -5
  12. data/lib/active_merchant/billing/gateways/authorize_net.rb +43 -35
  13. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +10 -6
  14. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +1 -3
  15. data/lib/active_merchant/billing/gateways/axcessms.rb +6 -2
  16. data/lib/active_merchant/billing/gateways/banwire.rb +4 -2
  17. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +7 -3
  18. data/lib/active_merchant/billing/gateways/blue_pay.rb +13 -5
  19. data/lib/active_merchant/billing/gateways/blue_snap.rb +5 -5
  20. data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +65 -20
  21. data/lib/active_merchant/billing/gateways/braintree_blue.rb +226 -73
  22. data/lib/active_merchant/billing/gateways/braintree_orange.rb +1 -1
  23. data/lib/active_merchant/billing/gateways/card_connect.rb +5 -2
  24. data/lib/active_merchant/billing/gateways/card_stream.rb +4 -6
  25. data/lib/active_merchant/billing/gateways/cashnet.rb +1 -1
  26. data/lib/active_merchant/billing/gateways/cecabank/cecabank_common.rb +36 -0
  27. data/lib/active_merchant/billing/gateways/cecabank/cecabank_json.rb +316 -0
  28. data/lib/active_merchant/billing/gateways/cecabank/cecabank_xml.rb +220 -0
  29. data/lib/active_merchant/billing/gateways/cecabank.rb +7 -240
  30. data/lib/active_merchant/billing/gateways/checkout_v2.rb +238 -34
  31. data/lib/active_merchant/billing/gateways/commerce_hub.rb +63 -6
  32. data/lib/active_merchant/billing/gateways/credorax.rb +3 -5
  33. data/lib/active_merchant/billing/gateways/cyber_source.rb +185 -47
  34. data/lib/active_merchant/billing/gateways/cyber_source_rest.rb +102 -58
  35. data/lib/active_merchant/billing/gateways/d_local.rb +26 -15
  36. data/lib/active_merchant/billing/gateways/data_cash.rb +21 -17
  37. data/lib/active_merchant/billing/gateways/datatrans.rb +279 -0
  38. data/lib/active_merchant/billing/gateways/decidir.rb +53 -18
  39. data/lib/active_merchant/billing/gateways/decidir_plus.rb +4 -1
  40. data/lib/active_merchant/billing/gateways/deepstack.rb +382 -0
  41. data/lib/active_merchant/billing/gateways/ebanx.rb +40 -36
  42. data/lib/active_merchant/billing/gateways/efsnet.rb +6 -2
  43. data/lib/active_merchant/billing/gateways/elavon.rb +99 -33
  44. data/lib/active_merchant/billing/gateways/element.rb +36 -7
  45. data/lib/active_merchant/billing/gateways/epay.rb +6 -2
  46. data/lib/active_merchant/billing/gateways/evo_ca.rb +6 -2
  47. data/lib/active_merchant/billing/gateways/eway.rb +4 -2
  48. data/lib/active_merchant/billing/gateways/eway_managed.rb +6 -2
  49. data/lib/active_merchant/billing/gateways/exact.rb +6 -2
  50. data/lib/active_merchant/billing/gateways/fat_zebra.rb +31 -3
  51. data/lib/active_merchant/billing/gateways/federated_canada.rb +6 -2
  52. data/lib/active_merchant/billing/gateways/first_pay/first_pay_common.rb +15 -0
  53. data/lib/active_merchant/billing/gateways/first_pay/first_pay_json.rb +190 -0
  54. data/lib/active_merchant/billing/gateways/first_pay/first_pay_xml.rb +183 -0
  55. data/lib/active_merchant/billing/gateways/first_pay.rb +6 -172
  56. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +6 -2
  57. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +7 -3
  58. data/lib/active_merchant/billing/gateways/flex_charge.rb +347 -0
  59. data/lib/active_merchant/billing/gateways/garanti.rb +4 -2
  60. data/lib/active_merchant/billing/gateways/global_collect.rb +45 -37
  61. data/lib/active_merchant/billing/gateways/hi_pay.rb +286 -0
  62. data/lib/active_merchant/billing/gateways/hps.rb +1 -1
  63. data/lib/active_merchant/billing/gateways/iats_payments.rb +7 -2
  64. data/lib/active_merchant/billing/gateways/inspire.rb +6 -4
  65. data/lib/active_merchant/billing/gateways/instapay.rb +7 -4
  66. data/lib/active_merchant/billing/gateways/ipg.rb +9 -5
  67. data/lib/active_merchant/billing/gateways/iridium.rb +15 -5
  68. data/lib/active_merchant/billing/gateways/itransact.rb +6 -2
  69. data/lib/active_merchant/billing/gateways/iveri.rb +3 -3
  70. data/lib/active_merchant/billing/gateways/ixopay.rb +2 -2
  71. data/lib/active_merchant/billing/gateways/jetpay.rb +4 -2
  72. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +4 -2
  73. data/lib/active_merchant/billing/gateways/kushki.rb +72 -12
  74. data/lib/active_merchant/billing/gateways/linkpoint.rb +6 -2
  75. data/lib/active_merchant/billing/gateways/litle.rb +33 -50
  76. data/lib/active_merchant/billing/gateways/mastercard.rb +4 -4
  77. data/lib/active_merchant/billing/gateways/maxipago.rb +2 -2
  78. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +8 -5
  79. data/lib/active_merchant/billing/gateways/merchant_ware.rb +11 -4
  80. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +11 -4
  81. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +19 -3
  82. data/lib/active_merchant/billing/gateways/mercury.rb +6 -2
  83. data/lib/active_merchant/billing/gateways/metrics_global.rb +8 -6
  84. data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +1 -0
  85. data/lib/active_merchant/billing/gateways/migs.rb +6 -2
  86. data/lib/active_merchant/billing/gateways/mit.rb +8 -3
  87. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +18 -10
  88. data/lib/active_merchant/billing/gateways/monei.rb +1 -1
  89. data/lib/active_merchant/billing/gateways/moneris.rb +9 -3
  90. data/lib/active_merchant/billing/gateways/money_movers.rb +6 -2
  91. data/lib/active_merchant/billing/gateways/nab_transact.rb +12 -4
  92. data/lib/active_merchant/billing/gateways/net_registry.rb +6 -2
  93. data/lib/active_merchant/billing/gateways/netbanx.rb +1 -3
  94. data/lib/active_merchant/billing/gateways/netbilling.rb +6 -2
  95. data/lib/active_merchant/billing/gateways/network_merchants.rb +6 -2
  96. data/lib/active_merchant/billing/gateways/nmi.rb +18 -6
  97. data/lib/active_merchant/billing/gateways/ogone.rb +6 -2
  98. data/lib/active_merchant/billing/gateways/openpay.rb +4 -2
  99. data/lib/active_merchant/billing/gateways/opp.rb +1 -2
  100. data/lib/active_merchant/billing/gateways/optimal_payment.rb +6 -2
  101. data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +1 -3
  102. data/lib/active_merchant/billing/gateways/orbital.rb +83 -24
  103. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +7 -4
  104. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +6 -2
  105. data/lib/active_merchant/billing/gateways/pay_hub.rb +4 -2
  106. data/lib/active_merchant/billing/gateways/pay_junction.rb +6 -2
  107. data/lib/active_merchant/billing/gateways/pay_secure.rb +6 -2
  108. data/lib/active_merchant/billing/gateways/pay_trace.rb +31 -18
  109. data/lib/active_merchant/billing/gateways/payeezy.rb +19 -8
  110. data/lib/active_merchant/billing/gateways/payex.rb +4 -2
  111. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +1 -1
  112. data/lib/active_merchant/billing/gateways/payflow.rb +1 -3
  113. data/lib/active_merchant/billing/gateways/payment_express.rb +8 -4
  114. data/lib/active_merchant/billing/gateways/paymentez.rb +23 -11
  115. data/lib/active_merchant/billing/gateways/paysafe.rb +12 -11
  116. data/lib/active_merchant/billing/gateways/payscout.rb +7 -4
  117. data/lib/active_merchant/billing/gateways/paystation.rb +7 -3
  118. data/lib/active_merchant/billing/gateways/payway.rb +6 -2
  119. data/lib/active_merchant/billing/gateways/payway_dot_com.rb +2 -2
  120. data/lib/active_merchant/billing/gateways/pin.rb +22 -4
  121. data/lib/active_merchant/billing/gateways/plexo.rb +49 -10
  122. data/lib/active_merchant/billing/gateways/plugnpay.rb +6 -2
  123. data/lib/active_merchant/billing/gateways/priority.rb +6 -5
  124. data/lib/active_merchant/billing/gateways/psigate.rb +6 -2
  125. data/lib/active_merchant/billing/gateways/psl_card.rb +6 -2
  126. data/lib/active_merchant/billing/gateways/qbms.rb +6 -2
  127. data/lib/active_merchant/billing/gateways/quantum.rb +6 -2
  128. data/lib/active_merchant/billing/gateways/quickbooks.rb +6 -5
  129. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +7 -4
  130. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +6 -2
  131. data/lib/active_merchant/billing/gateways/rapyd.rb +148 -46
  132. data/lib/active_merchant/billing/gateways/reach.rb +11 -4
  133. data/lib/active_merchant/billing/gateways/redsys.rb +2 -10
  134. data/lib/active_merchant/billing/gateways/redsys_rest.rb +507 -0
  135. data/lib/active_merchant/billing/gateways/s5.rb +3 -3
  136. data/lib/active_merchant/billing/gateways/safe_charge.rb +36 -16
  137. data/lib/active_merchant/billing/gateways/sage.rb +12 -4
  138. data/lib/active_merchant/billing/gateways/sage_pay.rb +79 -5
  139. data/lib/active_merchant/billing/gateways/sallie_mae.rb +6 -2
  140. data/lib/active_merchant/billing/gateways/secure_net.rb +6 -2
  141. data/lib/active_merchant/billing/gateways/secure_pay.rb +8 -6
  142. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +12 -4
  143. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +6 -2
  144. data/lib/active_merchant/billing/gateways/securion_pay.rb +24 -10
  145. data/lib/active_merchant/billing/gateways/shift4.rb +17 -20
  146. data/lib/active_merchant/billing/gateways/shift4_v2.rb +117 -0
  147. data/lib/active_merchant/billing/gateways/simetrik.rb +17 -11
  148. data/lib/active_merchant/billing/gateways/skip_jack.rb +6 -2
  149. data/lib/active_merchant/billing/gateways/smart_ps.rb +7 -4
  150. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +4 -2
  151. data/lib/active_merchant/billing/gateways/spreedly_core.rb +2 -4
  152. data/lib/active_merchant/billing/gateways/stripe.rb +53 -21
  153. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +199 -50
  154. data/lib/active_merchant/billing/gateways/sum_up.rb +223 -0
  155. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +4 -2
  156. data/lib/active_merchant/billing/gateways/telr.rb +3 -4
  157. data/lib/active_merchant/billing/gateways/trans_first.rb +1 -2
  158. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +8 -16
  159. data/lib/active_merchant/billing/gateways/transact_pro.rb +1 -1
  160. data/lib/active_merchant/billing/gateways/trust_commerce.rb +6 -2
  161. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +9 -8
  162. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +6 -2
  163. data/lib/active_merchant/billing/gateways/vanco.rb +2 -4
  164. data/lib/active_merchant/billing/gateways/vantiv_express.rb +587 -0
  165. data/lib/active_merchant/billing/gateways/verifi.rb +6 -2
  166. data/lib/active_merchant/billing/gateways/viaklix.rb +6 -2
  167. data/lib/active_merchant/billing/gateways/visanet_peru.rb +2 -2
  168. data/lib/active_merchant/billing/gateways/vpos.rb +3 -3
  169. data/lib/active_merchant/billing/gateways/wirecard.rb +7 -3
  170. data/lib/active_merchant/billing/gateways/wompi.rb +5 -0
  171. data/lib/active_merchant/billing/gateways/worldpay.rb +140 -73
  172. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +13 -10
  173. data/lib/active_merchant/billing/gateways/xpay.rb +242 -0
  174. data/lib/active_merchant/billing/network_tokenization_credit_card.rb +1 -1
  175. data/lib/active_merchant/billing/response.rb +2 -2
  176. data/lib/active_merchant/connection.rb +3 -17
  177. data/lib/active_merchant/country.rb +1 -0
  178. data/lib/active_merchant/errors.rb +10 -0
  179. data/lib/active_merchant/version.rb +1 -1
  180. data/lib/support/gateway_support.rb +2 -2
  181. data/lib/support/ssl_verify.rb +4 -4
  182. data/lib/support/ssl_version.rb +6 -6
  183. metadata +30 -9
@@ -0,0 +1,242 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ class XpayGateway < Gateway
4
+ self.display_name = 'XPay Gateway'
5
+ self.homepage_url = 'https://developer.nexi.it/en'
6
+
7
+ self.test_url = 'https://xpaysandbox.nexigroup.com/api/phoenix-0.0/psp/api/v1/'
8
+ self.live_url = 'https://xpay.nexigroup.com/api/phoenix-0.0/psp/api/v1/'
9
+
10
+ self.supported_countries = %w(AT BE CY EE FI FR DE GR IE IT LV LT LU MT PT SK SI ES BG HR DK NO PL RO RO SE CH HU)
11
+ self.default_currency = 'EUR'
12
+ self.currencies_without_fractions = %w(BGN HRK DKK NOK GBP PLN CZK RON SEK CHF HUF)
13
+ self.money_format = :cents
14
+ self.supported_cardtypes = %i[visa master maestro american_express jcb]
15
+
16
+ ENDPOINTS_MAPPING = {
17
+ validation: 'orders/3steps/validation',
18
+ purchase: 'orders/3steps/payment',
19
+ authorize: 'orders/3steps/payment',
20
+ preauth: 'orders/3steps/init',
21
+ capture: 'operations/%s/captures',
22
+ verify: 'orders/card_verification',
23
+ refund: 'operations/%s/refunds'
24
+ }
25
+
26
+ SUCCESS_MESSAGES = %w(PENDING AUTHORIZED THREEDS_VALIDATED EXECUTED).freeze
27
+
28
+ def initialize(options = {})
29
+ requires!(options, :api_key)
30
+ @api_key = options[:api_key]
31
+ super
32
+ end
33
+
34
+ def preauth(amount, credit_card, options = {})
35
+ order_request(:preauth, amount, {}, credit_card, options)
36
+ end
37
+
38
+ def purchase(amount, credit_card, options = {})
39
+ complete_order_request(:purchase, amount, credit_card, options)
40
+ end
41
+
42
+ def authorize(amount, credit_card, options = {})
43
+ complete_order_request(:authorize, amount, credit_card, options)
44
+ end
45
+
46
+ def capture(amount, authorization, options = {})
47
+ operation_request(:capture, amount, authorization, options)
48
+ end
49
+
50
+ def refund(amount, authorization, options = {})
51
+ operation_request(:refund, amount, authorization, options)
52
+ end
53
+
54
+ def verify(credit_card, options = {})
55
+ post = {}
56
+ add_invoice(post, 0, options)
57
+ add_customer_data(post, credit_card, options)
58
+ add_credit_card(post, credit_card)
59
+ commit(:verify, post, options)
60
+ end
61
+
62
+ def supports_scrubbing?
63
+ true
64
+ end
65
+
66
+ def scrub(transcript)
67
+ transcript.
68
+ gsub(%r((X-Api-Key: )(\w|-)+), '\1[FILTERED]').
69
+ gsub(%r(("pan\\?"\s*:\s*\\?")[^"]*)i, '\1[FILTERED]').
70
+ gsub(%r(("cvv\\?":\\?")\d+), '\1[FILTERED]')
71
+ end
72
+
73
+ private
74
+
75
+ def validation(options = {})
76
+ post = {}
77
+ add_3ds_validation_params(post, options)
78
+ commit(:validation, post, options)
79
+ end
80
+
81
+ def complete_order_request(action, amount, credit_card, options = {})
82
+ MultiResponse.run do |r|
83
+ r.process { validation(options) }
84
+ r.process { order_request(action, amount, { captureType: (action == :authorize ? 'EXPLICIT' : 'IMPLICIT') }, credit_card, options.merge!(validation: r.params)) }
85
+ end
86
+ end
87
+
88
+ def order_request(action, amount, post, credit_card, options = {})
89
+ add_invoice(post, amount, options)
90
+ add_credit_card(post, credit_card)
91
+ add_customer_data(post, credit_card, options)
92
+ add_address(post, options)
93
+ add_recurrence(post, options) unless options[:operation_id]
94
+ add_exemptions(post, options)
95
+ add_3ds_params(post, options[:validation]) if options[:validation]
96
+
97
+ commit(action, post, options)
98
+ end
99
+
100
+ def operation_request(action, amount, authorization, options)
101
+ options[:correlation_id], options[:reference] = authorization.split('#')
102
+ commit(action, { amount: amount, currency: options[:currency] }, options)
103
+ end
104
+
105
+ def add_invoice(post, amount, options)
106
+ currency = options[:currency] || currency(amount)
107
+ post[:order] = {
108
+ orderId: options[:order_id],
109
+ amount: localized_amount(amount, currency),
110
+ currency: currency
111
+ }.compact
112
+ end
113
+
114
+ def add_credit_card(post, credit_card)
115
+ post[:card] = {
116
+ pan: credit_card.number,
117
+ expiryDate: expdate(credit_card),
118
+ cvv: credit_card.verification_value
119
+ }
120
+ end
121
+
122
+ def add_customer_data(post, credit_card, options)
123
+ post[:order][:customerInfo] = {
124
+ cardHolderName: credit_card.name,
125
+ cardHolderEmail: options[:email]
126
+ }.compact
127
+ end
128
+
129
+ def add_address(post, options)
130
+ if address = options[:billing_address] || options[:address]
131
+ post[:order][:customerInfo][:billingAddress] = {
132
+ name: address[:name],
133
+ street: address[:address1],
134
+ additionalInfo: address[:address2],
135
+ city: address[:city],
136
+ postCode: address[:zip],
137
+ country: address[:country]
138
+ }.compact
139
+ end
140
+
141
+ if address = options[:shipping_address]
142
+ post[:order][:customerInfo][:shippingAddress] = {
143
+ name: address[:name],
144
+ street: address[:address1],
145
+ additionalInfo: address[:address2],
146
+ city: address[:city],
147
+ postCode: address[:zip],
148
+ country: address[:country]
149
+ }.compact
150
+ end
151
+ end
152
+
153
+ def add_recurrence(post, options)
154
+ post[:recurrence] = { action: options[:recurrence] || 'NO_RECURRING' }
155
+ end
156
+
157
+ def add_exemptions(post, options)
158
+ post[:exemptions] = options[:exemptions] || 'NO_PREFERENCE'
159
+ end
160
+
161
+ def add_3ds_params(post, validation)
162
+ post[:threeDSAuthData] = {
163
+ authenticationValue: validation['threeDSAuthResult']['authenticationValue'],
164
+ eci: validation['threeDSAuthResult']['eci'],
165
+ xid: validation['threeDSAuthResult']['xid']
166
+ }
167
+ post[:operationId] = validation['operation']['operationId']
168
+ end
169
+
170
+ def add_3ds_validation_params(post, options)
171
+ post[:operationId] = options[:operation_id]
172
+ post[:threeDSAuthResponse] = options[:three_ds_auth_response]
173
+ end
174
+
175
+ def parse(body)
176
+ JSON.parse(body)
177
+ end
178
+
179
+ def commit(action, params, options)
180
+ options[:correlation_id] ||= SecureRandom.uuid
181
+ transaction_id = transaction_id_from(params, options, action)
182
+ raw_response =
183
+ begin
184
+ url = build_request_url(action, transaction_id)
185
+ ssl_post(url, params.to_json, request_headers(options, action))
186
+ rescue ResponseError => e
187
+ { errors: [code: e.response.code, description: e.response.body] }.to_json
188
+ end
189
+ response = parse(raw_response)
190
+
191
+ Response.new(
192
+ success_from(action, response),
193
+ message_from(response),
194
+ response,
195
+ authorization: authorization_from(options[:correlation_id], response),
196
+ test: test?,
197
+ error_code: error_code_from(response)
198
+ )
199
+ end
200
+
201
+ def request_headers(options, action = nil)
202
+ headers = { 'X-Api-Key' => @api_key, 'Content-Type' => 'application/json', 'Correlation-Id' => options[:correlation_id] }
203
+ headers.merge!('Idempotency-Key' => options[:idempotency_key] || SecureRandom.uuid) if %i[capture refund].include?(action)
204
+ headers
205
+ end
206
+
207
+ def transaction_id_from(params, options, action = nil)
208
+ case action
209
+ when :refund, :capture
210
+ return options[:reference]
211
+ else
212
+ return params[:operation_id]
213
+ end
214
+ end
215
+
216
+ def build_request_url(action, id = nil)
217
+ "#{test? ? test_url : live_url}#{ENDPOINTS_MAPPING[action.to_sym] % id}"
218
+ end
219
+
220
+ def success_from(action, response)
221
+ case action
222
+ when :capture, :refund
223
+ response.include?('operationId') && response.include?('operationTime')
224
+ else
225
+ SUCCESS_MESSAGES.include?(response.dig('operation', 'operationResult'))
226
+ end
227
+ end
228
+
229
+ def message_from(response)
230
+ response['operationId'] || response.dig('operation', 'operationResult') || response.dig('errors', 0, 'description')
231
+ end
232
+
233
+ def authorization_from(correlation_id, response = {})
234
+ [correlation_id, (response['operationId'] || response.dig('operation', 'operationId'))].join('#')
235
+ end
236
+
237
+ def error_code_from(response)
238
+ response.dig('errors', 0, 'code')
239
+ end
240
+ end
241
+ end
242
+ end
@@ -14,7 +14,7 @@ module ActiveMerchant #:nodoc:
14
14
  self.require_verification_value = false
15
15
  self.require_name = false
16
16
 
17
- attr_accessor :payment_cryptogram, :eci, :transaction_id, :metadata
17
+ attr_accessor :payment_cryptogram, :eci, :transaction_id, :metadata, :payment_data
18
18
  attr_writer :source
19
19
 
20
20
  SOURCES = %i(apple_pay android_pay google_pay network_token)
@@ -100,11 +100,11 @@ module ActiveMerchant #:nodoc:
100
100
  end
101
101
 
102
102
  %w(params message test authorization error_code emv_authorization test? fraud_review?).each do |m|
103
- class_eval %(
103
+ class_eval <<~RUBY, __FILE__, __LINE__ + 1
104
104
  def #{m}
105
105
  (@responses.empty? ? nil : primary_response.#{m})
106
106
  end
107
- )
107
+ RUBY
108
108
  end
109
109
  end
110
110
  end
@@ -18,27 +18,13 @@ module ActiveMerchant
18
18
  RETRY_SAFE = false
19
19
  RUBY_184_POST_HEADERS = { 'Content-Type' => 'application/x-www-form-urlencoded' }
20
20
 
21
- attr_accessor :endpoint
22
- attr_accessor :open_timeout
23
- attr_accessor :read_timeout
24
- attr_accessor :verify_peer
25
- attr_accessor :ssl_version
21
+ attr_accessor :endpoint, :open_timeout, :read_timeout, :verify_peer, :ssl_version, :ca_file, :ca_path, :pem, :pem_password, :logger, :tag, :ignore_http_status, :max_retries, :proxy_address, :proxy_port
22
+
26
23
  if Net::HTTP.instance_methods.include?(:min_version=)
27
24
  attr_accessor :min_version
28
25
  attr_accessor :max_version
29
26
  end
30
- attr_reader :ssl_connection
31
- attr_accessor :ca_file
32
- attr_accessor :ca_path
33
- attr_accessor :pem
34
- attr_accessor :pem_password
35
- attr_reader :wiredump_device
36
- attr_accessor :logger
37
- attr_accessor :tag
38
- attr_accessor :ignore_http_status
39
- attr_accessor :max_retries
40
- attr_accessor :proxy_address
41
- attr_accessor :proxy_port
27
+ attr_reader :ssl_connection, :wiredump_device
42
28
 
43
29
  def initialize(endpoint)
44
30
  @endpoint = endpoint.is_a?(URI) ? endpoint : URI.parse(endpoint)
@@ -9,6 +9,7 @@ module ActiveMerchant #:nodoc:
9
9
 
10
10
  class CountryCode
11
11
  attr_reader :value, :format
12
+
12
13
  def initialize(value)
13
14
  @value = value.to_s.upcase
14
15
  detect_format
@@ -23,6 +23,16 @@ module ActiveMerchant #:nodoc:
23
23
  end
24
24
 
25
25
  def to_s
26
+ if response.kind_of?(String)
27
+ if response.start_with?('Failed')
28
+ return response
29
+ else
30
+ return "Failed with #{response}"
31
+ end
32
+ end
33
+
34
+ return response.message if response.respond_to?(:message) && response.message.start_with?('Failed')
35
+
26
36
  "Failed with #{response.code if response.respond_to?(:code)} #{response.message if response.respond_to?(:message)}"
27
37
  end
28
38
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveMerchant
2
- VERSION = '1.133.0'
2
+ VERSION = '1.137.0'
3
3
  end
@@ -23,8 +23,8 @@ class GatewaySupport #:nodoc:
23
23
  @gateways.delete(ActiveMerchant::Billing::BogusGateway)
24
24
  end
25
25
 
26
- def each_gateway
27
- @gateways.each { |g| yield g }
26
+ def each_gateway(&block)
27
+ @gateways.each(&block)
28
28
  end
29
29
 
30
30
  def features
@@ -80,9 +80,9 @@ class SSLVerify
80
80
  end
81
81
 
82
82
  return :success
83
- rescue OpenSSL::SSL::SSLError => ex
84
- return :fail, ex.inspect
85
- rescue Net::HTTPBadResponse, Errno::ETIMEDOUT, EOFError, SocketError, Errno::ECONNREFUSED, Timeout::Error => ex
86
- return :error, ex.inspect
83
+ rescue OpenSSL::SSL::SSLError => e
84
+ return :fail, e.inspect
85
+ rescue Net::HTTPBadResponse, Errno::ETIMEDOUT, EOFError, SocketError, Errno::ECONNREFUSED, Timeout::Error => e
86
+ return :error, e.inspect
87
87
  end
88
88
  end
@@ -75,12 +75,12 @@ class SSLVersion
75
75
  return :success
76
76
  rescue Net::HTTPBadResponse
77
77
  return :success # version negotiation succeeded
78
- rescue OpenSSL::SSL::SSLError => ex
79
- return :fail, ex.inspect
80
- rescue Interrupt => ex
78
+ rescue OpenSSL::SSL::SSLError => e
79
+ return :fail, e.inspect
80
+ rescue Interrupt => e
81
81
  print_summary
82
- raise ex
83
- rescue StandardError => ex
84
- return :error, ex.inspect
82
+ raise e
83
+ rescue StandardError => e
84
+ return :error, e.inspect
85
85
  end
86
86
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activemerchant
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.133.0
4
+ version: 1.137.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Luetke
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-20 00:00:00.000000000 Z
11
+ date: 2024-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -78,14 +78,20 @@ dependencies:
78
78
  requirements:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: 3.2.5
81
+ version: '3.3'
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: 3.3.4
82
85
  type: :runtime
83
86
  prerelease: false
84
87
  version_requirements: !ruby/object:Gem::Requirement
85
88
  requirements:
86
89
  - - "~>"
87
90
  - !ruby/object:Gem::Version
88
- version: 3.2.5
91
+ version: '3.3'
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: 3.3.4
89
95
  - !ruby/object:Gem::Dependency
90
96
  name: mocha
91
97
  requirement: !ruby/object:Gem::Requirement
@@ -235,6 +241,9 @@ files:
235
241
  - lib/active_merchant/billing/gateways/cashnet.rb
236
242
  - lib/active_merchant/billing/gateways/cc5.rb
237
243
  - lib/active_merchant/billing/gateways/cecabank.rb
244
+ - lib/active_merchant/billing/gateways/cecabank/cecabank_common.rb
245
+ - lib/active_merchant/billing/gateways/cecabank/cecabank_json.rb
246
+ - lib/active_merchant/billing/gateways/cecabank/cecabank_xml.rb
238
247
  - lib/active_merchant/billing/gateways/cenpos.rb
239
248
  - lib/active_merchant/billing/gateways/checkout.rb
240
249
  - lib/active_merchant/billing/gateways/checkout_v2.rb
@@ -252,8 +261,10 @@ files:
252
261
  - lib/active_merchant/billing/gateways/cyber_source_rest.rb
253
262
  - lib/active_merchant/billing/gateways/d_local.rb
254
263
  - lib/active_merchant/billing/gateways/data_cash.rb
264
+ - lib/active_merchant/billing/gateways/datatrans.rb
255
265
  - lib/active_merchant/billing/gateways/decidir.rb
256
266
  - lib/active_merchant/billing/gateways/decidir_plus.rb
267
+ - lib/active_merchant/billing/gateways/deepstack.rb
257
268
  - lib/active_merchant/billing/gateways/dibs.rb
258
269
  - lib/active_merchant/billing/gateways/digitzs.rb
259
270
  - lib/active_merchant/billing/gateways/ebanx.rb
@@ -272,8 +283,12 @@ files:
272
283
  - lib/active_merchant/billing/gateways/finansbank.rb
273
284
  - lib/active_merchant/billing/gateways/first_giving.rb
274
285
  - lib/active_merchant/billing/gateways/first_pay.rb
286
+ - lib/active_merchant/billing/gateways/first_pay/first_pay_common.rb
287
+ - lib/active_merchant/billing/gateways/first_pay/first_pay_json.rb
288
+ - lib/active_merchant/billing/gateways/first_pay/first_pay_xml.rb
275
289
  - lib/active_merchant/billing/gateways/firstdata_e4.rb
276
290
  - lib/active_merchant/billing/gateways/firstdata_e4_v27.rb
291
+ - lib/active_merchant/billing/gateways/flex_charge.rb
277
292
  - lib/active_merchant/billing/gateways/flo2cash.rb
278
293
  - lib/active_merchant/billing/gateways/flo2cash_simple.rb
279
294
  - lib/active_merchant/billing/gateways/forte.rb
@@ -281,6 +296,7 @@ files:
281
296
  - lib/active_merchant/billing/gateways/global_collect.rb
282
297
  - lib/active_merchant/billing/gateways/global_transport.rb
283
298
  - lib/active_merchant/billing/gateways/hdfc.rb
299
+ - lib/active_merchant/billing/gateways/hi_pay.rb
284
300
  - lib/active_merchant/billing/gateways/hps.rb
285
301
  - lib/active_merchant/billing/gateways/iats_payments.rb
286
302
  - lib/active_merchant/billing/gateways/in_context_paypal_express.rb
@@ -395,6 +411,7 @@ files:
395
411
  - lib/active_merchant/billing/gateways/reach.rb
396
412
  - lib/active_merchant/billing/gateways/realex.rb
397
413
  - lib/active_merchant/billing/gateways/redsys.rb
414
+ - lib/active_merchant/billing/gateways/redsys_rest.rb
398
415
  - lib/active_merchant/billing/gateways/s5.rb
399
416
  - lib/active_merchant/billing/gateways/safe_charge.rb
400
417
  - lib/active_merchant/billing/gateways/sage.rb
@@ -406,6 +423,7 @@ files:
406
423
  - lib/active_merchant/billing/gateways/secure_pay_tech.rb
407
424
  - lib/active_merchant/billing/gateways/securion_pay.rb
408
425
  - lib/active_merchant/billing/gateways/shift4.rb
426
+ - lib/active_merchant/billing/gateways/shift4_v2.rb
409
427
  - lib/active_merchant/billing/gateways/simetrik.rb
410
428
  - lib/active_merchant/billing/gateways/skip_jack.rb
411
429
  - lib/active_merchant/billing/gateways/smart_ps.rb
@@ -413,6 +431,7 @@ files:
413
431
  - lib/active_merchant/billing/gateways/spreedly_core.rb
414
432
  - lib/active_merchant/billing/gateways/stripe.rb
415
433
  - lib/active_merchant/billing/gateways/stripe_payment_intents.rb
434
+ - lib/active_merchant/billing/gateways/sum_up.rb
416
435
  - lib/active_merchant/billing/gateways/swipe_checkout.rb
417
436
  - lib/active_merchant/billing/gateways/telr.rb
418
437
  - lib/active_merchant/billing/gateways/tns.rb
@@ -427,6 +446,7 @@ files:
427
446
  - lib/active_merchant/billing/gateways/usa_epay_advanced.rb
428
447
  - lib/active_merchant/billing/gateways/usa_epay_transaction.rb
429
448
  - lib/active_merchant/billing/gateways/vanco.rb
449
+ - lib/active_merchant/billing/gateways/vantiv_express.rb
430
450
  - lib/active_merchant/billing/gateways/verifi.rb
431
451
  - lib/active_merchant/billing/gateways/viaklix.rb
432
452
  - lib/active_merchant/billing/gateways/visanet_peru.rb
@@ -439,6 +459,7 @@ files:
439
459
  - lib/active_merchant/billing/gateways/worldpay.rb
440
460
  - lib/active_merchant/billing/gateways/worldpay_online_payments.rb
441
461
  - lib/active_merchant/billing/gateways/worldpay_us.rb
462
+ - lib/active_merchant/billing/gateways/xpay.rb
442
463
  - lib/active_merchant/billing/model.rb
443
464
  - lib/active_merchant/billing/network_tokenization_credit_card.rb
444
465
  - lib/active_merchant/billing/payment_token.rb
@@ -465,7 +486,7 @@ licenses:
465
486
  - MIT
466
487
  metadata:
467
488
  allowed_push_host: https://rubygems.org
468
- post_install_message:
489
+ post_install_message:
469
490
  rdoc_options: []
470
491
  require_paths:
471
492
  - lib
@@ -473,15 +494,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
473
494
  requirements:
474
495
  - - ">="
475
496
  - !ruby/object:Gem::Version
476
- version: '2.5'
497
+ version: '3.1'
477
498
  required_rubygems_version: !ruby/object:Gem::Requirement
478
499
  requirements:
479
500
  - - ">="
480
501
  - !ruby/object:Gem::Version
481
502
  version: '0'
482
503
  requirements: []
483
- rubygems_version: 3.4.16
484
- signing_key:
504
+ rubygems_version: 3.5.16
505
+ signing_key:
485
506
  specification_version: 4
486
507
  summary: Framework and tools for dealing with credit card transactions.
487
508
  test_files: []