stripe 10.11.0 → 10.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -9
  3. data/OPENAPI_VERSION +1 -1
  4. data/VERSION +1 -1
  5. data/lib/stripe/object_types.rb +6 -5
  6. data/lib/stripe/resources/account.rb +70 -70
  7. data/lib/stripe/resources/apple_pay_domain.rb +4 -4
  8. data/lib/stripe/resources/apps/secret.rb +5 -5
  9. data/lib/stripe/resources/charge.rb +1 -1
  10. data/lib/stripe/resources/checkout/session.rb +21 -21
  11. data/lib/stripe/resources/credit_note.rb +35 -35
  12. data/lib/stripe/resources/customer.rb +58 -58
  13. data/lib/stripe/resources/ephemeral_key.rb +9 -9
  14. data/lib/stripe/resources/file.rb +5 -5
  15. data/lib/stripe/resources/financial_connections/account.rb +34 -34
  16. data/lib/stripe/resources/identity/verification_session.rb +38 -38
  17. data/lib/stripe/resources/invoice.rb +72 -72
  18. data/lib/stripe/resources/issuing/authorization.rb +32 -32
  19. data/lib/stripe/resources/issuing/card.rb +22 -22
  20. data/lib/stripe/resources/issuing/dispute.rb +16 -16
  21. data/lib/stripe/resources/issuing/personalization_design.rb +119 -0
  22. data/lib/stripe/resources/issuing/physical_bundle.rb +26 -0
  23. data/lib/stripe/resources/payment_intent.rb +100 -100
  24. data/lib/stripe/resources/payment_link.rb +10 -10
  25. data/lib/stripe/resources/payment_method.rb +17 -17
  26. data/lib/stripe/resources/payment_method_domain.rb +29 -29
  27. data/lib/stripe/resources/payout.rb +22 -22
  28. data/lib/stripe/resources/quote.rb +51 -51
  29. data/lib/stripe/resources/setup_intent.rb +32 -32
  30. data/lib/stripe/resources/sigma/scheduled_query_run.rb +4 -4
  31. data/lib/stripe/resources/source.rb +18 -18
  32. data/lib/stripe/resources/subscription.rb +36 -36
  33. data/lib/stripe/resources/subscription_item.rb +1 -1
  34. data/lib/stripe/resources/subscription_schedule.rb +19 -19
  35. data/lib/stripe/resources/tax/calculation.rb +10 -10
  36. data/lib/stripe/resources/tax/settings.rb +0 -1
  37. data/lib/stripe/resources/tax/transaction.rb +10 -10
  38. data/lib/stripe/resources/terminal/reader.rb +46 -46
  39. data/lib/stripe/resources/transfer.rb +1 -1
  40. data/lib/stripe/resources/treasury/financial_account.rb +25 -25
  41. data/lib/stripe/resources/treasury/inbound_transfer.rb +14 -14
  42. data/lib/stripe/resources/treasury/outbound_payment.rb +14 -14
  43. data/lib/stripe/resources/treasury/outbound_transfer.rb +14 -14
  44. data/lib/stripe/resources/treasury/transaction_entry.rb +4 -4
  45. data/lib/stripe/resources.rb +2 -0
  46. data/lib/stripe/version.rb +1 -1
  47. metadata +4 -2
@@ -9,9 +9,9 @@ module Stripe
9
9
  extend Stripe::APIOperations::Create
10
10
  include Stripe::APIOperations::Delete
11
11
  extend Stripe::APIOperations::List
12
+ extend Stripe::APIOperations::NestedResource
12
13
  extend Stripe::APIOperations::Search
13
14
  include Stripe::APIOperations::Save
14
- extend Stripe::APIOperations::NestedResource
15
15
 
16
16
  OBJECT_NAME = "customer"
17
17
  def self.object_name
@@ -23,6 +23,11 @@ module Stripe
23
23
  nested_resource_class_methods :source, operations: %i[create retrieve update delete list]
24
24
  nested_resource_class_methods :tax_id, operations: %i[create retrieve delete list]
25
25
 
26
+ # Creates a new customer object.
27
+ def self.create(params = {}, opts = {})
28
+ request_stripe_object(method: :post, path: "/v1/customers", params: params, opts: opts)
29
+ end
30
+
26
31
  # Retrieve funding instructions for a customer cash balance. If funding instructions do not yet exist for the customer, new
