stripe 6.0.0 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +60 -2
  3. data/Makefile +1 -1
  4. data/OPENAPI_VERSION +1 -0
  5. data/README.md +1 -1
  6. data/VERSION +1 -1
  7. data/lib/data/ca-certificates.crt +1241 -1937
  8. data/lib/stripe/api_operations/create.rb +6 -2
  9. data/lib/stripe/api_operations/delete.rb +12 -7
  10. data/lib/stripe/api_operations/list.rb +6 -9
  11. data/lib/stripe/api_operations/nested_resource.rb +62 -34
  12. data/lib/stripe/api_operations/request.rb +10 -0
  13. data/lib/stripe/api_operations/save.rb +6 -3
  14. data/lib/stripe/api_operations/search.rb +6 -9
  15. data/lib/stripe/api_resource.rb +1 -1
  16. data/lib/stripe/api_resource_test_helpers.rb +2 -0
  17. data/lib/stripe/api_version.rb +8 -0
  18. data/lib/stripe/object_types.rb +11 -7
  19. data/lib/stripe/resources/account.rb +28 -8
  20. data/lib/stripe/resources/apps/secret.rb +31 -0
  21. data/lib/stripe/resources/card.rb +1 -3
  22. data/lib/stripe/resources/charge.rb +10 -3
  23. data/lib/stripe/resources/checkout/session.rb +27 -5
  24. data/lib/stripe/resources/credit_note.rb +24 -9
  25. data/lib/stripe/resources/customer.rb +104 -19
  26. data/lib/stripe/resources/dispute.rb +10 -3
  27. data/lib/stripe/resources/financial_connections/account.rb +40 -5
  28. data/lib/stripe/resources/identity/verification_session.rb +20 -5
  29. data/lib/stripe/resources/invoice.rb +64 -17
  30. data/lib/stripe/resources/issuing/authorization.rb +20 -5
  31. data/lib/stripe/resources/issuing/card.rb +78 -9
  32. data/lib/stripe/resources/issuing/dispute.rb +10 -3
  33. data/lib/stripe/resources/order.rb +40 -9
  34. data/lib/stripe/resources/payment_intent.rb +60 -13
  35. data/lib/stripe/resources/payment_link.rb +10 -3
  36. data/lib/stripe/resources/payment_method.rb +20 -5
  37. data/lib/stripe/resources/payout.rb +20 -5
  38. data/lib/stripe/resources/quote.rb +50 -11
  39. data/lib/stripe/resources/refund.rb +19 -5
  40. data/lib/stripe/resources/reporting/report_type.rb +0 -1
  41. data/lib/stripe/resources/review.rb +10 -3
  42. data/lib/stripe/resources/setup_intent.rb +30 -7
  43. data/lib/stripe/resources/source.rb +16 -6
  44. data/lib/stripe/resources/subscription.rb +52 -3
  45. data/lib/stripe/resources/subscription_item.rb +0 -7
  46. data/lib/stripe/resources/subscription_schedule.rb +20 -5
  47. data/lib/stripe/resources/terminal/reader.rb +49 -11
  48. data/lib/stripe/resources/test_helpers/test_clock.rb +10 -3
  49. data/lib/stripe/resources/topup.rb +10 -3
  50. data/lib/stripe/resources/transfer.rb +0 -11
  51. data/lib/stripe/resources/treasury/credit_reversal.rb +13 -0
  52. data/lib/stripe/resources/treasury/debit_reversal.rb +13 -0
  53. data/lib/stripe/resources/treasury/financial_account.rb +50 -0
  54. data/lib/stripe/resources/treasury/inbound_transfer.rb +93 -0
  55. data/lib/stripe/resources/treasury/outbound_payment.rb +93 -0
  56. data/lib/stripe/resources/treasury/outbound_transfer.rb +97 -0
  57. data/lib/stripe/resources/treasury/received_credit.rb +29 -0
  58. data/lib/stripe/resources/treasury/received_debit.rb +29 -0
  59. data/lib/stripe/resources/treasury/transaction.rb +12 -0
  60. data/lib/stripe/resources/treasury/transaction_entry.rb +16 -0
  61. data/lib/stripe/resources.rb +11 -7
  62. data/lib/stripe/util.rb +38 -3
  63. data/lib/stripe/version.rb +1 -1
  64. metadata +16 -8
  65. data/lib/stripe/resources/bitcoin_receiver.rb +0 -24
  66. data/lib/stripe/resources/bitcoin_transaction.rb +0 -16
  67. data/lib/stripe/resources/issuing/card_details.rb +0 -10
  68. data/lib/stripe/resources/recipient.rb +0 -14
  69. data/lib/stripe/resources/three_d_secure.rb +0 -14
