UNPKG

@accounter/server

Version:

89 lines (88 loc) 3.68 kB
import type { Injector } from 'graphql-modules'; import type { DeelWorker, Invoice, PaymentBreakdownRecord, PaymentReceipts } from '../../app-providers/deel/schemas.js'; import type { IGetDocumentsByChargeIdResult } from '../../documents/types'; import type { LedgerProto, StrictLedgerProto } from '../../../shared/types/index.js'; import type { IInsertDeelInvoiceRecordsParams } from '../types.js'; export declare function isDeelDocument(document: IGetDocumentsByChargeIdResult): boolean; export declare function getDeelEmployeeId(context: GraphQLModules.ModuleContext, document: IGetDocumentsByChargeIdResult, ledgerEntry: StrictLedgerProto, ledgerEntries: LedgerProto[], updateLedgerBalance: (entry: LedgerProto) => void): Promise<void>; type Prefixer<Type> = { [Property in keyof Type as `breakdown_${string & Property}`]: Type[Property]; }; export type PrefixedBreakdown = Prefixer<PaymentBreakdownRecord & { receipt_id: string; }>; export type DeelInvoiceMatch = Invoice & PrefixedBreakdown; export declare function uploadDeelInvoice(receiptChargeMap: Map<string, string>, match: DeelInvoiceMatch, injector: Injector, ownerId: string): Promise<string>; export declare function convertMatchToDeelInvoiceRecord(match: DeelInvoiceMatch, documentId: string): IInsertDeelInvoiceRecordsParams; export declare function getDeelChargeDescription(injector: Injector, workers?: DeelWorker[]): Promise<string>; export declare function fetchAndFilterInvoices(injector: Injector): Promise<{ invoices: { id: string; amount: string; contract_id: string | null; created_at: string; currency: string; deel_fee: "0.00"; due_date: string; is_overdue: boolean; issued_at: string; label: string; paid_at: string; status: "pending" | "paid" | "processing" | "canceled" | "skipped" | "failed" | "refunded"; total: string; vat_id: ""; vat_percentage: ""; vat_total: "0.00"; }[]; }>; export declare function fetchReceipts(injector: Injector): Promise<{ id: string; created_at: string; label: string; paid_at: string; payment_currency: string; total: string; status: "paid"; payment_method?: Record<string, never> | undefined; workers?: { id: string; picUrl: string | null; contract_id?: string | null | undefined; name?: string | undefined; public_id?: string | undefined; }[] | undefined; }[]>; export declare function fetchPaymentBreakdowns(injector: Injector, receipts: PaymentReceipts[]): Promise<({ adjustment: "0.00"; approve_date: string; approvers: string; bonus: "0.00"; commissions: "0.00"; contract_country: string; contract_start_date: string; contract_type: string; contractor_email: string; contractor_employee_name: string; contractor_unique_identifier: string; currency: string; date: string; deductions: "0.00"; expenses: string; frequency: "" | "custom" | "hourly" | "daily" | "monthly"; general_ledger_account: ""; group_id: string; others: "0.00"; overtime: "0.00"; payment_currency: string; payment_date: string; pro_rata: string; processing_fee: string; work: string; total: string; total_payment_currency: string; } & { receipt_id: string; })[]>; export declare function getChargeMatchesForPayments(injector: Injector, ownerId: string, receipts: PaymentReceipts[]): Promise<Map<string, string>>; export declare function matchInvoicesWithPayments(invoices: Invoice[], paymentBreakdowns: PaymentBreakdownRecord[]): DeelInvoiceMatch[]; export {};