@gls_spain/gps-common 34.5.1 → 34.7.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.
@@ -0,0 +1,3 @@
1
+ <component name="DependencyValidationManager">
2
+ <scope name="Source files" pattern="file[gps-common]:errors//*||file[gps-common]:open-api-spec//*||file[gps-common]:schemas//*||file[gps-common]:scripts//*||file[gps-common]:*" />
3
+ </component>
@@ -16,7 +16,7 @@
16
16
  <option name="outputFromStdout" value="false" />
17
17
  <option name="program" value="$ProjectFileDir$/node_modules/.bin/prettier" />
18
18
  <option name="runOnExternalChanges" value="true" />
19
- <option name="scopeName" value="Project Files" />
19
+ <option name="scopeName" value="Source files" />
20
20
  <option name="trackOnlyRoot" value="false" />
21
21
  <option name="workingDir" value="$ProjectFileDir$" />
22
22
  <envs />
@@ -36,7 +36,7 @@
36
36
  <option name="outputFromStdout" value="false" />
37
37
  <option name="program" value="$ProjectFileDir$/node_modules/.bin/prettier" />
38
38
  <option name="runOnExternalChanges" value="true" />
39
- <option name="scopeName" value="Project Files" />
39
+ <option name="scopeName" value="Source files" />
40
40
  <option name="trackOnlyRoot" value="false" />
41
41
  <option name="workingDir" value="$ProjectFileDir$" />
42
42
  <envs />
@@ -2,7 +2,12 @@
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 beforePath="$PROJECT_DIR$/.idea/watcherTasks.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/watcherTasks.xml" afterDir="false" />
6
+ <change beforePath="$PROJECT_DIR$/errors/GLSRecordingError.js" beforeDir="false" afterPath="$PROJECT_DIR$/errors/GLSRecordingError.js" afterDir="false" />
7
+ <change beforePath="$PROJECT_DIR$/errors/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/errors/index.js" afterDir="false" />
5
8
  <change beforePath="$PROJECT_DIR$/open-api-spec/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/open-api-spec/index.js" afterDir="false" />
9
+ <change beforePath="$PROJECT_DIR$/package-lock.json" beforeDir="false" afterPath="$PROJECT_DIR$/package-lock.json" afterDir="false" />
10
+ <change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
6
11
  <change beforePath="$PROJECT_DIR$/schemas/definitions/sales.js" beforeDir="false" afterPath="$PROJECT_DIR$/schemas/definitions/sales.js" afterDir="false" />
7
12
  </list>
8
13
  <option name="SHOW_DIALOG" value="false" />
@@ -26,6 +31,11 @@
26
31
  <other-services-enabled>true</other-services-enabled>
27
32
  <auto-save>true</auto-save>
28
33
  </component>
34
+ <component name="NamedScopeManager">
35
+ <order>
36
+ <scope name="Source files" />
37
+ </order>
38
+ </component>
29
39
  <component name="ProjectId" id="1ONNcC0Dj8TpB0ikqd9Zaci2JZf" />
30
40
  <component name="ProjectLevelVcsManager">
31
41
  <ConfirmationsSetting value="2" id="Add" />
@@ -38,13 +48,14 @@
38
48
  <property name="ASKED_ADD_EXTERNAL_FILES" value="true" />
39
49
  <property name="ASKED_SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
40
50
  <property name="NewWatcherDialog.advanced.open" value="true" />
51
+ <property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
41
52
  <property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
42
53
  <property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
43
54
  <property name="TERMINAL_CUSTOM_COMMANDS_GOT_IT" value="true" />
44
55
  <property name="WebServerToolWindowFactoryState" value="false" />
45
- <property name="javascript.nodejs.core.library.configured.version" value="12.13.0" />
46
- <property name="javascript.nodejs.core.library.typings.version" value="12.12.53" />
47
- <property name="last_opened_file_path" value="$PROJECT_DIR$/errors" />
56
+ <property name="javascript.nodejs.core.library.configured.version" value="12.14.0" />
57
+ <property name="javascript.nodejs.core.library.typings.version" value="12.19.9" />
58
+ <property name="last_opened_file_path" value="$PROJECT_DIR$" />
48
59
  <property name="node.js.detected.package.eslint" value="true" />
49
60
  <property name="node.js.detected.package.standard" value="true" />
50
61
  <property name="node.js.path.for.package.eslint" value="project" />
@@ -123,9 +134,9 @@
123
134
  </configuration>
124
135
  <recent_temporary>
125
136
  <list>
137
+ <item itemvalue="npm.test" />
126
138
  <item itemvalue="JavaScript Debug.documentation.html (1)" />
127
139
  <item itemvalue="npm.build-documentation" />
128
- <item itemvalue="npm.test" />
129
140
  <item itemvalue="npm.semantic-release" />
130
141
  <item itemvalue="npm.commit" />
131
142
  </list>
@@ -633,7 +644,19 @@
633
644
  <workItem from="1601551727472" duration="27000" />
634
645
  <workItem from="1603700811892" duration="525000" />
635
646
  <workItem from="1603705612447" duration="352000" />
