@gls_spain/gps-common 34.5.1 → 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.
@@ -2,8 +2,9 @@
2
2
  <project version="4">
3
3
  <component name="ChangeListManager">
4
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" />
5
7
  <change beforePath="$PROJECT_DIR$/open-api-spec/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/open-api-spec/index.js" afterDir="false" />
6
- <change beforePath="$PROJECT_DIR$/schemas/definitions/sales.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/definitions/sales.js" afterDir="false" />
7
8
  </list>
8
9
  <option name="SHOW_DIALOG" value="false" />
9
10
  <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -62,13 +63,6 @@
62
63
  <property name="vue.rearranger.settings.migration" value="true" />
63
64
  </component>
64
65
  <component name="RecentsManager">
65
- <key name="MoveFile.RECENT_KEYS">
66
- <recent name="$PROJECT_DIR$/open-api" />
67
- <recent name="$PROJECT_DIR$" />
68
- <recent name="$PROJECT_DIR$/schemas" />
69
- <recent name="$PROJECT_DIR$/open-api-spec" />
70
- <recent name="$PROJECT_DIR$/errors" />
71
- </key>
72
66
  <key name="CopyFile.RECENT_KEYS">
73
67
  <recent name="$PROJECT_DIR$/errors" />
74
68
  <recent name="$PROJECT_DIR$/schemas/definitions" />
@@ -76,6 +70,13 @@
76
70
  <recent name="$PROJECT_DIR$/schemas" />
77
71
  <recent name="$PROJECT_DIR$/lib/scripts" />
78
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>
79
80
  </component>
80
81
  <component name="RunManager" selected="JavaScript Debug.documentation.html (1)">
81
82
  <configuration name="documentation.html (1)" type="JavascriptDebugType" temporary="true" nameIsGenerated="true" uri="http://localhost:63342/gps-common/build/documentation/documentation.html" useBuiltInWebServerPort="true">
@@ -123,9 +124,9 @@
123
124
  </configuration>
124
125
  <recent_temporary>
125
126
  <list>
126
- <item itemvalue="JavaScript Debug.documentation.html (1)" />
127
- <item itemvalue="npm.build-documentation" />
128
127
  <item itemvalue="npm.test" />
128
+ <item itemvalue="npm.build-documentation" />
129
+ <item itemvalue="JavaScript Debug.documentation.html (1)" />
129
130
  <item itemvalue="npm.semantic-release" />
130
131
  <item itemvalue="npm.commit" />
131
132
  </list>
@@ -633,7 +634,9 @@
633
634
  <workItem from="1601551727472" duration="27000" />
634
635
  <workItem from="1603700811892" duration="525000" />
635
636
  <workItem from="1603705612447" duration="352000" />
636
- <workItem from="1603706953993" duration="293000" />
637
+ <workItem from="1603706953993" duration="423000" />
638
+ <workItem from="1605609847030" duration="706000" />
639
+ <workItem from="1605809676752" duration="842000" />
637
640
  </task>
638
641
  <servers />
639
642
  </component>
@@ -672,33 +675,25 @@
672
675
  <option name="oldMeFiltersMigrated" value="true" />
673
676
  </component>
674
677
  <component name="WindowStateProjectService">
675
- <state x="762" y="341" key="#com.intellij.refactoring.safeDelete.UnsafeUsagesDialog" timestamp="1595577705727">
676
- <screen x="0" y="23" width="2048" height="1129" />
677
- </state>
678
- <state x="762" y="341" key="#com.intellij.refactoring.safeDelete.UnsafeUsagesDialog/0.23.2048.1129@0.23.2048.1129" timestamp="1595577705727" />
679
- <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">
680
679
  <screen x="0" y="23" width="2048" height="1129" />
681
680
  </state>
682
- <state width="2006" height="269" key="GridCell.Tab.0.bottom/0.23.2048.1129@0.23.2048.1129" timestamp="1603700951862" />
683
- <state width="2006" height="269" key="GridCell.Tab.0.center" timestamp="1603700951862">
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">
684
683
  <screen x="0" y="23" width="2048" height="1129" />
685
684
  </state>
686
- <state width="2006" height="269" key="GridCell.Tab.0.center/0.23.2048.1129@0.23.2048.1129" timestamp="1603700951862" />
687
- <state width="2006" height="269" key="GridCell.Tab.0.left" timestamp="1603700951862">
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">
688
687
  <screen x="0" y="23" width="2048" height="1129" />
689
688
  </state>
690
- <state width="2006" height="269" key="GridCell.Tab.0.left/0.23.2048.1129@0.23.2048.1129" timestamp="1603700951862" />
691
- <state width="2006" height="269" key="GridCell.Tab.0.right" timestamp="1603700951862">
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">
692
691
  <screen x="0" y="23" width="2048" height="1129" />
693
692
  </state>
694
- <state width="2006" height="269" key="GridCell.Tab.0.right/0.23.2048.1129@0.23.2048.1129" timestamp="1603700951862" />
693
+ <state width="2006" height="269" key="GridCell.Tab.0.right/0.23.2048.1129@0.23.2048.1129" timestamp="1605810518545" />
695
694
  <state x="725" y="342" width="736" height="612" key="find.popup" timestamp="1598206991663">
696
695
  <screen x="0" y="23" width="2048" height="1129" />
697
696
  </state>
698
697
  <state x="725" y="342" width="736" height="612" key="find.popup/0.23.2048.1129@0.23.2048.1129" timestamp="1598206991663" />
699
- <state x="689" y="276" width="670" height="676" key="search.everywhere.popup" timestamp="1595579270021">
700
- <screen x="0" y="23" width="2048" height="1129" />
701
- </state>
702
- <state x="689" y="276" width="670" height="676" key="search.everywhere.popup/0.23.2048.1129@0.23.2048.1129" timestamp="1595579270021" />
703
698
  </component>
704
699
  </project>
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
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
+
1
8
  ## [34.5.1](https://github.com/GLS-Spain/gps-common/compare/v34.5.0...v34.5.1) (2020-10-26)
2
9
 
3
10
 
@@ -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
  };
@@ -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 = {
@@ -3166,6 +3172,9 @@ If the shop does not have the capability to sell the API will return a \`500 Sho
3166
3172
 
3167
3173
  If the destination is invalid the API will return a \`500 InvalidSaleDestinationError\`.
3168
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
+
3169
3178
  ${securitySchemes.tokens}
3170
3179
  ${securitySchemes.shopUserRole}`,
3171
3180
  requestBody: {
@@ -3190,6 +3199,7 @@ ${securitySchemes.shopUserRole}`,
3190
3199
  ' 500 ': responses.shopCannotBeUpdated,
3191
3200
  ' 500 ': responses.shopCannotSell,
3192
3201
  ' 500 ': responses.invalidSaleDestination,
3202
+ ' 500 ': responses.glsSpainError,
3193
3203
  },
3194
3204
  },
3195
3205
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gls_spain/gps-common",
3
- "version": "34.5.1",
3
+ "version": "34.6.0",
4
4
  "description": "Errors, schemas and documentation for the Parcel Shops project",
5
5
  "main": "index.js",
6
6
  "keywords": [