import { Ref } from '@typegoose/typegoose'; import { Business, Restaurant } from '~backend/business/business.interface'; import { Member } from '~backend/marketing/membership/membership.interface'; import { Types } from 'mongoose'; import { PartialBy } from '~backend/utils/object'; export declare enum CreditRefSource { portal = "PORTAL", benefit = "BENEFIT", store = "STORE", order = "ORDER", bill = "BILL", expired = "EXPIRED", cashback = "CASHBACK" } export interface FreeCreditTransaction { _id: Types.ObjectId; amount: number; expiredAt: Date; } export interface CreditBalance { normal: number; free: FreeCreditTransaction[]; } export interface CreditTransaction { id: string; business: Ref; member: Ref; source: CreditRefSource; ref: string; remark?: string; from: CreditBalance; to: CreditBalance; normal: number; free: FreeCreditTransaction[]; createdAt: Date; restaurant?: Ref; refunded: boolean; refundedFrom?: Ref; } export interface ReceiveCreditTransactionDto { business: string; member: string; source: CreditRefSource; ref: string; normal: number; free?: PartialBy[]; remark?: string; restaurant?: Ref; } export interface SpentCreditTransactionDto { business: string; member: string; source: CreditRefSource; ref: string; amount: number; remark?: string; restaurant?: string; } export interface RefundCreditTransactionDto { id: string; source: CreditRefSource; ref: string; remark?: string; restaurant?: string; }