27
32
  # funding instructions will be created. If funding instructions have already been created for a given customer, the same
28
33
  # funding instructions will be retrieved. In other words, we will return the same funding instructions each time.
@@ -35,43 +40,43 @@ module Stripe
35
40
  )
36
41
  end
37
42
 
38
- # Removes the currently applied discount on a customer.
39
- def delete_discount(params = {}, opts = {})
43
+ # Retrieve funding instructions for a customer cash balance. If funding instructions do not yet exist for the customer, new
44
+ # funding instructions will be created. If funding instructions have already been created for a given customer, the same
45
+ # funding instructions will be retrieved. In other words, we will return the same funding instructions each time.
46
+ def self.create_funding_instructions(customer, params = {}, opts = {})
40
47
  request_stripe_object(
41
- method: :delete,
42
- path: format("/v1/customers/%<customer>s/discount", { customer: CGI.escape(self["id"]) }),
48
+ method: :post,
49
+ path: format("/v1/customers/%<customer>s/funding_instructions", { customer: CGI.escape(customer) }),
43
50
  params: params,
44
51
  opts: opts
45
52
  )
46
53
  end
47
54
 
48
- # Returns a list of PaymentMethods for a given Customer
49
- def list_payment_methods(params = {}, opts = {})
55
+ # Permanently deletes a customer. It cannot be undone. Also immediately cancels any active subscriptions on the customer.
56
+ def self.delete(id, params = {}, opts = {})
50
57
  request_stripe_object(
51
- method: :get,
52
- path: format("/v1/customers/%<customer>s/payment_methods", { customer: CGI.escape(self["id"]) }),
58
+ method: :delete,
59
+ path: format("/v1/customers/%<id>s", { id: CGI.escape(id) }),
53
60
  params: params,
54
61
  opts: opts
55
62
  )
56
63
  end
57
64
 
58
- # Retrieves a PaymentMethod object for a given Customer.
59
- def retrieve_payment_method(payment_method, params = {}, opts = {})
65
+ # Permanently deletes a customer. It cannot be undone. Also immediately cancels any active subscriptions on the customer.
66
+ def delete(params = {}, opts = {})
60
67
  request_stripe_object(
61
- method: :get,
62
- path: format("/v1/customers/%<customer>s/payment_methods/%<payment_method>s", { customer: CGI.escape(self["id"]), payment_method: CGI.escape(payment_method) }),
68
+ method: :delete,
69
+ path: format("/v1/customers/%<customer>s", { customer: CGI.escape(self["id"]) }),
63
70
  params: params,
64
71
  opts: opts
65
72
  )
66
73
  end
67
74
 
68
- # Retrieve funding instructions for a customer cash balance. If funding instructions do not yet exist for the customer, new
69
- # funding instructions will be created. If funding instructions have already been created for a given customer, the same
70
- # funding instructions will be retrieved. In other words, we will return the same funding instructions each time.
71
- def self.create_funding_instructions(customer, params = {}, opts = {})
75
+ # Removes the currently applied discount on a customer.
76
+ def delete_discount(params = {}, opts = {})
72
77
  request_stripe_object(
73
- method: :post,
74
- path: format("/v1/customers/%<customer>s/funding_instructions", { customer: CGI.escape(customer) }),
78
+ method: :delete,
79
+ path: format("/v1/customers/%<customer>s/discount", { customer: CGI.escape(self["id"]) }),
75
80
  params: params,
76
81
  opts: opts
77
82
  )
@@ -87,62 +92,59 @@ module Stripe
87
92
  )
88
93
  end
89
94
 
95
+ # Returns a list of your customers. The customers are returned sorted by creation date, with the most recent customers appearing first.
96
+ def self.list(filters = {}, opts = {})
97
+ request_stripe_object(method: :get, path: "/v1/customers", params: filters, opts: opts)
98
+ end
99
+
90
100
  # Returns a list of PaymentMethods for a given Customer
