@defra-fish/sales-api-service 1.77.0-rc.1 → 1.77.0-rc.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra-fish/sales-api-service",
3
- "version": "1.77.0-rc.1",
3
+ "version": "1.77.0-rc.3",
4
4
  "description": "Rod Licensing Sales API",
5
5
  "type": "module",
6
6
  "engines": {
@@ -35,9 +35,9 @@
35
35
  "test": "echo \"Error: run tests from root\" && exit 1"
36
36
  },
37
37
  "dependencies": {
38
- "@defra-fish/business-rules-lib": "1.77.0-rc.1",
39
- "@defra-fish/connectors-lib": "1.77.0-rc.1",
40
- "@defra-fish/dynamics-lib": "1.77.0-rc.1",
38
+ "@defra-fish/business-rules-lib": "1.77.0-rc.3",
39
+ "@defra-fish/connectors-lib": "1.77.0-rc.3",
40
+ "@defra-fish/dynamics-lib": "1.77.0-rc.3",
41
41
  "@hapi/boom": "9.1.2",
42
42
  "@hapi/hapi": "20.1.3",
43
43
  "@hapi/inert": "6.0.3",
@@ -53,5 +53,5 @@
53
53
  "moment-timezone": "0.5.34",
54
54
  "uuid": "8.3.2"
55
55
  },
56
- "gitHead": "2d2758c633c72fb22cd69fd5c9cbf0046568a9a9"
56
+ "gitHead": "fa97e97564ae1c2a49ffb2671f690f4328205942"
57
57
  }
@@ -5,7 +5,8 @@ const getRequestSampleData = () => ({
5
5
  licenseeFirstName: 'Laila',
6
6
  licenseeLastName: 'Alial',
7
7
  licenseeBirthDate: '2000-10-03',
8
- licenseePostcode: 'W8 7PP'
8
+ licenseePostcode: 'W8 7PP',
9
+ licenseePremises: '12'
9
10
  })
10
11
 
11
12
  const optionSetOptionSample = () => ({ id: 910400000, label: 'Example Label', description: 'Example Description' })
@@ -49,7 +50,7 @@ describe('licenceDetailsRequestQuerySchema', () => {
49
50
  expect(result).toEqual(getRequestSampleData())
50
51
  })
51
52
 
