@defra-fish/dynamics-lib 1.61.0-rc.0 → 1.61.0-rc.2
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.2",
|
|
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": "4a762cba2fbe794d581e4f6c05af93016b6d8728"
|
|
47
47
|
}
|
|
@@ -16,6 +16,7 @@ describe('recurring payment entity', () => {
|
|
|
16
16
|
recurringPayment.endDate = '2019-12-15T00:00:00Z'
|
|
17
17
|
recurringPayment.agreementId = 'c9267c6e-573d-488b-99ab-ea18431fc472'
|
|
18
18
|
recurringPayment.publicId = '649-213'
|
|
19
|
+
recurringPayment.lastDigitsCardNumbers = '1234'
|
|
19
20
|
recurringPayment.status = 1
|
|
20
21
|
|
|
21
22
|
recurringPayment.bindToEntity(RecurringPayment.definition.relationships.contact, contact)
|
|
@@ -38,6 +39,7 @@ describe('recurring payment entity', () => {
|
|
|
38
39
|
defra_enddate: '2019-12-15T00:00:00Z',
|
|
39
40
|
defra_agreementid: 'c9267c6e-573d-488b-99ab-ea18431fc472',
|
|
40
41
|
defra_publicid: '649-213',
|
|
42
|
+
defra_lastdigitscardnumbers: '1234',
|
|
41
43
|
statecode: 1,
|
|
42
44
|
_defra_contact_value: 'b3d33cln-2e83-ea11-a811-000d3a649213',
|
|
43
45
|
_defra_activepermission_value: 'a5b24adf-2e83-ea11-a811-000d3a649213',
|
|
@@ -68,6 +70,7 @@ describe('recurring payment entity', () => {
|
|
|
68
70
|
endDate: '2019-12-15T00:00:00Z',
|
|
69
71
|
agreementId: 'c9267c6e-573d-488b-99ab-ea18431fc472',
|
|
70
72
|
publicId: '649-213',
|
|
73
|
+
lastDigitsCardNumbers: '1234',
|
|
71
74
|
status: 1
|
|
72
75
|
})
|
|
73
76
|
)
|
|
@@ -92,6 +95,7 @@ describe('recurring payment entity', () => {
|
|
|
92
95
|
defra_enddate: '2019-12-15T00:00:00Z',
|
|
93
96
|
defra_agreementid: 'c9267c6e-573d-488b-99ab-ea18431fc472',
|
|
94
97
|
defra_publicid: '649-213',
|
|
98
|
+
defra_lastdigitscardnumbers: '1234',
|
|
95
99
|
statecode: 1,
|
|
96
100
|
'defra_Contact@odata.bind': `$${contact.uniqueContentId}`,
|
|
97
101
|
'defra_ActivePermission@odata.bind': `$${permission.uniqueContentId}`
|
|
@@ -119,6 +123,7 @@ describe('recurring payment entity', () => {
|
|
|
119
123
|
endDate: '2019-12-15T00:00:00Z',
|
|
120
124
|
agreementId: 'c9267c6e-573d-488b-99ab-ea18431fc472',
|
|
121
125
|
publicId: '649-213',
|
|
126
|
+
lastDigitsCardNumbers: '1234',
|
|
122
127
|
status: 1
|
|
123
128
|
})
|
|
124
129
|
)
|
|
@@ -138,6 +143,7 @@ describe('recurring payment entity', () => {
|
|
|
138
143
|
defra_enddate: '2019-12-15T00:00:00Z',
|
|
139
144
|
defra_agreementid: 'c9267c6e-573d-488b-99ab-ea18431fc472',
|
|
140
145
|
defra_publicid: '649-213',
|
|
146
|
+
defra_lastdigitscardnumbers: '1234',
|
|
141
147
|
statecode: 1,
|
|
142
148
|
'defra_Contact@odata.bind': `$${contact.uniqueContentId}`,
|
|
143
149
|
'defra_ActivePermission@odata.bind': `$${permission.uniqueContentId}`
|
|
@@ -162,6 +168,7 @@ describe('recurring payment entity', () => {
|
|
|
162
168
|
defra_enddate: '2019-12-15T00:00:00Z',
|
|
163
169
|
defra_agreementid: 'c9267c6e-573d-488b-99ab-ea18431fc472',
|
|
164
170
|
defra_publicid: '649-213',
|
|
171
|
+
defra_lastdigitscardnumbers: '1234',
|
|
165
172
|
statecode: 1,
|
|
166
173
|
'defra_Contact@odata.bind': `$${contact.uniqueContentId}`,
|
|
167
174
|
'defra_ActivePermission@odata.bind': `$${permission.uniqueContentId}`,
|
|
@@ -24,7 +24,8 @@ export class RecurringPayment extends BaseEntity {
|
|
|
24
24
|
activePermission: { field: '_defra_activepermission_value', type: 'string' },
|
|
25
25
|
contactId: { field: '_defra_contact_value', type: 'string' },
|
|
26
26
|
publicId: { field: 'defra_publicid', type: 'string' },
|
|
27
|
-
nextRecurringPayment: { field: '_defra_nextrecurringpayment_value', type: 'string' }
|
|
27
|
+
nextRecurringPayment: { field: '_defra_nextrecurringpayment_value', type: 'string' },
|
|
28
|
+
lastDigitsCardNumbers: { field: 'defra_lastdigitscardnumbers', type: 'string' }
|
|
28
29
|
},
|
|
29
30
|
relationships: {
|
|
30
31
|
contact: { property: 'defra_Contact', entity: Contact, parent: true },
|
|
@@ -136,4 +137,16 @@ export class RecurringPayment extends BaseEntity {
|
|
|
136
137
|
set status (status) {
|
|
137
138
|
super._setState('status', status)
|
|
138
139
|
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Last four digits of card number
|
|
143
|
+
* @type {string}
|
|
144
|
+
*/
|
|
145
|
+
get lastDigitsCardNumbers () {
|
|
146
|
+
return super._getState('lastDigitsCardNumbers')
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
set lastDigitsCardNumbers (lastDigitsCardNumbers) {
|
|
150
|
+
super._setState('lastDigitsCardNumbers', lastDigitsCardNumbers)
|
|
151
|
+
}
|
|
139
152
|
}
|
|
@@ -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', () => {
|
|
@@ -22,10 +22,39 @@ describe('Recurring Payment Queries', () => {
|
|
|
22
22
|
'_defra_activepermission_value',
|
|
23
23
|
'_defra_contact_value',
|
|
24
24
|
'defra_publicid',
|
|
25
|
-
'_defra_nextrecurringpayment_value'
|
|
25
|
+
'_defra_nextrecurringpayment_value',
|
|
26
|
+
'defra_lastdigitscardnumbers'
|
|
26
27
|
],
|
|
27
28
|
expand: [{ property: 'defra_Contact' }, { property: 'defra_ActivePermission' }]
|
|
28
29
|
})
|
|
29
30
|
})
|
|
30
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
|
+
})
|
|
31
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
|
+
}
|