import { Model, InferAttributes, InferCreationAttributes, CreationOptional, NonAttribute, ModelStatic } from "vr-migrations"; import type { User } from "./user.models"; import type { DevicePaymentPlan } from "./devicePaymentPlan.models"; import type { Installment } from "./installment.models"; import type { IdempotencyRecord } from "./idempotencyRecord.models"; export type PaymentProvider = "AIRTEL_MONEY" | "CASH" | "MOMO_PAY"; export type PaymentStatus = "PENDING" | "SUCCESSFUL" | "FAILED" | "REFUNDED"; export declare const PAYMENT_PROVIDER: readonly ["AIRTEL_MONEY", "CASH", "MOMO_PAY"]; export declare const PAYMENT_STATUS: readonly ["PENDING", "SUCCESSFUL", "FAILED", "REFUNDED"]; export interface PaymentAttributes { id: string; userId: string; devicePaymentPlanId: string | null; installmentId: string | null; idempotencyKeyId: string | null; amount: number; currency: string; provider: PaymentProvider; providerReference: string | null; status: PaymentStatus; customerPhone: string; customerName: string | null; failureReason: string | null; metadata: Record; settledAt: Date | null; createdAt: Date; updatedAt: Date; user?: User; devicePaymentPlan?: DevicePaymentPlan; installment?: Installment; idempotencyKey?: IdempotencyRecord; } export interface PaymentCreationAttributes extends Omit { id?: string; status?: PaymentStatus; providerReference?: string | null; failureReason?: string | null; settledAt?: Date | null; metadata?: Record; } export declare class Payment extends Model, InferCreationAttributes> implements PaymentAttributes { id: CreationOptional; userId: string; devicePaymentPlanId: CreationOptional; installmentId: CreationOptional; idempotencyKeyId: CreationOptional; amount: number; currency: string; provider: PaymentProvider; providerReference: CreationOptional; status: PaymentStatus; customerPhone: string; customerName: CreationOptional; failureReason: CreationOptional; metadata: CreationOptional>; settledAt: CreationOptional; readonly createdAt: CreationOptional; readonly updatedAt: CreationOptional; user?: NonAttribute; devicePaymentPlan?: NonAttribute; installment?: NonAttribute; idempotencyKey?: NonAttribute; static initialize(sequelize: any): void; static associate(models: Record>): void; markAsSuccessful(providerReference: string, metadata?: Record): Promise; markAsFailed(reason: string, metadata?: Record): Promise; markAsRefunded(metadata?: Record): Promise; markAsSettled(settledAt?: Date): Promise; isSuccessful(): boolean; isPending(): boolean; isFailed(): boolean; isRefunded(): boolean; getFormattedAmount(): string; getTargetType(): "payment_plan" | "installment"; getTargetId(): string; static getUserPayments(userId: string, limit?: number): Promise; static getPlanPayments(planId: string): Promise; static getInstallmentPayments(installmentId: string): Promise; static getPendingPayments(): Promise; } export type PaymentModel = typeof Payment;