@@ -10,17 +10,10 @@ module Stripe
10
10
 
11
11
  OBJECT_NAME = "payment_intent"
12
12
 
13
- custom_method :apply_customer_balance, http_verb: :post
14
- custom_method :cancel, http_verb: :post
15
- custom_method :capture, http_verb: :post
16
- custom_method :confirm, http_verb: :post
17
- custom_method :increment_authorization, http_verb: :post
18
- custom_method :verify_microdeposits, http_verb: :post
19
-
20
13
  def apply_customer_balance(params = {}, opts = {})
21
14
  request_stripe_object(
22
15
  method: :post,
23
- path: resource_url + "/apply_customer_balance",
16
+ path: format("/v1/payment_intents/%<intent>s/apply_customer_balance", { intent: CGI.escape(self["id"]) }),
24
17
  params: params,
25
18
  opts: opts
26
19
  )
@@ -29,7 +22,7 @@ module Stripe
29
22
  def cancel(params = {}, opts = {})
30
23
  request_stripe_object(
31
24
  method: :post,
32
- path: resource_url + "/cancel",
25
+ path: format("/v1/payment_intents/%<intent>s/cancel", { intent: CGI.escape(self["id"]) }),
33
26
  params: params,
34
27
  opts: opts
35
28
  )
@@ -38,7 +31,7 @@ module Stripe
38
31
  def capture(params = {}, opts = {})
39
32
  request_stripe_object(
40
33
  method: :post,
41
- path: resource_url + "/capture",
34
+ path: format("/v1/payment_intents/%<intent>s/capture", { intent: CGI.escape(self["id"]) }),
42
35
  params: params,
43
36
  opts: opts
44
37
  )
@@ -47,7 +40,7 @@ module Stripe
47
40
  def confirm(params = {}, opts = {})
48
41
  request_stripe_object(
49
42
  method: :post,
50
- path: resource_url + "/confirm",
43
+ path: format("/v1/payment_intents/%<intent>s/confirm", { intent: CGI.escape(self["id"]) }),
51
44
  params: params,
52
45
  opts: opts
53
46
  )
@@ -56,7 +49,7 @@ module Stripe
56
49
  def increment_authorization(params = {}, opts = {})
57
50
  request_stripe_object(
58
51
  method: :post,
59
- path: resource_url + "/increment_authorization",
52
+ path: format("/v1/payment_intents/%<intent>s/increment_authorization", { intent: CGI.escape(self["id"]) }),
60
53
  params: params,
61
54
  opts: opts
62
55
  )
@@ -65,7 +58,61 @@ module Stripe
65
58
  def verify_microdeposits(params = {}, opts = {})
66
59
  request_stripe_object(
67
60
  method: :post,
68
- path: resource_url + "/verify_microdeposits",
61
+ path: format("/v1/payment_intents/%<intent>s/verify_microdeposits", { intent: CGI.escape(self["id"]) }),
62
+ params: params,
63
+ opts: opts
64
+ )
65
+ end
66
+
67
+ def self.apply_customer_balance(intent, params = {}, opts = {})
68
+ request_stripe_object(
69
+ method: :post,
70
+ path: format("/v1/payment_intents/%<intent>s/apply_customer_balance", { intent: CGI.escape(intent) }),
71
+ params: params,
72
+ opts: opts
73
+ )
74
+ end
75
+
76
+ def self.cancel(intent, params = {}, opts = {})
77
+ request_stripe_object(
78
+ method: :post,
79
+ path: format("/v1/payment_intents/%<intent>s/cancel", { intent: CGI.escape(intent) }),
80
+ params: params,
81
+ opts: opts
82
+ )
83
+ end
84
+
85
+ def self.capture(intent, params = {}, opts = {})
86
+ request_stripe_object(
87
+ method: :post,
88
+ path: format("/v1/payment_intents/%<intent>s/capture", { intent: CGI.escape(intent) }),
89
+ params: params,
90
+ opts: opts
91
+ )
92
+ end
93
+
94
+ def self.confirm(intent, params = {}, opts = {})
95
+ request_stripe_object(
96
+ method: :post,
97
+ path: format("/v1/payment_intents/%<intent>s/confirm", { intent: CGI.escape(intent) }),
98
+ params: params,
99
+ opts: opts
100
+ )
101
+ end
102
+
103
+ def self.increment_authorization(intent, params = {}, opts = {})
104
+ request_stripe_object(
105
+ method: :post,
106
+ path: format("/v1/payment_intents/%<intent>s/increment_authorization", { intent: CGI.escape(intent) }),
107
+ params: params,
108
+ opts: opts
109
+ )
110
+ end
111
+
112
+ def self.verify_microdeposits(intent, params = {}, opts = {})
113
+ request_stripe_object(
114
+ method: :post,
115
+ path: format("/v1/payment_intents/%<intent>s/verify_microdeposits", { intent: CGI.escape(intent) }),
69
116
  params: params,
70
117
  opts: opts
71
118
  )
