@12-apps/fiscal 1.2.0 → 1.3.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 +14 -0
- package/dist/{chunk-G3V7IYNF.js → chunk-GGYJPFBJ.js} +2 -2
- package/dist/{chunk-N5DCKYFR.js → chunk-GKT3X5CF.js} +2 -2
- package/dist/{chunk-2LBQRYPV.js → chunk-H33BK623.js} +1 -1
- package/dist/{chunk-2LBQRYPV.js.map → chunk-H33BK623.js.map} +1 -1
- package/dist/{chunk-5S2PJHAE.js → chunk-MEBG7FGG.js} +2 -2
- package/dist/{chunk-WTGASIZE.js → chunk-MGTROA7K.js} +2 -2
- package/dist/{chunk-NVRYAAQ4.js → chunk-V6G2OFLA.js} +6 -5
- package/dist/chunk-V6G2OFLA.js.map +1 -0
- package/dist/{context-ChnWR4Kb.d.ts → context-yc1C2__K.d.ts} +1 -1
- package/dist/danfe/index.js +2 -2
- package/dist/documents/index.d.ts +12 -6
- package/dist/documents/index.js +54 -3
- package/dist/documents/index.js.map +1 -1
- package/dist/http.d.ts +4 -3
- package/dist/http.js +4 -4
- package/dist/issuer/index.d.ts +2 -2
- package/dist/jobs.d.ts +3 -3
- package/dist/jobs.js +3 -3
- package/dist/manifest/server.d.ts +3 -3
- package/dist/manifest/server.js +6 -6
- package/dist/notifications.d.ts +2 -2
- package/dist/notifications.js +2 -2
- package/dist/{port-DpRFK56U.d.ts → port-B1-ipIL4.d.ts} +1 -1
- package/dist/{service-KTjH7AxW.d.ts → service-BB9lWdyg.d.ts} +30 -3
- package/package.json +1 -1
- package/src/documents/errors.ts +7 -1
- package/src/documents/index.ts +2 -2
- package/src/documents/service.ts +94 -0
- package/src/http.ts +1 -0
- package/dist/chunk-NVRYAAQ4.js.map +0 -1
- /package/dist/{chunk-G3V7IYNF.js.map → chunk-GGYJPFBJ.js.map} +0 -0
- /package/dist/{chunk-N5DCKYFR.js.map → chunk-GKT3X5CF.js.map} +0 -0
- /package/dist/{chunk-5S2PJHAE.js.map → chunk-MEBG7FGG.js.map} +0 -0
- /package/dist/{chunk-WTGASIZE.js.map → chunk-MGTROA7K.js.map} +0 -0
package/dist/http.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FISCAL_ERROR_STATUS,
|
|
3
3
|
createApiFiscal
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-V6G2OFLA.js";
|
|
5
|
+
import "./chunk-MGTROA7K.js";
|
|
6
|
+
import "./chunk-GGYJPFBJ.js";
|
|
7
7
|
import "./chunk-PNTKG3DZ.js";
|
|
8
8
|
import "./chunk-XQGW5HUG.js";
|
|
9
9
|
import "./chunk-3SDXLSG4.js";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-H33BK623.js";
|
|
11
11
|
import "./chunk-7QVYU63E.js";
|
|
12
12
|
export {
|
|
13
13
|
FISCAL_ERROR_STATUS,
|
package/dist/issuer/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as Issuer } from '../port-
|
|
2
|
-
export { C as CancelBySubstitutionCall, a as CancelCall, b as InutilizeCall, c as IssueCall, d as IssuerFailure, e as IssuerOutcome, L as LookupCall, S as SignContingencyCall, f as SigningMaterial, T as TransmitCall, m as modelPath } from '../port-
|
|
1
|
+
import { I as Issuer } from '../port-B1-ipIL4.js';
|
|
2
|
+
export { C as CancelBySubstitutionCall, a as CancelCall, b as InutilizeCall, c as IssueCall, d as IssuerFailure, e as IssuerOutcome, L as LookupCall, S as SignContingencyCall, f as SigningMaterial, T as TransmitCall, m as modelPath } from '../port-B1-ipIL4.js';
|
|
3
3
|
import '../sale/index.js';
|
|
4
4
|
import '../sidecar/index.js';
|
|
5
5
|
|
package/dist/jobs.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _12_apps_wiring from '@12-apps/wiring';
|
|
2
|
-
import { F as FiscalStore, a as FiscalNotifyPort } from './context-
|
|
3
|
-
import { F as FiscalDocuments } from './service-
|
|
4
|
-
import './port-
|
|
2
|
+
import { F as FiscalStore, a as FiscalNotifyPort } from './context-yc1C2__K.js';
|
|
3
|
+
import { F as FiscalDocuments } from './service-BB9lWdyg.js';
|
|
4
|
+
import './port-B1-ipIL4.js';
|
|
5
5
|
import './sale/index.js';
|
|
6
6
|
import './sidecar/index.js';
|
|
7
7
|
import './types-B1b8LIWX.js';
|
package/dist/jobs.js
CHANGED
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
FISCAL_SWEEP_BATCH,
|
|
6
6
|
FISCAL_WORST_STEP_MS,
|
|
7
7
|
daysLeft
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-MEBG7FGG.js";
|
|
9
|
+
import "./chunk-GKT3X5CF.js";
|
|
10
10
|
import "./chunk-XQGW5HUG.js";
|
|
11
11
|
import "./chunk-3SDXLSG4.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-H33BK623.js";
|
|
13
13
|
import "./chunk-7QVYU63E.js";
|
|
14
14
|
export {
|
|
15
15
|
CERTIFICATE_WARNING_DAYS,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as _12_apps_wiring from '@12-apps/wiring';
|
|
2
2
|
import { FiscalJobDeps } from '../jobs.js';
|
|
3
3
|
import { createApiFiscal } from '../http.js';
|
|
4
|
-
import '../context-
|
|
5
|
-
import '../port-
|
|
4
|
+
import '../context-yc1C2__K.js';
|
|
5
|
+
import '../port-B1-ipIL4.js';
|
|
6
6
|
import '../sale/index.js';
|
|
7
7
|
import '../sidecar/index.js';
|
|
8
8
|
import '../types-B1b8LIWX.js';
|
|
9
|
-
import '../service-
|
|
9
|
+
import '../service-BB9lWdyg.js';
|
|
10
10
|
import '../labels-BNvflT0h.js';
|
|
11
11
|
|
|
12
12
|
declare const fiscalServerManifest: {
|
package/dist/manifest/server.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createApiFiscal
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-V6G2OFLA.js";
|
|
4
|
+
import "../chunk-MGTROA7K.js";
|
|
5
|
+
import "../chunk-GGYJPFBJ.js";
|
|
6
6
|
import "../chunk-PNTKG3DZ.js";
|
|
7
7
|
import {
|
|
8
8
|
FISCAL_JOBS
|
|
9
|
-
} from "../chunk-
|
|
10
|
-
import "../chunk-
|
|
9
|
+
} from "../chunk-MEBG7FGG.js";
|
|
10
|
+
import "../chunk-GKT3X5CF.js";
|
|
11
11
|
import "../chunk-XQGW5HUG.js";
|
|
12
12
|
import "../chunk-3SDXLSG4.js";
|
|
13
|
-
import "../chunk-
|
|
13
|
+
import "../chunk-H33BK623.js";
|
|
14
14
|
import "../chunk-7QVYU63E.js";
|
|
15
15
|
|
|
16
16
|
// src/manifest/server.ts
|
package/dist/notifications.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { b as FISCAL_CERTIFICATE_EXPIRING, c as FISCAL_CONTINGENCY_DEADLINE, d as FISCAL_DOCUMENT_NEEDS_ATTENTION, e as FISCAL_DOCUMENT_REJECTED } from './context-
|
|
2
|
-
import { F as FiscalDocumentModel, g as FiscalDocumentStatus, N as NumberVoid } from './port-
|
|
1
|
+
export { b as FISCAL_CERTIFICATE_EXPIRING, c as FISCAL_CONTINGENCY_DEADLINE, d as FISCAL_DOCUMENT_NEEDS_ATTENTION, e as FISCAL_DOCUMENT_REJECTED } from './context-yc1C2__K.js';
|
|
2
|
+
import { F as FiscalDocumentModel, g as FiscalDocumentStatus, N as NumberVoid } from './port-B1-ipIL4.js';
|
|
3
3
|
import './sale/index.js';
|
|
4
4
|
import './sidecar/index.js';
|
|
5
5
|
import './types-B1b8LIWX.js';
|
package/dist/notifications.js
CHANGED
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
FISCAL_CONTINGENCY_DEADLINE,
|
|
4
4
|
FISCAL_DOCUMENT_NEEDS_ATTENTION,
|
|
5
5
|
FISCAL_DOCUMENT_REJECTED
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-GKT3X5CF.js";
|
|
7
7
|
import "./chunk-XQGW5HUG.js";
|
|
8
8
|
import "./chunk-3SDXLSG4.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-H33BK623.js";
|
|
10
10
|
import {
|
|
11
11
|
__name
|
|
12
12
|
} from "./chunk-7QVYU63E.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SaleForDocument } from './sale/index.js';
|
|
2
|
-
import { SefazEnvironment, SidecarErrorClass, SigningCertificate, Csc,
|
|
2
|
+
import { SefazEnvironment, SidecarErrorClass, SidecarErrorBody, SigningCertificate, Csc, IssuedDocument, ContingencyEntry, ContingencySignedDocument, CancelledDocument, LookedUpDocument, InutilizedRange, SidecarHealth } from './sidecar/index.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The fiscal document record and its event log — the shape the package's
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { F as FiscalDocumentModel, h as FiscalDocument, d as IssuerFailure, i as FiscalDocumentEvent } from './port-
|
|
1
|
+
import { F as FiscalDocumentModel, h as FiscalDocument, d as IssuerFailure, i as FiscalDocumentEvent } from './port-B1-ipIL4.js';
|
|
2
2
|
import { T as TaxRegime } from './types-B1b8LIWX.js';
|
|
3
3
|
import { IssuerTaxRegime, Address } from './sale/index.js';
|
|
4
4
|
import { SefazEnvironment, LookedUpDocument } from './sidecar/index.js';
|
|
5
|
-
import { f as DocumentPolicy, S as SigningIdentityKind, g as FiscalDocumentsConfig, C as Cipher, E as EmitterProfile, I as IssuingPoint } from './context-
|
|
5
|
+
import { f as DocumentPolicy, S as SigningIdentityKind, g as FiscalDocumentsConfig, C as Cipher, E as EmitterProfile, I as IssuingPoint } from './context-yc1C2__K.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Reading the emitter profile and the certificate upload off a request body:
|
|
@@ -90,6 +90,28 @@ interface IssueInput {
|
|
|
90
90
|
}
|
|
91
91
|
/** How long an NFC-e may wait in contingency before it must be transmitted (24 h); the warning goes out at 20 h. */
|
|
92
92
|
declare const CONTINGENCY_WARNING_AFTER_MS: number;
|
|
93
|
+
/** SEFAZ's refusals of a cancel that came too late: "prazo de cancelamento superior ao previsto". */
|
|
94
|
+
declare const LATE_CANCEL_CODES: readonly ["501"];
|
|
95
|
+
interface CancelOrReturnInput {
|
|
96
|
+
readonly ownerId: string;
|
|
97
|
+
readonly documentId: string;
|
|
98
|
+
/** SEFAZ's 15–255 characters, sent with the cancel. */
|
|
99
|
+
readonly reason: string;
|
|
100
|
+
/** The NF-e (model 55) issuing point a return is numbered on. */
|
|
101
|
+
readonly returnPointId: string;
|
|
102
|
+
}
|
|
103
|
+
interface CancelOrReturnResult {
|
|
104
|
+
/**
|
|
105
|
+
* `CANCELLED` inside the window; `RETURNED` past it (the return may itself
|
|
106
|
+
* still be SUBMITTED: the sweep settles it like any document); `REFUSED`
|
|
107
|
+
* when the issuer refused the cancel for any other reason (nothing changed).
|
|
108
|
+
*/
|
|
109
|
+
readonly outcome: "CANCELLED" | "RETURNED" | "REFUSED";
|
|
110
|
+
/** The document asked about, as it stands: CANCELLED, or still AUTHORIZED beside its return. */
|
|
111
|
+
readonly document: FiscalDocument;
|
|
112
|
+
readonly returnDocument: FiscalDocument | null;
|
|
113
|
+
readonly failure: IssuerFailure | null;
|
|
114
|
+
}
|
|
93
115
|
declare function createFiscalDocuments(config: FiscalDocumentsServiceConfig): {
|
|
94
116
|
getProfile: (ownerId: string) => Promise<EmitterProfile | null>;
|
|
95
117
|
saveProfile: (ownerId: string, input: EmitterProfileInput) => Promise<EmitterProfile>;
|
|
@@ -112,6 +134,11 @@ declare function createFiscalDocuments(config: FiscalDocumentsServiceConfig): {
|
|
|
112
134
|
document: FiscalDocument;
|
|
113
135
|
failure: IssuerFailure | null;
|
|
114
136
|
}>;
|
|
137
|
+
/**
|
|
138
|
+
* Cancel an authorised document, or — when SEFAZ says the cancel is too late
|
|
139
|
+
* (501) — issue the buyer's return NF-e of entry quoting it. Idempotent.
|
|
140
|
+
*/
|
|
141
|
+
cancelOrReturn: (input: CancelOrReturnInput) => Promise<CancelOrReturnResult>;
|
|
115
142
|
/** Ask SEFAZ what it knows of the key; a state the answer moves is recorded. */
|
|
116
143
|
lookup: (input: {
|
|
117
144
|
ownerId: string;
|
|
@@ -136,4 +163,4 @@ declare function createFiscalDocuments(config: FiscalDocumentsServiceConfig): {
|
|
|
136
163
|
};
|
|
137
164
|
type FiscalDocuments = ReturnType<typeof createFiscalDocuments>;
|
|
138
165
|
|
|
139
|
-
export { CONTINGENCY_WARNING_AFTER_MS as C, type EmitterProfileInput as E, type FiscalDocuments as F, type IssueInput as I, type SweepReport as S, type
|
|
166
|
+
export { CONTINGENCY_WARNING_AFTER_MS as C, type EmitterProfileInput as E, type FiscalDocuments as F, type IssueInput as I, LATE_CANCEL_CODES as L, type SweepReport as S, type CancelOrReturnInput as a, type CancelOrReturnResult as b, type CertificateFacts as c, type CertificateUpload as d, type FiscalDocumentsServiceConfig as e, type IssuingPointInput as f, createFiscalDocuments as g, parseIssuingPointInput as h, parseProfileInput as i, parseCertificateUpload as p };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@12-apps/fiscal",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"description": "Brazilian consumption-tax machinery and fiscal documents for any host that sells. The IBS/CBS engine (./engine): a pure function from priced lines, the seller's regime, the destination, the exclusions, a versioned rate table and the date of the supply to a per-line and per-order breakdown. The neutral sale document (./sale) and a stateless HTTP service over sped-nfe that issues NF-e and NFC-e, shipped with its Dockerfile in sidecar/ (./sidecar types its wire contract). The fiscal document module (./documents): the state machine, the per-series number counters, the issuer port and its sidecar adapter (./issuer), the signing identity, and the DANFE NFC-e as ESC/POS-ready lines (./danfe). Implements @12-apps/wiring (./manifest): db, http, jobs, permissions.",
|
package/src/documents/errors.ts
CHANGED
|
@@ -35,7 +35,13 @@ export type FiscalDocumentErrorCode =
|
|
|
35
35
|
* A `RETURN` asked of an NFC-e. An NFC-e has no return purpose: the return is
|
|
36
36
|
* an NF-e (model 55) of entry that references the NFC-e's key.
|
|
37
37
|
*/
|
|
38
|
-
| "RETURN_ON_NFCE"
|
|
38
|
+
| "RETURN_ON_NFCE"
|
|
39
|
+
/**
|
|
40
|
+
* `cancelOrReturn` past SEFAZ's window on a document that is not an NFC-e:
|
|
41
|
+
* the buyer's return NF-e of entry answers a consumer's NFC-e only; an NF-e
|
|
42
|
+
* past its window is the issuer's own correction, not this path's.
|
|
43
|
+
*/
|
|
44
|
+
| "RETURN_OF_NFCE_ONLY";
|
|
39
45
|
|
|
40
46
|
export class FiscalDocumentError extends Error {
|
|
41
47
|
readonly code: FiscalDocumentErrorCode;
|
package/src/documents/index.ts
CHANGED
|
@@ -29,8 +29,8 @@ export {
|
|
|
29
29
|
xmlKeys,
|
|
30
30
|
} from "./context";
|
|
31
31
|
export type { FiscalDocumentsConfig, FiscalNotifyPort, FiscalReasons } from "./context";
|
|
32
|
-
export { CONTINGENCY_WARNING_AFTER_MS, createFiscalDocuments } from "./service";
|
|
33
|
-
export type { CertificateFacts, FiscalDocuments, FiscalDocumentsServiceConfig, IssueInput, SweepReport } from "./service";
|
|
32
|
+
export { CONTINGENCY_WARNING_AFTER_MS, LATE_CANCEL_CODES, createFiscalDocuments } from "./service";
|
|
33
|
+
export type { CancelOrReturnInput, CancelOrReturnResult, CertificateFacts, FiscalDocuments, FiscalDocumentsServiceConfig, IssueInput, SweepReport } from "./service";
|
|
34
34
|
export { createMemoryFiscalStore } from "./memory";
|
|
35
35
|
export type { MemoryFiscalStore } from "./memory";
|
|
36
36
|
export { FISCAL_NEXT_NUMBER_SQL } from "./sql";
|
package/src/documents/service.ts
CHANGED
|
@@ -176,6 +176,95 @@ async function cancel(
|
|
|
176
176
|
return { document: cancelled, failure: null };
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
+
/** SEFAZ's refusals of a cancel that came too late: "prazo de cancelamento superior ao previsto". */
|
|
180
|
+
export const LATE_CANCEL_CODES = ["501"] as const;
|
|
181
|
+
|
|
182
|
+
const isLateCancel = (code: string | null): boolean => code !== null && (LATE_CANCEL_CODES as readonly string[]).includes(code);
|
|
183
|
+
|
|
184
|
+
export interface CancelOrReturnInput {
|
|
185
|
+
readonly ownerId: string;
|
|
186
|
+
readonly documentId: string;
|
|
187
|
+
/** SEFAZ's 15–255 characters, sent with the cancel. */
|
|
188
|
+
readonly reason: string;
|
|
189
|
+
/** The NF-e (model 55) issuing point a return is numbered on. */
|
|
190
|
+
readonly returnPointId: string;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export interface CancelOrReturnResult {
|
|
194
|
+
/**
|
|
195
|
+
* `CANCELLED` inside the window; `RETURNED` past it (the return may itself
|
|
196
|
+
* still be SUBMITTED: the sweep settles it like any document); `REFUSED`
|
|
197
|
+
* when the issuer refused the cancel for any other reason (nothing changed).
|
|
198
|
+
*/
|
|
199
|
+
readonly outcome: "CANCELLED" | "RETURNED" | "REFUSED";
|
|
200
|
+
/** The document asked about, as it stands: CANCELLED, or still AUTHORIZED beside its return. */
|
|
201
|
+
readonly document: FiscalDocument;
|
|
202
|
+
readonly returnDocument: FiscalDocument | null;
|
|
203
|
+
readonly failure: IssuerFailure | null;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/** The subject's live return NF-e that quotes this key, if one was issued already. */
|
|
207
|
+
async function liveReturnOf(deps: Deps, document: FiscalDocument): Promise<FiscalDocument | null> {
|
|
208
|
+
const returns = (await deps.config.store.listBySubject(document.ownerId, document.subjectId, "NFE")).filter(isLive);
|
|
209
|
+
const quoting = returns.filter((candidate) => returnsDocument(candidate, document));
|
|
210
|
+
return quoting[quoting.length - 1] ?? null;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Cancel an authorised document; when SEFAZ refuses the cancel as LATE (501),
|
|
215
|
+
* issue the buyer's return instead: an NF-e of entry on `returnPointId`, the
|
|
216
|
+
* host's `SaleSource` answering the return sale for the document's subject
|
|
217
|
+
* (`model: "NFE"`), which must quote this document's key. The document itself
|
|
218
|
+
* stays AUTHORIZED: a return never cancels it.
|
|
219
|
+
*
|
|
220
|
+
* Idempotent: a document already cancelled, or already answered with a live
|
|
221
|
+
* return, is answered as it stands, with no call to the issuer. A return the
|
|
222
|
+
* sale source does not quote is refused before a number is drawn.
|
|
223
|
+
*/
|
|
224
|
+
async function cancelOrReturn(deps: Deps, input: CancelOrReturnInput): Promise<CancelOrReturnResult> {
|
|
225
|
+
assertReason(input.reason, "reason");
|
|
226
|
+
const document = await requireDocument(deps, input.ownerId, input.documentId);
|
|
227
|
+
if (document.status === "CANCELLED") return { outcome: "CANCELLED", document, returnDocument: null, failure: null };
|
|
228
|
+
const existing = document.accessKey === null ? null : await liveReturnOf(deps, document);
|
|
229
|
+
if (existing !== null) return { outcome: "RETURNED", document, returnDocument: existing, failure: null };
|
|
230
|
+
const cancelled = await cancel(deps, input);
|
|
231
|
+
if (cancelled.failure === null) return { outcome: "CANCELLED", document: cancelled.document, returnDocument: null, failure: null };
|
|
232
|
+
const late = cancelled.failure.class === "REJECTED" && isLateCancel(cancelled.failure.code);
|
|
233
|
+
if (!late) return { outcome: "REFUSED", document: cancelled.document, returnDocument: null, failure: cancelled.failure };
|
|
234
|
+
return { outcome: "RETURNED", document: cancelled.document, returnDocument: await issueReturn(deps, document, input.returnPointId), failure: cancelled.failure };
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/** Whether `candidate` is a buyer's return NF-e of entry quoting `document`. */
|
|
238
|
+
function returnsDocument(candidate: Pick<FiscalDocument, "model" | "sale">, document: FiscalDocument): boolean {
|
|
239
|
+
const quotes = (candidate.sale.referencedDocuments ?? []).some((reference) => reference.accessKey === document.accessKey);
|
|
240
|
+
return candidate.model === "NFE" && candidate.sale.purpose === "RETURN" && quotes;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* The return of a late-cancelled NFC-e. Refused, before any number is drawn,
|
|
245
|
+
* for anything but an NFC-e, for a subject that already holds a live NF-e that
|
|
246
|
+
* is not this return (the live index allows one per subject and model), and
|
|
247
|
+
* for a sale source whose return does not quote the document.
|
|
248
|
+
*/
|
|
249
|
+
async function issueReturn(deps: Deps, document: FiscalDocument, returnPointId: string): Promise<FiscalDocument> {
|
|
250
|
+
if (document.model !== "NFCE") {
|
|
251
|
+
throw new FiscalDocumentError("RETURN_OF_NFCE_ONLY", `document ${document.id} is an ${document.model}: only an NFC-e is answered with a buyer's return.`);
|
|
252
|
+
}
|
|
253
|
+
const live = (await deps.config.store.listBySubject(document.ownerId, document.subjectId, "NFE")).filter(isLive);
|
|
254
|
+
if (live.length > 0) {
|
|
255
|
+
throw new FiscalDocumentError("SUBJECT_HAS_DOCUMENT", `subject ${document.subjectId} already holds a live NF-e that is not document ${document.id}'s return.`);
|
|
256
|
+
}
|
|
257
|
+
const draft = await deps.config.sales.saleFor({ ownerId: document.ownerId, subjectId: document.subjectId, model: "NFE" });
|
|
258
|
+
if (!returnsDocument({ model: "NFE", sale: draft as FiscalDocument["sale"] }, document)) {
|
|
259
|
+
throw new FiscalDocumentError("INVALID_INPUT", `the return the sale source answered for subject ${document.subjectId} does not quote document ${document.id}.`);
|
|
260
|
+
}
|
|
261
|
+
const returned = await issue(deps, { ownerId: document.ownerId, subjectId: document.subjectId, issuingPointId: returnPointId, model: "NFE" });
|
|
262
|
+
if (returned.id === document.id || !returnsDocument(returned, document)) {
|
|
263
|
+
throw new FiscalDocumentError("CONFLICT", `subject ${document.subjectId}'s live NF-e is not document ${document.id}'s return.`);
|
|
264
|
+
}
|
|
265
|
+
return returned;
|
|
266
|
+
}
|
|
267
|
+
|
|
179
268
|
/** Whether a lookup's answer moves this document (a settled number moves only while it is owed one). */
|
|
180
269
|
function lookupMoves(document: FiscalDocument): boolean {
|
|
181
270
|
if (!canTransition(document.status, "LOOKUP")) return false;
|
|
@@ -272,6 +361,11 @@ export function createFiscalDocuments(config: FiscalDocumentsServiceConfig) {
|
|
|
272
361
|
resendContingency: resendContingency.bind(null, deps),
|
|
273
362
|
/** Cancel an authorised document. A refusal (late, say) answers the issuer's failure and changes nothing. */
|
|
274
363
|
cancel: cancel.bind(null, deps),
|
|
364
|
+
/**
|
|
365
|
+
* Cancel an authorised document, or — when SEFAZ says the cancel is too late
|
|
366
|
+
* (501) — issue the buyer's return NF-e of entry quoting it. Idempotent.
|
|
367
|
+
*/
|
|
368
|
+
cancelOrReturn: cancelOrReturn.bind(null, deps),
|
|
275
369
|
/** Ask SEFAZ what it knows of the key; a state the answer moves is recorded. */
|
|
276
370
|
lookup: lookup.bind(null, deps),
|
|
277
371
|
/** A person takes a document back from `attention`; the sweep tries it again. */
|
package/src/http.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/http.ts"],"sourcesContent":["/**\n * `createApiFiscal` — the fiscal HTTP surface as framework-neutral route\n * descriptors (the wiring contract's `http` capability, restated here\n * structurally: this package imports nothing from the contract at runtime,\n * and its manifest suite pins the twins).\n *\n * The package owns the paths, the bodies it reads (`./documents/profile-input`,\n * unknown keys refused), the `{ data }` envelope, the permission each route\n * needs and the status a refusal earns ({@link FISCAL_ERROR_STATUS}). The host\n * owns resolving WHO is calling into the opaque `ownerId` of its tenant, the\n * guards that check the declared permission, and every word a person reads:\n * an error answers a `code` for the host to word, never a sentence for a user.\n *\n * Nothing secret leaves: the profile answers `hasCertificate` / `hasCsc`, never\n * a ciphertext, and the certificate upload answers the profile view.\n */\n\nimport { type DanfeNfceLabels } from \"./danfe/labels\";\nimport { type PaperWidth, renderDanfeNfce } from \"./danfe/render\";\nimport { FiscalDocumentError, type FiscalDocumentErrorCode } from \"./documents/errors\";\nimport type { DocumentStorage } from \"./documents/ports\";\nimport { parseCertificateUpload, parseIssuingPointInput, parseProfileInput } from \"./documents/profile-input\";\nimport { viewOf } from \"./documents/profile\";\nimport type { FiscalDocuments } from \"./documents/service\";\nimport { FISCAL_DOCUMENT_MODELS, type FiscalDocumentModel } from \"./documents/types\";\nimport { FISCAL_CANCEL, FISCAL_ISSUE, FISCAL_MANAGE, FISCAL_READ } from \"./manifest/permissions\";\n\n/** The caller, as the host's adapter resolved it. */\nexport interface FiscalHttpActor {\n /** The emitter profile's owner: the host's tenant, mapped to an opaque id. */\n readonly ownerId: string;\n}\n\n/** Structural twin of the wiring contract's `WireRequest<FiscalHttpActor>`. */\nexport interface FiscalHttpRequest {\n actor: FiscalHttpActor;\n params: Record<string, string | undefined>;\n query: Record<string, string | undefined>;\n body?: unknown;\n}\n\n/** Structural twin of the wiring contract's `WireResponse`. */\nexport interface FiscalHttpResponse {\n status: number;\n body: unknown;\n}\n\n/** Structural twin of the wiring contract's `WireRoute<FiscalHttpActor>`. */\nexport interface FiscalRoute {\n method: \"GET\" | \"POST\" | \"PUT\";\n path: string;\n permission: string;\n handle(request: FiscalHttpRequest): Promise<FiscalHttpResponse>;\n}\n\nexport interface FiscalApiConfig {\n readonly documents: FiscalDocuments;\n /** Where the XMLs are, to render a DANFE from. */\n readonly storage: DocumentStorage;\n /** The DANFE's words: the host's, or `@12-apps/fiscal/danfe/pt-BR`. */\n readonly danfeLabels: DanfeNfceLabels;\n}\n\nexport const FISCAL_ERROR_STATUS = {\n INVALID_INPUT: 400,\n NOT_FOUND: 404,\n NOT_ISSUABLE: 409,\n NOT_SUPPORTED: 501,\n TRANSITION_REFUSED: 409,\n SERIES_EXHAUSTED: 409,\n CONFLICT: 409,\n SUBJECT_HAS_DOCUMENT: 409,\n NOT_PRINTABLE: 409,\n RESEND_CHANGES_PRINTED_FIELDS: 422,\n RETURN_NEEDS_REFERENCE: 422,\n RETURN_ON_NFCE: 422,\n} as const satisfies Record<FiscalDocumentErrorCode, number>;\n\n/**\n * The states with paper: an authorised document, and one signed offline and\n * not yet transmitted (its DANFE is what the buyer takes). A denied,\n * cancelled, rejected or replaced document is not a valid DANFE.\n */\nconst PRINTABLE = new Set([\"AUTHORIZED\", \"CONTINGENCY\"]);\n\nconst ok = (data: unknown, status = 200): FiscalHttpResponse => ({ status, body: { data } });\n\nasync function answering(run: () => Promise<FiscalHttpResponse>): Promise<FiscalHttpResponse> {\n try {\n return await run();\n } catch (error) {\n if (error instanceof FiscalDocumentError) {\n return { status: FISCAL_ERROR_STATUS[error.code], body: { error: error.code, message: error.message } };\n }\n throw error;\n }\n}\n\nfunction record(body: unknown): Record<string, unknown> {\n if (body === null || typeof body !== \"object\" || Array.isArray(body)) {\n throw new FiscalDocumentError(\"INVALID_INPUT\", \"the body must be an object.\");\n }\n return body as Record<string, unknown>;\n}\n\nfunction stringField(body: Record<string, unknown>, key: string): string {\n const value = body[key];\n if (typeof value !== \"string\" || value === \"\") throw new FiscalDocumentError(\"INVALID_INPUT\", `${key} is required.`);\n return value;\n}\n\nfunction param(request: FiscalHttpRequest, key: string): string {\n const value = request.params[key];\n if (value === undefined || value === \"\") throw new FiscalDocumentError(\"INVALID_INPUT\", `${key} is required.`);\n return value;\n}\n\nconst ISSUE_KEYS = new Set([\"subjectId\", \"issuingPointId\", \"model\", \"offline\"]);\n\nfunction issueBody(body: unknown): { subjectId: string; issuingPointId: string; model: FiscalDocumentModel; offline: boolean } {\n const fields = record(body);\n const unknown = Object.keys(fields).filter((key) => !ISSUE_KEYS.has(key));\n if (unknown.length > 0) throw new FiscalDocumentError(\"INVALID_INPUT\", `unknown keys: ${unknown.join(\", \")}.`);\n const model = fields[\"model\"];\n if (!FISCAL_DOCUMENT_MODELS.includes(model as FiscalDocumentModel)) throw new FiscalDocumentError(\"INVALID_INPUT\", \"model must be NFE or NFCE.\");\n const offline = fields[\"offline\"] ?? false;\n if (typeof offline !== \"boolean\") throw new FiscalDocumentError(\"INVALID_INPUT\", \"offline must be a boolean.\");\n if (offline && model !== \"NFCE\") throw new FiscalDocumentError(\"INVALID_INPUT\", \"only an NFC-e is issued offline.\");\n return { subjectId: stringField(fields, \"subjectId\"), issuingPointId: stringField(fields, \"issuingPointId\"), model: model as FiscalDocumentModel, offline };\n}\n\nfunction profileRoutes({ documents }: FiscalApiConfig): FiscalRoute[] {\n return [\n {\n method: \"GET\",\n path: \"/fiscal/profile\",\n permission: FISCAL_READ,\n handle: ({ actor }) =>\n answering(async () => {\n const profile = await documents.getProfile(actor.ownerId);\n return ok(profile === null ? null : viewOf(profile));\n }),\n },\n {\n method: \"PUT\",\n path: \"/fiscal/profile\",\n permission: FISCAL_MANAGE,\n handle: ({ actor, body }) => answering(async () => ok(viewOf(await documents.saveProfile(actor.ownerId, parseProfileInput(body))))),\n },\n {\n method: \"PUT\",\n path: \"/fiscal/profile/certificate\",\n permission: FISCAL_MANAGE,\n handle: ({ actor, body }) =>\n answering(async () => ok(viewOf(await documents.uploadCertificate(actor.ownerId, parseCertificateUpload(body))))),\n },\n {\n method: \"GET\",\n path: \"/fiscal/issuing-points\",\n permission: FISCAL_READ,\n handle: ({ actor }) => answering(async () => ok(await documents.listIssuingPoints(actor.ownerId))),\n },\n {\n method: \"POST\",\n path: \"/fiscal/issuing-points\",\n permission: FISCAL_MANAGE,\n handle: ({ actor, body }) =>\n answering(async () => ok(await documents.createIssuingPoint(actor.ownerId, parseIssuingPointInput(body)), 201)),\n },\n ];\n}\n\n/** The DANFE of a printable document, as ESC/POS-ready lines. */\nfunction danfeRoute({ documents, storage, danfeLabels }: FiscalApiConfig): FiscalRoute {\n return {\n method: \"GET\",\n path: \"/fiscal/documents/:documentId/danfe\",\n permission: FISCAL_READ,\n handle: (request) =>\n answering(async () => {\n const paper = Number(request.query[\"paper\"] ?? \"80\");\n if (paper !== 58 && paper !== 80) throw new FiscalDocumentError(\"INVALID_INPUT\", \"paper must be 58 or 80.\");\n const document = await documents.getDocument(request.actor.ownerId, param(request, \"documentId\"));\n if (!PRINTABLE.has(document.status)) {\n throw new FiscalDocumentError(\"NOT_PRINTABLE\", `document ${document.id} is ${document.status}: only an AUTHORIZED or CONTINGENCY document prints.`);\n }\n const xml = document.model === \"NFCE\" && document.xmlKey !== null ? await storage.get(document.xmlKey) : null;\n if (xml === null) throw new FiscalDocumentError(\"NOT_FOUND\", `document ${document.id} has no NFC-e XML to print.`);\n return ok(renderDanfeNfce({ xml, paperWidth: paper as PaperWidth, labels: danfeLabels }));\n }),\n };\n}\n\nfunction documentRoutes(config: FiscalApiConfig): FiscalRoute[] {\n const { documents } = config;\n return [\n {\n method: \"POST\",\n path: \"/fiscal/documents\",\n permission: FISCAL_ISSUE,\n handle: ({ actor, body }) =>\n answering(async () => {\n const { offline, ...input } = issueBody(body);\n const document = offline\n ? await documents.issueOffline({ ownerId: actor.ownerId, subjectId: input.subjectId, issuingPointId: input.issuingPointId })\n : await documents.issue({ ownerId: actor.ownerId, ...input });\n return ok(document);\n }),\n },\n {\n method: \"GET\",\n path: \"/fiscal/documents/:documentId\",\n permission: FISCAL_READ,\n handle: (request) =>\n answering(async () => {\n const documentId = param(request, \"documentId\");\n const document = await documents.getDocument(request.actor.ownerId, documentId);\n return ok({ document, events: await documents.listEvents(request.actor.ownerId, documentId) });\n }),\n },\n {\n method: \"POST\",\n path: \"/fiscal/documents/:documentId/cancel\",\n permission: FISCAL_CANCEL,\n handle: (request) =>\n answering(async () => {\n const reason = stringField(record(request.body), \"reason\");\n const result = await documents.cancel({ ownerId: request.actor.ownerId, documentId: param(request, \"documentId\"), reason });\n return result.failure === null\n ? ok(result.document)\n : { status: 422, body: { error: \"ISSUER_FAILURE\", failure: result.failure, data: result.document } };\n }),\n },\n {\n method: \"POST\",\n path: \"/fiscal/documents/:documentId/resend\",\n permission: FISCAL_ISSUE,\n handle: (request) =>\n answering(async () =>\n ok(await documents.resendContingency({ ownerId: request.actor.ownerId, documentId: param(request, \"documentId\") })),\n ),\n },\n {\n method: \"POST\",\n path: \"/fiscal/documents/:documentId/release\",\n permission: FISCAL_ISSUE,\n handle: (request) =>\n answering(async () => ok(await documents.release({ ownerId: request.actor.ownerId, documentId: param(request, \"documentId\") }))),\n },\n {\n method: \"POST\",\n path: \"/fiscal/documents/:documentId/lookup\",\n permission: FISCAL_READ,\n handle: (request) =>\n answering(async () => ok(await documents.lookup({ ownerId: request.actor.ownerId, documentId: param(request, \"documentId\") }))),\n },\n danfeRoute(config),\n ];\n}\n\nexport function createApiFiscal(config: FiscalApiConfig): { routes: readonly FiscalRoute[] } {\n if (config?.documents === undefined) throw new TypeError(\"createApiFiscal needs documents.\");\n if (config.storage === undefined) throw new TypeError(\"createApiFiscal needs storage.\");\n if (config.danfeLabels === undefined) throw new TypeError(\"createApiFiscal needs danfeLabels.\");\n return { routes: [...profileRoutes(config), ...documentRoutes(config)] };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA+DO,IAAM,sBAAsB;AAAA,EACjC,eAAe;AAAA,EACf,WAAW;AAAA,EACX,cAAc;AAAA,EACd,eAAe;AAAA,EACf,oBAAoB;AAAA,EACpB,kBAAkB;AAAA,EAClB,UAAU;AAAA,EACV,sBAAsB;AAAA,EACtB,eAAe;AAAA,EACf,+BAA+B;AAAA,EAC/B,wBAAwB;AAAA,EACxB,gBAAgB;AAClB;AAOA,IAAM,YAAY,oBAAI,IAAI,CAAC,cAAc,aAAa,CAAC;AAEvD,IAAM,KAAK,wBAAC,MAAe,SAAS,SAA6B,EAAE,QAAQ,MAAM,EAAE,KAAK,EAAE,IAA/E;AAEX,eAAe,UAAU,KAAqE;AAC5F,MAAI;AACF,WAAO,MAAM,IAAI;AAAA,EACnB,SAAS,OAAO;AACd,QAAI,iBAAiB,qBAAqB;AACxC,aAAO,EAAE,QAAQ,oBAAoB,MAAM,IAAI,GAAG,MAA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