minimax-client
Version:
TypeScript client library for the Minimax accounting API (https://moj.minimax.rs/RS/API/)
380 lines (379 loc) • 7.38 kB
TypeScript
/**
* Journals module
*
* Module for interacting with journals and journal entries in the Minimax API
*/
import { BaseResource } from './base-resource';
/**
* Journal search result
*/
export interface JournalSearch {
/**
* Unique identifier
*/
Id: string;
/**
* Journal name
*/
Name: string;
/**
* Journal code
*/
Code: string;
/**
* Journal type ID
*/
JournalTypeId: string;
/**
* Journal type name
*/
JournalTypeName: string;
/**
* Whether the journal is active
*/
IsActive: boolean;
}
/**
* Journal entries search result
*/
export interface JournalEntriesSearch {
/**
* Unique identifier
*/
Id: string;
/**
* Journal ID
*/
JournalId: string;
/**
* Journal name
*/
JournalName: string;
/**
* Document number
*/
DocumentNumber: string;
/**
* Document date
*/
DocumentDate: string;
/**
* Posting date
*/
PostingDate: string;
/**
* Description
*/
Description?: string;
/**
* Reference
*/
Reference?: string;
/**
* Total debit amount
*/
TotalDebitAmount: number;
/**
* Total credit amount
*/
TotalCreditAmount: number;
}
/**
* Journal resource
*/
export interface Journal {
/**
* Unique identifier
*/
Id: string;
/**
* Concurrency control token
*/
RowVersion: string;
/**
* Journal name
*/
Name: string;
/**
* Journal code
*/
Code: string;
/**
* Journal type ID
*/
JournalTypeId: string;
/**
* Whether the journal is active
*/
IsActive: boolean;
/**
* VAT entries
*/
VATEntries?: VATEntry[];
}
/**
* VAT Entry
*/
export interface VATEntry {
/**
* Unique identifier
*/
Id?: string;
/**
* Concurrency control token
*/
RowVersion?: string;
/**
* VAT code
*/
VATCode: string;
/**
* VAT rate
*/
VATRate: number;
/**
* VAT base amount
*/
VATBase: number;
/**
* VAT amount
*/
VATAmount: number;
}
/**
* Journal creation parameters
*/
export interface CreateJournalParams {
/**
* Journal name
*/
Name: string;
/**
* Journal code
*/
Code: string;
/**
* Journal type ID
*/
JournalTypeId: string;
/**
* Whether the journal is active
*/
IsActive?: boolean;
}
/**
* Journal update parameters
*/
export interface UpdateJournalParams {
/**
* Journal name
*/
Name?: string;
/**
* Journal code
*/
Code?: string;
/**
* Journal type ID
*/
JournalTypeId?: string;
/**
* Whether the journal is active
*/
IsActive?: boolean;
/**
* Concurrency control token
*/
RowVersion: string;
}
/**
* Journal filter options
*/
export interface JournalFilterOptions {
/**
* Date to
*/
dateTo?: string;
/**
* Date from
*/
dateFrom?: string;
/**
* Journal ID
*/
journalId?: string;
/**
* Journal type
*/
journalType?: string;
/**
* Journal description
*/
description?: string;
/**
* Journal status (O - Draft, P - Confirmed, A - Automatic)
*/
status?: 'O' | 'P' | 'A';
/**
* Current page index (starting with 1 for first page)
*/
currentPage?: number;
/**
* Page size (number of records per page)
*/
pageSize?: number;
/**
* Field name for sorting/ordering results
*/
sortField?: string;
/**
* Sort order (A - ascending, D - descending)
*/
order?: 'A' | 'D';
}
/**
* Journal entry filter options
*/
export interface JournalEntryFilterOptions {
/**
* Journal type
*/
journalType?: string;
/**
* Journal description
*/
description?: string;
/**
* Analytic ID
*/
analyticId?: string;
/**
* Customer ID
*/
customerId?: string;
/**
* Employee ID
*/
employeeId?: string;
/**
* Journal status
*/
status?: string;
/**
* Currency
*/
currency?: string;
/**
* Date to
*/
dateTo?: string;
/**
* Date from
*/
dateFrom?: string;
/**
* Account
*/
account?: string;
/**
* Current page index (starting with 1 for first page)
*/
currentPage?: number;
/**
* Page size (number of records per page)
*/
pageSize?: number;
/**
* Field name for sorting/ordering results
*/
sortField?: string;
/**
* Sort order (A - ascending, D - descending)
*/
order?: 'A' | 'D';
}
/**
* Journals module
*/
export declare class JournalsModule extends BaseResource {
/**
* Base endpoint for journals
*/
protected readonly endpoint = "journals";
/**
* Get all journals
*
* @param options Filter options
* @returns Promise resolving to an array of journal search results
*/
getAll(options?: JournalFilterOptions): Promise<JournalSearch[]>;
/**
* Get a journal by ID
*
* @param id Journal ID
* @returns Promise resolving to the journal
*/
get(id: string): Promise<Journal>;
/**
* Create a new journal
*
* @param params Journal creation parameters
* @returns Promise resolving to the created journal
*/
create(params: CreateJournalParams): Promise<Journal>;
/**
* Update a journal
*
* @param id Journal ID
* @param params Journal update parameters
* @returns Promise resolving to the updated journal
*/
update(id: string, params: UpdateJournalParams): Promise<Journal>;
/**
* Delete a journal
*
* @param id Journal ID
* @returns Promise resolving when the journal is deleted
*/
delete(id: string): Promise<void>;
/**
* Get a VAT entry by ID
*
* @param journalId Journal ID
* @param vatId VAT entry ID
* @returns Promise resolving to the VAT entry
*/
getVATEntry(journalId: string, vatId: string): Promise<VATEntry>;
/**
* Create a new VAT entry
*
* @param journalId Journal ID
* @param vatEntry VAT entry
* @returns Promise resolving when the VAT entry is created
*/
createVATEntry(journalId: string, vatEntry: VATEntry): Promise<void>;
/**
* Update a VAT entry
*
* @param journalId Journal ID
* @param vatId VAT entry ID
* @param vatEntry VAT entry
* @returns Promise resolving when the VAT entry is updated
*/
updateVATEntry(journalId: string, vatId: string, vatEntry: VATEntry): Promise<void>;
/**
* Delete a VAT entry
*
* @param journalId Journal ID
* @param vatId VAT entry ID
* @returns Promise resolving when the VAT entry is deleted
*/
deleteVATEntry(journalId: string, vatId: string): Promise<void>;
/**
* Get all journal entries
*
* @param options Filter options
* @returns Promise resolving to an array of journal entries search results
*/
getAllJournalEntries(options?: JournalEntryFilterOptions): Promise<JournalEntriesSearch[]>;
}