@stacksjs/commerce 0.75.170 → 0.75.172

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/dist/fiskaly.d.ts CHANGED
@@ -1,22 +1,5 @@
1
1
  /** A fiskaly SIGN DE client for one API key. Tokens are cached and refreshed. */
2
- export declare function fiskalySignDe(options: FiskalyOptions): {
3
- status: unknown.status;
4
- json: unknown
5
- } | {
6
- authenticate: () => Promise<{ organizationId: string | null, environment: string | null }>;
7
- createTss: (tssId: string, metadata?: Record<string, string>) => boolean;
8
- retrieveTss: (tssId: string) => boolean;
9
- setTssState: (tssId: string, state: 'UNINITIALIZED' | 'INITIALIZED' | 'DISABLED') => boolean;
10
- changeAdminPin: (tssId: string, adminPuk: string, newAdminPin: string) => unknown;
11
- authenticateAdmin: (tssId: string, adminPin: string) => unknown;
12
- logoutAdmin: (tssId: string) => unknown;
13
- upsertClient: (tssId: string, clientId: string, serialNumber: string) => boolean;
14
- retrieveClient: (tssId: string, clientId: string) => boolean;
15
- startTransaction: (tssId: string, txId: string, clientId: string) => boolean;
16
- finishTransaction: (tssId: string, txId: string, clientId: string, receipt: FiskalyReceipt, revision?: number) => boolean;
17
- cancelTransaction: (tssId: string, txId: string, clientId: string, revision?: number) => boolean;
18
- retrieveTransaction: (tssId: string, txId: string) => boolean
19
- };
2
+ export declare function fiskalySignDe(options: FiskalyOptions): FiskalySignDe;
20
3
  /**
21
4
  * Takes a TSS from nothing (or from wherever an earlier attempt stopped) to
22
5
  * INITIALIZED with this till registered as its client. Each step is safe to
@@ -114,6 +97,22 @@ export declare interface FiskalyTransaction {
114
97
  log?: { operation: string, timestamp: number, timestamp_format: string }
115
98
  schema?: { standard_v1?: { receipt?: FiskalyReceipt } }
116
99
  }
100
+ /** The calls a till makes to fiskaly SIGN DE with one API key. */
101
+ export declare interface FiskalySignDe {
102
+ authenticate: () => Promise<{ organizationId: string | null, environment: string | null }>
103
+ createTss: (tssId: string, metadata?: Record<string, string>) => Promise<FiskalyTss>
104
+ retrieveTss: (tssId: string) => Promise<FiskalyTss>
105
+ setTssState: (tssId: string, state: 'UNINITIALIZED' | 'INITIALIZED' | 'DISABLED') => Promise<FiskalyTss>
106
+ changeAdminPin: (tssId: string, adminPuk: string, newAdminPin: string) => Promise<Record<string, never>>
107
+ authenticateAdmin: (tssId: string, adminPin: string) => Promise<Record<string, never>>
108
+ logoutAdmin: (tssId: string) => Promise<Record<string, never>>
109
+ upsertClient: (tssId: string, clientId: string, serialNumber: string) => Promise<FiskalyClient>
110
+ retrieveClient: (tssId: string, clientId: string) => Promise<FiskalyClient>
111
+ startTransaction: (tssId: string, txId: string, clientId: string) => Promise<FiskalyTransaction>
112
+ finishTransaction: (tssId: string, txId: string, clientId: string, receipt: FiskalyReceipt, revision?: number) => Promise<FiskalyTransaction>
113
+ cancelTransaction: (tssId: string, txId: string, clientId: string, revision?: number) => Promise<FiskalyTransaction>
114
+ retrieveTransaction: (tssId: string, txId: string) => Promise<FiskalyTransaction>
115
+ }
117
116
  export declare interface ProvisionInput {
118
117
  tssId: string
119
118
  clientId: string
@@ -132,7 +131,6 @@ export type TssState = 'CREATED' | 'UNINITIALIZED' | 'INITIALIZED' | 'DISABLED'
132
131
  export type FiskalyVatRate = 'NORMAL' | 'REDUCED_1' | 'SPECIAL_RATE_1' | 'SPECIAL_RATE_2' | 'NULL';
133
132
  export type FiskalyPaymentType = 'CASH' | 'NON_CASH';
134
133
  export type FiskalyReceiptType = 'RECEIPT' | 'TRAINING' | 'TRANSFER' | 'ORDER' | 'CANCELLATION' | 'ABORT' | 'BENEFIT_IN_KIND' | 'INVOICE' | 'OTHER';
135
- export type FiskalySignDe = ReturnType<typeof fiskalySignDe>;
136
134
  export declare class FiskalyError extends Error {
137
135
  readonly failure: FiskalyFailure;
138
136
  readonly status: number;
@@ -15,11 +15,7 @@ export declare function tseAmount(cents: number): string;
15
15
  */
16
16
  export declare function processData(input: { bonTyp?: BonTyp, vat: readonly TseVatAmount[], payments: readonly TsePayment[] }): string;
17
17
  /** fiskaly's receipt schema (`schema.standard_v1.receipt`) for the same amounts. */
18
- export declare function fiskalyReceiptFor(input: { vat: readonly TseVatAmount[], payments: readonly TsePayment[], receiptType?: 'RECEIPT' | 'TRAINING' | 'TRANSFER' | 'ORDER' | 'CANCELLATION' | 'ABORT' | 'BENEFIT_IN_KIND' | 'INVOICE' | 'OTHER' }): {
19
- receipt_type: unknown;
20
- amounts_per_vat_rate: unknown;
21
- amounts_per_payment_type: unknown
22
- };
18
+ export declare function fiskalyReceiptFor(input: { vat: readonly TseVatAmount[], payments: readonly TsePayment[], receiptType?: FiskalyReceiptSchema['receipt_type'] }): FiskalyReceiptSchema;
23
19
  /** A TSE time as receipts and the export write it: `YYYY-MM-DDThh:mm:ss.fffZ` (UTC). Takes unix seconds, an ISO string or a Date. */
24
20
  export declare function tseTime(value: number | string | Date): string;
25
21
  /** The receipt's QR code content (DSFinV-K Anhang I): twelve fields joined by ";", starting with "V0". */
@@ -80,6 +76,12 @@ export declare const DE_VAT_KEYS: {
80
76
  export declare const TSE_FAILURE_NOTICE: 'TSE ausgefallen';
81
77
  export declare interface TseVatAmount { key: DeVatKey, grossCents: number }
82
78
  export declare interface TsePayment { kind: TsePaymentKind, cents: number, currency?: string }
79
+ /** fiskaly's receipt schema (`schema.standard_v1.receipt`), as `fiskalyReceiptFor` writes it. */
80
+ export declare interface FiskalyReceiptSchema {
81
+ receipt_type: 'RECEIPT' | 'TRAINING' | 'TRANSFER' | 'ORDER' | 'CANCELLATION' | 'ABORT' | 'BENEFIT_IN_KIND' | 'INVOICE' | 'OTHER'
82
+ amounts_per_vat_rate: Array<{ vat_rate: 'NORMAL' | 'REDUCED_1' | 'SPECIAL_RATE_1' | 'SPECIAL_RATE_2' | 'NULL', amount: string }>
83
+ amounts_per_payment_type: Array<{ payment_type: 'CASH' | 'NON_CASH', amount: string, currency_code?: string }>
84
+ }
83
85
  export declare interface ReceiptQrInput {
84
86
  clientSerialNumber: string
85
87
  processType: 'Kassenbeleg-V1' | 'Bestellung-V1' | 'SonstigerVorgang'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/commerce",
3
3
  "type": "module",
4
- "version": "0.75.170",
4
+ "version": "0.75.172",
5
5
  "description": "Stacks commerce utilities.",
6
6
  "author": "Chris Breuer",
7
7
  "contributors": [
@@ -57,18 +57,18 @@
57
57
  "prepublishOnly": "bun run build"
58
58
  },
59
59
  "dependencies": {
60
- "@stacksjs/cache": "0.75.170",
61
- "@stacksjs/config": "0.75.170",
62
- "@stacksjs/database": "0.75.170",
63
- "@stacksjs/env": "0.75.170",
64
- "@stacksjs/error-handling": "0.75.170",
65
- "@stacksjs/events": "0.75.170",
66
- "@stacksjs/logging": "0.75.170",
67
- "@stacksjs/orm": "0.75.170",
68
- "@stacksjs/payments": "0.75.170",
69
- "@stacksjs/realtime": "0.75.170",
70
- "@stacksjs/strings": "0.75.170",
71
- "@stacksjs/validation": "0.75.170",
60
+ "@stacksjs/cache": "0.75.172",
61
+ "@stacksjs/config": "0.75.172",
62
+ "@stacksjs/database": "0.75.172",
63
+ "@stacksjs/env": "0.75.172",
64
+ "@stacksjs/error-handling": "0.75.172",
65
+ "@stacksjs/events": "0.75.172",
66
+ "@stacksjs/logging": "0.75.172",
67
+ "@stacksjs/orm": "0.75.172",
68
+ "@stacksjs/payments": "0.75.172",
69
+ "@stacksjs/realtime": "0.75.172",
70
+ "@stacksjs/strings": "0.75.172",
71
+ "@stacksjs/validation": "0.75.172",
72
72
  "ts-spreadsheets": "^0.2.0"
73
73
  },
74
74
  "devDependencies": {