@defra-fish/sales-api-service 1.71.0-rc.0 → 1.71.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra-fish/sales-api-service",
3
- "version": "1.71.0-rc.0",
3
+ "version": "1.71.0",
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.71.0-rc.0",
39
- "@defra-fish/connectors-lib": "1.71.0-rc.0",
40
- "@defra-fish/dynamics-lib": "1.71.0-rc.0",
38
+ "@defra-fish/business-rules-lib": "1.71.0",
39
+ "@defra-fish/connectors-lib": "1.71.0",
40
+ "@defra-fish/dynamics-lib": "1.71.0",
41
41
  "@hapi/boom": "9.1.2",
42
42
  "@hapi/hapi": "20.1.3",
43
43
  "@hapi/inert": "6.0.3",
@@ -52,5 +52,5 @@
52
52
  "moment-timezone": "0.5.34",
53
53
  "uuid": "8.3.2"
54
54
  },
55
- "gitHead": "fa8ad0d1d338a670b9d1c5fc65f1b4ab80eef3f4"
55
+ "gitHead": "c98333798083660981c89770737986df4129365b"
56
56
  }
@@ -161,6 +161,23 @@ describe('preparePermissionDataForRenewal', () => {
161
161
  expect(permission.concessions).toEqual([])
162
162
  })
163
163
 
164
+ it.each([
165
+ ['1960-09-01', 'turns 66 in < 6 months'],
166
+ ['1960-05-13', 'turns 66 the day after licence start'],
167
+ ['1960-12-25', 'turns 66 in > 6 months']
168
+ ])("doesn't add senior concession if the licensee is 65 at licence start (DOB: %s, %s)", async birthDate => {
169
+ const endDate = moment('2026-05-11')
170
+ const almostSeniorPermission = existingPermission({
171
+ endDate,
172
+ licensee: {
173
+ ...existingPermission().licensee,
174
+ birthDate
175
+ }
176
+ })
177
+ const permission = await preparePermissionDataForRenewal(almostSeniorPermission)
178
+ expect(permission.concessions).toEqual([])
179
+ })
180
+
164
181
  it('should remove noLicenceRequired from licensee', async () => {
165
182
  const permission = existingPermission()
166
183
  permission.licensee.noLicenceRequired = true
@@ -97,9 +97,7 @@ const preparePermit = async existingPermission => {
97
97
 
98
98
  const prepareConcessionsData = async (existingPermission, dateData) => {
99
99
  delete existingPermission.licensee.noLicenceRequired
100
- const ageAtLicenceStartDate = moment(dateData.licenceStartDate)
101
- .add(1, 'year')
102
- .diff(moment(existingPermission.licensee.birthDate), 'years')
100
+ const ageAtLicenceStartDate = moment(dateData.licenceStartDate).diff(moment(existingPermission.licensee.birthDate), 'years')
103
101
 
104
102
  if (isSenior(ageAtLicenceStartDate)) {
105
103
  await addSenior(existingPermission)