91
- def self.list_payment_methods(customer, params = {}, opts = {})
101
+ def list_payment_methods(params = {}, opts = {})
92
102
  request_stripe_object(
93
103
  method: :get,
94
- path: format("/v1/customers/%<customer>s/payment_methods", { customer: CGI.escape(customer) }),
104
+ path: format("/v1/customers/%<customer>s/payment_methods", { customer: CGI.escape(self["id"]) }),
95
105
  params: params,
96
106
  opts: opts
97
107
  )
98
108
  end
99
109
 
100
- # Retrieves a PaymentMethod object for a given Customer.
101
- def self.retrieve_payment_method(customer, payment_method, params = {}, opts = {})
110
+ # Returns a list of PaymentMethods for a given Customer
111
+ def self.list_payment_methods(customer, params = {}, opts = {})
102
112
  request_stripe_object(
103
113
  method: :get,
104
- path: format("/v1/customers/%<customer>s/payment_methods/%<payment_method>s", { customer: CGI.escape(customer), payment_method: CGI.escape(payment_method) }),
114
+ path: format("/v1/customers/%<customer>s/payment_methods", { customer: CGI.escape(customer) }),
105
115
  params: params,
106
116
  opts: opts
107
117
  )
108
118
  end
109
119
 
110
- save_nested_resource :source
111
-
112
- # The API request for deleting a card or bank account and for detaching a
113
- # source object are the same.
114
- class << self
115
- alias detach_source delete_source
116
- end
117
-
118
- # Creates a new customer object.
119
- def self.create(params = {}, opts = {})
120
- request_stripe_object(method: :post, path: "/v1/customers", params: params, opts: opts)
121
- end
122
-
123
- # Permanently deletes a customer. It cannot be undone. Also immediately cancels any active subscriptions on the customer.
124
- def self.delete(id, params = {}, opts = {})
120
+ # Retrieves a customer's cash balance.
121
+ def self.retrieve_cash_balance(customer, params = {}, opts = {})
125
122
  request_stripe_object(
126
- method: :delete,
127
- path: format("/v1/customers/%<id>s", { id: CGI.escape(id) }),
123
+ method: :get,
124
+ path: format("/v1/customers/%<customer>s/cash_balance", { customer: CGI.escape(customer) }),
128
125
  params: params,
129
126
  opts: opts
130
127
  )
131
128
  end
132
129
 
133
- # Permanently deletes a customer. It cannot be undone. Also immediately cancels any active subscriptions on the customer.
134
- def delete(params = {}, opts = {})
130
+ # Retrieves a PaymentMethod object for a given Customer.
131
+ def retrieve_payment_method(payment_method, params = {}, opts = {})
135
132
  request_stripe_object(
136
- method: :delete,
137
- path: format("/v1/customers/%<customer>s", { customer: CGI.escape(self["id"]) }),
133
+ method: :get,
134
+ path: format("/v1/customers/%<customer>s/payment_methods/%<payment_method>s", { customer: CGI.escape(self["id"]), payment_method: CGI.escape(payment_method) }),
138
135
  params: params,
139
136
  opts: opts
140
137
  )
141
138
  end
142
139
 
143
- # Returns a list of your customers. The customers are returned sorted by creation date, with the most recent customers appearing first.
144
- def self.list(filters = {}, opts = {})
145
- request_stripe_object(method: :get, path: "/v1/customers", params: filters, opts: opts)
140
+ # Retrieves a PaymentMethod object for a given Customer.
141
+ def self.retrieve_payment_method(customer, payment_method, params = {}, opts = {})
142
+ request_stripe_object(
143
+ method: :get,
144
+ path: format("/v1/customers/%<customer>s/payment_methods/%<payment_method>s", { customer: CGI.escape(customer), payment_method: CGI.escape(payment_method) }),
145
+ params: params,
146
+ opts: opts
147
+ )
146
148
  end
147
149
 
148
150
  def self.search(params = {}, opts = {})
@@ -165,16 +167,6 @@ module Stripe
165
167
  )
166
168
  end
167
169
 
168
- # Retrieves a customer's cash balance.
169
- def self.retrieve_cash_balance(customer, params = {}, opts = {})
170
- request_stripe_object(
171
- method: :get,
172
- path: format("/v1/customers/%<customer>s/cash_balance", { customer: CGI.escape(customer) }),
173
- params: params,
174
- opts: opts
175
- )
176
- end
177
-
178
170
  # Changes the settings on a customer's cash balance.
