@lucaapp/service-utils 5.38.0 → 5.39.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.
@@ -1,36 +1,35 @@
1
1
  export declare const FISCALIZED_PAYMENT_EVENT_VERSION = 1;
2
2
  export type FiscalizedPaymentEventVersion = typeof FISCALIZED_PAYMENT_EVENT_VERSION;
3
3
  /**
4
- * Emitted by backend-tse when a payment's fiscalization reaches a terminal
5
- * ready state (signed and receipt PDF materializable).
6
- * Consumers (e.g. backend-pay) use this instead of polling readiness.
7
- *
8
- * ID fields are intentionally distinct — they are not always equal:
9
- * - POS checkout fast-path can create `fiscal_payment_events` under a throwaway
10
- * Kafka uuid before `V3Payment` exists; TSE then reuses that fiscal row via
11
- * `checkoutId` and does not rewrite the fiscal id to `V3Payment.uuid`.
12
- * - Cash / HTTP paths often have no `V3Payment` at all.
4
+ * Final fiscalization outcome of a payment, decided by backend-tse:
5
+ * - `FISCALIZED`: the Kassenbeleg is final — signed with its receipt PDF
6
+ * materializable, or issued in Notfallmodus.
7
+ * - `NOT_FISCALIZED`: backend-tse will never fiscalize this payment (a luca-web
8
+ * QR / self-service payment at a location that does not fiscalize web
9
+ * orders). There is no fiscal row and no Kassenbeleg.
10
+ */
11
+ export type FiscalizedPaymentStatus = 'FISCALIZED' | 'NOT_FISCALIZED';
12
+ /**
13
+ * Emitted by backend-tse once a payment's fiscalization outcome is final, so
14
+ * consumers (backend-pay) need not poll readiness. Delivery is at least once:
15
+ * dedupe on the envelope `id` (the fiscal payment id, or the payment id when
16
+ * NOT_FISCALIZED).
13
17
  */
14
18
  export type FiscalizedPayment = {
15
19
  version: FiscalizedPaymentEventVersion;
20
+ status: FiscalizedPaymentStatus;
16
21
  /**
17
- * `fiscal_payment_events.id` — TSE primary key used for receipt-token /
18
- * readiness / PDF. Always present. Envelope `id` should match this.
19
- */
20
- fiscalPaymentEventId: string;
21
- locationId: string;
22
- /**
23
- * backend-pay `V3Payment.uuid` when TSE knows it (settled Kafka card/web
24
- * path). May differ from `fiscalPaymentEventId` after fast-path reuse.
25
- * Absent for cash / when only a throwaway Kafka uuid was seen.
22
+ * backend-pay `V3Payment.uuid` for luca-web QR / self-service payments. Null
23
+ * for POS card payments (backend-tse cannot tell the real uuid from the
24
+ * fast-path one) and cash; resolve those via `checkoutId`.
26
25
  */
27
- paymentId?: string | null;
26
+ paymentId: string | null;
28
27
  /**
29
- * backend-pay `V3Checkout.uuid` when known. Join key when
30
- * `fiscalPaymentEventId` ≠ `paymentId`.
28
+ * `fiscal_payment_events.id` — the key for the receipt token / PDF. Null when
29
+ * NOT_FISCALIZED.
31
30
  */
32
- checkoutId?: string | null;
33
- notfallmodus?: boolean;
34
- tseSigningEventId?: string | null;
35
- statusCompleteAt?: Date | null;
31
+ fiscalPaymentEventId: string | null;
32
+ locationId: string;
33
+ /** backend-pay `V3Checkout.uuid` for card / web payments. */
34
+ checkoutId: string | null;
36
35
  };
@@ -26,6 +26,19 @@ export type OrderEventItem = {
26
26
  tax?: number;
27
27
  subItems?: OrderEventItem[];
28
28
  };
29
+ /**
30
+ * Legal / billing details of the location group, printed as the Kassenbeleg
31
+ * issuer for mirrored web orders (LUCA-36795).
32
+ */
33
+ export type OrderEventIssuer = {
34
+ legalName?: string | null;
35
+ street?: string | null;
36
+ postalCode?: string | null;
37
+ city?: string | null;
38
+ country?: string | null;
39
+ taxNumber?: string | null;
40
+ vatId?: string | null;
41
+ };
29
42
  /**
30
43
  * Emitted by backend-pay when a luca-web order is created (LUCA-36037).
31
44
  * Carries the full order snapshot so consumers can mirror it without a callback.
@@ -45,4 +58,6 @@ export type OrderEvent = {
45
58
  note: string | null;
46
59
  createdAt: Date;
47
60
  items: OrderEventItem[];
61
+ /** Optional so older producers and consumers keep working. */
62
+ issuer?: OrderEventIssuer | null;
48
63
  };
@@ -3,8 +3,8 @@ export { KafkaTopic } from './events';
3
3
  export type { ConversationMessage } from './events/conversationMessage';
4
4
  export type { RefundEvent } from './events/refund';
5
5
  export { REFUND_EVENT_VERSION } from './events/refund';
6
- export type { OrderEvent, OrderEventItem, OrderEventType, OrderEventStatus, OrderEventTranslatableName, } from './events/order';
6
+ export type { OrderEvent, OrderEventIssuer, OrderEventItem, OrderEventType, OrderEventStatus, OrderEventTranslatableName, } from './events/order';
7
7
  export { ORDER_EVENT_VERSION } from './events/order';
8
- export type { FiscalizedPayment } from './events/fiscalizedPayment';
8
+ export type { FiscalizedPayment, FiscalizedPaymentStatus, } from './events/fiscalizedPayment';
9
9
  export { FISCALIZED_PAYMENT_EVENT_VERSION } from './events/fiscalizedPayment';
10
10
  export type { KafkaEvent, GenericKafkaEvent, EventPayloadHandler, GenericEventPayloadHandler, KafkaConfiguration, CustomTopicConfig, CustomTopicPoisonContext, CustomTopicPoisonHandler, } from './types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lucaapp/service-utils",
3
- "version": "5.38.0",
3
+ "version": "5.39.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [