@zenglobal/api-client 5.1.15 → 5.1.16

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.
@@ -7114,125 +7114,6 @@ export type TransactionCustomer = {
7114
7114
  */
7115
7115
  purchaseorder?: string;
7116
7116
  };
7117
- /**
7118
- * Transaction data structure. Optional fields are left out of the body
7119
- * entirely when they have no value; they are never sent as `null`.
7120
- */
7121
- export type TransactionData = {
7122
- /**
7123
- * Company/chain code
7124
- */
7125
- Company: number;
7126
- /**
7127
- * Site ID
7128
- */
7129
- Site: number;
7130
- /**
7131
- * Location ID
7132
- */
7133
- Location: number;
7134
- /**
7135
- * Terminal number
7136
- */
7137
- Terminal: number;
7138
- /**
7139
- * Journal number
7140
- */
7141
- Journal: number;
7142
- /**
7143
- * Invoice journal number
7144
- */
7145
- InvoiceJournal?: string;
7146
- /**
7147
- * Credit note journal number
7148
- */
7149
- CreditJournal?: string;
7150
- /**
7151
- * Transaction date and time (YYYY-MM-DD HH:MM:SS)
7152
- */
7153
- DateTime: string;
7154
- /**
7155
- * Trading date (YYYY-MM-DD)
7156
- */
7157
- TradingDate: string;
7158
- /**
7159
- * Always `false`
7160
- */
7161
- isTraining: false;
7162
- /**
7163
- * Operator number
7164
- */
7165
- OperatorNumber: number;
7166
- /**
7167
- * Operator name
7168
- */
7169
- OperatorName: string;
7170
- /**
7171
- * Operator login
7172
- */
7173
- OperatorLogin: string;
7174
- /**
7175
- * Cash drawer number
7176
- */
7177
- Cashdrawer: number;
7178
- /**
7179
- * Always an empty string
7180
- */
7181
- EmailReceipt: '';
7182
- /**
7183
- * Customer email
7184
- */
7185
- CustomerEmail: string;
7186
- /**
7187
- * Customer postcode
7188
- */
7189
- Postcode: string;
7190
- /**
7191
- * Customer name
7192
- */
7193
- CustomerName?: string;
7194
- /**
7195
- * Customer address
7196
- */
7197
- CustomerAddress?: string;
7198
- /**
7199
- * Customer phone
7200
- */
7201
- CustomerPhone?: string;
7202
- /**
7203
- * Loyalty information, when a card was used
7204
- */
7205
- Loyalty?: WebhookTransactionLoyalty;
7206
- /**
7207
- * Sales lines
7208
- */
7209
- Sales?: Array<TransactionItem>;
7210
- /**
7211
- * Tenders. Change given is a separate line with a negative amount.
7212
- */
7213
- Tender?: Array<TransactionTender>;
7214
- /**
7215
- * Whole-of-sale discount
7216
- */
7217
- SalesDiscount?: TransactionDiscount;
7218
- /**
7219
- * Rounding
7220
- */
7221
- Rounding?: TransactionRounding;
7222
- };
7223
- /**
7224
- * Transaction discount
7225
- */
7226
- export type TransactionDiscount = {
7227
- /**
7228
- * Discount amount
7229
- */
7230
- Amount: number;
7231
- /**
7232
- * Tax amount on discount
7233
- */
7234
- Tax: number;
7235
- };
7236
7117
  /**
7237
7118
  * Event format transaction response (for format=event query parameter).
7238
7119
  *
@@ -7245,132 +7126,6 @@ export type TransactionDiscount = {
7245
7126
  export type TransactionEventResponse = {
7246
7127
  [key: string]: unknown;
7247
7128
  };
7248
- /**
7249
- * Transaction sales line.
7250
- *
7251
- * At most one of the pairs `SubDepartment`/`SubDepartmentName`,
7252
- * `Category`/`CategoryName`, `SubCategory`/`SubCategoryName` and
7253
- * `Range`/`RangeName` is present, depending on how many department levels
7254
- * the company uses.
7255
- */
7256
- export type TransactionItem = {
7257
- /**
7258
- * Line date and time (YYYY-MM-DD HH:MM:SS)
7259
- */
7260
- DateTime: string;
7261
- /**
7262
- * Item code
7263
- */
7264
- Item: string;
7265
- /**
7266
- * Item barcode
7267
- */
7268
- Barcode: string;
7269
- /**
7270
- * Item description
7271
- */
7272
- Description: string;
7273
- /**
7274
- * Price level
7275
- */
7276
- PriceLevel: number;
7277
- /**
7278
- * Unit price
7279
- */
7280
- Price: number;
7281
- /**
7282
- * Original price before discounts. `0` when not discounted.
7283
- */
7284
- OriginalPrice: number;
7285
- /**
7286
- * Unit cost
7287
- */
7288
- Cost: number;
7289
- /**
7290
- * Quantity sold
7291
- */
7292
- Quantity: number;
7293
- /**
7294
- * Line total
7295
- */
7296
- LineTotal: number;
7297
- /**
7298
- * Line tax
7299
- */
7300
- LineTAX: number;
7301
- /**
7302
- * Discount amount
7303
- */
7304
- Discount: number;
7305
- /**
7306
- * Department code
7307
- */
7308
- Department: number;
7309
- /**
7310
- * Department name
7311
- */
7312
- DepartmentName: string;
7313
- /**
7314
- * Whether the item is on special
7315
- */
7316
- Special: boolean;
7317
- /**
7318
- * Loyalty points earned
7319
- */
7320
- Points?: number;
7321
- /**
7322
- * Bonus points earned
7323
- */
7324
- Bonus?: number;
7325
- /**
7326
- * Whether the item was scanned
7327
- */
7328
- Scanned: boolean;
7329
- /**
7330
- * Scan terminal number. `0` when not scanned.
7331
- */
7332
- ScanTerminal: number;
7333
- /**
7334
- * Brand code. Empty string when the item has no brand.
7335
- */
7336
- Brand: string;
7337
- /**
7338
- * Brand name. Empty string when the item has no brand.
7339
- */
7340
- BrandName: string;
7341
- /**
7342
- * Sub-department code
7343
- */
7344
- SubDepartment?: number;
7345
- /**
7346
- * Sub-department name
7347
- */
7348
- SubDepartmentName?: string;
7349
- /**
7350
- * Category code
7351
- */
7352
- Category?: number;
7353
- /**
7354
- * Category name
7355
- */
7356
- CategoryName?: string;
7357
- /**
7358
- * Sub-category code
7359
- */
7360
- SubCategory?: number;
7361
- /**
7362
- * Sub-category name
7363
- */
7364
- SubCategoryName?: string;
7365
- /**
7366
- * Range code
7367
- */
7368
- Range?: number;
7369
- /**
7370
- * Range name
7371
- */
7372
- RangeName?: string;
7373
- };
7374
7129
  /**
7375
7130
  * Transaction offer structure for creation requests
7376
7131
  */
