helenye-stripe dc5174725f
Add RBI annotations for fields and params (#1559)
* Introduce types to ruby

* rubocop

* forgot these files

* other request methods

* more tests, fix for raw request

* Add README entry for types

* rebase and regen
2025-03-31 14:29:41 -07:00

132 lines
5.8 KiB
Ruby

# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
module Treasury
# You can reverse some [ReceivedDebits](https://stripe.com/docs/api#received_debits) depending on their network and source flow. Reversing a ReceivedDebit leads to the creation of a new object known as a DebitReversal.
class DebitReversal < APIResource
extend Stripe::APIOperations::Create
extend Stripe::APIOperations::List
OBJECT_NAME = "treasury.debit_reversal"
def self.object_name
"treasury.debit_reversal"
end
class LinkedFlows < Stripe::StripeObject
# Set if there is an Issuing dispute associated with the DebitReversal.
attr_reader :issuing_dispute
end
class StatusTransitions < Stripe::StripeObject
# Timestamp describing when the DebitReversal changed status to `completed`.
attr_reader :completed_at
end
class ListParams < Stripe::RequestParams
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
attr_accessor :ending_before
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# Returns objects associated with this FinancialAccount.
attr_accessor :financial_account
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
attr_accessor :limit
# Only return DebitReversals for the ReceivedDebit ID.
attr_accessor :received_debit
# Only return DebitReversals for a given resolution.
attr_accessor :resolution
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
attr_accessor :starting_after
# Only return DebitReversals for a given status.
attr_accessor :status
def initialize(
ending_before: nil,
expand: nil,
financial_account: nil,
limit: nil,
received_debit: nil,
resolution: nil,
starting_after: nil,
status: nil
)
@ending_before = ending_before
@expand = expand
@financial_account = financial_account
@limit = limit
@received_debit = received_debit
@resolution = resolution
@starting_after = starting_after
@status = status
end
end
class CreateParams < Stripe::RequestParams
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
attr_accessor :metadata
# The ReceivedDebit to reverse.
attr_accessor :received_debit
def initialize(expand: nil, metadata: nil, received_debit: nil)
@expand = expand
@metadata = metadata
@received_debit = received_debit
end
end
# Amount (in cents) transferred.
attr_reader :amount
# Time at which the object was created. Measured in seconds since the Unix epoch.
attr_reader :created
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
attr_reader :currency
# The FinancialAccount to reverse funds from.
attr_reader :financial_account
# A [hosted transaction receipt](https://stripe.com/docs/treasury/moving-money/regulatory-receipts) URL that is provided when money movement is considered regulated under Stripe's money transmission licenses.
attr_reader :hosted_regulatory_receipt_url
# Unique identifier for the object.
attr_reader :id
# Other flows linked to a DebitReversal.
attr_reader :linked_flows
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
attr_reader :livemode
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
attr_reader :metadata
# The rails used to reverse the funds.
attr_reader :network
# String representing the object's type. Objects of the same type share the same value.
attr_reader :object
# The ReceivedDebit being reversed.
attr_reader :received_debit
# Status of the DebitReversal
attr_reader :status
# Attribute for field status_transitions
attr_reader :status_transitions
# The Transaction associated with this object.
attr_reader :transaction
# Reverses a ReceivedDebit and creates a DebitReversal object.
def self.create(params = {}, opts = {})
request_stripe_object(
method: :post,
path: "/v1/treasury/debit_reversals",
params: params,
opts: opts
)
end
# Returns a list of DebitReversals.
def self.list(params = {}, opts = {})
request_stripe_object(
method: :get,
path: "/v1/treasury/debit_reversals",
params: params,
opts: opts
)
end
end
end
end