179
171
  def self.update_cash_balance(customer, params = {}, opts = {})
180
172
  request_stripe_object(
@@ -185,6 +177,14 @@ module Stripe
185
177
  )
186
178
  end
187
179
 
180
+ save_nested_resource :source
181
+
182
+ # The API request for deleting a card or bank account and for detaching a
183
+ # source object are the same.
184
+ class << self
185
+ alias detach_source delete_source
186
+ end
187
+
188
188
  def test_helpers
189
189
  TestHelpers.new(self)
190
190
  end
@@ -11,15 +11,6 @@ module Stripe
11
11
  "ephemeral_key"
12
12
  end
13
13
 
14
- def self.create(params = {}, opts = {})
15
- opts = Util.normalize_opts(opts)
16
- unless opts[:stripe_version]
17
- raise ArgumentError,
18
- "stripe_version must be specified to create an ephemeral key"
19
- end
20
- super
21
- end
22
-
23
14
  # Invalidates a short-lived API key for a given resource.
24
15
  def self.delete(id, params = {}, opts = {})
25
16
  request_stripe_object(
@@ -39,5 +30,14 @@ module Stripe
39
30
  opts: opts
40
31
  )
41
32
  end
33
+
34
+ def self.create(params = {}, opts = {})
35
+ opts = Util.normalize_opts(opts)
36
+ unless opts[:stripe_version]
37
+ raise ArgumentError,
38
+ "stripe_version must be specified to create an ephemeral key"
39
+ end
40
+ super
41
+ end
42
42
  end
43
43
  end
@@ -18,6 +18,11 @@ module Stripe
18
18
  "file"
19
19
  end
20
20
 
21
+ # Returns a list of the files that your account has access to. Stripe sorts and returns the files by their creation dates, placing the most recently created files at the top.
22
+ def self.list(filters = {}, opts = {})
23
+ request_stripe_object(method: :get, path: "/v1/files", params: filters, opts: opts)
24
+ end
25
+
21
26
  # This resource can have two different object names. In latter API
22
27
  # versions, only `file` is used, but since stripe-ruby may be used with
23
28
  # any API version, we need to support deserializing the older
@@ -43,10 +48,5 @@ module Stripe
43
48
  }.merge(Util.normalize_opts(opts))
44
49
  super
45
50
  end
46
-
47
- # Returns a list of the files that your account has access to. Stripe sorts and returns the files by their creation dates, placing the most recently created files at the top.
48
- def self.list(filters = {}, opts = {})
49
- request_stripe_object(method: :get, path: "/v1/files", params: filters, opts: opts)
50
- end
51
51
  end
52
52
  end
@@ -22,71 +22,71 @@ module Stripe
22
22
  )
23
23
  end
24
24
 
25
- # Lists all owners for a given Account
26
- def list_owners(params = {}, opts = {})
25
+ # Disables your access to a Financial Connections Account. You will no longer be able to access data associated with the account (e.g. balances, transactions).
26
+ def self.disconnect(account, params = {}, opts = {})
27
27
  request_stripe_object(
28
- method: :get,
29
- path: format("/v1/financial_connections/accounts/%<account>s/owners", { account: CGI.escape(self["id"]) }),
28
+ method: :post,
29
+ path: format("/v1/financial_connections/accounts/%<account>s/disconnect", { account: CGI.escape(account) }),
30
30
  params: params,
31
31
  opts: opts
32
32
  )
33
33
  end
34
34
 
35
- # Refreshes the data associated with a Financial Connections Account.
36
- def refresh_account(params = {}, opts = {})
35
+ # Returns a list of Financial Connections Account objects.
36
+ def self.list(filters = {}, opts = {})
37
37
  request_stripe_object(
38
- method: :post,
39
- path: format("/v1/financial_connections/accounts/%<account>s/refresh", { account: CGI.escape(self["id"]) }),
40
- params: params,
38
+ method: :get,
39
+ path: "/v1/financial_connections/accounts",
40
+ params: filters,
41
41
  opts: opts
42
42
  )
43
43
  end
44
44
 
