diff --git a/lib/stripe/api_resource_test_helpers.rb b/lib/stripe/api_resource_test_helpers.rb index 2c42ad719..2309cd592 100644 --- a/lib/stripe/api_resource_test_helpers.rb +++ b/lib/stripe/api_resource_test_helpers.rb @@ -8,6 +8,8 @@ module Stripe # class MyAPIResource < APIResource # class TestHelpers < APIResourceTestHelpers class APIResourceTestHelpers + include Stripe::APIOperations::Request + def initialize(resource) @resource = resource end diff --git a/lib/stripe/object_types.rb b/lib/stripe/object_types.rb index dc5b74488..99016906a 100644 --- a/lib/stripe/object_types.rb +++ b/lib/stripe/object_types.rb @@ -107,6 +107,16 @@ def self.object_names_to_classes Token::OBJECT_NAME => Token, Topup::OBJECT_NAME => Topup, Transfer::OBJECT_NAME => Transfer, + Treasury::CreditReversal::OBJECT_NAME => Treasury::CreditReversal, + Treasury::DebitReversal::OBJECT_NAME => Treasury::DebitReversal, + Treasury::FinancialAccount::OBJECT_NAME => Treasury::FinancialAccount, + Treasury::InboundTransfer::OBJECT_NAME => Treasury::InboundTransfer, + Treasury::OutboundPayment::OBJECT_NAME => Treasury::OutboundPayment, + Treasury::OutboundTransfer::OBJECT_NAME => Treasury::OutboundTransfer, + Treasury::ReceivedCredit::OBJECT_NAME => Treasury::ReceivedCredit, + Treasury::ReceivedDebit::OBJECT_NAME => Treasury::ReceivedDebit, + Treasury::Transaction::OBJECT_NAME => Treasury::Transaction, + Treasury::TransactionEntry::OBJECT_NAME => Treasury::TransactionEntry, UsageRecord::OBJECT_NAME => UsageRecord, UsageRecordSummary::OBJECT_NAME => UsageRecordSummary, WebhookEndpoint::OBJECT_NAME => WebhookEndpoint, diff --git a/lib/stripe/resources.rb b/lib/stripe/resources.rb index 07a845886..794fc519c 100644 --- a/lib/stripe/resources.rb +++ b/lib/stripe/resources.rb @@ -94,6 +94,16 @@ require "stripe/resources/token" require "stripe/resources/topup" require "stripe/resources/transfer" +require "stripe/resources/treasury/credit_reversal" +require "stripe/resources/treasury/debit_reversal" +require "stripe/resources/treasury/financial_account" +require "stripe/resources/treasury/inbound_transfer" +require "stripe/resources/treasury/outbound_payment" +require "stripe/resources/treasury/outbound_transfer" +require "stripe/resources/treasury/received_credit" +require "stripe/resources/treasury/received_debit" +require "stripe/resources/treasury/transaction" +require "stripe/resources/treasury/transaction_entry" require "stripe/resources/usage_record" require "stripe/resources/usage_record_summary" require "stripe/resources/webhook_endpoint" diff --git a/lib/stripe/resources/customer.rb b/lib/stripe/resources/customer.rb index 376db0219..ef6122242 100644 --- a/lib/stripe/resources/customer.rb +++ b/lib/stripe/resources/customer.rb @@ -41,6 +41,30 @@ def list_payment_methods(params = {}, opts = {}) ) end + def retrieve_payment_method(payment_method, params = {}, opts = {}) + request_stripe_object( + method: :get, + path: format("/v1/customers/%s/payment_methods/%s", { customer: CGI.escape(self["id"]), payment_method: CGI.escape(payment_method) }), + params: params, + opts: opts + ) + end + + def self.retrieve_payment_method( + customer, + payment_method, + params = {}, + opts = {} + ) + resp, opts = execute_resource_request( + :get, + format("/v1/customers/%s/payment_methods/%s", { customer: CGI.escape(customer), payment_method: CGI.escape(payment_method) }), + params, + opts + ) + Util.convert_to_stripe_object(resp.data, opts) + end + custom_method :delete_discount, http_verb: :delete, http_path: "discount" save_nested_resource :source diff --git a/lib/stripe/resources/financial_connections/account.rb b/lib/stripe/resources/financial_connections/account.rb index 7f0a53932..96c179647 100644 --- a/lib/stripe/resources/financial_connections/account.rb +++ b/lib/stripe/resources/financial_connections/account.rb @@ -4,9 +4,12 @@ module Stripe module FinancialConnections class Account < APIResource + extend Stripe::APIOperations::List + OBJECT_NAME = "financial_connections.account" custom_method :disconnect, http_verb: :post + custom_method :list_owners, http_verb: :get, http_path: "owners" custom_method :refresh_account, http_verb: :post, http_path: "refresh" def disconnect(params = {}, opts = {}) @@ -18,6 +21,15 @@ def disconnect(params = {}, opts = {}) ) end + def list_owners(params = {}, opts = {}) + request_stripe_object( + method: :get, + path: resource_url + "/owners", + params: params, + opts: opts + ) + end + def refresh_account(params = {}, opts = {}) request_stripe_object( method: :post, diff --git a/lib/stripe/resources/treasury/credit_reversal.rb b/lib/stripe/resources/treasury/credit_reversal.rb new file mode 100644 index 000000000..8a4d76a27 --- /dev/null +++ b/lib/stripe/resources/treasury/credit_reversal.rb @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module Treasury + class CreditReversal < APIResource + extend Stripe::APIOperations::Create + extend Stripe::APIOperations::List + + OBJECT_NAME = "treasury.credit_reversal" + end + end +end diff --git a/lib/stripe/resources/treasury/debit_reversal.rb b/lib/stripe/resources/treasury/debit_reversal.rb new file mode 100644 index 000000000..a16838c2a --- /dev/null +++ b/lib/stripe/resources/treasury/debit_reversal.rb @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module Treasury + class DebitReversal < APIResource + extend Stripe::APIOperations::Create + extend Stripe::APIOperations::List + + OBJECT_NAME = "treasury.debit_reversal" + end + end +end diff --git a/lib/stripe/resources/treasury/financial_account.rb b/lib/stripe/resources/treasury/financial_account.rb new file mode 100644 index 000000000..bc0df0cde --- /dev/null +++ b/lib/stripe/resources/treasury/financial_account.rb @@ -0,0 +1,35 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module Treasury + class FinancialAccount < APIResource + extend Stripe::APIOperations::Create + extend Stripe::APIOperations::List + include Stripe::APIOperations::Save + + OBJECT_NAME = "treasury.financial_account" + + custom_method :retrieve_features, http_verb: :get, http_path: "features" + custom_method :update_features, http_verb: :post, http_path: "features" + + def retrieve_features(params = {}, opts = {}) + request_stripe_object( + method: :get, + path: resource_url + "/features", + params: params, + opts: opts + ) + end + + def update_features(params = {}, opts = {}) + request_stripe_object( + method: :post, + path: resource_url + "/features", + params: params, + opts: opts + ) + end + end + end +end diff --git a/lib/stripe/resources/treasury/inbound_transfer.rb b/lib/stripe/resources/treasury/inbound_transfer.rb new file mode 100644 index 000000000..d7b322030 --- /dev/null +++ b/lib/stripe/resources/treasury/inbound_transfer.rb @@ -0,0 +1,63 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module Treasury + class InboundTransfer < APIResource + extend Stripe::APIOperations::Create + extend Stripe::APIOperations::List + + OBJECT_NAME = "treasury.inbound_transfer" + + custom_method :cancel, http_verb: :post + + def cancel(params = {}, opts = {}) + request_stripe_object( + method: :post, + path: resource_url + "/cancel", + params: params, + opts: opts + ) + end + + def test_helpers + TestHelpers.new(self) + end + + class TestHelpers < APIResourceTestHelpers + RESOURCE_CLASS = InboundTransfer + + custom_method :fail, http_verb: :post + custom_method :return_inbound_transfer, http_verb: :post, http_path: "return" + custom_method :succeed, http_verb: :post + + def fail(params = {}, opts = {}) + @resource.request_stripe_object( + method: :post, + path: resource_url + "/fail", + params: params, + opts: opts + ) + end + + def return_inbound_transfer(params = {}, opts = {}) + @resource.request_stripe_object( + method: :post, + path: resource_url + "/return", + params: params, + opts: opts + ) + end + + def succeed(params = {}, opts = {}) + @resource.request_stripe_object( + method: :post, + path: resource_url + "/succeed", + params: params, + opts: opts + ) + end + end + end + end +end diff --git a/lib/stripe/resources/treasury/outbound_payment.rb b/lib/stripe/resources/treasury/outbound_payment.rb new file mode 100644 index 000000000..2757ccad0 --- /dev/null +++ b/lib/stripe/resources/treasury/outbound_payment.rb @@ -0,0 +1,63 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module Treasury + class OutboundPayment < APIResource + extend Stripe::APIOperations::Create + extend Stripe::APIOperations::List + + OBJECT_NAME = "treasury.outbound_payment" + + custom_method :cancel, http_verb: :post + + def cancel(params = {}, opts = {}) + request_stripe_object( + method: :post, + path: resource_url + "/cancel", + params: params, + opts: opts + ) + end + + def test_helpers + TestHelpers.new(self) + end + + class TestHelpers < APIResourceTestHelpers + RESOURCE_CLASS = OutboundPayment + + custom_method :fail, http_verb: :post + custom_method :post, http_verb: :post + custom_method :return_outbound_payment, http_verb: :post, http_path: "return" + + def fail(params = {}, opts = {}) + @resource.request_stripe_object( + method: :post, + path: resource_url + "/fail", + params: params, + opts: opts + ) + end + + def post(params = {}, opts = {}) + @resource.request_stripe_object( + method: :post, + path: resource_url + "/post", + params: params, + opts: opts + ) + end + + def return_outbound_payment(params = {}, opts = {}) + @resource.request_stripe_object( + method: :post, + path: resource_url + "/return", + params: params, + opts: opts + ) + end + end + end + end +end diff --git a/lib/stripe/resources/treasury/outbound_transfer.rb b/lib/stripe/resources/treasury/outbound_transfer.rb new file mode 100644 index 000000000..db936b851 --- /dev/null +++ b/lib/stripe/resources/treasury/outbound_transfer.rb @@ -0,0 +1,63 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module Treasury + class OutboundTransfer < APIResource + extend Stripe::APIOperations::Create + extend Stripe::APIOperations::List + + OBJECT_NAME = "treasury.outbound_transfer" + + custom_method :cancel, http_verb: :post + + def cancel(params = {}, opts = {}) + request_stripe_object( + method: :post, + path: resource_url + "/cancel", + params: params, + opts: opts + ) + end + + def test_helpers + TestHelpers.new(self) + end + + class TestHelpers < APIResourceTestHelpers + RESOURCE_CLASS = OutboundTransfer + + custom_method :fail, http_verb: :post + custom_method :post, http_verb: :post + custom_method :return_outbound_transfer, http_verb: :post, http_path: "return" + + def fail(params = {}, opts = {}) + @resource.request_stripe_object( + method: :post, + path: resource_url + "/fail", + params: params, + opts: opts + ) + end + + def post(params = {}, opts = {}) + @resource.request_stripe_object( + method: :post, + path: resource_url + "/post", + params: params, + opts: opts + ) + end + + def return_outbound_transfer(params = {}, opts = {}) + @resource.request_stripe_object( + method: :post, + path: resource_url + "/return", + params: params, + opts: opts + ) + end + end + end + end +end diff --git a/lib/stripe/resources/treasury/received_credit.rb b/lib/stripe/resources/treasury/received_credit.rb new file mode 100644 index 000000000..5dbe399c1 --- /dev/null +++ b/lib/stripe/resources/treasury/received_credit.rb @@ -0,0 +1,30 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module Treasury + class ReceivedCredit < APIResource + extend Stripe::APIOperations::List + + OBJECT_NAME = "treasury.received_credit" + + def test_helpers + TestHelpers.new(self) + end + + class TestHelpers < APIResourceTestHelpers + RESOURCE_CLASS = ReceivedCredit + + def self.create(params = {}, opts = {}) + resp, opts = execute_resource_request( + :post, + "/v1/test_helpers/treasury/received_credits", + params, + opts + ) + Util.convert_to_stripe_object(resp.data, opts) + end + end + end + end +end diff --git a/lib/stripe/resources/treasury/received_debit.rb b/lib/stripe/resources/treasury/received_debit.rb new file mode 100644 index 000000000..c4a3bef34 --- /dev/null +++ b/lib/stripe/resources/treasury/received_debit.rb @@ -0,0 +1,30 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module Treasury + class ReceivedDebit < APIResource + extend Stripe::APIOperations::List + + OBJECT_NAME = "treasury.received_debit" + + def test_helpers + TestHelpers.new(self) + end + + class TestHelpers < APIResourceTestHelpers + RESOURCE_CLASS = ReceivedDebit + + def self.create(params = {}, opts = {}) + resp, opts = execute_resource_request( + :post, + "/v1/test_helpers/treasury/received_debits", + params, + opts + ) + Util.convert_to_stripe_object(resp.data, opts) + end + end + end + end +end diff --git a/lib/stripe/resources/treasury/transaction.rb b/lib/stripe/resources/treasury/transaction.rb new file mode 100644 index 000000000..edcaf283e --- /dev/null +++ b/lib/stripe/resources/treasury/transaction.rb @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module Treasury + class Transaction < APIResource + extend Stripe::APIOperations::List + + OBJECT_NAME = "treasury.transaction" + end + end +end diff --git a/lib/stripe/resources/treasury/transaction_entry.rb b/lib/stripe/resources/treasury/transaction_entry.rb new file mode 100644 index 000000000..beaca6416 --- /dev/null +++ b/lib/stripe/resources/treasury/transaction_entry.rb @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module Treasury + class TransactionEntry < APIResource + extend Stripe::APIOperations::List + + OBJECT_NAME = "treasury.transaction_entry" + + def self.resource_url + "/v1/treasury/transaction_entries" + end + end + end +end diff --git a/test/stripe/generated_examples_test.rb b/test/stripe/generated_examples_test.rb index 9197d730a..4f3834d0d 100644 --- a/test/stripe/generated_examples_test.rb +++ b/test/stripe/generated_examples_test.rb @@ -73,18 +73,6 @@ class CodegennedExampleTest < Test::Unit::TestCase assert_requested :get, "#{Stripe.api_base}/v1/application_fees/fee_xxxxxxxxxxxxx?" end end - context "BalanceTransaction.list" do - should "support requests with args: limit" do - Stripe::BalanceTransaction.list(limit: 3) - assert_requested :get, "#{Stripe.api_base}/v1/balance_transactions?limit=3" - end - end - context "BalanceTransaction.retrieve" do - should "support requests with args: id" do - Stripe::BalanceTransaction.retrieve("txn_xxxxxxxxxxxxx") - assert_requested :get, "#{Stripe.api_base}/v1/balance_transactions/txn_xxxxxxxxxxxxx?" - end - end context "BillingPortal.Configuration.create" do should "support requests with args: features, business_profile" do Stripe::BillingPortal::Configuration.create( @@ -192,6 +180,14 @@ class CodegennedExampleTest < Test::Unit::TestCase assert_requested :get, "#{Stripe.api_base}/v1/charges/ch_xxxxxxxxxxxxx?" end end + context "Charge.search" do + should "support requests with args: query" do + Stripe::Charge.search( + query: "amount>999 AND metadata['order_id']:'6735'" + ) + assert_requested :get, "#{Stripe.api_base}/v1/charges/search?query=amount>999 AND metadata['order_id']:'6735'" + end + end context "Charge.update" do should "support requests with args: metadata, id" do Stripe::Charge.update( @@ -202,16 +198,6 @@ class CodegennedExampleTest < Test::Unit::TestCase end end context "Checkout.Session.create" do - should "support requests with args: success_url, cancel_url, payment_method_types, line_items, mode" do - Stripe::Checkout::Session.create( - success_url: "https://example.com/success", - cancel_url: "https://example.com/cancel", - payment_method_types: ["card"], - line_items: [{ price: "price_xxxxxxxxxxxxx", quantity: 2 }], - mode: "payment" - ) - assert_requested :post, "#{Stripe.api_base}/v1/checkout/sessions" - end should "support requests with args: success_url, cancel_url, mode, shipping_options" do Stripe::Checkout::Session.create( success_url: "https://example.com/success", @@ -232,12 +218,25 @@ class CodegennedExampleTest < Test::Unit::TestCase ) assert_requested :post, "#{Stripe.api_base}/v1/checkout/sessions" end + should "support requests with args: success_url, cancel_url, line_items, mode" do + Stripe::Checkout::Session.create( + success_url: "https://example.com/success", + cancel_url: "https://example.com/cancel", + line_items: [{ price: "price_xxxxxxxxxxxxx", quantity: 2 }], + mode: "payment" + ) + assert_requested :post, "#{Stripe.api_base}/v1/checkout/sessions" + end end context "Checkout.Session.expire" do should "support requests with args: session" do Stripe::Checkout::Session.expire("sess_xyz") assert_requested :post, "#{Stripe.api_base}/v1/checkout/sessions/sess_xyz/expire?" end + should "support requests with args: id" do + Stripe::Checkout::Session.expire("cs_test_xxxxxxxxxxxxx") + assert_requested :post, "#{Stripe.api_base}/v1/checkout/sessions/cs_test_xxxxxxxxxxxxx/expire?" + end end context "Checkout.Session.list" do should "support requests with args: limit" do @@ -266,7 +265,7 @@ class CodegennedExampleTest < Test::Unit::TestCase context "Coupon.create" do should "support requests with args: percent_off, duration, duration_in_months" do Stripe::Coupon.create( - percent_off: 25, + percent_off: 25.5, duration: "repeating", duration_in_months: 3 ) @@ -275,8 +274,8 @@ class CodegennedExampleTest < Test::Unit::TestCase end context "Coupon.delete" do should "support requests with args: id" do - Stripe::Coupon.delete("co_xxxxxxxxxxxxx") - assert_requested :delete, "#{Stripe.api_base}/v1/coupons/co_xxxxxxxxxxxxx?" + Stripe::Coupon.delete("Z4OV52SU") + assert_requested :delete, "#{Stripe.api_base}/v1/coupons/Z4OV52SU?" end end context "Coupon.list" do @@ -287,17 +286,14 @@ class CodegennedExampleTest < Test::Unit::TestCase end context "Coupon.retrieve" do should "support requests with args: id" do - Stripe::Coupon.retrieve("25_5OFF") - assert_requested :get, "#{Stripe.api_base}/v1/coupons/25_5OFF?" + Stripe::Coupon.retrieve("Z4OV52SU") + assert_requested :get, "#{Stripe.api_base}/v1/coupons/Z4OV52SU?" end end context "Coupon.update" do should "support requests with args: metadata, id" do - Stripe::Coupon.update( - "co_xxxxxxxxxxxxx", - { metadata: { order_id: "6735" } } - ) - assert_requested :post, "#{Stripe.api_base}/v1/coupons/co_xxxxxxxxxxxxx" + Stripe::Coupon.update("Z4OV52SU", { metadata: { order_id: "6735" } }) + assert_requested :post, "#{Stripe.api_base}/v1/coupons/Z4OV52SU" end end context "CreditNote.create" do @@ -387,6 +383,13 @@ class CodegennedExampleTest < Test::Unit::TestCase Stripe::Customer.list_payment_methods("cus_xyz", { type: "card" }) assert_requested :get, "#{Stripe.api_base}/v1/customers/cus_xyz/payment_methods?type=card" end + should "support requests with args: type, parent_id" do + Stripe::Customer.list_payment_methods( + "cus_xxxxxxxxxxxxx", + { type: "card" } + ) + assert_requested :get, "#{Stripe.api_base}/v1/customers/cus_xxxxxxxxxxxxx/payment_methods?type=card" + end end context "Customer.retrieve" do should "support requests with args: id" do @@ -394,6 +397,20 @@ class CodegennedExampleTest < Test::Unit::TestCase assert_requested :get, "#{Stripe.api_base}/v1/customers/cus_xxxxxxxxxxxxx?" end end + context "Customer.search" do + should "support requests with args: query" do + 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 "support requests with args: query2" do + 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 + end context "Customer.update" do should "support requests with args: metadata, id" do Stripe::Customer.update( @@ -540,6 +557,34 @@ class CodegennedExampleTest < Test::Unit::TestCase assert_requested :post, "#{Stripe.api_base}/v1/financial_connections/accounts/fca_xyz/disconnect?" end end + context "FinancialConnections.Account.list" do + should "work" do + Stripe::FinancialConnections::Account.list + assert_requested :get, "#{Stripe.api_base}/v1/financial_connections/accounts?" + end + should "support requests with args: account_holder" do + Stripe::FinancialConnections::Account.list( + account_holder: { customer: "cus_xxxxxxxxxxxxx" } + ) + assert_requested :get, "#{Stripe.api_base}/v1/financial_connections/accounts?account_holder[customer]=cus_xxxxxxxxxxxxx" + end + end + context "FinancialConnections.Account.list_owners" do + should "support requests with args: account, ownership" do + Stripe::FinancialConnections::Account.list_owners( + "fca_xyz", + { ownership: "fcaowns_xyz" } + ) + assert_requested :get, "#{Stripe.api_base}/v1/financial_connections/accounts/fca_xyz/owners?ownership=fcaowns_xyz" + end + should "support requests with args: limit, ownership, parent_id" do + Stripe::FinancialConnections::Account.list_owners( + "fca_xxxxxxxxxxxxx", + { limit: 3, ownership: "fcaowns_xxxxxxxxxxxxx" } + ) + assert_requested :get, "#{Stripe.api_base}/v1/financial_connections/accounts/fca_xxxxxxxxxxxxx/owners?limit=3&ownership=fcaowns_xxxxxxxxxxxxx" + end + end context "FinancialConnections.Account.refresh_account" do should "support requests with args: account, features" do Stripe::FinancialConnections::Account.refresh_account( @@ -554,6 +599,10 @@ class CodegennedExampleTest < Test::Unit::TestCase Stripe::FinancialConnections::Account.retrieve("fca_xyz") assert_requested :get, "#{Stripe.api_base}/v1/financial_connections/accounts/fca_xyz?" end + should "support requests with args: id" do + Stripe::FinancialConnections::Account.retrieve("fca_xxxxxxxxxxxxx") + assert_requested :get, "#{Stripe.api_base}/v1/financial_connections/accounts/fca_xxxxxxxxxxxxx?" + end end context "FinancialConnections.Session.create" do should "support requests with args: account_holder, permissions" do @@ -563,12 +612,75 @@ class CodegennedExampleTest < Test::Unit::TestCase ) assert_requested :post, "#{Stripe.api_base}/v1/financial_connections/sessions" end + should "support requests with args: account_holder, permissions, filters" do + Stripe::FinancialConnections::Session.create( + account_holder: { type: "customer", customer: "cus_xxxxxxxxxxxxx" }, + permissions: %w[payment_method balances], + filters: { countries: ["US"] } + ) + assert_requested :post, "#{Stripe.api_base}/v1/financial_connections/sessions" + end end context "FinancialConnections.Session.retrieve" do should "support requests with args: session" do Stripe::FinancialConnections::Session.retrieve("fcsess_xyz") assert_requested :get, "#{Stripe.api_base}/v1/financial_connections/sessions/fcsess_xyz?" end + should "support requests with args: id" do + Stripe::FinancialConnections::Session.retrieve("fcsess_xxxxxxxxxxxxx") + assert_requested :get, "#{Stripe.api_base}/v1/financial_connections/sessions/fcsess_xxxxxxxxxxxxx?" + end + end + context "Identity.VerificationReport.list" do + should "support requests with args: limit" do + Stripe::Identity::VerificationReport.list(limit: 3) + assert_requested :get, "#{Stripe.api_base}/v1/identity/verification_reports?limit=3" + end + end + context "Identity.VerificationReport.retrieve" do + should "support requests with args: id" do + Stripe::Identity::VerificationReport.retrieve("vr_xxxxxxxxxxxxx") + assert_requested :get, "#{Stripe.api_base}/v1/identity/verification_reports/vr_xxxxxxxxxxxxx?" + end + end + context "Identity.VerificationSession.cancel" do + should "support requests with args: id" do + Stripe::Identity::VerificationSession.cancel("vs_xxxxxxxxxxxxx") + assert_requested :post, "#{Stripe.api_base}/v1/identity/verification_sessions/vs_xxxxxxxxxxxxx/cancel?" + end + end + context "Identity.VerificationSession.create" do + should "support requests with args: type" do + Stripe::Identity::VerificationSession.create(type: "document") + assert_requested :post, "#{Stripe.api_base}/v1/identity/verification_sessions" + end + end + context "Identity.VerificationSession.list" do + should "support requests with args: limit" do + Stripe::Identity::VerificationSession.list(limit: 3) + assert_requested :get, "#{Stripe.api_base}/v1/identity/verification_sessions?limit=3" + end + end + context "Identity.VerificationSession.redact" do + should "support requests with args: id" do + Stripe::Identity::VerificationSession.redact("vs_xxxxxxxxxxxxx") + assert_requested :post, "#{Stripe.api_base}/v1/identity/verification_sessions/vs_xxxxxxxxxxxxx/redact?" + end + end + context "Identity.VerificationSession.retrieve" do + should "support requests with args: id" do + Stripe::Identity::VerificationSession.retrieve("vs_xxxxxxxxxxxxx") + assert_requested :get, "#{Stripe.api_base}/v1/identity/verification_sessions/vs_xxxxxxxxxxxxx?" + end + end + context "Identity.VerificationSession.update" do + should "support requests with args: type, id" do + Stripe::Identity::VerificationSession.update( + "vs_xxxxxxxxxxxxx", + { type: "id_number" } + ) + assert_requested :post, "#{Stripe.api_base}/v1/identity/verification_sessions/vs_xxxxxxxxxxxxx" + end end context "Invoice.create" do should "support requests with args: customer" do @@ -612,6 +724,14 @@ class CodegennedExampleTest < Test::Unit::TestCase assert_requested :get, "#{Stripe.api_base}/v1/invoices/in_xxxxxxxxxxxxx?" end end + context "Invoice.search" do + should "support requests with args: query" do + Stripe::Invoice.search( + query: "total>999 AND metadata['order_id']:'6735'" + ) + assert_requested :get, "#{Stripe.api_base}/v1/invoices/search?query=total>999 AND metadata['order_id']:'6735'" + end + end context "Invoice.send_invoice" do should "support requests with args: id" do Stripe::Invoice.send_invoice("in_xxxxxxxxxxxxx") @@ -894,6 +1014,12 @@ class CodegennedExampleTest < Test::Unit::TestCase assert_requested :post, "#{Stripe.api_base}/v1/orders/order_xyz?" end end + context "PaymentIntent.apply_customer_balance" do + should "support requests with args: id" do + Stripe::PaymentIntent.apply_customer_balance("pi_xxxxxxxxxxxxx") + assert_requested :post, "#{Stripe.api_base}/v1/payment_intents/pi_xxxxxxxxxxxxx/apply_customer_balance?" + end + end context "PaymentIntent.cancel" do should "support requests with args: id" do Stripe::PaymentIntent.cancel("pi_xxxxxxxxxxxxx") @@ -916,6 +1042,14 @@ class CodegennedExampleTest < Test::Unit::TestCase end end context "PaymentIntent.create" do + should "support requests with args: amount, currency, automatic_payment_methods" do + Stripe::PaymentIntent.create( + amount: 1099, + currency: "eur", + automatic_payment_methods: { enabled: true } + ) + assert_requested :post, "#{Stripe.api_base}/v1/payment_intents" + end should "support requests with args: amount, currency, payment_method_types" do Stripe::PaymentIntent.create( amount: 2000, @@ -924,13 +1058,14 @@ class CodegennedExampleTest < Test::Unit::TestCase ) assert_requested :post, "#{Stripe.api_base}/v1/payment_intents" end - should "support requests with args: amount, currency, automatic_payment_methods" do - Stripe::PaymentIntent.create( - amount: 1099, - currency: "eur", - automatic_payment_methods: { enabled: true } + end + context "PaymentIntent.increment_authorization" do + should "support requests with args: amount, id" do + Stripe::PaymentIntent.increment_authorization( + "pi_xxxxxxxxxxxxx", + { amount: 2099 } ) - assert_requested :post, "#{Stripe.api_base}/v1/payment_intents" + assert_requested :post, "#{Stripe.api_base}/v1/payment_intents/pi_xxxxxxxxxxxxx/increment_authorization" end end context "PaymentIntent.list" do @@ -945,6 +1080,14 @@ class CodegennedExampleTest < Test::Unit::TestCase assert_requested :get, "#{Stripe.api_base}/v1/payment_intents/pi_xxxxxxxxxxxxx?" end end + context "PaymentIntent.search" do + should "support requests with args: query" do + Stripe::PaymentIntent.search( + query: "status:'succeeded' AND metadata['order_id']:'6735'" + ) + assert_requested :get, "#{Stripe.api_base}/v1/payment_intents/search?query=status:'succeeded' AND metadata['order_id']:'6735'" + end + end context "PaymentIntent.update" do should "support requests with args: metadata, id" do Stripe::PaymentIntent.update( @@ -967,6 +1110,18 @@ class CodegennedExampleTest < Test::Unit::TestCase ) assert_requested :post, "#{Stripe.api_base}/v1/payment_links" end + should "support requests with args: line_items2" do + Stripe::PaymentLink.create( + line_items: [{ price: "price_xxxxxxxxxxxxx", quantity: 1 }] + ) + assert_requested :post, "#{Stripe.api_base}/v1/payment_links" + end + end + context "PaymentLink.list" do + should "support requests with args: limit" do + Stripe::PaymentLink.list(limit: 3) + assert_requested :get, "#{Stripe.api_base}/v1/payment_links?limit=3" + end end context "PaymentLink.list_line_items" do should "support requests with args: payment_link" do @@ -979,6 +1134,16 @@ class CodegennedExampleTest < Test::Unit::TestCase Stripe::PaymentLink.retrieve("pl_xyz") assert_requested :get, "#{Stripe.api_base}/v1/payment_links/pl_xyz?" end + should "support requests with args: id" do + Stripe::PaymentLink.retrieve("plink_xxxxxxxxxxxxx") + assert_requested :get, "#{Stripe.api_base}/v1/payment_links/plink_xxxxxxxxxxxxx?" + end + end + context "PaymentLink.update" do + should "support requests with args: active, id" do + Stripe::PaymentLink.update("plink_xxxxxxxxxxxxx", { active: false }) + assert_requested :post, "#{Stripe.api_base}/v1/payment_links/plink_xxxxxxxxxxxxx" + end end context "PaymentMethod.attach" do should "support requests with args: customer, id" do @@ -996,7 +1161,7 @@ class CodegennedExampleTest < Test::Unit::TestCase card: { number: "4242424242424242", exp_month: 5, - exp_year: 2022, + exp_year: 2023, cvc: "314", } ) @@ -1155,6 +1320,14 @@ class CodegennedExampleTest < Test::Unit::TestCase assert_requested :get, "#{Stripe.api_base}/v1/prices/price_xxxxxxxxxxxxx?" end end + context "Price.search" do + should "support requests with args: query" do + Stripe::Price.search( + query: "active:'true' AND metadata['order_id']:'6735'" + ) + assert_requested :get, "#{Stripe.api_base}/v1/prices/search?query=active:'true' AND metadata['order_id']:'6735'" + end + end context "Price.update" do should "support requests with args: metadata, id" do Stripe::Price.update( @@ -1188,6 +1361,14 @@ class CodegennedExampleTest < Test::Unit::TestCase assert_requested :get, "#{Stripe.api_base}/v1/products/prod_xxxxxxxxxxxxx?" end end + context "Product.search" do + should "support requests with args: query" do + Stripe::Product.search( + query: "active:'true' AND metadata['order_id']:'6735'" + ) + assert_requested :get, "#{Stripe.api_base}/v1/products/search?query=active:'true' AND metadata['order_id']:'6735'" + end + end context "Product.update" do should "support requests with args: metadata, id" do Stripe::Product.update( @@ -1199,7 +1380,7 @@ class CodegennedExampleTest < Test::Unit::TestCase end context "PromotionCode.create" do should "support requests with args: coupon" do - Stripe::PromotionCode.create(coupon: "25_5OFF") + Stripe::PromotionCode.create(coupon: "Z4OV52SU") assert_requested :post, "#{Stripe.api_base}/v1/promotion_codes" end end @@ -1224,6 +1405,51 @@ class CodegennedExampleTest < Test::Unit::TestCase assert_requested :post, "#{Stripe.api_base}/v1/promotion_codes/promo_xxxxxxxxxxxxx" end end + context "Quote.accept" do + should "support requests with args: id" do + Stripe::Quote.accept("qt_xxxxxxxxxxxxx") + assert_requested :post, "#{Stripe.api_base}/v1/quotes/qt_xxxxxxxxxxxxx/accept?" + end + end + context "Quote.cancel" do + should "support requests with args: id" do + Stripe::Quote.cancel("qt_xxxxxxxxxxxxx") + assert_requested :post, "#{Stripe.api_base}/v1/quotes/qt_xxxxxxxxxxxxx/cancel?" + end + end + context "Quote.create" do + should "support requests with args: customer, line_items" do + Stripe::Quote.create( + customer: "cus_xxxxxxxxxxxxx", + line_items: [{ price: "price_xxxxxxxxxxxxx", quantity: 2 }] + ) + assert_requested :post, "#{Stripe.api_base}/v1/quotes" + end + end + context "Quote.finalize_quote" do + should "support requests with args: id" do + Stripe::Quote.finalize_quote("qt_xxxxxxxxxxxxx") + assert_requested :post, "#{Stripe.api_base}/v1/quotes/qt_xxxxxxxxxxxxx/finalize?" + end + end + context "Quote.list" do + should "support requests with args: limit" do + Stripe::Quote.list(limit: 3) + assert_requested :get, "#{Stripe.api_base}/v1/quotes?limit=3" + end + end + context "Quote.retrieve" do + should "support requests with args: id" do + Stripe::Quote.retrieve("qt_xxxxxxxxxxxxx") + assert_requested :get, "#{Stripe.api_base}/v1/quotes/qt_xxxxxxxxxxxxx?" + end + end + context "Quote.update" do + should "support requests with args: metadata, id" do + Stripe::Quote.update("qt_xxxxxxxxxxxxx", { metadata: { order_id: "6735" } }) + assert_requested :post, "#{Stripe.api_base}/v1/quotes/qt_xxxxxxxxxxxxx" + end + end context "Radar.EarlyFraudWarning.list" do should "support requests with args: limit" do Stripe::Radar::EarlyFraudWarning.list(limit: 3) @@ -1303,6 +1529,12 @@ class CodegennedExampleTest < Test::Unit::TestCase assert_requested :get, "#{Stripe.api_base}/v1/radar/value_list_items/rsli_xxxxxxxxxxxxx?" end end + context "Refund.cancel" do + should "support requests with args: id" do + Stripe::Refund.cancel("re_xxxxxxxxxxxxx") + assert_requested :post, "#{Stripe.api_base}/v1/refunds/re_xxxxxxxxxxxxx/cancel?" + end + end context "Refund.create" do should "support requests with args: charge" do Stripe::Refund.create(charge: "ch_xxxxxxxxxxxxx") @@ -1388,9 +1620,9 @@ class CodegennedExampleTest < Test::Unit::TestCase end end context "SetupAttempt.list" do - should "support requests with args: setup_intent, limit" do - Stripe::SetupAttempt.list(setup_intent: "seti_xxxxxxxxxxxxx", limit: 3) - assert_requested :get, "#{Stripe.api_base}/v1/setup_attempts?setup_intent=seti_xxxxxxxxxxxxx&limit=3" + should "support requests with args: limit, setup_intent" do + Stripe::SetupAttempt.list(limit: 3, setup_intent: "si_xyz") + assert_requested :get, "#{Stripe.api_base}/v1/setup_attempts?limit=3&setup_intent=si_xyz" end end context "SetupIntent.cancel" do @@ -1450,12 +1682,39 @@ class CodegennedExampleTest < Test::Unit::TestCase ) assert_requested :post, "#{Stripe.api_base}/v1/shipping_rates" end + should "support requests with args: display_name, type, fixed_amount" do + Stripe::ShippingRate.create( + display_name: "Ground shipping", + type: "fixed_amount", + fixed_amount: { amount: 500, currency: "usd" } + ) + assert_requested :post, "#{Stripe.api_base}/v1/shipping_rates" + end end context "ShippingRate.list" do should "work" do Stripe::ShippingRate.list assert_requested :get, "#{Stripe.api_base}/v1/shipping_rates?" end + should "support requests with args: limit" do + Stripe::ShippingRate.list(limit: 3) + assert_requested :get, "#{Stripe.api_base}/v1/shipping_rates?limit=3" + end + end + context "ShippingRate.retrieve" do + should "support requests with args: id" do + Stripe::ShippingRate.retrieve("shr_xxxxxxxxxxxxx") + assert_requested :get, "#{Stripe.api_base}/v1/shipping_rates/shr_xxxxxxxxxxxxx?" + end + end + context "ShippingRate.update" do + should "support requests with args: metadata, id" do + Stripe::ShippingRate.update( + "shr_xxxxxxxxxxxxx", + { metadata: { order_id: "6735" } } + ) + assert_requested :post, "#{Stripe.api_base}/v1/shipping_rates/shr_xxxxxxxxxxxxx" + end end context "Sigma.ScheduledQueryRun.list" do should "support requests with args: limit" do @@ -1510,6 +1769,10 @@ class CodegennedExampleTest < Test::Unit::TestCase Stripe::Source.retrieve("src_xxxxxxxxxxxxx") assert_requested :get, "#{Stripe.api_base}/v1/sources/src_xxxxxxxxxxxxx?" end + should "support requests with args: id2" do + Stripe::Source.retrieve("src_xxxxxxxxxxxxx") + assert_requested :get, "#{Stripe.api_base}/v1/sources/src_xxxxxxxxxxxxx?" + end end context "Source.update" do should "support requests with args: metadata, id" do @@ -1541,6 +1804,14 @@ class CodegennedExampleTest < Test::Unit::TestCase assert_requested :get, "#{Stripe.api_base}/v1/subscriptions/sub_xxxxxxxxxxxxx?" end end + context "Subscription.search" do + should "support requests with args: query" do + Stripe::Subscription.search( + query: "status:'active' AND metadata['order_id']:'6735'" + ) + assert_requested :get, "#{Stripe.api_base}/v1/subscriptions/search?query=status:'active' AND metadata['order_id']:'6735'" + end + end context "Subscription.update" do should "support requests with args: metadata, id" do Stripe::Subscription.update( @@ -1597,7 +1868,7 @@ class CodegennedExampleTest < Test::Unit::TestCase should "support requests with args: customer, start_date, end_behavior, phases" do Stripe::SubscriptionSchedule.create( customer: "cus_xxxxxxxxxxxxx", - start_date: 1_620_753_115, + start_date: 1_652_909_005, end_behavior: "release", phases: [ { @@ -1636,6 +1907,18 @@ class CodegennedExampleTest < Test::Unit::TestCase assert_requested :post, "#{Stripe.api_base}/v1/subscription_schedules/sub_sched_xxxxxxxxxxxxx" end end + context "TaxCode.list" do + should "support requests with args: limit" do + Stripe::TaxCode.list(limit: 3) + assert_requested :get, "#{Stripe.api_base}/v1/tax_codes?limit=3" + end + end + context "TaxCode.retrieve" do + should "support requests with args: id" do + Stripe::TaxCode.retrieve("txcd_xxxxxxxxxxxxx") + assert_requested :get, "#{Stripe.api_base}/v1/tax_codes/txcd_xxxxxxxxxxxxx?" + end + end context "TaxId.delete" do should "support requests with args: parent_id, id" do Stripe::Customer.delete_tax_id("cus_xxxxxxxxxxxxx", "txi_xxxxxxxxxxxxx") @@ -1692,24 +1975,42 @@ class CodegennedExampleTest < Test::Unit::TestCase Stripe::Terminal::Configuration.create assert_requested :post, "#{Stripe.api_base}/v1/terminal/configurations?" end + should "support requests with args: bbpos_wisepos_e" do + Stripe::Terminal::Configuration.create( + bbpos_wisepos_e: { splashscreen: "file_xxxxxxxxxxxxx" } + ) + assert_requested :post, "#{Stripe.api_base}/v1/terminal/configurations" + end end context "Terminal.Configuration.delete" do should "support requests with args: configuration" do Stripe::Terminal::Configuration.delete("uc_123") assert_requested :delete, "#{Stripe.api_base}/v1/terminal/configurations/uc_123?" end + should "support requests with args: id" do + Stripe::Terminal::Configuration.delete("tmc_xxxxxxxxxxxxx") + assert_requested :delete, "#{Stripe.api_base}/v1/terminal/configurations/tmc_xxxxxxxxxxxxx?" + end end context "Terminal.Configuration.list" do should "work" do Stripe::Terminal::Configuration.list assert_requested :get, "#{Stripe.api_base}/v1/terminal/configurations?" end + should "support requests with args: limit" do + Stripe::Terminal::Configuration.list(limit: 3) + assert_requested :get, "#{Stripe.api_base}/v1/terminal/configurations?limit=3" + end end context "Terminal.Configuration.retrieve" do should "support requests with args: configuration" do Stripe::Terminal::Configuration.retrieve("uc_123") assert_requested :get, "#{Stripe.api_base}/v1/terminal/configurations/uc_123?" end + should "support requests with args: id" do + Stripe::Terminal::Configuration.retrieve("tmc_xxxxxxxxxxxxx") + assert_requested :get, "#{Stripe.api_base}/v1/terminal/configurations/tmc_xxxxxxxxxxxxx?" + end end context "Terminal.Configuration.update" do should "support requests with args: configuration, tipping" do @@ -1719,6 +2020,13 @@ class CodegennedExampleTest < Test::Unit::TestCase ) assert_requested :post, "#{Stripe.api_base}/v1/terminal/configurations/uc_123" end + should "support requests with args: bbpos_wisepos_e, id" do + Stripe::Terminal::Configuration.update( + "tmc_xxxxxxxxxxxxx", + { bbpos_wisepos_e: { splashscreen: "file_xxxxxxxxxxxxx" } } + ) + assert_requested :post, "#{Stripe.api_base}/v1/terminal/configurations/tmc_xxxxxxxxxxxxx" + end end context "Terminal.ConnectionToken.create" do should "work" do @@ -1767,6 +2075,12 @@ class CodegennedExampleTest < Test::Unit::TestCase assert_requested :post, "#{Stripe.api_base}/v1/terminal/locations/tml_xxxxxxxxxxxxx" end end + context "Terminal.Reader.cancel_action" do + should "support requests with args: id" do + Stripe::Terminal::Reader.cancel_action("tmr_xxxxxxxxxxxxx") + assert_requested :post, "#{Stripe.api_base}/v1/terminal/readers/tmr_xxxxxxxxxxxxx/cancel_action?" + end + end context "Terminal.Reader.create" do should "support requests with args: registration_code, label, location" do Stripe::Terminal::Reader.create( @@ -1779,8 +2093,8 @@ class CodegennedExampleTest < Test::Unit::TestCase end context "Terminal.Reader.delete" do should "support requests with args: id" do - Stripe::Terminal::Reader.delete("tmr_P400-123-456-789") - assert_requested :delete, "#{Stripe.api_base}/v1/terminal/readers/tmr_P400-123-456-789?" + Stripe::Terminal::Reader.delete("tmr_xxxxxxxxxxxxx") + assert_requested :delete, "#{Stripe.api_base}/v1/terminal/readers/tmr_xxxxxxxxxxxxx?" end end context "Terminal.Reader.list" do @@ -1789,19 +2103,40 @@ class CodegennedExampleTest < Test::Unit::TestCase assert_requested :get, "#{Stripe.api_base}/v1/terminal/readers?limit=3" end end + context "Terminal.Reader.process_payment_intent" do + should "support requests with args: payment_intent, id" do + Stripe::Terminal::Reader.process_payment_intent( + "tmr_xxxxxxxxxxxxx", + { payment_intent: "pi_xxxxxxxxxxxxx" } + ) + assert_requested :post, "#{Stripe.api_base}/v1/terminal/readers/tmr_xxxxxxxxxxxxx/process_payment_intent" + end + end + context "Terminal.Reader.process_setup_intent" do + should "support requests with args: setup_intent, customer_consent_collected, id" do + Stripe::Terminal::Reader.process_setup_intent( + "tmr_xxxxxxxxxxxxx", + { + setup_intent: "seti_xxxxxxxxxxxxx", + customer_consent_collected: true, + } + ) + assert_requested :post, "#{Stripe.api_base}/v1/terminal/readers/tmr_xxxxxxxxxxxxx/process_setup_intent" + end + end context "Terminal.Reader.retrieve" do should "support requests with args: id" do - Stripe::Terminal::Reader.retrieve("tmr_P400-123-456-789") - assert_requested :get, "#{Stripe.api_base}/v1/terminal/readers/tmr_P400-123-456-789?" + Stripe::Terminal::Reader.retrieve("tmr_xxxxxxxxxxxxx") + assert_requested :get, "#{Stripe.api_base}/v1/terminal/readers/tmr_xxxxxxxxxxxxx?" end end context "Terminal.Reader.update" do should "support requests with args: label, id" do Stripe::Terminal::Reader.update( - "tmr_P400-123-456-789", + "tmr_xxxxxxxxxxxxx", { label: "Blue Rabbit" } ) - assert_requested :post, "#{Stripe.api_base}/v1/terminal/readers/tmr_P400-123-456-789" + assert_requested :post, "#{Stripe.api_base}/v1/terminal/readers/tmr_xxxxxxxxxxxxx" end end context "TestHelpers.TestClock.advance" do @@ -1809,6 +2144,13 @@ class CodegennedExampleTest < Test::Unit::TestCase Stripe::TestHelpers::TestClock.advance("clock_xyz", { frozen_time: 142 }) assert_requested :post, "#{Stripe.api_base}/v1/test_helpers/test_clocks/clock_xyz/advance" end + should "support requests with args: frozen_time, id" do + Stripe::TestHelpers::TestClock.advance( + "clock_xxxxxxxxxxxxx", + { frozen_time: 1_652_390_605 } + ) + assert_requested :post, "#{Stripe.api_base}/v1/test_helpers/test_clocks/clock_xxxxxxxxxxxxx/advance" + end end context "TestHelpers.TestClock.create" do should "support requests with args: frozen_time, name" do @@ -1818,24 +2160,40 @@ class CodegennedExampleTest < Test::Unit::TestCase ) assert_requested :post, "#{Stripe.api_base}/v1/test_helpers/test_clocks" end + should "support requests with args: frozen_time" do + Stripe::TestHelpers::TestClock.create(frozen_time: 1_577_836_800) + assert_requested :post, "#{Stripe.api_base}/v1/test_helpers/test_clocks" + end end context "TestHelpers.TestClock.delete" do should "support requests with args: test_clock" do Stripe::TestHelpers::TestClock.delete("clock_xyz") assert_requested :delete, "#{Stripe.api_base}/v1/test_helpers/test_clocks/clock_xyz?" end + should "support requests with args: id" do + Stripe::TestHelpers::TestClock.delete("clock_xxxxxxxxxxxxx") + assert_requested :delete, "#{Stripe.api_base}/v1/test_helpers/test_clocks/clock_xxxxxxxxxxxxx?" + end end context "TestHelpers.TestClock.list" do should "work" do Stripe::TestHelpers::TestClock.list assert_requested :get, "#{Stripe.api_base}/v1/test_helpers/test_clocks?" end + should "support requests with args: limit" do + Stripe::TestHelpers::TestClock.list(limit: 3) + assert_requested :get, "#{Stripe.api_base}/v1/test_helpers/test_clocks?limit=3" + end end context "TestHelpers.TestClock.retrieve" do should "support requests with args: test_clock" do Stripe::TestHelpers::TestClock.retrieve("clock_xyz") assert_requested :get, "#{Stripe.api_base}/v1/test_helpers/test_clocks/clock_xyz?" end + should "support requests with args: id" do + Stripe::TestHelpers::TestClock.retrieve("clock_xxxxxxxxxxxxx") + assert_requested :get, "#{Stripe.api_base}/v1/test_helpers/test_clocks/clock_xxxxxxxxxxxxx?" + end end context "Token.create" do should "support requests with args: card" do @@ -1843,7 +2201,7 @@ class CodegennedExampleTest < Test::Unit::TestCase card: { number: "4242424242424242", exp_month: "5", - exp_year: "2022", + exp_year: "2023", cvc: "314", } ) @@ -1988,6 +2346,320 @@ class CodegennedExampleTest < Test::Unit::TestCase assert_requested :post, "#{Stripe.api_base}/v1/transfers/tr_xxxxxxxxxxxxx/reversals/trr_xxxxxxxxxxxxx" end end + context "Treasury.CreditReversal.create" do + should "support requests with args: received_credit" do + Stripe::Treasury::CreditReversal.create( + received_credit: "rc_xxxxxxxxxxxxx" + ) + assert_requested :post, "#{Stripe.api_base}/v1/treasury/credit_reversals" + end + end + context "Treasury.CreditReversal.list" do + should "support requests with args: financial_account, limit" do + Stripe::Treasury::CreditReversal.list( + financial_account: "fa_xxxxxxxxxxxxx", + limit: 3 + ) + assert_requested :get, "#{Stripe.api_base}/v1/treasury/credit_reversals?financial_account=fa_xxxxxxxxxxxxx&limit=3" + end + end + context "Treasury.CreditReversal.retrieve" do + should "support requests with args: id" do + Stripe::Treasury::CreditReversal.retrieve("credrev_xxxxxxxxxxxxx") + assert_requested :get, "#{Stripe.api_base}/v1/treasury/credit_reversals/credrev_xxxxxxxxxxxxx?" + end + end + context "Treasury.DebitReversal.create" do + should "support requests with args: received_debit" do + Stripe::Treasury::DebitReversal.create( + received_debit: "rd_xxxxxxxxxxxxx" + ) + assert_requested :post, "#{Stripe.api_base}/v1/treasury/debit_reversals" + end + end + context "Treasury.DebitReversal.list" do + should "support requests with args: financial_account, limit" do + Stripe::Treasury::DebitReversal.list( + financial_account: "fa_xxxxxxxxxxxxx", + limit: 3 + ) + assert_requested :get, "#{Stripe.api_base}/v1/treasury/debit_reversals?financial_account=fa_xxxxxxxxxxxxx&limit=3" + end + end + context "Treasury.DebitReversal.retrieve" do + should "support requests with args: id" do + Stripe::Treasury::DebitReversal.retrieve("debrev_xxxxxxxxxxxxx") + assert_requested :get, "#{Stripe.api_base}/v1/treasury/debit_reversals/debrev_xxxxxxxxxxxxx?" + end + end + context "Treasury.FinancialAccount.create" do + should "support requests with args: supported_currencies, features" do + Stripe::Treasury::FinancialAccount.create( + supported_currencies: ["usd"], + features: {} + ) + assert_requested :post, "#{Stripe.api_base}/v1/treasury/financial_accounts" + end + end + context "Treasury.FinancialAccount.list" do + should "support requests with args: limit" do + Stripe::Treasury::FinancialAccount.list(limit: 3) + assert_requested :get, "#{Stripe.api_base}/v1/treasury/financial_accounts?limit=3" + end + end + context "Treasury.FinancialAccount.retrieve" do + should "support requests with args: id" do + Stripe::Treasury::FinancialAccount.retrieve("fa_xxxxxxxxxxxxx") + assert_requested :get, "#{Stripe.api_base}/v1/treasury/financial_accounts/fa_xxxxxxxxxxxxx?" + end + end + context "Treasury.FinancialAccount.retrieve_features" do + should "support requests with args: parent_id" do + Stripe::Treasury::FinancialAccount.retrieve_features("fa_xxxxxxxxxxxxx") + assert_requested :get, "#{Stripe.api_base}/v1/treasury/financial_accounts/fa_xxxxxxxxxxxxx/features?" + end + end + context "Treasury.FinancialAccount.update" do + should "support requests with args: metadata, id" do + Stripe::Treasury::FinancialAccount.update( + "fa_xxxxxxxxxxxxx", + { metadata: { order_id: "6735" } } + ) + assert_requested :post, "#{Stripe.api_base}/v1/treasury/financial_accounts/fa_xxxxxxxxxxxxx" + end + end + context "Treasury.FinancialAccount.update_features" do + should "support requests with args: parent_id" do + Stripe::Treasury::FinancialAccount.update_features("fa_xxxxxxxxxxxxx") + assert_requested :post, "#{Stripe.api_base}/v1/treasury/financial_accounts/fa_xxxxxxxxxxxxx/features?" + end + end + context "Treasury.InboundTransfer.cancel" do + should "support requests with args: id" do + Stripe::Treasury::InboundTransfer.cancel("ibt_xxxxxxxxxxxxx") + assert_requested :post, "#{Stripe.api_base}/v1/treasury/inbound_transfers/ibt_xxxxxxxxxxxxx/cancel?" + end + end + context "Treasury.InboundTransfer.create" do + should "support requests with args: financial_account, amount, currency, origin_payment_method, description" do + Stripe::Treasury::InboundTransfer.create( + financial_account: "fa_xxxxxxxxxxxxx", + amount: 10_000, + currency: "usd", + origin_payment_method: "pm_xxxxxxxxxxxxx", + description: "InboundTransfer from my bank account" + ) + assert_requested :post, "#{Stripe.api_base}/v1/treasury/inbound_transfers" + end + end + context "Treasury.InboundTransfer.fail" do + should "support requests with args: id, failure_details" do + Stripe::Treasury::InboundTransfer::TestHelpers.fail( + "ibt_123", + { failure_details: { code: "account_closed" } } + ) + assert_requested :post, "#{Stripe.api_base}/v1/test_helpers/treasury/inbound_transfers/ibt_123/fail" + end + end + context "Treasury.InboundTransfer.list" do + should "support requests with args: financial_account, limit" do + Stripe::Treasury::InboundTransfer.list( + financial_account: "fa_xxxxxxxxxxxxx", + limit: 3 + ) + assert_requested :get, "#{Stripe.api_base}/v1/treasury/inbound_transfers?financial_account=fa_xxxxxxxxxxxxx&limit=3" + end + end + context "Treasury.InboundTransfer.retrieve" do + should "support requests with args: id" do + Stripe::Treasury::InboundTransfer.retrieve("ibt_xxxxxxxxxxxxx") + assert_requested :get, "#{Stripe.api_base}/v1/treasury/inbound_transfers/ibt_xxxxxxxxxxxxx?" + end + end + context "Treasury.InboundTransfer.return_inbound_transfer" do + should "support requests with args: id" do + Stripe::Treasury::InboundTransfer::TestHelpers.return_inbound_transfer( + "ibt_123" + ) + assert_requested :post, "#{Stripe.api_base}/v1/test_helpers/treasury/inbound_transfers/ibt_123/return?" + end + end + context "Treasury.InboundTransfer.succeed" do + should "support requests with args: id" do + Stripe::Treasury::InboundTransfer::TestHelpers.succeed("ibt_123") + assert_requested :post, "#{Stripe.api_base}/v1/test_helpers/treasury/inbound_transfers/ibt_123/succeed?" + end + end + context "Treasury.OutboundPayment.cancel" do + should "support requests with args: id" do + Stripe::Treasury::OutboundPayment.cancel("obp_xxxxxxxxxxxxx") + assert_requested :post, "#{Stripe.api_base}/v1/treasury/outbound_payments/obp_xxxxxxxxxxxxx/cancel?" + end + end + context "Treasury.OutboundPayment.create" do + should "support requests with args: financial_account, amount, currency, customer, destination_payment_method, description" do + Stripe::Treasury::OutboundPayment.create( + financial_account: "fa_xxxxxxxxxxxxx", + amount: 10_000, + currency: "usd", + customer: "cu_xxxxxxxxxxxxx", + destination_payment_method: "pm_xxxxxxxxxxxxx", + description: "OutboundPayment to a 3rd party" + ) + assert_requested :post, "#{Stripe.api_base}/v1/treasury/outbound_payments" + end + end + context "Treasury.OutboundPayment.list" do + should "support requests with args: financial_account, limit" do + Stripe::Treasury::OutboundPayment.list( + financial_account: "fa_xxxxxxxxxxxxx", + limit: 3 + ) + assert_requested :get, "#{Stripe.api_base}/v1/treasury/outbound_payments?financial_account=fa_xxxxxxxxxxxxx&limit=3" + end + end + context "Treasury.OutboundPayment.retrieve" do + should "support requests with args: id" do + Stripe::Treasury::OutboundPayment.retrieve("obp_xxxxxxxxxxxxx") + assert_requested :get, "#{Stripe.api_base}/v1/treasury/outbound_payments/obp_xxxxxxxxxxxxx?" + end + end + context "Treasury.OutboundTransfer.cancel" do + should "support requests with args: id" do + Stripe::Treasury::OutboundTransfer.cancel("obt_xxxxxxxxxxxxx") + assert_requested :post, "#{Stripe.api_base}/v1/treasury/outbound_transfers/obt_xxxxxxxxxxxxx/cancel?" + end + end + context "Treasury.OutboundTransfer.create" do + should "support requests with args: financial_account, destination_payment_method, amount, currency, description" do + Stripe::Treasury::OutboundTransfer.create( + financial_account: "fa_xxxxxxxxxxxxx", + destination_payment_method: "pm_xxxxxxxxxxxxx", + amount: 500, + currency: "usd", + description: "OutboundTransfer to my external bank account" + ) + assert_requested :post, "#{Stripe.api_base}/v1/treasury/outbound_transfers" + end + end + context "Treasury.OutboundTransfer.fail" do + should "support requests with args: id" do + Stripe::Treasury::OutboundTransfer::TestHelpers.fail("obt_123") + assert_requested :post, "#{Stripe.api_base}/v1/test_helpers/treasury/outbound_transfers/obt_123/fail?" + end + end + context "Treasury.OutboundTransfer.list" do + should "support requests with args: financial_account, limit" do + Stripe::Treasury::OutboundTransfer.list( + financial_account: "fa_xxxxxxxxxxxxx", + limit: 3 + ) + assert_requested :get, "#{Stripe.api_base}/v1/treasury/outbound_transfers?financial_account=fa_xxxxxxxxxxxxx&limit=3" + end + end + context "Treasury.OutboundTransfer.post" do + should "support requests with args: id" do + Stripe::Treasury::OutboundTransfer::TestHelpers.post("obt_123") + assert_requested :post, "#{Stripe.api_base}/v1/test_helpers/treasury/outbound_transfers/obt_123/post?" + end + end + context "Treasury.OutboundTransfer.retrieve" do + should "support requests with args: id" do + Stripe::Treasury::OutboundTransfer.retrieve("obt_xxxxxxxxxxxxx") + assert_requested :get, "#{Stripe.api_base}/v1/treasury/outbound_transfers/obt_xxxxxxxxxxxxx?" + end + end + context "Treasury.OutboundTransfer.return_outbound_transfer" do + should "support requests with args: id, returned_details" do + Stripe::Treasury::OutboundTransfer::TestHelpers.return_outbound_transfer( + "obt_123", + { returned_details: { code: "account_closed" } } + ) + assert_requested :post, "#{Stripe.api_base}/v1/test_helpers/treasury/outbound_transfers/obt_123/return" + end + end + context "Treasury.ReceivedCredit.create" do + should "support requests with args: financial_account, network, amount, currency" do + Stripe::Treasury::ReceivedCredit::TestHelpers.create( + financial_account: "fa_123", + network: "ach", + amount: 1234, + currency: "usd" + ) + assert_requested :post, "#{Stripe.api_base}/v1/test_helpers/treasury/received_credits" + end + end + context "Treasury.ReceivedCredit.list" do + should "support requests with args: financial_account, limit" do + Stripe::Treasury::ReceivedCredit.list( + financial_account: "fa_xxxxxxxxxxxxx", + limit: 3 + ) + assert_requested :get, "#{Stripe.api_base}/v1/treasury/received_credits?financial_account=fa_xxxxxxxxxxxxx&limit=3" + end + end + context "Treasury.ReceivedCredit.retrieve" do + should "support requests with args: id" do + Stripe::Treasury::ReceivedCredit.retrieve("rc_xxxxxxxxxxxxx") + assert_requested :get, "#{Stripe.api_base}/v1/treasury/received_credits/rc_xxxxxxxxxxxxx?" + end + end + context "Treasury.ReceivedDebit.create" do + should "support requests with args: financial_account, network, amount, currency" do + Stripe::Treasury::ReceivedDebit::TestHelpers.create( + financial_account: "fa_123", + network: "ach", + amount: 1234, + currency: "usd" + ) + assert_requested :post, "#{Stripe.api_base}/v1/test_helpers/treasury/received_debits" + end + end + context "Treasury.ReceivedDebit.list" do + should "support requests with args: financial_account, limit" do + Stripe::Treasury::ReceivedDebit.list( + financial_account: "fa_xxxxxxxxxxxxx", + limit: 3 + ) + assert_requested :get, "#{Stripe.api_base}/v1/treasury/received_debits?financial_account=fa_xxxxxxxxxxxxx&limit=3" + end + end + context "Treasury.ReceivedDebit.retrieve" do + should "support requests with args: id" do + Stripe::Treasury::ReceivedDebit.retrieve("rd_xxxxxxxxxxxxx") + assert_requested :get, "#{Stripe.api_base}/v1/treasury/received_debits/rd_xxxxxxxxxxxxx?" + end + end + context "Treasury.Transaction.list" do + should "support requests with args: financial_account, limit" do + Stripe::Treasury::Transaction.list( + financial_account: "fa_xxxxxxxxxxxxx", + limit: 3 + ) + assert_requested :get, "#{Stripe.api_base}/v1/treasury/transactions?financial_account=fa_xxxxxxxxxxxxx&limit=3" + end + end + context "Treasury.Transaction.retrieve" do + should "support requests with args: id" do + Stripe::Treasury::Transaction.retrieve("trxn_xxxxxxxxxxxxx") + assert_requested :get, "#{Stripe.api_base}/v1/treasury/transactions/trxn_xxxxxxxxxxxxx?" + end + end + context "Treasury.TransactionEntry.list" do + should "support requests with args: financial_account, limit" do + Stripe::Treasury::TransactionEntry.list( + financial_account: "fa_xxxxxxxxxxxxx", + limit: 3 + ) + assert_requested :get, "#{Stripe.api_base}/v1/treasury/transaction_entries?financial_account=fa_xxxxxxxxxxxxx&limit=3" + end + end + context "Treasury.TransactionEntry.retrieve" do + should "support requests with args: id" do + Stripe::Treasury::TransactionEntry.retrieve("trxne_xxxxxxxxxxxxx") + assert_requested :get, "#{Stripe.api_base}/v1/treasury/transaction_entries/trxne_xxxxxxxxxxxxx?" + end + end context "WebhookEndpoint.create" do should "support requests with args: url, enabled_events" do Stripe::WebhookEndpoint.create(