From 800aca12b4e6b6e4aeca33d1ca6be7785a708cd9 Mon Sep 17 00:00:00 2001 From: Remi Jannel Date: Tue, 13 Oct 2020 18:05:44 -0700 Subject: [PATCH 1/2] Codegen for openapi 4bd4c01 --- lib/stripe/resources/payout.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/stripe/resources/payout.rb b/lib/stripe/resources/payout.rb index 751ce7deb..2a77bf1a6 100644 --- a/lib/stripe/resources/payout.rb +++ b/lib/stripe/resources/payout.rb @@ -10,6 +10,7 @@ class Payout < APIResource OBJECT_NAME = "payout" custom_method :cancel, http_verb: :post + custom_method :reverse, http_verb: :post def cancel(params = {}, opts = {}) request_stripe_object( @@ -19,5 +20,14 @@ def cancel(params = {}, opts = {}) opts: opts ) end + + def reverse(params = {}, opts = {}) + request_stripe_object( + method: :post, + path: resource_url + "/reverse", + params: params, + opts: opts + ) + end end end From 95e08276ae483db6115d2e26b6fe7da9b56c005b Mon Sep 17 00:00:00 2001 From: Remi Jannel Date: Tue, 13 Oct 2020 18:51:59 -0700 Subject: [PATCH 2/2] Add test --- .travis.yml | 2 +- test/stripe/customer_test.rb | 2 +- test/stripe/payout_test.rb | 15 +++++++++++++++ test/test_helper.rb | 2 +- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index a53cdcda2..8d9f93079 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,7 @@ notifications: env: global: # If changing this number, please also change it in `test/test_helper.rb`. - - STRIPE_MOCK_VERSION=0.99.0 + - STRIPE_MOCK_VERSION=0.101.0 cache: directories: diff --git a/test/stripe/customer_test.rb b/test/stripe/customer_test.rb index 370240e48..9c8128648 100644 --- a/test/stripe/customer_test.rb +++ b/test/stripe/customer_test.rb @@ -57,7 +57,7 @@ class CustomerTest < Test::Unit::TestCase should "delete a discount" do customer = Stripe::Customer.retrieve("cus_123") customer = customer.delete_discount - assert_requested :delete, "#{Stripe.api_base}/v1/customers/#{customer.id}/discount" + assert_requested :delete, "#{Stripe.api_base}/v1/customers/cus_123/discount" assert customer.is_a?(Stripe::Customer) end end diff --git a/test/stripe/payout_test.rb b/test/stripe/payout_test.rb index 765369f2f..d7c197881 100644 --- a/test/stripe/payout_test.rb +++ b/test/stripe/payout_test.rb @@ -53,5 +53,20 @@ class PayoutTest < Test::Unit::TestCase assert payout.is_a?(Stripe::Payout) end end + + context "#reverse" do + should "reverse a payout" do + payout = Stripe::Payout.retrieve("tr_123") + payout = payout.reverse + assert payout.is_a?(Stripe::Payout) + end + end + + context ".reverse" do + should "reverse a payout" do + payout = Stripe::Payout.reverse("pm_123") + assert payout.is_a?(Stripe::Payout) + end + end end end diff --git a/test/test_helper.rb b/test/test_helper.rb index edf9c772a..319b78c89 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -16,7 +16,7 @@ require ::File.expand_path("stripe_mock", __dir__) # If changing this number, please also change it in `.travis.yml`. -MOCK_MINIMUM_VERSION = "0.99.0" +MOCK_MINIMUM_VERSION = "0.101.0" MOCK_PORT = Stripe::StripeMock.start # Disable all real network connections except those that are outgoing to