@factpulse/sdk 3.0.36 → 4.0.0
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/.openapi-generator/FILES +2 -2
- package/CHANGELOG.md +10 -13
- package/README.md +135 -148
- package/dist/esm/models/{facture-electronique-rest-api-schemas-ereporting-invoice-type-code.d.ts → facture-electronique-models-invoice-type-code.d.ts} +67 -8
- package/dist/esm/models/{facture-electronique-rest-api-schemas-ereporting-invoice-type-code.js → facture-electronique-models-invoice-type-code.js} +66 -7
- package/dist/esm/models/index.d.ts +1 -1
- package/dist/esm/models/index.js +1 -1
- package/dist/esm/models/invoice-input.d.ts +2 -2
- package/dist/esm/models/invoice-type-code.d.ts +6 -65
- package/dist/esm/models/invoice-type-code.js +6 -65
- package/dist/esm/models/recipient.d.ts +1 -1
- package/dist/esm/models/scheme-id.d.ts +7 -7
- package/dist/esm/models/scheme-id.js +7 -7
- package/dist/esm/models/simplified-invoice-data.d.ts +2 -2
- package/dist/esm/models/submit-complete-invoice-response.d.ts +1 -1
- package/dist/esm/models/supplier.d.ts +1 -1
- package/dist/esm/src/helpers/client.d.ts +43 -265
- package/dist/esm/src/helpers/client.js +196 -779
- package/dist/esm/src/helpers/index.d.ts +1 -2
- package/dist/esm/src/helpers/index.js +1 -3
- package/dist/models/{facture-electronique-rest-api-schemas-ereporting-invoice-type-code.d.ts → facture-electronique-models-invoice-type-code.d.ts} +67 -8
- package/dist/models/{facture-electronique-rest-api-schemas-ereporting-invoice-type-code.js → facture-electronique-models-invoice-type-code.js} +67 -8
- package/dist/models/index.d.ts +1 -1
- package/dist/models/index.js +1 -1
- package/dist/models/invoice-input.d.ts +2 -2
- package/dist/models/invoice-type-code.d.ts +6 -65
- package/dist/models/invoice-type-code.js +6 -65
- package/dist/models/recipient.d.ts +1 -1
- package/dist/models/scheme-id.d.ts +7 -7
- package/dist/models/scheme-id.js +7 -7
- package/dist/models/simplified-invoice-data.d.ts +2 -2
- package/dist/models/submit-complete-invoice-response.d.ts +1 -1
- package/dist/models/supplier.d.ts +1 -1
- package/dist/src/helpers/client.d.ts +43 -265
- package/dist/src/helpers/client.js +199 -823
- package/dist/src/helpers/index.d.ts +1 -2
- package/dist/src/helpers/index.js +2 -12
- package/docs/FactureElectroniqueModelsInvoiceTypeCode.md +39 -0
- package/docs/InvoiceInput.md +1 -1
- package/docs/InvoiceTypeCode.md +6 -28
- package/docs/Recipient.md +1 -1
- package/docs/SchemeID.md +4 -4
- package/docs/SimplifiedInvoiceData.md +1 -1
- package/docs/SubmitCompleteInvoiceResponse.md +2 -2
- package/docs/Supplier.md +1 -1
- package/models/{facture-electronique-rest-api-schemas-ereporting-invoice-type-code.ts → facture-electronique-models-invoice-type-code.ts} +67 -8
- package/models/index.ts +1 -1
- package/models/invoice-input.ts +2 -2
- package/models/invoice-type-code.ts +6 -65
- package/models/recipient.ts +1 -1
- package/models/scheme-id.ts +7 -7
- package/models/simplified-invoice-data.ts +2 -2
- package/models/submit-complete-invoice-response.ts +1 -1
- package/models/supplier.ts +1 -1
- package/package.json +1 -1
- package/src/helpers/client.ts +211 -834
- package/src/helpers/index.ts +1 -3
- package/docs/FactureElectroniqueRestApiSchemasEreportingInvoiceTypeCode.md +0 -17
|
@@ -10,72 +10,13 @@
|
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Invoice type codes (UNTDID 1001).
|
|
14
14
|
*/
|
|
15
15
|
export declare const InvoiceTypeCode: {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
readonly
|
|
20
|
-
|
|
21
|
-
* Self-billed Invoice
|
|
22
|
-
*/
|
|
23
|
-
readonly SELF_BILLED_INVOICE: "389";
|
|
24
|
-
/**
|
|
25
|
-
* Factored Invoice
|
|
26
|
-
*/
|
|
27
|
-
readonly FACTORED_INVOICE: "393";
|
|
28
|
-
/**
|
|
29
|
-
* Self-billed Factored Invoice
|
|
30
|
-
*/
|
|
31
|
-
readonly SELF_BILLED_FACTORED_INVOICE: "501";
|
|
32
|
-
/**
|
|
33
|
-
* Prepayment Invoice
|
|
34
|
-
*/
|
|
35
|
-
readonly PREPAYMENT_INVOICE: "386";
|
|
36
|
-
/**
|
|
37
|
-
* Self-billed Prepayment Invoice
|
|
38
|
-
*/
|
|
39
|
-
readonly SELF_BILLED_PREPAYMENT_INVOICE: "500";
|
|
40
|
-
/**
|
|
41
|
-
* Corrective Invoice
|
|
42
|
-
*/
|
|
43
|
-
readonly CORRECTIVE_INVOICE: "384";
|
|
44
|
-
/**
|
|
45
|
-
* Self-billed Corrective Invoice
|
|
46
|
-
*/
|
|
47
|
-
readonly SELF_BILLED_CORRECTIVE_INVOICE: "471";
|
|
48
|
-
/**
|
|
49
|
-
* Factored Corrective Invoice
|
|
50
|
-
*/
|
|
51
|
-
readonly FACTORED_CORRECTIVE_INVOICE: "472";
|
|
52
|
-
/**
|
|
53
|
-
* Self-billed Factored Corrective Invoice
|
|
54
|
-
*/
|
|
55
|
-
readonly SELF_BILLED_FACTORED_CORRECTIVE_INVOICE: "473";
|
|
56
|
-
/**
|
|
57
|
-
* Credit Note
|
|
58
|
-
*/
|
|
59
|
-
readonly CREDIT_NOTE: "381";
|
|
60
|
-
/**
|
|
61
|
-
* Self-billed Credit Note
|
|
62
|
-
*/
|
|
63
|
-
readonly SELF_BILLED_CREDIT_NOTE: "261";
|
|
64
|
-
/**
|
|
65
|
-
* Global Allowance Credit Note
|
|
66
|
-
*/
|
|
67
|
-
readonly GLOBAL_ALLOWANCE_CREDIT_NOTE: "262";
|
|
68
|
-
/**
|
|
69
|
-
* Factored Credit Note
|
|
70
|
-
*/
|
|
71
|
-
readonly FACTORED_CREDIT_NOTE: "396";
|
|
72
|
-
/**
|
|
73
|
-
* Self-billed Factored Credit Note
|
|
74
|
-
*/
|
|
75
|
-
readonly SELF_BILLED_FACTORED_CREDIT_NOTE: "502";
|
|
76
|
-
/**
|
|
77
|
-
* Prepayment Credit Note
|
|
78
|
-
*/
|
|
79
|
-
readonly PREPAYMENT_CREDIT_NOTE: "503";
|
|
16
|
+
readonly _380: "380";
|
|
17
|
+
readonly _381: "381";
|
|
18
|
+
readonly _384: "384";
|
|
19
|
+
readonly _389: "389";
|
|
20
|
+
readonly _386: "386";
|
|
80
21
|
};
|
|
81
22
|
export type InvoiceTypeCode = typeof InvoiceTypeCode[keyof typeof InvoiceTypeCode];
|
|
@@ -12,71 +12,12 @@
|
|
|
12
12
|
* Do not edit the class manually.
|
|
13
13
|
*/
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Invoice type codes (UNTDID 1001).
|
|
16
16
|
*/
|
|
17
17
|
export const InvoiceTypeCode = {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
* Self-billed Invoice
|
|
24
|
-
*/
|
|
25
|
-
SELF_BILLED_INVOICE: '389',
|
|
26
|
-
/**
|
|
27
|
-
* Factored Invoice
|
|
28
|
-
*/
|
|
29
|
-
FACTORED_INVOICE: '393',
|
|
30
|
-
/**
|
|
31
|
-
* Self-billed Factored Invoice
|
|
32
|
-
*/
|
|
33
|
-
SELF_BILLED_FACTORED_INVOICE: '501',
|
|
34
|
-
/**
|
|
35
|
-
* Prepayment Invoice
|
|
36
|
-
*/
|
|
37
|
-
PREPAYMENT_INVOICE: '386',
|
|
38
|
-
/**
|
|
39
|
-
* Self-billed Prepayment Invoice
|
|
40
|
-
*/
|
|
41
|
-
SELF_BILLED_PREPAYMENT_INVOICE: '500',
|
|
42
|
-
/**
|
|
43
|
-
* Corrective Invoice
|
|
44
|
-
*/
|
|
45
|
-
CORRECTIVE_INVOICE: '384',
|
|
46
|
-
/**
|
|
47
|
-
* Self-billed Corrective Invoice
|
|
48
|
-
*/
|
|
49
|
-
SELF_BILLED_CORRECTIVE_INVOICE: '471',
|
|
50
|
-
/**
|
|
51
|
-
* Factored Corrective Invoice
|
|
52
|
-
*/
|
|
53
|
-
FACTORED_CORRECTIVE_INVOICE: '472',
|
|
54
|
-
/**
|
|
55
|
-
* Self-billed Factored Corrective Invoice
|
|
56
|
-
*/
|
|
57
|
-
SELF_BILLED_FACTORED_CORRECTIVE_INVOICE: '473',
|
|
58
|
-
/**
|
|
59
|
-
* Credit Note
|
|
60
|
-
*/
|
|
61
|
-
CREDIT_NOTE: '381',
|
|
62
|
-
/**
|
|
63
|
-
* Self-billed Credit Note
|
|
64
|
-
*/
|
|
65
|
-
SELF_BILLED_CREDIT_NOTE: '261',
|
|
66
|
-
/**
|
|
67
|
-
* Global Allowance Credit Note
|
|
68
|
-
*/
|
|
69
|
-
GLOBAL_ALLOWANCE_CREDIT_NOTE: '262',
|
|
70
|
-
/**
|
|
71
|
-
* Factored Credit Note
|
|
72
|
-
*/
|
|
73
|
-
FACTORED_CREDIT_NOTE: '396',
|
|
74
|
-
/**
|
|
75
|
-
* Self-billed Factored Credit Note
|
|
76
|
-
*/
|
|
77
|
-
SELF_BILLED_FACTORED_CREDIT_NOTE: '502',
|
|
78
|
-
/**
|
|
79
|
-
* Prepayment Credit Note
|
|
80
|
-
*/
|
|
81
|
-
PREPAYMENT_CREDIT_NOTE: '503'
|
|
18
|
+
_380: '380',
|
|
19
|
+
_381: '381',
|
|
20
|
+
_384: '384',
|
|
21
|
+
_389: '389',
|
|
22
|
+
_386: '386'
|
|
82
23
|
};
|
|
@@ -16,7 +16,7 @@ import type { PostalAddress } from './postal-address';
|
|
|
16
16
|
* Information about the invoice recipient / buyer (BG-7).
|
|
17
17
|
*/
|
|
18
18
|
export interface Recipient {
|
|
19
|
-
'electronic_address'
|
|
19
|
+
'electronic_address'?: ElectronicAddress | null;
|
|
20
20
|
'executing_service_code'?: string | null;
|
|
21
21
|
'name'?: string | null;
|
|
22
22
|
'siren'?: string | null;
|
|
@@ -10,21 +10,21 @@
|
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
12
|
/**
|
|
13
|
-
* Identification scheme codes (Electronic Address Scheme - EAS)
|
|
13
|
+
* Identification scheme codes (Electronic Address Scheme - EAS). **Electronic Address (routing for PDP/Chorus Pro):** - `0225`: FR_ELECTRONIC_ADDRESS - French electronic billing address (BT-34/BT-49) Format: SIREN or SIREN_SUFFIX (e.g., \"920195229_92019522900017\") **Legal Identifiers (entity identification):** - `0002`: FR_SIREN - French SIREN (9 digits) for BT-30/BT-47 - `0009`: FR_SIRET - French SIRET (14 digits) for BT-29/BT-46 **Other schemes:** - `0088`: GLN - Global Location Number - `0060`: DUNS - Data Universal Numbering System - `9957`: FR_VAT_INTRA - French intra-community VAT number - `0199`: GLEIF - Global Legal Entity Identifier Foundation - `0231`: DT_DIRECTORY_ID - Directory ID for tax administration - `EM`: EMAIL - Email-based electronic address
|
|
14
14
|
*/
|
|
15
15
|
export declare const SchemeID: {
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* FR_ELECTRONIC_ADDRESS - French electronic billing address (BT-34/BT-49)
|
|
18
18
|
*/
|
|
19
|
-
readonly
|
|
19
|
+
readonly FR_ELECTRONIC_ADDRESS: "0225";
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* FR_SIREN - French SIREN (9 digits) - Legal organization ID
|
|
22
22
|
*/
|
|
23
|
-
readonly
|
|
23
|
+
readonly FR_SIREN: "0002";
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* FR_SIRET - French SIRET (14 digits) - Establishment ID
|
|
26
26
|
*/
|
|
27
|
-
readonly
|
|
27
|
+
readonly FR_SIRET: "0009";
|
|
28
28
|
/**
|
|
29
29
|
* GLN - Global Location Number (GLN)
|
|
30
30
|
*/
|
|
@@ -12,21 +12,21 @@
|
|
|
12
12
|
* Do not edit the class manually.
|
|
13
13
|
*/
|
|
14
14
|
/**
|
|
15
|
-
* Identification scheme codes (Electronic Address Scheme - EAS)
|
|
15
|
+
* Identification scheme codes (Electronic Address Scheme - EAS). **Electronic Address (routing for PDP/Chorus Pro):** - `0225`: FR_ELECTRONIC_ADDRESS - French electronic billing address (BT-34/BT-49) Format: SIREN or SIREN_SUFFIX (e.g., \"920195229_92019522900017\") **Legal Identifiers (entity identification):** - `0002`: FR_SIREN - French SIREN (9 digits) for BT-30/BT-47 - `0009`: FR_SIRET - French SIRET (14 digits) for BT-29/BT-46 **Other schemes:** - `0088`: GLN - Global Location Number - `0060`: DUNS - Data Universal Numbering System - `9957`: FR_VAT_INTRA - French intra-community VAT number - `0199`: GLEIF - Global Legal Entity Identifier Foundation - `0231`: DT_DIRECTORY_ID - Directory ID for tax administration - `EM`: EMAIL - Email-based electronic address
|
|
16
16
|
*/
|
|
17
17
|
export const SchemeID = {
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* FR_ELECTRONIC_ADDRESS - French electronic billing address (BT-34/BT-49)
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
FR_ELECTRONIC_ADDRESS: '0225',
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* FR_SIREN - French SIREN (9 digits) - Legal organization ID
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
FR_SIREN: '0002',
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* FR_SIRET - French SIRET (14 digits) - Establishment ID
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
FR_SIRET: '0009',
|
|
30
30
|
/**
|
|
31
31
|
* GLN - Global Location Number (GLN)
|
|
32
32
|
*/
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* https://openapi-generator.tech
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
|
-
import type {
|
|
12
|
+
import type { FactureElectroniqueModelsInvoiceTypeCode } from './facture-electronique-models-invoice-type-code';
|
|
13
13
|
import type { InvoicingFrameworkCode } from './invoicing-framework-code';
|
|
14
14
|
import type { OperationNature } from './operation-nature';
|
|
15
15
|
/**
|
|
@@ -49,7 +49,7 @@ export interface SimplifiedInvoiceData {
|
|
|
49
49
|
/**
|
|
50
50
|
* Document type (UNTDID 1001). Default: 380 (Invoice).
|
|
51
51
|
*/
|
|
52
|
-
'invoiceType'?:
|
|
52
|
+
'invoiceType'?: FactureElectroniqueModelsInvoiceTypeCode;
|
|
53
53
|
'precedingInvoiceReference'?: string | null;
|
|
54
54
|
'operationNature'?: OperationNature | null;
|
|
55
55
|
'invoicingFramework'?: InvoicingFrameworkCode | null;
|
|
@@ -16,7 +16,7 @@ import type { PostalAddress } from './postal-address';
|
|
|
16
16
|
* Information about the supplier / seller (BG-4).
|
|
17
17
|
*/
|
|
18
18
|
export interface Supplier {
|
|
19
|
-
'electronic_address'
|
|
19
|
+
'electronic_address'?: ElectronicAddress | null;
|
|
20
20
|
'supplier_id': number;
|
|
21
21
|
'private_id'?: string | null;
|
|
22
22
|
'supplier_bank_account_code'?: number | null;
|
|
@@ -1,278 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
chorusProLogin: string;
|
|
6
|
-
chorusProPassword: string;
|
|
7
|
-
sandbox?: boolean;
|
|
8
|
-
}
|
|
9
|
-
/** AFNOR PDP credentials for Zero-Trust mode. The FactPulse API uses these credentials to authenticate with the AFNOR PDP. */
|
|
10
|
-
export interface AFNORCredentials {
|
|
11
|
-
flowServiceUrl: string;
|
|
12
|
-
tokenUrl: string;
|
|
13
|
-
clientId: string;
|
|
14
|
-
clientSecret: string;
|
|
15
|
-
directoryServiceUrl?: string;
|
|
1
|
+
export declare class FactPulseError extends Error {
|
|
2
|
+
statusCode?: number;
|
|
3
|
+
details?: unknown[];
|
|
4
|
+
constructor(message: string, statusCode?: number, details?: unknown[]);
|
|
16
5
|
}
|
|
17
6
|
export interface FactPulseClientConfig {
|
|
18
7
|
email: string;
|
|
19
8
|
password: string;
|
|
9
|
+
clientUid: string;
|
|
20
10
|
apiUrl?: string;
|
|
21
|
-
|
|
22
|
-
chorusCredentials?: ChorusProCredentials;
|
|
23
|
-
afnorCredentials?: AFNORCredentials;
|
|
24
|
-
pollingInterval?: number;
|
|
11
|
+
timeout?: number;
|
|
25
12
|
pollingTimeout?: number;
|
|
26
13
|
maxRetries?: number;
|
|
27
14
|
}
|
|
28
|
-
type AmountValue = string | number | null | undefined;
|
|
29
|
-
/** Converts a value to an amount string for the API. */
|
|
30
|
-
export declare function amount(value: AmountValue): string;
|
|
31
|
-
/** Creates a simplified InvoiceTotals object. */
|
|
32
|
-
export declare function invoiceTotals(exclTax: AmountValue, vat: AmountValue, inclTax: AmountValue, amountDue: AmountValue, options?: {
|
|
33
|
-
globalAllowanceAmount?: AmountValue;
|
|
34
|
-
globalAllowanceReason?: string;
|
|
35
|
-
prepayment?: AmountValue;
|
|
36
|
-
}): Record<string, unknown>;
|
|
37
|
-
/** Creates an invoice line (aligned with InvoiceLine in models.py).
|
|
38
|
-
* For VAT rate: either vatRate (code e.g.: "VAT20") or manualVatRate (value e.g.: 20.00) */
|
|
39
|
-
export declare function invoiceLine(lineNumber: number, itemName: string, quantity: AmountValue, unitNetPrice: AmountValue, lineNetAmount: AmountValue, options?: {
|
|
40
|
-
vatRate?: string;
|
|
41
|
-
manualVatRate?: AmountValue;
|
|
42
|
-
vatCategory?: string;
|
|
43
|
-
unit?: string;
|
|
44
|
-
reference?: string;
|
|
45
|
-
lineAllowanceAmount?: AmountValue;
|
|
46
|
-
allowanceReasonCode?: string;
|
|
47
|
-
allowanceReason?: string;
|
|
48
|
-
periodStartDate?: string;
|
|
49
|
-
periodEndDate?: string;
|
|
50
|
-
}): Record<string, unknown>;
|
|
51
|
-
/** Creates a VAT line (aligned with VATLine in models.py).
|
|
52
|
-
* For rate: either rate (code e.g.: "VAT20") or manualRate (value e.g.: 20.00) */
|
|
53
|
-
export declare function vatLine(taxableAmount: AmountValue, vatAmount: AmountValue, options?: {
|
|
54
|
-
rate?: string;
|
|
55
|
-
manualRate?: AmountValue;
|
|
56
|
-
category?: string;
|
|
57
|
-
}): Record<string, unknown>;
|
|
58
|
-
/** Creates a postal address for the FactPulse API. */
|
|
59
|
-
export declare function postalAddress(lineOne: string, postalCode: string, city: string, options?: {
|
|
60
|
-
countryCode?: string;
|
|
61
|
-
lineTwo?: string;
|
|
62
|
-
lineThree?: string;
|
|
63
|
-
}): Record<string, unknown>;
|
|
64
|
-
/** Creates an electronic address for the FactPulse API. schemeId: "0009"=SIREN, "0225"=SIRET */
|
|
65
|
-
export declare function electronicAddress(identifier: string, schemeId?: string): Record<string, unknown>;
|
|
66
|
-
/** Creates a supplier (issuer) with auto-computed SIREN, intra-EU VAT number and addresses. */
|
|
67
|
-
export declare function supplier(name: string, siret: string, addressLine1: string, postalCode: string, city: string, options?: {
|
|
68
|
-
supplierId?: number;
|
|
69
|
-
siren?: string;
|
|
70
|
-
vatNumber?: string;
|
|
71
|
-
iban?: string;
|
|
72
|
-
countryCode?: string;
|
|
73
|
-
addressLine2?: string;
|
|
74
|
-
supplierServiceId?: number;
|
|
75
|
-
supplierBankDetailsCode?: number;
|
|
76
|
-
}): Record<string, unknown>;
|
|
77
|
-
/** Creates a recipient (customer) with auto-computed SIREN and addresses. */
|
|
78
|
-
export declare function recipient(name: string, siret: string, addressLine1: string, postalCode: string, city: string, options?: {
|
|
79
|
-
siren?: string;
|
|
80
|
-
countryCode?: string;
|
|
81
|
-
addressLine2?: string;
|
|
82
|
-
executingServiceCode?: string;
|
|
83
|
-
}): Record<string, unknown>;
|
|
84
|
-
/**
|
|
85
|
-
* Creates a beneficiary (factor) for factoring.
|
|
86
|
-
*
|
|
87
|
-
* The beneficiary (BG-10 / PayeeTradeParty) is used when payment
|
|
88
|
-
* must be made to a third party different from the supplier, typically
|
|
89
|
-
* a factor (factoring company).
|
|
90
|
-
*
|
|
91
|
-
* For factored invoices, you also need to:
|
|
92
|
-
* - Use a factored document type (393, 396, 501, 502, 472, 473)
|
|
93
|
-
* - Add an ACC note with the subrogation mention
|
|
94
|
-
* - The beneficiary's IBAN will be used for payment
|
|
95
|
-
*
|
|
96
|
-
* @param name Factor's business name (BT-59)
|
|
97
|
-
* @param options Options: siret (BT-60), siren (BT-61), iban, bic
|
|
98
|
-
* @returns Dict ready to be used in a factored invoice
|
|
99
|
-
*
|
|
100
|
-
* @example
|
|
101
|
-
* const factor = beneficiary('FACTOR SAS', {
|
|
102
|
-
* siret: '30000000700033',
|
|
103
|
-
* iban: 'FR76 3000 4000 0500 0012 3456 789',
|
|
104
|
-
* });
|
|
105
|
-
*/
|
|
106
|
-
export declare function beneficiary(name: string, options?: {
|
|
107
|
-
siret?: string;
|
|
108
|
-
siren?: string;
|
|
109
|
-
iban?: string;
|
|
110
|
-
bic?: string;
|
|
111
|
-
}): Record<string, unknown>;
|
|
112
15
|
export declare class FactPulseClient {
|
|
113
|
-
private
|
|
114
|
-
private
|
|
115
|
-
private
|
|
116
|
-
private
|
|
16
|
+
private readonly apiUrl;
|
|
17
|
+
private readonly email;
|
|
18
|
+
private readonly password;
|
|
19
|
+
private readonly clientUid;
|
|
20
|
+
private readonly timeout;
|
|
21
|
+
private readonly pollingTimeout;
|
|
22
|
+
private readonly httpClient;
|
|
23
|
+
private token;
|
|
117
24
|
private tokenExpiresAt;
|
|
118
|
-
readonly chorusCredentials?: ChorusProCredentials;
|
|
119
|
-
readonly afnorCredentials?: AFNORCredentials;
|
|
120
25
|
constructor(config: FactPulseClientConfig);
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
/** Gets a facility by SIRET in the AFNOR directory. */
|
|
151
|
-
getSiretAfnor(siret: string): Promise<Record<string, unknown>>;
|
|
152
|
-
/** Gets a legal unit by SIREN in the AFNOR directory. */
|
|
153
|
-
getSirenAfnor(siren: string): Promise<Record<string, unknown>>;
|
|
154
|
-
/** Searches for legal units (SIREN) in the AFNOR directory. */
|
|
155
|
-
searchSirenAfnor(options?: {
|
|
156
|
-
filters?: Record<string, unknown>;
|
|
157
|
-
limit?: number;
|
|
158
|
-
}): Promise<Record<string, unknown>>;
|
|
159
|
-
/** Searches for routing codes in the AFNOR directory. */
|
|
160
|
-
searchRoutingCodesAfnor(options?: {
|
|
161
|
-
filters?: Record<string, unknown>;
|
|
162
|
-
limit?: number;
|
|
163
|
-
}): Promise<Record<string, unknown>>;
|
|
164
|
-
/** Gets a routing code by SIRET and routing identifier. */
|
|
165
|
-
getRoutingCodeAfnor(siret: string, routingIdentifier: string): Promise<Record<string, unknown>>;
|
|
166
|
-
/**
|
|
167
|
-
* Submits an invoice to a PDP via the AFNOR API.
|
|
168
|
-
* Authentication uses the AFNOR OAuth token (obtained automatically),
|
|
169
|
-
* either via stored credentials (stored mode), or via the afnorCredentials
|
|
170
|
-
* provided to the constructor (zero-trust mode).
|
|
171
|
-
*
|
|
172
|
-
* @param pdfBuffer Buffer of the Factur-X PDF to submit
|
|
173
|
-
* @param flowName Flow name (e.g.: "Invoice INV-2025-001")
|
|
174
|
-
* @param options Options: trackingId, flowSyntax (CII/UBL), flowProfile
|
|
175
|
-
*/
|
|
176
|
-
submitInvoiceAfnor(pdfBuffer: Buffer, flowName: string, options?: {
|
|
177
|
-
trackingId?: string;
|
|
178
|
-
flowSyntax?: string;
|
|
179
|
-
flowProfile?: string;
|
|
180
|
-
}): Promise<Record<string, unknown>>;
|
|
181
|
-
searchFlowsAfnor(criteria?: {
|
|
182
|
-
trackingId?: string;
|
|
183
|
-
status?: string;
|
|
184
|
-
offset?: number;
|
|
185
|
-
limit?: number;
|
|
186
|
-
}): Promise<Record<string, unknown>>;
|
|
187
|
-
downloadFlowAfnor(flowId: string): Promise<Buffer>;
|
|
188
|
-
/**
|
|
189
|
-
* Retrieves JSON metadata of an incoming flow (supplier invoice).
|
|
190
|
-
* Downloads an incoming flow from the AFNOR PDP and extracts invoice
|
|
191
|
-
* metadata into a unified JSON format. Supports Factur-X, CII and UBL.
|
|
192
|
-
*
|
|
193
|
-
* Note: This endpoint uses FactPulse JWT authentication (not AFNOR OAuth).
|
|
194
|
-
* The FactPulse server handles calling the PDP with stored credentials.
|
|
195
|
-
*
|
|
196
|
-
* @param flowId Flow identifier (UUID)
|
|
197
|
-
* @param includeDocument If true, includes the original document encoded in base64
|
|
198
|
-
* @returns Invoice metadata (supplier, amounts, dates, etc.)
|
|
199
|
-
*
|
|
200
|
-
* @example
|
|
201
|
-
* const invoice = await client.getIncomingInvoiceAfnor("550e8400-...");
|
|
202
|
-
* console.log(`Supplier: ${invoice.supplier.name}`);
|
|
203
|
-
* console.log(`Total incl. tax: ${invoice.total_incl_tax} ${invoice.currency}`);
|
|
204
|
-
*/
|
|
205
|
-
getIncomingInvoiceAfnor(flowId: string, includeDocument?: boolean): Promise<Record<string, unknown>>;
|
|
206
|
-
healthcheckAfnor(): Promise<Record<string, unknown>>;
|
|
207
|
-
rechercherStructureChorus(criteria: Record<string, unknown>): Promise<unknown[]>;
|
|
208
|
-
consulterStructureChorus(idStructureCpp: number): Promise<Record<string, unknown>>;
|
|
209
|
-
/**
|
|
210
|
-
* Lists the services of a Chorus Pro structure.
|
|
211
|
-
* @param idStructureCpp Chorus Pro ID of the structure
|
|
212
|
-
* @returns Object with listeServices, total, codeRetour, libelle
|
|
213
|
-
*/
|
|
214
|
-
listerServicesStructureChorus(idStructureCpp: number): Promise<Record<string, unknown>>;
|
|
215
|
-
obtenirIdChorusDepuisSiret(siret: string): Promise<number | null>;
|
|
216
|
-
submitInvoiceChorus(invoiceData: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
217
|
-
lookupInvoiceChorus(invoiceIdCpp: number): Promise<Record<string, unknown>>;
|
|
218
|
-
/**
|
|
219
|
-
* Validates a Factur-X PDF.
|
|
220
|
-
* @param pdfBuffer - PDF content as Buffer
|
|
221
|
-
* @param options - Validation options
|
|
222
|
-
* @param options.profile - Factur-X profile (MINIMUM, BASIC, EN16931, EXTENDED). If not specified, auto-detected.
|
|
223
|
-
* @param options.useVerapdf - Enable strict PDF/A validation with VeraPDF (default: false)
|
|
224
|
-
*/
|
|
225
|
-
validateFacturxPdf(pdfBuffer: Buffer, options?: {
|
|
226
|
-
profile?: string;
|
|
227
|
-
useVerapdf?: boolean;
|
|
228
|
-
}): Promise<Record<string, unknown>>;
|
|
229
|
-
validateFacturxXml(xmlContent: string, profile?: string): Promise<Record<string, unknown>>;
|
|
230
|
-
validatePdfSignature(pdfBuffer: Buffer): Promise<Record<string, unknown>>;
|
|
231
|
-
/**
|
|
232
|
-
* Signs a PDF with the server-configured certificate (via JWT client_uid).
|
|
233
|
-
* The certificate must be previously configured in Django Admin.
|
|
234
|
-
*/
|
|
235
|
-
signPdf(pdfBuffer: Buffer, options?: {
|
|
236
|
-
reason?: string;
|
|
237
|
-
location?: string;
|
|
238
|
-
contact?: string;
|
|
239
|
-
usePadesLt?: boolean;
|
|
240
|
-
useTimestamp?: boolean;
|
|
241
|
-
}): Promise<Buffer>;
|
|
242
|
-
/**
|
|
243
|
-
* Generates a test certificate (NOT FOR PRODUCTION).
|
|
244
|
-
* The certificate must then be configured in Django Admin.
|
|
245
|
-
*/
|
|
246
|
-
generateTestCertificate(options?: {
|
|
247
|
-
cn?: string;
|
|
248
|
-
organisation?: string;
|
|
249
|
-
email?: string;
|
|
250
|
-
validityDays?: number;
|
|
251
|
-
keySize?: number;
|
|
252
|
-
}): Promise<Record<string, unknown>>;
|
|
253
|
-
/**
|
|
254
|
-
* Complete workflow: generation + validation + signature + AFNOR submission.
|
|
255
|
-
* Note: Signature uses the server-configured certificate (via JWT client_uid).
|
|
256
|
-
* @param invoiceData Invoice data
|
|
257
|
-
* @param pdfPath Path to the source PDF
|
|
258
|
-
* @param options Workflow options
|
|
259
|
-
* @returns Result with pdfBuffer, validation, signature and afnor
|
|
260
|
-
*/
|
|
261
|
-
generateCompleteFacturx(invoiceData: Record<string, unknown>, pdfPath: string, options?: {
|
|
262
|
-
profile?: string;
|
|
263
|
-
validate?: boolean;
|
|
264
|
-
sign?: boolean;
|
|
265
|
-
submitAfnor?: boolean;
|
|
266
|
-
afnorFlowName?: string;
|
|
267
|
-
afnorTrackingId?: string;
|
|
268
|
-
timeout?: number;
|
|
269
|
-
}): Promise<{
|
|
270
|
-
pdfBuffer: Buffer;
|
|
271
|
-
validation?: Record<string, unknown>;
|
|
272
|
-
signature?: {
|
|
273
|
-
signed: boolean;
|
|
274
|
-
};
|
|
275
|
-
afnor?: Record<string, unknown>;
|
|
276
|
-
}>;
|
|
26
|
+
/** POST request to /api/v1/{path} */
|
|
27
|
+
post(path: string, data?: Record<string, unknown>): Promise<unknown>;
|
|
28
|
+
/** GET request to /api/v1/{path} */
|
|
29
|
+
get(path: string, params?: Record<string, unknown>): Promise<unknown>;
|
|
30
|
+
get processing(): Endpoint;
|
|
31
|
+
get chorus_pro(): Endpoint;
|
|
32
|
+
get afnor(): Endpoint;
|
|
33
|
+
private _endpoint;
|
|
34
|
+
_request(method: 'GET' | 'POST', path: string, data?: Record<string, unknown>): Promise<unknown>;
|
|
35
|
+
private _doRequest;
|
|
36
|
+
private _parseResponse;
|
|
37
|
+
private _poll;
|
|
38
|
+
private _ensureAuth;
|
|
39
|
+
private _refreshToken;
|
|
40
|
+
private _invalidateToken;
|
|
41
|
+
}
|
|
42
|
+
declare class Endpoint {
|
|
43
|
+
private client;
|
|
44
|
+
private path;
|
|
45
|
+
constructor(client: FactPulseClient, path: string);
|
|
46
|
+
private _child;
|
|
47
|
+
get invoices(): Endpoint;
|
|
48
|
+
get structures(): Endpoint;
|
|
49
|
+
get tasks(): Endpoint;
|
|
50
|
+
get validate_facturx_pdf(): Endpoint;
|
|
51
|
+
get submit_complete_async(): Endpoint;
|
|
52
|
+
[key: string]: unknown;
|
|
53
|
+
call(data?: Record<string, unknown>): Promise<unknown>;
|
|
54
|
+
get(params?: Record<string, unknown>): Promise<unknown>;
|
|
277
55
|
}
|
|
278
56
|
export {};
|