2024-08-04 01:16:25 +07:00

148 lines
5.2 KiB
Go

package response
import (
"furtuna-be/internal/constants/order"
"furtuna-be/internal/constants/transaction"
"time"
)
type Order struct {
ID int64 `json:"id" `
BranchID int64 `json:"branch_id" `
BranchName string `json:"branch_name" `
Amount float64 `json:"amount" `
Status order.OrderStatus `json:"status" `
CustomerName string `json:"customer_name" `
CustomerPhone string `json:"customer_phone" `
Pax int `json:"pax" `
PaymentMethod transaction.PaymentMethod `json:"payment_method" `
OrderItem []OrderItem `json:"order_items" `
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
type OrderAmount struct {
Amount float64 `json:"amount"`
}
type HistoryOrder struct {
ID int64 `json:"id"`
Employee string `json:"employee"`
Site string `json:"site"`
Timestamp string `json:"timestamp"`
BookingTime string `json:"booking_time"`
Tickets []string `json:"tickets"`
PaymentType string `json:"payment_type"`
Status string `json:"status"`
Amount float64 `json:"amount"`
}
type OrderItem struct {
OrderItemID int64 `json:"order_item_id" `
ItemID int64 `json:"item_id" `
ItemType order.ItemType `json:"item_type" `
ItemName string `json:"item_name" `
Price float64 `json:"price" `
Qty int64 `json:"qty" `
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
type OrderList struct {
Orders []Order `json:"orders"`
Total int64 `json:"total"`
Limit int `json:"limit"`
Offset int `json:"offset"`
}
type HistoryOrderList struct {
Orders []HistoryOrder `json:"history_orders"`
Total int64 `json:"total"`
Limit int `json:"limit"`
Offset int `json:"offset"`
}
type TicketSold struct {
Count int64 `json:"count"`
}
type OrderMonthlyRevenue struct {
TotalRevenue float64 `json:"total_revenue"`
TotalTransaction int64 `json:"total_transaction"`
}
type OrderBranchRevenue struct {
BranchID string `json:"branch_id"`
BranchName string `json:"name"`
BranchLocation string `json:"location"`
TotalTransaction int `json:"total_trans"`
TotalAmount float64 `json:"total_amount"`
}
type CreateOrderResponse struct {
ID int64 `json:"id"`
RefID string `json:"ref_id"`
PartnerID int64 `json:"partner_id"`
Status string `json:"status"`
Amount float64 `json:"amount"`
PaymentType string `json:"payment_type"`
CreatedAt time.Time `json:"created_at"`
OrderItems []CreateOrderItemResponse `json:"order_items"`
Token string `json:"token"`
}
type ExecuteOrderResponse struct {
ID int64 `json:"id"`
RefID string `json:"ref_id"`
PartnerID int64 `json:"partner_id"`
Status string `json:"status"`
Amount float64 `json:"amount"`
PaymentType string `json:"payment_type"`
CreatedAt time.Time `json:"created_at"`
OrderItems []CreateOrderItemResponse `json:"order_items"`
PaymentToken string `json:"payment_token"`
RedirectURL string `json:"redirect_url"`
}
type CreateOrderItemResponse struct {
ID int64 `json:"id"`
ItemID int64 `json:"item_id"`
Quantity int64 `json:"quantity"`
Price float64 `json:"price"`
Name string `json:"name"`
}
type ProductDailySales struct {
Day time.Time `json:"day"`
SiteID int64 `json:"site_id"`
SiteName string `json:"site_name"`
PaymentType string `json:"payment_type"`
Total float64 `json:"total"`
}
type PaymentDistribution struct {
PaymentType string `json:"payment_type"`
Count int `json:"count"`
}
type OrderDetail struct {
ID int64 `json:"id"` // Order ID
QRCode string `json:"qr_code"` // QR code data (can be a URL or base64 string)
FullName string `json:"full_name"` // Customer's full name
Email string `json:"email"` // Customer's email address
PhoneNumber string `json:"phone_number"` // Customer's phone number
OrderItems []OrderDetailItem `json:"order_items"` // List of ordered items
TotalAmount float64 `json:"total_amount"` // Total amount paid
CreatedAt time.Time `json:"created_at"` // Order creation time
Status string `json:"status"`
PaymentLink string `json:"payment_link"`
}
type OrderDetailItem struct {
ItemType string `json:"item_type"`
Description string `json:"description"`
Quantity int `json:"quantity"` // Quantity of the item
UnitPrice float64 `json:"unit_price"` // Price per unit
TotalPrice float64 `json:"total_price"` // Total price for this item (Quantity * UnitPrice)
}