import { CreationOptional, DataTypes, InferAttributes, InferCreationAttributes } from 'sequelize'; import type { LiteralUnion } from 'type-fest'; import { TenantModel } from '../tenant-model'; import type { CustomerAddress, CustomerShipping, DiscountAmount, GroupedBN, GroupedStrList, PaymentError, PaymentSettings, SimpleCustomField } from './types'; export declare const nextInvoiceId: (size?: number) => string; export declare class Invoice extends TenantModel, InferCreationAttributes> { id: CreationOptional; number: string; livemode: boolean; instance_did?: string; description?: string; statement_descriptor: string; period_end: number; period_start: number; auto_advance: boolean; paid: boolean; paid_out_of_band: boolean; status: LiteralUnion<'draft' | 'open' | 'void' | 'paid' | 'uncollectible', string>; collection_method: LiteralUnion<'charge_automatically' | 'send_invoice', string>; billing_reason: LiteralUnion<'subscription_create' | 'subscription_cycle' | 'subscription_update' | 'subscription_recover' | 'subscription_threshold' | 'subscription_cancel' | 'subscription' | 'manual' | 'upcoming' | 'slash_stake' | 'stake' | 'overdraft_protection' | 'stake_overdraft_protection' | 'recharge' | 'auto_recharge', string>; currency_id: string; customer_id: string; payment_intent_id?: string; subscription_id?: string; checkout_session_id?: string; quote_id?: string; charge_id?: string; subscription_details?: any; subscription_proration_date?: number; subtotal: string; subtotal_excluding_tax: string; tax: string; total: string; gross_amount?: string; platform_fee?: string; net_amount?: string; amount_due: string; amount_paid: string; amount_remaining: string; amount_shipping: string; starting_balance: string; ending_balance: string; starting_token_balance?: Record; ending_token_balance?: Record; attempt_count: number; attempted: boolean; next_payment_attempt?: number; custom_fields?: SimpleCustomField[]; customer_address?: CustomerAddress; customer_email?: string; customer_name?: string; customer_phone?: string; customer_shipping?: CustomerShipping; discounts?: string[]; total_discount_amounts?: DiscountAmount[]; due_date?: number; effective_at?: number; footer?: string; from_invoice?: any; account_country?: string; account_name?: string; hosted_invoice_url?: string; invoice_pdf?: string; last_finalization_error?: PaymentError; latest_revision?: string; payment_settings?: PaymentSettings; default_payment_method_id: string; post_payment_credit_notes_amount?: string; pre_payment_credit_notes_amount?: string; rendering_options?: any; status_transitions?: { finalized_at?: number; marked_uncollectible_at?: number; paid_at?: number; voided_at?: number; }; test_clock_id?: string; threshold_reason?: any; webhooks_delivered_at?: number; receipt_number?: string; metadata?: Record; created_at: CreationOptional; updated_at: CreationOptional; static readonly GENESIS_ATTRIBUTES: { id: { type: DataTypes.StringDataType; primaryKey: boolean; allowNull: boolean; defaultValue: (size?: number) => string; }; livemode: { type: DataTypes.AbstractDataTypeConstructor; allowNull: boolean; }; auto_advance: { type: DataTypes.AbstractDataTypeConstructor; allowNull: boolean; }; account_country: { type: DataTypes.StringDataType; allowNull: boolean; }; account_name: { type: DataTypes.StringDataType; allowNull: boolean; }; charge_id: { type: DataTypes.StringDataType; allowNull: boolean; }; collection_method: { type: DataTypes.EnumDataType<"charge_automatically" | "send_invoice">; allowNull: boolean; }; currency_id: { type: DataTypes.StringDataType; allowNull: boolean; }; customer_id: { type: DataTypes.StringDataType; allowNull: boolean; }; description: { type: DataTypes.StringDataType; allowNull: boolean; }; hosted_invoice_url: { type: DataTypes.StringDataType; allowNull: boolean; }; payment_intent_id: { type: DataTypes.StringDataType; allowNull: boolean; }; period_end: { type: DataTypes.IntegerDataTypeConstructor; defaultValue: number; }; period_start: { type: DataTypes.IntegerDataTypeConstructor; defaultValue: number; }; status: { type: DataTypes.EnumDataType<"paid" | "draft" | "open" | "void" | "uncollectible">; allowNull: boolean; }; checkout_session_id: { type: DataTypes.StringDataType; allowNull: boolean; }; subscription_id: { type: DataTypes.StringDataType; allowNull: boolean; }; subscription_details: { type: DataTypes.AbstractDataTypeConstructor; defaultValue: {}; }; subscription_proration_date: { type: DataTypes.IntegerDataTypeConstructor; allowNull: boolean; }; total: { type: DataTypes.StringDataType; allowNull: boolean; }; gross_amount: { type: DataTypes.StringDataType; allowNull: boolean; }; platform_fee: { type: DataTypes.StringDataType; defaultValue: string; }; net_amount: { type: DataTypes.StringDataType; allowNull: boolean; }; subtotal: { type: DataTypes.StringDataType; allowNull: boolean; }; subtotal_excluding_tax: { type: DataTypes.StringDataType; allowNull: boolean; }; tax: { type: DataTypes.StringDataType; defaultValue: string; }; amount_due: { type: DataTypes.StringDataType; allowNull: boolean; }; amount_paid: { type: DataTypes.StringDataType; defaultValue: string; }; amount_remaining: { type: DataTypes.StringDataType; allowNull: boolean; }; amount_shipping: { type: DataTypes.StringDataType; defaultValue: string; }; attempt_count: { type: DataTypes.IntegerDataTypeConstructor; defaultValue: number; }; attempted: { type: DataTypes.AbstractDataTypeConstructor; defaultValue: boolean; }; next_payment_attempt: { type: DataTypes.IntegerDataTypeConstructor; allowNull: boolean; }; billing_reason: { type: DataTypes.EnumDataType<"manual" | "subscription_create" | "subscription_cycle" | "subscription_update" | "subscription_threshold" | "subscription_cancel" | "subscription" | "upcoming" | "slash_stake" | "stake" | "overdraft_protection" | "stake_overdraft_protection" | "recharge">; }; custom_fields: { type: DataTypes.AbstractDataTypeConstructor; defaultValue: never[]; }; customer_address: { type: DataTypes.AbstractDataTypeConstructor; allowNull: boolean; }; customer_name: { type: DataTypes.StringDataType; allowNull: boolean; }; customer_email: { type: DataTypes.StringDataType; allowNull: boolean; }; customer_phone: { type: DataTypes.StringDataType; allowNull: boolean; }; customer_shipping: { type: DataTypes.AbstractDataTypeConstructor; allowNull: boolean; }; default_payment_method_id: { type: DataTypes.StringDataType; allowNull: boolean; }; discounts: { type: DataTypes.AbstractDataTypeConstructor; defaultValue: never[]; }; due_date: { type: DataTypes.IntegerDataTypeConstructor; allowNull: boolean; }; effective_at: { type: DataTypes.IntegerDataTypeConstructor; allowNull: boolean; }; ending_balance: { type: DataTypes.StringDataType; defaultValue: string; }; footer: { type: DataTypes.StringDataType; allowNull: boolean; }; from_invoice_id: { type: DataTypes.StringDataType; allowNull: boolean; }; invoice_pdf: { type: DataTypes.StringDataType; allowNull: boolean; }; last_finalization_error: { type: DataTypes.AbstractDataTypeConstructor; allowNull: boolean; }; latest_revision: { type: DataTypes.StringDataType; allowNull: boolean; }; number: { type: DataTypes.StringDataType; allowNull: boolean; }; paid: { type: DataTypes.AbstractDataTypeConstructor; defaultValue: boolean; }; paid_out_of_band: { type: DataTypes.AbstractDataTypeConstructor; defaultValue: boolean; }; payment_settings: { type: DataTypes.AbstractDataTypeConstructor; allowNull: boolean; }; post_payment_credit_notes_amount: { type: DataTypes.StringDataType; defaultValue: string; }; pre_payment_credit_notes_amount: { type: DataTypes.StringDataType; defaultValue: string; }; quote_id: { type: DataTypes.StringDataType; allowNull: boolean; }; receipt_number: { type: DataTypes.StringDataType; allowNull: boolean; }; days_until_due: { type: DataTypes.NumberDataTypeConstructor; allowNull: boolean; }; rendering_options: { type: DataTypes.AbstractDataTypeConstructor; allowNull: boolean; }; starting_balance: { type: DataTypes.StringDataType; defaultValue: string; }; statement_descriptor: { type: DataTypes.StringDataType; allowNull: boolean; }; status_transitions: { type: DataTypes.AbstractDataTypeConstructor; defaultValue: {}; }; test_clock_id: { type: DataTypes.StringDataType; allowNull: boolean; }; threshold_reason: { type: DataTypes.AbstractDataTypeConstructor; allowNull: boolean; }; total_discount_amounts: { type: DataTypes.AbstractDataTypeConstructor; defaultValue: never[]; }; webhooks_delivered_at: { type: DataTypes.IntegerDataTypeConstructor; allowNull: boolean; }; metadata: { type: DataTypes.AbstractDataTypeConstructor; allowNull: boolean; }; created_at: { type: DataTypes.DateDataTypeConstructor; defaultValue: DataTypes.AbstractDataTypeConstructor; allowNull: boolean; }; updated_at: { type: DataTypes.DateDataTypeConstructor; defaultValue: DataTypes.AbstractDataTypeConstructor; allowNull: boolean; }; }; static initialize(sequelize: any): void; static associate(models: any): void; isImmutable(): boolean; private static _getUncollectibleAmount; static getUncollectibleAmount({ customerId, subscriptionId, currencyId, excludedInvoiceId, livemode, }: { customerId?: string; subscriptionId?: string; currencyId?: string; excludedInvoiceId?: string; livemode?: boolean; }): Promise<[GroupedBN, GroupedStrList, Invoice[]]>; static getSummary(livemode?: boolean, field?: string): Promise; } export type TInvoice = InferAttributes;