636
- <workItem from="1603706953993" duration="293000" />
647
+ <workItem from="1603706953993" duration="423000" />
648
+ <workItem from="1605609847030" duration="706000" />
649
+ <workItem from="1605809676752" duration="1017000" />
650
+ <workItem from="1605876571382" duration="624000" />
651
+ <workItem from="1605900661533" duration="76000" />
652
+ <workItem from="1606052972013" duration="21000" />
653
+ <workItem from="1606121670993" duration="473000" />
654
+ <workItem from="1606141520470" duration="29000" />
655
+ <workItem from="1606477130384" duration="74000" />
656
+ <workItem from="1606835326733" duration="48000" />
657
+ <workItem from="1607951320583" duration="589000" />
658
+ <workItem from="1608286770164" duration="53000" />
659
+ <workItem from="1608574754236" duration="463000" />
637
660
  </task>
638
661
  <servers />
639
662
  </component>
@@ -671,34 +694,4 @@
671
694
  </option>
672
695
  <option name="oldMeFiltersMigrated" value="true" />
673
696
  </component>
674
- <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">
680
- <screen x="0" y="23" width="2048" height="1129" />
681
- </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">
684
- <screen x="0" y="23" width="2048" height="1129" />
685
- </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">
688
- <screen x="0" y="23" width="2048" height="1129" />
689
- </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">
692
- <screen x="0" y="23" width="2048" height="1129" />
693
- </state>
694
- <state width="2006" height="269" key="GridCell.Tab.0.right/0.23.2048.1129@0.23.2048.1129" timestamp="1603700951862" />
695
- <state x="725" y="342" width="736" height="612" key="find.popup" timestamp="1598206991663">
696
- <screen x="0" y="23" width="2048" height="1129" />
697
- </state>
698
- <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
- </component>
704
697
  </project>
package/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ # [34.7.0](https://github.com/GLS-Spain/gps-common/compare/v34.6.0...v34.7.0) (2020-12-21)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * change get defaults permissions to any role ([92c5f19](https://github.com/GLS-Spain/gps-common/commit/92c5f193ec744ac9cb66021ba20ef1b499ccd2f1))
7
+
8
+
9
+ ### Features
10
+
11
+ * add gls recording error ([15731bb](https://github.com/GLS-Spain/gps-common/commit/15731bb6e10a02178ecc536bd12ea34cde06ca97))
12
+
13
+ # [34.6.0](https://github.com/GLS-Spain/gps-common/compare/v34.5.1...v34.6.0) (2020-11-19)
14
+
15
+
16
+ ### Features
17
+
18
+ * add GLS Spain error to create sale ([38ad6c7](https://github.com/GLS-Spain/gps-common/commit/38ad6c7976d11c1ede5bc960e63d4a0cc22fe15f))
19
+
1
20
  ## [34.5.1](https://github.com/GLS-Spain/gps-common/compare/v34.5.0...v34.5.1) (2020-10-26)
2
21
 
3
22
 
@@ -0,0 +1,11 @@
1
+ const { DatabaseError } = require('@gls_spain/mongodb');
2
+
3
+ class GLSRecordingError extends DatabaseError {
4
+ constructor(message = 'GLS Spain recording layer error.') {
5
+ // noinspection JSCheckFunctionSignatures
6
+ super(message);
7
+ this.name = 'GLSRecordingError';
8
+ }
9
+ }
10
+
11
+ module.exports = GLSRecordingError;
@@ -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,8 @@ 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');
36
+ const GLSRecordingError = require('./GLSRecordingError');
35
37
 
36
38
  const errorsNames = {
37
39
  DatabaseNotEmptyError: 'DatabaseNotEmptyError',
@@ -68,6 +70,8 @@ const errorsNames = {
68
70
  SaleAlreadyExistsError: 'SaleAlreadyExistsError',
69
71
  InconsistentSalesSettingsError: 'InconsistentSalesSettingsError',
70
72
  InvalidSaleDestinationError: 'InvalidSaleDestinationError',
73
+ GLSSpainError: 'GLSSpainError',
74
+ GLSRecordingError: 'GLSRecordingError',
71
75
  };
72
76
 
73
77
  module.exports = {
@@ -105,5 +109,7 @@ module.exports = {
105
109
  SaleAlreadyExistsError,
106
110
  InconsistentSalesSettingsError,
107
111
  InvalidSaleDestinationError,
112
+ GLSSpainError,
113
+ GLSRecordingError,
108
114
  errorsNames,
109
115
  };
@@ -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 = {
@@ -1296,7 +1302,7 @@ ${securitySchemes.basicAuth}`,
1296
1302
  '/config/defaults/get': {
1297
1303
  get: {
1298
1304
  tags: ['Config'],
1299
- summary: '[S] Get defaults',
1305
+ summary: '[SNU] Get defaults',
1300
1306
  description: `
1301
1307
  Get the default settings.
1302
1308
 
@@ -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.7.0",
4
4
  "description": "Errors, schemas and documentation for the Parcel Shops project",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -43,7 +43,7 @@
43
43
  "jest": "^25.5.4",
44
44
  "prettier": "^1.19.1",
45
45
  "redoc-cli": "^0.9.12",
46
- "semantic-release": "^17.1.1"
46
+ "semantic-release": "^17.3.0"
47
47
  },
48
48
  "dependencies": {
49
49
  "@gls_spain/ajv-options": "^1.1.2",
@@ -42,6 +42,7 @@ const sale = () => ({
42
42
  status: {
43
43
  type: 'object',
44
44
  properties: {
45
+ // todo add paidAt if status=paymentRequested
45
46
  code: {
46
47
  type: 'string',
47
48
  enum: ['invalidOrIncomplete', 'cancelledByCustomer', 'authorizationRefused', 'paymentRequested', 'paymentDeleted', 'refund'],