stripe-ruby/lib/stripe/resources/treasury/outbound_payment.rb
2022-08-23 05:35:55 -07:00

97 lines
3.2 KiB
Ruby

# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
module Treasury
# Use OutboundPayments to send funds to another party's external bank account or [FinancialAccount](https://stripe.com/docs/api#financial_accounts). To send money to an account belonging to the same user, use an [OutboundTransfer](https://stripe.com/docs/api#outbound_transfers).
#
# Simulate OutboundPayment state changes with the `/v1/test_helpers/treasury/outbound_payments` endpoints. These methods can only be called on test mode objects.
class OutboundPayment < APIResource
extend Stripe::APIOperations::Create
extend Stripe::APIOperations::List
OBJECT_NAME = "treasury.outbound_payment"
def cancel(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/treasury/outbound_payments/%<id>s/cancel", { id: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
def self.cancel(id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/treasury/outbound_payments/%<id>s/cancel", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end
def test_helpers
TestHelpers.new(self)
end
class TestHelpers < APIResourceTestHelpers
RESOURCE_CLASS = OutboundPayment
def self.fail(id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/test_helpers/treasury/outbound_payments/%<id>s/fail", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end
def self.post(id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/test_helpers/treasury/outbound_payments/%<id>s/post", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end
def self.return_outbound_payment(id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/test_helpers/treasury/outbound_payments/%<id>s/return", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end
def fail(params = {}, opts = {})
@resource.request_stripe_object(
method: :post,
path: format("/v1/test_helpers/treasury/outbound_payments/%<id>s/fail", { id: CGI.escape(@resource["id"]) }),
params: params,
opts: opts
)
end
def post(params = {}, opts = {})
@resource.request_stripe_object(
method: :post,
path: format("/v1/test_helpers/treasury/outbound_payments/%<id>s/post", { id: CGI.escape(@resource["id"]) }),
params: params,
opts: opts
)
end
def return_outbound_payment(params = {}, opts = {})
@resource.request_stripe_object(
method: :post,
path: format("/v1/test_helpers/treasury/outbound_payments/%<id>s/return", { id: CGI.escape(@resource["id"]) }),
params: params,
opts: opts
)
end
end
end
end
end