stripe 4.20.1 → 4.21.0

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: 2002b2a203c6c8b65987b94eb5c2c883e9b06bb37ea982d778011d18a60bf86e
4
- data.tar.gz: 784aa17ef657de3a630b34c7edf04155b1cb0cc5f4f48a356720ca02473701a9
3
+ metadata.gz: 71a6b96879649c2de27d42c29eac925733f9c89e6a3c98fe635f31644fc775d9
4
+ data.tar.gz: 4a1af752a7cf8b81003a1d81720855199b6115acc59b0b102d25ad6087103132
5
5
  SHA512:
6
- metadata.gz: f188c2b86be99683db3fb16a88d776df987e4aa78ea76782bae0f4a9f7e99b11bc87124a5c49ada67a29dc9adfb427bb19ffe4ea4abbe360ede1839941955cf6
7
- data.tar.gz: 90f8976f09ab1817cb2a6faceb4cf20dd1b4869a8be793f5a5288428c16595705d3ae9be27b62b317f534ee24e73d324af25dbb73520457a77331444fe356c1d
6
+ metadata.gz: 42bf6cd4ad0701ce1cc0a62b62dd4a24fe1c16e11ef5f0375be3cd8133c3501e88c124483bf59309d9254ce224646e061a21731f437931984fb986e2e7f203f8
7
+ data.tar.gz: 33696fe519ec6cb477ea4e81e17c14a202c2ed50c1db9000ba1d5d4d312fd8a2ef9e63befd9d322bb6bdbc7cf2cbe244add40b7bec00fb247684c1cc73bda3dd
@@ -18,7 +18,7 @@ sudo: false
18
18
  env:
19
19
  global:
20
20
  # If changing this number, please also change it in `test/test_helper.rb`.
21
- - STRIPE_MOCK_VERSION=0.58.0
21
+ - STRIPE_MOCK_VERSION=0.60.0
22
22
 
23
23
  cache:
