@lucaapp/service-utils 5.31.0 → 5.32.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,48 @@
1
+ import { SupportedCurrencies } from '../../money/supportedCurrencies';
2
+ export declare const ORDER_EVENT_VERSION = 1;
3
+ export type OrderEventVersion = typeof ORDER_EVENT_VERSION;
4
+ /**
5
+ * luca-web order types mirrored to downstream consumers (LUCA-36037).
6
+ * String-typed on the wire to stay decoupled from backend-pay's OrderType enum;
7
+ * these are the currently-produced values.
8
+ */
9
+ export type OrderEventType = 'HOTEL_SPECIAL_OFFER' | 'HOTEL_MINI_BAR' | 'IN_ROOM_ORDER' | 'QR_CODE_ORDER' | 'SELF_SERVICE_SHOP_ORDER' | 'PRE_ORDER' | 'TERMINAL_ORDER';
10
+ export type OrderEventStatus = 'OPEN' | 'PAID' | 'REFUNDED';
11
+ /**
12
+ * Localised display text keyed by locale; `de` is always present.
13
+ * Mirrors the menu snapshot backend-pay stores on the order line.
14
+ */
15
+ export type OrderEventTranslatableName = {
16
+ de: string;
17
+ en?: string;
18
+ [locale: string]: string | undefined;
19
+ };
20
+ export type OrderEventItem = {
21
+ name: OrderEventTranslatableName;
22
+ quantity: number;
23
+ /** Unit price in minor units (cents). */
24
+ price: number;
25
+ /** VAT rate in percent, when known. */
26
+ tax?: number;
27
+ subItems?: OrderEventItem[];
28
+ };
29
+ /**
30
+ * Emitted by backend-pay when a luca-web order is created (LUCA-36037).
31
+ * Carries the full order snapshot so consumers can mirror it without a callback.
32
+ */
33
+ export type OrderEvent = {
34
+ version: OrderEventVersion;
35
+ uuid: string;
36
+ orderRef: string;
37
+ type: OrderEventType | null;
38
+ status: OrderEventStatus;
39
+ locationId: string;
40
+ locationGroupId: string;
41
+ currency: SupportedCurrencies;
42
+ /** Invoice total in minor units (cents). */
43
+ invoiceAmount: number;
44
+ table: string | null;
45
+ note: string | null;
46
+ createdAt: Date;
47
+ items: OrderEventItem[];
48
+ };
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ORDER_EVENT_VERSION = void 0;
4
+ exports.ORDER_EVENT_VERSION = 1;
@@ -70,6 +70,12 @@ export type PaymentEvent = {
70
70
  paymentVerifier: string;
71
71
  checkoutId?: string;
72
72
  orderId?: string;
73
+ /**
74
+ * backend-pay Orders.uuid[] linked to this payment's checkout (LUCA-36037).
75
+ * Distinct from the singular `orderId` (the luca-POS order id). A checkout can
76
+ * cover multiple orders, so this is a list. Absent for non-web payments.
77
+ */
78
+ payOrderIds?: string[] | null;
73
79
  statusCompleteAt?: Date | null;
74
80
  merchantDetails?: PaymentMerchantDetails;
75
81
  } & PaymentEventCardAcquirerFields;
@@ -27,4 +27,6 @@ export type RefundEvent = {
27
27
  checkoutId?: string | null;
28
28
  /** Payment method of the original payment (e.g. CARD). */
29
29
  method?: string | null;
30
+ /** Optional on the wire for in-flight events produced before this field existed. */
31
+ reason?: string | null;
30
32
  };
@@ -1,4 +1,5 @@
1
1
  import type { Payment, PaymentEvent } from './events/payment';
2
+ import type { OrderEvent } from './events/order';
2
3
  import type { RefundEvent } from './events/refund';
3
4
  import type { Consumer } from './events/consumer';
4
5
  import type { Operator } from './events/operator';
@@ -20,6 +21,7 @@ import { TokenizationJobItem } from './events/tokenizationJobItem';
20
21
  import { Organization, OperatorOrganization } from '../../types/organization';
