@lucaapp/service-utils 5.37.1 → 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.
@@ -0,0 +1,35 @@
1
+ export declare const FISCALIZED_PAYMENT_EVENT_VERSION = 1;
2
+ export type FiscalizedPaymentEventVersion = typeof FISCALIZED_PAYMENT_EVENT_VERSION;
3
+ /**
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).
17
+ */
18
+ export type FiscalizedPayment = {
19
+ version: FiscalizedPaymentEventVersion;
20
+ status: FiscalizedPaymentStatus;
21
+ /**
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`.
25
+ */
26
+ paymentId: string | null;
27
+ /**
28
+ * `fiscal_payment_events.id` — the key for the receipt token / PDF. Null when
29
+ * NOT_FISCALIZED.
30
+ */
31
+ fiscalPaymentEventId: string | null;
32
+ locationId: string;
33
+ /** backend-pay `V3Checkout.uuid` for card / web payments. */
34
+ checkoutId: string | null;
35
+ };
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FISCALIZED_PAYMENT_EVENT_VERSION = void 0;
4
+ exports.FISCALIZED_PAYMENT_EVENT_VERSION = 1;
@@ -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
  };
@@ -1,6 +1,7 @@
1
1
  import type { Payment, PaymentEvent } from './events/payment';
2
2
  import type { OrderEvent } from './events/order';
3
3
  import type { RefundEvent } from './events/refund';
4
+ import type { FiscalizedPayment } from './events/fiscalizedPayment';
4
5
  import type { Consumer } from './events/consumer';
5
6
  import type { Operator } from './events/operator';
6
7
  import type { LocationGroupEmployees } from './events/locationGroupEmployees';
@@ -23,6 +24,7 @@ declare enum KafkaTopic {
23
24
  PAYMENTS = "payments",
24
25
  ORDERS = "orders",
25
26
  REFUNDS = "refunds",
27
+ FISCALIZED_PAYMENTS = "fiscalized_payments",
26
28
  CONSUMERS = "consumers",
27
29
  OPERATORS = "operators",
28
30
  OPERATORS_PAY = "operators_pay",
@@ -48,6 +50,7 @@ type MessageFormats = {
48
50
  [KafkaTopic.PAYMENTS]: Payment | PaymentEvent;
49
51
  [KafkaTopic.ORDERS]: OrderEvent;
50
52
  [KafkaTopic.REFUNDS]: RefundEvent;
53
+ [KafkaTopic.FISCALIZED_PAYMENTS]: FiscalizedPayment;
51
54
  [KafkaTopic.CONSUMERS]: Consumer;
52
55
  [KafkaTopic.OPERATORS]: Operator;
53
56
  [KafkaTopic.OPERATORS_PAY]: OperatorPay;
@@ -73,6 +76,7 @@ declare const MessageIssuer: {
73
76
  payments: Service;
74
77
  orders: Service;
75
78
  refunds: Service;
79
+ fiscalized_payments: Service;
76
80
  consumers: Service;
77
81
  operators: Service;
78
82
  operator_devices: Service;
@@ -7,6 +7,7 @@ var KafkaTopic;
7
7
  KafkaTopic["PAYMENTS"] = "payments";
8
8
  KafkaTopic["ORDERS"] = "orders";
9
9
  KafkaTopic["REFUNDS"] = "refunds";
10
+ KafkaTopic["FISCALIZED_PAYMENTS"] = "fiscalized_payments";
10
11
  KafkaTopic["CONSUMERS"] = "consumers";
11
12
  KafkaTopic["OPERATORS"] = "operators";
12
13
  KafkaTopic["OPERATORS_PAY"] = "operators_pay";
@@ -32,6 +33,7 @@ const MessageIssuer = {
32
33
  [KafkaTopic.PAYMENTS]: serviceIdentity_1.Service.BACKEND_PAY,
33
34
  [KafkaTopic.ORDERS]: serviceIdentity_1.Service.BACKEND_PAY,
34
35
  [KafkaTopic.REFUNDS]: serviceIdentity_1.Service.BACKEND_PAY,
36
+ [KafkaTopic.FISCALIZED_PAYMENTS]: serviceIdentity_1.Service.BACKEND_TSE,
35
37
  [KafkaTopic.CONSUMERS]: serviceIdentity_1.Service.BACKEND,
36
38
  [KafkaTopic.OPERATORS]: serviceIdentity_1.Service.BACKEND,
37
39
  [KafkaTopic.OPERATOR_DEVICES]: serviceIdentity_1.Service.BACKEND,
@@ -3,6 +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, FiscalizedPaymentStatus, } from './events/fiscalizedPayment';
9
+ export { FISCALIZED_PAYMENT_EVENT_VERSION } from './events/fiscalizedPayment';
8
10
  export type { KafkaEvent, GenericKafkaEvent, EventPayloadHandler, GenericEventPayloadHandler, KafkaConfiguration, CustomTopicConfig, CustomTopicPoisonContext, CustomTopicPoisonHandler, } from './types';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ORDER_EVENT_VERSION = exports.REFUND_EVENT_VERSION = exports.KafkaTopic = exports.KafkaClient = void 0;
3
+ exports.FISCALIZED_PAYMENT_EVENT_VERSION = exports.ORDER_EVENT_VERSION = exports.REFUND_EVENT_VERSION = exports.KafkaTopic = exports.KafkaClient = void 0;
4
4
  var kafkaClient_1 = require("./kafkaClient");
5
5
  Object.defineProperty(exports, "KafkaClient", { enumerable: true, get: function () { return kafkaClient_1.KafkaClient; } });
6
6
  var events_1 = require("./events");
@@ -9,3 +9,5 @@ var refund_1 = require("./events/refund");
9
9
  Object.defineProperty(exports, "REFUND_EVENT_VERSION", { enumerable: true, get: function () { return refund_1.REFUND_EVENT_VERSION; } });
10
10
  var order_1 = require("./events/order");
11
11
  Object.defineProperty(exports, "ORDER_EVENT_VERSION", { enumerable: true, get: function () { return order_1.ORDER_EVENT_VERSION; } });
12
+ var fiscalizedPayment_1 = require("./events/fiscalizedPayment");
13
+ Object.defineProperty(exports, "FISCALIZED_PAYMENT_EVENT_VERSION", { enumerable: true, get: function () { return fiscalizedPayment_1.FISCALIZED_PAYMENT_EVENT_VERSION; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lucaapp/service-utils",
3
- "version": "5.37.1",
3
+ "version": "5.39.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [