# 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 self.object_name "treasury.outbound_payment" end # Cancel an OutboundPayment. def cancel(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/treasury/outbound_payments/%s/cancel", { id: CGI.escape(self["id"]) }), params: params, opts: opts ) end # Cancel an OutboundPayment. def self.cancel(id, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/treasury/outbound_payments/%s/cancel", { id: CGI.escape(id) }), params: params, opts: opts ) end # Creates an OutboundPayment. def self.create(params = {}, opts = {}) request_stripe_object( method: :post, path: "/v1/treasury/outbound_payments", params: params, opts: opts ) end # Returns a list of OutboundPayments sent from the specified FinancialAccount. def self.list(filters = {}, opts = {}) request_stripe_object( method: :get, path: "/v1/treasury/outbound_payments", params: filters, opts: opts ) end def test_helpers TestHelpers.new(self) end class TestHelpers < APIResourceTestHelpers RESOURCE_CLASS = OutboundPayment def self.resource_class "OutboundPayment" end # Transitions a test mode created OutboundPayment to the failed status. The OutboundPayment must already be in the processing state. def self.fail(id, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/test_helpers/treasury/outbound_payments/%s/fail", { id: CGI.escape(id) }), params: params, opts: opts ) end # Transitions a test mode created OutboundPayment to the failed status. The OutboundPayment must already be in the processing state. def fail(params = {}, opts = {}) @resource.request_stripe_object( method: :post, path: format("/v1/test_helpers/treasury/outbound_payments/%s/fail", { id: CGI.escape(@resource["id"]) }), params: params, opts: opts ) end # Transitions a test mode created OutboundPayment to the posted status. The OutboundPayment must already be in the processing state. def self.post(id, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/test_helpers/treasury/outbound_payments/%s/post", { id: CGI.escape(id) }), params: params, opts: opts ) end # Transitions a test mode created OutboundPayment to the posted status. The OutboundPayment must already be in the processing state. def post(params = {}, opts = {}) @resource.request_stripe_object( method: :post, path: format("/v1/test_helpers/treasury/outbound_payments/%s/post", { id: CGI.escape(@resource["id"]) }), params: params, opts: opts ) end # Transitions a test mode created OutboundPayment to the returned status. The OutboundPayment must already be in the processing state. def self.return_outbound_payment(id, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/test_helpers/treasury/outbound_payments/%s/return", { id: CGI.escape(id) }), params: params, opts: opts ) end # Transitions a test mode created OutboundPayment to the returned status. The OutboundPayment must already be in the processing state. def return_outbound_payment(params = {}, opts = {}) @resource.request_stripe_object( method: :post, path: format("/v1/test_helpers/treasury/outbound_payments/%s/return", { id: CGI.escape(@resource["id"]) }), params: params, opts: opts ) end end end end end