spreedly 2.0.23 → 2.0.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +6 -1
- data/lib/spreedly/environment.rb +4 -0
- data/lib/spreedly/urls.rb +4 -0
- data/lib/spreedly/version.rb +1 -1
- data/test/helpers/creation_helper.rb +10 -7
- data/test/remote/remote_complete_test.rb +27 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43cf51954eea13a2f1305e712c4ea4c4870f4de8b1066160b8023ca45b8e2aa0
|
4
|
+
data.tar.gz: 0dd8522435f12b094dbdb8f07dfb45143ac265aaac416457f95242a038e1e5b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d36b133483e50f955c4e392a2f43a6ae6efa0edae54f2b7f1266b7a4587b47fc4a8e1725b6de49e90b4e2cc3a390e78b4c10e919eb8b2d675df73c3b8232c2a
|
7
|
+
data.tar.gz: 77f2b68c2f8b94250836a3a8a2dadaf47e2950717c5a0ef192d39150ba0844b5b874799773c3f4eb46c1b53209374cb62e6264093eb752f19374120381501067
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
|
5
|
+
## [2.0.24]
|
6
|
+
### Added
|
7
|
+
- @jeremywrowe - Add 3D Secure 2 complete transaction
|
8
|
+
|
5
9
|
## [2.0.23] - 2019-08-16
|
6
10
|
### Added
|
7
11
|
- @bayprogrammer - Add 3D Secure 2 third-party auth abilities to gateway class
|
data/README.md
CHANGED
@@ -181,6 +181,12 @@ env.purchase_on_gateway(gateway_token, payment_method_token, amount,
|
|
181
181
|
)
|
182
182
|
```
|
183
183
|
|
184
|
+
#### Complete a transaction (3DS 2)
|
185
|
+
|
186
|
+
```ruby
|
187
|
+
env.complete_transaction(transaction_token)
|
188
|
+
```
|
189
|
+
|
184
190
|
#### Retain on success
|
185
191
|
Retain a payment method automatically if the purchase, verify, or authorize transaction succeeded. Saves you a separate call to retain:
|
186
192
|
|
@@ -322,7 +328,6 @@ You can get the full list of supported receivers like so:
|
|
322
328
|
env.receiver_options
|
323
329
|
```
|
324
330
|
|
325
|
-
|
326
331
|
## Error Handling
|
327
332
|
|
328
333
|
When you make a call to the API, there are times when things don't go as expected. For the most part, when a call is made, a Transaction is created behind the scenes at Spreedly. In general,
|
data/lib/spreedly/environment.rb
CHANGED
@@ -49,6 +49,10 @@ module Spreedly
|
|
49
49
|
api_post(authorize_url(gateway_token), body)
|
50
50
|
end
|
51
51
|
|
52
|
+
def complete_transaction(transaction_token)
|
53
|
+
api_post(complete_transaction_url(transaction_token), '')
|
54
|
+
end
|
55
|
+
|
52
56
|
def verify_on_gateway(gateway_token, payment_method_token, options = {})
|
53
57
|
body = verify_body(payment_method_token, options)
|
54
58
|
api_post(verify_url(gateway_token), body)
|
data/lib/spreedly/urls.rb
CHANGED
@@ -12,6 +12,10 @@ module Spreedly
|
|
12
12
|
"#{base_url}/v1/transactions/#{transaction_token}/transcript"
|
13
13
|
end
|
14
14
|
|
15
|
+
def complete_transaction_url(token)
|
16
|
+
"#{base_url}/v1/transactions/#{token}/complete.xml"
|
17
|
+
end
|
18
|
+
|
15
19
|
def find_gateway_url(token)
|
16
20
|
"#{base_url}/v1/gateways/#{token}.xml"
|
17
21
|
end
|
data/lib/spreedly/version.rb
CHANGED
@@ -1,16 +1,19 @@
|
|
1
1
|
|
2
2
|
module Spreedly
|
3
|
-
|
4
3
|
module CreationHelper
|
5
|
-
|
6
4
|
def create_card_on(environment, options = {})
|
7
|
-
|
8
|
-
environment.add_credit_card(
|
5
|
+
options = default_card_options.merge(options)
|
6
|
+
environment.add_credit_card(options).payment_method
|
9
7
|
end
|
10
8
|
|
11
9
|
def create_failed_card_on(environment, options = {})
|
12
|
-
|
13
|
-
environment.add_credit_card(
|
10
|
+
options = default_card_options.merge(number: '4012888888881881').merge(options)
|
11
|
+
environment.add_credit_card(options).payment_method
|
12
|
+
end
|
13
|
+
|
14
|
+
def create_threeds_2_card_on(environment, options = {})
|
15
|
+
options = default_card_options.merge(number: '4556761029983886').merge(options)
|
16
|
+
environment.add_credit_card(options).payment_method
|
14
17
|
end
|
15
18
|
|
16
19
|
def create_sprel_on(environment)
|
@@ -21,7 +24,7 @@ module Spreedly
|
|
21
24
|
|
22
25
|
private
|
23
26
|
|
24
|
-
def
|
27
|
+
def default_card_options
|
25
28
|
{
|
26
29
|
email: 'perrin@wot.com', number: '5555555555554444', month: 1, year: 2023,
|
27
30
|
last_name: 'Aybara', first_name: 'Perrin', retained: true
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class RemoteCompleteTransactionTest < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
@environment = Spreedly::Environment.new(remote_test_environment_key, remote_test_access_secret)
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_successful_complete_a_3ds_transaction
|
9
|
+
gateway_token = @environment.add_gateway(:test).token
|
10
|
+
card_token = create_threeds_2_card_on(@environment).token
|
11
|
+
base64_encoded_browser_info = "eyJ3aWR0aCI6MTY4MCwiaGVpZ2h0IjoxMDUwLCJkZXB0aCI6MjQsInRpbWV6b25lIjoyNDAsInVzZXJfYWdlbnQiOiJNb3ppbGxhLzUuMCAoTWFjaW50b3NoOyBJbnRlbCBNYWMgT1MgWCAxMF8xNF80KSBBcHBsZVdlYktpdC82MDUuMS4xNSAoS0hUTUwsIGxpa2UgR2Vja28pIFZlcnNpb24vMTIuMSBTYWZhcmkvNjA1LjEuMTUiLCJqYXZhIjp0cnVlLCJsYW5ndWFnZSI6ImVuLVVTIn0="
|
12
|
+
purchase = @environment.purchase_on_gateway(
|
13
|
+
gateway_token,
|
14
|
+
card_token,
|
15
|
+
3003,
|
16
|
+
browser_info: base64_encoded_browser_info,
|
17
|
+
three_ds_version: '2.0',
|
18
|
+
redirect_url: 'https://example.com/redirect',
|
19
|
+
callback_url: 'https://example.com/callback',
|
20
|
+
attempt_3dsecure: true
|
21
|
+
)
|
22
|
+
assert_equal 'pending', purchase.state
|
23
|
+
|
24
|
+
complete_transaction = @environment.complete_transaction(purchase.token)
|
25
|
+
assert_equal 'succeeded', complete_transaction.state
|
26
|
+
end
|
27
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spreedly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Spreedly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-08-
|
11
|
+
date: 2019-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -191,6 +191,7 @@ files:
|
|
191
191
|
- test/remote/remote_add_receiver_test.rb
|
192
192
|
- test/remote/remote_authorize_test.rb
|
193
193
|
- test/remote/remote_capture_test.rb
|
194
|
+
- test/remote/remote_complete_test.rb
|
194
195
|
- test/remote/remote_deliver_payment_method_test.rb
|
195
196
|
- test/remote/remote_find_gateway_test.rb
|
196
197
|
- test/remote/remote_find_payment_method_test.rb
|
@@ -301,6 +302,7 @@ test_files:
|
|
301
302
|
- test/remote/remote_add_receiver_test.rb
|
302
303
|
- test/remote/remote_authorize_test.rb
|
303
304
|
- test/remote/remote_capture_test.rb
|
305
|
+
- test/remote/remote_complete_test.rb
|
304
306
|
- test/remote/remote_deliver_payment_method_test.rb
|
305
307
|
- test/remote/remote_find_gateway_test.rb
|
306
308
|
- test/remote/remote_find_payment_method_test.rb
|