restucturization of recipients payment methods
All checks were successful
ci/woodpecker/push/billing_fees Pipeline was successful
ci/woodpecker/push/bff Pipeline was successful
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/chain_gateway Pipeline was successful
ci/woodpecker/push/fx_ingestor Pipeline was successful
ci/woodpecker/push/fx_oracle Pipeline was successful
ci/woodpecker/push/frontend Pipeline was successful
ci/woodpecker/push/nats Pipeline was successful
ci/woodpecker/push/ledger Pipeline was successful
ci/woodpecker/push/notification Pipeline was successful
ci/woodpecker/push/payments_orchestrator Pipeline was successful
All checks were successful
ci/woodpecker/push/billing_fees Pipeline was successful
ci/woodpecker/push/bff Pipeline was successful
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/chain_gateway Pipeline was successful
ci/woodpecker/push/fx_ingestor Pipeline was successful
ci/woodpecker/push/fx_oracle Pipeline was successful
ci/woodpecker/push/frontend Pipeline was successful
ci/woodpecker/push/nats Pipeline was successful
ci/woodpecker/push/ledger Pipeline was successful
ci/woodpecker/push/notification Pipeline was successful
ci/woodpecker/push/payments_orchestrator Pipeline was successful
This commit is contained in:
54
api/gateway/chain/storage/model/deposit.go
Normal file
54
api/gateway/chain/storage/model/deposit.go
Normal file
@@ -0,0 +1,54 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/tech/sendico/pkg/db/storable"
|
||||
"github.com/tech/sendico/pkg/mservice"
|
||||
moneyv1 "github.com/tech/sendico/pkg/proto/common/money/v1"
|
||||
)
|
||||
|
||||
type DepositStatus string
|
||||
|
||||
const (
|
||||
DepositStatusPending DepositStatus = "pending"
|
||||
DepositStatusConfirmed DepositStatus = "confirmed"
|
||||
DepositStatusFailed DepositStatus = "failed"
|
||||
)
|
||||
|
||||
// Deposit records an inbound transfer observed on-chain.
|
||||
type Deposit struct {
|
||||
storable.Base `bson:",inline" json:",inline"`
|
||||
|
||||
DepositRef string `bson:"depositRef" json:"depositRef"`
|
||||
WalletRef string `bson:"walletRef" json:"walletRef"`
|
||||
Network string `bson:"network" json:"network"`
|
||||
TokenSymbol string `bson:"tokenSymbol" json:"tokenSymbol"`
|
||||
ContractAddress string `bson:"contractAddress" json:"contractAddress"`
|
||||
Amount *moneyv1.Money `bson:"amount" json:"amount"`
|
||||
SourceAddress string `bson:"sourceAddress" json:"sourceAddress"`
|
||||
TxHash string `bson:"txHash" json:"txHash"`
|
||||
BlockID string `bson:"blockId,omitempty" json:"blockId,omitempty"`
|
||||
Status DepositStatus `bson:"status" json:"status"`
|
||||
ObservedAt time.Time `bson:"observedAt" json:"observedAt"`
|
||||
RecordedAt time.Time `bson:"recordedAt" json:"recordedAt"`
|
||||
LastStatusAt time.Time `bson:"lastStatusAt" json:"lastStatusAt"`
|
||||
}
|
||||
|
||||
// Collection implements storable.Storable.
|
||||
func (*Deposit) Collection() string {
|
||||
return mservice.ChainDeposits
|
||||
}
|
||||
|
||||
// Normalize standardizes case-sensitive fields.
|
||||
func (d *Deposit) Normalize() {
|
||||
d.DepositRef = strings.TrimSpace(d.DepositRef)
|
||||
d.WalletRef = strings.TrimSpace(d.WalletRef)
|
||||
d.Network = strings.TrimSpace(strings.ToLower(d.Network))
|
||||
d.TokenSymbol = strings.TrimSpace(strings.ToUpper(d.TokenSymbol))
|
||||
d.ContractAddress = strings.TrimSpace(strings.ToLower(d.ContractAddress))
|
||||
d.SourceAddress = strings.TrimSpace(strings.ToLower(d.SourceAddress))
|
||||
d.TxHash = strings.TrimSpace(strings.ToLower(d.TxHash))
|
||||
d.BlockID = strings.TrimSpace(d.BlockID)
|
||||
}
|
||||
Reference in New Issue
Block a user