Files
zeekay 7d727874d5 chore: rebrand Formance Payments -> Hanzo Payments (hanzo-fi)
- go.mod module path + all self-imports: github.com/formancehq/payments -> github.com/hanzo-fi/payments
  (1590 .go files / 3152 refs; 20 modules: root, pkg/client, pkg/domain, 18 ce/plugins).
  External dep kept: formancehq/go-libs.
- plugins: each ce/plugins/* consumed a *published* pkg/domain; added local
  'replace .../pkg/domain => ../../../pkg/domain' (consistent with root) so every
  standalone plugin module builds in-monorepo. compile-plugin.sh MOD var rebranded too.
- branding: README, LICENSE (dual MIT+EE; upstream copyright retained + Hanzo added),
  goreleaser (release images -> registry.hanzo.ai/hanzo-fi, OCI labels, homepage),
  proto go_package, renovate, speakeasy gen.yaml, connector-template *.gotpl.
- CI: removed Numary/Formance workflows + composite action; added canonical hanzo.yml +
  cicd.yml (hanzoai/ci, gated HANZO_CI_ENABLED) + secretless ci.yml (go build/vet).
- kept as data/compat keys: wire capability enums ALLOW_FORMANCE_*, generated SDK type
  client.Formance, domain field FormanceRedirectURL, OTEL_SERVICE_NAME, upstream base image.
- verified: go build ./... (default + -tags ee) + all 20 nested modules green.
2026-07-05 13:08:55 -07:00

323 lines
9.0 KiB
Go

// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
package components
import (
"github.com/hanzo-fi/payments/pkg/client/internal/utils"
"math/big"
"time"
)
// V3Order - A trade order submitted to an exchange-style PSP. Orders are read-only
// in the Formance API: they are fetched from the underlying connector.
// Status transitions are captured via the `adjustments` array; each
// adjustment is a point-in-time snapshot from the PSP.
type V3Order struct {
// Formance-assigned unique order ID (composed from the PSP reference and connector ID).
ID string `json:"id"`
// ID of the Formance connector this order was fetched from.
ConnectorID string `json:"connectorID"`
// Provider name of the connector (e.g. `coinbaseprime`).
Provider string `json:"provider"`
// PSP-assigned order reference. Unique within the connector; used as the storage dedup key.
Reference string `json:"reference"`
// Client-assigned ID supplied to the PSP for placement idempotency
// (e.g. Coinbase `client_order_id`, Kraken `cl_ord_id`, Binance
// `clientOrderId`). Stored for traceability only — Formance does
// NOT dedup on this field.
//
ClientOrderID *string `json:"clientOrderID,omitempty"`
// When the order was created on the PSP.
CreatedAt time.Time `json:"createdAt"`
// When Formance last observed a state change on the order. Equivalent to the latest adjustment's `createdAt`.
UpdatedAt time.Time `json:"updatedAt"`
// Whether an order buys or sells the base asset.
Direction V3OrderDirectionEnum `json:"direction"`
// Asset being spent, in `SYMBOL/precision` form (e.g. `USD/2`,
// `BTC/8`). For BUY: the quote currency. For SELL: the base
// currency.
//
SourceAsset string `json:"sourceAsset"`
// Asset being received, in `SYMBOL/precision` form.
// For BUY: the base currency. For SELL: the quote currency.
//
DestinationAsset string `json:"destinationAsset"`
// Exchange order type. Determines which price fields are meaningful on
// `V3Order`: LIMIT-family types use `limitPrice`; STOP-family types use
// `stopPrice`; TWAP/VWAP are time-weighted execution algorithms.
//
Type V3OrderTypeEnum `json:"type"`
// Lifecycle of an order on the exchange.
// `PENDING` — accepted by the exchange, not yet working.
// `OPEN` — live on the book, no fills yet.
// `PARTIALLY_FILLED` — live on the book, some base quantity filled.
// `FILLED` — fully filled, terminal.
// `CANCELLED` — cancelled by the user or system, terminal.
// `FAILED` — rejected by the exchange, terminal. See `error` for details.
// `EXPIRED` — `timeInForce` elapsed before full fill, terminal.
//
Status V3OrderStatusEnum `json:"status"`
// Amount of base asset the order was placed for, as an integer at the base asset's precision.
BaseQuantityOrdered *big.Int `json:"baseQuantityOrdered"`
// Amount of base asset filled so far, as an integer at the base asset's precision. Null before any fill.
BaseQuantityFilled *big.Int `json:"baseQuantityFilled,omitempty"`
// Maximum price (for BUY) or minimum price (for SELL) at which the order may execute, in `priceAsset` precision. Required for LIMIT-family order types; null otherwise.
LimitPrice *big.Int `json:"limitPrice,omitempty"`
// Trigger price at which a STOP / STOP_LIMIT order activates, in `priceAsset` precision. Null for non-stop order types.
StopPrice *big.Int `json:"stopPrice,omitempty"`
// How long an order is valid on the exchange.
// `GOOD_UNTIL_CANCELLED` — rests until explicitly cancelled.
// `GOOD_UNTIL_DATE_TIME` — rests until `expiresAt`.
// `IMMEDIATE_OR_CANCEL` — fill immediately, cancel any unfilled portion.
// `FILL_OR_KILL` — fill fully and immediately, or cancel entirely.
//
TimeInForce V3TimeInForceEnum `json:"timeInForce"`
// Expiration instant for `GOOD_UNTIL_DATE_TIME` orders. Null for other time-in-force values.
ExpiresAt *time.Time `json:"expiresAt,omitempty"`
// Commission charged by the PSP for the order, as an integer in `feeAsset` precision.
Fee *big.Int `json:"fee,omitempty"`
// Currency the fee is denominated in, in `SYMBOL/precision` form. Typically the quote asset.
FeeAsset *string `json:"feeAsset,omitempty"`
// Volume-weighted average price across all fills so far, in `priceAsset` precision. Analytics field — may be absent if the PSP does not report it.
AverageFillPrice *big.Int `json:"averageFillPrice,omitempty"`
// Total amount of quote currency exchanged so far, as reported by
// the PSP (e.g. Coinbase `filled_value`), at `quoteAsset`
// precision. For BUY: amount spent. For SELL: amount received.
//
QuoteAmount *big.Int `json:"quoteAmount,omitempty"`
// Quote currency with precision (e.g. `USD/2`). Null when the order has no quote-side amounts reported yet.
QuoteAsset *string `json:"quoteAsset,omitempty"`
// Currency + precision under which `limitPrice`, `stopPrice`, and
// `averageFillPrice` should be interpreted. Separate from
// `quoteAsset` because some PSPs return price strings with more
// decimal digits than the quote currency's natural precision.
//
PriceAsset *string `json:"priceAsset,omitempty"`
// Formance account ID of the wallet the source asset was debited
// from. Null if the PSP did not return enough information to
// resolve it at ingestion time.
//
SourceAccountID *string `json:"sourceAccountID,omitempty"`
// Formance account ID of the wallet the destination asset was credited to. Null if unresolvable.
DestinationAccountID *string `json:"destinationAccountID,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
// Ordered history of state snapshots for this order. The most recent element reflects the current `status`.
Adjustments []V3OrderAdjustment `json:"adjustments,omitempty"`
// Human-readable error from the PSP (e.g. rejection reason) when `status` is `FAILED`. Null otherwise.
Error *string `json:"error,omitempty"`
}
func (v V3Order) MarshalJSON() ([]byte, error) {
return utils.MarshalJSON(v, "", false)
}
func (v *V3Order) UnmarshalJSON(data []byte) error {
if err := utils.UnmarshalJSON(data, &v, "", false, false); err != nil {
return err
}
return nil
}
func (o *V3Order) GetID() string {
if o == nil {
return ""
}
return o.ID
}
func (o *V3Order) GetConnectorID() string {
if o == nil {
return ""
}
return o.ConnectorID
}
func (o *V3Order) GetProvider() string {
if o == nil {
return ""
}
return o.Provider
}
func (o *V3Order) GetReference() string {
if o == nil {
return ""
}
return o.Reference
}
func (o *V3Order) GetClientOrderID() *string {
if o == nil {
return nil
}
return o.ClientOrderID
}
func (o *V3Order) GetCreatedAt() time.Time {
if o == nil {
return time.Time{}
}
return o.CreatedAt
}
func (o *V3Order) GetUpdatedAt() time.Time {
if o == nil {
return time.Time{}
}
return o.UpdatedAt
}
func (o *V3Order) GetDirection() V3OrderDirectionEnum {
if o == nil {
return V3OrderDirectionEnum("")
}
return o.Direction
}
func (o *V3Order) GetSourceAsset() string {
if o == nil {
return ""
}
return o.SourceAsset
}
func (o *V3Order) GetDestinationAsset() string {
if o == nil {
return ""
}
return o.DestinationAsset
}
func (o *V3Order) GetType() V3OrderTypeEnum {
if o == nil {
return V3OrderTypeEnum("")
}
return o.Type
}
func (o *V3Order) GetStatus() V3OrderStatusEnum {
if o == nil {
return V3OrderStatusEnum("")
}
return o.Status
}
func (o *V3Order) GetBaseQuantityOrdered() *big.Int {
if o == nil {
return big.NewInt(0)
}
return o.BaseQuantityOrdered
}
func (o *V3Order) GetBaseQuantityFilled() *big.Int {
if o == nil {
return nil
}
return o.BaseQuantityFilled
}
func (o *V3Order) GetLimitPrice() *big.Int {
if o == nil {
return nil
}
return o.LimitPrice
}
func (o *V3Order) GetStopPrice() *big.Int {
if o == nil {
return nil
}
return o.StopPrice
}
func (o *V3Order) GetTimeInForce() V3TimeInForceEnum {
if o == nil {
return V3TimeInForceEnum("")
}
return o.TimeInForce
}
func (o *V3Order) GetExpiresAt() *time.Time {
if o == nil {
return nil
}
return o.ExpiresAt
}
func (o *V3Order) GetFee() *big.Int {
if o == nil {
return nil
}
return o.Fee
}
func (o *V3Order) GetFeeAsset() *string {
if o == nil {
return nil
}
return o.FeeAsset
}
func (o *V3Order) GetAverageFillPrice() *big.Int {
if o == nil {
return nil
}
return o.AverageFillPrice
}
func (o *V3Order) GetQuoteAmount() *big.Int {
if o == nil {
return nil
}
return o.QuoteAmount
}
func (o *V3Order) GetQuoteAsset() *string {
if o == nil {
return nil
}
return o.QuoteAsset
}
func (o *V3Order) GetPriceAsset() *string {
if o == nil {
return nil
}
return o.PriceAsset
}
func (o *V3Order) GetSourceAccountID() *string {
if o == nil {
return nil
}
return o.SourceAccountID
}
func (o *V3Order) GetDestinationAccountID() *string {
if o == nil {
return nil
}
return o.DestinationAccountID
}
func (o *V3Order) GetMetadata() map[string]string {
if o == nil {
return nil
}
return o.Metadata
}
func (o *V3Order) GetAdjustments() []V3OrderAdjustment {
if o == nil {
return nil
}
return o.Adjustments
}
func (o *V3Order) GetError() *string {
if o == nil {
return nil
}
return o.Error
}