@@ -9,12 +9,19 @@ module Stripe
9
9
 
10
10
  OBJECT_NAME = "payment_link"
11
11
 
12
- custom_method :list_line_items, http_verb: :get, http_path: "line_items"
13
-
14
12
  def list_line_items(params = {}, opts = {})
15
13
  request_stripe_object(
16
14
  method: :get,
17
- path: resource_url + "/line_items",
15
+ path: format("/v1/payment_links/%<payment_link>s/line_items", { payment_link: CGI.escape(self["id"]) }),
16
+ params: params,
17
+ opts: opts
18
+ )
19
+ end
20
+
21
+ def self.list_line_items(payment_link, params = {}, opts = {})
22
+ request_stripe_object(
23
+ method: :get,
24
+ path: format("/v1/payment_links/%<payment_link>s/line_items", { payment_link: CGI.escape(payment_link) }),
18
25
  params: params,
19
26
  opts: opts
20
27
  )
@@ -9,13 +9,10 @@ module Stripe
9
9
 
10
10
  OBJECT_NAME = "payment_method"
11
11
 
12
- custom_method :attach, http_verb: :post
13
- custom_method :detach, http_verb: :post
14
-
15
12
  def attach(params = {}, opts = {})
16
13
  request_stripe_object(
17
14
  method: :post,
18
- path: resource_url + "/attach",
15
+ path: format("/v1/payment_methods/%<payment_method>s/attach", { payment_method: CGI.escape(self["id"]) }),
19
16
  params: params,
20
17
  opts: opts
21
18
  )
@@ -24,7 +21,25 @@ module Stripe
24
21
  def detach(params = {}, opts = {})
25
22
  request_stripe_object(
26
23
  method: :post,
27
- path: resource_url + "/detach",
24
+ path: format("/v1/payment_methods/%<payment_method>s/detach", { payment_method: CGI.escape(self["id"]) }),
25
+ params: params,
26
+ opts: opts
27
+ )
28
+ end
29
+
30
+ def self.attach(payment_method, params = {}, opts = {})
31
+ request_stripe_object(
32
+ method: :post,
33
+ path: format("/v1/payment_methods/%<payment_method>s/attach", { payment_method: CGI.escape(payment_method) }),
34
+ params: params,
35
+ opts: opts
36
+ )
37
+ end
38
+
39
+ def self.detach(payment_method, params = {}, opts = {})
40
+ request_stripe_object(
41
+ method: :post,
42
+ path: format("/v1/payment_methods/%<payment_method>s/detach", { payment_method: CGI.escape(payment_method) }),
28
43
  params: params,
29
44
  opts: opts
30
45
  )
@@ -9,13 +9,10 @@ module Stripe
9
9
 
10
10
  OBJECT_NAME = "payout"
11
11
 
12
- custom_method :cancel, http_verb: :post
13
- custom_method :reverse, http_verb: :post
14
-
15
12
  def cancel(params = {}, opts = {})
16
13
  request_stripe_object(
17
14
  method: :post,
18
- path: resource_url + "/cancel",
15
+ path: format("/v1/payouts/%<payout>s/cancel", { payout: CGI.escape(self["id"]) }),
19
16
  params: params,
20
17
  opts: opts
21
18
  )
@@ -24,7 +21,25 @@ module Stripe
24
21
  def reverse(params = {}, opts = {})
