From 56b995025072533e09ad12c3db6b13e148ebbb44 Mon Sep 17 00:00:00 2001 From: helenye-stripe <111009531+helenye-stripe@users.noreply.github.com> Date: Thu, 14 Nov 2024 18:28:00 -0800 Subject: [PATCH 1/4] Fix incorrect key in param encoding (#1488) --- lib/stripe/util.rb | 2 +- test/stripe/util_test.rb | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/stripe/util.rb b/lib/stripe/util.rb index 448178881..d03e758c2 100644 --- a/lib/stripe/util.rb +++ b/lib/stripe/util.rb @@ -259,7 +259,7 @@ def self.flatten_params_array(value, api_mode, calculated_key) if elem.is_a?(Hash) result += flatten_params(elem, api_mode, "#{calculated_key}[#{i}]") elsif elem.is_a?(Array) - result += flatten_params_array(elem, calculated_key, api_mode) + result += flatten_params_array(elem, api_mode, calculated_key) else result << if api_mode == :v2 [calculated_key, elem] diff --git a/test/stripe/util_test.rb b/test/stripe/util_test.rb index 900c37fb3..8e5f56082 100644 --- a/test/stripe/util_test.rb +++ b/test/stripe/util_test.rb @@ -16,6 +16,7 @@ class UtilTest < Test::Unit::TestCase # NOTE: the empty hash won't even show up in the request g: [], + } assert_equal( "a=3&b=%2Bfoo%3F&c=bar%26baz&d[a]=a&d[b]=b&e[0]=0&e[1]=1&f=", @@ -23,6 +24,16 @@ class UtilTest < Test::Unit::TestCase ) end + should "correctly represent nested arrays" do + params = { + a: [[foo: "bar", baz: "qux"]], + } + assert_equal( + "a[0][foo]=bar&a[0][baz]=qux", + Stripe::Util.encode_parameters(params, :v1) + ) + end + should "use correct array expansion for v2 query params" do params = { d: { a: "a", b: "b" }, From 7ddf16d170c0b10533882c4f17c18130b78795d9 Mon Sep 17 00:00:00 2001 From: Helen Ye Date: Fri, 15 Nov 2024 10:26:46 -0500 Subject: [PATCH 2/4] Bump version to 13.1.2 --- CHANGELOG.md | 4 ++++ VERSION | 2 +- lib/stripe/version.rb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d9c8605f..3b390624e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ # Changelog +## 13.1.2 - 2024-11-15 +* [#1488](https://github.com/stripe/stripe-ruby/pull/1488) Fix incorrect key in param encoding +* [#1487](https://github.com/stripe/stripe-ruby/pull/1487) Update VSCode default extensions to use solargraph instead of ruby lsp + ## 13.1.1 - 2024-11-06 * [#1483](https://github.com/stripe/stripe-ruby/pull/1483) Fix APIResource#retrieve not sending `stripe_version` * [#1478](https://github.com/stripe/stripe-ruby/pull/1478) Update changelog with a note on 2024-10-28.acacia API version diff --git a/VERSION b/VERSION index 21b80e995..383738180 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -13.1.1 +13.1.2 diff --git a/lib/stripe/version.rb b/lib/stripe/version.rb index e8e5736ed..21b26555a 100644 --- a/lib/stripe/version.rb +++ b/lib/stripe/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Stripe - VERSION = "13.1.1" + VERSION = "13.1.2" end From 7c7f431838317810d3a70fc1d61ae13ec94de30c Mon Sep 17 00:00:00 2001 From: "stripe-openapi[bot]" <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Wed, 20 Nov 2024 23:25:25 +0000 Subject: [PATCH 3/4] Update generated code (#1486) * Update generated code for v1341 * Update generated code for v1347 --------- Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Co-authored-by: Ramya Rao <100975018+ramya-stripe@users.noreply.github.com> --- OPENAPI_VERSION | 2 +- lib/stripe/api_version.rb | 2 +- lib/stripe/resources/billing/credit_grant.rb | 11 +++++----- lib/stripe/resources/issuing/authorization.rb | 20 +++++++++++++++++++ lib/stripe/resources/issuing/card.rb | 2 +- lib/stripe/resources/issuing/cardholder.rb | 2 +- lib/stripe/resources/subscription.rb | 2 +- .../services/billing/credit_grant_service.rb | 6 +++--- lib/stripe/services/subscription_service.rb | 2 +- .../issuing/authorization_service.rb | 11 ++++++++++ 10 files changed, 45 insertions(+), 15 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 579e73fad..7ab08411d 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1318 \ No newline at end of file +v1347 \ No newline at end of file diff --git a/lib/stripe/api_version.rb b/lib/stripe/api_version.rb index f0b789d86..cb1d8b67d 100644 --- a/lib/stripe/api_version.rb +++ b/lib/stripe/api_version.rb @@ -3,6 +3,6 @@ module Stripe module ApiVersion - CURRENT = "2024-10-28.acacia" + CURRENT = "2024-11-20.acacia" end end diff --git a/lib/stripe/resources/billing/credit_grant.rb b/lib/stripe/resources/billing/credit_grant.rb index b12198e5e..43839816a 100644 --- a/lib/stripe/resources/billing/credit_grant.rb +++ b/lib/stripe/resources/billing/credit_grant.rb @@ -6,7 +6,6 @@ module Billing # A credit grant is an API resource that documents the allocation of some billing credits to a customer. # # Related guide: [Billing credits](https://docs.stripe.com/billing/subscriptions/usage-based/billing-credits) - # end class CreditGrant < APIResource extend Stripe::APIOperations::Create extend Stripe::APIOperations::List @@ -27,7 +26,7 @@ def self.create(params = {}, opts = {}) ) end - # Expires a credit grant + # Expires a credit grant. def expire(params = {}, opts = {}) request_stripe_object( method: :post, @@ -37,7 +36,7 @@ def expire(params = {}, opts = {}) ) end - # Expires a credit grant + # Expires a credit grant. def self.expire(id, params = {}, opts = {}) request_stripe_object( method: :post, @@ -47,7 +46,7 @@ def self.expire(id, params = {}, opts = {}) ) end - # Retrieve a list of credit grants + # Retrieve a list of credit grants. def self.list(filters = {}, opts = {}) request_stripe_object( method: :get, @@ -67,7 +66,7 @@ def self.update(id, params = {}, opts = {}) ) end - # Voids a credit grant + # Voids a credit grant. def void_grant(params = {}, opts = {}) request_stripe_object( method: :post, @@ -77,7 +76,7 @@ def void_grant(params = {}, opts = {}) ) end - # Voids a credit grant + # Voids a credit grant. def self.void_grant(id, params = {}, opts = {}) request_stripe_object( method: :post, diff --git a/lib/stripe/resources/issuing/authorization.rb b/lib/stripe/resources/issuing/authorization.rb index c21088e01..f5cffe924 100644 --- a/lib/stripe/resources/issuing/authorization.rb +++ b/lib/stripe/resources/issuing/authorization.rb @@ -192,6 +192,26 @@ def increment(params = {}, opts = {}) ) end + # Respond to a fraud challenge on a testmode Issuing authorization, simulating either a confirmation of fraud or a correction of legitimacy. + def self.respond(authorization, params = {}, opts = {}) + request_stripe_object( + method: :post, + path: format("/v1/test_helpers/issuing/authorizations/%s/fraud_challenges/respond", { authorization: CGI.escape(authorization) }), + params: params, + opts: opts + ) + end + + # Respond to a fraud challenge on a testmode Issuing authorization, simulating either a confirmation of fraud or a correction of legitimacy. + def respond(params = {}, opts = {}) + @resource.request_stripe_object( + method: :post, + path: format("/v1/test_helpers/issuing/authorizations/%s/fraud_challenges/respond", { authorization: CGI.escape(@resource["id"]) }), + params: params, + opts: opts + ) + end + # Reverse a test-mode Authorization. def self.reverse(authorization, params = {}, opts = {}) request_stripe_object( diff --git a/lib/stripe/resources/issuing/card.rb b/lib/stripe/resources/issuing/card.rb index 0166ab678..fdf8188be 100644 --- a/lib/stripe/resources/issuing/card.rb +++ b/lib/stripe/resources/issuing/card.rb @@ -3,7 +3,7 @@ module Stripe module Issuing - # You can [create physical or virtual cards](https://stripe.com/docs/issuing/cards) that are issued to cardholders. + # You can [create physical or virtual cards](https://stripe.com/docs/issuing) that are issued to cardholders. class Card < APIResource extend Stripe::APIOperations::Create extend Stripe::APIOperations::List diff --git a/lib/stripe/resources/issuing/cardholder.rb b/lib/stripe/resources/issuing/cardholder.rb index 57f04da49..24ae14410 100644 --- a/lib/stripe/resources/issuing/cardholder.rb +++ b/lib/stripe/resources/issuing/cardholder.rb @@ -5,7 +5,7 @@ module Stripe module Issuing # An Issuing `Cardholder` object represents an individual or business entity who is [issued](https://stripe.com/docs/issuing) cards. # - # Related guide: [How to create a cardholder](https://stripe.com/docs/issuing/cards#create-cardholder) + # Related guide: [How to create a cardholder](https://stripe.com/docs/issuing/cards/virtual/issue-cards#create-cardholder) class Cardholder < APIResource extend Stripe::APIOperations::Create extend Stripe::APIOperations::List diff --git a/lib/stripe/resources/subscription.rb b/lib/stripe/resources/subscription.rb index 16002f33a..d00880253 100644 --- a/lib/stripe/resources/subscription.rb +++ b/lib/stripe/resources/subscription.rb @@ -127,7 +127,7 @@ def self.search_auto_paging_each(params = {}, opts = {}, &blk) # A trial starts or ends. # # - # In these cases, we apply a credit for the unused time on the previous price, immediately charge the customer using the new price, and reset the billing date. Learn about how [Stripe immediately attempts payment for subscription changes](https://stripe.com/billing/subscriptions/upgrade-downgrade#immediate-payment). + # In these cases, we apply a credit for the unused time on the previous price, immediately charge the customer using the new price, and reset the billing date. Learn about how [Stripe immediately attempts payment for subscription changes](https://stripe.com/docs/billing/subscriptions/upgrade-downgrade#immediate-payment). # # If you want to charge for an upgrade immediately, pass proration_behavior as always_invoice to create prorations, automatically invoice the customer for those proration adjustments, and attempt to collect payment. If you pass create_prorations, the prorations are created but not automatically invoiced. If you want to bill the customer for the prorations before the subscription's renewal date, you need to manually [invoice the customer](https://stripe.com/docs/api/invoices/create). # diff --git a/lib/stripe/services/billing/credit_grant_service.rb b/lib/stripe/services/billing/credit_grant_service.rb index 8596c4202..78a92b1b1 100644 --- a/lib/stripe/services/billing/credit_grant_service.rb +++ b/lib/stripe/services/billing/credit_grant_service.rb @@ -15,7 +15,7 @@ def create(params = {}, opts = {}) ) end - # Expires a credit grant + # Expires a credit grant. def expire(id, params = {}, opts = {}) request( method: :post, @@ -26,7 +26,7 @@ def expire(id, params = {}, opts = {}) ) end - # Retrieve a list of credit grants + # Retrieve a list of credit grants. def list(params = {}, opts = {}) request( method: :get, @@ -59,7 +59,7 @@ def update(id, params = {}, opts = {}) ) end - # Voids a credit grant + # Voids a credit grant. def void_grant(id, params = {}, opts = {}) request( method: :post, diff --git a/lib/stripe/services/subscription_service.rb b/lib/stripe/services/subscription_service.rb index 334aa04bf..1ef8fcbb1 100644 --- a/lib/stripe/services/subscription_service.rb +++ b/lib/stripe/services/subscription_service.rb @@ -107,7 +107,7 @@ def search(params = {}, opts = {}) # A trial starts or ends. # # - # In these cases, we apply a credit for the unused time on the previous price, immediately charge the customer using the new price, and reset the billing date. Learn about how [Stripe immediately attempts payment for subscription changes](https://stripe.com/billing/subscriptions/upgrade-downgrade#immediate-payment). + # In these cases, we apply a credit for the unused time on the previous price, immediately charge the customer using the new price, and reset the billing date. Learn about how [Stripe immediately attempts payment for subscription changes](https://stripe.com/docs/billing/subscriptions/upgrade-downgrade#immediate-payment). # # If you want to charge for an upgrade immediately, pass proration_behavior as always_invoice to create prorations, automatically invoice the customer for those proration adjustments, and attempt to collect payment. If you pass create_prorations, the prorations are created but not automatically invoiced. If you want to bill the customer for the prorations before the subscription's renewal date, you need to manually [invoice the customer](https://stripe.com/docs/api/invoices/create). # diff --git a/lib/stripe/services/test_helpers/issuing/authorization_service.rb b/lib/stripe/services/test_helpers/issuing/authorization_service.rb index e9bbc38ea..45c620db9 100644 --- a/lib/stripe/services/test_helpers/issuing/authorization_service.rb +++ b/lib/stripe/services/test_helpers/issuing/authorization_service.rb @@ -60,6 +60,17 @@ def increment(authorization, params = {}, opts = {}) ) end + # Respond to a fraud challenge on a testmode Issuing authorization, simulating either a confirmation of fraud or a correction of legitimacy. + def respond(authorization, params = {}, opts = {}) + request( + method: :post, + path: format("/v1/test_helpers/issuing/authorizations/%s/fraud_challenges/respond", { authorization: CGI.escape(authorization) }), + params: params, + opts: opts, + base_address: :api + ) + end + # Reverse a test-mode Authorization. def reverse(authorization, params = {}, opts = {}) request( From 68f806e454f8ce6a59b19604d0e4cfe445e49398 Mon Sep 17 00:00:00 2001 From: Ramya Rao Date: Wed, 20 Nov 2024 15:31:31 -0800 Subject: [PATCH 4/4] Bump version to 13.2.0 --- CHANGELOG.md | 6 ++++-- VERSION | 2 +- lib/stripe/version.rb | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b390624e..7f31f7146 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,13 @@ # Changelog +## 13.2.0 - 2024-11-20 +* [#1486](https://github.com/stripe/stripe-ruby/pull/1486) This release changes the pinned API version to `2024-11-20.acacia`. + * Add support for `respond` test helper method on resource `Issuing.Authorization` + ## 13.1.2 - 2024-11-15 * [#1488](https://github.com/stripe/stripe-ruby/pull/1488) Fix incorrect key in param encoding -* [#1487](https://github.com/stripe/stripe-ruby/pull/1487) Update VSCode default extensions to use solargraph instead of ruby lsp ## 13.1.1 - 2024-11-06 * [#1483](https://github.com/stripe/stripe-ruby/pull/1483) Fix APIResource#retrieve not sending `stripe_version` -* [#1478](https://github.com/stripe/stripe-ruby/pull/1478) Update changelog with a note on 2024-10-28.acacia API version ## 13.1.0 - 2024-10-29 * [#1472](https://github.com/stripe/stripe-ruby/pull/1472) This release changes the pinned API version to `2024-10-28.acacia`. diff --git a/VERSION b/VERSION index 383738180..67aee2394 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -13.1.2 +13.2.0 diff --git a/lib/stripe/version.rb b/lib/stripe/version.rb index 21b26555a..0ddc23ea1 100644 --- a/lib/stripe/version.rb +++ b/lib/stripe/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Stripe - VERSION = "13.1.2" + VERSION = "13.2.0" end