# File generated from our OpenAPI spec # frozen_string_literal: true module Stripe module Treasury # You can reverse some [ReceivedCredits](https://stripe.com/docs/api#received_credits) depending on their network and source flow. Reversing a ReceivedCredit leads to the creation of a new object known as a CreditReversal. class CreditReversal < APIResource extend Stripe::APIOperations::Create extend Stripe::APIOperations::List OBJECT_NAME = "treasury.credit_reversal" def self.object_name "treasury.credit_reversal" end class StatusTransitions < Stripe::StripeObject # Timestamp describing when the CreditReversal changed status to `posted` attr_reader :posted_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 CreditReversals for the ReceivedCredit ID. attr_accessor :received_credit # 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 CreditReversals for a given status. attr_accessor :status def initialize( ending_before: nil, expand: nil, financial_account: nil, limit: nil, received_credit: nil, starting_after: nil, status: nil ) @ending_before = ending_before @expand = expand @financial_account = financial_account @limit = limit @received_credit = received_credit @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 ReceivedCredit to reverse. attr_accessor :received_credit def initialize(expand: nil, metadata: nil, received_credit: nil) @expand = expand @metadata = metadata @received_credit = received_credit 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 # 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 ReceivedCredit being reversed. attr_reader :received_credit # Status of the CreditReversal attr_reader :status # Attribute for field status_transitions attr_reader :status_transitions # The Transaction associated with this object. attr_reader :transaction # Reverses a ReceivedCredit and creates a CreditReversal object. def self.create(params = {}, opts = {}) request_stripe_object( method: :post, path: "/v1/treasury/credit_reversals", params: params, opts: opts ) end # Returns a list of CreditReversals. def self.list(params = {}, opts = {}) request_stripe_object( method: :get, path: "/v1/treasury/credit_reversals", params: params, opts: opts ) end end end end