25
22
  request_stripe_object(
26
23
  method: :post,
27
- path: resource_url + "/reverse",
24
+ path: format("/v1/payouts/%<payout>s/reverse", { payout: CGI.escape(self["id"]) }),
25
+ params: params,
26
+ opts: opts
27
+ )
28
+ end
29
+
30
+ def self.cancel(payout, params = {}, opts = {})
31
+ request_stripe_object(
32
+ method: :post,
33
+ path: format("/v1/payouts/%<payout>s/cancel", { payout: CGI.escape(payout) }),
34
+ params: params,
35
+ opts: opts
36
+ )
37
+ end
38
+
39
+ def self.reverse(payout, params = {}, opts = {})
40
+ request_stripe_object(
41
+ method: :post,
42
+ path: format("/v1/payouts/%<payout>s/reverse", { payout: CGI.escape(payout) }),
28
43
  params: params,
29
44
  opts: opts
30
45
  )
@@ -9,16 +9,10 @@ module Stripe
9
9
 
10
10
  OBJECT_NAME = "quote"
11
11
 
12
- custom_method :accept, http_verb: :post
13
- custom_method :cancel, http_verb: :post
14
- custom_method :finalize_quote, http_verb: :post, http_path: "finalize"
15
- custom_method :list_computed_upfront_line_items, http_verb: :get, http_path: "computed_upfront_line_items"
16
- custom_method :list_line_items, http_verb: :get, http_path: "line_items"
17
-
18
12
  def accept(params = {}, opts = {})
19
13
  request_stripe_object(
20
14
  method: :post,
21
- path: resource_url + "/accept",
15
+ path: format("/v1/quotes/%<quote>s/accept", { quote: CGI.escape(self["id"]) }),
22
16
  params: params,
23
17
  opts: opts
24
18
  )
@@ -27,7 +21,7 @@ module Stripe
27
21
  def cancel(params = {}, opts = {})
28
22
  request_stripe_object(
29
23
  method: :post,
30
- path: resource_url + "/cancel",
24
+ path: format("/v1/quotes/%<quote>s/cancel", { quote: CGI.escape(self["id"]) }),
31
25
  params: params,
32
26
  opts: opts
33
27
  )
@@ -36,7 +30,7 @@ module Stripe
36
30
  def finalize_quote(params = {}, opts = {})
37
31
  request_stripe_object(
38
32
  method: :post,
39
- path: resource_url + "/finalize",
33
+ path: format("/v1/quotes/%<quote>s/finalize", { quote: CGI.escape(self["id"]) }),
40
34
  params: params,
41
35
  opts: opts
42
36
  )
@@ -45,7 +39,7 @@ module Stripe
45
39
  def list_computed_upfront_line_items(params = {}, opts = {})
46
40
  request_stripe_object(
47
41
  method: :get,
48
- path: resource_url + "/computed_upfront_line_items",
42
+ path: format("/v1/quotes/%<quote>s/computed_upfront_line_items", { quote: CGI.escape(self["id"]) }),
49
43
  params: params,
50
44
  opts: opts
51
45
  )
@@ -54,7 +48,52 @@ module Stripe
54
48
  def list_line_items(params = {}, opts = {})
55
49
  request_stripe_object(
56
50
  method: :get,
57
- path: resource_url + "/line_items",
51
+ path: format("/v1/quotes/%<quote>s/line_items", { quote: CGI.escape(self["id"]) }),
52
+ params: params,
53
+ opts: opts
54
+ )
55
+ end
56
+
57
+ def self.accept(quote, params = {}, opts = {})
58
+ request_stripe_object(
59
+ method: :post,
60
+ path: format("/v1/quotes/%<quote>s/accept", { quote: CGI.escape(quote) }),
61
+ params: params,
62
+ opts: opts
63
+ )
64
+ end
65
+
66
+ def self.cancel(quote, params = {}, opts = {})
67
+ request_stripe_object(
68
+ method: :post,
69
+ path: format("/v1/quotes/%<quote>s/cancel", { quote: CGI.escape(quote) }),
70
+ params: params,
71
+ opts: opts
72
+ )
73
+ end
74
+
75
+ def self.finalize_quote(quote, params = {}, opts = {})
76
+ request_stripe_object(
77
+ method: :post,
78
+ path: format("/v1/quotes/%<quote>s/finalize", { quote: CGI.escape(quote) }),
79
+ params: params,
80
+ opts: opts
81
+ )
82
+ end
83
+
84
+ def self.list_computed_upfront_line_items(quote, params = {}, opts = {})
85
+ request_stripe_object(
86
+ method: :get,
87
+ path: format("/v1/quotes/%<quote>s/computed_upfront_line_items", { quote: CGI.escape(quote) }),
88
+ params: params,
89
+ opts: opts
90
+ )
91
+ end
92
+
93
+ def self.list_line_items(quote, params = {}, opts = {})
94
+ request_stripe_object(
95
+ method: :get,
96
+ path: format("/v1/quotes/%<quote>s/line_items", { quote: CGI.escape(quote) }),
58
97
  params: params,
59
98
  opts: opts
60
99
  )
