@accounter/server
Version:
Accounter GraphQL server
41 lines (40 loc) • 1.39 kB
TypeScript
import type { PoolClient } from 'pg';
import { TenantAwareDBClient } from '../../app-providers/tenant-db-client.js';
export type FinancialEntityType = 'business' | 'tax_category' | 'tag';
export interface EnsureFinancialEntityParams {
id?: string;
name: string;
type: FinancialEntityType;
ownerId?: string;
}
export interface EnsureBusinessOptions {
ownerId?: string;
country?: string;
isDocumentsOptional?: boolean;
hebrewName?: string;
address?: string;
city?: string;
zipCode?: string;
email?: string;
website?: string;
phoneNumber?: string;
governmentId?: string;
exemptDealer?: boolean;
optionalVat?: boolean;
isReceiptEnough?: boolean;
}
export interface EnsureTaxCategoryOptions {
ownerId?: string;
hashavshevetName?: string;
taxExcluded?: boolean;
}
export declare class EntityEnsureProvider {
private db;
constructor(db: TenantAwareDBClient);
ensureFinancialEntity(params: EnsureFinancialEntityParams, client?: PoolClient): Promise<{
id: string;
}>;
ensureBusinessForEntity(entityId: string, options?: EnsureBusinessOptions, client?: PoolClient): Promise<void>;
ensureTaxCategoryForEntity(entityId: string, options?: EnsureTaxCategoryOptions, client?: PoolClient): Promise<void>;
ensureCountry(code: string, name: string, client?: PoolClient): Promise<void>;
}