Yimaru-BackEnd/internal/domain/shop_deposit.go

79 lines
2.1 KiB
Go

package domain
import (
"time"
)
type ShopDeposit struct {
ID int64
ShopTransactionID int64
CustomerID int64
WalletTransferID ValidInt64
BranchWalletID int64
}
type CreateShopDeposit struct {
ShopTransactionID int64
CustomerID int64
BranchWalletID int64
}
type ShopDepositFilter struct {
CompanyID ValidInt64
BranchID ValidInt64
Query ValidString
CreatedBefore ValidTime
CreatedAfter ValidTime
}
type ShopDepositDetail struct {
ID int64
ShopTransactionID int64
CustomerID int64
BranchWalletID int64
WalletTransferID ValidInt64
FullName string
PhoneNumber string
Amount Currency
BranchID int64
CompanyID int64
TransactionVerified bool
UpdatedAt time.Time
CreatedAt time.Time
}
type ShopDepositReq struct {
CustomerID int64 `json:"customer_id" example:"1"`
Amount float32 `json:"amount" example:"100.0"`
PaymentOption PaymentOption `json:"payment_option" example:"1"`
// FullName string `json:"full_name" example:"John Smith"`
// PhoneNumber string `json:"phone_number" example:"0911111111"`
BankCode string `json:"bank_code"`
BeneficiaryName string `json:"beneficiary_name"`
AccountName string `json:"account_name"`
AccountNumber string `json:"account_number"`
ReferenceNumber string `json:"reference_number"`
BranchID *int64 `json:"branch_id,omitempty" example:"1"`
}
type ShopDepositRes struct {
ID int64 `json:"id"`
ShopTransactionID int64 `json:"shop_transaction_id"`
CustomerID int64 `json:"customer_id"`
WalletTransferID *int64 `json:"wallet_transfer_id,omitempty"`
}
func ConvertShopDeposit(shopDeposit ShopDeposit) ShopDepositRes {
res := ShopDepositRes{
ID: shopDeposit.ID,
ShopTransactionID: shopDeposit.ShopTransactionID,
CustomerID: shopDeposit.CustomerID,
}
if shopDeposit.WalletTransferID.Valid {
res.WalletTransferID = &shopDeposit.WalletTransferID.Value
}
return res
}