@@ -7545,15 +7300,6 @@ export type TransactionResponseOffer = {
7545
7300
  */
7546
7301
  customer_loyalty_id?: string;
7547
7302
  };
7548
- /**
7549
- * Transaction rounding
7550
- */
7551
- export type TransactionRounding = {
7552
- /**
7553
- * Rounding amount
7554
- */
7555
- Amount: number;
7556
- };
7557
7303
  /**
7558
7304
  * Transaction sales discount structure.
7559
7305
  * The Sales Discount node activates the sales discount reports in the Portal.
@@ -7590,23 +7336,6 @@ export type TransactionTableInfo = {
7590
7336
  */
7591
7337
  covers?: string;
7592
7338
  };
7593
- /**
7594
- * Transaction tender
7595
- */
7596
- export type TransactionTender = {
7597
- /**
7598
- * Tender type number
7599
- */
7600
- Number: number;
7601
- /**
7602
- * Tender name
7603
- */
7604
- Name: string;
7605
- /**
7606
- * Tender amount
7607
- */
7608
- Amount: number;
7609
- };
7610
7339
  /**
7611
7340
  * Transaction tracking information
7612
7341
  */
@@ -7657,14 +7386,210 @@ export type TransactionVoucher = {
7657
7386
  */
7658
7387
  voiditem?: boolean;
7659
7388
  };
