@defra-fish/sales-api-service 1.57.0-rc.6 → 1.57.0-rc.8
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.57.0-rc.
|
|
3
|
+
"version": "1.57.0-rc.8",
|
|
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.57.0-rc.
|
|
39
|
-
"@defra-fish/connectors-lib": "1.57.0-rc.
|
|
40
|
-
"@defra-fish/dynamics-lib": "1.57.0-rc.
|
|
38
|
+
"@defra-fish/business-rules-lib": "1.57.0-rc.8",
|
|
39
|
+
"@defra-fish/connectors-lib": "1.57.0-rc.8",
|
|
40
|
+
"@defra-fish/dynamics-lib": "1.57.0-rc.8",
|
|
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": "
|
|
55
|
+
"gitHead": "0bec5c50b0ee09c450d0016cf7b5225f00b1556c"
|
|
56
56
|
}
|
|
@@ -326,5 +326,17 @@ describe('recurring payments service', () => {
|
|
|
326
326
|
|
|
327
327
|
expect(() => generateRecurringPaymentRecord(sampleTransaction)).toThrow('Invalid dates provided for permission')
|
|
328
328
|
})
|
|
329
|
+
|
|
330
|
+
it('returns a false flag when agreementId is not present', () => {
|
|
331
|
+
const sampleTransaction = createFinalisedSampleTransaction(null, {
|
|
332
|
+
startDate: '2024-11-22T15:30:45.922Z',
|
|
333
|
+
issueDate: '2024-11-22T15:00:45.922Z',
|
|
334
|
+
endDate: '2025-11-21T23:59:59.999Z'
|
|
335
|
+
})
|
|
336
|
+
|
|
337
|
+
const rpRecord = generateRecurringPaymentRecord(sampleTransaction)
|
|
338
|
+
|
|
339
|
+
expect(rpRecord.payment.recurring).toBeFalsy()
|
|
340
|
+
})
|
|
329
341
|
})
|
|
330
342
|
})
|
|
@@ -20,21 +20,24 @@ const getNextDueDate = (startDate, issueDate, endDate) => {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export const generateRecurringPaymentRecord = (transactionRecord, permission) => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
23
|
+
if (transactionRecord.agreementId) {
|
|
24
|
+
const [{ startDate, issueDate, endDate }] = transactionRecord.permissions
|
|
25
|
+
return {
|
|
26
|
+
payment: {
|
|
27
|
+
recurring: {
|
|
28
|
+
name: '',
|
|
29
|
+
nextDueDate: getNextDueDate(startDate, issueDate, endDate),
|
|
30
|
+
cancelledDate: null,
|
|
31
|
+
cancelledReason: null,
|
|
32
|
+
endDate,
|
|
33
|
+
agreementId: transactionRecord.agreementId,
|
|
34
|
+
status: 1
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
permissions: [permission]
|
|
38
|
+
}
|
|
37
39
|
}
|
|
40
|
+
return { payment: { recurring: false } }
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
/**
|