import { Amount } from '../../../commonStateTypes/amount'; import { ID } from '../../../commonStateTypes/common'; import { ZeniDate } from '../../../zeniDayJS'; import { InvoicingSubscription } from '../invoicingSubscription/invoicingSubscriptionState'; export type InvoicingPaymentMethodType = 'ach' | 'card'; /** * One stored payment method for a customer. `isDefault` is only trustworthy * after `invoicingCustomerPaymentMethods` has normalized a list — that is * what guarantees a single default across the returned methods. */ export interface InvoicingCustomerPaymentMethod { id: ID; isDefault: boolean; type: InvoicingPaymentMethodType; /** Card network label; only known for the legacy scalar default method. */ brand?: string; expMonth?: number; expYear?: number; last4?: string; } export interface InvoicingCustomer { id: ID; arr?: Amount; autoCollection?: 'on' | 'off'; billingAddressId?: ID; cardStatus?: 'no_card' | 'valid' | 'expiring' | 'expired'; company?: string; consolidatedInvoicing?: boolean; createdAt?: ZeniDate; customerType?: 'residential' | 'business'; defaultPaymentMethodID?: ID; email?: string; excessPayments?: Amount; firstName?: string; fraudFlag?: 'safe' | 'suspicious' | 'fraudulent'; initials?: string; invoiceNotes?: string; isAtRisk?: boolean; lastName?: string; lifetimeValue?: Amount; locale?: string; mrr?: Amount; netTermDays?: number; notes?: string; paymentMethod?: string; paymentMethodExpMonth?: number; paymentMethodExpYear?: number; paymentMethodLast4?: string; /** * Every payment method on file. Absent (not empty) on responses from a * backend that only returns the scalar default-method fields, which is how * `invoicingCustomerPaymentMethods` decides whether to synthesize a row. */ paymentMethods?: InvoicingCustomerPaymentMethod[]; paymentMethodType?: 'ach' | 'card' | 'none'; phone?: string; plan?: string; planName?: string; preferredCurrencyCode?: string; promotionalCredits?: Amount; refundableCredits?: Amount; status?: string; stripeCustomerID?: ID; subscriptions?: InvoicingSubscription[]; taxability?: 'taxable' | 'exempt'; totalReceivable?: Amount; unbilledCharges?: Amount; updatedAt?: ZeniDate; vatNumber?: string; } export interface InvoicingCustomerState { customerByID: Record; }