@gls_spain/gps-common 34.5.0 → 34.6.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/.idea/workspace.xml +27 -27
- package/CHANGELOG.md +14 -0
- package/errors/GLSSpainError.js +11 -0
- package/errors/index.js +3 -0
- package/open-api-spec/index.js +16 -4
- package/package.json +1 -1
- package/schemas/definitions/sales.js +1 -3
package/.idea/workspace.xml
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<project version="4">
|
|
3
3
|
<component name="ChangeListManager">
|
|
4
|
-
<list default="true" id="c2833e40-3178-44f3-9bc5-203849985c7f" name="Default Changelist" comment=""
|
|
4
|
+
<list default="true" id="c2833e40-3178-44f3-9bc5-203849985c7f" name="Default Changelist" comment="">
|
|
5
|
+
<change afterPath="$PROJECT_DIR$/errors/GLSSpainError.js" afterDir="false" />
|
|
6
|
+
<change beforePath="$PROJECT_DIR$/errors/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/errors/index.js" afterDir="false" />
|
|
7
|
+
<change beforePath="$PROJECT_DIR$/open-api-spec/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/open-api-spec/index.js" afterDir="false" />
|
|
8
|
+
</list>
|
|
5
9
|
<option name="SHOW_DIALOG" value="false" />
|
|
6
10
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
7
11
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
@@ -59,13 +63,6 @@
|
|
|
59
63
|
<property name="vue.rearranger.settings.migration" value="true" />
|
|
60
64
|
</component>
|
|
61
65
|
<component name="RecentsManager">
|
|
62
|
-
<key name="MoveFile.RECENT_KEYS">
|
|
63
|
-
<recent name="$PROJECT_DIR$/open-api" />
|
|
64
|
-
<recent name="$PROJECT_DIR$" />
|
|
65
|
-
<recent name="$PROJECT_DIR$/schemas" />
|
|
66
|
-
<recent name="$PROJECT_DIR$/open-api-spec" />
|
|
67
|
-
<recent name="$PROJECT_DIR$/errors" />
|
|
68
|
-
</key>
|
|
69
66
|
<key name="CopyFile.RECENT_KEYS">
|
|
70
67
|
<recent name="$PROJECT_DIR$/errors" />
|
|
71
68
|
<recent name="$PROJECT_DIR$/schemas/definitions" />
|
|
@@ -73,6 +70,13 @@
|
|
|
73
70
|
<recent name="$PROJECT_DIR$/schemas" />
|
|
74
71
|
<recent name="$PROJECT_DIR$/lib/scripts" />
|
|
75
72
|
</key>
|
|
73
|
+
<key name="MoveFile.RECENT_KEYS">
|
|
74
|
+
<recent name="$PROJECT_DIR$/open-api" />
|
|
75
|
+
<recent name="$PROJECT_DIR$" />
|
|
76
|
+
<recent name="$PROJECT_DIR$/schemas" />
|
|
77
|
+
<recent name="$PROJECT_DIR$/open-api-spec" />
|
|
78
|
+
<recent name="$PROJECT_DIR$/errors" />
|
|
79
|
+
</key>
|
|
76
80
|
</component>
|
|
77
81
|
<component name="RunManager" selected="JavaScript Debug.documentation.html (1)">
|
|
78
82
|
<configuration name="documentation.html (1)" type="JavascriptDebugType" temporary="true" nameIsGenerated="true" uri="http://localhost:63342/gps-common/build/documentation/documentation.html" useBuiltInWebServerPort="true">
|
|
@@ -120,9 +124,9 @@
|
|
|
120
124
|
</configuration>
|
|
121
125
|
<recent_temporary>
|
|
122
126
|
<list>
|
|
123
|
-
<item itemvalue="JavaScript Debug.documentation.html (1)" />
|
|
124
|
-
<item itemvalue="npm.build-documentation" />
|
|
125
127
|
<item itemvalue="npm.test" />
|
|
128
|
+
<item itemvalue="npm.build-documentation" />
|
|
129
|
+
<item itemvalue="JavaScript Debug.documentation.html (1)" />
|
|
126
130
|
<item itemvalue="npm.semantic-release" />
|
|
127
131
|
<item itemvalue="npm.commit" />
|
|
128
132
|
</list>
|
|
@@ -628,7 +632,11 @@
|
|
|
628
632
|
<workItem from="1601366983507" duration="49000" />
|
|
629
633
|
<workItem from="1601370976937" duration="339000" />
|
|
630
634
|
<workItem from="1601551727472" duration="27000" />
|
|
631
|
-
<workItem from="1603700811892" duration="
|
|
635
|
+
<workItem from="1603700811892" duration="525000" />
|
|
636
|
+
<workItem from="1603705612447" duration="352000" />
|
|
637
|
+
<workItem from="1603706953993" duration="423000" />
|
|
638
|
+
<workItem from="1605609847030" duration="706000" />
|
|
639
|
+
<workItem from="1605809676752" duration="842000" />
|
|
632
640
|
</task>
|
|
633
641
|
<servers />
|
|
634
642
|
</component>
|
|
@@ -667,33 +675,25 @@
|
|
|
667
675
|
<option name="oldMeFiltersMigrated" value="true" />
|
|
668
676
|
</component>
|
|
669
677
|
<component name="WindowStateProjectService">
|
|
670
|
-
<state
|
|
671
|
-
<screen x="0" y="23" width="2048" height="1129" />
|
|
672
|
-
</state>
|
|
673
|
-
<state x="762" y="341" key="#com.intellij.refactoring.safeDelete.UnsafeUsagesDialog/0.23.2048.1129@0.23.2048.1129" timestamp="1595577705727" />
|
|
674
|
-
<state width="2006" height="269" key="GridCell.Tab.0.bottom" timestamp="1603700951862">
|
|
678
|
+
<state width="2006" height="269" key="GridCell.Tab.0.bottom" timestamp="1605810518546">
|
|
675
679
|
<screen x="0" y="23" width="2048" height="1129" />
|
|
676
680
|
</state>
|
|
677
|
-
<state width="2006" height="269" key="GridCell.Tab.0.bottom/0.23.2048.1129@0.23.2048.1129" timestamp="
|
|
678
|
-
<state width="2006" height="269" key="GridCell.Tab.0.center" timestamp="
|
|
681
|
+
<state width="2006" height="269" key="GridCell.Tab.0.bottom/0.23.2048.1129@0.23.2048.1129" timestamp="1605810518546" />
|
|
682
|
+
<state width="2006" height="269" key="GridCell.Tab.0.center" timestamp="1605810518545">
|
|
679
683
|
<screen x="0" y="23" width="2048" height="1129" />
|
|
680
684
|
</state>
|
|
681
|
-
<state width="2006" height="269" key="GridCell.Tab.0.center/0.23.2048.1129@0.23.2048.1129" timestamp="
|
|
682
|
-
<state width="2006" height="269" key="GridCell.Tab.0.left" timestamp="
|
|
685
|
+
<state width="2006" height="269" key="GridCell.Tab.0.center/0.23.2048.1129@0.23.2048.1129" timestamp="1605810518545" />
|
|
686
|
+
<state width="2006" height="269" key="GridCell.Tab.0.left" timestamp="1605810518545">
|
|
683
687
|
<screen x="0" y="23" width="2048" height="1129" />
|
|
684
688
|
</state>
|
|
685
|
-
<state width="2006" height="269" key="GridCell.Tab.0.left/0.23.2048.1129@0.23.2048.1129" timestamp="
|
|
686
|
-
<state width="2006" height="269" key="GridCell.Tab.0.right" timestamp="
|
|
689
|
+
<state width="2006" height="269" key="GridCell.Tab.0.left/0.23.2048.1129@0.23.2048.1129" timestamp="1605810518545" />
|
|
690
|
+
<state width="2006" height="269" key="GridCell.Tab.0.right" timestamp="1605810518545">
|
|
687
691
|
<screen x="0" y="23" width="2048" height="1129" />
|
|
688
692
|
</state>
|
|
689
|
-
<state width="2006" height="269" key="GridCell.Tab.0.right/0.23.2048.1129@0.23.2048.1129" timestamp="
|
|
693
|
+
<state width="2006" height="269" key="GridCell.Tab.0.right/0.23.2048.1129@0.23.2048.1129" timestamp="1605810518545" />
|
|
690
694
|
<state x="725" y="342" width="736" height="612" key="find.popup" timestamp="1598206991663">
|
|
691
695
|
<screen x="0" y="23" width="2048" height="1129" />
|
|
692
696
|
</state>
|
|
693
697
|
<state x="725" y="342" width="736" height="612" key="find.popup/0.23.2048.1129@0.23.2048.1129" timestamp="1598206991663" />
|
|
694
|
-
<state x="689" y="276" width="670" height="676" key="search.everywhere.popup" timestamp="1595579270021">
|
|
695
|
-
<screen x="0" y="23" width="2048" height="1129" />
|
|
696
|
-
</state>
|
|
697
|
-
<state x="689" y="276" width="670" height="676" key="search.everywhere.popup/0.23.2048.1129@0.23.2048.1129" timestamp="1595579270021" />
|
|
698
698
|
</component>
|
|
699
699
|
</project>
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [34.6.0](https://github.com/GLS-Spain/gps-common/compare/v34.5.1...v34.6.0) (2020-11-19)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* add GLS Spain error to create sale ([38ad6c7](https://github.com/GLS-Spain/gps-common/commit/38ad6c7976d11c1ede5bc960e63d4a0cc22fe15f))
|
|
7
|
+
|
|
8
|
+
## [34.5.1](https://github.com/GLS-Spain/gps-common/compare/v34.5.0...v34.5.1) (2020-10-26)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* change super admin find sales by network and shop to only shop ([18e52f6](https://github.com/GLS-Spain/gps-common/commit/18e52f65718ba2a49cc11980198922d4e2aed1f7))
|
|
14
|
+
|
|
1
15
|
# [34.5.0](https://github.com/GLS-Spain/gps-common/compare/v34.4.1...v34.5.0) (2020-10-26)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const { DatabaseError } = require('@gls_spain/mongodb');
|
|
2
|
+
|
|
3
|
+
class GLSSpainError extends DatabaseError {
|
|
4
|
+
constructor(message = 'GLS Spain integration error.') {
|
|
5
|
+
// noinspection JSCheckFunctionSignatures
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = 'GLSSpainError';
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
module.exports = GLSSpainError;
|
package/errors/index.js
CHANGED
|
@@ -32,6 +32,7 @@ const SaleDoesNotExistError = require('./SaleDoesNotExistError');
|
|
|
32
32
|
const SaleAlreadyExistsError = require('./SaleAlreadyExistsError');
|
|
33
33
|
const InconsistentSalesSettingsError = require('./InconsistentSalesSettingsError');
|
|
34
34
|
const InvalidSaleDestinationError = require('./InvalidSaleDestinationError');
|
|
35
|
+
const GLSSpainError = require('./GLSSpainError');
|
|
35
36
|
|
|
36
37
|
const errorsNames = {
|
|
37
38
|
DatabaseNotEmptyError: 'DatabaseNotEmptyError',
|
|
@@ -68,6 +69,7 @@ const errorsNames = {
|
|
|
68
69
|
SaleAlreadyExistsError: 'SaleAlreadyExistsError',
|
|
69
70
|
InconsistentSalesSettingsError: 'InconsistentSalesSettingsError',
|
|
70
71
|
InvalidSaleDestinationError: 'InvalidSaleDestinationError',
|
|
72
|
+
GLSSpainError: 'GLSSpainError',
|
|
71
73
|
};
|
|
72
74
|
|
|
73
75
|
module.exports = {
|
|
@@ -105,5 +107,6 @@ module.exports = {
|
|
|
105
107
|
SaleAlreadyExistsError,
|
|
106
108
|
InconsistentSalesSettingsError,
|
|
107
109
|
InvalidSaleDestinationError,
|
|
110
|
+
GLSSpainError,
|
|
108
111
|
errorsNames,
|
|
109
112
|
};
|
package/open-api-spec/index.js
CHANGED
|
@@ -43,6 +43,7 @@ const {
|
|
|
43
43
|
SaleAlreadyExistsError,
|
|
44
44
|
InconsistentSalesSettingsError,
|
|
45
45
|
InvalidSaleDestinationError,
|
|
46
|
+
GLSSpainError,
|
|
46
47
|
} = require('../errors');
|
|
47
48
|
const { timezoneNames } = require('../schemas/definitions/common');
|
|
48
49
|
const { loginResponse } = require('../schemas/definitions/login');
|
|
@@ -908,6 +909,7 @@ const errors = {
|
|
|
908
909
|
saleAlreadyExists: new SaleAlreadyExistsError(),
|
|
909
910
|
inconsistentSalesSettings: new InconsistentSalesSettingsError(),
|
|
910
911
|
invalidSaleDestination: new InvalidSaleDestinationError(),
|
|
912
|
+
glsSpainError: new GLSSpainError(),
|
|
911
913
|
};
|
|
912
914
|
|
|
913
915
|
const responses = {
|
|
@@ -1075,6 +1077,10 @@ const responses = {
|
|
|
1075
1077
|
description: 'The sale destination is invalid.',
|
|
1076
1078
|
content: { 'application/json': { schema: specificHttpError(errors.invalidSaleDestination) } },
|
|
1077
1079
|
},
|
|
1080
|
+
glsSpainError: {
|
|
1081
|
+
description: 'Cannot create the sale due to an error from the GLS Spain integration.',
|
|
1082
|
+
content: { 'application/json': { schema: specificHttpError(errors.glsSpainError) } },
|
|
1083
|
+
},
|
|
1078
1084
|
};
|
|
1079
1085
|
|
|
1080
1086
|
const securitySchemes = {
|
|
@@ -2624,7 +2630,10 @@ An expedition can be associated on creation to either one shop, one network or m
|
|
|
2624
2630
|
|
|
2625
2631
|
- Provide \`shop\` when it can be received only in a specific shop. The network will be inserted automatically.
|
|
2626
2632
|
- Provide \`network\` when it can be received at any shop in one network. On reception the shop will be added to the expedition.
|
|
2627
|
-
- Provide \`network\` and \`otherNetworks\` when it can be received in any shop in more than one network. On reception the network and shop
|
|
2633
|
+
- Provide \`network\` and \`otherNetworks\` when it can be received in any shop in more than one network. On reception the network and shop
|
|
2634
|
+
will be set and the other networks removed.
|
|
2635
|
+
|
|
2636
|
+
If a provided network does not exist the API will return a \`500 NetworkDoesNotExistError\`.
|
|
2628
2637
|
|
|
2629
2638
|
If the provided shop does not exist the API will return a \`500 ShopDoesNotExistError\`, if it is not enabled it will return a
|
|
2630
2639
|
\`500 ShopNotEnabledError\`, and if it is readonly it will return a \`500 ShopCannotBeUpdatedError\`.
|
|
@@ -2632,9 +2641,8 @@ If the provided shop does not exist the API will return a \`500 ShopDoesNotExist
|
|
|
2632
2641
|
When providing a shop one can also provide a sale if the expedition is created because of it. If the provided sale does not
|
|
2633
2642
|
exist the API will return a \`500 SaleDoesNotExistError\`.
|
|
2634
2643
|
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
The \`status.code\` of a new expedition cannot be specified and it will always be \`incoming\`.
|
|
2644
|
+
The \`status.code\` of a new expedition cannot be specified and will be \`incoming\` when the expedition has no \`sale\` and \`inShop\`
|
|
2645
|
+
when it does.
|
|
2638
2646
|
|
|
2639
2647
|
${securitySchemes.tokens}
|
|
2640
2648
|
${securitySchemes.superAdminRole}`,
|
|
@@ -3164,6 +3172,9 @@ If the shop does not have the capability to sell the API will return a \`500 Sho
|
|
|
3164
3172
|
|
|
3165
3173
|
If the destination is invalid the API will return a \`500 InvalidSaleDestinationError\`.
|
|
3166
3174
|
|
|
3175
|
+
Creating a sale requires communicating with GLS Spain to validate the sale. If there is an error on the GLS Spain side the API will return
|
|
3176
|
+
a \`500 GLSSpainError\`.
|
|
3177
|
+
|
|
3167
3178
|
${securitySchemes.tokens}
|
|
3168
3179
|
${securitySchemes.shopUserRole}`,
|
|
3169
3180
|
requestBody: {
|
|
@@ -3188,6 +3199,7 @@ ${securitySchemes.shopUserRole}`,
|
|
|
3188
3199
|
' 500 ': responses.shopCannotBeUpdated,
|
|
3189
3200
|
' 500 ': responses.shopCannotSell,
|
|
3190
3201
|
' 500 ': responses.invalidSaleDestination,
|
|
3202
|
+
' 500 ': responses.glsSpainError,
|
|
3191
3203
|
},
|
|
3192
3204
|
},
|
|
3193
3205
|
},
|
package/package.json
CHANGED
|
@@ -152,9 +152,7 @@ const findByNetwork = () => mergeSchemas(objectWithNetworkId(), { title: 'find b
|
|
|
152
152
|
|
|
153
153
|
const findByShop = () => mergeSchemas(objectWithShopId(), { title: 'find by shop' });
|
|
154
154
|
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
const findSalesSuperAdminRequest = () => findRequest({ oneOf: [findByNetwork(), findByNetworkAndShop(), findById()] });
|
|
155
|
+
const findSalesSuperAdminRequest = () => findRequest({ oneOf: [findByNetwork(), findByShop(), findById()] });
|
|
158
156
|
|
|
159
157
|
const findSalesNetworkAdminRequest = () => findRequest({ oneOf: [findAll(), findByShop(), findById()] });
|
|
160
158
|
|