# 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" # 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 def test_helpers TestHelpers.new(self) end class TestHelpers < APIResourceTestHelpers RESOURCE_CLASS = OutboundPayment # 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 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 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 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 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 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