keez-invoicing 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +28 -0
- package/README.md +366 -0
- package/dist/coverage/lcov-report/block-navigation.js +71 -0
- package/dist/coverage/lcov-report/prettify.js +478 -0
- package/dist/coverage/lcov-report/sorter.js +177 -0
- package/dist/eslint.config.js +56 -0
- package/dist/jest.config.cjs +13 -0
- package/dist/jest.config.js +13 -0
- package/dist/src/api/__tests__/index.test.js +52 -0
- package/dist/src/api/authorise.js +48 -0
- package/dist/src/api/invoices/cancel.js +33 -0
- package/dist/src/api/invoices/create.js +97 -0
- package/dist/src/api/invoices/delete.js +33 -0
- package/dist/src/api/invoices/downloadPdf.js +31 -0
- package/dist/src/api/invoices/getAll.js +84 -0
- package/dist/src/api/invoices/sendMail.js +59 -0
- package/dist/src/api/invoices/submitEfactura.js +34 -0
- package/dist/src/api/invoices/update.js +61 -0
- package/dist/src/api/invoices/validate.js +39 -0
- package/dist/src/api/invoices/view.js +93 -0
- package/dist/src/api/items/create.js +42 -0
- package/dist/src/api/items/getAll.js +74 -0
- package/dist/src/api/items/getById.js +46 -0
- package/dist/src/api/items/index.js +14 -0
- package/dist/src/api/items/patch.js +49 -0
- package/dist/src/api/items/update.js +41 -0
- package/dist/src/config/constants.js +23 -0
- package/dist/src/config/constructorParam.js +3 -0
- package/dist/src/config/measureUnit.js +22 -0
- package/dist/src/config/paymentType.js +17 -0
- package/dist/src/config/paymentType.js.js +16 -0
- package/dist/src/dto/allInvoicesResponse.js +3 -0
- package/dist/src/dto/authResponse.js +3 -0
- package/dist/src/dto/common/index.js +3 -0
- package/dist/src/dto/common/paginationParams.js +3 -0
- package/dist/src/dto/createInvoiceRequest.js +3 -0
- package/dist/src/dto/invoiceResponse.js +3 -0
- package/dist/src/dto/invoices/index.js +3 -0
- package/dist/src/dto/invoices/invoiceFilterParams.js +3 -0
- package/dist/src/dto/invoices/invoiceRequestV2.js +3 -0
- package/dist/src/dto/invoices/sendInvoiceParams.js +3 -0
- package/dist/src/dto/items/allItemsResponse.js +3 -0
- package/dist/src/dto/items/index.js +3 -0
- package/dist/src/dto/items/itemRequest.js +3 -0
- package/dist/src/dto/items/itemResponse.js +3 -0
- package/dist/src/errors/KeezError.js +27 -0
- package/dist/src/helpers/logger.js +15 -0
- package/dist/src/index.js +15 -0
- package/dist/src/keezApi.js +283 -0
- package/dist/tests/additional-coverage.test.js +351 -0
- package/dist/tests/edge-cases.test.js +353 -0
- package/dist/tests/error-handling.test.js +224 -0
- package/dist/tests/filter-params.test.js +267 -0
- package/dist/tests/index.test.js +493 -0
- package/dist/tests/invoices-extended.test.js +168 -0
- package/dist/tests/items.test.js +142 -0
- package/dist/types/coverage/lcov-report/block-navigation.d.ts +1 -0
- package/dist/types/coverage/lcov-report/prettify.d.ts +0 -0
- package/dist/types/coverage/lcov-report/sorter.d.ts +1 -0
- package/dist/types/eslint.config.d.ts +2 -0
- package/dist/types/jest.config.d.cts +9 -0
- package/dist/types/jest.config.d.ts +9 -0
- package/dist/types/src/api/__tests__/index.test.d.ts +1 -0
- package/dist/types/src/api/authorise.d.ts +18 -0
- package/dist/types/src/api/invoices/cancel.d.ts +9 -0
- package/dist/types/src/api/invoices/create.d.ts +22 -0
- package/dist/types/src/api/invoices/delete.d.ts +9 -0
- package/dist/types/src/api/invoices/downloadPdf.d.ts +8 -0
- package/dist/types/src/api/invoices/getAll.d.ts +22 -0
- package/dist/types/src/api/invoices/sendMail.d.ts +24 -0
- package/dist/types/src/api/invoices/submitEfactura.d.ts +9 -0
- package/dist/types/src/api/invoices/update.d.ts +11 -0
- package/dist/types/src/api/invoices/validate.d.ts +21 -0
- package/dist/types/src/api/invoices/view.d.ts +22 -0
- package/dist/types/src/api/items/create.d.ts +10 -0
- package/dist/types/src/api/items/getAll.d.ts +10 -0
- package/dist/types/src/api/items/getById.d.ts +10 -0
- package/dist/types/src/api/items/index.d.ts +5 -0
- package/dist/types/src/api/items/patch.d.ts +11 -0
- package/dist/types/src/api/items/update.d.ts +11 -0
- package/dist/types/src/config/constants.d.ts +13 -0
- package/dist/types/src/config/constructorParam.d.ts +6 -0
- package/dist/types/src/config/measureUnit.d.ts +17 -0
- package/dist/types/src/config/paymentType.d.ts +12 -0
- package/dist/types/src/config/paymentType.js.d.ts +11 -0
- package/dist/types/src/dto/allInvoicesResponse.d.ts +21 -0
- package/dist/types/src/dto/authResponse.d.ts +7 -0
- package/dist/types/src/dto/common/index.d.ts +1 -0
- package/dist/types/src/dto/common/paginationParams.d.ts +4 -0
- package/dist/types/src/dto/createInvoiceRequest.d.ts +34 -0
- package/dist/types/src/dto/invoiceResponse.d.ts +48 -0
- package/dist/types/src/dto/invoices/index.d.ts +3 -0
- package/dist/types/src/dto/invoices/invoiceFilterParams.d.ts +8 -0
- package/dist/types/src/dto/invoices/invoiceRequestV2.d.ts +23 -0
- package/dist/types/src/dto/invoices/sendInvoiceParams.d.ts +5 -0
- package/dist/types/src/dto/items/allItemsResponse.d.ts +13 -0
- package/dist/types/src/dto/items/index.d.ts +3 -0
- package/dist/types/src/dto/items/itemRequest.d.ts +34 -0
- package/dist/types/src/dto/items/itemResponse.d.ts +15 -0
- package/dist/types/src/errors/KeezError.d.ts +11 -0
- package/dist/types/src/helpers/logger.d.ts +2 -0
- package/dist/types/src/index.d.ts +11 -0
- package/dist/types/src/keezApi.d.ts +114 -0
- package/dist/types/tests/additional-coverage.test.d.ts +1 -0
- package/dist/types/tests/edge-cases.test.d.ts +1 -0
- package/dist/types/tests/error-handling.test.d.ts +1 -0
- package/dist/types/tests/filter-params.test.d.ts +1 -0
- package/dist/types/tests/index.test.d.ts +1 -0
- package/dist/types/tests/invoices-extended.test.d.ts +1 -0
- package/dist/types/tests/items.test.d.ts +1 -0
- package/package.json +66 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { UpdateItemRequest } from '../../../../src/dto/items';
|
|
2
|
+
interface UpdateItemParams {
|
|
3
|
+
readonly baseDomain: string;
|
|
4
|
+
readonly appId: string;
|
|
5
|
+
readonly appClientId: string;
|
|
6
|
+
readonly bearerToken: string;
|
|
7
|
+
readonly itemId: string;
|
|
8
|
+
readonly item: UpdateItemRequest;
|
|
9
|
+
}
|
|
10
|
+
export declare function apiUpdateItem(params: UpdateItemParams): Promise<void>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const SECONDS_IN_MINUTE = 60;
|
|
2
|
+
export declare const MINUTES_IN_HOUR = 60;
|
|
3
|
+
export declare const MILLISECONDS_IN_SECOND = 1000;
|
|
4
|
+
export declare const SECONDS_IN_HOUR: number;
|
|
5
|
+
export declare const MILLISECONDS_IN_MINUTE: number;
|
|
6
|
+
export declare const HTTP_REQUEST_TIMEOUT_MS: number;
|
|
7
|
+
export declare const DOWNLOAD_REQUEST_TIMEOUT_MS: number;
|
|
8
|
+
export declare const TOKEN_EXPIRY_BUFFER_MS: number;
|
|
9
|
+
export declare const DATE_PAD_LENGTH = 2;
|
|
10
|
+
export declare const MONTH_INDEX_OFFSET = 1;
|
|
11
|
+
export declare const DECIMAL_RADIX = 10;
|
|
12
|
+
export declare const DEFAULT_VAT_AMOUNT = 0;
|
|
13
|
+
export declare const DEFAULT_INVOICE_QUANTITY = 1;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare enum MeasureUnit {
|
|
2
|
+
PIECE = 1,// Bucata
|
|
3
|
+
KILOGRAM = 2,// Kilogram
|
|
4
|
+
GRAM = 3,// Gram
|
|
5
|
+
LITER = 4,// Litru
|
|
6
|
+
METER = 5,// Metru
|
|
7
|
+
SQUARE_METER = 6,// Metru patrat
|
|
8
|
+
CUBIC_METER = 7,// Metru cub
|
|
9
|
+
HOUR = 8,// Ora
|
|
10
|
+
DAY = 9,// Zi
|
|
11
|
+
MONTH = 10,// Luna
|
|
12
|
+
YEAR = 11,// An
|
|
13
|
+
SET = 12,// Set
|
|
14
|
+
PACK = 13,// Pachet
|
|
15
|
+
BOX = 14,// Cutie
|
|
16
|
+
SERVICE = 15
|
|
17
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare enum PaymentType {
|
|
2
|
+
CASH = 1,// Bon fiscal platit cu numerar
|
|
3
|
+
CARD = 2,// Bon fiscal platit cu cardul
|
|
4
|
+
BANK_TRANSFER = 3,// Factura platita prin transfer bancar
|
|
5
|
+
CASH_RECEIPT = 4,// Plata numerar cu chitanta
|
|
6
|
+
CASH_ON_DELIVERY = 5,// Ramburs
|
|
7
|
+
CARD_ONLINE = 6,// Plata cu cardul online
|
|
8
|
+
CARD_PLATFORMS = 7,// Plata cu platforme distributie si plata (Emag)
|
|
9
|
+
HOLIDAY_VOUCHER_CARD = 8,// Plata cu voucher de vacanta (card)
|
|
10
|
+
HOLIDAY_VOUCHER_TICKET = 9,// Plata cu voucher de vacanta (ticket)
|
|
11
|
+
MEAL_VOUCHER = 10
|
|
12
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface ShortInvoiceResponse {
|
|
2
|
+
readonly externalId: string;
|
|
3
|
+
readonly series: string;
|
|
4
|
+
readonly number: number;
|
|
5
|
+
readonly documentDate: number;
|
|
6
|
+
readonly dueDate: number;
|
|
7
|
+
readonly status: string;
|
|
8
|
+
readonly clientName: string;
|
|
9
|
+
readonly partnerName: string;
|
|
10
|
+
readonly currencyCode: string;
|
|
11
|
+
readonly referenceCurrencyCode: string;
|
|
12
|
+
readonly netAmount: number;
|
|
13
|
+
readonly vatAmount: number;
|
|
14
|
+
readonly grossAmount: number;
|
|
15
|
+
}
|
|
16
|
+
export interface AllInvoicesResponse {
|
|
17
|
+
readonly first: number;
|
|
18
|
+
readonly last: number;
|
|
19
|
+
readonly recordsCount: number;
|
|
20
|
+
readonly data: ShortInvoiceResponse[];
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PaginationParams } from './paginationParams';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { PaymentType } from '../../../src/config/paymentType';
|
|
2
|
+
export interface Partner {
|
|
3
|
+
addressDetails: string;
|
|
4
|
+
cityName: string;
|
|
5
|
+
countryCode: string;
|
|
6
|
+
countryName: string;
|
|
7
|
+
countyCode: string;
|
|
8
|
+
countyName: string;
|
|
9
|
+
identificationNumber: string;
|
|
10
|
+
isLegalPerson: boolean;
|
|
11
|
+
partnerName: string;
|
|
12
|
+
}
|
|
13
|
+
export interface InvoiceDetail {
|
|
14
|
+
itemExternalId: string;
|
|
15
|
+
measureUnitId: number;
|
|
16
|
+
quantity: number;
|
|
17
|
+
unitPrice: number;
|
|
18
|
+
netAmount: number;
|
|
19
|
+
vatAmount: number;
|
|
20
|
+
grossAmount: number;
|
|
21
|
+
}
|
|
22
|
+
export interface InvoiceRequest {
|
|
23
|
+
series: string;
|
|
24
|
+
currencyCode: string;
|
|
25
|
+
amount: number;
|
|
26
|
+
paymentType: PaymentType;
|
|
27
|
+
partner: Partner;
|
|
28
|
+
itemId: string;
|
|
29
|
+
documentDate?: number;
|
|
30
|
+
dueDate?: number;
|
|
31
|
+
measureUnitId?: number;
|
|
32
|
+
quantity?: number;
|
|
33
|
+
vatOnCollection?: boolean;
|
|
34
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Partner } from './createInvoiceRequest';
|
|
2
|
+
export interface Item {
|
|
3
|
+
discountGrossValue: number;
|
|
4
|
+
discountNetValue: number;
|
|
5
|
+
discountValueOnNet: boolean;
|
|
6
|
+
discountVatValue: number;
|
|
7
|
+
exciseAmount: number;
|
|
8
|
+
grossAmount: number;
|
|
9
|
+
itemCode: string;
|
|
10
|
+
itemDescription: string;
|
|
11
|
+
itemExternalId: string;
|
|
12
|
+
itemName: string;
|
|
13
|
+
measureUnitId: number;
|
|
14
|
+
netAmount: number;
|
|
15
|
+
originalNetAmount: number;
|
|
16
|
+
originalVatAmount: number;
|
|
17
|
+
quantity: number;
|
|
18
|
+
unMeasureUnit: string;
|
|
19
|
+
unVatCategory: string;
|
|
20
|
+
unVatExemptionReason: string;
|
|
21
|
+
unitPrice: number;
|
|
22
|
+
vatAmount: number;
|
|
23
|
+
vatPercent: number;
|
|
24
|
+
}
|
|
25
|
+
export interface InvoiceResponse {
|
|
26
|
+
currencyCode: string;
|
|
27
|
+
discountGrossValue: number;
|
|
28
|
+
discountNetValue: number;
|
|
29
|
+
discountValueOnNet: boolean;
|
|
30
|
+
discountVatValue: number;
|
|
31
|
+
documentDate: number;
|
|
32
|
+
dueDate: number;
|
|
33
|
+
exchangeRate: number;
|
|
34
|
+
exciseAmount: number;
|
|
35
|
+
grossAmount: number;
|
|
36
|
+
items: Item[];
|
|
37
|
+
netAmount: number;
|
|
38
|
+
number: number;
|
|
39
|
+
originalNetAmount: number;
|
|
40
|
+
originalVatAmount: number;
|
|
41
|
+
partner: Partner;
|
|
42
|
+
paymentTypeId: number;
|
|
43
|
+
referenceCurrencyCode: string;
|
|
44
|
+
series: string;
|
|
45
|
+
status: string;
|
|
46
|
+
vatAmount: number;
|
|
47
|
+
vatOnCollection: boolean;
|
|
48
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PaginationParams } from '../../../../src/dto/common/paginationParams';
|
|
2
|
+
export interface InvoiceFilterParams extends PaginationParams {
|
|
3
|
+
readonly status?: string;
|
|
4
|
+
readonly fromDate?: number;
|
|
5
|
+
readonly toDate?: number;
|
|
6
|
+
readonly series?: string;
|
|
7
|
+
readonly partnerName?: string;
|
|
8
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { PaymentType } from '../../../../src/config/paymentType';
|
|
2
|
+
import { Partner } from '../../../../src/dto/createInvoiceRequest';
|
|
3
|
+
export interface InvoiceLineItem {
|
|
4
|
+
readonly itemExternalId: string;
|
|
5
|
+
readonly measureUnitId: number;
|
|
6
|
+
readonly quantity: number;
|
|
7
|
+
readonly unitPrice: number;
|
|
8
|
+
readonly vatPercent?: number;
|
|
9
|
+
readonly discountPercent?: number;
|
|
10
|
+
readonly description?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface InvoiceRequestV2 {
|
|
13
|
+
readonly series: string;
|
|
14
|
+
readonly documentDate: number;
|
|
15
|
+
readonly dueDate: number;
|
|
16
|
+
readonly currencyCode: string;
|
|
17
|
+
readonly paymentType: PaymentType;
|
|
18
|
+
readonly partner: Partner;
|
|
19
|
+
readonly items: InvoiceLineItem[];
|
|
20
|
+
readonly vatOnCollection?: boolean;
|
|
21
|
+
readonly exchangeRate?: number;
|
|
22
|
+
readonly notes?: string;
|
|
23
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PaginationParams } from '../../../../src/dto/common/paginationParams';
|
|
2
|
+
import { ItemResponse } from './itemResponse';
|
|
3
|
+
export interface ItemFilterParams extends PaginationParams {
|
|
4
|
+
readonly itemName?: string;
|
|
5
|
+
readonly itemCode?: string;
|
|
6
|
+
readonly isActive?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface AllItemsResponse {
|
|
9
|
+
readonly first: number;
|
|
10
|
+
readonly last: number;
|
|
11
|
+
readonly recordsCount: number;
|
|
12
|
+
readonly data: ItemResponse[];
|
|
13
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { MeasureUnit } from '../../../../src/config/measureUnit';
|
|
2
|
+
export interface CreateItemRequest {
|
|
3
|
+
readonly itemName: string;
|
|
4
|
+
readonly itemCode?: string;
|
|
5
|
+
readonly itemDescription?: string;
|
|
6
|
+
readonly measureUnitId: MeasureUnit;
|
|
7
|
+
readonly unitPrice: number;
|
|
8
|
+
readonly vatPercent: number;
|
|
9
|
+
readonly vatCategoryCode?: string;
|
|
10
|
+
readonly vatExemptionReason?: string;
|
|
11
|
+
readonly isActive?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface UpdateItemRequest {
|
|
14
|
+
readonly itemName: string;
|
|
15
|
+
readonly itemCode?: string;
|
|
16
|
+
readonly itemDescription?: string;
|
|
17
|
+
readonly measureUnitId: MeasureUnit;
|
|
18
|
+
readonly unitPrice: number;
|
|
19
|
+
readonly vatPercent: number;
|
|
20
|
+
readonly vatCategoryCode?: string;
|
|
21
|
+
readonly vatExemptionReason?: string;
|
|
22
|
+
readonly isActive?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface PatchItemRequest {
|
|
25
|
+
readonly itemName?: string;
|
|
26
|
+
readonly itemCode?: string;
|
|
27
|
+
readonly itemDescription?: string;
|
|
28
|
+
readonly measureUnitId?: MeasureUnit;
|
|
29
|
+
readonly unitPrice?: number;
|
|
30
|
+
readonly vatPercent?: number;
|
|
31
|
+
readonly vatCategoryCode?: string;
|
|
32
|
+
readonly vatExemptionReason?: string;
|
|
33
|
+
readonly isActive?: boolean;
|
|
34
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface ItemResponse {
|
|
2
|
+
readonly externalId: string;
|
|
3
|
+
readonly itemName: string;
|
|
4
|
+
readonly itemCode: string;
|
|
5
|
+
readonly itemDescription: string;
|
|
6
|
+
readonly measureUnitId: number;
|
|
7
|
+
readonly measureUnitName: string;
|
|
8
|
+
readonly unitPrice: number;
|
|
9
|
+
readonly vatPercent: number;
|
|
10
|
+
readonly vatCategoryCode: string;
|
|
11
|
+
readonly vatExemptionReason: string;
|
|
12
|
+
readonly isActive: boolean;
|
|
13
|
+
readonly createdAt: number;
|
|
14
|
+
readonly updatedAt: number;
|
|
15
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare class KeezError extends Error {
|
|
2
|
+
readonly statusCode?: number | undefined;
|
|
3
|
+
readonly originalError?: unknown | undefined;
|
|
4
|
+
constructor(message: string, statusCode?: number | undefined, originalError?: unknown | undefined);
|
|
5
|
+
}
|
|
6
|
+
export declare class KeezAuthError extends KeezError {
|
|
7
|
+
constructor(message: string, statusCode?: number, originalError?: unknown);
|
|
8
|
+
}
|
|
9
|
+
export declare class KeezApiError extends KeezError {
|
|
10
|
+
constructor(message: string, statusCode?: number, originalError?: unknown);
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { KeezApi } from './keezApi';
|
|
2
|
+
export { KeezError, KeezAuthError, KeezApiError } from './errors/KeezError';
|
|
3
|
+
export { PaymentType } from './config/paymentType';
|
|
4
|
+
export { MeasureUnit } from './config/measureUnit';
|
|
5
|
+
export { PaginationParams } from './dto/common';
|
|
6
|
+
export { InvoiceRequest, Partner } from './dto/createInvoiceRequest';
|
|
7
|
+
export { InvoiceResponse, Item } from './dto/invoiceResponse';
|
|
8
|
+
export { AllInvoicesResponse, ShortInvoiceResponse } from './dto/allInvoicesResponse';
|
|
9
|
+
export { InvoiceFilterParams, SendInvoiceEmailParams, InvoiceRequestV2, InvoiceLineItem } from './dto/invoices';
|
|
10
|
+
export { CreateItemRequest, UpdateItemRequest, PatchItemRequest, ItemResponse, ItemFilterParams, AllItemsResponse, } from './dto/items';
|
|
11
|
+
export { AuthResponse } from './dto/authResponse';
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { KeezConstructor } from './config/constructorParam';
|
|
2
|
+
import { InvoiceRequest } from './dto/createInvoiceRequest';
|
|
3
|
+
import { InvoiceFilterParams, InvoiceRequestV2, SendInvoiceEmailParams } from './dto/invoices';
|
|
4
|
+
import { AllItemsResponse, CreateItemRequest, ItemFilterParams, ItemResponse, PatchItemRequest, UpdateItemRequest } from './dto/items';
|
|
5
|
+
export declare class KeezApi {
|
|
6
|
+
private readonly appId;
|
|
7
|
+
private readonly apiSecret;
|
|
8
|
+
private readonly apiClientId;
|
|
9
|
+
private authResponse;
|
|
10
|
+
private authToken;
|
|
11
|
+
private isLive;
|
|
12
|
+
constructor(params: KeezConstructor);
|
|
13
|
+
/**
|
|
14
|
+
* Get the base domain for the API
|
|
15
|
+
* @returns {string} - The base domain
|
|
16
|
+
*/
|
|
17
|
+
getBaseDomain(): string;
|
|
18
|
+
private checkIfTokenIsValid;
|
|
19
|
+
private generateToken;
|
|
20
|
+
/**
|
|
21
|
+
* Set live mode
|
|
22
|
+
*
|
|
23
|
+
* @param {boolean} mode - `False` will use the staging mode and `True` will use the production mode
|
|
24
|
+
*/
|
|
25
|
+
setLive(mode: boolean): void;
|
|
26
|
+
/**
|
|
27
|
+
* Get all invoices with optional filtering and pagination
|
|
28
|
+
* @param params - Optional filter parameters
|
|
29
|
+
*/
|
|
30
|
+
getAllInvoices(params?: InvoiceFilterParams): Promise<import(".").AllInvoicesResponse>;
|
|
31
|
+
/**
|
|
32
|
+
* Get an invoice by its external ID
|
|
33
|
+
* @param invoiceExternalId - The external ID of the invoice
|
|
34
|
+
*/
|
|
35
|
+
getInvoiceByExternalId(invoiceExternalId: string): Promise<import(".").InvoiceResponse>;
|
|
36
|
+
/**
|
|
37
|
+
* Send an invoice via email
|
|
38
|
+
* @param email - The recipient email address
|
|
39
|
+
* @param invoiceExternalId - The external ID of the invoice
|
|
40
|
+
*/
|
|
41
|
+
sendInvoice(email: string, invoiceExternalId: string): Promise<string>;
|
|
42
|
+
/**
|
|
43
|
+
* Send an invoice via email with CC/BCC support
|
|
44
|
+
* @param emailParams - Email parameters including to, cc, and bcc
|
|
45
|
+
* @param invoiceExternalId - The external ID of the invoice
|
|
46
|
+
*/
|
|
47
|
+
sendInvoice(emailParams: SendInvoiceEmailParams, invoiceExternalId: string): Promise<string>;
|
|
48
|
+
/**
|
|
49
|
+
* Create a new invoice
|
|
50
|
+
* @param invoiceParams - The invoice parameters
|
|
51
|
+
*/
|
|
52
|
+
createInvoice(invoiceParams: InvoiceRequest): Promise<string>;
|
|
53
|
+
/**
|
|
54
|
+
* Validate an invoice
|
|
55
|
+
* @param invoiceExternalId - The external ID of the invoice
|
|
56
|
+
*/
|
|
57
|
+
validateInvoice(invoiceExternalId: string): Promise<string>;
|
|
58
|
+
/**
|
|
59
|
+
* Update an existing invoice
|
|
60
|
+
* @param invoiceId - The external ID of the invoice to update
|
|
61
|
+
* @param invoice - The updated invoice data
|
|
62
|
+
*/
|
|
63
|
+
updateInvoice(invoiceId: string, invoice: InvoiceRequestV2): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Delete an invoice
|
|
66
|
+
* @param invoiceId - The external ID of the invoice to delete
|
|
67
|
+
*/
|
|
68
|
+
deleteInvoice(invoiceId: string): Promise<void>;
|
|
69
|
+
/**
|
|
70
|
+
* Submit an invoice to eFactura (Romanian electronic invoicing system)
|
|
71
|
+
* @param invoiceId - The external ID of the invoice to submit
|
|
72
|
+
* @returns The upload index or confirmation from eFactura
|
|
73
|
+
*/
|
|
74
|
+
submitInvoiceToEfactura(invoiceId: string): Promise<string>;
|
|
75
|
+
/**
|
|
76
|
+
* Cancel an invoice
|
|
77
|
+
* @param invoiceId - The external ID of the invoice to cancel
|
|
78
|
+
*/
|
|
79
|
+
cancelInvoice(invoiceId: string): Promise<void>;
|
|
80
|
+
/**
|
|
81
|
+
* Download an invoice as PDF
|
|
82
|
+
* @param invoiceId - The external ID of the invoice
|
|
83
|
+
* @returns Buffer containing the PDF data
|
|
84
|
+
*/
|
|
85
|
+
downloadInvoicePdf(invoiceId: string): Promise<Buffer>;
|
|
86
|
+
/**
|
|
87
|
+
* Get all items with optional filtering and pagination
|
|
88
|
+
* @param params - Optional filter parameters
|
|
89
|
+
*/
|
|
90
|
+
getAllItems(params?: ItemFilterParams): Promise<AllItemsResponse>;
|
|
91
|
+
/**
|
|
92
|
+
* Get an item by its external ID
|
|
93
|
+
* @param itemId - The external ID of the item
|
|
94
|
+
*/
|
|
95
|
+
getItemByExternalId(itemId: string): Promise<ItemResponse>;
|
|
96
|
+
/**
|
|
97
|
+
* Create a new item
|
|
98
|
+
* @param item - The item data to create
|
|
99
|
+
* @returns The external ID of the created item
|
|
100
|
+
*/
|
|
101
|
+
createItem(item: CreateItemRequest): Promise<string>;
|
|
102
|
+
/**
|
|
103
|
+
* Update an existing item (full replacement)
|
|
104
|
+
* @param itemId - The external ID of the item to update
|
|
105
|
+
* @param item - The updated item data
|
|
106
|
+
*/
|
|
107
|
+
updateItem(itemId: string, item: UpdateItemRequest): Promise<void>;
|
|
108
|
+
/**
|
|
109
|
+
* Partially update an existing item
|
|
110
|
+
* @param itemId - The external ID of the item to patch
|
|
111
|
+
* @param item - The fields to update
|
|
112
|
+
*/
|
|
113
|
+
patchItem(itemId: string, item: PatchItemRequest): Promise<void>;
|
|
114
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "keez-invoicing",
|
|
3
|
+
"version": "1.1.5",
|
|
4
|
+
"description": "Keez API wrapper using Node",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/src/index.js",
|
|
7
|
+
"types": "dist/src/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsc && tsc-alias",
|
|
10
|
+
"format": "prettier --write \"src/**/*.(js|ts)\"",
|
|
11
|
+
"lint": "eslint src",
|
|
12
|
+
"lint:fix": "eslint src --fix",
|
|
13
|
+
"postversion": "git push && git push --tags",
|
|
14
|
+
"prepare": "npm run build",
|
|
15
|
+
"prepublishOnly": "npm test && npm run lint",
|
|
16
|
+
"preversion": "npm run lint",
|
|
17
|
+
"test": "jest --config jest.config.cjs",
|
|
18
|
+
"test:ci": "jest --coverage --ci --maxWorkers=2",
|
|
19
|
+
"test:coverage": "jest --coverage",
|
|
20
|
+
"test:e2e": "jest --testPathPatterns=e2e",
|
|
21
|
+
"test:integration": "jest --testPathPatterns=integration",
|
|
22
|
+
"test:unit": "jest --testPathPatterns=unit",
|
|
23
|
+
"test:watch": "jest --watch",
|
|
24
|
+
"version": "npm run format && git add -A src"
|
|
25
|
+
},
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/TPN-Labs/keez-node.git"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"keez",
|
|
32
|
+
"node",
|
|
33
|
+
"romania",
|
|
34
|
+
"efactura",
|
|
35
|
+
"typescript"
|
|
36
|
+
],
|
|
37
|
+
"author": "TPN LABS",
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"bugs": {
|
|
40
|
+
"url": "https://github.com/TPN-Labs/keez-node/issues"
|
|
41
|
+
},
|
|
42
|
+
"homepage": "https://github.com/TPN-Labs/keez-node#readme",
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@eslint/js": "^9.18.0",
|
|
45
|
+
"@types/jest": "^30.0.0",
|
|
46
|
+
"@typescript-eslint/eslint-plugin": "^8.20.0",
|
|
47
|
+
"@typescript-eslint/parser": "^8.20.0",
|
|
48
|
+
"eslint": "^9.39.2",
|
|
49
|
+
"eslint-plugin-jest": "^29.12.1",
|
|
50
|
+
"globals": "^17.0.0",
|
|
51
|
+
"typescript-eslint": "^8.20.0",
|
|
52
|
+
"jest": "^30.2.0",
|
|
53
|
+
"nock": "^14.0.10",
|
|
54
|
+
"prettier": "^3.4.2",
|
|
55
|
+
"ts-jest": "^29.2.5",
|
|
56
|
+
"tsc-alias": "^1.8.16",
|
|
57
|
+
"typescript": "^5.7.3"
|
|
58
|
+
},
|
|
59
|
+
"files": [
|
|
60
|
+
"dist/**/*"
|
|
61
|
+
],
|
|
62
|
+
"dependencies": {
|
|
63
|
+
"axios": "^1.7.9",
|
|
64
|
+
"winston": "^3.17.0"
|
|
65
|
+
}
|
|
66
|
+
}
|