@defra-fish/dynamics-lib 1.61.0-rc.9 → 1.62.0-rc.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,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defra-fish/dynamics-lib",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.62.0-rc.0",
|
|
4
4
|
"description": "Framework to support integration with dynamics",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
7
|
-
"node": ">=
|
|
7
|
+
"node": ">=20"
|
|
8
8
|
},
|
|
9
9
|
"keywords": [
|
|
10
10
|
"rod",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"simple-oauth2": "^4.3.0",
|
|
44
44
|
"uuid": "^8.3.2"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "d56e1a0d0f4b22f1dded800c0ed511b737cb91a7"
|
|
47
47
|
}
|
|
@@ -21,10 +21,7 @@ export class RecurringPayment extends BaseEntity {
|
|
|
21
21
|
cancelledReason: { field: 'defra_cancelledreason', type: 'optionset', ref: 'defra_cancelledreason' },
|
|
22
22
|
endDate: { field: 'defra_enddate', type: 'datetime' },
|
|
23
23
|
agreementId: { field: 'defra_agreementid', type: 'string' },
|
|
24
|
-
activePermission: { field: '_defra_activepermission_value', type: 'string' },
|
|
25
|
-
contactId: { field: '_defra_contact_value', type: 'string' },
|
|
26
24
|
publicId: { field: 'defra_publicid', type: 'string' },
|
|
27
|
-
nextRecurringPayment: { field: '_defra_nextrecurringpayment_value', type: 'string' },
|
|
28
25
|
lastDigitsCardNumbers: { field: 'defra_lastdigitscardnumbers', type: 'string' }
|
|
29
26
|
},
|
|
30
27
|
relationships: {
|
|
@@ -9,7 +9,8 @@ describe('Recurring Payment Queries', () => {
|
|
|
9
9
|
|
|
10
10
|
expect(query.toRetrieveRequest()).toEqual({
|
|
11
11
|
collection: 'defra_recurringpayments',
|
|
12
|
-
filter:
|
|
12
|
+
filter:
|
|
13
|
+
"defra_nextduedate eq 'Wed Nov 08 2023 00:00:00 GMT+0000 (Greenwich Mean Time)' and defra_cancelleddate eq null and _defra_nextrecurringpayment_value eq null and statecode eq 0",
|
|
13
14
|
select: [
|
|
14
15
|
'defra_recurringpaymentid',
|
|
15
16
|
'defra_name',
|
|
@@ -19,10 +20,7 @@ describe('Recurring Payment Queries', () => {
|
|
|
19
20
|
'defra_cancelledreason',
|
|
20
21
|
'defra_enddate',
|
|
21
22
|
'defra_agreementid',
|
|
22
|
-
'_defra_activepermission_value',
|
|
23
|
-
'_defra_contact_value',
|
|
24
23
|
'defra_publicid',
|
|
25
|
-
'_defra_nextrecurringpayment_value',
|
|
26
24
|
'defra_lastdigitscardnumbers'
|
|
27
25
|
],
|
|
28
26
|
expand: [{ property: 'defra_Contact' }, { property: 'defra_ActivePermission' }]
|
|
@@ -38,7 +36,7 @@ describe('Recurring Payment Queries', () => {
|
|
|
38
36
|
|
|
39
37
|
expect(query.toRetrieveRequest()).toEqual({
|
|
40
38
|
collection: 'defra_recurringpayments',
|
|
41
|
-
filter: `defra_agreementid eq '${agreementId}'`,
|
|
39
|
+
filter: `defra_agreementid eq '${agreementId}' and statecode eq 0`,
|
|
42
40
|
select: [
|
|
43
41
|
'defra_recurringpaymentid',
|
|
44
42
|
'defra_name',
|
|
@@ -48,10 +46,7 @@ describe('Recurring Payment Queries', () => {
|
|
|
48
46
|
'defra_cancelledreason',
|
|
49
47
|
'defra_enddate',
|
|
50
48
|
'defra_agreementid',
|
|
51
|
-
'_defra_activepermission_value',
|
|
52
|
-
'_defra_contact_value',
|
|
53
49
|
'defra_publicid',
|
|
54
|
-
'_defra_nextrecurringpayment_value',
|
|
55
50
|
'defra_lastdigitscardnumbers'
|
|
56
51
|
]
|
|
57
52
|
})
|
|
@@ -10,14 +10,21 @@ import { PredefinedQuery } from './predefined-query.js'
|
|
|
10
10
|
export const findDueRecurringPayments = date => {
|
|
11
11
|
const { contact, activePermission } = RecurringPayment.definition.relationships
|
|
12
12
|
|
|
13
|
-
const
|
|
13
|
+
const filters = []
|
|
14
|
+
|
|
15
|
+
filters.push(`defra_nextduedate eq '${date}'`)
|
|
16
|
+
filters.push('defra_cancelleddate eq null')
|
|
17
|
+
filters.push('_defra_nextrecurringpayment_value eq null')
|
|
18
|
+
|
|
19
|
+
filters.push(RecurringPayment.definition.defaultFilter)
|
|
14
20
|
|
|
15
21
|
return new PredefinedQuery({
|
|
16
22
|
root: RecurringPayment,
|
|
17
|
-
filter:
|
|
23
|
+
filter: filters.join(' and '),
|
|
18
24
|
expand: [contact, activePermission]
|
|
19
25
|
})
|
|
20
26
|
}
|
|
27
|
+
|
|
21
28
|
/**
|
|
22
29
|
* Builds a query to retrieve recurring payments by agreementId
|
|
23
30
|
*
|
|
@@ -25,10 +32,13 @@ export const findDueRecurringPayments = date => {
|
|
|
25
32
|
* @returns {PredefinedQuery}
|
|
26
33
|
*/
|
|
27
34
|
export const findRecurringPaymentsByAgreementId = agreementId => {
|
|
28
|
-
const
|
|
35
|
+
const filters = []
|
|
36
|
+
|
|
37
|
+
filters.push(`defra_agreementid eq '${agreementId}'`)
|
|
38
|
+
filters.push(RecurringPayment.definition.defaultFilter)
|
|
29
39
|
|
|
30
40
|
return new PredefinedQuery({
|
|
31
41
|
root: RecurringPayment,
|
|
32
|
-
filter:
|
|
42
|
+
filter: filters.join(' and ')
|
|
33
43
|
})
|
|
34
44
|
}
|