From 47e441492f178ec8790019d6e0ee4f88f2cc0a13 Mon Sep 17 00:00:00 2001 From: Rebecca Ransome Date: Wed, 23 Oct 2024 11:54:33 +0100 Subject: [PATCH 1/2] Fix testing endpoint for supplementary flags Recently a PR was raised to create a testing endpoint for the process of flagging a licence for supplementary billing during the import service. This looks at the licence end dates and works out what if any flags should be added to the licence. During testing the feature wasn't working as expected. After some investigation, it turns out that the testing endpoint wasn't confured correctly. When the arguments are passed in the body of the request it converts everything to String. This means the data we are mocking is in a String data type and not a Date data type, which it would be during the actual import. This PR fixed the object before being passed to the supplementary flagging process. From 10587138583d1ce30efea60c21047ff1588f2f6f Mon Sep 17 00:00:00 2001 From: Rebecca Ransome Date: Wed, 23 Oct 2024 12:00:01 +0100 Subject: [PATCH 2/2] Fix: Object data types --- app/controllers/check.controller.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/check.controller.js b/app/controllers/check.controller.js index f168a7914e..0b14af4bb4 100644 --- a/app/controllers/check.controller.js +++ b/app/controllers/check.controller.js @@ -26,9 +26,9 @@ async function flagForBilling (request, h) { const { licenceId, expiredDate, lapsedDate, revokedDate } = request.payload const transformedLicence = { - expiredDate, - lapsedDate, - revokedDate + expiredDate: expiredDate ? new Date(expiredDate) : null, + lapsedDate: lapsedDate ? new Date(lapsedDate) : null, + revokedDate: revokedDate ? new Date(revokedDate) : null } await DetermineSupplementaryBillingFlagsService.go(transformedLicence, licenceId)