@@ -9,12 +9,19 @@ module Stripe
9
9
 
10
10
  OBJECT_NAME = "refund"
11
11
 
12
- custom_method :cancel, http_verb: :post
13
-
14
12
  def cancel(params = {}, opts = {})
15
13
  request_stripe_object(
16
14
  method: :post,
17
- path: resource_url + "/cancel",
15
+ path: format("/v1/refunds/%<refund>s/cancel", { refund: CGI.escape(self["id"]) }),
16
+ params: params,
17
+ opts: opts
18
+ )
19
+ end
20
+
21
+ def self.cancel(refund, params = {}, opts = {})
22
+ request_stripe_object(
23
+ method: :post,
24
+ path: format("/v1/refunds/%<refund>s/cancel", { refund: CGI.escape(refund) }),
18
25
  params: params,
19
26
  opts: opts
20
27
  )
@@ -27,12 +34,19 @@ module Stripe
27
34
  class TestHelpers < APIResourceTestHelpers
28
35
  RESOURCE_CLASS = Refund
29
36
 
30
- custom_method :expire, http_verb: :post
37
+ def self.expire(refund, params = {}, opts = {})
38
+ request_stripe_object(
39
+ method: :post,
40
+ path: format("/v1/test_helpers/refunds/%<refund>s/expire", { refund: CGI.escape(refund) }),
41
+ params: params,
42
+ opts: opts
43
+ )
44
+ end
31
45
 
32
46
  def expire(params = {}, opts = {})
33
47
  @resource.request_stripe_object(
34
48
  method: :post,
35
- path: resource_url + "/expire",
49
+ path: format("/v1/test_helpers/refunds/%<refund>s/expire", { refund: CGI.escape(@resource["id"]) }),
36
50
  params: params,
37
51
  opts: opts
38
52
  )
@@ -4,7 +4,6 @@
4
4
  module Stripe
5
5
  module Reporting
6
6
  class ReportType < APIResource
7
- extend Stripe::APIOperations::Create
8
7
  extend Stripe::APIOperations::List
9
8
 
10
9
  OBJECT_NAME = "reporting.report_type"
@@ -7,12 +7,19 @@ module Stripe
7
7
 
8
8
  OBJECT_NAME = "review"
9
9
 
10
- custom_method :approve, http_verb: :post
11
-
12
10
  def approve(params = {}, opts = {})
13
11
  request_stripe_object(
14
12
  method: :post,
15
- path: resource_url + "/approve",
13
+ path: format("/v1/reviews/%<review>s/approve", { review: CGI.escape(self["id"]) }),
14
+ params: params,
15
+ opts: opts
16
+ )
17
+ end
18
+
19
+ def self.approve(review, params = {}, opts = {})
20
+ request_stripe_object(
21
+ method: :post,
22
+ path: format("/v1/reviews/%<review>s/approve", { review: CGI.escape(review) }),
16
23
  params: params,
17
24
  opts: opts
18
25
  )
@@ -9,14 +9,10 @@ module Stripe
9
9
 
10
10
  OBJECT_NAME = "setup_intent"
11
11
 
12
- custom_method :cancel, http_verb: :post
13
- custom_method :confirm, http_verb: :post
14
- custom_method :verify_microdeposits, http_verb: :post
15
-
16
12
  def cancel(params = {}, opts = {})
17
13
  request_stripe_object(
18
14
  method: :post,
19
- path: resource_url + "/cancel",
15
+ path: format("/v1/setup_intents/%<intent>s/cancel", { intent: CGI.escape(self["id"]) }),
20
16
  params: params,
21
17
  opts: opts
22
18
  )
@@ -25,7 +21,7 @@ module Stripe
25
21
  def confirm(params = {}, opts = {})
