@gls_spain/gps-common 34.14.0 → 34.16.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
- # [34.14.0](https://github.com/GLS-Spain/gps-common/compare/v34.13.2...v34.14.0) (2021-05-21)
1
+ # [34.16.0](https://github.com/GLS-Spain/gps-common/compare/v34.15.0...v34.16.0) (2021-05-24)
2
2
 
3
3
 
4
4
  ### Features
5
5
 
6
- * new end point notNofiticationReceiver ([8af8d6d](https://github.com/GLS-Spain/gps-common/commit/8af8d6dad7b5b9d6df96446799c7f2f62002b6a0))
6
+ * new endpoint create sales by shopId to role superAdmin ([f7ef396](https://github.com/GLS-Spain/gps-common/commit/f7ef39638a4744e072387851794164552703aa3d))
7
7
 
8
+ # [34.15.0](https://github.com/GLS-Spain/gps-common/compare/v34.14.0...v34.15.0) (2021-05-24)
9
+
10
+
11
+ ### Features
12
+
13
+ * add new property 'type' in network ([1bbd68f](https://github.com/GLS-Spain/gps-common/commit/1bbd68fd2493568a2be84ba36fd29684d1123901))
14
+
15
+ # [34.14.0](https://github.com/GLS-Spain/gps-common/compare/v34.13.2...v34.14.0) (2021-05-21)
16
+
17
+
18
+ ### Features
19
+
20
+ * new end point notNofiticationReceiver ([8af8d6d](https://github.com/GLS-Spain/gps-common/commit/8af8d6dad7b5b9d6df96446799c7f2f62002b6a0))
21
+
8
22
  ## [34.13.2](https://github.com/GLS-Spain/gps-common/compare/v34.13.1...v34.13.2) (2021-05-21)
9
23
 
10
24
 
@@ -3502,6 +3502,73 @@ If the destination is invalid the API will return a \`500 InvalidSaleDestination
3502
3502
  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
3503
3503
  a \`500 GLSSpainError\`.
3504
3504
 
3505
+ ${securitySchemes.tokens}
3506
+ ${securitySchemes.shopUserRole}`,
3507
+ requestBody: {
3508
+ content: { 'application/json': { schema: createSaleRequest() } },
3509
+ required: true,
3510
+ },
3511
+ responses: {
3512
+ ' 200': {
3513
+ description: 'Contains the created sale.',
3514
+ content: { 'application/json': { schema: createSaleResponse() } },
3515
+ },
3516
+ ' 400': responses.badRequest,
3517
+ ' 401': responses.invalidUserInCookieOrHeader,
3518
+ ' 401 ': responses.invalidCookieOrHeader,
3519
+ ' 401 ': responses.missingCookieOrHeader,
3520
+ ' 401 ': responses.unauthorized,
3521
+ ' 403': responses.forbidden,
3522
+ ' 415': responses.unsupportedMediaType,
3523
+ ' 500': responses.internalServerError,
3524
+ ' 500 ': responses.saleAlreadyExists,
3525
+ ' 500 ': responses.shopNotEnabled,
3526
+ ' 500 ': responses.shopCannotBeUpdated,
3527
+ ' 500 ': responses.shopCannotSell,
3528
+ ' 500 ': responses.invalidSaleDestination,
3529
+ ' 500 ': responses.glsSpainError,
3530
+ },
3531
+ },
3532
+ },
3533
+ '/sales/create/{shopId}': {
3534
+ post: {
3535
+ tags: ['Sales'],
3536
+ summary: '[S] Create by ShopId',
3537
+ parameters: [
3538
+ {
3539
+ name: 'shopId',
3540
+ in: 'query',
3541
+ required: true,
3542
+ schema: { type: 'string' },
3543
+ description: 'Shop Id to insert sale.',
3544
+ }],
3545
+ description: `
3546
+ Creates a new sale.
3547
+
3548
+ ${descriptions.createIdIsOptional}
3549
+
3550
+ ${descriptions.optionalArrayPropertiesEmptyByDefault}
3551
+
3552
+ The \`network\` and \`shop\` fields of the new sale will be the same as the shop user that creates it.
3553
+
3554
+ The \`status.code\` will be \`pending\`.
3555
+
3556
+ The \`settings\` field will be created by combining the \`salesSettings\` from the \`default\` object and the \`salesSettings\` from the
3557
+ sale \`network\` as they are when the sale is created. This way the sale will keep the right settings values even if the \`default\` or
3558
+ the \`network\` are updated later.
3559
+
3560
+ The \`price\` field will be calculated from the \`size\` and \`settings\` fields.
3561
+
3562
+ If the shop the user belongs to is not enabled the API will return a \`500 ShopNotEnabledError\` and if the shop is readonly it will
3563
+ return a \`500 ShopCannotBeUpdatedError\`.
3564
+
3565
+ If the shop does not have the capability to sell the API will return a \`500 ShopCannotSellError\`.
3566
+
3567
+ If the destination is invalid the API will return a \`500 InvalidSaleDestinationError\`.
3568
+
3569
+ 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
3570
+ a \`500 GLSSpainError\`.
3571
+
3505
3572
  ${securitySchemes.tokens}
3506
3573
  ${securitySchemes.shopUserRole}`,
3507
3574
  requestBody: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gls_spain/gps-common",
3
- "version": "34.14.0",
3
+ "version": "34.16.0",
4
4
  "description": "Errors, schemas and documentation for the Parcel Shops project",
5
5
  "keywords": [
6
6
  "gls"
@@ -435,6 +435,15 @@ const findByFiscal = () => ({
435
435
  additionalProperties: false,
436
436
  });
437
437
 
438
+ const networkType = () => ({
439
+ type: 'string',
440
+ enum: [
441
+ 'ParcelShop',
442
+ 'Locker',
443
+ 'Agency'
444
+ ]
445
+ });
446
+
438
447
  module.exports = {
439
448
  specificErrorResponse,
440
449
  date,
@@ -459,4 +468,5 @@ module.exports = {
459
468
  contact,
460
469
  fiscal,
461
470
  findByFiscal,
471
+ networkType
462
472
  };
@@ -12,7 +12,7 @@ const {
12
12
  deleteResponse,
13
13
  pickProperties,
14
14
  } = require('@gls_spain/common-json-schemas');
15
- const { findAll, findById, findByName, objectWithUuidAndName, contact, fiscal } = require('./common');
15
+ const { findAll, findById, findByName, objectWithUuidAndName, contact, fiscal, networkType } = require('./common');
16
16
  const { defaults, derivationSettings, expirationSettings } = require('./defaults');
17
17
 
18
18
  const network = () => ({
@@ -47,8 +47,9 @@ const network = () => ({
47
47
  required: ['networkPercentage', 'shopPercentage'],
48
48
  additionalProperties: false,
49
49
  },
50
+ type: networkType()
50
51
  },
51
- required: ['_id', 'createdAt', 'updatedAt', 'deletable', 'readonly', 'defaults', 'name', 'contacts', 'salesSettings'],
52
+ required: ['_id', 'createdAt', 'updatedAt', 'deletable', 'readonly', 'defaults', 'name', 'contacts', 'salesSettings', 'type'],
52
53
  additionalProperties: false,
53
54
  });
54
55
 
@@ -73,6 +74,7 @@ const createNetworkRequest = () =>
73
74
  'derivationSettings',
74
75
  'expirationSettings',
75
76
  'salesSettings',
77
+ 'type'
76
78
  ]),
77
79
  },
78
80
  required: ['name', 'salesSettings'],
package/schemas/index.js CHANGED
@@ -231,7 +231,6 @@ const expeditionsExpireRequest = request(expireExpeditionRequest(), 'expeditions
231
231
  const expeditionsUnexpireRequest = request(unexpireExpeditionRequest(), 'expeditionsUnexpireRequest');
232
232
  const expeditionsUpdateDerivationRequest = request(updateExpeditionDerivationRequest(), 'expeditionsUpdateDerivationRequest');
233
233
  const expeditionsReminderRequest = request(reminderResponse(), 'expeditionsReminderRequest');
234
- const expeditionsNotNotificationRequest = request(notNotificationResponse(), 'expeditionsNotNotificationRequest');
235
234
 
236
235
  const podsFindRequest = request(findPodsRequest(), 'podsFindRequest');
237
236
  const podsFindResponse = response(findPodsResponse(), 'podsFindResponse');