import { OrderInvoice, OrderItem, OrderDiscount } from "./order"; import { ReceiptStatusType, PaymentServiceProvider, PaymentType } from "../enums"; import { InvoiceConfig } from "./invoice-config"; import { Customer } from "./customer"; import { Operator } from "./store"; import { OnlinePlatformType } from './online-integration'; export interface Receipt { id: string; /** Copy `invoiceConfig` from `Store` */ invoiceConfig: InvoiceConfig; /** Copy `displayId` from `Store` */ storeDisplayId?: string; /** * 有值代表「線上訂單 & 線上付款」。 * 若是「線上訂單 & 線上付款」,會走線上取消訂單並退款流程。 * 若是「現場付款」,則會走現場退款流程。 */ onlinePlatformType?: OnlinePlatformType; /** 外部線上點餐平台訂單ID */ onlinePlatformOrderId?: string; status: ReceiptStatusType; issuedAt: number; voidedAt: number; orderId: string; customerId?: string; customer?: Customer; items: OrderItem[]; discount?: OrderDiscount; salesAmountExcludeTax: number; exemptTaxSalesAmount: number; zeroTaxSalesAmount: number; taxAmount: number; /** sigma(items.amount) */ subtotal: number; /** subtotal - sigma(discount.discountReferences.orderItemId === null) */ totalAmount: number; payment: Transaction; refund?: Transaction; invoice?: OrderInvoice; /** 主要為顯示用 */ posSerialNumber?: string; /** 混合支付細項 */ mixPayments?: Transaction[]; mixRefunds?: Transaction[]; /** 結帳備註,會印在收據上且上傳發票雲 */ note?: string; } export interface Transaction { accountId: string; paymentServiceProvider: PaymentServiceProvider; paymentType: PaymentType; customName?: string; /** Transaction ID provided by third party payment vendor after payment. */ transactionId: string; /** PaidAt provided by third party payment vendor after payment. */ timestamp: number; cardBrand?: string; maskedCardNo?: string; terminalId?: string; merchantId?: string; /** Used to record the payment results provided by third-party payment vendor */ detail: any; operator?: Operator; note?: string; /** for sub transaction only (parent is mix) */ amount?: number; cashActualAmount?: number; cashReturnAmount?: number; }