@defra-fish/gafl-webapp-service 1.57.0-rc.1 → 1.57.0-rc.3
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/gafl-webapp-service",
|
|
3
|
-
"version": "1.57.0-rc.
|
|
3
|
+
"version": "1.57.0-rc.3",
|
|
4
4
|
"description": "The websales frontend for the GAFL service",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"prepare": "gulp --gulpfile build/gulpfile.cjs"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@defra-fish/business-rules-lib": "1.57.0-rc.
|
|
40
|
-
"@defra-fish/connectors-lib": "1.57.0-rc.
|
|
39
|
+
"@defra-fish/business-rules-lib": "1.57.0-rc.3",
|
|
40
|
+
"@defra-fish/connectors-lib": "1.57.0-rc.3",
|
|
41
41
|
"@defra/hapi-gapi": "^2.0.0",
|
|
42
42
|
"@hapi/boom": "^9.1.2",
|
|
43
43
|
"@hapi/catbox-redis": "^6.0.2",
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"./gafl-jest-matchers.js"
|
|
81
81
|
]
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "fffcc3f47679cac0fef84e3220a1111e4a209b2f"
|
|
84
84
|
}
|
|
@@ -309,7 +309,7 @@ describe('The govuk-pay-service', () => {
|
|
|
309
309
|
ok: true,
|
|
310
310
|
json: jest.fn().mockResolvedValue({ success: true, paymentId: 'abc123' })
|
|
311
311
|
}
|
|
312
|
-
govUkPayApi.
|
|
312
|
+
govUkPayApi.createRecurringPaymentAgreement.mockResolvedValue(mockResponse)
|
|
313
313
|
const unique = Symbol('payload')
|
|
314
314
|
const payload = {
|
|
315
315
|
reference: 'd81f1a2b-6508-468f-8342-b6770f60f7cd',
|
|
@@ -318,7 +318,7 @@ describe('The govuk-pay-service', () => {
|
|
|
318
318
|
unique
|
|
319
319
|
}
|
|
320
320
|
await sendRecurringPayment(payload)
|
|
321
|
-
expect(govUkPayApi.
|
|
321
|
+
expect(govUkPayApi.createRecurringPaymentAgreement).toHaveBeenCalledWith(payload)
|
|
322
322
|
})
|
|
323
323
|
|
|
324
324
|
it('should return response body when payment creation is successful', async () => {
|
|
@@ -326,7 +326,7 @@ describe('The govuk-pay-service', () => {
|
|
|
326
326
|
ok: true,
|
|
327
327
|
json: jest.fn().mockResolvedValue({ success: true, paymentId: 'abc123' })
|
|
328
328
|
}
|
|
329
|
-
govUkPayApi.
|
|
329
|
+
govUkPayApi.createRecurringPaymentAgreement.mockResolvedValue(mockResponse)
|
|
330
330
|
|
|
331
331
|
const result = await sendRecurringPayment(preparedPayment)
|
|
332
332
|
|
|
@@ -338,7 +338,7 @@ describe('The govuk-pay-service', () => {
|
|
|
338
338
|
ok: true,
|
|
339
339
|
json: jest.fn().mockResolvedValue({ success: true, paymentId: 'abc123' })
|
|
340
340
|
}
|
|
341
|
-
govUkPayApi.
|
|
341
|
+
govUkPayApi.createRecurringPaymentAgreement.mockResolvedValue(mockResponse)
|
|
342
342
|
|
|
343
343
|
await sendRecurringPayment(preparedPayment)
|
|
344
344
|
|
|
@@ -352,7 +352,7 @@ describe('The govuk-pay-service', () => {
|
|
|
352
352
|
json: jest.fn().mockResolvedValue({ message: 'Server error' })
|
|
353
353
|
}
|
|
354
354
|
const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation(() => {})
|
|
355
|
-
govUkPayApi.
|
|
355
|
+
govUkPayApi.createRecurringPaymentAgreement.mockResolvedValue(mockResponse)
|
|
356
356
|
|
|
357
357
|
try {
|
|
358
358
|
await sendRecurringPayment(preparedPayment)
|
|
@@ -370,7 +370,7 @@ describe('The govuk-pay-service', () => {
|
|
|
370
370
|
it('should throw error when API call fails with network issue', async () => {
|
|
371
371
|
const mockError = new Error('Network error')
|
|
372
372
|
const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation(jest.fn())
|
|
373
|
-
govUkPayApi.
|
|
373
|
+
govUkPayApi.createRecurringPaymentAgreement.mockRejectedValue(mockError)
|
|
374
374
|
|
|
375
375
|
try {
|
|
376
376
|
await sendRecurringPayment(preparedPayment)
|
|
@@ -389,7 +389,7 @@ describe('The govuk-pay-service', () => {
|
|
|
389
389
|
json: jest.fn().mockResolvedValue({ message: 'Rate limit exceeded' })
|
|
390
390
|
}
|
|
391
391
|
const consoleErrorSpy = jest.spyOn(console, 'info').mockImplementation(jest.fn())
|
|
392
|
-
govUkPayApi.
|
|
392
|
+
govUkPayApi.createRecurringPaymentAgreement.mockResolvedValue(mockResponse)
|
|
393
393
|
|
|
394
394
|
try {
|
|
395
395
|
await sendRecurringPayment(preparedPayment)
|
|
@@ -404,7 +404,7 @@ describe('The govuk-pay-service', () => {
|
|
|
404
404
|
status: 500,
|
|
405
405
|
json: jest.fn().mockResolvedValue({ message: 'Server error' })
|
|
406
406
|
}
|
|
407
|
-
govUkPayApi.
|
|
407
|
+
govUkPayApi.createRecurringPaymentAgreement.mockResolvedValue(mockResponse)
|
|
408
408
|
|
|
409
409
|
try {
|
|
410
410
|
await sendRecurringPayment(preparedPayment)
|
|
@@ -109,9 +109,9 @@ export const getPaymentStatus = async (paymentId, recurring = false) => {
|
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
const
|
|
112
|
+
const createRecurringPaymentAgreement = async preparedPayment => {
|
|
113
113
|
try {
|
|
114
|
-
return await govUkPayApi.
|
|
114
|
+
return await govUkPayApi.createRecurringPaymentAgreement(preparedPayment)
|
|
115
115
|
} catch (err) {
|
|
116
116
|
/*
|
|
117
117
|
* Potentially errors caught here (unreachable, timeouts) may be retried - set origin on the error to indicate
|
|
@@ -122,7 +122,7 @@ const createRecurringPayment = async preparedPayment => {
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
export const sendRecurringPayment = async preparedPayment => {
|
|
125
|
-
const response = await
|
|
125
|
+
const response = await createRecurringPaymentAgreement(preparedPayment)
|
|
126
126
|
|
|
127
127
|
if (response.ok) {
|
|
128
128
|
const resBody = await response.json()
|