@gls_spain/gps-common 35.14.2 → 35.15.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.
package/CHANGELOG.md CHANGED
@@ -1,10 +1,24 @@
1
- ## [35.14.2](https://github.com/GLS-Spain/gps-common/compare/v35.14.1...v35.14.2) (2025-09-01)
1
+ # [35.15.0](https://github.com/GLS-Spain/gps-common/compare/v35.14.3...v35.15.0) (2026-03-06)
2
2
 
3
3
 
4
- ### Bug Fixes
4
+ ### Features
5
5
 
6
- * fix sales.discount ([4b9c09e](https://github.com/GLS-Spain/gps-common/commit/4b9c09eb7c172369784f5d597f6f21f8801af55d))
6
+ * add schema locker ([77df6a1](https://github.com/GLS-Spain/gps-common/commit/77df6a1d91f04a22d52b5af57f67551af11e4f22))
7
7
 
8
+ ## [35.14.3](https://github.com/GLS-Spain/gps-common/compare/v35.14.2...v35.14.3) (2025-09-01)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * sales.discount fix ([7a7bceb](https://github.com/GLS-Spain/gps-common/commit/7a7bcebac719d42943b55f094ad201d7603b00cf))
14
+
15
+ ## [35.14.2](https://github.com/GLS-Spain/gps-common/compare/v35.14.1...v35.14.2) (2025-09-01)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * fix sales.discount ([4b9c09e](https://github.com/GLS-Spain/gps-common/commit/4b9c09eb7c172369784f5d597f6f21f8801af55d))
21
+
8
22
  ## [35.14.1](https://github.com/GLS-Spain/gps-common/compare/v35.14.0...v35.14.1) (2025-08-20)
9
23
 
10
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gls_spain/gps-common",
3
- "version": "35.14.2",
3
+ "version": "35.15.0",
4
4
  "description": "Errors, schemas and documentation for the Parcel Shops project",
5
5
  "keywords": [
6
6
  "gls"
@@ -32,6 +32,30 @@ const parcelShopData = () => ({
32
32
  required: ['_id', 'email', 'name', 'phone', 'postalCode'],
33
33
  });
34
34
 
35
+ const carrefourDiscount = () => ({
36
+ type: 'object',
37
+ properties: {
38
+ type: { type: 'string', enum: ['carrefour'] },
39
+ code: { type: 'string' },
40
+ price: { type: 'integer', minimum: 0 },
41
+ percentage: { type: 'number', minimum: 0 },
42
+ clientPrice: { type: 'integer', minimum: 0 },
43
+ },
44
+ required: ['type', 'code', 'price'],
45
+ additionalProperties: false,
46
+ });
47
+
48
+ const campaignDiscount = () => ({
49
+ type: 'object',
50
+ properties: {
51
+ type: { type: 'string', enum: ['campaign'] },
52
+ code: { type: 'string' },
53
+ price: { type: 'integer', minimum: 0 },
54
+ },
55
+ required: ['type', 'code', 'price'],
56
+ additionalProperties: false,
57
+ });
58
+
35
59
  const sale = () => ({
36
60
  title: 'sale',
37
61
  type: 'object',
@@ -152,15 +176,7 @@ const sale = () => ({
152
176
  typeService: { type: 'string', enum: ['parcel', 'traveller'] },
153
177
  // 2025-07-25 JL descuentos (campañas/carrefour)
154
178
  discount: {
155
- type: 'object',
156
- properties: {
157
- type: { type: 'string' },
158
- code: { type: 'string' },
159
- price: { type: 'integer', minimum: 0 },
160
- clientPrice: { type: 'integer', minimum: 0 },
161
- },
162
- required: ['type', 'code', 'price'],
163
- additionalProperties: false,
179
+ oneOf: [campaignDiscount(), carrefourDiscount()],
164
180
  },
165
181
  },
166
182
  required: [
@@ -555,6 +555,296 @@ const upsertShopResponse = () => ({
555
555
  additionalProperties: false,
556
556
  });
557
557
 
558
+ // LOCKERS
559
+
560
+ const locker = () => ({
561
+ title: 'locker',
562
+ type: 'object',
563
+ properties: {
564
+ _id: uuid(),
565
+ createdAt: datetime(),
566
+ updatedAt: datetime(),
567
+ deletable: { type: 'boolean' },
568
+ readonly: { type: 'boolean', description: 'readonly shops do not allow updates or adding expeditions to them' },
569
+ international: {
570
+ type: 'object',
571
+ properties: {
572
+ partnerKey: { type: 'string' },
573
+ parcelShopId: { type: 'string' },
574
+ },
575
+ required: ['partnerKey', 'parcelShopId'],
576
+ additionalProperties: false,
577
+ },
578
+ defaults: {
579
+ type: 'object',
580
+ properties: { ...pickProperties(defaults(), ['derivationSettings', 'expirationSettings']) },
581
+ required: ['derivationSettings', 'expirationSettings'],
582
+ additionalProperties: false,
583
+ },
584
+ network: {
585
+ type: 'object',
586
+ properties: { ...pickProperties(network(), ['_id', 'name', 'derivationSettings', 'expirationSettings']) },
587
+ required: ['_id', 'name'],
588
+ additionalProperties: false,
589
+ },
590
+ zone: {
591
+ type: 'object',
592
+ properties: { ...pickProperties(zone(), ['_id', 'name']) },
593
+ required: ['_id', 'name'],
594
+ additionalProperties: false,
595
+ },
596
+ openingRepresentative: shopRepresentative(),
597
+ managingRepresentative: shopRepresentative(),
598
+ status: {
599
+ type: 'object',
600
+ properties: {
601
+ code: { type: 'string', enum: ['enabled', 'disabled', 'manuallyDisabled'] },
602
+ disabled: {
603
+ type: 'object',
604
+ properties: {
605
+ at: datetime(),
606
+ reason: { type: 'string', trim: true },
607
+ },
608
+ required: ['at', 'reason'],
609
+ additionalProperties: false,
610
+ },
611
+ manuallyDisabled: {
612
+ type: 'object',
613
+ properties: {
614
+ _id: uuid(),
615
+ at: datetime(),
616
+ to: datetime(),
617
+ reason: { type: 'string', trim: true },
618
+ },
619
+ required: ['at', 'reason'],
620
+ additionalProperties: false,
621
+ },
622
+ },
623
+ required: ['code'],
624
+ additionalProperties: false,
625
+ },
626
+ name: { type: 'string', trim: true },
627
+ address: addressWithRequiredLocation(),
628
+ capabilities: {
629
+ type: 'array',
630
+ items: { type: 'string', enum: ['deliver', 'pickup', 'sell', 'sellplus'] },
631
+ uniqueItems: true,
632
+ },
633
+ openingSchedule: shopSchedule(),
634
+ holidays: { type: 'array', items: shopHoliday(), uniqueItems: true },
635
+ timezone: timezone(),
636
+ contacts: {
637
+ type: 'array',
638
+ items: contact(),
639
+ },
640
+ fiscal: fiscal(),
641
+ activity: shopActivity(),
642
+ notes: { type: 'string', trim: true },
643
+ derivationSettings: derivationSettings(),
644
+ expirationSettings: expirationSettings(),
645
+ eco: { type: 'boolean', default: false },
646
+ gold: { type: 'boolean', default: false },
647
+ radical: { type: 'boolean', default: false },
648
+ operations: { type: ['boolean', 'string'], trim: true },
649
+ reverseLogistic: { type: 'boolean', default: false },
650
+ squareCode: { type: ['integer', 'string'], minimum: 0, maximum: 32767, description: 'agency code' },
651
+ clientCode: { type: ['integer', 'string'], description: 'client code' },
652
+ channelingAgencyCode: { type: ['integer', 'string', 'null'], description: 'Channeling Agency Code' },
653
+ capacity: { type: 'string' },
654
+ courierAccessCode: {
655
+ type: 'object',
656
+ properties: {
657
+ code: { type: 'string' },
658
+ updatedAt: { type: 'string', format: 'date-time' },
659
+ },
660
+ required: ['code', 'updatedAt'],
661
+ additionalProperties: false,
662
+ },
663
+ },
664
+ required: [
665
+ '_id',
666
+ 'createdAt',
667
+ 'updatedAt',
668
+ 'deletable',
669
+ 'readonly',
670
+ 'international',
671
+ 'defaults',
672
+ 'network',
673
+ 'status',
674
+ 'name',
675
+ 'address',
676
+ 'capabilities',
677
+ 'openingSchedule',
678
+ 'timezone',
679
+ 'contacts',
680
+ ],
681
+ additionalProperties: false,
682
+ });
683
+
684
+ const createLockerRequest = () =>
685
+ createRequest({
686
+ type: 'object',
687
+ properties: {
688
+ // ----- parcelshop -----
689
+ parcelshop: {
690
+ type: 'object',
691
+ properties: {
692
+ _id: uuid(), // el handler lo asigna a locker.carrier.lockerId
693
+ createdAt: datetime(),
694
+ network: objectWithUuid(),
695
+ zone: objectWithUuid(),
696
+ openingRepresentative: setShopRepresentative(),
697
+ managingRepresentative: setShopRepresentative(),
698
+ name: shop().properties.name,
699
+ address: {
700
+ type: 'object',
701
+ properties: {
702
+ street: { type: 'string', trim: true },
703
+ door: { type: 'string', trim: true },
704
+ postalCode: { type: 'string', trim: true },
705
+ locality: { type: 'string', trim: true },
706
+ country: { type: 'string', trim: true },
707
+ location: {
708
+ type: 'object',
709
+ properties: {
710
+ geometry: {
711
+ type: 'object',
712
+ properties: {
713
+ type: { type: 'string', enum: ['Point'] },
714
+ coordinates: { type: 'array', items: { type: 'number' }, minItems: 2, maxItems: 2 },
715
+ },
716
+ required: ['coordinates'],
717
+ additionalProperties: false,
718
+ },
719
+ precision: { type: 'string' },
720
+ },
721
+ required: ['geometry'],
722
+ additionalProperties: false,
723
+ },
724
+ },
725
+ additionalProperties: true, // permite access_descript_locker y otros campos extra
726
+ },
727
+ openingSchedule: shop().properties.openingSchedule,
728
+ timezone: shop().properties.timezone,
729
+ activity: shop().properties.activity,
730
+ eco: shop().properties.eco,
731
+ status: {
732
+ type: 'object',
733
+ properties: {
734
+ code: { type: 'string', enum: ['enabled', 'disabled', 'manuallyDisabled'] },
735
+ disabled: {
736
+ type: 'object',
737
+ properties: {
738
+ at: datetime(),
739
+ reason: { type: 'string', trim: true },
740
+ },
741
+ required: ['at', 'reason'],
742
+ additionalProperties: false,
743
+ },
744
+ manuallyDisabled: {
745
+ type: 'object',
746
+ properties: {
747
+ _id: uuid(),
748
+ at: datetime(),
749
+ to: datetime(),
750
+ reason: { type: 'string', trim: true },
751
+ },
752
+ required: ['at', 'reason'],
753
+ additionalProperties: false,
754
+ },
755
+ },
756
+ required: ['code'],
757
+ additionalProperties: false,
758
+ },
759
+ direccion_locker: { type: 'string', trim: true },
760
+ codpostal_locker: { type: 'string', trim: true },
761
+ ciudad_locker: { type: 'string', trim: true },
762
+ longitud_locker: { type: 'number' },
763
+ latitud_locker: { type: 'number' },
764
+ capacity_locker: { type: 'string' },
765
+ access_descript_locker: { type: 'string', trim: true },
766
+ },
767
+ required: [
768
+ 'network',
769
+ 'name',
770
+ 'status',
771
+ 'address',
772
+ 'openingSchedule',
773
+ 'timezone',
774
+ 'direccion_locker',
775
+ 'codpostal_locker',
776
+ 'ciudad_locker',
777
+ 'longitud_locker',
778
+ 'latitud_locker',
779
+ ],
780
+ additionalProperties: false,
781
+ },
782
+ // ----- locker ----- NXT MODEL
783
+ lockerDevice: {
784
+ title: 'lockerDevice',
785
+ type: 'object',
786
+ properties: {
787
+
788
+ provider: {
789
+ type: 'object',
790
+ properties: {
791
+ name: { type: 'string', trim: true }, // "KEBA"
792
+ lockerVersion: { type: 'string', trim: true }, // "v1.0"
793
+ lockerModel: { type: 'string', trim: true }, // "gls_es_0001_m03_b031"
794
+ },
795
+ required: ['name'],
796
+ additionalProperties: false,
797
+ },
798
+
799
+ location: {
800
+ type: 'object',
801
+ properties: {
802
+ streetNumber: { type: 'string', trim: true }, // "3"
803
+ street: { type: 'string', trim: true }, // "AL-12 3"
804
+ postalCode: { type: 'string', trim: true }, // "04006"
805
+ lon: { type: 'number' }, // -2.4229276567318436
806
+ lat: { type: 'number' }, // 36.84309556940104
807
+ countryCode: { type: 'string', trim: true, minLength: 2, maxLength: 2 }, // "ES"
808
+ city: { type: 'string', trim: true }, // "Almería"
809
+ },
810
+ required: ['street', 'postalCode', 'countryCode', 'city'],
811
+ additionalProperties: false,
812
+ },
813
+
814
+ features: {
815
+ type: 'object',
816
+ properties: {
817
+ hasScreen: { type: 'boolean' }, // true
818
+ hasPinPad: { type: 'boolean' }, // true
819
+ hasPinBarcodeReader: { type: 'boolean' }, // true
820
+ },
821
+ additionalProperties: false,
822
+ },
823
+
824
+ carrier: {
825
+ type: 'object',
826
+ properties: {
827
+ lockerName: { type: 'string', trim: true }, // "Locker GLS NXT - 24/7 MOEVE Los Partidores"
828
+ activationDate: { type: 'string', format: 'date-time' }, // "2027-03-10T01:00:00Z"
829
+ lockerId: { type: 'string' }, // uuid — asignado por el handler antes de validar
830
+ },
831
+ required: ['lockerName', 'lockerId'],
832
+ additionalProperties: false,
833
+ },
834
+
835
+ },
836
+ required: ['provider', 'location', 'carrier'],
837
+ additionalProperties: false,
838
+ }
839
+ },
840
+ required: ['parcelshop', 'locker'],
841
+ additionalProperties: false,
842
+ });
843
+
844
+ const createLockerResponse = () => createResponse(locker());
845
+
846
+
847
+
558
848
  module.exports = {
559
849
  shop,
560
850
  objectWithShopId,
@@ -569,4 +859,6 @@ module.exports = {
569
859
  deleteShopResponse,
570
860
  upsertShopResponse,
571
861
  upsertShopRequest,
862
+ createLockerRequest,
863
+ createLockerResponse,
572
864
  };