@zenglobal/api-client 5.1.15 → 5.1.17

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,235 @@ 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
+ /**
7405
+ * Free-form details recorded with the entry, such as the basket total and site. `{}` when none were recorded.
7406
+ */
7407
+ entry_metadata: {
7408
+ [key: string]: unknown;
7409
+ };
7410
+ };
7411
+ /**
7412
+ * The `transaction.complete` webhook's `data` (template `zen_transaction_v2`,
7413
+ * ZC-7687): the journal stream record, the same record the LMG Snowflake
7414
+ * stream receives.
7415
+ *
7416
+ * `event_uid` is stable for a journal: it is derived from the portal and the
7417
+ * journal id, so a retry or replay carries the same value. Use it as an
7418
+ * idempotency key.
7419
+ *
7420
+ * Every committed journal is sent, voids and training included. Read
7421
+ * `event_payload.journal.void` and the other flags to tell them apart.
7422
+ *
7423
+ * Object keys arrive in alphabetical order. Do not depend on key order.
7424
+ *
7425
+ * These models are the webhook's own copy, not shared with the stream, so the
7426
+ * two can diverge. Checked against
7427
+ * `fixtures/webhook-parity/transaction_v2.expected.json`.
7428
+ */
7429
+ export type TransactionWebhookV2Data = {
7430
+ /**
7431
+ * Always `journal.created`.
7432
+ */
7433
+ event_name: string;
7434
+ /**
7435
+ * When the record was built (ISO 8601, UTC).
7436
+ */
7437
+ event_created_at: string;
7438
+ /**
7439
+ * The portal the journal belongs to.
7440
+ */
7441
+ event_portal_uid: string;
7442
+ /**
7443
+ * Stable per journal: a UUIDv5 of the portal and journal id.
7444
+ */
7445
+ event_uid: string;
7446
+ event_payload: TransactionWebhookV2Payload;
7447
+ };
7448
+ export type TransactionWebhookV2Discount = {
7449
+ amount: number;
7450
+ tax: number;
7451
+ discount_type: string;
7452
+ item_number: string | null;
7453
+ };
7454
+ export type TransactionWebhookV2Journal = {
7455
+ /**
7456
+ * Journal (JOURNALTRACK) id.
7457
+ */
7458
+ id: number;
7459
+ /**
7460
+ * Whether the whole sale was voided.
7461
+ */
7462
+ void: boolean;
7463
+ company: {
7464
+ id: number;
7465
+ name: string;
7466
+ };
7467
+ site: {
7468
+ id: number;
7469
+ name: string | null;
7470
+ customer_reference_id: string | null;
7471
+ };
7472
+ location: {
7473
+ id: number;
7474
+ number: number;
7475
+ name: string | null;
7476
+ };
7477
+ operator: {
7478
+ id: number;
7479
+ number: number;
7480
+ name: string;
7481
+ };
7482
+ terminal: {
7483
+ number: number;
7484
+ cash_drawer: number | null;
7485
+ };
7486
+ /**
7487
+ * Journal number as the POS reported it.
7488
+ */
7489
+ journal_number: string;
7490
+ /**
7491
+ * Local time of the sale, `Y-m-d\TH:i:s`, no offset.
7492
+ */
7493
+ transacted_at: string;
7494
+ /**
7495
+ * Loyalty card on the sale, or `null`.
7496
+ */
7497
+ loyalty: TransactionWebhookV2Loyalty | null;
7498
+ table: {
7499
+ table_id: number | null;
7500
+ number: number | null;
7501
+ covers: number;
7502
+ };
7503
+ sales: Array<TransactionWebhookV2SaleItem>;
7504
+ tenders: Array<TransactionWebhookV2Tender>;
7505
+ discounts: Array<TransactionWebhookV2Discount>;
7506
+ offers: Array<TransactionWebhookV2Offer>;
7507
+ voids: Array<TransactionWebhookV2Void>;
7508
+ competition_entries: Array<TransactionWebhookV2CompetitionEntry>;
7509
+ sales_breakdown: {
7510
+ sales: number;
7511
+ sales_ex: number;
7512
+ tax: number;
7513
+ cost: number;
7514
+ discount: number;
7515
+ rounding: number;
7516
+ };
7517
+ /**
7518
+ * The points the sale posted to the loyalty card. All zero when the sale has no loyalty card.
7519
+ */
7520
+ points_breakdown: TransactionWebhookV2Points;
7521
+ discount_breakdown: {
7522
+ sales: number;
7523
+ item: number;
7524
+ offer: number;
7525
+ };
7526
+ sales_channel: string;
7527
+ partner_id: string;
7528
+ order_reference: string;
7529
+ timezone: string;
7530
+ };
7531
+ export type TransactionWebhookV2Loyalty = {
7532
+ card_number: string;
7533
+ first_name?: string;
7534
+ last_name?: string;
7535
+ mobile?: string | null;
7536
+ card_type?: number;
7537
+ };
7538
+ export type TransactionWebhookV2Offer = {
7539
+ id: number;
7540
+ external_reference: string;
7541
+ total_amount: number;
7542
+ total_quantity: number;
7543
+ effect_type: string;
7544
+ };
7545
+ export type TransactionWebhookV2Payload = {
7546
+ journal: TransactionWebhookV2Journal;
7547
+ };
7660
7548
  /**
7661
- * Transaction webhook data payload
7549
+ * The points a sale posted to its loyalty card, split by kind.
7550
+ * `base + bonus + jackpot + redeemed + expired = total`.
7662
7551
  */