7389
+ export type TransactionWebhookV2Category = {
7390
+ number: number | null;
7391
+ description: string | null;
7392
+ chain: number | null;
7393
+ };
7394
+ export type TransactionWebhookV2CompetitionEntry = {
7395
+ competition_id: number;
7396
+ competition_code: string;
7397
+ competition_name: string;
7398
+ customer_loyalty_id: number;
7399
+ card_number: string | null;
7400
+ entries_count: number;
7401
+ entry_source: string;
7402
+ qualifying_amount: number | null;
7403
+ qualifying_quantity: number | null;
7404
+ entry_metadata: {
7405
+ [key: string]: unknown;
7406
+ } | Array<unknown>;
7407
+ };
7660
7408
  /**
7661
- * Transaction webhook data payload
7409
+ * The `transaction.complete` webhook's `data` (template `zen_transaction_v2`,
7410
+ * ZC-7687): the journal stream record, the same record the LMG Snowflake
7411
+ * stream receives.
7412
+ *
7413
+ * `event_uid` is stable for a journal: it is derived from the portal and the
7414
+ * journal id, so a retry or replay carries the same value. Use it as an
7415
+ * idempotency key.
7416
+ *
7417
+ * Every committed journal is sent, voids and training included. Read
7418
+ * `event_payload.journal.void` and the other flags to tell them apart.
7419
+ *
7420
+ * Object keys arrive in alphabetical order. Do not depend on key order.
7421
+ *
7422
+ * These models are the webhook's own copy, not shared with the stream, so the
7423
+ * two can diverge. Checked against
7424
+ * `fixtures/webhook-parity/transaction_v2.expected.json`.
7662
7425
  */
7663
- export type TransactionWebhookData = {
7426
+ export type TransactionWebhookV2Data = {
7427
+ /**
7428
+ * Always `journal.created`.
7429
+ */
7430
+ event_name: string;
7431
+ /**
7432
+ * When the record was built (ISO 8601, UTC).
7433
+ */
7434
+ event_created_at: string;
7435
+ /**
7436
+ * The portal the journal belongs to.
7437
+ */
7438
+ event_portal_uid: string;
7439
+ /**
7440
+ * Stable per journal: a UUIDv5 of the portal and journal id.
7441
+ */
7442
+ event_uid: string;
7443
+ event_payload: TransactionWebhookV2Payload;
7444
+ };
7445
+ export type TransactionWebhookV2Discount = {
7446
+ amount: number;
7447
+ tax: number;
7448
+ discount_type: string;
7449
+ item_number: string | null;
7450
+ };
7451
+ export type TransactionWebhookV2Journal = {
7452
+ /**
7453
+ * Journal (JOURNALTRACK) id.
7454
+ */
7455
+ id: number;
7456
+ /**
7457
+ * Whether the whole sale was voided.
7458
+ */
7459
+ void: boolean;
7460
+ company: {
7461
+ id: number;
7462
+ name: string;
7463
+ };
7464
+ site: {
7465
+ id: number;
7466
+ name: string | null;
7467
+ customer_reference_id: string | null;
7468
+ };
7469
+ location: {
7470
+ id: number;
7471
+ number: number;
7472
+ name: string | null;
7473
+ };
7474
+ operator: {
7475
+ id: number;
7476
+ number: number;
7477
+ name: string;
7478
+ };
7479
+ terminal: {
7480
+ number: number;
7481
+ cash_drawer: number | null;
7482
+ };
7483
+ /**
7484
+ * Journal number as the POS reported it.
7485
+ */
7486
+ journal_number: string;
7487
+ /**
7488
+ * Local time of the sale, `Y-m-d\TH:i:s`, no offset.
7489
+ */
7490
+ transacted_at: string;
7664
7491
  /**
7665
- * Transaction data container
7492
+ * Loyalty card on the sale, or `null`.
7666
7493
  */
7667
- AMC_POSPortal: TransactionData;
7494
+ loyalty: TransactionWebhookV2Loyalty | null;
7495
+ table: {
7496
+ table_id: number | null;
7497
+ number: number | null;
7498
+ covers: number;
7499
+ };
7500
+ sales: Array<TransactionWebhookV2SaleItem>;
7501
+ tenders: Array<TransactionWebhookV2Tender>;
7502
+ discounts: Array<TransactionWebhookV2Discount>;
7503
+ offers: Array<TransactionWebhookV2Offer>;
7504
+ voids: Array<TransactionWebhookV2Void>;
7505
+ competition_entries: Array<TransactionWebhookV2CompetitionEntry>;
7506
+ sales_breakdown: {
7507
+ sales: number;
7508
+ sales_ex: number;
7509
+ tax: number;
7510
+ cost: number;
7511
+ discount: number;
7512
+ rounding: number;
7513
+ };
7514
+ /**
7515
+ * Empty when the sale earned or spent no points.
7516
+ */
7517
+ points_breakdown: TransactionWebhookV2Points | Array<unknown>;
7518
+ discount_breakdown: {
7519
+ sales: number;
7520
+ item: number;
7521
+ offer: number;
7522
+ };
7523
+ sales_channel: string;
7524
+ partner_id: string;
7525
+ order_reference: string;
7526
+ timezone: string;
7527
+ };
7528
+ export type TransactionWebhookV2Loyalty = {
7529
+ card_number: string;
7530
+ first_name?: string;
7531
+ last_name?: string;
7532
+ mobile?: string | null;
7533
+ card_type?: number;
7534
+ };
7535
+ export type TransactionWebhookV2Offer = {
7536
+ id: number;
7537
+ external_reference: string;
7538
+ total_amount: number;
7539
+ total_quantity: number;
7540
+ effect_type: string;
7541
+ };
7542
+ export type TransactionWebhookV2Payload = {
7543
+ journal: TransactionWebhookV2Journal;
7544
+ };
7545
+ export type TransactionWebhookV2Points = {
7546
+ base: number;
7547
+ bonus: number;
7548
+ jackpot: number;
7549
+ expired: number;
7550
+ redeemed: number;
7551
+ total: number;
7552
+ };
7553
+ export type TransactionWebhookV2SaleItem = {
7554
+ /**
7555
+ * BASKET row id.
7556
+ */
7557
+ basket_id: number | null;
7558
+ item_number: string;
7559
+ source_item_number: string;
7560
+ barcode: string;
7561
+ description: string;
7562
+ promotion_id: string;
7563
+ price_level: number;
7564
+ unit_price: number;
7565
+ unit_cost: number;
7566
+ quantity: number;
7567
+ line_total: number;
7568
+ line_tax: number;
7569
+ line_discount: number;
7570
+ special: boolean;
7571
+ matching_strategy_type: string;
7572
+ kit_type: string;
7573
+ division?: TransactionWebhookV2Category;
7574
+ department?: TransactionWebhookV2Category;
7575
+ sub_department?: TransactionWebhookV2Category;
7576
+ offers: Array<TransactionWebhookV2Offer>;
7577
+ competition_entries: Array<TransactionWebhookV2CompetitionEntry>;
7578
+ };
7579
+ export type TransactionWebhookV2Tender = {
7580
+ number: number;
7581
+ name: string;
7582
+ amount: number;
7583
+ void: boolean;
7584
+ };
7585
+ export type TransactionWebhookV2Void = {
7586
+ amount: number;
7587
+ description: string;
7588
+ item_number: string | null;
7589
+ /**
7590
+ * `item` or `sale`.
7591
+ */
7592
+ type: string;
7668
7593
  };
7669
7594
  /**
7670
7595
  * Validation error for various validation failures (400)
@@ -9292,39 +9217,6 @@ export type WebhookSigningKeyResponse = {
9292
9217
  */
9293
9218
  signing_key: string;
9294
9219
  };
