@defra-fish/dynamics-lib 1.61.0-rc.1 → 1.61.0-rc.10
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.61.0-rc.
|
|
3
|
+
"version": "1.61.0-rc.10",
|
|
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": "
|
|
46
|
+
"gitHead": "27650c5d19c86f1621c7c1367fafb7d090da3d02"
|
|
47
47
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { findDueRecurringPayments } from '../recurring-payments.queries.js'
|
|
1
|
+
import { findDueRecurringPayments, findRecurringPaymentsByAgreementId } from '../recurring-payments.queries.js'
|
|
2
2
|
|
|
3
3
|
describe('Recurring Payment Queries', () => {
|
|
4
4
|
describe('findDueRecurringPayments', () => {
|
|
@@ -29,4 +29,32 @@ describe('Recurring Payment Queries', () => {
|
|
|
29
29
|
})
|
|
30
30
|
})
|
|
31
31
|
})
|
|
32
|
+
|
|
33
|
+
describe('findRecurringPaymentsByAgreementId', () => {
|
|
34
|
+
it('builds a query to retrieve active recurring payments', () => {
|
|
35
|
+
const agreementId = 'abc123'
|
|
36
|
+
|
|
37
|
+
const query = findRecurringPaymentsByAgreementId(agreementId)
|
|
38
|
+
|
|
39
|
+
expect(query.toRetrieveRequest()).toEqual({
|
|
40
|
+
collection: 'defra_recurringpayments',
|
|
41
|
+
filter: `defra_agreementid eq '${agreementId}'`,
|
|
42
|
+
select: [
|
|
43
|
+
'defra_recurringpaymentid',
|
|
44
|
+
'defra_name',
|
|
45
|
+
'statecode',
|
|
46
|
+
'defra_nextduedate',
|
|
47
|
+
'defra_cancelleddate',
|
|
48
|
+
'defra_cancelledreason',
|
|
49
|
+
'defra_enddate',
|
|
50
|
+
'defra_agreementid',
|
|
51
|
+
'_defra_activepermission_value',
|
|
52
|
+
'_defra_contact_value',
|
|
53
|
+
'defra_publicid',
|
|
54
|
+
'_defra_nextrecurringpayment_value',
|
|
55
|
+
'defra_lastdigitscardnumbers'
|
|
56
|
+
]
|
|
57
|
+
})
|
|
58
|
+
})
|
|
59
|
+
})
|
|
32
60
|
})
|
|
@@ -18,3 +18,17 @@ export const findDueRecurringPayments = date => {
|
|
|
18
18
|
expand: [contact, activePermission]
|
|
19
19
|
})
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Builds a query to retrieve recurring payments by agreementId
|
|
23
|
+
*
|
|
24
|
+
* @param agreementId the agreementId assigned by GOV.UK Pay
|
|
25
|
+
* @returns {PredefinedQuery}
|
|
26
|
+
*/
|
|
27
|
+
export const findRecurringPaymentsByAgreementId = agreementId => {
|
|
28
|
+
const filter = `defra_agreementid eq '${agreementId}'`
|
|
29
|
+
|
|
30
|
+
return new PredefinedQuery({
|
|
31
|
+
root: RecurringPayment,
|
|
32
|
+
filter: filter
|
|
33
|
+
})
|
|
34
|
+
}
|