52
- it.each([['licenseeFirstName'], ['licenseeLastName'], ['licenseeBirthDate'], ['licenseePostcode']])(
53
+ it.each([['licenseeFirstName'], ['licenseeLastName'], ['licenseeBirthDate'], ['licenseePostcode'], ['licenseePremises']])(
53
54
  'fails when %s is missing',
54
55
  async field => {
55
56
  const { [field]: _, ...invalidData } = getRequestSampleData()
@@ -8,6 +8,7 @@ export const licenceDetailsRequestQuerySchema = Joi.object({
8
8
  licenseeFirstName: validation.contact.createFirstNameValidator(Joi).description('The first name of the licensee'),
9
9
  licenseeLastName: validation.contact.createLastNameValidator(Joi).description('The last name of the licensee'),
10
10
  licenseeBirthDate: validation.contact.createBirthDateValidator(Joi).description('The date of birth of the licensee'),
11
+ licenseePremises: validation.contact.createPremisesValidator(Joi).description('The premises of the licensee'),
11
12
  licenseePostcode: Joi.alternatives()
12
13
  .try(
13
14
  validation.contact.createUKPostcodeValidator(Joi).description('The postcode of the licensee'),
@@ -35,7 +35,8 @@ describe('licence-details handler', () => {
35
35
  licenseeFirstName: 'Bilbo',
36
36
  licenseeLastName: 'Baggins',
37
37
  licenseeBirthDate: '2000-10-03',
38
- licenseePostcode: 'AB12 3CD'
38
+ licenseePostcode: 'AB12 3CD',
39
+ licenseePremises: '12'
39
40
  }
40
41
  }
41
42
 
@@ -78,17 +79,17 @@ describe('licence-details handler', () => {
78
79
  }
79
80
 
80
81
  expect(routeMetadata).toMatchInlineSnapshot(`
81
- Object {
82
- "description": "Look up licence details for a licensee using their name, postcode and date of birth",
83
- "method": "GET",
84
- "notes": "Look up licence details for a licensee using their name, postcode and date of birth",
85
- "path": "/licenceDetails",
86
- "tags": Array [
87
- "api",
88
- "licence-details",
89
- ],
90
- }
91
- `)
82
+ Object {
83
+ "description": "Look up licence details for a licensee using their name, premises, postcode and date of birth",
84
+ "method": "GET",
85
+ "notes": "Look up licence details for a licensee using their name, premises, postcode and date of birth",
86
+ "path": "/licenceDetails",
87
+ "tags": Array [
88
+ "api",
89
+ "licence-details",
90
+ ],
91
+ }
92
+ `)
92
93
  })
93
94
 
94
95
  it('returns 500 if executeQuery throws', async () => {
@@ -107,14 +108,14 @@ describe('licence-details handler', () => {
107
108
  })
108
109
 
109
110
  it.each([
110
- ['Frodo', 'Underhill', '1993-09-22', 'EF45 6GH'],
111
- ['Samwise', 'Gamgee', '1998-03-06', 'IJ78 9KL'],
112
- ['Peregrin', 'Took', '1994-04-01', 'ZZ99 9ZZ']
111
+ ['Frodo', 'Underhill', '1993-09-22', 'Bag End', 'EF45 6GH'],
112
+ ['Samwise', 'Gamgee', '1998-03-06', '15', 'IJ78 9KL'],
113
+ ['Peregrin', 'Took', '1994-04-01', '12', 'ZZ99 9ZZ']
113
114
  ])(
114
- 'calls contactForLicenseeByPersonalDetails with the name, dob and postcode from the query (%s %s)',
115
- async (licenseeFirstName, licenseeLastName, licenseeBirthDate, licenseePostcode) => {
115
+ 'calls contactForLicenseeByPersonalDetails with the name, dob, premises and postcode from the query (%s %s)',
116
+ async (licenseeFirstName, licenseeLastName, licenseeBirthDate, licenseePremises, licenseePostcode) => {
116
117
  mockContactWithPermissions(mockPermission())
117
- const query = { licenseeFirstName, licenseeLastName, licenseeBirthDate, licenseePostcode }
118
+ const query = { licenseeFirstName, licenseeLastName, licenseeBirthDate, licenseePremises, licenseePostcode }
118
119
 
119
120
  await getLicenceDetails({ query })
120
121
 
@@ -27,9 +27,9 @@ const isActiveTwelveMonthLicence = permission => {
27
27
  }
28
28
 
29
29
  export const getLicenceDetails = async request => {
30
- const { licenseeFirstName, licenseeLastName, licenseeBirthDate, licenseePostcode } = request.query
30
+ const { licenseeFirstName, licenseeLastName, licenseeBirthDate, licenseePremises, licenseePostcode } = request.query
31
31
  const contacts = await executeWithErrorLog(
32
- contactForLicenseeByPersonalDetails({ licenseeFirstName, licenseeLastName, licenseeBirthDate, licenseePostcode })
32
+ contactForLicenseeByPersonalDetails({ licenseeFirstName, licenseeLastName, licenseeBirthDate, licenseePremises, licenseePostcode })
33
33
  )
34
34
 
35
35
  if (!contacts.length) {
@@ -64,9 +64,9 @@ export default [
64
64
  path: '/licenceDetails',
65
65
  options: {
66
66
  handler,
67
- description: 'Look up licence details for a licensee using their name, postcode and date of birth',
67
+ description: 'Look up licence details for a licensee using their name, premises, postcode and date of birth',
68
68
  notes: `
69
- Look up licence details for a licensee using their name, postcode and date of birth
69
+ Look up licence details for a licensee using their name, premises, postcode and date of birth
70
70
  `,
71
71
  tags: ['api', 'licence-details'],
72
72
  validate: {