spreedly 2.0.23 → 2.0.25

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e1d30091e8d85d242e31d7acd1779b3188786c659bb40b134a284f398a2bf1af
4
- data.tar.gz: 9720c910cf18ce6ed848e489adf2077ef5f1a54373b8a41b9e8fb30231e58c63
3
+ metadata.gz: e8ebadb2a554b10f4889e1d9e0ba5550f63f506ac35065f4873c52df6e6caae7
4
+ data.tar.gz: e298035d0659d1ddcd38d723d6b1c6ccabd0c3c6254d0dc3453e8cf0eaf86769
5
5
  SHA512:
6
- metadata.gz: f0987d464f46000c6f8d3d303b2b264105f210450c175131e2b6d185c61b30a8e75c9984dde8e3ea506cbbe864bbab609b563b860ddfb1f6703f4df1e8e3bb0c
7
- data.tar.gz: 2f568229b8423b52456e7e58b96010a0f99fef4eed65858d98088c24591459d718f419c42b635561d2b6eb1b9b51cbd9ae890671a9bee55d485db4eb0f1980a9
6
+ metadata.gz: c8b186c24a8e14b296b994fbda2c55d3dd6d869110146fabdc04574963613ff6384687897be41a9cf5616efba2f3409ee974ea972683f647dc9971970f786787
7
+ data.tar.gz: e630762db928600eb7fa390f356bc878dea1a50e9c7edb86ddecedee983c625607922894dff2f61cd84045c64e5fc66e441d812ddc2bf403da8be7b7e03cc68e
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [2.0.24] - 2021-07-12
6
+ ### Added
7
+ - @almalee24 - Add MIT Framework support flag, supports_populate_mit_fields
8
+
9
+ ## [2.0.24] - 2019-08-21
10
+ ### Added
11
+ - @jeremywrowe - Add 3D Secure 2 complete transaction
12
+
5
13
  ## [2.0.23] - 2019-08-16
6
14
  ### Added
7
15
  - @bayprogrammer - Add 3D Secure 2 third-party auth abilities to gateway class
data/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  A convenient Ruby wrapper for the Spreedly API.
4
4
 
5
+ This is an example Ruby integration with Spreedly. This version is no longer actively updated and will be superseded by a new version in the near future. Feature parity may lag behind, so please use this gem at your own risk.
6
+
5
7
  ## Philosophy
6
8
 
7
9
  * No global configuration of authentication credentials.
@@ -181,6 +183,12 @@ env.purchase_on_gateway(gateway_token, payment_method_token, amount,
181
183
  )
182
184
  ```
183
185
 
186
+ #### Complete a transaction (3DS 2)
187
+
188
+ ```ruby
189
+ env.complete_transaction(transaction_token)
190
+ ```
191
+
184
192
  #### Retain on success
185
193
  Retain a payment method automatically if the purchase, verify, or authorize transaction succeeded. Saves you a separate call to retain:
186
194
 
@@ -322,6 +330,19 @@ You can get the full list of supported receivers like so:
322
330
  env.receiver_options
323
331
  ```
324
332
 
333
+ #### Delivering a payment method
334
+
335
+ You can deliver a payment method to a third party using [Payment Method Distribution](https://docs.spreedly.com/guides/payment-method-distribution/). Once a receiver is set up and you have a payment method that you would like to share, you can use the following call:
336
+
337
+ ```ruby
338
+ env.deliver_to_receiver(
339
+ "receiver token goes here",
340
+ "payment method token goes here",
341
+ headers: { "Content-Type": "application/json" },
342
+ url: "https://spreedly-echo.herokuapp.com",
343
+ body: { card_number: "{{credit_card_number}}" }.to_json
344
+ )
345
+ ```
325
346
 
326
347
  ## Error Handling
327
348
 
@@ -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)
@@ -11,7 +11,7 @@ module Spreedly
11
11
  :supports_3dsecure_2_purchase, :supports_3dsecure_2_authorize,
12
12
  :supports_3dsecure_2_mpi_purchase, :supports_3dsecure_2_mpi_authorize,
13
13
  :supports_store, :supports_remove, :supports_general_credit,
14
- :supports_fraud_review, type: :boolean
14
+ :supports_fraud_review, :supports_populate_mit_fields, type: :boolean
15
15
 
16
16
  attr_reader :supported_countries, :payment_methods, :auth_modes, :regions
17
17
 
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
@@ -1,3 +1,3 @@
1
1
  module Spreedly
2
- VERSION = "2.0.23"
2
+ VERSION = "2.0.25"
3
3
  end
@@ -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
- deets = default_card_deets.merge(options)
8
- environment.add_credit_card(deets).payment_method
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
- deets = default_card_deets.merge(number: '4012888888881881').merge(options)
13
- environment.add_credit_card(deets).payment_method
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 default_card_deets
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
@@ -68,6 +68,7 @@ class GatewayOptionsTest < Test::Unit::TestCase
68
68
  :supports_general_credit,
69
69
  :supports_offsite_authorize,
70
70
  :supports_offsite_purchase,
71
+ :supports_populate_mit_fields,
71
72
  :supports_purchase,
72
73
  :supports_purchase_via_preauthorization,
73
74
  :supports_reference_purchase,
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.23
4
+ version: 2.0.25
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-16 00:00:00.000000000 Z
11
+ date: 2023-03-28 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
@@ -285,7 +286,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
285
286
  - !ruby/object:Gem::Version
286
287
  version: '0'
287
288
  requirements: []
288
- rubygems_version: 3.0.3
289
+ rubygems_version: 3.1.6
289
290
  signing_key:
290
291
  specification_version: 4
291
292
  summary: Provides a Ruby wrapper for the Spreedly API.
@@ -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