7663
- export type TransactionWebhookData = {
7552
+ export type TransactionWebhookV2Points = {
7553
+ /**
7554
+ * Points earned at the card's normal rate.
7555
+ */
7556
+ base: number;
7664
7557
  /**
7665
- * Transaction data container
7558
+ * Bonus points included in `total`.
7666
7559
  */
7667
- AMC_POSPortal: TransactionData;
7560
+ bonus: number;
7561
+ /**
7562
+ * Jackpot points included in `total`.
7563
+ */
7564
+ jackpot: number;
7565
+ /**
7566
+ * Expired points included in `total`.
7567
+ */
7568
+ expired: number;
7569
+ /**
7570
+ * Points redeemed. Negative when the sale spent points.
7571
+ */
7572
+ redeemed: number;
7573
+ /**
7574
+ * The net change to the card's balance from this sale.
7575
+ */
7576
+ total: number;
7577
+ };
7578
+ export type TransactionWebhookV2SaleItem = {
7579
+ /**
7580
+ * BASKET row id.
7581
+ */
7582
+ basket_id: number | null;
7583
+ item_number: string;
7584
+ source_item_number: string;
7585
+ barcode: string;
7586
+ description: string;
7587
+ promotion_id: string;
7588
+ price_level: number;
7589
+ unit_price: number;
7590
+ unit_cost: number;
7591
+ quantity: number;
7592
+ line_total: number;
7593
+ line_tax: number;
7594
+ line_discount: number;
7595
+ special: boolean;
7596
+ matching_strategy_type: string;
7597
+ kit_type: string;
7598
+ division?: TransactionWebhookV2Category;
7599
+ department?: TransactionWebhookV2Category;
7600
+ sub_department?: TransactionWebhookV2Category;
7601
+ offers: Array<TransactionWebhookV2Offer>;
7602
+ competition_entries: Array<TransactionWebhookV2CompetitionEntry>;
7603
+ };
7604
+ export type TransactionWebhookV2Tender = {
7605
+ number: number;
7606
+ name: string;
7607
+ amount: number;
7608
+ void: boolean;
7609
+ };
7610
+ export type TransactionWebhookV2Void = {
7611
+ amount: number;
7612
+ description: string;
7613
+ item_number: string | null;
7614
+ /**
7615
+ * `item` or `sale`.
7616
+ */
7617
+ type: string;
7668
7618
  };
7669
7619
  /**
7670
7620
  * Validation error for various validation failures (400)
@@ -9129,9 +9079,9 @@ export type WebhookDestination = {
9129
9079
  [key: string]: unknown;
9130
9080
  } | null;
9131
9081
  /**
9132
- * Whether a 4xx response from your endpoint counts as a permanent failure or a retryable one
9082
+ * What a 4xx response from your endpoint means: `failed` (the default) is a permanent failure that is not retried; `delivered` counts it as delivered.
9133
9083
  */
9134
- treat_4xx_as: 'failed' | 'retry';
9084
+ treat_4xx_as: 'failed' | 'delivered';
9135
9085
  /**
9136
9086
  * Read-only. Whether this destination is live. Creating sets it true and deleting sets it false; it cannot be driven from a request body.
9137
9087
  */
@@ -9207,7 +9157,7 @@ export type WebhookDestinationInput = {
9207
9157
  response_check?: {
9208
9158
  [key: string]: unknown;
9209
9159
  } | null;
9210
- treat_4xx_as?: 'failed' | 'retry';
9160
+ treat_4xx_as?: 'failed' | 'delivered';
9211
9161
  };
9212
9162
  export type WebhookDestinationListResponse = {
9213
9163
  destinations: Array<WebhookDestination>;
@@ -9292,39 +9242,6 @@ export type WebhookSigningKeyResponse = {
9292
9242
  */
9293
9243
  signing_key: string;
9294
9244
  };
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
9245
  /**
9329
9246
  * A field-level validation failure.
9330
9247
  */
@@ -13257,7 +13174,7 @@ export type WebhookItemPriceWebhookRequest = {
13257
13174
  };
13258
13175
  export type WebhookTransactionCompleteWebhookPayload = WebhookPayload & {
13259
13176
  function?: 'transaction';
13260
- data: TransactionWebhookData;
13177
+ data: TransactionWebhookV2Data;
13261
13178
  };
13262
13179
  export type WebhookTransactionCompleteWebhookRequest = {
13263
13180
  body: WebhookTransactionCompleteWebhookPayload;