47 lines
1.8 KiB
Go
47 lines
1.8 KiB
Go
package models
|
|||
|
|
|
||
|
|
import (
|
||
|
|
"time"
|
||
|
|
|
||
|
|
"github.com/google/uuid"
|
||
|
|
)
|
||
|
|
|
||
|
|
// AdminWalletTrace is GET /marketing/wallet-transactions/:id/trace
|
||
|
|
// (docs/prd-point-coin.md F7, ยง8.1): the lots a ledger row took from or created, and
|
||
|
|
// where each of them came from, lot by lot, back to the lot that first brought the
|
||
|
|
// balance into a wallet. It follows balance across transfers, exchanges and refunds.
|
||
|
|
type AdminWalletTrace struct {
|
||
|
|
Transaction AdminWalletTraceRow `json:"transaction"`
|
||
|
|
// One per lot the row took from (a debit) or created (a credit).
|
||
|
|
Lots []AdminWalletTraceLot `json:"lots"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// AdminWalletTraceLot is how much of a row went through one lot, and that lot's chain.
|
||
|
|
type AdminWalletTraceLot struct {
|
||
|
|
Amount int64 `json:"amount"`
|
||
|
|
// The lot itself first, then the lot it was carried over from, and so on. The
|
||
|
|
// last step is the lot an EARN, ADJUSTMENT or MIGRATION created.
|
||
|
|
Chain []AdminWalletTraceStep `json:"chain"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// AdminWalletTraceStep is one lot on a chain and the row that created it.
|
||
|
|
type AdminWalletTraceStep struct {
|
||
|
|
Lot AdminWalletLot `json:"lot"`
|
||
|
|
Source AdminWalletTraceRow `json:"source"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// AdminWalletTraceRow is a ledger row as a trace shows it, with the real name of the
|
||
|
|
// customer it belongs to.
|
||
|
|
type AdminWalletTraceRow struct {
|
||
|
|
ID uuid.UUID `json:"id"`
|
||
|
|
Customer AdminWalletNamedRef `json:"customer"`
|
||
|
|
Currency string `json:"currency"`
|
||
|
|
Type string `json:"type"`
|
||
|
|
Amount int64 `json:"amount"`
|
||
|
|
Description string `json:"description"`
|
||
|
|
ReferenceType string `json:"reference_type"`
|
||
|
|
ReferenceID uuid.UUID `json:"reference_id"`
|
||
|
|
OutletID *uuid.UUID `json:"outlet_id,omitempty"`
|
||
|
|
CreatedAt time.Time `json:"created_at"`
|
||
|
|
}
|