@stackin-io/stackin-node-sdk 0.2.0 → 0.4.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/README.md +94 -0
- package/dist/client.d.ts +33 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +82 -16
- package/dist/client.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -90,6 +90,100 @@ await client.issue({
|
|
|
90
90
|
|
|
91
91
|
`items` is an array of `br.Product` — `description`/`amount` apply to any document type; `ncm`/`cfop` (plus everything else on `Product`: `cest`, tax groups, presumed credits...) are Brazil-specific and required per item for NFE, ignored for NFSE (a service isn't a physical good).
|
|
92
92
|
|
|
93
|
+
## Retrying safely
|
|
94
|
+
|
|
95
|
+
Issuing is the one call you must not repeat blindly. If the response is lost — a
|
|
96
|
+
timeout, a dropped connection — the document may well have been authorized, and a
|
|
97
|
+
second attempt issues a **second** fiscal document: another credit, another number
|
|
98
|
+
burned, and undoing it means cancelling, which has a deadline.
|
|
99
|
+
|
|
100
|
+
Pass an idempotency key to make the retry safe:
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
const key = randomUUID();
|
|
104
|
+
|
|
105
|
+
const result = await invoice.issue({
|
|
106
|
+
documentType: DocumentType.NFSE,
|
|
107
|
+
clientName: "Maria Silva",
|
|
108
|
+
taxId: "12345678909",
|
|
109
|
+
items: [new br.Product({ description: "Consultoria", amount: 1500.0 })],
|
|
110
|
+
idempotencyKey: key,
|
|
111
|
+
});
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Retry with the **same key and the same body** and you get the first response back,
|
|
115
|
+
replayed — no second document, no credit consumed. Reissue takes the same argument.
|
|
116
|
+
|
|
117
|
+
| Situation | What the API does |
|
|
118
|
+
|---|---|
|
|
119
|
+
| New key | issues normally, records the response |
|
|
120
|
+
| Same key, same body | replays the recorded response |
|
|
121
|
+
| Same key, different body | API error 422 |
|
|
122
|
+
| Same key, first call still running | API error 409 |
|
|
123
|
+
| Previous attempt failed | key is released — the retry issues |
|
|
124
|
+
| Key older than 24 hours | treated as new |
|
|
125
|
+
|
|
126
|
+
Generate the key yourself and keep it for as long as you might retry — one UUID per
|
|
127
|
+
business event, not per HTTP call. The SDK never generates one, because a key minted
|
|
128
|
+
per call would protect nothing, and because two genuinely separate invoices for the
|
|
129
|
+
same customer and amount on the same day are a normal thing to issue.
|
|
130
|
+
|
|
131
|
+
## Correcting a document
|
|
132
|
+
|
|
133
|
+
Some mistakes don't need a cancellation. A wrong product name, wrong
|
|
134
|
+
transport details, a typo in the extra information — a **CC-e** (carta de
|
|
135
|
+
correção) fixes those, and it is free: no new credit, no burned series
|
|
136
|
+
number, no reissue.
|
|
137
|
+
|
|
138
|
+
```ts
|
|
139
|
+
const result = await invoice.correct(
|
|
140
|
+
"35240912345678000199550010000000011000000017",
|
|
141
|
+
{
|
|
142
|
+
documentType: DocumentType.NFE,
|
|
143
|
+
correction: "Transportadora corrigida para Rapido Ltda",
|
|
144
|
+
}
|
|
145
|
+
);
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
The correction text is 15 to 1000 characters, checked locally before the call.
|
|
149
|
+
|
|
150
|
+
What a CC-e **cannot** fix: anything that changes the tax owed (base, rate,
|
|
151
|
+
price, quantity, totals), the buyer or the seller, or the issue date. Those
|
|
152
|
+
still mean cancelling and reissuing. The API sends the legally fixed wording
|
|
153
|
+
that says exactly this, attached to every correction.
|
|
154
|
+
|
|
155
|
+
The original document does not change — the CC-e is an event attached to it, and
|
|
156
|
+
the authorized XML stays as it was. A document accepts at most 20 of them, and
|
|
157
|
+
they are numbered for you.
|
|
158
|
+
|
|
159
|
+
**NF-e only.** NFS-e has no correction letter, and asking for one returns
|
|
160
|
+
a `409`.
|
|
161
|
+
|
|
162
|
+
## Invalidating unused numbers
|
|
163
|
+
|
|
164
|
+
NF-e numbering is sequential and the SEFAZ expects it to have no gaps. A number
|
|
165
|
+
gets reserved the moment issuing starts, so a submission that fails afterwards —
|
|
166
|
+
a rejection, a timeout — leaves a hole in the series. Reporting that range is how
|
|
167
|
+
you close it.
|
|
168
|
+
|
|
169
|
+
```ts
|
|
170
|
+
const result = await invoice.invalidate({
|
|
171
|
+
series: "1",
|
|
172
|
+
numberStart: 10,
|
|
173
|
+
numberEnd: 12,
|
|
174
|
+
reason: "Numeracao reservada e nao utilizada por falha no ERP",
|
|
175
|
+
});
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
The reason is 15 to 255 characters and the range is inclusive; both are checked
|
|
179
|
+
locally, as is `number_end` not being below `number_start`.
|
|
180
|
+
|
|
181
|
+
A number that already reached the authorizer can't be invalidated. The API checks
|
|
182
|
+
its own records first and answers `409` naming the offending numbers, without a
|
|
183
|
+
round trip — and the authorizer checks again for what we can't see from here.
|
|
184
|
+
|
|
185
|
+
**NF-e only**, and it takes no access key: there is no document to point at.
|
|
186
|
+
|
|
93
187
|
## Errors
|
|
94
188
|
|
|
95
189
|
- `APIError` — the API responded with a non-2xx status (`statusCode`, `detail`) — a 401 here means `apiKey` is missing, wrong, or was rotated.
|
package/dist/client.d.ts
CHANGED
|
@@ -17,6 +17,13 @@ export interface IssueRequest {
|
|
|
17
17
|
recipientAddress?: Address;
|
|
18
18
|
series?: string;
|
|
19
19
|
number?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Makes a retry safe: repeating the same key with the same body
|
|
22
|
+
* replays the first response instead of issuing a second document.
|
|
23
|
+
* Keys live 24 hours. Never generated for you — only the caller
|
|
24
|
+
* knows which two requests are meant to be the same one.
|
|
25
|
+
*/
|
|
26
|
+
idempotencyKey?: string;
|
|
20
27
|
}
|
|
21
28
|
export declare class Invoice {
|
|
22
29
|
readonly baseUrl: string;
|
|
@@ -32,8 +39,33 @@ export declare class Invoice {
|
|
|
32
39
|
documentType: DocumentType;
|
|
33
40
|
reason: string;
|
|
34
41
|
}): Promise<Record<string, unknown>>;
|
|
35
|
-
|
|
42
|
+
invalidate(options: {
|
|
43
|
+
series: string;
|
|
44
|
+
numberStart: number;
|
|
45
|
+
numberEnd: number;
|
|
46
|
+
reason: string;
|
|
47
|
+
}): Promise<Record<string, unknown>>;
|
|
48
|
+
correct(accessKey: string, options: {
|
|
49
|
+
documentType: DocumentType;
|
|
50
|
+
correction: string;
|
|
51
|
+
}): Promise<Record<string, unknown>>;
|
|
52
|
+
reissue(invoiceId: string, options?: {
|
|
53
|
+
idempotencyKey?: string;
|
|
54
|
+
}): Promise<Record<string, unknown>>;
|
|
36
55
|
private headers;
|
|
56
|
+
/**
|
|
57
|
+
* The authorizer's own rendering of an authorized document, as raw
|
|
58
|
+
* bytes — the only method that does not return a parsed object.
|
|
59
|
+
*
|
|
60
|
+
* The XML is the legally valid document; this is a convenience, and
|
|
61
|
+
* the authorizer's endpoint for it is unstable, so an APIError with
|
|
62
|
+
* status 502 means the authorizer is unavailable, not that the
|
|
63
|
+
* invoice is wrong. NFS-e only.
|
|
64
|
+
*/
|
|
65
|
+
pdf(accessKey: string, options: {
|
|
66
|
+
documentType: DocumentType;
|
|
67
|
+
}): Promise<Uint8Array>;
|
|
37
68
|
private request;
|
|
69
|
+
private send;
|
|
38
70
|
}
|
|
39
71
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEpD,eAAO,MAAM,gBAAgB,2BAA2B,CAAC;AAkBzD,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,SAAS,CAAC,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Y,EAAE,YAAY,CAAA;KAAE,GACtC,OAAO,CAAC,UAAU,CAAC;YAOR,OAAO;YAwBP,IAAI;CAmDnB"}
|
package/dist/client.js
CHANGED
|
@@ -79,7 +79,10 @@ class Invoice {
|
|
|
79
79
|
payload.series = request.series;
|
|
80
80
|
if (request.number)
|
|
81
81
|
payload.number = request.number;
|
|
82
|
-
return this.request("POST", "/invoices", {
|
|
82
|
+
return this.request("POST", "/invoices", {
|
|
83
|
+
body: payload,
|
|
84
|
+
idempotencyKey: request.idempotencyKey,
|
|
85
|
+
});
|
|
83
86
|
}
|
|
84
87
|
async consult(accessKey, options) {
|
|
85
88
|
return this.request("GET", `/invoices/${accessKey}`, {
|
|
@@ -94,19 +97,82 @@ class Invoice {
|
|
|
94
97
|
},
|
|
95
98
|
});
|
|
96
99
|
}
|
|
97
|
-
async
|
|
98
|
-
|
|
100
|
+
async invalidate(options) {
|
|
101
|
+
const length = options.reason?.length ?? 0;
|
|
102
|
+
if (length < 15 || length > 255) {
|
|
103
|
+
throw new errors_1.ValidationError("reason must be 15 to 255 characters");
|
|
104
|
+
}
|
|
105
|
+
if (options.numberEnd < options.numberStart) {
|
|
106
|
+
throw new errors_1.ValidationError("numberEnd can't be below numberStart");
|
|
107
|
+
}
|
|
108
|
+
return this.request("POST", "/invoices/invalidations", {
|
|
109
|
+
body: {
|
|
110
|
+
series: options.series,
|
|
111
|
+
number_start: options.numberStart,
|
|
112
|
+
number_end: options.numberEnd,
|
|
113
|
+
reason: options.reason,
|
|
114
|
+
},
|
|
115
|
+
});
|
|
99
116
|
}
|
|
100
|
-
|
|
117
|
+
async correct(accessKey, options) {
|
|
118
|
+
const length = options.correction?.length ?? 0;
|
|
119
|
+
if (length < 15 || length > 1000) {
|
|
120
|
+
throw new errors_1.ValidationError("correction must be 15 to 1000 characters");
|
|
121
|
+
}
|
|
122
|
+
return this.request("POST", `/invoices/${accessKey}/correction`, {
|
|
123
|
+
body: {
|
|
124
|
+
document_type: options.documentType,
|
|
125
|
+
correction: options.correction,
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
async reissue(invoiceId, options = {}) {
|
|
130
|
+
return this.request("POST", `/invoices/${invoiceId}/reissue`, {
|
|
131
|
+
idempotencyKey: options.idempotencyKey,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
headers(idempotencyKey) {
|
|
101
135
|
const headers = {
|
|
102
136
|
"Content-Type": "application/json",
|
|
103
137
|
};
|
|
104
138
|
if (this.apiKey) {
|
|
105
139
|
headers.Authorization = `Bearer ${this.apiKey}`;
|
|
106
140
|
}
|
|
141
|
+
if (idempotencyKey) {
|
|
142
|
+
headers["Idempotency-Key"] = idempotencyKey;
|
|
143
|
+
}
|
|
107
144
|
return headers;
|
|
108
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* The authorizer's own rendering of an authorized document, as raw
|
|
148
|
+
* bytes — the only method that does not return a parsed object.
|
|
149
|
+
*
|
|
150
|
+
* The XML is the legally valid document; this is a convenience, and
|
|
151
|
+
* the authorizer's endpoint for it is unstable, so an APIError with
|
|
152
|
+
* status 502 means the authorizer is unavailable, not that the
|
|
153
|
+
* invoice is wrong. NFS-e only.
|
|
154
|
+
*/
|
|
155
|
+
async pdf(accessKey, options) {
|
|
156
|
+
const response = await this.send("GET", `/invoices/${accessKey}/pdf`, {
|
|
157
|
+
query: { document_type: options.documentType },
|
|
158
|
+
});
|
|
159
|
+
return new Uint8Array(await response.arrayBuffer());
|
|
160
|
+
}
|
|
109
161
|
async request(method, path, opts = {}) {
|
|
162
|
+
const response = await this.send(method, path, opts);
|
|
163
|
+
let body = {};
|
|
164
|
+
const text = await response.text();
|
|
165
|
+
if (text) {
|
|
166
|
+
try {
|
|
167
|
+
body = JSON.parse(text);
|
|
168
|
+
}
|
|
169
|
+
catch {
|
|
170
|
+
body = {};
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return body.result ?? body;
|
|
174
|
+
}
|
|
175
|
+
async send(method, path, opts = {}) {
|
|
110
176
|
let url = `${this.baseUrl}/api/v1${path}`;
|
|
111
177
|
if (opts.query) {
|
|
112
178
|
const params = new URLSearchParams(opts.query);
|
|
@@ -118,7 +184,7 @@ class Invoice {
|
|
|
118
184
|
try {
|
|
119
185
|
response = await this.fetchImpl(url, {
|
|
120
186
|
method,
|
|
121
|
-
headers: this.headers(),
|
|
187
|
+
headers: this.headers(opts.idempotencyKey),
|
|
122
188
|
body: opts.body !== undefined ? JSON.stringify(opts.body) : undefined,
|
|
123
189
|
signal: controller.signal,
|
|
124
190
|
});
|
|
@@ -129,21 +195,21 @@ class Invoice {
|
|
|
129
195
|
finally {
|
|
130
196
|
clearTimeout(timer);
|
|
131
197
|
}
|
|
132
|
-
let body = {};
|
|
133
|
-
const text = await response.text();
|
|
134
|
-
if (text) {
|
|
135
|
-
try {
|
|
136
|
-
body = JSON.parse(text);
|
|
137
|
-
}
|
|
138
|
-
catch {
|
|
139
|
-
body = {};
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
198
|
if (!response.ok) {
|
|
199
|
+
const text = await response.text();
|
|
200
|
+
let body = {};
|
|
201
|
+
if (text) {
|
|
202
|
+
try {
|
|
203
|
+
body = JSON.parse(text);
|
|
204
|
+
}
|
|
205
|
+
catch {
|
|
206
|
+
body = {};
|
|
207
|
+
}
|
|
208
|
+
}
|
|
143
209
|
const detail = typeof body.detail === "string" ? body.detail : text;
|
|
144
210
|
throw new errors_1.APIError(response.status, detail);
|
|
145
211
|
}
|
|
146
|
-
return
|
|
212
|
+
return response;
|
|
147
213
|
}
|
|
148
214
|
}
|
|
149
215
|
exports.Invoice = Invoice;
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;AAEA,qCAA4E;AAC5E,mCAAoD;AAEvC,QAAA,gBAAgB,GAAG,wBAAwB,CAAC;AAEzD,MAAM,gBAAgB,GAAgC;IACpD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AAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CACjD,CAAC;QACJ,CAAC;gBAAS,CAAC;YACT,YAAY,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YACnC,IAAI,IAAI,GAA4B,EAAE,CAAC;YACvC,IAAI,IAAI,EAAE,CAAC;gBACT,IAAI,CAAC;oBACH,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAA4B,CAAC;gBACrD,CAAC;gBAAC,MAAM,CAAC;oBACP,IAAI,GAAG,EAAE,CAAC;gBACZ,CAAC;YACH,CAAC;YACD,MAAM,MAAM,GACV,OAAO,IAAI,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAE,IAAI,CAAC,MAAiB,CAAC,CAAC,CAAC,IAAI,CAAC;YACnE,MAAM,IAAI,iBAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC9C,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AAvOD,0BAuOC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackin-io/stackin-node-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Node/TypeScript SDK for stackin — issue, consult and cancel Brazilian fiscal documents (NF-e, NFS-e) via a single Invoice client. No certificates, XML or SOAP.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"stackin",
|