21
22
  declare enum KafkaTopic {
22
23
  PAYMENTS = "payments",
24
+ ORDERS = "orders",
23
25
  REFUNDS = "refunds",
24
26
  CONSUMERS = "consumers",
25
27
  OPERATORS = "operators",
@@ -44,6 +46,7 @@ declare enum KafkaTopic {
44
46
  }
45
47
  type MessageFormats = {
46
48
  [KafkaTopic.PAYMENTS]: Payment | PaymentEvent;
49
+ [KafkaTopic.ORDERS]: OrderEvent;
47
50
  [KafkaTopic.REFUNDS]: RefundEvent;
48
51
  [KafkaTopic.CONSUMERS]: Consumer;
49
52
  [KafkaTopic.OPERATORS]: Operator;
@@ -68,6 +71,7 @@ type MessageFormats = {
68
71
  };
69
72
  declare const MessageIssuer: {
70
73
  payments: Service;
74
+ orders: Service;
71
75
  refunds: Service;
72
76
  consumers: Service;
73
77
  operators: Service;
@@ -5,6 +5,7 @@ const serviceIdentity_1 = require("../serviceIdentity");
5
5
  var KafkaTopic;
6
6
  (function (KafkaTopic) {
7
7
  KafkaTopic["PAYMENTS"] = "payments";
8
+ KafkaTopic["ORDERS"] = "orders";
8
9
  KafkaTopic["REFUNDS"] = "refunds";
9
10
  KafkaTopic["CONSUMERS"] = "consumers";
10
11
  KafkaTopic["OPERATORS"] = "operators";
@@ -29,6 +30,7 @@ var KafkaTopic;
29
30
  })(KafkaTopic || (exports.KafkaTopic = KafkaTopic = {}));
30
31
  const MessageIssuer = {
31
32
  [KafkaTopic.PAYMENTS]: serviceIdentity_1.Service.BACKEND_PAY,
33
+ [KafkaTopic.ORDERS]: serviceIdentity_1.Service.BACKEND_PAY,
32
34
  [KafkaTopic.REFUNDS]: serviceIdentity_1.Service.BACKEND_PAY,
33
35
  [KafkaTopic.CONSUMERS]: serviceIdentity_1.Service.BACKEND,
34
36
  [KafkaTopic.OPERATORS]: serviceIdentity_1.Service.BACKEND,
@@ -54,5 +56,6 @@ const MessageIssuer = {
54
56
  exports.MessageIssuer = MessageIssuer;
55
57
  const MessageSignatureIssuers = {
56
58
  [KafkaTopic.PAYMENTS]: [serviceIdentity_1.Service.BACKEND_PAY, serviceIdentity_1.Service.BACKEND_TSE],
59
+ [KafkaTopic.ORDERS]: [serviceIdentity_1.Service.BACKEND_PAY],
57
60
  };
58
61
  exports.MessageSignatureIssuers = MessageSignatureIssuers;
@@ -3,4 +3,6 @@ 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';
7
+ export { ORDER_EVENT_VERSION } from './events/order';
6
8
  export type { KafkaEvent, GenericKafkaEvent, EventPayloadHandler, GenericEventPayloadHandler, KafkaConfiguration, CustomTopicConfig, CustomTopicPoisonContext, CustomTopicPoisonHandler, } from './types';
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.REFUND_EVENT_VERSION = exports.KafkaTopic = exports.KafkaClient = void 0;
3
+ 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");
7
7
  Object.defineProperty(exports, "KafkaTopic", { enumerable: true, get: function () { return events_1.KafkaTopic; } });
8
8
  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
+ var order_1 = require("./events/order");
11
+ Object.defineProperty(exports, "ORDER_EVENT_VERSION", { enumerable: true, get: function () { return order_1.ORDER_EVENT_VERSION; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lucaapp/service-utils",
3
- "version": "5.31.0",
3
+ "version": "5.32.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -105,7 +105,7 @@
105
105
  "fast-xml-builder": "^1.1.7",
106
106
  "brace-expansion": "2.1.4",
107
107
  "form-data": "4.0.6",
108
- "js-yaml": "4.3.1",
108
+ "js-yaml": "4.3.2",
109
109
  "@opentelemetry/core": "2.8.0"
110
110
  }
111
111
  }