45
- # Subscribes to periodic refreshes of data associated with a Financial Connections Account.
46
- def subscribe(params = {}, opts = {})
45
+ # Lists all owners for a given Account
46
+ def list_owners(params = {}, opts = {})
47
47
  request_stripe_object(
48
- method: :post,
49
- path: format("/v1/financial_connections/accounts/%<account>s/subscribe", { account: CGI.escape(self["id"]) }),
48
+ method: :get,
49
+ path: format("/v1/financial_connections/accounts/%<account>s/owners", { account: CGI.escape(self["id"]) }),
50
50
  params: params,
51
51
  opts: opts
52
52
  )
53
53
  end
54
54
 
55
- # Unsubscribes from periodic refreshes of data associated with a Financial Connections Account.
56
- def unsubscribe(params = {}, opts = {})
55
+ # Lists all owners for a given Account
56
+ def self.list_owners(account, params = {}, opts = {})
57
57
  request_stripe_object(
58
- method: :post,
59
- path: format("/v1/financial_connections/accounts/%<account>s/unsubscribe", { account: CGI.escape(self["id"]) }),
58
+ method: :get,
59
+ path: format("/v1/financial_connections/accounts/%<account>s/owners", { account: CGI.escape(account) }),
60
60
  params: params,
61
61
  opts: opts
62
62
  )
63
63
  end
64
64
 
65
- # Disables your access to a Financial Connections Account. You will no longer be able to access data associated with the account (e.g. balances, transactions).
66
- def self.disconnect(account, params = {}, opts = {})
65
+ # Refreshes the data associated with a Financial Connections Account.
66
+ def refresh_account(params = {}, opts = {})
67
67
  request_stripe_object(
68
68
  method: :post,
69
- path: format("/v1/financial_connections/accounts/%<account>s/disconnect", { account: CGI.escape(account) }),
69
+ path: format("/v1/financial_connections/accounts/%<account>s/refresh", { account: CGI.escape(self["id"]) }),
70
70
  params: params,
71
71
  opts: opts
72
72
  )
73
73
  end
74
74
 
75
- # Lists all owners for a given Account
76
- def self.list_owners(account, params = {}, opts = {})
75
+ # Refreshes the data associated with a Financial Connections Account.
76
+ def self.refresh_account(account, params = {}, opts = {})
77
77
  request_stripe_object(
78
- method: :get,
79
- path: format("/v1/financial_connections/accounts/%<account>s/owners", { account: CGI.escape(account) }),
78
+ method: :post,
79
+ path: format("/v1/financial_connections/accounts/%<account>s/refresh", { account: CGI.escape(account) }),
80
80
  params: params,
81
81
  opts: opts
82
82
  )
83
83
  end
84
84
 
85
- # Refreshes the data associated with a Financial Connections Account.
86
- def self.refresh_account(account, params = {}, opts = {})
85
+ # Subscribes to periodic refreshes of data associated with a Financial Connections Account.
86
+ def subscribe(params = {}, opts = {})
87
87
  request_stripe_object(
88
88
  method: :post,
89
- path: format("/v1/financial_connections/accounts/%<account>s/refresh", { account: CGI.escape(account) }),
89
+ path: format("/v1/financial_connections/accounts/%<account>s/subscribe", { account: CGI.escape(self["id"]) }),
90
90
  params: params,
91
91
  opts: opts
92
92
  )
@@ -103,21 +103,21 @@ module Stripe
103
103
  end
104
104
 
105
105
  # Unsubscribes from periodic refreshes of data associated with a Financial Connections Account.
106
- def self.unsubscribe(account, params = {}, opts = {})
106
+ def unsubscribe(params = {}, opts = {})
107
107
  request_stripe_object(
108
108
  method: :post,
109
- path: format("/v1/financial_connections/accounts/%<account>s/unsubscribe", { account: CGI.escape(account) }),
109
+ path: format("/v1/financial_connections/accounts/%<account>s/unsubscribe", { account: CGI.escape(self["id"]) }),
110
110
  params: params,
111
111
  opts: opts
112
112
  )
113
113
  end
114
114
 
115
- # Returns a list of Financial Connections Account objects.
116
- def self.list(filters = {}, opts = {})
115
+ # Unsubscribes from periodic refreshes of data associated with a Financial Connections Account.
116
+ def self.unsubscribe(account, params = {}, opts = {})
117
117
  request_stripe_object(
118
- method: :get,
119
- path: "/v1/financial_connections/accounts",
120
- params: filters,
118
+ method: :post,
119
+ path: format("/v1/financial_connections/accounts/%<account>s/unsubscribe", { account: CGI.escape(account) }),
120
+ params: params,
121
121
  opts: opts
122
122
  )