26
22
  request_stripe_object(
27
23
  method: :post,
28
- path: resource_url + "/confirm",
24
+ path: format("/v1/setup_intents/%<intent>s/confirm", { intent: CGI.escape(self["id"]) }),
29
25
  params: params,
30
26
  opts: opts
31
27
  )
@@ -34,7 +30,34 @@ module Stripe
34
30
  def verify_microdeposits(params = {}, opts = {})
35
31
  request_stripe_object(
36
32
  method: :post,
37
- path: resource_url + "/verify_microdeposits",
33
+ path: format("/v1/setup_intents/%<intent>s/verify_microdeposits", { intent: CGI.escape(self["id"]) }),
34
+ params: params,
35
+ opts: opts
36
+ )
37
+ end
38
+
39
+ def self.cancel(intent, params = {}, opts = {})
40
+ request_stripe_object(
41
+ method: :post,
42
+ path: format("/v1/setup_intents/%<intent>s/cancel", { intent: CGI.escape(intent) }),
43
+ params: params,
44
+ opts: opts
45
+ )
46
+ end
47
+
48
+ def self.confirm(intent, params = {}, opts = {})
49
+ request_stripe_object(
50
+ method: :post,
51
+ path: format("/v1/setup_intents/%<intent>s/confirm", { intent: CGI.escape(intent) }),
52
+ params: params,
53
+ opts: opts
54
+ )
55
+ end
56
+
57
+ def self.verify_microdeposits(intent, params = {}, opts = {})
58
+ request_stripe_object(
59
+ method: :post,
60
+ path: format("/v1/setup_intents/%<intent>s/verify_microdeposits", { intent: CGI.escape(intent) }),
38
61
  params: params,
39
62
  opts: opts
40
63
  )
@@ -9,15 +9,22 @@ module Stripe
9
9
 
10
10
  OBJECT_NAME = "source"
11
11
 
12
- custom_method :verify, http_verb: :post
13
-
14
12
  nested_resource_class_methods :source_transaction,
15
13
  operations: %i[retrieve list]
16
14
 
17
15
  def verify(params = {}, opts = {})
18
16
  request_stripe_object(
19
17
  method: :post,
20
- path: resource_url + "/verify",
18
+ path: format("/v1/sources/%<source>s/verify", { source: CGI.escape(self["id"]) }),
19
+ params: params,
20
+ opts: opts
21
+ )
22
+ end
23
+
24
+ def self.verify(source, params = {}, opts = {})
25
+ request_stripe_object(
26
+ method: :post,
27
+ path: format("/v1/sources/%<source>s/verify", { source: CGI.escape(source) }),
21
28
  params: params,
22
29
  opts: opts
23
30
  )
@@ -37,9 +44,12 @@ module Stripe
37
44
  end
38
45
 
39
46
  def source_transactions(params = {}, opts = {})
40
- resp, opts = execute_resource_request(:get, resource_url + "/source_transactions", params,
41
- opts)
42
- Util.convert_to_stripe_object(resp.data, opts)
47
+ request_stripe_object(
48
+ method: :get,
49
+ path: resource_url + "/source_transactions",
50
+ params: params,
51
+ opts: opts
52
+ )
43
53
  end
44
54
  extend Gem::Deprecate
45
55
  deprecate :source_transactions, :"Source.list_source_transactions", 2020, 1
@@ -4,25 +4,74 @@
4
4
  module Stripe
5
5
  class Subscription < APIResource
6
6
  extend Stripe::APIOperations::Create
7
- include Stripe::APIOperations::Delete
8
7
  extend Stripe::APIOperations::List
9
8
  extend Stripe::APIOperations::Search
10
9
  include Stripe::APIOperations::Save
11
10
 
12
11
  OBJECT_NAME = "subscription"
13
12
 
14
- custom_method :delete_discount, http_verb: :delete, http_path: "discount"
13
+ def cancel(params = {}, opts = {})
14
+ request_stripe_object(
15
+ method: :delete,
16
+ path: format("/v1/subscriptions/%<subscription_exposed_id>s", { subscription_exposed_id: CGI.escape(self["id"]) }),
17
+ params: params,
18
+ opts: opts
19
+ )
20
+ end
15
21
 
16
22
  def delete_discount(params = {}, opts = {})
