Files
Client_Fe/src/lib/models/subscription.ts
T
Dhananjaya99 a1b870fa8a first commit
2026-09-28 11:48:14 +05:30

117 lines
2.9 KiB
TypeScript

export type PaymentStatus = "Pending" | "Partial" | "Paid"
export interface SubscriptionMemberInfo {
subscriptionMemberId: string
customerId: string
cusName?: string | null
email?: string | null
primaryPH?: string | null
isPrimary: boolean
joinedAt: string
isActive: boolean
/** False when unassigned from the plan but still a member of the gym. */
isPlanAssigned?: boolean
}
export interface SubscriptionInstallment {
subscriptionInstallmentId: string
installmentNo: number
dueDate: string
amount: number
paidAmount: number
status: PaymentStatus
}
export interface AutoChargeCard {
cardId: string
cardLast4?: string | null
cardType?: string | null
}
export interface MemberCard {
jobId: string
cardId?: string | null
cardNumber?: string | null
cardType?: string | null
nickName?: string | null
isPrimary: boolean
consentGiven: boolean
}
/** GET client/subscriptions/{id}. */
export interface SubscriptionSummary {
subscriptionId: string
customerPlanId: string
planName?: string | null
planScope: "Individual" | "Group"
memberLimit: number
durationMode: "Rolling" | "FixedRange"
allowSplitPayments: boolean
planPrice: number
onboardDate: string
/** Frozen at creation, never changes again -- see renewalDate for the current cycle end. */
expiryDate?: string | null
renewalDate?: string | null
isActive: boolean
customerInvoiceId?: string | null
invoiceAmount: number
paidAmount: number
balance: number
paymentStatus: PaymentStatus
members: SubscriptionMemberInfo[]
installments: SubscriptionInstallment[]
autoChargeEnabled: boolean
autoChargeCard?: AutoChargeCard | null
}
export interface SubscriptionPayment {
attemptId: string
payDate?: string | null
payStatus: string
payAmount: number
payNote?: string | null
refType?: string | null
paymentMethod?: "Cash" | "Bank" | null
bankRefNo?: string | null
isApproved?: boolean | null
}
/** GET client/subscriptions/{id}/payments. */
export interface SubscriptionPaymentsResult {
invoiceId?: string | null
invoiceAmount: number
paidAmount: number
balance: number
status: PaymentStatus
installments: SubscriptionInstallment[]
payments: SubscriptionPayment[]
}
export interface RecordPaymentInput {
amount: number
note?: string
paymentMethod: "Cash" | "Bank"
/** Reference/slip number — only meaningful (and sent) when paymentMethod is "Bank". */
bankRefNo?: string
}
export type ExtraFeeFrequency = "OneTime" | "Recurring"
/** Mirrors CustomerSubItemDto — an optional extra fee on a subscription (e.g. coaching fee). */
export interface SubscriptionExtraFee {
customerSubItemId: string
subItemName?: string | null
subItemDescription?: string | null
subItemPrice: number
frequency: ExtraFeeFrequency
isActive: boolean
createdAt: string
}
export interface AddExtraFeeInput {
name: string
description?: string
amount: number
frequency: ExtraFeeFrequency
}