108 lines
3.7 KiB
Go
108 lines
3.7 KiB
Go
package domain
|
|
|
|
import "time"
|
|
|
|
type TransferType string
|
|
|
|
const (
|
|
DEPOSIT TransferType = "deposit"
|
|
WITHDRAW TransferType = "withdraw"
|
|
WALLET TransferType = "wallet"
|
|
)
|
|
|
|
type PaymentMethod string
|
|
|
|
// Info on why the wallet was modified
|
|
// If its internal system modification then, its always direct
|
|
const (
|
|
TRANSFER_DIRECT PaymentMethod = "direct"
|
|
TRANSFER_CASH PaymentMethod = "cash"
|
|
TRANSFER_BANK PaymentMethod = "bank"
|
|
TRANSFER_CHAPA PaymentMethod = "chapa"
|
|
TRANSFER_ARIFPAY PaymentMethod = "arifpay"
|
|
TRANSFER_SANTIMPAY PaymentMethod = "santimpay"
|
|
TRANSFER_ADDISPAY PaymentMethod = "addispay"
|
|
TRANSFER_OTHER PaymentMethod = "other"
|
|
)
|
|
|
|
type TransactionApproval struct {
|
|
ID int64
|
|
TransferID int64
|
|
ApprovedBy int64 // User ID of approver
|
|
Status string // "pending", "approved", "rejected"
|
|
Comments string
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
}
|
|
|
|
type ApprovalAction string
|
|
|
|
const (
|
|
ApprovalActionApprove ApprovalAction = "approve"
|
|
ApprovalActionReject ApprovalAction = "reject"
|
|
)
|
|
|
|
type ApprovalRequest struct {
|
|
TransferID int64
|
|
Action ApprovalAction
|
|
Comments string
|
|
ApproverID int64
|
|
}
|
|
|
|
// Info for the payment providers
|
|
type PaymentDetails struct {
|
|
ReferenceNumber ValidString
|
|
BankNumber ValidString
|
|
}
|
|
|
|
// A Transfer is logged for every modification of ALL wallets and wallet types
|
|
type Transfer struct {
|
|
ID int64 `json:"id"`
|
|
Amount Currency `json:"amount"`
|
|
Verified bool `json:"verified"`
|
|
Message string `json:"message"`
|
|
Type TransferType `json:"type"`
|
|
PaymentMethod PaymentMethod `json:"payment_method"`
|
|
ReceiverWalletID ValidInt64 `json:"receiver_wallet_id"`
|
|
SenderWalletID ValidInt64 `json:"sender_wallet_id"`
|
|
ReferenceNumber string `json:"reference_number"` // <-- needed
|
|
SessionID string `json:"session_id"`
|
|
Status string `json:"status"`
|
|
DepositorID ValidInt64 `json:"depositor_id"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
type TransferDetail struct {
|
|
ID int64 `json:"id"`
|
|
Amount Currency `json:"amount"`
|
|
Verified bool `json:"verified"`
|
|
Message string `json:"message"`
|
|
Type TransferType `json:"type"`
|
|
PaymentMethod PaymentMethod `json:"payment_method"`
|
|
ReceiverWalletID ValidInt64 `json:"receiver_wallet_id"`
|
|
SenderWalletID ValidInt64 `json:"sender_wallet_id"`
|
|
ReferenceNumber string `json:"reference_number"` // <-- needed
|
|
SessionID string `json:"session_id"`
|
|
Status string `json:"status"`
|
|
DepositorID ValidInt64 `json:"depositor_id"`
|
|
DepositorFirstName string `json:"depositor_first_name"`
|
|
DepositorLastName string `json:"depositor_last_name"`
|
|
DepositorPhoneNumber string `json:"depositor_phone_number"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type CreateTransfer struct {
|
|
Amount Currency `json:"amount"`
|
|
Verified bool `json:"verified"`
|
|
Message string `json:"message"`
|
|
Type TransferType `json:"type"`
|
|
PaymentMethod PaymentMethod `json:"payment_method"`
|
|
ReceiverWalletID ValidInt64 `json:"receiver_wallet_id"`
|
|
SenderWalletID ValidInt64 `json:"sender_wallet_id"`
|
|
ReferenceNumber string `json:"reference_number"` // <-- needed
|
|
SessionID string `json:"session_id"`
|
|
Status string `json:"status"`
|
|
CashierID ValidInt64 `json:"cashier_id"`
|
|
}
|