n8n-nodes-afipsdk 1.0.5 → 1.1.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.
Files changed (41) hide show
  1. package/README.md +29 -0
  2. package/dist/credentials/FacturaSdkApi.credentials.d.ts +10 -0
  3. package/dist/credentials/FacturaSdkApi.credentials.js +55 -0
  4. package/dist/credentials/FacturaSdkApi.credentials.js.map +1 -0
  5. package/dist/icons/facturasdk.dark.svg +10 -0
  6. package/dist/icons/facturasdk.svg +10 -0
  7. package/dist/nodes/FacturaSdk/FacturaSdk.node.d.ts +5 -0
  8. package/dist/nodes/FacturaSdk/FacturaSdk.node.js +102 -0
  9. package/dist/nodes/FacturaSdk/FacturaSdk.node.js.map +1 -0
  10. package/dist/nodes/FacturaSdk/FacturaSdk.node.json +13 -0
  11. package/dist/nodes/FacturaSdk/resources/automation.d.ts +4 -0
  12. package/dist/nodes/FacturaSdk/resources/automation.js +40 -0
  13. package/dist/nodes/FacturaSdk/resources/automation.js.map +1 -0
  14. package/dist/nodes/FacturaSdk/resources/certificate.d.ts +4 -0
  15. package/dist/nodes/FacturaSdk/resources/certificate.js +113 -0
  16. package/dist/nodes/FacturaSdk/resources/certificate.js.map +1 -0
  17. package/dist/nodes/FacturaSdk/resources/invoice.d.ts +4 -0
  18. package/dist/nodes/FacturaSdk/resources/invoice.js +153 -0
  19. package/dist/nodes/FacturaSdk/resources/invoice.js.map +1 -0
  20. package/dist/nodes/FacturaSdk/resources/issuer.d.ts +4 -0
  21. package/dist/nodes/FacturaSdk/resources/issuer.js +193 -0
  22. package/dist/nodes/FacturaSdk/resources/issuer.js.map +1 -0
  23. package/dist/nodes/FacturaSdk/resources/webhookEndpoint.d.ts +4 -0
  24. package/dist/nodes/FacturaSdk/resources/webhookEndpoint.js +124 -0
  25. package/dist/nodes/FacturaSdk/resources/webhookEndpoint.js.map +1 -0
  26. package/dist/nodes/FacturaSdk/shared/fields.d.ts +5 -0
  27. package/dist/nodes/FacturaSdk/shared/fields.js +81 -0
  28. package/dist/nodes/FacturaSdk/shared/fields.js.map +1 -0
  29. package/dist/nodes/FacturaSdk/shared/request.d.ts +15 -0
  30. package/dist/nodes/FacturaSdk/shared/request.js +160 -0
  31. package/dist/nodes/FacturaSdk/shared/request.js.map +1 -0
  32. package/dist/nodes/FacturaSdk/shared/signature.d.ts +1 -0
  33. package/dist/nodes/FacturaSdk/shared/signature.js +30 -0
  34. package/dist/nodes/FacturaSdk/shared/signature.js.map +1 -0
  35. package/dist/nodes/FacturaSdkTrigger/FacturaSdkTrigger.node.d.ts +5 -0
  36. package/dist/nodes/FacturaSdkTrigger/FacturaSdkTrigger.node.js +100 -0
  37. package/dist/nodes/FacturaSdkTrigger/FacturaSdkTrigger.node.js.map +1 -0
  38. package/dist/nodes/FacturaSdkTrigger/FacturaSdkTrigger.node.json +13 -0
  39. package/dist/package.json +7 -3
  40. package/dist/tsconfig.tsbuildinfo +1 -1
  41. package/package.json +7 -3
package/README.md CHANGED
@@ -47,8 +47,30 @@ Search for `n8n-nodes-afipsdk` in the community nodes panel.
47
47
  |-----------|-------------|
48
48
  | **Get XML From Last Request** | Returns the raw XML of the last request/response pair. Useful for debugging or sending to ARCA support. |
49
49
 
