@defra-fish/dynamics-lib 1.24.0-rc.7 → 1.24.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/dynamics-lib",
3
- "version": "1.24.0-rc.7",
3
+ "version": "1.24.0",
4
4
  "description": "Framework to support integration with dynamics",
5
5
  "type": "module",
6
6
  "engines": {
@@ -43,5 +43,5 @@
43
43
  "simple-oauth2": "^4.3.0",
44
44
  "uuid": "^8.3.2"
45
45
  },
46
- "gitHead": "da3683aebd2547d7a8d2be3668c16c258a073328"
46
+ "gitHead": "c138f45936dbae8ebb917599a53b6cf96c73aaa5"
47
47
  }
@@ -17,6 +17,7 @@ describe('permission entity', () => {
17
17
  defra_enddate: '2020-12-13T23:59:59Z',
18
18
  defra_stagingid: '71ad9a25-2a03-406b-a0e3-f4ff37799374',
19
19
  defra_datasource: 910400003,
20
+ defra_renewal: true,
20
21
  defra_licenceforyou: 1
21
22
  },
22
23
  optionSetData
@@ -30,6 +31,7 @@ describe('permission entity', () => {
30
31
  endDate: '2020-12-13T23:59:59Z',
31
32
  stagingId: '71ad9a25-2a03-406b-a0e3-f4ff37799374',
32
33
  dataSource: expect.objectContaining({ id: 910400003, label: 'Web Sales', description: 'Web Sales' }),
34
+ isRenewal: true,
33
35
  isLicenceForYou: expect.objectContaining({ id: 1, label: 'Yes', description: 'Yes' })
34
36
  }
35
37
 
@@ -73,6 +75,7 @@ describe('permission entity', () => {
73
75
  permission.endDate = '2020-12-13T23:59:59Z'
74
76
  permission.stagingId = '71ad9a25-2a03-406b-a0e3-f4ff37799374'
75
77
  permission.dataSource = optionSetData.defra_datasource.options['910400003']
78
+ permission.isRenewal = true
76
79
  permission.isLicenceForYou = optionSetData.defra_islicenceforyou.options['1']
77
80
 
78
81
  permission.bindToEntity(Permission.definition.relationships.licensee, contact)
@@ -93,7 +96,8 @@ describe('permission entity', () => {
93
96
  'defra_PermitId@odata.bind': `/${Permit.definition.dynamicsCollection}(${permit.id})`,
94
97
  'defra_ContactId@odata.bind': `$${contact.uniqueContentId}`,
95
98
  'defra_Transaction@odata.bind': `$${transaction.uniqueContentId}`,
96
- 'defra_POCLFileId@odata.bind': `$${poclFile.uniqueContentId}`
99
+ 'defra_POCLFileId@odata.bind': `$${poclFile.uniqueContentId}`,
100
+ defra_renewal: true
97
101
  })
98
102
  )
99
103
  })
@@ -23,6 +23,7 @@ export class Permission extends BaseEntity {
23
23
  endDate: { field: 'defra_enddate', type: 'datetime' },
24
24
  stagingId: { field: 'defra_stagingid', type: 'string' },
25
25
  dataSource: { field: 'defra_datasource', type: 'optionset', ref: 'defra_datasource' },
26
+ isRenewal: { field: 'defra_renewal', type: 'boolean' },
26
27
  isLicenceForYou: { field: 'defra_licenceforyou', type: 'optionset', ref: 'defra_islicenceforyou' }
27
28
  },
28
29
  relationships: {
@@ -115,6 +116,18 @@ export class Permission extends BaseEntity {
115
116
  }
116
117
 
117
118
  /**
119
+ * Whether the permission is a renewal
120
+ * @type {boolean}
121
+ */
122
+ get isRenewal () {
123
+ return super._getState('isRenewal')
124
+ }
125
+
126
+ set isRenewal (isRenewal) {
127
+ super._setState('isRenewal', isRenewal)
128
+ }
129
+
130
+ /*
118
131
  * Whether the permission is for the user purchasing the licence or someone else
119
132
  * @type {boolean}
120
133
  */