fiscalapi 1.0.0 → 4.0.141

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 (2) hide show
  1. package/README.md +23 -19
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -40,10 +40,10 @@ Puedes usar el SDK tanto en aplicaciones Node.js tradicionales como en framework
40
40
  1. **Crea tu objeto de configuración** con [tus credenciales](https://docs.fiscalapi.com/credentials-info):
41
41
  ```javascript
42
42
  // CommonJS
43
- const { FiscalApiClient } = require('fiscalapi');
43
+ const { FiscalapiClient } = require('fiscalapi');
44
44
 
45
45
  // o ESM
46
- import { FiscalApiClient } from 'fiscalapi';
46
+ import { FiscalapiClient } from 'fiscalapi';
47
47
 
48
48
  const settings = {
49
49
  apiUrl: "https://test.fiscalapi.com", // https://live.fiscalapi.com (producción)
@@ -54,10 +54,10 @@ Puedes usar el SDK tanto en aplicaciones Node.js tradicionales como en framework
54
54
 
55
55
  2. **Crea la instancia del cliente**:
56
56
  ```javascript
57
- const fiscalApi = FiscalApiClient.create(settings);
57
+ const fiscalApi = FiscalapiClient.create(settings);
58
58
  ```
59
59
 
60
- Para ejemplos completos, consulta [samples-nodejs](https://github.com/FiscalAPI/fiscalapi-samples-node).
60
+ Para ejemplos completos, consulta [samples-express](https://github.com/FiscalAPI/fiscalapi-samples-express).
61
61
 
62
62
  ---
63
63
 
@@ -65,21 +65,23 @@ Para ejemplos completos, consulta [samples-nodejs](https://github.com/FiscalAPI/
65
65
 
66
66
  1. **Agrega la configuración** en tu archivo de variables de entorno (`.env`):
67
67
  ```
68
- FISCALAPI_URL=https://test.fiscalapi.com
69
- FISCALAPI_KEY=<YourApiKeyHere>
70
- FISCALAPI_TENANT=<YourTenantHere>
68
+ FISCALAPI_API_KEY=<api_key>
69
+ FISCALAPI_TENANT=<tenant>
70
+ FISCALAPI_API_URL=https://test.fiscalapi.com
71
71
  ```
72
72
 
73
73
  2. **Crea y registra el cliente** (por ejemplo, en un servicio o módulo):
74
+
74
75
  ```typescript
75
- // services/fiscalapi.service.ts
76
- import { FiscalApiClient } from 'fiscalapi';
77
-
78
- export const createFiscalApiClient = () => {
79
- return FiscalApiClient.create({
80
- apiUrl: process.env.FISCALAPI_URL,
81
- apiKey: process.env.FISCALAPI_KEY,
82
- tenant: process.env.FISCALAPI_TENANT
76
+ // services/fiscalapi.service.ts
77
+ import { FiscalapiClient } from 'fiscalapi'
78
+ import config from '../config/config';
79
+
80
+ export const createFiscalApiClient = () => {
81
+ return FiscalapiClient.create({
82
+ apiUrl: config.fiscalapiSettings.apiUrl,
83
+ apiKey: config.fiscalapiSettings.apiKey,
84
+ tenant: config.fiscalapiSettings.tenant
83
85
  });
84
86
  };
85
87
  ```
@@ -87,11 +89,13 @@ Para ejemplos completos, consulta [samples-nodejs](https://github.com/FiscalAPI/
87
89
  En Express:
88
90
  ```javascript
89
91
  // En tu controlador o router
90
- const fiscalApi = createFiscalApiClient();
92
+ import { createFiscalApiClient } from '../services/fiscalapi.service';
93
+
94
+ const fiscalapi = createFiscalApiClient();
91
95
 
92
96
  app.post('/invoices', async (req, res) => {
93
97
  try {
94
- const response = await fiscalApi.invoices.create(req.body);
98
+ const response = await fiscalapi.invoices.create(req.body);
95
99
  res.json(response);
96
100
  } catch (error) {
97
101
  res.status(500).json({ error: error.message });
@@ -99,7 +103,7 @@ app.post('/invoices', async (req, res) => {
99
103
  });
100
104
  ```
101
105
 
102
- Para más ejemplos, revisa [samples-express](https://github.com/FiscalAPI/fiscalapi-samples-node-express).
106
+ Para más ejemplos, revisa [samples-express](https://github.com/FiscalAPI/fiscalapi-samples-express).
103
107
 
104
108
 
105
109
  ## 🔄 Modos de Operación
@@ -385,4 +389,4 @@ Este proyecto está licenciado bajo la Licencia **MPL-2.0**. Consulta el archivo
385
389
 
386
390
  ---
387
391
 
388
- Desarrollado con ❤️ por [Fiscalapi](https://www.fiscalapi.com)
392
+ Desarrollado con ❤️ por [Fiscalapi](https://www.fiscalapi.com)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fiscalapi",
3
- "version": "1.0.0",
3
+ "version": "4.0.141",
4
4
  "description": "SDK de Node.js para FiscalAPI",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",