24
24
  directories:
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.21.0 - 2019-06-28
4
+ * [#803](https://github.com/stripe/stripe-ruby/pull/803) Add support for the `SetupIntent` resource and APIs
5
+
3
6
  ## 4.20.1 - 2019-06-28
4
7
  * [#805](https://github.com/stripe/stripe-ruby/pull/805) Fix formatting in `ConnectionFailed` error message
5
8
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.20.1
1
+ 4.21.0
@@ -69,6 +69,7 @@ module Stripe
69
69
  Reversal::OBJECT_NAME => Reversal,
70
70
  Review::OBJECT_NAME => Review,
71
71
  SKU::OBJECT_NAME => SKU,
72
+ SetupIntent::OBJECT_NAME => SetupIntent,
72
73
  Sigma::ScheduledQueryRun::OBJECT_NAME => Sigma::ScheduledQueryRun,
73
74
  Source::OBJECT_NAME => Source,
74
75
  SourceTransaction::OBJECT_NAME => SourceTransaction,
@@ -56,6 +56,7 @@ require "stripe/resources/reporting/report_run"
56
56
  require "stripe/resources/reporting/report_type"
57
57
  require "stripe/resources/reversal"
58
58
  require "stripe/resources/review"
59
+ require "stripe/resources/setup_intent"
59
60
  require "stripe/resources/sigma/scheduled_query_run"
60
61
  require "stripe/resources/sku"
61
62
  require "stripe/resources/source"
@@ -10,6 +10,8 @@ module Stripe
10
10
 
11
11
  OBJECT_NAME = "customer".freeze
12
12
 
13
+ nested_resource_class_methods :balance_transaction,
14
+ operations: %i[create retrieve update list]
13
15
  nested_resource_class_methods :tax_id,
14
16
  operations: %i[create retrieve delete list]
15
17
 
@@ -19,9 +21,6 @@ module Stripe
19
21
  nested_resource_class_methods :source,
20
22
  operations: %i[create retrieve update delete list]
21
23
 
22
- nested_resource_class_methods :balance_transaction,
23
- operations: %i[create retrieve update list]
24
-
25
24
  # The API request for deleting a card or bank account and for detaching a
26
25
  # source object are the same.
27
26
  class << self
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stripe
4
+ class SetupIntent < APIResource
5
+ extend Stripe::APIOperations::Create
6
+ extend Stripe::APIOperations::List
7
+ include Stripe::APIOperations::Save
8
+
9
+ OBJECT_NAME = "setup_intent".freeze
10
+
11
+ custom_method :cancel, http_verb: :post
12
+ custom_method :confirm, http_verb: :post
13
+
14
+ def cancel(params = {}, opts = {})
15
+ resp, opts = request(:post, resource_url + "/cancel", params, opts)
16
+ Util.convert_to_stripe_object(resp.data, opts)
17
+ end
18
+
19
+ def confirm(params = {}, opts = {})
20
+ resp, opts = request(:post, resource_url + "/confirm", params, opts)
21
+ Util.convert_to_stripe_object(resp.data, opts)
22
+ end
23
+ end
24
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stripe
4
- VERSION = "4.20.1".freeze
4
+ VERSION = "4.21.0".freeze
5
5
  end
@@ -3,9 +3,9 @@
3
3
  require ::File.expand_path("../test_helper", __dir__)
4
4
 
5
5
  module Stripe
6
- TEST_RESOURCE_ID = "pi_123".freeze
7
-
8
6
  class PaymentIntentTest < Test::Unit::TestCase
7
+ TEST_RESOURCE_ID = "pi_123".freeze
8
+
9
9
  should "be listable" do
10
10
  payment_intents = Stripe::PaymentIntent.list
11
11
  assert_requested :get, "#{Stripe.api_base}/v1/payment_intents"
@@ -0,0 +1,84 @@
1
+ # frozen_string_literal: true
2
+
3
+ require ::File.expand_path("../test_helper", __dir__)
4
+
5
+ module Stripe
6
+ class SetupIntentTest < Test::Unit::TestCase
7
+ TEST_RESOURCE_ID = "seti_123".freeze
8
+
9
+ should "be listable" do
10
+ setup_intents = Stripe::SetupIntent.list
11
+ assert_requested :get, "#{Stripe.api_base}/v1/setup_intents"
12
+ assert setup_intents.data.is_a?(Array)
13
+ assert setup_intents.data[0].is_a?(Stripe::SetupIntent)
14
+ end
15
+
16
+ should "be retrievable" do
17
+ setup_intent = Stripe::SetupIntent.retrieve("seti_123")
18
+ assert_requested :get, "#{Stripe.api_base}/v1/setup_intents/seti_123"
19
+ assert setup_intent.is_a?(Stripe::SetupIntent)
20
+ end
21
+
22
+ should "be creatable" do
23
+ setup_intent = Stripe::SetupIntent.create(
24
+ payment_method_types: ["card"]
25
+ )
26
+ assert_requested :post, "#{Stripe.api_base}/v1/setup_intents"
27
+ assert setup_intent.is_a?(Stripe::SetupIntent)
28
+ end
29
+
30
+ should "be saveable" do
31
+ setup_intent = Stripe::SetupIntent.construct_from(id: "seti_123", object: "setup_intent", metadata: {})
32
+ setup_intent.metadata["key"] = "value"
33
+ setup_intent.save
34
+ assert_requested :post, "#{Stripe.api_base}/v1/setup_intents/#{setup_intent.id}"
35
+ end
36
+
37
+ should "be updateable" do
38
+ setup_intent = Stripe::SetupIntent.update("seti_123", metadata: { foo: "bar" })
39
+
40
+ assert_requested :post, "#{Stripe.api_base}/v1/setup_intents/seti_123"
41
+ assert setup_intent.is_a?(Stripe::SetupIntent)
42
+ end
43
+
44
+ context "#cancel" do
45
+ should "cancel a setup_intent" do
46
+ setup_intent = Stripe::SetupIntent.construct_from(id: "seti_123", object: "setup_intent")
47
+ setup_intent = setup_intent.cancel
48
+
49
+ assert_requested :post, "#{Stripe.api_base}/v1/setup_intents/seti_123/cancel"
50
+ assert setup_intent.is_a?(Stripe::SetupIntent)
51
+ end
52
+ end
53
+
54
+ context ".cancel" do
55
+ should "cancel a setup_intent" do
56
+ setup_intent = Stripe::SetupIntent.cancel("seti_123")
57
+
58
+ assert_requested :post, "#{Stripe.api_base}/v1/setup_intents/seti_123/cancel"
59
+ assert setup_intent.is_a?(Stripe::SetupIntent)
60
+ end
61
+ end
62
+
63
+ context "#confirm" do
64
+ should "confirm a setup_intent" do
65
+ setup_intent = Stripe::SetupIntent.construct_from(id: "seti_123", object: "setup_intent")
66
+ setup_intent = setup_intent.confirm(
67
+ payment_method: "pm_123"
68
+ )
69
+
70
+ assert_requested :post, "#{Stripe.api_base}/v1/setup_intents/seti_123/confirm"
71
+ assert setup_intent.is_a?(Stripe::SetupIntent)
72
+ end
73
+ end
74
+
75
+ context ".confirm" do
76
+ should "confirm a setup_intent" do
77
+ setup_intent = Stripe::SetupIntent.confirm("seti_123", payment_method: "pm_123")
78
+
79
+ assert_requested :post, "#{Stripe.api_base}/v1/setup_intents/seti_123/confirm"
80
+ assert setup_intent.is_a?(Stripe::SetupIntent)
81
+ end
82
+ end
83
+ end
84
+ end
@@ -17,7 +17,7 @@ require ::File.expand_path("test_data", __dir__)
17
17
  require ::File.expand_path("stripe_mock", __dir__)
18
18
 
19
19
  # If changing this number, please also change it in `.travis.yml`.
20
- MOCK_MINIMUM_VERSION = "0.58.0".freeze
20
+ MOCK_MINIMUM_VERSION = "0.60.0".freeze
21
21
  MOCK_PORT = Stripe::StripeMock.start
22
22
 
23
23
  # Disable all real network connections except those that are outgoing to
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stripe
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.20.1
4
+ version: 4.21.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
@@ -134,6 +134,7 @@ files:
134
134
  - lib/stripe/resources/reporting/report_type.rb
135
135
  - lib/stripe/resources/reversal.rb
136
136
  - lib/stripe/resources/review.rb
137
+ - lib/stripe/resources/setup_intent.rb
137
138
  - lib/stripe/resources/sigma/scheduled_query_run.rb
138
139
  - lib/stripe/resources/sku.rb
139
140
  - lib/stripe/resources/source.rb
@@ -219,6 +220,7 @@ files:
219
220
  - test/stripe/reporting/report_type_test.rb
220
221
  - test/stripe/reversal_test.rb
221
222
  - test/stripe/review_test.rb
223
+ - test/stripe/setup_intent_test.rb
222
224
  - test/stripe/sigma/scheduled_query_run_test.rb
223
225
  - test/stripe/sku_test.rb
224
226
  - test/stripe/source_test.rb
@@ -328,6 +330,7 @@ test_files:
328
330
  - test/stripe/reporting/report_type_test.rb
329
331
  - test/stripe/reversal_test.rb
330
332
  - test/stripe/review_test.rb
333
+ - test/stripe/setup_intent_test.rb
331
334
  - test/stripe/sigma/scheduled_query_run_test.rb
332
335
  - test/stripe/sku_test.rb
333
336
  - test/stripe/source_test.rb