@defra-fish/sales-api-service 1.63.0-rc.2 → 1.63.0-rc.4
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.63.0-rc.
|
|
3
|
+
"version": "1.63.0-rc.4",
|
|
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.63.0-rc.
|
|
39
|
-
"@defra-fish/connectors-lib": "1.63.0-rc.
|
|
40
|
-
"@defra-fish/dynamics-lib": "1.63.0-rc.
|
|
38
|
+
"@defra-fish/business-rules-lib": "1.63.0-rc.4",
|
|
39
|
+
"@defra-fish/connectors-lib": "1.63.0-rc.4",
|
|
40
|
+
"@defra-fish/dynamics-lib": "1.63.0-rc.4",
|
|
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": "19c5ac3cf85aa9f3dc5e7ebc0f14cfe88936125c"
|
|
56
56
|
}
|
|
@@ -96,27 +96,45 @@ describe('createTransactionSchema', () => {
|
|
|
96
96
|
await expect(createTransactionSchema.validateAsync(mockPayload)).rejects.toThrow()
|
|
97
97
|
})
|
|
98
98
|
|
|
99
|
-
it('validates successfully when
|
|
99
|
+
it('validates successfully when recurring payment detail is supplied', async () => {
|
|
100
100
|
const mockPayload = mockTransactionPayload()
|
|
101
|
-
mockPayload.
|
|
101
|
+
mockPayload.recurringPayment = {
|
|
102
|
+
agreementId: 't3jl08v2nqqmujrnhs09pmhtjx',
|
|
103
|
+
id: 'fdc73d20-a0bf-4da6-9a49-2f0a24bd3509'
|
|
104
|
+
}
|
|
102
105
|
await expect(createTransactionSchema.validateAsync(mockPayload)).resolves.not.toThrow()
|
|
103
106
|
})
|
|
104
107
|
|
|
105
|
-
it('validates successfully when
|
|
108
|
+
it('validates successfully when recurring payment detail is omitted', async () => {
|
|
106
109
|
const mockPayload = mockTransactionPayload()
|
|
107
110
|
await expect(createTransactionSchema.validateAsync(mockPayload)).resolves.not.toThrow()
|
|
108
111
|
})
|
|
109
112
|
|
|
110
113
|
it.each([
|
|
111
|
-
['
|
|
112
|
-
['
|
|
113
|
-
|
|
114
|
-
['null', null],
|
|
115
|
-
['numeric', 4567]
|
|
116
|
-
])('fails validation when provided with a %s for agreementId', async (_d, agreementId) => {
|
|
114
|
+
['agreement id', { id: 'fdc73d20-a0bf-4da6-9a49-2f0a24bd3509' }],
|
|
115
|
+
['id', { agreementId: 'jhy7u8ii87uyhjui87u89ui8ie' }]
|
|
116
|
+
])('fails validation if %s is omitted from recurring payment detail', async (_d, recurringPayment) => {
|
|
117
117
|
const mockPayload = mockTransactionPayload()
|
|
118
|
-
mockPayload.
|
|
119
|
-
await expect(createTransactionSchema.validateAsync(mockPayload)).rejects.toThrow()
|
|
118
|
+
mockPayload.recurringPayment = recurringPayment
|
|
119
|
+
await expect(() => createTransactionSchema.validateAsync(mockPayload)).rejects.toThrow()
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
it.each([
|
|
123
|
+
['agreement id is too long', { agreementId: 'thisistoolongtobeanagreementid' }],
|
|
124
|
+
['agreement id is too short', { agreementId: 'tooshorttobeanagreementid' }],
|
|
125
|
+
['agreement id contains invalid characters', '!3j@08v2nqqmujrnhs09_mhtjx'],
|
|
126
|
+
['agreement id is null', { agreementId: null }],
|
|
127
|
+
['agreement id is a numeric', { agreementId: 4567 }],
|
|
128
|
+
['id is not a guid', { id: 'not-a-guid' }],
|
|
129
|
+
['id is null', { id: null }]
|
|
130
|
+
])('fails validation if %s', async (_d, recurringPayment) => {
|
|
131
|
+
const mockPayload = mockTransactionPayload()
|
|
132
|
+
mockPayload.recurringPayment = {
|
|
133
|
+
agreementId: 'jhyu78iujhy7u87y6thu87uyj8',
|
|
134
|
+
id: '7a0660ec-8535-4357-b925-e598a9358119',
|
|
135
|
+
...recurringPayment
|
|
136
|
+
}
|
|
137
|
+
await expect(() => createTransactionSchema.validateAsync(mockPayload)).rejects.toThrow()
|
|
120
138
|
})
|
|
121
139
|
})
|
|
122
140
|
|
|
@@ -36,7 +36,10 @@ const createTransactionRequestSchemaContent = {
|
|
|
36
36
|
createdBy: Joi.string().optional(),
|
|
37
37
|
journalId: Joi.string().optional(),
|
|
38
38
|
transactionId: Joi.string().guid({ version: 'uuidv4' }).optional(),
|
|
39
|
-
|
|
39
|
+
recurringPayment: Joi.object({
|
|
40
|
+
agreementId: Joi.string().alphanum().length(AGREEMENT_ID_LENGTH).required(),
|
|
41
|
+
id: Joi.string().guid().required()
|
|
42
|
+
}).optional()
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
/**
|