github.com/stripe/stripe-go/v76@v76.25.0/treasury_creditreversal.go (about)

     1  //
     2  //
     3  // File generated from our OpenAPI spec
     4  //
     5  //
     6  
     7  package stripe
     8  
     9  // The rails used to reverse the funds.
    10  type TreasuryCreditReversalNetwork string
    11  
    12  // List of values that TreasuryCreditReversalNetwork can take
    13  const (
    14  	TreasuryCreditReversalNetworkACH    TreasuryCreditReversalNetwork = "ach"
    15  	TreasuryCreditReversalNetworkStripe TreasuryCreditReversalNetwork = "stripe"
    16  )
    17  
    18  // Status of the CreditReversal
    19  type TreasuryCreditReversalStatus string
    20  
    21  // List of values that TreasuryCreditReversalStatus can take
    22  const (
    23  	TreasuryCreditReversalStatusCanceled   TreasuryCreditReversalStatus = "canceled"
    24  	TreasuryCreditReversalStatusPosted     TreasuryCreditReversalStatus = "posted"
    25  	TreasuryCreditReversalStatusProcessing TreasuryCreditReversalStatus = "processing"
    26  )
    27  
    28  // Returns a list of CreditReversals.
    29  type TreasuryCreditReversalListParams struct {
    30  	ListParams `form:"*"`
    31  	// Specifies which fields in the response should be expanded.
    32  	Expand []*string `form:"expand"`
    33  	// Returns objects associated with this FinancialAccount.
    34  	FinancialAccount *string `form:"financial_account"`
    35  	// Only return CreditReversals for the ReceivedCredit ID.
    36  	ReceivedCredit *string `form:"received_credit"`
    37  	// Only return CreditReversals for a given status.
    38  	Status *string `form:"status"`
    39  }
    40  
    41  // AddExpand appends a new field to expand.
    42  func (p *TreasuryCreditReversalListParams) AddExpand(f string) {
    43  	p.Expand = append(p.Expand, &f)
    44  }
    45  
    46  // Reverses a ReceivedCredit and creates a CreditReversal object.
    47  type TreasuryCreditReversalParams struct {
    48  	Params `form:"*"`
    49  	// Specifies which fields in the response should be expanded.
    50  	Expand []*string `form:"expand"`
    51  	// 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`.
    52  	Metadata map[string]string `form:"metadata"`
    53  	// The ReceivedCredit to reverse.
    54  	ReceivedCredit *string `form:"received_credit"`
    55  }
    56  
    57  // AddExpand appends a new field to expand.
    58  func (p *TreasuryCreditReversalParams) AddExpand(f string) {
    59  	p.Expand = append(p.Expand, &f)
    60  }
    61  
    62  // AddMetadata adds a new key-value pair to the Metadata.
    63  func (p *TreasuryCreditReversalParams) AddMetadata(key string, value string) {
    64  	if p.Metadata == nil {
    65  		p.Metadata = make(map[string]string)
    66  	}
    67  
    68  	p.Metadata[key] = value
    69  }
    70  
    71  type TreasuryCreditReversalStatusTransitions struct {
    72  	// Timestamp describing when the CreditReversal changed status to `posted`
    73  	PostedAt int64 `json:"posted_at"`
    74  }
    75  
    76  // 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.
    77  type TreasuryCreditReversal struct {
    78  	APIResource
    79  	// Amount (in cents) transferred.
    80  	Amount int64 `json:"amount"`
    81  	// Time at which the object was created. Measured in seconds since the Unix epoch.
    82  	Created int64 `json:"created"`
    83  	// 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).
    84  	Currency Currency `json:"currency"`
    85  	// The FinancialAccount to reverse funds from.
    86  	FinancialAccount string `json:"financial_account"`
    87  	// 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.
    88  	HostedRegulatoryReceiptURL string `json:"hosted_regulatory_receipt_url"`
    89  	// Unique identifier for the object.
    90  	ID string `json:"id"`
    91  	// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
    92  	Livemode bool `json:"livemode"`
    93  	// 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.
    94  	Metadata map[string]string `json:"metadata"`
    95  	// The rails used to reverse the funds.
    96  	Network TreasuryCreditReversalNetwork `json:"network"`
    97  	// String representing the object's type. Objects of the same type share the same value.
    98  	Object string `json:"object"`
    99  	// The ReceivedCredit being reversed.
   100  	ReceivedCredit string `json:"received_credit"`
   101  	// Status of the CreditReversal
   102  	Status            TreasuryCreditReversalStatus             `json:"status"`
   103  	StatusTransitions *TreasuryCreditReversalStatusTransitions `json:"status_transitions"`
   104  	// The Transaction associated with this object.
   105  	Transaction *TreasuryTransaction `json:"transaction"`
   106  }
   107  
   108  // TreasuryCreditReversalList is a list of CreditReversals as retrieved from a list endpoint.
   109  type TreasuryCreditReversalList struct {
   110  	APIResource
   111  	ListMeta
   112  	Data []*TreasuryCreditReversal `json:"data"`
   113  }