17
23
  request_stripe_object(
18
24
  method: :delete,
19
- path: resource_url + "/discount",
25
+ path: format("/v1/subscriptions/%<subscription_exposed_id>s/discount", { subscription_exposed_id: CGI.escape(self["id"]) }),
26
+ params: params,
27
+ opts: opts
28
+ )
29
+ end
30
+
31
+ def self.cancel(subscription_exposed_id, params = {}, opts = {})
32
+ request_stripe_object(
33
+ method: :delete,
34
+ path: format("/v1/subscriptions/%<subscription_exposed_id>s", { subscription_exposed_id: CGI.escape(subscription_exposed_id) }),
35
+ params: params,
36
+ opts: opts
37
+ )
38
+ end
39
+
40
+ def self.delete_discount(subscription_exposed_id, params = {}, opts = {})
41
+ request_stripe_object(
42
+ method: :delete,
43
+ path: format("/v1/subscriptions/%<subscription_exposed_id>s/discount", { subscription_exposed_id: CGI.escape(subscription_exposed_id) }),
20
44
  params: params,
21
45
  opts: opts
22
46
  )
23
47
  end
24
48
 
25
49
  save_nested_resource :source
50
+ def delete(params = {}, opts = {})
51
+ request_stripe_object(
52
+ method: :delete,
53
+ path: format("/v1/subscriptions/%<subscription_exposed_id>s", { subscription_exposed_id: CGI.escape(self["id"]) }),
54
+ params: params,
55
+ opts: opts
56
+ )
57
+ end
58
+
59
+ def self.delete(subscription_exposed_id, params = {}, opts = {})
60
+ request_stripe_object(
61
+ method: :delete,
62
+ path: format("/v1/subscriptions/%<subscription_exposed_id>s", { subscription_exposed_id: CGI.escape(subscription_exposed_id) }),
63
+ params: params,
64
+ opts: opts
65
+ )
66
+ end
67
+
68
+ extend Gem::Deprecate
69
+ deprecate :delete, "Stripe::Subscription.cancel", 2022, 7
70
+
71
+ class << self
72
+ extend Gem::Deprecate
73
+ deprecate :delete, "Stripe::Subscription#cancel", 2022, 7
74
+ end
26
75
 
27
76
  def self.search(params = {}, opts = {})
28
77
  _search("/v1/subscriptions/search", params, opts)
@@ -15,12 +15,5 @@ module Stripe
15
15
  nested_resource_class_methods :usage_record_summary,
16
16
  operations: %i[list],
17
17
  resource_plural: "usage_record_summaries"
18
-
19
- def usage_record_summaries(params = {}, opts = {})
20
- resp, opts = execute_resource_request(:get, resource_url + "/usage_record_summaries", params, opts)
21
- Util.convert_to_stripe_object(resp.data, opts)
22
- end
23
- extend Gem::Deprecate
24
- deprecate :usage_record_summaries, :"SubscriptionItem.list_usage_record_summaries", 2020, 1
25
18
  end
26
19
  end
@@ -9,13 +9,10 @@ module Stripe
9
9
 
10
10
  OBJECT_NAME = "subscription_schedule"
11
11
 
12
- custom_method :cancel, http_verb: :post
13
- custom_method :release, http_verb: :post
14
-
15
12
  def cancel(params = {}, opts = {})
16
13
  request_stripe_object(
17
14
  method: :post,
18
- path: resource_url + "/cancel",
15
+ path: format("/v1/subscription_schedules/%<schedule>s/cancel", { schedule: CGI.escape(self["id"]) }),
19
16
  params: params,
20
17
  opts: opts
21
18
  )
@@ -24,7 +21,25 @@ module Stripe
24
21
  def release(params = {}, opts = {})
25
22
  request_stripe_object(
26
23
  method: :post,
27
- path: resource_url + "/release",
24
+ path: format("/v1/subscription_schedules/%<schedule>s/release", { schedule: CGI.escape(self["id"]) }),
25
+ params: params,
26
+ opts: opts
27
+ )
28
+ end
29
+
30
+ def self.cancel(schedule, params = {}, opts = {})
31
+ request_stripe_object(
32
+ method: :post,
33
+ path: format("/v1/subscription_schedules/%<schedule>s/cancel", { schedule: CGI.escape(schedule) }),
34
+ params: params,
35
+ opts: opts
36
+ )
37
+ end
38
+
39
+ def self.release(schedule, params = {}, opts = {})
40
+ request_stripe_object(
41
+ method: :post,
42
+ path: format("/v1/subscription_schedules/%<schedule>s/release", { schedule: CGI.escape(schedule) }),
28
43
  params: params,
29
44
  opts: opts
30
45
  )