@gls_spain/gps-common 33.0.0 → 33.0.1
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/.idea/workspace.xml +10 -15
- package/CHANGELOG.md +7 -0
- package/open-api-spec/index.js +12 -2
- package/package.json +1 -1
- package/schemas/definitions/defaults.js +15 -49
package/.idea/workspace.xml
CHANGED
|
@@ -4,12 +4,6 @@
|
|
|
4
4
|
<list default="true" id="c2833e40-3178-44f3-9bc5-203849985c7f" name="Default Changelist" comment="">
|
|
5
5
|
<change beforePath="$PROJECT_DIR$/open-api-spec/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/open-api-spec/index.js" afterDir="false" />
|
|
6
6
|
<change beforePath="$PROJECT_DIR$/schemas/definitions/defaults.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/definitions/defaults.js" afterDir="false" />
|
|
7
|
-
<change beforePath="$PROJECT_DIR$/schemas/definitions/gls-spain-integration-events.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/definitions/gls-spain-integration-events.js" afterDir="false" />
|
|
8
|
-
<change beforePath="$PROJECT_DIR$/schemas/definitions/historic-records.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/definitions/historic-records.js" afterDir="false" />
|
|
9
|
-
<change beforePath="$PROJECT_DIR$/schemas/definitions/init.js" beforeDir="false" />
|
|
10
|
-
<change beforePath="$PROJECT_DIR$/schemas/definitions/networks.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/definitions/networks.js" afterDir="false" />
|
|
11
|
-
<change beforePath="$PROJECT_DIR$/schemas/definitions/sales.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/definitions/sales.js" afterDir="false" />
|
|
12
|
-
<change beforePath="$PROJECT_DIR$/schemas/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/index.js" afterDir="false" />
|
|
13
7
|
</list>
|
|
14
8
|
<option name="SHOW_DIALOG" value="false" />
|
|
15
9
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
@@ -590,7 +584,8 @@
|
|
|
590
584
|
<workItem from="1595531893690" duration="4660000" />
|
|
591
585
|
<workItem from="1595572792857" duration="2475000" />
|
|
592
586
|
<workItem from="1595668967544" duration="116000" />
|
|
593
|
-
<workItem from="1595832239784" duration="
|
|
587
|
+
<workItem from="1595832239784" duration="11480000" />
|
|
588
|
+
<workItem from="1595858491503" duration="3712000" />
|
|
594
589
|
</task>
|
|
595
590
|
<servers />
|
|
596
591
|
</component>
|
|
@@ -633,22 +628,22 @@
|
|
|
633
628
|
<screen x="0" y="23" width="2048" height="1129" />
|
|
634
629
|
</state>
|
|
635
630
|
<state x="762" y="341" key="#com.intellij.refactoring.safeDelete.UnsafeUsagesDialog/0.23.2048.1129@0.23.2048.1129" timestamp="1595577705727" />
|
|
636
|
-
<state width="2006" height="269" key="GridCell.Tab.0.bottom" timestamp="
|
|
631
|
+
<state width="2006" height="269" key="GridCell.Tab.0.bottom" timestamp="1595862472962">
|
|
637
632
|
<screen x="0" y="23" width="2048" height="1129" />
|
|
638
633
|
</state>
|
|
639
|
-
<state width="2006" height="269" key="GridCell.Tab.0.bottom/0.23.2048.1129@0.23.2048.1129" timestamp="
|
|
640
|
-
<state width="2006" height="269" key="GridCell.Tab.0.center" timestamp="
|
|
634
|
+
<state width="2006" height="269" key="GridCell.Tab.0.bottom/0.23.2048.1129@0.23.2048.1129" timestamp="1595862472962" />
|
|
635
|
+
<state width="2006" height="269" key="GridCell.Tab.0.center" timestamp="1595862472962">
|
|
641
636
|
<screen x="0" y="23" width="2048" height="1129" />
|
|
642
637
|
</state>
|
|
643
|
-
<state width="2006" height="269" key="GridCell.Tab.0.center/0.23.2048.1129@0.23.2048.1129" timestamp="
|
|
644
|
-
<state width="2006" height="269" key="GridCell.Tab.0.left" timestamp="
|
|
638
|
+
<state width="2006" height="269" key="GridCell.Tab.0.center/0.23.2048.1129@0.23.2048.1129" timestamp="1595862472962" />
|
|
639
|
+
<state width="2006" height="269" key="GridCell.Tab.0.left" timestamp="1595862472962">
|
|
645
640
|
<screen x="0" y="23" width="2048" height="1129" />
|
|
646
641
|
</state>
|
|
647
|
-
<state width="2006" height="269" key="GridCell.Tab.0.left/0.23.2048.1129@0.23.2048.1129" timestamp="
|
|
648
|
-
<state width="2006" height="269" key="GridCell.Tab.0.right" timestamp="
|
|
642
|
+
<state width="2006" height="269" key="GridCell.Tab.0.left/0.23.2048.1129@0.23.2048.1129" timestamp="1595862472962" />
|
|
643
|
+
<state width="2006" height="269" key="GridCell.Tab.0.right" timestamp="1595862472962">
|
|
649
644
|
<screen x="0" y="23" width="2048" height="1129" />
|
|
650
645
|
</state>
|
|
651
|
-
<state width="2006" height="269" key="GridCell.Tab.0.right/0.23.2048.1129@0.23.2048.1129" timestamp="
|
|
646
|
+
<state width="2006" height="269" key="GridCell.Tab.0.right/0.23.2048.1129@0.23.2048.1129" timestamp="1595862472962" />
|
|
652
647
|
<state x="689" y="276" width="670" height="676" key="search.everywhere.popup" timestamp="1595579270021">
|
|
653
648
|
<screen x="0" y="23" width="2048" height="1129" />
|
|
654
649
|
</state>
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [33.0.1](https://github.com/GLS-Spain/gps-common/compare/v33.0.0...v33.0.1) (2020-07-27)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* rework the defaults sales settings because the old structure did not work for some combinations ([7e36141](https://github.com/GLS-Spain/gps-common/commit/7e36141e227a6bb74be4886c9144916fc6d63d25))
|
|
7
|
+
|
|
1
8
|
# [33.0.0](https://github.com/GLS-Spain/gps-common/compare/v32.5.0...v33.0.0) (2020-07-27)
|
|
2
9
|
|
|
3
10
|
|
package/open-api-spec/index.js
CHANGED
|
@@ -564,6 +564,17 @@ field used for any resource in the API.
|
|
|
564
564
|
|
|
565
565
|
## Defaults schema
|
|
566
566
|
|
|
567
|
+
### Sales price calculation
|
|
568
|
+
|
|
569
|
+
The API calculates the price for a destination (country and optional postal code) by scanning the \`salesSettings\` and following this steps:
|
|
570
|
+
|
|
571
|
+
1. For each zone:
|
|
572
|
+
1.1. If the destination is in \`excludes\` skip the zone.
|
|
573
|
+
1.2. Else if the destination is in \`includes\` save the match and the length of the prefix.
|
|
574
|
+
1.3. Else skip this zone.
|
|
575
|
+
2. If there is only one matched zone choose that one.
|
|
576
|
+
3. Else choose the first one among the matched zones with the longest prefix.
|
|
577
|
+
|
|
567
578
|
<SchemaDefinition schemaRef="#/components/schemas/defaults" />
|
|
568
579
|
|
|
569
580
|
## Counters schema
|
|
@@ -1260,8 +1271,7 @@ Update the default settings.
|
|
|
1260
1271
|
If the \`derivationSettings\` or \`expirationSettings\` are updated, the update will propagate to the \`defaults\` property of all networks
|
|
1261
1272
|
and shops.
|
|
1262
1273
|
|
|
1263
|
-
If the \`salesSettings\`
|
|
1264
|
-
zone, the API will return a \`500 InconsistentSalesSettingsError\`.
|
|
1274
|
+
If the \`salesSettings\` contains duplicated zones names the API will return a \`500 InconsistentSalesSettingsError\`.
|
|
1265
1275
|
|
|
1266
1276
|
${securitySchemes.tokens}
|
|
1267
1277
|
${securitySchemes.superAdminRole}`,
|
package/package.json
CHANGED
|
@@ -50,10 +50,20 @@ const saleSize = () => ({
|
|
|
50
50
|
enum: ['xs', 's', 'm', 'l', 'xl'],
|
|
51
51
|
});
|
|
52
52
|
|
|
53
|
+
const saleZoneRegion = () => ({
|
|
54
|
+
type: 'object',
|
|
55
|
+
properties: {
|
|
56
|
+
country: country(),
|
|
57
|
+
postalCodePrefix: { type: 'string', minLength: 1 },
|
|
58
|
+
},
|
|
59
|
+
required: ['country'],
|
|
60
|
+
additionalProperties: false,
|
|
61
|
+
});
|
|
62
|
+
|
|
53
63
|
const saleZone = () => ({
|
|
54
64
|
type: 'object',
|
|
55
65
|
properties: {
|
|
56
|
-
name: { type: 'string', trim: true },
|
|
66
|
+
name: { type: 'string', trim: true, minLength: 1 },
|
|
57
67
|
prices: {
|
|
58
68
|
type: 'object',
|
|
59
69
|
properties: {
|
|
@@ -66,64 +76,20 @@ const saleZone = () => ({
|
|
|
66
76
|
required: ['xs', 's', 'm', 'l', 'xl'],
|
|
67
77
|
additionalProperties: false,
|
|
68
78
|
},
|
|
79
|
+
includes: { type: 'array', items: saleZoneRegion(), uniqueItems: true },
|
|
80
|
+
excludes: { type: 'array', items: saleZoneRegion(), uniqueItems: true },
|
|
69
81
|
},
|
|
70
|
-
required: ['name', 'prices'],
|
|
71
|
-
additionalProperties: false,
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
const salePostalCodeZone = () => ({
|
|
75
|
-
type: 'object',
|
|
76
|
-
properties: {
|
|
77
|
-
prefix: {
|
|
78
|
-
type: 'string',
|
|
79
|
-
description: 'include only the postal codes that begin with this prefix',
|
|
80
|
-
},
|
|
81
|
-
zone: {
|
|
82
|
-
oneOf: [
|
|
83
|
-
{
|
|
84
|
-
type: 'string',
|
|
85
|
-
description: 'name of the zone for this country and postal codes, must exist in the zones array',
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
type: 'null',
|
|
89
|
-
description: 'set to null to prevent sales to this country and postal codes',
|
|
90
|
-
},
|
|
91
|
-
],
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
required: ['prefix', 'zone'],
|
|
82
|
+
required: ['name', 'prices', 'includes', 'excludes'],
|
|
95
83
|
additionalProperties: false,
|
|
96
84
|
});
|
|
97
85
|
|
|
98
|
-
const saleCountry = () => ({
|
|
99
|
-
type: 'object',
|
|
100
|
-
properties: {
|
|
101
|
-
country: country(),
|
|
102
|
-
postalCodesZones: { type: 'array', items: salePostalCodeZone(), uniqueItems: true },
|
|
103
|
-
defaultZone: {
|
|
104
|
-
oneOf: [
|
|
105
|
-
{
|
|
106
|
-
type: 'string',
|
|
107
|
-
description: 'name of the default zone for this country, must exist in the zones array',
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
type: 'null',
|
|
111
|
-
description: 'set to null to prevent sales to this country by default',
|
|
112
|
-
},
|
|
113
|
-
],
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
required: ['country', 'postalCodesZones', 'defaultZone'],
|
|
117
|
-
});
|
|
118
|
-
|
|
119
86
|
const salesSettings = () => ({
|
|
120
87
|
title: 'sales settings',
|
|
121
88
|
type: 'object',
|
|
122
89
|
properties: {
|
|
123
90
|
zones: { type: 'array', items: saleZone(), uniqueItems: true, minItems: 1 },
|
|
124
|
-
countries: { type: 'array', items: saleCountry(), uniqueItems: true, minItems: 1 },
|
|
125
91
|
},
|
|
126
|
-
required: ['zones'
|
|
92
|
+
required: ['zones'],
|
|
127
93
|
additionalProperties: false,
|
|
128
94
|
});
|
|
129
95
|
|