146 lines
3.5 KiB
Go
146 lines
3.5 KiB
Go
package domain
|
|
|
|
import (
|
|
"errors"
|
|
"time"
|
|
)
|
|
|
|
var (
|
|
ErrWalletIDDuplicate = errors.New("there already exists user id with wallet_type")
|
|
)
|
|
|
|
type Wallet struct {
|
|
ID int64
|
|
Balance Currency
|
|
Currency IntCurrency
|
|
IsWithdraw bool
|
|
IsBettable bool
|
|
IsTransferable bool
|
|
IsActive bool
|
|
UserID int64
|
|
Type WalletType
|
|
UpdatedAt time.Time
|
|
CreatedAt time.Time
|
|
}
|
|
|
|
type WalletFilter struct {
|
|
IsActive ValidBool
|
|
Query ValidString
|
|
CreatedBefore ValidTime
|
|
CreatedAfter ValidTime
|
|
}
|
|
|
|
type CustomerWallet struct {
|
|
ID int64
|
|
RegularID int64
|
|
StaticID int64
|
|
CustomerID int64
|
|
}
|
|
type GetCustomerWallet struct {
|
|
ID int64
|
|
RegularID int64
|
|
RegularBalance Currency
|
|
StaticID int64
|
|
StaticBalance Currency
|
|
CustomerID int64
|
|
RegularIsActive bool
|
|
StaticIsActive bool
|
|
RegularUpdatedAt time.Time
|
|
StaticUpdatedAt time.Time
|
|
CreatedAt time.Time
|
|
FirstName string
|
|
LastName string
|
|
PhoneNumber string
|
|
}
|
|
|
|
type BranchWallet struct {
|
|
ID int64
|
|
Balance Currency
|
|
IsActive bool
|
|
Name string
|
|
Location string
|
|
BranchManagerID int64
|
|
CompanyID int64
|
|
IsSelfOwned bool
|
|
UpdatedAt time.Time
|
|
CreatedAt time.Time
|
|
}
|
|
|
|
type CreateWallet struct {
|
|
IsWithdraw bool
|
|
IsBettable bool
|
|
IsTransferable bool
|
|
UserID int64
|
|
Type WalletType
|
|
}
|
|
|
|
type CreateCustomerWallet struct {
|
|
CustomerID int64
|
|
RegularWalletID int64
|
|
StaticWalletID int64
|
|
}
|
|
|
|
type WalletType string
|
|
|
|
const (
|
|
RegularWalletType WalletType = "regular_wallet"
|
|
StaticWalletType WalletType = "static_wallet"
|
|
BranchWalletType WalletType = "branch_wallet"
|
|
CompanyWalletType WalletType = "company_wallet"
|
|
)
|
|
|
|
// domain/wallet.go
|
|
|
|
type DirectDepositStatus string
|
|
|
|
const (
|
|
DepositStatusPending DirectDepositStatus = "pending"
|
|
DepositStatusCompleted DirectDepositStatus = "completed"
|
|
DepositStatusRejected DirectDepositStatus = "rejected"
|
|
)
|
|
|
|
type DirectDeposit struct {
|
|
ID int64 `json:"id"`
|
|
CustomerID int64 `json:"customer_id"`
|
|
WalletID int64 `json:"wallet_id"`
|
|
Wallet Wallet `json:"wallet"`
|
|
Amount Currency `json:"amount"`
|
|
BankReference string `json:"bank_reference"`
|
|
SenderAccount string `json:"sender_account"`
|
|
Status DirectDepositStatus `json:"status"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
VerifiedBy *int64 `json:"verified_by"`
|
|
VerificationNotes string `json:"verification_notes"`
|
|
VerifiedAt *time.Time `json:"verified_at"`
|
|
}
|
|
|
|
type CreateDirectDeposit struct {
|
|
CustomerID int64
|
|
WalletID int64
|
|
Amount Currency
|
|
BankReference string
|
|
SenderAccount string
|
|
Status DirectDepositStatus
|
|
}
|
|
|
|
type UpdateDirectDeposit struct {
|
|
ID int64
|
|
Status DirectDepositStatus
|
|
VerifiedBy int64
|
|
VerificationNotes string
|
|
VerifiedAt time.Time
|
|
}
|
|
|
|
type DirectDepositRequest struct {
|
|
CustomerID int64 `json:"customer_id" binding:"required"`
|
|
Amount Currency `json:"amount" binding:"required,gt=0"`
|
|
BankReference string `json:"bank_reference" binding:"required"`
|
|
SenderAccount string `json:"sender_account" binding:"required"`
|
|
}
|
|
|
|
type VerifyDirectDepositRequest struct {
|
|
DepositID int64 `json:"deposit_id" binding:"required"`
|
|
IsVerified bool `json:"is_verified" binding:"required"`
|
|
Notes string `json:"notes"`
|
|
}
|