123
123
  end
@@ -36,6 +36,44 @@ module Stripe
36
36
  )
37
37
  end
38
38
 
39
+ # A VerificationSession object can be canceled when it is in requires_input [status](https://stripe.com/docs/identity/how-sessions-work).
40
+ #
41
+ # Once canceled, future submission attempts are disabled. This cannot be undone. [Learn more](https://stripe.com/docs/identity/verification-sessions#cancel).
42
+ def self.cancel(session, params = {}, opts = {})
43
+ request_stripe_object(
44
+ method: :post,
45
+ path: format("/v1/identity/verification_sessions/%<session>s/cancel", { session: CGI.escape(session) }),
46
+ params: params,
47
+ opts: opts
48
+ )
49
+ end
50
+
51
+ # Creates a VerificationSession object.
52
+ #
53
+ # After the VerificationSession is created, display a verification modal using the session client_secret or send your users to the session's url.
54
+ #
55
+ # If your API key is in test mode, verification checks won't actually process, though everything else will occur as if in live mode.
56
+ #
57
+ # Related guide: [Verify your users' identity documents](https://stripe.com/docs/identity/verify-identity-documents)
58
+ def self.create(params = {}, opts = {})
59
+ request_stripe_object(
60
+ method: :post,
61
+ path: "/v1/identity/verification_sessions",
62
+ params: params,
63
+ opts: opts
64
+ )
65
+ end
66
+
67
+ # Returns a list of VerificationSessions
68
+ def self.list(filters = {}, opts = {})
69
+ request_stripe_object(
70
+ method: :get,
71
+ path: "/v1/identity/verification_sessions",
72
+ params: filters,
73
+ opts: opts
74
+ )
75
+ end
76
+
39
77
  # Redact a VerificationSession to remove all collected information from Stripe. This will redact
40
78
  # the VerificationSession and all objects related to it, including VerificationReports, Events,
41
79
  # request logs, etc.
@@ -64,18 +102,6 @@ module Stripe
64
102
  )
65
103
  end
66
104
 
67
- # A VerificationSession object can be canceled when it is in requires_input [status](https://stripe.com/docs/identity/how-sessions-work).
68
- #
69
- # Once canceled, future submission attempts are disabled. This cannot be undone. [Learn more](https://stripe.com/docs/identity/verification-sessions#cancel).
70
- def self.cancel(session, params = {}, opts = {})
71
- request_stripe_object(
72
- method: :post,
73
- path: format("/v1/identity/verification_sessions/%<session>s/cancel", { session: CGI.escape(session) }),
74
- params: params,
75
- opts: opts
76
- )
77
- end
78
-
79
105
  # Redact a VerificationSession to remove all collected information from Stripe. This will redact
80
106
  # the VerificationSession and all objects related to it, including VerificationReports, Events,
81
107
  # request logs, etc.
@@ -104,32 +130,6 @@ module Stripe
104
130
  )
105
131
  end
106
132
 
107
- # Creates a VerificationSession object.
108
- #
109
- # After the VerificationSession is created, display a verification modal using the session client_secret or send your users to the session's url.
110
- #
111
- # If your API key is in test mode, verification checks won't actually process, though everything else will occur as if in live mode.
112
- #
113
- # Related guide: [Verify your users' identity documents](https://stripe.com/docs/identity/verify-identity-documents)
114
- def self.create(params = {}, opts = {})
115
- request_stripe_object(
116
- method: :post,
117
- path: "/v1/identity/verification_sessions",
118
- params: params,
119
- opts: opts
120
- )
121
- end
122
-
123
- # Returns a list of VerificationSessions
124
- def self.list(filters = {}, opts = {})
125
- request_stripe_object(
126
- method: :get,
127
- path: "/v1/identity/verification_sessions",
128
- params: filters,
129
- opts: opts
130
- )
131
- end
132
-
133
133
  # Updates a VerificationSession object.
134
134
  #
135
135
  # When the session status is requires_input, you can use this method to update the