50
+ ## Factura SDK
51
+
52
+ [Factura SDK](https://afipsdk.com/docs/facturasdk/) issues electronic invoices end to end: issuers, certificates, authorization in ARCA, PDF and webhooks. The package includes two nodes for it, which use the **Factura SDK API** credential (`facturaSdkApi`): the access token of a Factura SDK project (`fsk_dev_…` for the sandbox, `fsk_prod_…` for production) and, for the trigger, the secret of your webhook endpoint.
53
+
54
+ ### Factura SDK node
55
+
56
+ | Resource | Operations |
57
+ |----------|------------|
58
+ | **Invoice** | Create (with `Idempotency-Key` and an optional wait for the final status), Get, Get Many, Cancel |
59
+ | **Issuer** | Create, Get, Get Many, Update, Delete, Lookup (registration data of a CUIT), Get Sales Points, Create Sales Point, Create Certificate, Accept Delegation, Verify |
60
+ | **Certificate** | Create (upload or create in ARCA), Get, Get Many, Revoke, Renew (upload or in ARCA, keeping its ID), Delete, Authorize |
61
+ | **Webhook Endpoint** | Create, Get, Get Many, Update, Rotate Secret, Test, Get Deliveries |
62
+ | **Automation** | Get, with an optional wait until it finishes |
63
+
64
+ The operations that start an automation in ARCA (sales points, certificates created with the tax password, delegation, verification) wait for its result by default; turn off **Wait For Result** to get the automation ID and check it later. Bodies are sent as JSON, exactly as in the [documentation](https://afipsdk.com/docs/facturasdk/invoices). API errors come with the message, the rules that were not met and the problems by field.
65
+
66
+ ### Factura SDK Trigger node
67
+
68
+ Starts the workflow when Factura SDK sends the result of an invoice: `invoice.approved`, `invoice.rejected` or `invoice.failed` (and `test`, if you select it). Create a webhook endpoint in Factura SDK with the production URL of the node (from the dashboard, *Configuración → Webhooks*, or with the Factura SDK node) and save its secret in the credential: the node verifies the `X-FacturaSDK-Signature` of every delivery and rejects the invalid ones. Factura SDK accepts one active endpoint per environment, so the node does not create it by itself.
69
+
50
70
  ## Credentials
51
71
 
72
+ ### Afip SDK API
73
+
52
74
  This node requires an **Afip SDK API** credential (`afipSdkApi`).
53
75
 
54
76
  To set up credentials:
@@ -56,6 +78,13 @@ To set up credentials:
56
78
  2. In n8n, go to **Settings → Credentials → New** and search for *Afip SDK*.
57
79
  3. Enter your API key and save.
58
80
 
81
+ ### Factura SDK API
82
+
83
+ The Factura SDK nodes require a **Factura SDK API** credential (`facturaSdkApi`):
84
+ 1. In [app.afipsdk.com](https://app.afipsdk.com/), create a project of type Factura SDK and, in *Configuración → Access tokens*, a token of the environment you want to use.
85
+ 2. In n8n, go to **Settings → Credentials → New** and search for *Factura SDK*.
86
+ 3. Enter the access token and, if you use the trigger, the secret of your webhook endpoint.
87
+
59
88
  ## Compatibility
60
89
 
61
90
  - Tested with n8n `1.x`.
@@ -0,0 +1,10 @@
1
+ import type { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class FacturaSdkApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ icon: ICredentialType['icon'];
6
+ documentationUrl: string;
7
+ properties: INodeProperties[];
8
+ authenticate: IAuthenticateGeneric;
9
+ test: ICredentialTestRequest;
10
+ }
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FacturaSdkApi = void 0;
4
+ class FacturaSdkApi {
5
+ constructor() {
6
+ this.name = 'facturaSdkApi';
7
+ this.displayName = 'Factura SDK API';
8
+ this.icon = {
9
+ light: 'file:../icons/facturasdk.svg',
10
+ dark: 'file:../icons/facturasdk.dark.svg',
11
+ };
12
+ this.documentationUrl = 'https://afipsdk.com/docs/facturasdk/access-tokens';
13
+ this.properties = [
14
+ {
15
+ displayName: 'Access Token',
16
+ name: 'accessToken',
17
+ type: 'string',
18
+ typeOptions: { password: true },
19
+ default: '',
20
+ description: 'Access token of a Factura SDK project. It decides the environment: fsk_dev_… works in the sandbox, fsk_prod_… issues real invoices.',
21
+ },
22
+ {
23
+ displayName: 'Webhook Secret',
24
+ name: 'webhookSecret',
25
+ type: 'string',
26
+ typeOptions: { password: true },
27
+ default: '',
28
+ description: 'Secret of the webhook endpoint (whsec_…), used by the Factura SDK Trigger node to verify the signature of each event',
29
+ },
30
+ {
31
+ displayName: 'Base URL',
32
+ name: 'baseUrl',
33
+ type: 'string',
34
+ default: 'https://app.afipsdk.com/api/v1',
35
+ },
36
+ ];
37
+ this.authenticate = {
38
+ type: 'generic',
39
+ properties: {
40
+ headers: {
41
+ Authorization: '=Bearer {{$credentials.accessToken}}',
42
+ },
43
+ },
44
+ };
45
+ this.test = {
46
+ request: {
47
+ baseURL: '={{$credentials.baseUrl}}',
48
+ url: '/issuers',
49
+ qs: { limit: 1 },
50
+ },
51
+ };
52
+ }
53
+ }
54
+ exports.FacturaSdkApi = FacturaSdkApi;
55
+ //# sourceMappingURL=FacturaSdkApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FacturaSdkApi.credentials.js","sourceRoot":"","sources":["../../credentials/FacturaSdkApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,aAAa;IAA1B;QACC,SAAI,GAAG,eAAe,CAAC;QAEvB,gBAAW,GAAG,iBAAiB,CAAC;QAEhC,SAAI,GAA4B;YAC/B,KAAK,EAAE,8BAA8B;YACrC,IAAI,EAAE,mCAAmC;SACzC,CAAC;QAEF,qBAAgB,GAAG,mDAAmD,CAAC;QAEvE,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,cAAc;gBAC3B,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,WAAW,EACV,qIAAqI;aACtI;YACD;gBACC,WAAW,EAAE,gBAAgB;gBAC7B,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,WAAW,EACV,sHAAsH;aACvH;YACD;gBACC,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,gCAAgC;aACzC;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,aAAa,EAAE,sCAAsC;iBACrD;aACD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,2BAA2B;gBACpC,GAAG,EAAE,UAAU;gBACf,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE;aAChB;SACD,CAAC;IACH,CAAC;CAAA;AAvDD,sCAuDC"}
@@ -0,0 +1,10 @@
1
+ <svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <defs><radialGradient id="ra" cx="50%" cy="50%" r="100%" fx="50%" fy="0%" gradientUnits="objectBoundingBox"><stop stop-color="#695BF8"/><stop offset="1" stop-color="#131308"/></radialGradient></defs>
3
+ <rect width="512" height="512" rx="115" fill="url(#ra)"/>
4
+ <g transform="translate(96 96) scale(13.3333)" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
5
+ <path d="M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z"/>
6
+ <path d="M14 8H8"/>
7
+ <path d="M16 12H8"/>
8
+ <path d="M13 16H8"/>
9
+ </g>
10
+ </svg>
@@ -0,0 +1,10 @@
1
+ <svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <defs><radialGradient id="ra" cx="50%" cy="50%" r="100%" fx="50%" fy="0%" gradientUnits="objectBoundingBox"><stop stop-color="#695BF8"/><stop offset="1" stop-color="#131308"/></radialGradient></defs>
3
+ <rect width="512" height="512" rx="115" fill="url(#ra)"/>
4
+ <g transform="translate(96 96) scale(13.3333)" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
5
+ <path d="M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z"/>
6
+ <path d="M14 8H8"/>
7
+ <path d="M16 12H8"/>
8
+ <path d="M13 16H8"/>
9
+ </g>
10
+ </svg>
@@ -0,0 +1,5 @@
1
+ import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class FacturaSdk implements INodeType {
3
+ description: INodeTypeDescription;
4
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
5
+ }
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FacturaSdk = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const automation_1 = require("./resources/automation");
6
+ const certificate_1 = require("./resources/certificate");
7
+ const invoice_1 = require("./resources/invoice");
8
+ const issuer_1 = require("./resources/issuer");
9
+ const webhookEndpoint_1 = require("./resources/webhookEndpoint");
10
+ const executors = {
11
+ automation: automation_1.automationExecute,
12
+ certificate: certificate_1.certificateExecute,
13
+ invoice: invoice_1.invoiceExecute,
14
+ issuer: issuer_1.issuerExecute,
15
+ webhookEndpoint: webhookEndpoint_1.webhookEndpointExecute,
16
+ };
17
+ class FacturaSdk {
18
+ constructor() {
19
+ this.description = {
20
+ displayName: 'Factura SDK',
21
+ name: 'facturaSdk',
22
+ icon: { light: 'file:../../icons/facturasdk.svg', dark: 'file:../../icons/facturasdk.dark.svg' },
23
+ group: ['transform'],
24
+ version: 1,
25
+ subtitle: '={{ $parameter["resource"] + ": " + $parameter["operation"] }}',
26
+ description: 'Issue electronic invoices end to end with Factura SDK: issuers, certificates, invoices and webhooks',
27
+ defaults: {
28
+ name: 'Factura SDK',
29
+ },
30
+ inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
31
+ outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
32
+ credentials: [
33
+ {
34
+ name: 'facturaSdkApi',
35
+ required: true,
36
+ },
37
+ ],
38
+ properties: [
39
+ {
40
+ displayName: 'Resource',
41
+ name: 'resource',
42
+ type: 'options',
43
+ noDataExpression: true,
44
+ options: [
45
+ { name: 'Automation', value: 'automation' },
46
+ { name: 'Certificate', value: 'certificate' },
47
+ { name: 'Invoice', value: 'invoice' },
48
+ { name: 'Issuer', value: 'issuer' },
49
+ { name: 'Webhook Endpoint', value: 'webhookEndpoint' },
50
+ ],
51
+ default: 'invoice',
52
+ },
53
+ invoice_1.invoiceOperations,
54
+ issuer_1.issuerOperations,
55
+ certificate_1.certificateOperations,
56
+ webhookEndpoint_1.webhookEndpointOperations,
57
+ automation_1.automationOperations,
58
+ ...invoice_1.invoiceFields,
59
+ ...issuer_1.issuerFields,
60
+ ...certificate_1.certificateFields,
61
+ ...webhookEndpoint_1.webhookEndpointFields,
62
+ ...automation_1.automationFields,
63
+ ],
64
+ usableAsTool: true,
65
+ };
66
+ }
67
+ async execute() {
68
+ const resource = this.getNodeParameter('resource', 0);
69
+ const operation = this.getNodeParameter('operation', 0);
70
+ const items = this.getInputData();
71
+ const returnData = [];
72
+ const executor = executors[resource];
73
+ if (!executor) {
74
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Resource "${resource}" not supported`);
75
+ }
76
+ for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
77
+ try {
78
+ const result = await executor.call(this, operation, itemIndex);
79
+ const responseItems = this.helpers.returnJsonArray(result);
80
+ returnData.push(...responseItems.map((item) => ({ ...item, pairedItem: { item: itemIndex } })));
81
+ }
82
+ catch (error) {
83
+ if (this.continueOnFail()) {
84
+ returnData.push({
85
+ json: { error: error.message },
86
+ pairedItem: { item: itemIndex },
87
+ });
88
+ }
89
+ else {
90
+ if (error.context) {
91
+ error.context.itemIndex = itemIndex;
92
+ throw error;
93
+ }
94
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, { itemIndex });
95
+ }
96
+ }
97
+ }
98
+ return [returnData];
99
+ }
100
+ }
101
+ exports.FacturaSdk = FacturaSdk;
102
+ //# sourceMappingURL=FacturaSdk.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FacturaSdk.node.js","sourceRoot":"","sources":["../../../nodes/FacturaSdk/FacturaSdk.node.ts"],"names":[],"mappings":";;;AAOA,+CAAuE;AACvE,uDAAmG;AACnG,yDAIiC;AACjC,iDAAuF;AACvF,+CAAmF;AACnF,iEAIqC;AAQrC,MAAM,SAAS,GAAoC;IAClD,UAAU,EAAE,8BAAiB;IAC7B,WAAW,EAAE,gCAAkB;IAC/B,OAAO,EAAE,wBAAc;IACvB,MAAM,EAAE,sBAAa;IACrB,eAAe,EAAE,wCAAsB;CACvC,CAAC;AAEF,MAAa,UAAU;IAAvB;QACC,gBA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AAM,CAAC;oBACP,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;wBACnB,KAAK,CAAC,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;wBACpC,MAAM,KAAK,CAAC;oBACb,CAAC;oBACD,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;gBACpE,CAAC;YACF,CAAC;QACF,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AA3FD,gCA2FC"}
@@ -0,0 +1,13 @@
1
+ {
2
+ "node": "n8n-nodes-afipsdk.facturaSdk",
3
+ "nodeVersion": "1.0",
4
+ "codexVersion": "1.0",
5
+ "categories": ["Finance"],
6
+ "resources": {
7
+ "primaryDocumentation": [
8
+ {
9
+ "url": "https://afipsdk.com/docs/facturasdk/"
10
+ }
11
+ ]
12
+ }
13
+ }
@@ -0,0 +1,4 @@
1
+ import type { IDataObject, IExecuteFunctions, INodeProperties } from 'n8n-workflow';
2
+ export declare const automationOperations: INodeProperties;
3
+ export declare const automationFields: INodeProperties[];
4
+ export declare function automationExecute(this: IExecuteFunctions, operation: string, itemIndex: number): Promise<IDataObject>;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.automationFields = exports.automationOperations = void 0;
4
+ exports.automationExecute = automationExecute;
5
+ const fields_1 = require("../shared/fields");
6
+ const request_1 = require("../shared/request");
7
+ const RESOURCE = 'automation';
8
+ exports.automationOperations = {
9
+ displayName: 'Operation',
10
+ name: 'operation',
11
+ type: 'options',
12
+ noDataExpression: true,
13
+ displayOptions: { show: { resource: [RESOURCE] } },
14
+ options: [
15
+ {
16
+ name: 'Get',
17
+ value: 'get',
18
+ action: 'Get an automation',
19
+ description: 'Get an automation started by another operation (a certificate created in ARCA, a verification) and, if you want, wait until it finishes',
20
+ },
21
+ ],
22
+ default: 'get',
23
+ };
24
+ exports.automationFields = [
25
+ (0, fields_1.idField)(RESOURCE, ['get'], 'automationId', 'Automation ID', 'ID of the automation'),
26
+ ...(0, fields_1.waitFields)(RESOURCE, ['get']),
27
+ ];
28
+ async function automationExecute(operation, itemIndex) {
29
+ if (operation === 'get') {
30
+ const automationId = this.getNodeParameter('automationId', itemIndex);
31
+ const wait = this.getNodeParameter('wait', itemIndex, true);
32
+ const secondsToWait = this.getNodeParameter('secondsToWait', itemIndex, 3);
33
+ if (wait) {
34
+ return (0, request_1.waitForAutomation)(this, automationId, secondsToWait, itemIndex);
35
+ }
36
+ return (0, request_1.facturaSdkRequest)(this, 'GET', `automations/${automationId}`);
37
+ }
38
+ throw new Error(`Operation "${operation}" not supported`);
39
+ }
40
+ //# sourceMappingURL=automation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"automation.js","sourceRoot":"","sources":["../../../../nodes/FacturaSdk/resources/automation.ts"],"names":[],"mappings":";;;AA6BA,8CAkBC;AA9CD,6CAAuD;AACvD,+CAAyE;AAEzE,MAAM,QAAQ,GAAG,YAAY,CAAC;AAEjB,QAAA,oBAAoB,GAAoB;IACpD,WAAW,EAAE,WAAW;IACxB,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,SAAS;IACf,gBAAgB,EAAE,IAAI;IACtB,cAAc,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE;IAClD,OAAO,EAAE;QACR;YACC,IAAI,EAAE,KAAK;YACX,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,mBAAmB;YAC3B,WAAW,EACV,yIAAyI;SAC1I;KACD;IACD,OAAO,EAAE,KAAK;CACd,CAAC;AAEW,QAAA,gBAAgB,GAAsB;IAClD,IAAA,gBAAO,EAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,cAAc,EAAE,eAAe,EAAE,sBAAsB,CAAC;IACnF,GAAG,IAAA,mBAAU,EAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC;CAChC,CAAC;AAEK,KAAK,UAAU,iBAAiB,CAEtC,SAAiB,EACjB,SAAiB;IAEjB,IAAI,SAAS,KAAK,KAAK,EAAE,CAAC;QACzB,MAAM,YAAY,GAAG,IAAI,CAAC,gBAAgB,CAAC,cAAc,EAAE,SAAS,CAAW,CAAC;QAChF,MAAM,IAAI,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,CAAY,CAAC;QACvE,MAAM,aAAa,GAAG,IAAI,CAAC,gBAAgB,CAAC,eAAe,EAAE,SAAS,EAAE,CAAC,CAAW,CAAC;QAErF,IAAI,IAAI,EAAE,CAAC;YACV,OAAO,IAAA,2BAAiB,EAAC,IAAI,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;QACxE,CAAC;QAED,OAAO,IAAA,2BAAiB,EAAC,IAAI,EAAE,KAAK,EAAE,eAAe,YAAY,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,cAAc,SAAS,iBAAiB,CAAC,CAAC;AAC3D,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { IDataObject, IExecuteFunctions, INodeProperties } from 'n8n-workflow';
2
+ export declare const certificateOperations: INodeProperties;
3
+ export declare const certificateFields: INodeProperties[];
4
+ export declare function certificateExecute(this: IExecuteFunctions, operation: string, itemIndex: number): Promise<IDataObject | IDataObject[]>;
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.certificateFields = exports.certificateOperations = void 0;
4
+ exports.certificateExecute = certificateExecute;
5
+ const fields_1 = require("../shared/fields");
6
+ const request_1 = require("../shared/request");
7
+ const RESOURCE = 'certificate';
8
+ exports.certificateOperations = {
9
+ displayName: 'Operation',
10
+ name: 'operation',
11
+ type: 'options',
12
+ noDataExpression: true,
13
+ displayOptions: { show: { resource: [RESOURCE] } },
14
+ options: [
15
+ {
16
+ name: 'Authorize',
17
+ value: 'authorize',
18
+ action: 'Authorize a certificate for wsfe',
19
+ description: 'Authorize in ARCA a certificate for the electronic billing web service (wsfe), with the tax password of its owner',
20
+ },
21
+ {
22
+ name: 'Create',
23
+ value: 'create',
24
+ action: 'Create a certificate',
25
+ description: 'Upload a certificate (cert and key in PEM) or create one in ARCA (source automation, with the tax password)',
26
+ },
27
+ {
28
+ name: 'Delete',
29
+ value: 'delete',
30
+ action: 'Delete a certificate',
31
+ description: 'Delete a certificate: it disappears from the project without being revoked in ARCA. The issuers that used it keep their reference.',
32
+ },
33
+ {
34
+ name: 'Get',
35
+ value: 'get',
36
+ action: 'Get a certificate',
37
+ },
38
+ {
39
+ name: 'Get Many',
40
+ value: 'getAll',
41
+ action: 'Get many certificates',
42
+ },
43
+ {
44
+ name: 'Renew',
45
+ value: 'renew',
46
+ action: 'Renew a certificate',
47
+ description: 'Renew a certificate in place, keeping its ID: upload the new cert and key in PEM, or renew it in ARCA (source automation, with the tax password). A revoked certificate can not be renewed.',
48
+ },
49
+ {
50
+ name: 'Revoke',
51
+ value: 'revoke',
52
+ action: 'Revoke a certificate',
53
+ description: 'Revoke a certificate: it no longer signs',
54
+ },
55
+ ],
56
+ default: 'create',
57
+ };
58
+ exports.certificateFields = [
59
+ (0, fields_1.idField)(RESOURCE, ['get', 'revoke', 'renew', 'delete', 'authorize'], 'certificateId', 'Certificate ID', 'ID of the certificate'),
60
+ (0, fields_1.bodyField)(RESOURCE, 'create', { tax_id: '20111111112', cert: 'VALID_CERT', key: 'VALID_KEY' }),
61
+ (0, fields_1.bodyField)(RESOURCE, 'renew', { cert: 'VALID_CERT', key: 'VALID_KEY' }),
62
+ (0, fields_1.bodyField)(RESOURCE, 'authorize', { password: '<CLAVE_FISCAL>' }),
63
+ ...(0, fields_1.waitFields)(RESOURCE, ['create', 'renew', 'authorize']),
64
+ ...(0, fields_1.listFields)(RESOURCE, 'getAll', [
65
+ {
66
+ displayName: 'Tax ID (CUIT)',
67
+ name: 'tax_id',
68
+ type: 'string',
69
+ default: '',
70
+ description: 'CUIT that owns the certificate',
71
+ },
72
+ {
73
+ displayName: 'Status',
74
+ name: 'status',
75
+ type: 'options',
76
+ default: 'active',
77
+ options: [
78
+ { name: 'Active', value: 'active' },
79
+ { name: 'Expired', value: 'expired' },
80
+ { name: 'Revoked', value: 'revoked' },
81
+ ],
82
+ },
83
+ ]),
84
+ ];
85
+ async function certificateExecute(operation, itemIndex) {
86
+ const certificateId = () => this.getNodeParameter('certificateId', itemIndex);
87
+ if (operation === 'create' || operation === 'renew' || operation === 'authorize') {
88
+ const path = operation === 'create' ? 'certificates' : `certificates/${certificateId()}/${operation}`;
89
+ const wait = this.getNodeParameter('wait', itemIndex, true);
90
+ const secondsToWait = this.getNodeParameter('secondsToWait', itemIndex, 3);
91
+ const result = await (0, request_1.facturaSdkRequest)(this, 'POST', path, {
92
+ body: (0, request_1.parseBody)(this, itemIndex),
93
+ });
94
+ return (0, request_1.resolveAutomation)(this, result, wait, secondsToWait, itemIndex);
95
+ }
96
+ if (operation === 'get') {
97
+ return (0, request_1.facturaSdkRequest)(this, 'GET', `certificates/${certificateId()}`);
98
+ }
99
+ if (operation === 'getAll') {
100
+ const returnAll = this.getNodeParameter('returnAll', itemIndex);
101
+ const limit = returnAll ? 0 : this.getNodeParameter('limit', itemIndex);
102
+ return (0, request_1.listAll)(this, 'certificates', (0, request_1.readFilters)(this, itemIndex), returnAll, limit);
103
+ }
104
+ if (operation === 'revoke') {
105
+ return (0, request_1.facturaSdkRequest)(this, 'POST', `certificates/${certificateId()}/revoke`);
106
+ }
107
+ if (operation === 'delete') {
108
+ await (0, request_1.facturaSdkRequest)(this, 'DELETE', `certificates/${certificateId()}`);
109
+ return { success: true };
110
+ }
111
+ throw new Error(`Operation "${operation}" not supported`);
112
+ }
113
+ //# sourceMappingURL=certificate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"certificate.js","sourceRoot":"","sources":["../../../../nodes/FacturaSdk/resources/certificate.ts"],"names":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IAAI,EAAE,MAAM,EAAE,gBAAgB,aAAa,EAAE,SAAS,CAAC,CAAC;IAClF,CAAC;IAED,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;QAC5B,MAAM,IAAA,2BAAiB,EAAC,IAAI,EAAE,QAAQ,EAAE,gBAAgB,aAAa,EAAE,EAAE,CAAC,CAAC;QAE3E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC1B,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,cAAc,SAAS,iBAAiB,CAAC,CAAC;AAC3D,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { IDataObject, IExecuteFunctions, INodeProperties } from 'n8n-workflow';
2
+ export declare const invoiceOperations: INodeProperties;
3
+ export declare const invoiceFields: INodeProperties[];
4
+ export declare function invoiceExecute(this: IExecuteFunctions, operation: string, itemIndex: number): Promise<IDataObject | IDataObject[]>;
@@ -0,0 +1,153 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.invoiceFields = exports.invoiceOperations = void 0;
4
+ exports.invoiceExecute = invoiceExecute;
5
+ const fields_1 = require("../shared/fields");
6
+ const request_1 = require("../shared/request");
7
+ const RESOURCE = 'invoice';
8
+ exports.invoiceOperations = {
9
+ displayName: 'Operation',
10
+ name: 'operation',
11
+ type: 'options',
12
+ noDataExpression: true,
13
+ displayOptions: { show: { resource: [RESOURCE] } },
14
+ options: [
15
+ {
16
+ name: 'Cancel',
17
+ value: 'cancel',
18
+ action: 'Cancel an invoice',
19
+ description: 'Cancel an invoice that is still queued, so it never gets issued',
20
+ },
21
+ {
22
+ name: 'Create',
23
+ value: 'create',
24
+ action: 'Create an invoice',
25
+ description: 'Issue an invoice: Factura SDK answers right away with it queued and the result arrives at your webhook',
26
+ },
27
+ {
28
+ name: 'Get',
29
+ value: 'get',
30
+ action: 'Get an invoice',
31
+ description: 'Get an invoice with its current status',
32
+ },
33
+ {
34
+ name: 'Get Many',
35
+ value: 'getAll',
36
+ action: 'Get many invoices',
37
+ description: 'List invoices, newest first',
38
+ },
39
+ ],
40
+ default: 'create',
41
+ };
42
+ exports.invoiceFields = [
43
+ (0, fields_1.bodyField)(RESOURCE, 'create', {
44
+ issuer_cuit: '20111111112',
45
+ invoice_type: 6,
46
+ concept: 1,
47
+ receiver: {
48
+ doc_type: 96,
49
+ doc_number: '12345678',
50
+ vat_condition: 5,
51
+ name: 'Juan Pérez',
52
+ address: 'Calle Falsa 123, CABA',
53
+ },
54
+ amounts: { net: 1000, vat: 210, total: 1210 },
55
+ vat_items: [{ id: 5, base: 1000, amount: 210 }],
56
+ items: [{ description: 'Teclado inalámbrico', quantity: 1, unit_price: 1210, subtotal: 1210 }],
57
+ sale_condition: 'Contado',
58
+ }),
59
+ {
60
+ displayName: 'Idempotency Key',
61
+ name: 'idempotencyKey',
62
+ type: 'string',
63
+ default: '',
64
+ description: 'Identifier of the sale in your system. Repeating it returns the same invoice instead of issuing another one.',
65
+ displayOptions: { show: { resource: [RESOURCE], operation: ['create'] } },
66
+ },
67
+ {
68
+ displayName: 'Wait For Result',
69
+ name: 'wait',
70
+ type: 'boolean',
71
+ default: false,
72
+ description: 'Whether to wait until the invoice is approved, rejected or failed instead of returning it queued',
73
+ displayOptions: { show: { resource: [RESOURCE], operation: ['create', 'get'] } },
74
+ },
75
+ (0, fields_1.idField)(RESOURCE, ['get', 'cancel'], 'invoiceId', 'Invoice ID', 'ID of the invoice'),
76
+ ...(0, fields_1.listFields)(RESOURCE, 'getAll', [
77
+ {
78
+ displayName: 'Issuer CUIT',
79
+ name: 'issuer_cuit',
80
+ type: 'string',
81
+ default: '',
82
+ },
83
+ {
84
+ displayName: 'Status',
85
+ name: 'status',
86
+ type: 'options',
87
+ default: 'approved',
88
+ options: [
89
+ { name: 'Approved', value: 'approved' },
90
+ { name: 'Cancelled', value: 'cancelled' },
91
+ { name: 'Failed', value: 'failed' },
92
+ { name: 'Processing', value: 'processing' },
93
+ { name: 'Queued', value: 'queued' },
94
+ { name: 'Rejected', value: 'rejected' },
95
+ ],
96
+ },
97
+ {
98
+ displayName: 'Invoice Type',
99
+ name: 'invoice_type',
100
+ type: 'number',
101
+ default: 6,
102
+ description: 'Type of invoice as in ARCA: 1 Factura A, 6 Factura B, 11 Factura C…',
103
+ },
104
+ {
105
+ displayName: 'Created From',
106
+ name: 'start',
107
+ type: 'string',
108
+ default: '',
109
+ placeholder: '2026-10-01T00:00:00.000Z',
110
+ description: 'Creation date from, as a full ISO 8601 date and time',
111
+ },
112
+ {
113
+ displayName: 'Created To',
114
+ name: 'end',
115
+ type: 'string',
116
+ default: '',
117
+ placeholder: '2026-10-31T23:59:59.999Z',
118
+ description: 'Creation date to, as a full ISO 8601 date and time',
119
+ },
120
+ ]),
121
+ ];
122
+ async function invoiceExecute(operation, itemIndex) {
123
+ if (operation === 'create') {
124
+ const body = (0, request_1.parseBody)(this, itemIndex);
125
+ const idempotencyKey = this.getNodeParameter('idempotencyKey', itemIndex, '');
126
+ const wait = this.getNodeParameter('wait', itemIndex, false);
127
+ const headers = idempotencyKey ? { 'Idempotency-Key': idempotencyKey } : undefined;
128
+ const invoice = await (0, request_1.facturaSdkRequest)(this, 'POST', 'invoices', { body, headers });
129
+ if (wait && (0, request_1.isPendingInvoice)(invoice)) {
130
+ return (0, request_1.waitForInvoice)(this, invoice.id, itemIndex);
131
+ }
132
+ return invoice;
133
+ }
134
+ if (operation === 'get') {
135
+ const invoiceId = this.getNodeParameter('invoiceId', itemIndex);
136
+ const wait = this.getNodeParameter('wait', itemIndex, false);
137
+ if (wait) {
138
+ return (0, request_1.waitForInvoice)(this, invoiceId, itemIndex);
139
+ }
140
+ return (0, request_1.facturaSdkRequest)(this, 'GET', `invoices/${invoiceId}`);
141
+ }
142
+ if (operation === 'getAll') {
143
+ const returnAll = this.getNodeParameter('returnAll', itemIndex);
144
+ const limit = returnAll ? 0 : this.getNodeParameter('limit', itemIndex);
145
+ return (0, request_1.listAll)(this, 'invoices', (0, request_1.readFilters)(this, itemIndex), returnAll, limit);
146
+ }
147
+ if (operation === 'cancel') {
148
+ const invoiceId = this.getNodeParameter('invoiceId', itemIndex);
149
+ return (0, request_1.facturaSdkRequest)(this, 'POST', `invoices/${invoiceId}/cancel`);
150
+ }
151
+ throw new Error(`Operation "${operation}" not supported`);
152
+ }
153
+ //# sourceMappingURL=invoice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoice.js","sourceRoot":"","sources":["../../../../nodes/FacturaSdk/resources/invoice.ts"],"names":[],"mappings":";;;AAoIA,wCA6CC;AAhLD,6CAAkE;AAClE,+CAO2B;AAE3B,MAAM,QAAQ,GAAG,SAAS,CAAC;AAEd,QAAA,iBAAiB,GAAoB;IACjD,WAAW,EAAE,WAAW;IACxB,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,SAAS;IACf,gBAAgB,EAAE,IAAI;IACtB,cAAc,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE;IAClD,OAAO,EAAE;QACR;YACC,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,QAAQ;YACf,MAAM,EAAE,mBAAmB;YAC3B,WAAW,EAAE,iEAAiE;SAC9E;QACD;YACC,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,QAAQ;YACf,MAAM,EAAE,mBAAmB;YAC3B,WAAW,EACV,wGAAwG;SACzG;QACD;YACC,IAAI,EAAE,KAAK;YACX,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,gBAAgB;YACxB,WAAW,EAAE,wCAAwC;SACrD;QACD;YACC,IAAI,EAAE,UAAU;YAChB,KAAK,EAAE,QAAQ;YACf,MAAM,EAAE,mBAAmB;YAC3B,WAAW,EAAE,6BAA6B;SAC1C;KACD;IACD,OAAO,EAAE,QAAQ;CACjB,CAAC;AAEW,QAAA,aAAa,GAAsB;IAC/C,IAAA,kBAAS,EAAC,QAAQ,EAAE,QAAQ,EAAE;QAC7B,WAAW,EAAE,aAAa;QAC1B,YA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AC3E,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAE,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAY,CAAC;QAEpF,OAAO,IAAA,iBAAO,EAAC,IAAI,EAAE,UAAU,EAAE,IAAA,qBAAW,EAAC,IAAI,EAAE,SAAS,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAClF,CAAC;IAED,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;QAC5B,MAAM,SAAS,GAAG,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,SAAS,CAAW,CAAC;QAE1E,OAAO,IAAA,2BAAiB,EAAC,IAAI,EAAE,MAAM,EAAE,YAAY,SAAS,SAAS,CAAC,CAAC;IACxE,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,cAAc,SAAS,iBAAiB,CAAC,CAAC;AAC3D,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { IDataObject, IExecuteFunctions, INodeProperties } from 'n8n-workflow';
2
+ export declare const issuerOperations: INodeProperties;
3
+ export declare const issuerFields: INodeProperties[];
4
+ export declare function issuerExecute(this: IExecuteFunctions, operation: string, itemIndex: number): Promise<IDataObject | IDataObject[]>;