9295
- /**
9296
- * Transaction loyalty information
9297
- */
9298
- export type WebhookTransactionLoyalty = {
9299
- /**
9300
- * Loyalty card number
9301
- */
9302
- Card: string;
9303
- /**
9304
- * Always an empty string
9305
- */
9306
- OpeningPoints: '';
9307
- /**
9308
- * Card holder name, as `Last,First`
9309
- */
9310
- Name: string;
9311
- /**
9312
- * First name
9313
- */
9314
- FirstName: string;
9315
- /**
9316
- * Last name
9317
- */
9318
- LastName: string;
9319
- /**
9320
- * Round points flag
9321
- */
9322
- RoundPoints: boolean;
9323
- /**
9324
- * Card type ID
9325
- */
9326
- CardType: number;
9327
- };
9328
9220
  /**
9329
9221
  * A field-level validation failure.
9330
9222
  */
@@ -13257,7 +13149,7 @@ export type WebhookItemPriceWebhookRequest = {
13257
13149
  };
13258
13150
  export type WebhookTransactionCompleteWebhookPayload = WebhookPayload & {
13259
13151
  function?: 'transaction';
13260
- data: TransactionWebhookData;
13152
+ data: TransactionWebhookV2Data;
13261
13153
  };
13262
13154
  export type WebhookTransactionCompleteWebhookRequest = {
13263
13155
  body: WebhookTransactionCompleteWebhookPayload;