package response import ( "enaklo-pos-be/internal/entity" "time" ) type CashierSessionResponse struct { ID int64 `json:"id"` PartnerID int64 `json:"partner_id"` CashierID int64 `json:"cashier_id"` OpenedAt time.Time `json:"opened_at"` ClosedAt *time.Time `json:"closed_at,omitempty"` OpeningAmount float64 `json:"opening_amount"` ClosingAmount *float64 `json:"closing_amount,omitempty"` Status string `json:"status"` } type PaymentSummaryResponse struct { PaymentType string `json:"payment_type"` PaymentProvider string `json:"payment_provider"` TotalAmount float64 `json:"total_amount"` } type CashierSessionReportResponse struct { SessionID int64 `json:"session_id"` ExpectedAmount float64 `json:"expected_amount"` ClosingAmount float64 `json:"closing_amount"` Payments []PaymentSummaryResponse `json:"payments"` } func MapToCashierSessionResponse(e *entity.CashierSession) *CashierSessionResponse { if e == nil { return nil } return &CashierSessionResponse{ ID: e.ID, PartnerID: e.PartnerID, CashierID: e.CashierID, OpenedAt: e.OpenedAt, ClosedAt: e.ClosedAt, OpeningAmount: e.OpeningAmount, ClosingAmount: e.ClosingAmount, Status: e.Status, } } func MapToCashierSessionReport(e *entity.CashierSessionReport) *CashierSessionReportResponse { payments := make([]PaymentSummaryResponse, len(e.Payments)) for i, p := range e.Payments { payments[i] = PaymentSummaryResponse{ PaymentType: p.PaymentType, PaymentProvider: p.PaymentProvider, TotalAmount: p.TotalAmount, } } return &CashierSessionReportResponse{ SessionID: e.SessionID, ExpectedAmount: e.ExpectedAmount, ClosingAmount: e.ClosingAmount, Payments: payments, } }