Add refund order
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
package response
|
||||
|
||||
import (
|
||||
"enaklo-pos-be/internal/entity"
|
||||
"time"
|
||||
)
|
||||
|
||||
type CashierSessionResponse struct {
|
||||
ID int64 `json:"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,
|
||||
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,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package response
|
||||
|
||||
import "enaklo-pos-be/internal/entity"
|
||||
|
||||
type CategoryResponse struct {
|
||||
ID int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
PartnerID int64 `json:"partner_id"`
|
||||
}
|
||||
|
||||
func MapToCategoryResponse(cat *entity.Category) *CategoryResponse {
|
||||
if cat == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return &CategoryResponse{
|
||||
ID: cat.ID,
|
||||
Name: cat.Name,
|
||||
PartnerID: cat.PartnerID,
|
||||
}
|
||||
}
|
||||
|
||||
func MapToCategoryListResponse(cats []*entity.Category) []*CategoryResponse {
|
||||
result := make([]*CategoryResponse, len(cats))
|
||||
for i, c := range cats {
|
||||
result[i] = MapToCategoryResponse(c)
|
||||
}
|
||||
return result
|
||||
}
|
||||
@@ -1,13 +1,19 @@
|
||||
package response
|
||||
|
||||
type Product struct {
|
||||
ID int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
Price float64 `json:"price"`
|
||||
Status string `json:"status"`
|
||||
Description string `json:"description"`
|
||||
Image string `json:"image"`
|
||||
ID int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
Price float64 `json:"price"`
|
||||
Status string `json:"status"`
|
||||
Description string `json:"description"`
|
||||
Image string `json:"image"`
|
||||
Category Category `json:"category"`
|
||||
}
|
||||
|
||||
type Category struct {
|
||||
ID int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type ProductList struct {
|
||||
|
||||
Reference in New Issue
Block a user