@zenglobal/api-client 5.1.14 → 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.
@@ -1,7 +1,7 @@
1
1
  export type ClientOptions = {
2
2
  baseUrl: 'https://api-dev.zenglobal.au' | 'https://api.zenglobal.au' | (string & {});
3
3
  };
4
- export type Webhooks = WebhookLoyaltyWebhookRequest | WebhookCustomerWebhookRequest | WebhookOfferWebhookRequest | WebhookRedeemWebhookRequest | WebhookDeleteWebhookRequest | WebhookItemWebhookRequest | WebhookPriceWebhookRequest | WebhookTransactionWebhookRequest;
4
+ export type Webhooks = WebhookLoyaltyCardWebhookRequest | WebhookLoyaltyPointsWebhookRequest | WebhookCustomerUpsertWebhookRequest | WebhookOfferCreateWebhookRequest | WebhookOfferUpdateWebhookRequest | WebhookOfferRedeemWebhookRequest | WebhookOfferDeleteWebhookRequest | WebhookItemSohWebhookRequest | WebhookItemPriceWebhookRequest | WebhookTransactionCompleteWebhookRequest | WebhookPingWebhookRequest;
5
5
  /**
6
6
  * Address structure used for billing and shipping addresses
7
7
  */
@@ -38,27 +38,27 @@ export type AddressData = {
38
38
  /**
39
39
  * Address line 1
40
40
  */
41
- address1?: string;
41
+ address1: string;
42
42
  /**
43
43
  * Address line 2
44
44
  */
45
- address2?: string;
45
+ address2: string;
46
46
  /**
47
47
  * Suburb
48
48
  */
49
- suburb?: string;
49
+ suburb: string;
50
50
  /**
51
51
  * State
52
52
  */
53
- state?: string;
53
+ state: string;
54
54
  /**
55
55
  * Postcode
56
56
  */
57
- postcode?: string;
57
+ postcode: string;
58
58
  /**
59
59
  * Country
60
60
  */
61
- country?: string;
61
+ country: string;
62
62
  };
63
63
  /**
64
64
  * Response for GET /lists.
@@ -808,7 +808,7 @@ export type CustomerData = {
808
808
  /**
809
809
  * Company/chain code
810
810
  */
811
- Company: string;
811
+ Company: number;
812
812
  /**
813
813
  * Customer number
814
814
  */
