feat(F-186): completed feature
This commit is contained in:
@@ -1,6 +1,30 @@
|
||||
export interface PosSaleLineItem {
|
||||
export interface PosStockSaleLineInput {
|
||||
kind?: 'stock';
|
||||
variantId: string;
|
||||
productId: string;
|
||||
quantity: number;
|
||||
discountCents?: number;
|
||||
// Legacy snapshot fields are accepted at the API boundary but ignored.
|
||||
productId?: string;
|
||||
sku?: string;
|
||||
ean?: string | null;
|
||||
name?: string;
|
||||
unitPriceCents?: number;
|
||||
taxCents?: number;
|
||||
}
|
||||
|
||||
export interface PosFreeSaleLineInput {
|
||||
kind: 'free';
|
||||
name: string;
|
||||
unitPriceCents: number;
|
||||
quantity: number;
|
||||
}
|
||||
|
||||
export type PosSaleLineInput = PosStockSaleLineInput | PosFreeSaleLineInput;
|
||||
|
||||
export interface PosSaleLineItem {
|
||||
kind: 'stock' | 'free';
|
||||
variantId: string | null;
|
||||
productId: string | null;
|
||||
sku: string;
|
||||
ean: string | null;
|
||||
name: string;
|
||||
@@ -8,12 +32,16 @@ export interface PosSaleLineItem {
|
||||
discountCents: number;
|
||||
taxCents: number;
|
||||
quantity: number;
|
||||
vatRate: string | null;
|
||||
}
|
||||
|
||||
export type PosPaymentKind = 'cash' | 'card' | 'other';
|
||||
|
||||
export interface PosPaymentInput {
|
||||
kind: PosPaymentKind;
|
||||
/** Configured payment method code. */
|
||||
methodCode?: string;
|
||||
/** Legacy field; used only to resolve cash/card defaults. */
|
||||
kind?: PosPaymentKind;
|
||||
amountCents: number;
|
||||
/** For cash payments: actual amount given by customer. */
|
||||
tenderedCents?: number;
|
||||
@@ -26,23 +54,71 @@ export interface PosSaleInput {
|
||||
cashSessionId: string;
|
||||
terminalId: string;
|
||||
userId: string;
|
||||
items: PosSaleLineItem[];
|
||||
items: PosSaleLineInput[];
|
||||
payments: PosPaymentInput[];
|
||||
/** Optional customer ID for loyalty. */
|
||||
customerId?: string;
|
||||
}
|
||||
|
||||
export interface PosReceiptItem {
|
||||
name: string;
|
||||
sku: string;
|
||||
quantity: number;
|
||||
unitPriceCents: number;
|
||||
subtotalCents: number;
|
||||
discountCents: number;
|
||||
taxCents: number;
|
||||
totalCents: number;
|
||||
freeItem: boolean;
|
||||
}
|
||||
|
||||
export interface PosReceiptPayment {
|
||||
methodCode: string;
|
||||
methodLabel: string;
|
||||
kind: PosPaymentKind;
|
||||
amountCents: number;
|
||||
tenderedCents: number | null;
|
||||
changeCents: number;
|
||||
}
|
||||
|
||||
export interface PosReceipt {
|
||||
receiptNumber: string;
|
||||
orderId: string;
|
||||
issuedAt: Date;
|
||||
company: {
|
||||
name: string;
|
||||
address: string | null;
|
||||
taxId: string | null;
|
||||
email: string | null;
|
||||
phone: string | null;
|
||||
};
|
||||
terminal: { id: string; name: string };
|
||||
cashier: string;
|
||||
sessionId: string;
|
||||
customerEmail: string | null;
|
||||
items: PosReceiptItem[];
|
||||
subtotalCents: number;
|
||||
discountCents: number;
|
||||
taxCents: number;
|
||||
totalCents: number;
|
||||
payments: PosReceiptPayment[];
|
||||
changeCents: number;
|
||||
header: string | null;
|
||||
returnPolicy: string;
|
||||
footer: string | null;
|
||||
}
|
||||
|
||||
export interface PosSaleResult {
|
||||
orderId: string;
|
||||
idempotencyKey: string;
|
||||
receiptNumber: string;
|
||||
totalCents: number;
|
||||
changeCents: number;
|
||||
items: PosSaleLineItem[];
|
||||
payments: PosPaymentResult[];
|
||||
receipt: PosReceipt;
|
||||
createdAt: Date;
|
||||
}
|
||||
|
||||
export interface PosPaymentResult {
|
||||
export interface PosPaymentResult extends PosReceiptPayment {
|
||||
id: string;
|
||||
kind: PosPaymentKind;
|
||||
amountCents: number;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user