Merge pull request #1332 from stripe/latest-codegen-beta

Update generated code for beta
This commit is contained in:
stripe-openapi[bot] 2024-02-16 09:42:15 -08:00 committed by GitHub
commit cbe61d7d38
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 92 additions and 12 deletions

View File

@ -1,5 +1,11 @@
# Changelog
## 10.9.0 - 2024-02-15
* [#1329](https://github.com/stripe/stripe-ruby/pull/1329) Update generated code
* Fixed bug where `TaxId` resource `delete` method sent request to wrong URL (https://github.com/stripe/stripe-ruby/issues/1333)
* [#1324](https://github.com/stripe/stripe-ruby/pull/1324) Start running Sorbet in CI
* [#1327](https://github.com/stripe/stripe-ruby/pull/1327) Add methods for dynamically referenced constants
## 10.9.0-beta.1 - 2024-02-08
* [#1321](https://github.com/stripe/stripe-ruby/pull/1321) Update generated code for beta
* Release specs are identical.

View File

@ -1 +1 @@
v827
v831

View File

@ -24,6 +24,9 @@ module Stripe
nested_resource_class_methods :capability,
operations: %i[retrieve update list],
resource_plural: "capabilities"
nested_resource_class_methods :external_account,
operations: %i[create retrieve update delete list]
nested_resource_class_methods :login_link, operations: %i[create]
nested_resource_class_methods :person, operations: %i[create retrieve update delete list]
# Returns a list of people associated with the account's legal entity. The people are returned sorted by creation date, with the most recent people appearing first.
@ -72,10 +75,6 @@ module Stripe
save_nested_resource :external_account
nested_resource_class_methods :external_account,
operations: %i[create retrieve update delete list]
nested_resource_class_methods :login_link, operations: %i[create]
def resource_url
if self["id"]
super

View File

@ -20,8 +20,9 @@ module Stripe
nested_resource_class_methods :balance_transaction, operations: %i[create retrieve update list]
nested_resource_class_methods :cash_balance_transaction, operations: %i[retrieve list]
nested_resource_class_methods :entitlement, operations: %i[list]
nested_resource_class_methods :source, operations: %i[create retrieve update delete list]
nested_resource_class_methods :tax_id, operations: %i[create retrieve delete list]
nested_resource_class_methods :entitlement, operations: %i[list]
# Retrieve funding instructions for a customer cash balance. If funding instructions do not yet exist for the customer, new
# funding instructions will be created. If funding instructions have already been created for a given customer, the same
@ -108,8 +109,6 @@ module Stripe
end
save_nested_resource :source
nested_resource_class_methods :source,
operations: %i[create retrieve update delete list]
# The API request for deleting a card or bank account and for detaching a
# source object are the same.

View File

@ -93,6 +93,31 @@ module Stripe
)
end
# Perform an decremental authorization on an eligible
# [PaymentIntent](https://stripe.com/docs/api/payment_intents/object). To be eligible, the
# PaymentIntent's status must be requires_capture and
# [decremental_authorization.status](https://stripe.com/docs/api/charges/object#charge_object-payment_method_details-card-decremental_authorization)
# must be available.
#
# Decremental authorizations decrease the authorized amount on your customer's card
# to the new, lower amount provided. A single PaymentIntent can call this endpoint multiple times to further decrease the authorized amount.
#
# After decrement, the PaymentIntent object
# returns with the updated
# [amount](https://stripe.com/docs/api/payment_intents/object#payment_intent_object-amount).
# The PaymentIntent will now be capturable up to the new authorized amount.
#
# Each PaymentIntent can have a maximum of 10 decremental or incremental authorization attempts, including declines.
# After it's captured, a PaymentIntent can no longer be decremented.
def decrement_authorization(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/payment_intents/%<intent>s/decrement_authorization", { intent: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Perform an incremental authorization on an eligible
# [PaymentIntent](https://stripe.com/docs/api/payment_intents/object). To be eligible, the
# PaymentIntent's status must be requires_capture and
@ -205,6 +230,31 @@ module Stripe
)
end
# Perform an decremental authorization on an eligible
# [PaymentIntent](https://stripe.com/docs/api/payment_intents/object). To be eligible, the
# PaymentIntent's status must be requires_capture and
# [decremental_authorization.status](https://stripe.com/docs/api/charges/object#charge_object-payment_method_details-card-decremental_authorization)
# must be available.
#
# Decremental authorizations decrease the authorized amount on your customer's card
# to the new, lower amount provided. A single PaymentIntent can call this endpoint multiple times to further decrease the authorized amount.
#
# After decrement, the PaymentIntent object
# returns with the updated
# [amount](https://stripe.com/docs/api/payment_intents/object#payment_intent_object-amount).
# The PaymentIntent will now be capturable up to the new authorized amount.
#
# Each PaymentIntent can have a maximum of 10 decremental or incremental authorization attempts, including declines.
# After it's captured, a PaymentIntent can no longer be decremented.
def self.decrement_authorization(intent, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/payment_intents/%<intent>s/decrement_authorization", { intent: CGI.escape(intent) }),
params: params,
opts: opts
)
end
# Perform an incremental authorization on an eligible
# [PaymentIntent](https://stripe.com/docs/api/payment_intents/object). To be eligible, the
# PaymentIntent's status must be requires_capture and

View File

@ -30,21 +30,19 @@ module Stripe
"'tax_id_id')`"
end
# Deletes an existing tax_id object.
def self.delete(id, params = {}, opts = {})
request_stripe_object(
method: :delete,
path: format("/v1/customers/%<customer>s/tax_ids/%<id>s", { customer: CGI.escape(customer), id: CGI.escape(id) }),
path: "#{resource_url}/#{id}",
params: params,
opts: opts
)
end
# Deletes an existing tax_id object.
def delete(params = {}, opts = {})
request_stripe_object(
method: :delete,
path: format("/v1/customers/%<customer>s/tax_ids/%<id>s", { customer: CGI.escape(self["id"]), id: CGI.escape(id) }),
path: resource_url.to_s,
params: params,
opts: opts
)

View File

@ -482,6 +482,14 @@ module Stripe
Stripe::Customer.search({ query: "name:'fakename' AND metadata['foo']:'bar'" })
assert_requested :get, "#{Stripe.api_base}/v1/customers/search?query=name:'fakename' AND metadata['foo']:'bar'"
end
should "Test customers sources delete" do
Stripe::Customer.delete_source("cus_xxxxxxxxxxxxx", "ba_xxxxxxxxxxxxx")
assert_requested :delete, "#{Stripe.api_base}/v1/customers/cus_xxxxxxxxxxxxx/sources/ba_xxxxxxxxxxxxx?"
end
should "Test customers sources delete 2" do
Stripe::Customer.delete_source("cus_xxxxxxxxxxxxx", "card_xxxxxxxxxxxxx")
assert_requested :delete, "#{Stripe.api_base}/v1/customers/cus_xxxxxxxxxxxxx/sources/card_xxxxxxxxxxxxx?"
end
should "Test customers sources get" do
Stripe::Customer.list_sources(
"cus_xxxxxxxxxxxxx",
@ -510,6 +518,10 @@ module Stripe
Stripe::Customer.retrieve_source("cus_xxxxxxxxxxxxx", "card_xxxxxxxxxxxxx")
assert_requested :get, "#{Stripe.api_base}/v1/customers/cus_xxxxxxxxxxxxx/sources/card_xxxxxxxxxxxxx?"
end
should "Test customers sources post" do
Stripe::Customer.update_source("cus_123", "card_123", { account_holder_name: "Kamil" })
assert_requested :post, "#{Stripe.api_base}/v1/customers/cus_123/sources/card_123"
end
should "Test customers sources post 2" do
Stripe::Customer.create_source("cus_xxxxxxxxxxxxx", { source: "btok_xxxxxxxxxxxxx" })
assert_requested :post, "#{Stripe.api_base}/v1/customers/cus_xxxxxxxxxxxxx/sources"
@ -518,6 +530,22 @@ module Stripe
Stripe::Customer.create_source("cus_xxxxxxxxxxxxx", { source: "tok_xxxx" })
assert_requested :post, "#{Stripe.api_base}/v1/customers/cus_xxxxxxxxxxxxx/sources"
end
should "Test customers sources post 4" do
Stripe::Customer.update_source(
"cus_xxxxxxxxxxxxx",
"ba_xxxxxxxxxxxxx",
{ metadata: { order_id: "6735" } }
)
assert_requested :post, "#{Stripe.api_base}/v1/customers/cus_xxxxxxxxxxxxx/sources/ba_xxxxxxxxxxxxx"
end
should "Test customers sources post 5" do
Stripe::Customer.update_source(
"cus_xxxxxxxxxxxxx",
"card_xxxxxxxxxxxxx",
{ name: "Jenny Rosen" }
)
assert_requested :post, "#{Stripe.api_base}/v1/customers/cus_xxxxxxxxxxxxx/sources/card_xxxxxxxxxxxxx"
end
should "Test customers tax ids delete" do
Stripe::Customer.delete_tax_id("cus_xxxxxxxxxxxxx", "txi_xxxxxxxxxxxxx")
assert_requested :delete, "#{Stripe.api_base}/v1/customers/cus_xxxxxxxxxxxxx/tax_ids/txi_xxxxxxxxxxxxx?"