@@ -820,35 +820,36 @@ export type CustomerData = {
820
820
  /**
821
821
  * Email address
822
822
  */
823
- email?: string;
823
+ email: string;
824
824
  /**
825
825
  * Mobile number
826
826
  */
827
- mobile?: string;
827
+ mobile: string;
828
828
  /**
829
829
  * Phone number
830
830
  */
831
- phone?: string;
831
+ phone: string;
832
832
  /**
833
833
  * Secondary phone number
834
834
  */
835
- phone1?: string;
835
+ phone1: string;
836
836
  /**
837
837
  * Gender
838
838
  */
839
- gender?: string;
839
+ gender: string;
840
840
  /**
841
- * Date of birth
841
+ * Date of birth (YYYY-MM-DD)
842
842
  */
843
- dateofbirth?: string;
843
+ dateofbirth: string;
844
844
  /**
845
845
  * WooCommerce customer ID
846
846
  */
847
- woocommerce?: string;
847
+ woocommerce: string;
848
848
  /**
849
- * Shopify customer ID
849
+ * Shopify customer ID. The key really is spelled `shopfiy`; it has always
850
+ * been sent that way and is kept for compatibility.
850
851
  */
851
- shopify?: string;
852
+ shopfiy: string;
852
853
  /**
853
854
  * Billing address
854
855
  */
@@ -858,9 +859,9 @@ export type CustomerData = {
858
859
  */
859
860
  shipping: AddressData;
860
861
  /**
861
- * Associated loyalty cards
862
+ * Loyalty cards linked to the customer. An empty array when there are none.
862
863
  */
863
- cards?: Array<LoyaltyCardSummary>;
864
+ cards: Array<LoyaltyCardSummary>;
864
865
  };
865
866
  /**
866
867
  * The error body these operations return.
@@ -1362,53 +1363,108 @@ export type InventoryLoyaltyGroup = {
1362
1363
  description: string;
1363
1364
  };
1364
1365
  /**
1365
- * Inventory webhook data payload
1366
+ * Price change, sent on `item.price`. The fields are at the top level of
1367
+ * `data`, not in a wrapper object.
1366
1368
  */
1367
- export type InventoryWebhookData = {
1369
+ export type InventoryPriceWebhookData = {
1370
+ /**
1371
+ * Company/chain code
1372
+ */
1373
+ chain: number;
1374
+ /**
1375
+ * Company/chain code (same value as `chain`)
1376
+ */
1377
+ Company: number;
1378
+ /**
1379
+ * Site ID
1380
+ */
1381
+ Site: number;
1382
+ /**
1383
+ * Location ID
1384
+ */
1385
+ Location: number;
1368
1386
  /**
1369
1387
  * Item code
1370
1388
  */
1371
1389
  Item: string;
1390
+ /**
1391
+ * New price
1392
+ */
1393
+ Price: number;
1394
+ /**
1395
+ * Always `false`
1396
+ */
1397
+ sohFlag: false;
1398
+ /**
1399
+ * Always `true`
1400
+ */
1401
+ priceFlag: true;
1402
+ };
1403
+ /**
1404
+ * Stock-on-hand change, sent on `item.soh`. The fields are at the top level
1405
+ * of `data`, not in a wrapper object.
1406
+ *
1407
+ * Exactly one of `StockOnHand` and `DeltaQuantity` is present, chosen by
1408
+ * `delta`. `PreviousSOH`, `CurrentSOH`, `ReferralItem` and `ReferralRatio`
1409
+ * are each left out when they have no value.
1410
+ */
1411
+ export type InventorySohWebhookData = {
1372
1412
  /**
1373
1413
  * Company/chain code
1374
1414
  */
1375
- chain: string;
1415
+ chain: number;
1376
1416
  /**
1377
- * Company/chain code (duplicate)
1417
+ * Company/chain code (same value as `chain`)
1378
1418
  */
1379
- Company: string;
1419
+ Company: number;
1380
1420
  /**
1381
- * Whether stock on hand has changed
1421
+ * Site ID
1382
1422
  */
1383
- sohFlag: boolean;
1423
+ Site: number;
1384
1424
  /**
1385
- * Whether price has changed
1425
+ * Location ID
1386
1426
  */
1387
- priceFlag: boolean;
1427
+ Location: number;
1388
1428
  /**
1389
- * Current stock on hand
1429
+ * Item code
1390
1430
  */
1391
- stockOnHand?: number;
1431
+ Item: string;
1392
1432
  /**
1393
- * Item price
1433
+ * Always `true`
1394
1434
  */
1395
- price?: number;
1435
+ sohFlag: true;
1396
1436
  /**
1397
- * Item cost
1437
+ * Always `false`
1398
1438
  */
1399
- cost?: number;
1439
+ priceFlag: false;
1400
1440
  /**
1401
- * Item description
1441
+ * `true` when the change is sent as a quantity change (`DeltaQuantity`), `false` when it is the new level (`StockOnHand`)
1402
1442
  */
1403
- description?: string;
1443
+ delta: boolean;
1404
1444
  /**
1405
- * Department code
1445
+ * Stock on hand. Present when `delta` is `false`.
1406
1446
  */
1407
- department?: number;
1447
+ StockOnHand?: number;
1408
1448
  /**
1409
- * Site code
1449
+ * Change in stock on hand. Present when `delta` is `true`.
1450
+ */
1451
+ DeltaQuantity?: number;
1452
+ /**
1453
+ * Stock on hand before the change
1454
+ */
1455
+ PreviousSOH?: number;
1456
+ /**
1457
+ * Stock on hand after the change
1458
+ */
1459
+ CurrentSOH?: number;
1460
+ /**
1461
+ * Referral item code
1410
1462
  */
1411
- sitecode?: string;
1463
+ ReferralItem?: string;
1464
+ /**
1465
+ * Ratio between this item and `ReferralItem`
1466
+ */
1467
+ ReferralRatio?: number;
1412
1468
  };
1413
1469
  /**
1414
1470
  * Active jackpot information
@@ -2399,7 +2455,7 @@ export type LoyaltyCardData = {
2399
2455
  /**
2400
2456
  * Company/chain code
2401
2457
  */
2402
- Company: string;
2458
+ Company: number;
2403
2459
  /**
2404
2460
  * Loyalty card number
2405
2461
  */
@@ -2409,21 +2465,21 @@ export type LoyaltyCardData = {
2409
2465
  */
2410
2466
  Customer: string;
2411
2467
  /**
2412
- * Family card number (if linked)
2468
+ * Family card number, or an empty string if the card is not linked
2413
2469
  */
2414
2470
  FamilyCard: string;
2415
2471
  /**
2416
- * Original card number before conversion
2472
+ * Same value as `Card`
2417
2473
  */
2418
2474
  OriginalCard: string;
2419
2475
  /**
2420
- * Card status
2476
+ * Always `Present`
2421
2477
  */
2422
- Status: string;
2478
+ Status: 'Present';
2423
2479
  /**
2424
2480
  * Customer salutation
2425
2481
  */
2426
- Salutation?: string;
2482
+ Salutation: string;
2427
2483
  /**
2428
2484
  * First name
2429
2485
  */
@@ -2435,77 +2491,77 @@ export type LoyaltyCardData = {
2435
2491
  /**
2436
2492
  * Card PIN
2437
2493
  */
2438
- pin?: string;
2494
+ pin: string;
2439
2495
  /**
2440
2496
  * Gender
2441
2497
  */
2442
- Gender?: string;
2498
+ Gender: string;
2443
2499
  /**
2444
2500
  * Address line 1
2445
2501
  */
2446
- Address1?: string;
2502
+ Address1: string;
2447
2503
  /**
2448
2504
  * Address line 2
2449
2505
  */
2450
- Address2?: string;
2506
+ Address2: string;
2451
2507
  /**
2452
2508
  * Suburb
2453
2509
  */
2454
- Suburb?: string;
2510
+ Suburb: string;
2455
2511
  /**
2456
2512
  * State
2457
2513
  */
2458
- State?: string;
2514
+ State: string;
2459
2515
  /**
2460
2516
  * Postcode
2461
2517
  */
2462
- Postcode?: string;
2518
+ Postcode: string;
2463
2519
  /**
2464
2520
  * Security token
2465
2521
  */
2466
- Token?: string;
2522
+ Token: string;
2467
2523
  /**
2468
- * App token
2524
+ * Always an empty string
2469
2525
  */
2470
- AppToken?: string;
2526
+ AppToken: '';
2471
2527
  /**
2472
- * App operating system
2528
+ * Always an empty string
2473
2529
  */
2474
- AppSystem?: string;
2530
+ AppSystem: '';
2475
2531
  /**
2476
2532
  * Email address
2477
2533
  */
2478
- Email?: string;
2534
+ Email: string;
2479
2535
  /**
2480
2536
  * Phone number
2481
2537
  */
2482
- Phone?: string;
2538
+ Phone: string;
2483
2539
  /**
2484
2540
  * Secondary phone number
2485
2541
  */
2486
- Phone2?: string;
2542
+ Phone2: string;
2487
2543
  /**
2488
2544
  * Mobile number
2489
2545
  */
2490
- Mobile?: string;
2546
+ Mobile: string;
2491
2547
  /**
2492
2548
  * Fax number
2493
2549
  */
2494
- Fax?: string;
2550
+ Fax: string;
2495
2551
  /**
2496
2552
  * Occupation
2497
2553
  */
2498
- Occupation?: string;
2554
+ Occupation: string;
2499
2555
  /**
2500
- * Date of birth
2556
+ * Date of birth (YYYY-MM-DD)
2501
2557
  */
2502
- dateOfBirth?: string;
2558
+ dateOfBirth: string;
2503
2559
  /**
2504
2560
  * Card type ID
2505
2561
  */
2506
- CARDTYPE: string;
2562
+ CARDTYPE: number;
2507
2563
  /**
2508
- * Whether card follows default settings
2564
+ * Whether the card follows its card type's default settings
2509
2565
  */
2510
2566
  FOLLOWCARD: 'T' | 'F';
2511
2567
  /**
@@ -2521,29 +2577,29 @@ export type LoyaltyCardData = {
2521
2577
  */
2522
2578
  Discount: string;
2523
2579
  /**
2524
- * Mail opt-in preference
2580
+ * Mail opt-in
2525
2581
  */
2526
- mailOpt?: string;
2582
+ mailOpt: 'T' | 'F';
2527
2583
  /**
2528
- * Email opt-in preference
2584
+ * Email opt-in
2529
2585
  */
2530
- emailOpt?: string;
2586
+ emailOpt: 'T' | 'F';
2531
2587
  /**
2532
- * SMS opt-in preference
2588
+ * SMS opt-in
2533
2589
  */
2534
- smsOpt?: string;
2590
+ smsOpt: 'T' | 'F';
2535
2591
  /**
2536
2592
  * Whether card details are complete
2537
2593
  */
2538
- CardComplete: string;
2594
+ CardComplete: 'T' | 'F';
2539
2595
  /**
2540
2596
  * Whether card is active
2541
2597
  */
2542
- CardActive: string;
2598
+ CardActive: 'T' | 'F';
2543
2599
  /**
2544
2600
  * Whether card is purged
2545
2601
  */
2546
- Purged: string;
2602
+ Purged: 'T' | 'F';
2547
2603
  /**
2548
2604
  * Current points balance
2549
2605
  */
@@ -2551,7 +2607,7 @@ export type LoyaltyCardData = {
2551
2607
  /**
2552
2608
  * Home site ID
2553
2609
  */
2554
- HomeSite: string;
2610
+ HomeSite: number;
2555
2611
  /**
2556
2612
  * Home site name
2557
2613
  */
@@ -2559,7 +2615,7 @@ export type LoyaltyCardData = {
2559
2615
  /**
2560
2616
  * Profile picture URL
2561
2617
  */
2562
- Picture?: string;
2618
+ Picture: string;
2563
2619
  };
2564
2620
  /**
2565
2621
  * Card movement/tier progression information
@@ -2617,33 +2673,29 @@ export type LoyaltyCardSummary = {
2617
2673
  */
2618
2674
  name: string;
2619
2675
  /**
2620
- * Join date
2676
+ * Join date (YYYY-MM-DD)
2621
2677
  */
2622
2678
  joindate: string;
2623
2679
  /**
2624
2680
  * Points earned to date
2625
2681
  */
2626
- pointsearned: string;
2682
+ pointsearned: number;
2627
2683
  /**
2628
2684
  * Points redeemed to date
2629
2685
  */
2630
- pointsredeemed: string;
2686
+ pointsredeemed: number;
2631
2687
  /**
2632
2688
  * Points expired to date
2633
2689
  */
2634
- pointsexpired: string;
2690
+ pointsexpired: number;
2635
2691
  /**
2636
- * Current points balance
2692
+ * Current points balance. Sent as a string, unlike the other points fields.
2637
2693
  */
2638
2694
  pointsbalance: string;
2639
2695
  /**
2640
- * Total sales to date
2641
- */
2642
- salestodate: string;
2643
- /**
2644
- * Card type
2696
+ * Card type ID
2645
2697
  */
2646
- cardtype: string;
2698
+ cardtype: number;
2647
2699
  };
2648
2700
  /**
2649
2701
  * Loyalty card type information
@@ -4474,57 +4526,306 @@ export type OfferCreateRequest = {
4474
4526
  effect?: OfferEffect;
4475
4527
  };
4476
4528
  /**
4477
- * Offer data structure
4529
+ * The offer record, sent on `offer.create` and `offer.update`.
4530
+ *
4531
+ * Most fields can be `null` when the offer does not set them. Decimal
4532
+ * columns are sent as strings (`"19.990"`). Flag columns are sent as `"T"`
4533
+ * or `"F"`, except the six listed as booleans.
4534
+ *
4535
+ * The boolean flags `linkedto`, `peritem`, `birthdayoffer`, `linkscheduler`,
4536
+ * `cardactive` and `cardcomplete` are always `false`, and `loyaltyonly` is
4537
+ * always `true`, whatever the offer is set to. This is a long-standing bug
4538
+ * in how these flags are converted; it is kept so existing consumers do not
4539
+ * break. Do not rely on these seven fields.
4478
4540
  */
4479
4541
  export type OfferData = {
4480
4542
  /**
4481
4543
  * Offer ID
4482
4544
  */
4483
- offerid: string;
4545
+ offerid: number;
4484
4546
  /**
4485
- * Company/chain code
4547
+ * Company/chain code that owns the offer
4486
4548
  */
4487
- chaincode: string;
4549
+ chaincode: number | null;
4488
4550
  /**
4489
- * Offer title
4551
+ * Offer description
4490
4552
  */
4491
- title?: string;
4553
+ description: string | null;
4492
4554
  /**
4493
- * Offer description
4555
+ * Date the offer becomes active (YYYY-MM-DD)
4494
4556
  */
4495
- description?: string;
4557
+ dateactive: string | null;
4558
+ /**
4559
+ * Date the offer expires (YYYY-MM-DD)
4560
+ */
4561
+ dateexpire: string | null;
4562
+ /**
4563
+ * Number of times a customer may use the offer
4564
+ */
4565
+ numberallowed: number | null;
4566
+ /**
4567
+ * Number of times the offer may be used per site
4568
+ */
4569
+ numberallowedsite: number | null;
4570
+ /**
4571
+ * Start hour of day, as a decimal string
4572
+ */
4573
+ starthour: string | null;
4574
+ /**
4575
+ * End hour of day, as a decimal string
4576
+ */
4577
+ endhour: string | null;
4578
+ /**
4579
+ * Largest basket total the offer triggers on
4580
+ */
4581
+ maxamount: string | null;
4582
+ /**
4583
+ * Smallest basket total the offer triggers on
4584
+ */
4585
+ minamount: string | null;
4586
+ /**
4587
+ * Offer amount
4588
+ */
4589
+ amount: string | null;
4590
+ /**
4591
+ * Points value configured on the offer
4592
+ */
4593
+ points: string | null;
4496
4594
  /**
4497
- * Whether offer is loyalty-only
4595
+ * Discount
4596
+ */
4597
+ discount: string | null;
4598
+ /**
4599
+ * Department code
4600
+ */
4601
+ department: number | null;
4602
+ /**
4603
+ * Points multiplier
4604
+ */
4605
+ multpoints: string | null;
4606
+ /**
4607
+ * Whether the offer is enabled
4608
+ */
4609
+ enabled: 'T' | 'F' | null;
4610
+ /**
4611
+ * Always `true`. See the model description.
4498
4612
  */
4499
4613
  loyaltyonly: boolean;
4500
4614
  /**
4501
- * Whether offer is linked to another offer
4615
+ * Whether the offer is limited to the card types below
4616
+ */
4617
+ cardtypeflag: 'T' | 'F' | null;
4618
+ /**
4619
+ * Card type the offer is limited to
4620
+ */
4621
+ loyaltycardtype: number | null;
4622
+ /**
4623
+ * Additional card type
4624
+ */
4625
+ loyaltycardtype1: number | null;
4626
+ /**
4627
+ * Additional card type
4628
+ */
4629
+ loyaltycardtype2: number | null;
4630
+ /**
4631
+ * Additional card type
4632
+ */
4633
+ loyaltycardtype3: number | null;
4634
+ /**
4635
+ * Additional card type
4636
+ */
4637
+ loyaltycardtype4: number | null;
4638
+ /**
4639
+ * Additional card type
4640
+ */
4641
+ loyaltycardtype5: number | null;
4642
+ /**
4643
+ * Customer group the offer is limited to
4644
+ */
4645
+ group1: number | null;
4646
+ /**
4647
+ * Additional customer group
4648
+ */
4649
+ group2: number | null;
4650
+ /**
4651
+ * Additional customer group
4652
+ */
4653
+ group3: number | null;
4654
+ /**
4655
+ * Additional customer group
4656
+ */
4657
+ group4: number | null;
4658
+ /**
4659
+ * Additional customer group
4660
+ */
4661
+ group5: number | null;
4662
+ /**
4663
+ * Additional customer group
4664
+ */
4665
+ group6: number | null;
4666
+ /**
4667
+ * Whether the offer is limited to the groups above
4668
+ */
4669
+ groupflag: 'T' | 'F' | null;
4670
+ /**
4671
+ * Always `false`. See the model description.
4502
4672
  */
4503
4673
  linkedto: boolean;
4504
4674
  /**
4505
- * Whether this is a birthday offer
4675
+ * Always `false`. See the model description.
4676
+ */
4677
+ peritem: boolean;
4678
+ /**
4679
+ * Offer reference
4680
+ */
4681
+ offerref: string | null;
4682
+ /**
4683
+ * Free-text comments
4684
+ */
4685
+ comments: string | null;
4686
+ /**
4687
+ * Offer period in days
4688
+ */
4689
+ offerperiod: number | null;
4690
+ /**
4691
+ * Always `false`. See the model description.
4506
4692
  */
4507
4693
  birthdayoffer: boolean;
4508
4694
  /**
4509
- * Whether card must be active
4695
+ * Delta days
4696
+ */
4697
+ deltadays: number | null;
4698
+ /**
4699
+ * Whether the offer is linked to an external system
4700
+ */
4701
+ externallink: 'T' | 'F' | null;
4702
+ /**
4703
+ * External system user
4704
+ */
4705
+ externaluser: string | null;
4706
+ /**
4707
+ * External system password
4708
+ */
4709
+ externalpassword: string | null;
4710
+ /**
4711
+ * External system reference
4712
+ */
4713
+ externalref: string | null;
4714
+ /**
4715
+ * Always `false`. See the model description.
4716
+ */
4717
+ linkscheduler: boolean;
4718
+ /**
4719
+ * Offer image URL
4720
+ */
4721
+ image: string | null;
4722
+ /**
4723
+ * Delta direction
4724
+ */
4725
+ deltadir: string | null;
4726
+ /**
4727
+ * Boost type
4728
+ */
4729
+ boosttype: string | null;
4730
+ /**
4731
+ * Boost days
4732
+ */
4733
+ boostdays: number | null;
4734
+ /**
4735
+ * Always `false`. See the model description.
4510
4736
  */
4511
4737
  cardactive: boolean;
4512
4738
  /**
4513
- * Whether card details must be complete
4739
+ * Always `false`. See the model description.
4514
4740
  */
4515
4741
  cardcomplete: boolean;
4516
4742
  /**
4517
- * Date offer was last changed
4743
+ * Coffee card ID
4744
+ */
4745
+ coffeecard: number | null;
4746
+ /**
4747
+ * Portal user who last changed the offer
4748
+ */
4749
+ portaluser: string | null;
4750
+ /**
4751
+ * Date the offer was last changed (YYYY-MM-DD)
4752
+ */
4753
+ changedate: string | null;
4754
+ /**
4755
+ * Event ID
4756
+ */
4757
+ eventid: number | null;
4758
+ /**
4759
+ * What the offer applies to
4760
+ */
4761
+ apply_to: number;
4762
+ /**
4763
+ * Maximum quantity the offer applies to
4764
+ */
4765
+ apply_upto_quantity: number;
4766
+ /**
4767
+ * Fixed amount
4768
+ */
4769
+ fixed_amount: string;
4770
+ /**
4771
+ * Location type filter, as a JSON-encoded array in a string
4772
+ */
4773
+ location_type_id_filter: string | null;
4774
+ /**
4775
+ * Location filter, as a JSON-encoded array in a string
4776
+ */
4777
+ location_filter: string | null;
4778
+ /**
4779
+ * Site filter, as a JSON-encoded array in a string
4780
+ */
4781
+ site_filter: string | null;
4782
+ /**
4783
+ * Day-of-week filter, as a JSON-encoded array in a string
4784
+ */
4785
+ day_of_week_filter: string | null;
4786
+ /**
4787
+ * Region filter, as a JSON-encoded array in a string
4788
+ */
4789
+ region_filter: string | null;
4790
+ /**
4791
+ * State filter, as a JSON-encoded array in a string
4792
+ */
4793
+ state_filter: string | null;
4794
+ /**
4795
+ * Promotion group ID
4518
4796
  */
4519
- changedate: string;
4797
+ promo_group_id: number | null;
4520
4798
  /**
4521
- * Date offer becomes active
4799
+ * Item the offer applies to, or `null`
4522
4800
  */
4523
- dateactive: string;
4801
+ apply_to_items: {
4802
+ sku: string;
4803
+ quantity: number;
4804
+ } | null;
4805
+ /**
4806
+ * Start of the new-member window (YYYY-MM-DD)
4807
+ */
4808
+ new_member_window_start: string | null;
4809
+ /**
4810
+ * End of the new-member window (YYYY-MM-DD)
4811
+ */
4812
+ new_member_window_end: string | null;
4813
+ /**
4814
+ * Days after the trigger that the offer becomes valid
4815
+ */
4816
+ trigger_days_valid_after: number | null;
4817
+ /**
4818
+ * Discount item number
4819
+ */
4820
+ discount_item_number: string | null;
4821
+ /**
4822
+ * Whether the offer is applied automatically (`1` or `0`)
4823
+ */
4824
+ auto_applied: number;
4524
4825
  /**
4525
- * Date offer expires
4826
+ * Discount item type
4526
4827
  */
4527
- dateexpire: string;
4828
+ discount_item_type: string | null;
4528
4829
  /**
4529
4830
  * Maximum total discount this offer may give in a single transaction,
4530
4831
  * summed across all lines. `null` means no cap.
@@ -4533,24 +4834,42 @@ export type OfferData = {
4533
4834
  * amount. Not to be confused with `maxamount`, the largest basket total the
4534
4835
  * offer triggers on.
4535
4836
  */
4536
- max_discount_amount?: string | null;
4837
+ max_discount_amount: string | null;
4537
4838
  /**
4538
- * Whether this is a redemption event
4839
+ * Always `false`. Redemptions are sent as `offer.redeem`.
4539
4840
  */
4540
- redeem: boolean;
4841
+ redeem: false;
4541
4842
  /**
4542
- * Whether this is a deletion event
4843
+ * Always `false`. Deletions are sent as `offer.delete`.
4543
4844
  */
4544
- delete: boolean;
4845
+ delete: false;
4545
4846
  /**
4546
- * Card data for redemption events
4847
+ * Always `null`.
4547
4848
  */
4548
- card?: LoyaltyCardData;
4849
+ card: null;
4549
4850
  };
4550
4851
  export type OfferDeleteResult = {
4551
4852
  result: number;
4552
4853
  errormessage: string;
4553
4854
  };
4855
+ /**
4856
+ * Offer delete webhook data payload
4857
+ */
4858
+ export type OfferDeleteWebhookData = {
4859
+ /**
4860
+ * The deleted offer
4861
+ */
4862
+ Offer: {
4863
+ /**
4864
+ * Offer ID
4865
+ */
4866
+ offer_id: number;
4867
+ /**
4868
+ * Company loyalty chain the offer belonged to
4869
+ */
4870
+ chain_code: number;
4871
+ };
4872
+ };
4554
4873
  export type OfferDetailAmount = {
4555
4874
  type: string;
4556
4875
  value: number;
@@ -4772,6 +5091,102 @@ export type OfferRedemption = {
4772
5091
  */
4773
5092
  redeemed_tax?: ApiNumeric;
4774
5093
  };
5094
+ /**
5095
+ * One redemption of an offer at the POS. This is the redemption itself,
5096
+ * not the offer record: subscribe to `offer.create`/`offer.update` for the
5097
+ * offer's settings, and `loyalty.card` for cardholder details.
5098
+ */
5099
+ export type OfferRedemptionData = {
5100
+ /**
5101
+ * Offer ID
5102
+ */
5103
+ offer_id: number;
5104
+ /**
5105
+ * Offer reference
5106
+ */
5107
+ offer_ref: string;
5108
+ /**
5109
+ * Offer description
5110
+ */
5111
+ description: string;
5112
+ /**
5113
+ * Loyalty card used, or `null` when no card was presented
5114
+ */
5115
+ card: string | null;
5116
+ /**
5117
+ * Whether this was a loyalty redemption
5118
+ */
5119
+ is_loyalty: boolean;
5120
+ /**
5121
+ * Company loyalty chain the offer belongs to. This is the chain the
5122
+ * webhook destination is configured on, and the same value as the
5123
+ * envelope's `chain`.
5124
+ */
5125
+ chain_code: number;
5126
+ /**
5127
+ * Company (chain) code where the redemption took place
5128
+ */
5129
+ trading_chain_code: number;
5130
+ /**
5131
+ * Site ID
5132
+ */
5133
+ site: number;
5134
+ /**
5135
+ * Location ID
5136
+ */
5137
+ location: number;
5138
+ /**
5139
+ * Terminal number
5140
+ */
5141
+ terminal: number;
5142
+ /**
5143
+ * Journal number of the transaction
5144
+ */
5145
+ journal: number;
5146
+ /**
5147
+ * Sequence number of the redemption line
5148
+ */
5149
+ sequence: number;
5150
+ /**
5151
+ * Transaction date (YYYY-MM-DD)
5152
+ */
5153
+ transaction_date: string;
5154
+ /**
5155
+ * Transaction time of day (HH:MM:SS)
5156
+ */
5157
+ transaction_time: string;
5158
+ /**
5159
+ * Operator number
5160
+ */
5161
+ operator: number;
5162
+ /**
5163
+ * Operator name
5164
+ */
5165
+ operator_name: string;
5166
+ /**
5167
+ * Value of the redemption line. Negative for a discount.
5168
+ */
5169
+ amount: number;
5170
+ /**
5171
+ * Tax on the redemption line
5172
+ */
5173
+ tax: number;
5174
+ /**
5175
+ * The offer's configured points value, NOT the points awarded on this
5176
+ * redemption. A non-loyalty redemption (`is_loyalty: false`) awards no
5177
+ * points even when this is non-zero.
5178
+ */
5179
+ points: number;
5180
+ };
5181
+ /**
5182
+ * Offer redemption webhook data payload
5183
+ */
5184
+ export type OfferRedemptionWebhookData = {
5185
+ /**
5186
+ * The redemption
5187
+ */
5188
+ Redemption: OfferRedemptionData;
5189
+ };
4775
5190
  /**
4776
5191
  * Response for offer redemptions list endpoint
4777
5192
  */
@@ -4855,7 +5270,7 @@ export type OfferUpdateRequest = {
4855
5270
  effect?: OfferEffect;
4856
5271
  };
4857
5272
  /**
4858
- * Offer webhook data payload
5273
+ * Offer create/update webhook data payload
4859
5274
  */
4860
5275
  export type OfferWebhookData = {
4861
5276
  /**
@@ -5581,6 +5996,23 @@ export type PingV2PingResult = {
5581
5996
  */
5582
5997
  chaincode: number;
5583
5998
  };
5999
+ /**
6000
+ * Test delivery sent when a destination is tested from Zen.
6001
+ */
6002
+ export type PingWebhookData = {
6003
+ /**
6004
+ * Always `zen.ping`
6005
+ */
6006
+ event: 'zen.ping';
6007
+ /**
6008
+ * Name of the destination being tested
6009
+ */
6010
+ destination: string;
6011
+ /**
6012
+ * When the test was sent (RFC 3339)
6013
+ */
6014
+ sent_at: string;
6015
+ };
5584
6016
  export type PluGroup = {
5585
6017
  /**
5586
6018
  * PLU Group Id (match with PLUGroupNo)
@@ -6537,401 +6969,162 @@ export type TransactionCreateItem = {
6537
6969
  /**
6538
6970
  * Transaction creation request - wrapper object
6539
6971
  */
6540
- export type TransactionCreateRequest = {
6541
- /**
6542
- * Transaction data
6543
- */
6544
- transaction: TransactionCreateData;
6545
- };
6546
- /**
6547
- * Transaction creation response (union of success and error)
6548
- */
6549
- export type TransactionCreateResponse = TransactionCreateSuccessResponse | TransactionCreateErrorResponse;
6550
- /**
6551
- * Successful transaction creation response
6552
- */
6553
- export type TransactionCreateSuccessResponse = {
6554
- /**
6555
- * Result code (0 = success)
6556
- */
6557
- result: 0;
6558
- /**
6559
- * Result message
6560
- */
6561
- errormessage: 'OK';
6562
- /**
6563
- * Processing comment
6564
- */
6565
- comment: string;
6566
- };
6567
- /**
6568
- * Transaction tender structure for creation requests
6569
- */
6570
- export type TransactionCreateTender = {
6571
- /**
6572
- * Tender type code
6573
- */
6574
- tendertype: string;
6575
- /**
6576
- * Tender description
6577
- */
6578
- description: string;
6579
- /**
6580
- * Tender amount
6581
- */
6582
- amount: string;
6583
- /**
6584
- * Shift number
6585
- */
6586
- shiftnumber?: string;
6587
- /**
6588
- * Obfuscated credit card number
6589
- */
6590
- creditcard?: string;
6591
- /**
6592
- * Card holder's name
6593
- */
6594
- cardname?: string;
6595
- /**
6596
- * Payment authorization platform
6597
- */
6598
- authorisation?: string;
6599
- /**
6600
- * Card expiry date (MM/YY)
6601
- */
6602
- expirydate?: string;
6603
- /**
6604
- * Voucher serial number (for voucher redemption)
6605
- */
6606
- voucher?: string;
6607
- /**
6608
- * Voucher type (for voucher redemption)
6609
- */
6610
- type?: string;
6611
- /**
6612
- * EFT surcharge amount (ex. tax)
6613
- */
6614
- surcharge?: ApiNumeric;
6615
- /**
6616
- * EFT surcharge tax
6617
- */
6618
- surchargetax?: ApiNumeric;
6619
- /**
6620
- * Tips amount
6621
- */
6622
- tips?: ApiNumeric;
6623
- /**
6624
- * Tips tax
6625
- */
6626
- tipstax?: ApiNumeric;
6627
- /**
6628
- * Retrieval reference number of the card payment, 1-32 alphanumeric characters. Stored trimmed and upper-cased; an invalid value is dropped without rejecting the transaction. The XML transaction API takes the same value as <Rrn> on <Tender>.
6629
- */
6630
- rrn?: string;
6631
- };
6632
- /**
6633
- * Transaction customer information for creation requests
6634
- */
6635
- export type TransactionCustomer = {
6636
- /**
6637
- * Customer card number
6638
- */
6639
- cardnumber?: string;
6640
- /**
6641
- * Customer first name
6642
- */
6643
- firstname: string;
6644
- /**
6645
- * Customer last name
6646
- */
6647
- lastname: string;
6648
- /**
6649
- * Card type
6650
- */
6651
- cardtype?: string;
6652
- /**
6653
- * Number of loyalty points being redeemed
6654
- */
6655
- redeempoints?: string;
6656
- /**
6657
- * Dollar value of points being redeemed (inc. tax)
6658
- */
6659
- redeemamount?: string;
6660
- /**
6661
- * Debtor account number
6662
- */
6663
- account?: string;
6664
- /**
6665
- * Amount to charge to debtor account
6666
- */
6667
- charge?: string;
6668
- /**
6669
- * Amount being paid on debtor account
6670
- */
6671
- payment?: string;
6672
- /**
6673
- * Tender number for the debtor charge
6674
- */
6675
- tendernumber?: string;
6676
- /**
6677
- * Department for charge attribution
6678
- */
6679
- department?: number;
6680
- /**
6681
- * Purchase order reference
6682
- */
6683
- purchaseorder?: string;
6684
- };
6685
- /**
6686
- * Transaction data structure
6687
- */
6688
- export type TransactionData = {
6689
- /**
6690
- * Company/chain code
6691
- */
6692
- Company: string;
6693
- /**
6694
- * Site code
6695
- */
6696
- Site: string;
6697
- /**
6698
- * Location code
6699
- */
6700
- Location: string;
6701
- /**
6702
- * Terminal number
6703
- */
6704
- Terminal: string;
6705
- /**
6706
- * Journal number
6707
- */
6708
- Journal: string;
6709
- /**
6710
- * Invoice journal number
6711
- */
6712
- InvoiceJournal?: string;
6713
- /**
6714
- * Credit note journal number
6715
- */
6716
- CreditJournal?: string;
6717
- /**
6718
- * Transaction date and time
6719
- */
6720
- DateTime: string;
6721
- /**
6722
- * Trading date
6723
- */
6724
- TradingDate: string;
6725
- /**
6726
- * Whether this is a training transaction
6727
- */
6728
- isTraining: boolean;
6729
- /**
6730
- * Operator number
6731
- */
6732
- OperatorNumber: string;
6733
- /**
6734
- * Operator name
6735
- */
6736
- OperatorName: string;
6737
- /**
6738
- * Operator login
6739
- */
6740
- OperatorLogin: string;
6741
- /**
6742
- * Cash drawer number
6743
- */
6744
- Cashdrawer: string;
6745
- /**
6746
- * Email receipt address
6747
- */
6748
- EmailReceipt?: string;
6749
- /**
6750
- * Customer email
6751
- */
6752
- CustomerEmail?: string;
6753
- /**
6754
- * Customer postcode
6755
- */
6756
- Postcode?: string;
6757
- /**
6758
- * Customer name
6759
- */
6760
- CustomerName?: string;
6761
- /**
6762
- * Customer address
6763
- */
6764
- CustomerAddress?: string;
6765
- /**
6766
- * Customer phone
6767
- */
6768
- CustomerPhone?: string;
6769
- /**
6770
- * Loyalty information
6771
- */
6772
- Loyalty?: WebhookTransactionLoyalty;
6773
- /**
6774
- * Sales items
6775
- */
6776
- Sales?: Array<TransactionItem>;
6777
- /**
6778
- * Tender information
6779
- */
6780
- Tender?: Array<TransactionTender>;
6781
- /**
6782
- * Sales discount
6783
- */
6784
- SalesDiscount?: TransactionDiscount;
6785
- /**
6786
- * Rounding amount
6787
- */
6788
- Rounding?: TransactionRounding;
6789
- };
6790
- /**
6791
- * Transaction discount
6792
- */
6793
- export type TransactionDiscount = {
6794
- /**
6795
- * Discount amount
6796
- */
6797
- Amount: number;
6798
- /**
6799
- * Tax amount on discount
6800
- */
6801
- Tax: number;
6802
- };
6803
- /**
6804
- * Event format transaction response (for format=event query parameter).
6805
- *
6806
- * When `?format=event` is specified, the response is a JMS-serialized JournalCreatedEvent
6807
- * object returned directly via `json_encode()`, without `result`/`errormessage` wrapper fields.
6808
- * The exact structure depends on the JournalCreatedEvent serialization and includes
6809
- * fields such as company, site, location, terminal, journal details, sale items,
6810
- * tenders, discounts, loyalty information, and offers.
6811
- */
6812
- export type TransactionEventResponse = {
6813
- [key: string]: unknown;
6972
+ export type TransactionCreateRequest = {
6973
+ /**
6974
+ * Transaction data
6975
+ */
6976
+ transaction: TransactionCreateData;
6814
6977
  };
6815
6978
  /**
6816
- * Transaction item
6979
+ * Transaction creation response (union of success and error)
6980
+ */
6981
+ export type TransactionCreateResponse = TransactionCreateSuccessResponse | TransactionCreateErrorResponse;
6982
+ /**
6983
+ * Successful transaction creation response
6817
6984
  */
6818
- export type TransactionItem = {
6985
+ export type TransactionCreateSuccessResponse = {
6819
6986
  /**
6820
- * Item transaction date and time
6987
+ * Result code (0 = success)
6821
6988
  */
6822
- DateTime: string;
6989
+ result: 0;
6823
6990
  /**
6824
- * Item code
6991
+ * Result message
6825
6992
  */
6826
- Item: string;
6993
+ errormessage: 'OK';
6827
6994
  /**
6828
- * Item barcode
6995
+ * Processing comment
6829
6996
  */
6830
- Barcode: string;
6997
+ comment: string;
6998
+ };
6999
+ /**
7000
+ * Transaction tender structure for creation requests
7001
+ */
7002
+ export type TransactionCreateTender = {
6831
7003
  /**
6832
- * Item description
7004
+ * Tender type code
6833
7005
  */
6834
- Description: string;
7006
+ tendertype: string;
6835
7007
  /**
6836
- * Price level
7008
+ * Tender description
6837
7009
  */
6838
- PriceLevel: number;
7010
+ description: string;
6839
7011
  /**
6840
- * Item price
7012
+ * Tender amount
6841
7013
  */
6842
- Price: number;
7014
+ amount: string;
6843
7015
  /**
6844
- * Original price before discounts
7016
+ * Shift number
6845
7017
  */
6846
- OriginalPrice?: number;
7018
+ shiftnumber?: string;
6847
7019
  /**
6848
- * Item cost
7020
+ * Obfuscated credit card number
6849
7021
  */
6850
- Cost: number;
7022
+ creditcard?: string;
6851
7023
  /**
6852
- * Quantity sold
7024
+ * Card holder's name
6853
7025
  */
6854
- Quantity: number;
7026
+ cardname?: string;
6855
7027
  /**
6856
- * Line total amount
7028
+ * Payment authorization platform
6857
7029
  */
6858
- LineTotal: number;
7030
+ authorisation?: string;
6859
7031
  /**
6860
- * Line tax amount
7032
+ * Card expiry date (MM/YY)
6861
7033
  */
6862
- LineTAX: number;
7034
+ expirydate?: string;
6863
7035
  /**
6864
- * Discount amount
7036
+ * Voucher serial number (for voucher redemption)
6865
7037
  */
6866
- Discount: number;
7038
+ voucher?: string;
6867
7039
  /**
6868
- * Department code
7040
+ * Voucher type (for voucher redemption)
7041
+ */
7042
+ type?: string;
7043
+ /**
7044
+ * EFT surcharge amount (ex. tax)
6869
7045
  */
6870
- Department: number;
7046
+ surcharge?: ApiNumeric;
6871
7047
  /**
6872
- * Department name
7048
+ * EFT surcharge tax
6873
7049
  */
6874
- DepartmentName?: string;
7050
+ surchargetax?: ApiNumeric;
6875
7051
  /**
6876
- * Whether item is on special
7052
+ * Tips amount
6877
7053
  */
6878
- Special: boolean;
7054
+ tips?: ApiNumeric;
6879
7055
  /**
6880
- * Loyalty points earned
7056
+ * Tips tax
6881
7057
  */
6882
- Points?: number;
7058
+ tipstax?: ApiNumeric;
6883
7059
  /**
6884
- * Bonus points earned
7060
+ * Retrieval reference number of the card payment, 1-32 alphanumeric characters. Stored trimmed and upper-cased; an invalid value is dropped without rejecting the transaction. The XML transaction API takes the same value as <Rrn> on <Tender>.
6885
7061
  */
6886
- Bonus?: number;
7062
+ rrn?: string;
7063
+ };
7064
+ /**
7065
+ * Transaction customer information for creation requests
7066
+ */
7067
+ export type TransactionCustomer = {
6887
7068
  /**
6888
- * Whether item was scanned
7069
+ * Customer card number
6889
7070
  */
6890
- Scanned: boolean;
7071
+ cardnumber?: string;
6891
7072
  /**
6892
- * Scan terminal number
7073
+ * Customer first name
6893
7074
  */
6894
- ScanTerminal?: number;
7075
+ firstname: string;
6895
7076
  /**
6896
- * Brand code
7077
+ * Customer last name
6897
7078
  */
6898
- Brand?: string;
7079
+ lastname: string;
6899
7080
  /**
6900
- * Brand name
7081
+ * Card type
6901
7082
  */
6902
- BrandName?: string;
7083
+ cardtype?: string;
6903
7084
  /**
6904
- * Sub-department code
7085
+ * Number of loyalty points being redeemed
6905
7086
  */
6906
- SubDepartment?: number;
7087
+ redeempoints?: string;
6907
7088
  /**
6908
- * Sub-department name
7089
+ * Dollar value of points being redeemed (inc. tax)
6909
7090
  */
6910
- SubDepartmentName?: string;
7091
+ redeemamount?: string;
6911
7092
  /**
6912
- * Category code
7093
+ * Debtor account number
6913
7094
  */
6914
- Category?: number;
7095
+ account?: string;
6915
7096
  /**
6916
- * Category name
7097
+ * Amount to charge to debtor account
6917
7098
  */
6918
- CategoryName?: string;
7099
+ charge?: string;
6919
7100
  /**
6920
- * Sub-category code
7101
+ * Amount being paid on debtor account
6921
7102
  */
6922
- SubCategory?: number;
7103
+ payment?: string;
6923
7104
  /**
6924
- * Sub-category name
7105
+ * Tender number for the debtor charge
6925
7106
  */
6926
- SubCategoryName?: string;
7107
+ tendernumber?: string;
6927
7108
  /**
6928
- * Range code
7109
+ * Department for charge attribution
6929
7110
  */
6930
- Range?: number;
7111
+ department?: number;
6931
7112
  /**
6932
- * Range name
7113
+ * Purchase order reference
6933
7114
  */
6934
- RangeName?: string;
7115
+ purchaseorder?: string;
7116
+ };
7117
+ /**
7118
+ * Event format transaction response (for format=event query parameter).
7119
+ *
7120
+ * When `?format=event` is specified, the response is a JMS-serialized JournalCreatedEvent
7121
+ * object returned directly via `json_encode()`, without `result`/`errormessage` wrapper fields.
7122
+ * The exact structure depends on the JournalCreatedEvent serialization and includes
7123
+ * fields such as company, site, location, terminal, journal details, sale items,
7124
+ * tenders, discounts, loyalty information, and offers.
7125
+ */
7126
+ export type TransactionEventResponse = {
7127
+ [key: string]: unknown;
6935
7128
  };
6936
7129
  /**
6937
7130
  * Transaction offer structure for creation requests
@@ -7107,15 +7300,6 @@ export type TransactionResponseOffer = {
7107
7300
  */
7108
7301
  customer_loyalty_id?: string;
7109
7302
  };
7110
- /**
7111
- * Transaction rounding
7112
- */
7113
- export type TransactionRounding = {
7114
- /**
7115
- * Rounding amount
7116
- */
7117
- Amount: number;
7118
- };
7119
7303
  /**
7120
7304
  * Transaction sales discount structure.
7121
7305
  * The Sales Discount node activates the sales discount reports in the Portal.
@@ -7152,23 +7336,6 @@ export type TransactionTableInfo = {
7152
7336
  */
7153
7337
  covers?: string;
7154
7338
  };
7155
- /**
7156
- * Transaction tender
7157
- */
7158
- export type TransactionTender = {
7159
- /**
7160
- * Tender type number
7161
- */
7162
- Number: string;
7163
- /**
7164
- * Tender name
7165
- */
7166
- Name: string;
7167
- /**
7168
- * Tender amount
7169
- */
7170
- Amount: number;
7171
- };
7172
7339
  /**
7173
7340
  * Transaction tracking information
7174
7341
  */
@@ -7219,14 +7386,210 @@ export type TransactionVoucher = {
7219
7386
  */
7220
7387
  voiditem?: boolean;
7221
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
+ };
7222
7408
  /**
7223
- * 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`.
7224
7425
  */
7225
- 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;
7491
+ /**
7492
+ * Loyalty card on the sale, or `null`.
7493
+ */
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 = {
7226
7554
  /**
7227
- * Transaction data container
7555
+ * BASKET row id.
7228
7556
  */
7229
- AMC_POSPortal: TransactionData;
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;
7230
7593
  };
7231
7594
  /**
7232
7595
  * Validation error for various validation failures (400)
@@ -8807,37 +9170,40 @@ export type WebhookEventType = 'loyalty.card' | 'loyalty.points' | 'customer.ups
8807
9170
  * Outbound Webhook Models
8808
9171
  *
8809
9172
  * Zen sends webhooks to external systems when various events occur.
8810
- * All webhooks are sent as HTTP POST requests with JSON payloads.Base webhook payload structure
9173
+ * All webhooks are sent as HTTP POST requests with JSON payloads.
9174
+ *
9175
+ * These models describe the bodies exactly as Zen renders them. Each one is
9176
+ * checked against a golden fixture in
9177
+ * `apps/zen/db/dbtend/comms/fixtures/webhook-parity/` (the
9178
+ * `*.expected.json` files). When a template changes, update the matching
9179
+ * model here.
9180
+ *
9181
+ * Several payloads keep legacy quirks (mixed key casing, numbers sent as
9182
+ * strings, the `shopfiy` key). They are part of the wire contract and are
9183
+ * documented as sent, not as they should be.The envelope every webhook body is wrapped in. The event's own fields are
9184
+ * in `data`.
8811
9185
  */
8812
9186
  export type WebhookPayload = {
8813
9187
  /**
8814
- * Webhook function/event type
8815
- */
8816
- function: string;
8817
- /**
8818
- * Authentication key for webhook verification
9188
+ * Shared key. Only filled in when the destination is configured to send
9189
+ * its credential in the body; otherwise an empty string. Verify deliveries
9190
+ * with the `X-Zen-Signature` header instead.
8819
9191
  */
8820
9192
  key: string;
8821
9193
  /**
8822
- * Company/chain code
8823
- */
8824
- chain: string;
8825
- /**
8826
- * Whether HTML trace is enabled
9194
+ * The legacy function name for this event. Several events share a value
9195
+ * (for example `create` is sent for customer, loyalty and offer events),
9196
+ * so use the `X-Zen-Topic` header to tell events apart.
8827
9197
  */
8828
- traceHtml: boolean;
8829
- /**
8830
- * Whether trace logging is enabled
8831
- */
8832
- trace: boolean;
9198
+ function: string;
8833
9199
  /**
8834
- * Target webhook URL
9200
+ * Company (chain) code the destination is configured on.
8835
9201
  */
8836
- url: string;
9202
+ chain: number;
8837
9203
  /**
8838
- * Whether data is sent via POST body
9204
+ * Always `true`.
8839
9205
  */
8840
- viaBody: boolean;
9206
+ viaBody: true;
8841
9207
  };
8842
9208
  /**
8843
9209
  * 200 — a newly generated signing key.
@@ -8851,39 +9217,6 @@ export type WebhookSigningKeyResponse = {
8851
9217
  */
8852
9218
  signing_key: string;
8853
9219
  };
8854
- /**
8855
- * Transaction loyalty information
8856
- */
8857
- export type WebhookTransactionLoyalty = {
8858
- /**
8859
- * Loyalty card number
8860
- */
8861
- Card: string;
8862
- /**
8863
- * Opening points balance
8864
- */
8865
- OpeningPoints?: string;
8866
- /**
8867
- * Card holder name
8868
- */
8869
- Name: string;
8870
- /**
8871
- * First name
8872
- */
8873
- FirstName?: string;
8874
- /**
8875
- * Last name
8876
- */
8877
- LastName?: string;
8878
- /**
8879
- * Points from rounding
8880
- */
8881
- RoundPoints?: string;
8882
- /**
8883
- * Card type
8884
- */
8885
- CardType: string;
8886
- };
8887
9220
  /**
8888
9221
  * A field-level validation failure.
8889
9222
  */
@@ -8905,6 +9238,37 @@ export type ZenNotFoundError = {
8905
9238
  errormessage: 'Not Found';
8906
9239
  issue?: string;
8907
9240
  };
9241
+ /**
9242
+ * HMAC-SHA256 signature of the raw body, keyed with the destination's
9243
+ * signing key: `t=<unix seconds>,v1=<hex hmac_sha256(key, "<t>.<raw body>")>`.
9244
+ * See *Verifying a delivery* under Webhook Destinations.
9245
+ *
9246
+ */
9247
+ export type XZenSignature = string;
9248
+ /**
9249
+ * The event type, for example `offer.redeem`. Use this, not the body's `function`, to tell events apart.
9250
+ */
9251
+ export type XZenTopic = string;
9252
+ /**
9253
+ * Identifies the event. The same on every retry, so deduplicate on it.
9254
+ */
9255
+ export type XZenEventId = string;
9256
+ /**
9257
+ * Identifies this delivery attempt, as `<event id>.<attempt>`. Different on every retry.
9258
+ */
9259
+ export type XZenDeliveryId = string;
9260
+ /**
9261
+ * Name of the webhook destination this was delivered to.
9262
+ */
9263
+ export type XZenDestination = string;
9264
+ /**
9265
+ * RFC 3339 time the event occurred. Does not change between retries.
9266
+ */
9267
+ export type XZenTriggeredAt = string;
9268
+ /**
9269
+ * Revision of that template the body was rendered from.
9270
+ */
9271
+ export type XZenTemplateVersion = string;
8908
9272
  export type SmsSendSmsData = {
8909
9273
  body: SmsSendRequestBody;
8910
9274
  path?: never;
@@ -12693,75 +13057,113 @@ export type PingV2ShowResponses = {
12693
13057
  200: PingV2PingResult;
12694
13058
  };
12695
13059
  export type PingV2ShowResponse = PingV2ShowResponses[keyof PingV2ShowResponses];
12696
- export type WebhookLoyaltyWebhookPayload = WebhookPayload & {
13060
+ export type WebhookLoyaltyCardWebhookPayload = WebhookPayload & {
13061
+ function?: 'card' | 'create' | 'update';
13062
+ data: LoyaltyWebhookData;
13063
+ };
13064
+ export type WebhookLoyaltyCardWebhookRequest = {
13065
+ body: WebhookLoyaltyCardWebhookPayload;
13066
+ key: 'loyalty.card';
13067
+ path?: never;
13068
+ query?: never;
13069
+ };
13070
+ export type WebhookLoyaltyPointsWebhookPayload = WebhookPayload & {
13071
+ function?: 'points';
12697
13072
  data: LoyaltyWebhookData;
12698
13073
  };
12699
- export type WebhookLoyaltyWebhookRequest = {
12700
- body: WebhookLoyaltyWebhookPayload;
12701
- key: 'loyalty';
13074
+ export type WebhookLoyaltyPointsWebhookRequest = {
13075
+ body: WebhookLoyaltyPointsWebhookPayload;
13076
+ key: 'loyalty.points';
12702
13077
  path?: never;
12703
13078
  query?: never;
12704
13079
  };
12705
- export type WebhookCustomerWebhookPayload = WebhookPayload & {
13080
+ export type WebhookCustomerUpsertWebhookPayload = WebhookPayload & {
13081
+ function?: 'customer' | 'create' | 'update';
12706
13082
  data: CustomerWebhookData;
12707
13083
  };
12708
- export type WebhookCustomerWebhookRequest = {
12709
- body: WebhookCustomerWebhookPayload;
12710
- key: 'customer';
13084
+ export type WebhookCustomerUpsertWebhookRequest = {
13085
+ body: WebhookCustomerUpsertWebhookPayload;
13086
+ key: 'customer.upsert';
12711
13087
  path?: never;
12712
13088
  query?: never;
12713
13089
  };
12714
- export type WebhookOfferWebhookPayload = WebhookPayload & {
13090
+ export type WebhookOfferCreateWebhookPayload = WebhookPayload & {
13091
+ function?: 'create';
12715
13092
  data: OfferWebhookData;
12716
13093
  };
12717
- export type WebhookOfferWebhookRequest = {
12718
- body: WebhookOfferWebhookPayload;
12719
- key: 'offer';
13094
+ export type WebhookOfferCreateWebhookRequest = {
13095
+ body: WebhookOfferCreateWebhookPayload;
13096
+ key: 'offer.create';
12720
13097
  path?: never;
12721
13098
  query?: never;
12722
13099
  };
12723
- export type WebhookRedeemWebhookPayload = WebhookPayload & {
13100
+ export type WebhookOfferUpdateWebhookPayload = WebhookPayload & {
13101
+ function?: 'update';
12724
13102
  data: OfferWebhookData;
12725
13103
  };
12726
- export type WebhookRedeemWebhookRequest = {
12727
- body: WebhookRedeemWebhookPayload;
12728
- key: 'redeem';
13104
+ export type WebhookOfferUpdateWebhookRequest = {
13105
+ body: WebhookOfferUpdateWebhookPayload;
13106
+ key: 'offer.update';
12729
13107
  path?: never;
12730
13108
  query?: never;
12731
13109
  };
12732
- export type WebhookDeleteWebhookPayload = WebhookPayload & {
12733
- data: OfferWebhookData;
13110
+ export type WebhookOfferRedeemWebhookPayload = WebhookPayload & {
13111
+ function?: 'redeem';
13112
+ data: OfferRedemptionWebhookData;
13113
+ };
13114
+ export type WebhookOfferRedeemWebhookRequest = {
13115
+ body: WebhookOfferRedeemWebhookPayload;
13116
+ key: 'offer.redeem';
13117
+ path?: never;
13118
+ query?: never;
13119
+ };
13120
+ export type WebhookOfferDeleteWebhookPayload = WebhookPayload & {
13121
+ function?: 'delete';
13122
+ data: OfferDeleteWebhookData;
13123
+ };
13124
+ export type WebhookOfferDeleteWebhookRequest = {
13125
+ body: WebhookOfferDeleteWebhookPayload;
13126
+ key: 'offer.delete';
13127
+ path?: never;
13128
+ query?: never;
13129
+ };
13130
+ export type WebhookItemSohWebhookPayload = WebhookPayload & {
13131
+ function?: 'item';
13132
+ data: InventorySohWebhookData;
12734
13133
  };
12735
- export type WebhookDeleteWebhookRequest = {
12736
- body: WebhookDeleteWebhookPayload;
12737
- key: 'delete';
13134
+ export type WebhookItemSohWebhookRequest = {
13135
+ body: WebhookItemSohWebhookPayload;
13136
+ key: 'item.soh';
12738
13137
  path?: never;
12739
13138
  query?: never;
12740
13139
  };
12741
- export type WebhookItemWebhookPayload = WebhookPayload & {
12742
- data: InventoryWebhookData;
13140
+ export type WebhookItemPriceWebhookPayload = WebhookPayload & {
13141
+ function?: 'price';
13142
+ data: InventoryPriceWebhookData;
12743
13143
  };
12744
- export type WebhookItemWebhookRequest = {
12745
- body: WebhookItemWebhookPayload;
12746
- key: 'item';
13144
+ export type WebhookItemPriceWebhookRequest = {
13145
+ body: WebhookItemPriceWebhookPayload;
13146
+ key: 'item.price';
12747
13147
  path?: never;
12748
13148
  query?: never;
12749
13149
  };
12750
- export type WebhookPriceWebhookPayload = WebhookPayload & {
12751
- data: InventoryWebhookData;
13150
+ export type WebhookTransactionCompleteWebhookPayload = WebhookPayload & {
13151
+ function?: 'transaction';
13152
+ data: TransactionWebhookV2Data;
12752
13153
  };
12753
- export type WebhookPriceWebhookRequest = {
12754
- body: WebhookPriceWebhookPayload;
12755
- key: 'price';
13154
+ export type WebhookTransactionCompleteWebhookRequest = {
13155
+ body: WebhookTransactionCompleteWebhookPayload;
13156
+ key: 'transaction.complete';
12756
13157
  path?: never;
12757
13158
  query?: never;
12758
13159
  };
12759
- export type WebhookTransactionWebhookPayload = WebhookPayload & {
12760
- data: TransactionWebhookData;
13160
+ export type WebhookPingWebhookPayload = WebhookPayload & {
13161
+ function?: 'ping';
13162
+ data: PingWebhookData;
12761
13163
  };
12762
- export type WebhookTransactionWebhookRequest = {
12763
- body: WebhookTransactionWebhookPayload;
12764
- key: 'transaction';
13164
+ export type WebhookPingWebhookRequest = {
13165
+ body: WebhookPingWebhookPayload;
13166
+ key: 'ping';
12765
13167
  path?: never;
12766
13168
  query?: never;
12767
13169
  };