swiss-activemerchant 1.0.6 → 1.0.8
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a0a202a2ab6a0f8090f08dfbfab88bf513b95f630bc82788a4f21f7067651b4
|
4
|
+
data.tar.gz: 8c89ee65ebafe3c6f68216f2a73ecfb6134b82bc3e10c104276b08ac296f0f79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d5dc22556a450764cf3b13643553ecca13028a051c699b317c558f27dcfd900c3963c5dec75b6df22afe8a60dc0637cc87a2df93d00bd67ab4f13528d829bc6
|
7
|
+
data.tar.gz: 2d3db1f8444644aa86134b8cda0ea8b1ee2ba067b49086a5bdcc06b339ef1beb8720a21ba8498de8e714b99a7d3833013422a3a0f173e83abdd86fe73a220054
|
@@ -7,6 +7,9 @@ module ActiveMerchant #:nodoc:
|
|
7
7
|
# particularly useful if you already have code interacting with
|
8
8
|
# ActiveMerchant and want to easily take advantage of Spreedly's vault.
|
9
9
|
class SpreedlyCoreGateway < Gateway
|
10
|
+
SUCCESS_CODE = 200
|
11
|
+
SOFT_DECLINE_CODES = [401, 402, 408, 415, 422].freeze
|
12
|
+
|
10
13
|
self.live_url = 'https://core.spreedly.com/v1'
|
11
14
|
|
12
15
|
self.supported_countries = %w(AD AE AT AU BD BE BG BN CA CH CY CZ DE DK EE EG ES FI FR GB
|
@@ -99,7 +102,7 @@ module ActiveMerchant #:nodoc:
|
|
99
102
|
# credit_card - The CreditCard to store
|
100
103
|
# options - A standard ActiveMerchant options hash
|
101
104
|
def store(credit_card, options = {})
|
102
|
-
retain =
|
105
|
+
retain = true
|
103
106
|
save_card(retain, credit_card, options)
|
104
107
|
end
|
105
108
|
|
@@ -186,8 +189,6 @@ module ActiveMerchant #:nodoc:
|
|
186
189
|
add_credit_card(doc, payment_method, options)
|
187
190
|
elsif payment_method.is_a?(Check)
|
188
191
|
add_bank_account(doc, payment_method, options)
|
189
|
-
else
|
190
|
-
raise TypeError, 'Payment method not supported'
|
191
192
|
end
|
192
193
|
end
|
193
194
|
|
@@ -281,21 +282,26 @@ module ActiveMerchant #:nodoc:
|
|
281
282
|
|
282
283
|
def commit(relative_url, request, method = :post, authorization_field = :token)
|
283
284
|
begin
|
284
|
-
raw_response = ssl_request(method,
|
285
|
+
raw_response = ssl_request(method, request_url(relative_url), request, headers)
|
285
286
|
rescue ResponseError => e
|
286
287
|
raw_response = e.response.body
|
287
288
|
end
|
288
289
|
|
289
|
-
response_from(raw_response, authorization_field)
|
290
|
+
response_from(raw_response, authorization_field, request, relative_url)
|
290
291
|
end
|
291
292
|
|
292
|
-
def response_from(raw_response, authorization_field)
|
293
|
+
def response_from(raw_response, authorization_field, request_body, relative_url)
|
293
294
|
parsed = parse(raw_response)
|
294
295
|
options = {
|
295
296
|
authorization: parsed[authorization_field],
|
296
297
|
test: (parsed[:on_test_gateway] == 'true'),
|
297
298
|
avs_result: { code: parsed[:response_avs_code] },
|
298
|
-
cvv_result: parsed[:response_cvv_code]
|
299
|
+
cvv_result: parsed[:response_cvv_code],
|
300
|
+
response_type: response_type(@response_http_code.to_i),
|
301
|
+
response_http_code: @response_http_code,
|
302
|
+
request_endpoint: request_url(relative_url),
|
303
|
+
request_method: :post,
|
304
|
+
request_body:
|
299
305
|
}
|
300
306
|
|
301
307
|
Response.new(parsed[:succeeded] == 'true', parsed[:message] || parsed[:error], parsed, options)
|
@@ -307,6 +313,30 @@ module ActiveMerchant #:nodoc:
|
|
307
313
|
'Content-Type' => 'text/xml'
|
308
314
|
}
|
309
315
|
end
|
316
|
+
|
317
|
+
def request_url(relative_url)
|
318
|
+
"#{live_url}/#{relative_url}"
|
319
|
+
end
|
320
|
+
|
321
|
+
def handle_response(response)
|
322
|
+
@response_http_code = response.code.to_i
|
323
|
+
case @response_http_code
|
324
|
+
when 200...300
|
325
|
+
response.body
|
326
|
+
else
|
327
|
+
raise ResponseError.new(response)
|
328
|
+
end
|
329
|
+
end
|
330
|
+
|
331
|
+
def response_type(code)
|
332
|
+
if code == SUCCESS_CODE
|
333
|
+
0
|
334
|
+
elsif SOFT_DECLINE_CODES.include?(code)
|
335
|
+
1
|
336
|
+
else
|
337
|
+
2
|
338
|
+
end
|
339
|
+
end
|
310
340
|
end
|
311
341
|
end
|
312
342
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: swiss-activemerchant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Luetke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|