Files
meezi/src/Meezi.API/Models/Orders/OrderDtos.cs
T
soroush.asadi c47922414a
CI/CD / CI · API (dotnet build + test) (push) Successful in 51s
CI/CD / CI · Admin API (dotnet build) (push) Successful in 31s
CI/CD / CI · Dashboard (tsc) (push) Failing after 1m12s
CI/CD / CI · Admin Web (tsc) (push) Successful in 40s
CI/CD / CI · Website (tsc) (push) Successful in 46s
CI/CD / CI · Koja (tsc) (push) Successful in 51s
CI/CD / Deploy · all services (push) Has been skipped
feat: اصلاح سند payment corrections + audit-log & daily P&L views
Backend:
- POST /orders/{id}/payments/corrections (Manager/Owner): void wrong
  payments (marked Refunded, never deleted) and/or record replacements
  atomically; mandatory reason; requires an open register shift; full
  before/after written to the immutable audit trail.
- GET /orders/closed?date= — closed orders of one Iran-calendar day,
  paged, the browsing surface for corrections.
- CalculateExpectedCash now subtracts cash refunds so corrections keep
  the drawer expectation honest.

Dashboard (reports screen now has three tabs):
- عملکرد و سود: existing KPIs/charts + new day-by-day breakdown table
  (orders, revenue, expenses, net profit per Jalali day).
- اصلاح سند: closed-orders browser with payment chips + correction
  dialog (void checkboxes, replacement rows, live balance, reason).
- گزارش عملیات: filterable audit-log viewer (category, Jalali range,
  branch) with expandable structured details.

fa/en/ar translations included. 86 backend tests pass; dashboard tsc clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 01:24:19 +03:30

96 lines
2.6 KiB
C#

using Meezi.Core.Enums;
namespace Meezi.API.Models.Orders;
public record OrderItemDto(
string Id,
string MenuItemId,
string MenuItemName,
int Quantity,
decimal UnitPrice,
string? Notes,
bool IsVoided = false,
DateTime? VoidedAt = null);
public record TransferTableRequest(string TargetTableId);
public record OrderDto(
string Id,
string CafeId,
string? BranchId,
string? TableId,
string? TableNumber,
string? GuestName,
string? GuestPhone,
string? CustomerName,
string? CustomerPhone,
string? CustomerId,
string? EmployeeId,
OrderType OrderType,
OrderSource Source,
OrderStatus Status,
decimal Subtotal,
decimal TaxTotal,
decimal DiscountAmount,
decimal Total,
decimal PaidAmount,
DateTime CreatedAt,
int DisplayNumber,
IReadOnlyList<OrderItemDto> Items,
IReadOnlyList<PaymentDto> Payments);
public record AppendOrderItemsRequest(IReadOnlyList<CreateOrderItemRequest> Items);
public record UpdateOrderSessionRequest(
string? GuestName,
string? GuestPhone,
string? CustomerId);
public record CreateOrderItemRequest(string MenuItemId, int Quantity, string? Notes);
public record CreateOrderRequest(
OrderType OrderType,
string? BranchId,
string? TableId,
string? ReservationId,
string? GuestName,
string? GuestPhone,
string? CustomerId,
string? CouponId,
IReadOnlyList<CreateOrderItemRequest> Items);
public record UpdateOrderStatusRequest(OrderStatus Status);
public record CancelOrderRequest(string? Reason);
public record CreatePaymentRequest(PaymentMethod Method, decimal Amount, string? Reference);
public record RecordPaymentsRequest(
IReadOnlyList<CreatePaymentRequest> Payments,
int? LoyaltyPointsToRedeem = null);
/// <summary>
/// اصلاح سند — amend the payments of an order after the fact (wrong method,
/// wrong amount, or payment recorded on the wrong order). Voids the listed
/// payments (marked Refunded, never deleted) and records the replacements in
/// one atomic operation. A reason is mandatory; the whole change is audit-logged.
/// </summary>
public record CorrectPaymentsRequest(
IReadOnlyList<string> VoidPaymentIds,
IReadOnlyList<CreatePaymentRequest> Replacements,
string Reason);
public record PaymentDto(string Id, PaymentMethod Method, decimal Amount, PaymentStatus Status, string? Reference);
public record LiveOrderDto(
string Id,
int DisplayNumber,
OrderStatus Status,
string? TableNumber,
OrderType OrderType,
decimal Total,
DateTime CreatedAt,
IReadOnlyList<OrderItemDto> Items,
OrderSource Source);