From 9967c5c44cde03d764c8f4268f36763e969dfde2 Mon Sep 17 00:00:00 2001 From: Akinsola Lawanson <106528085+akinsola-guardian@users.noreply.github.com> Date: Tue, 2 Jul 2024 12:15:11 +0100 Subject: [PATCH] feat: Calling /consent-email to send confirmation email before newsletter subscription This changes the newsletter page to send email confirmation before email signup. Sends a post request to /consent-email instead of /consent-signup. --- .../app/controllers/EmailSignupController.scala | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/common/app/controllers/EmailSignupController.scala b/common/app/controllers/EmailSignupController.scala index 22e7967f6a1b..837d23fa4d89 100644 --- a/common/app/controllers/EmailSignupController.scala +++ b/common/app/controllers/EmailSignupController.scala @@ -78,23 +78,14 @@ class EmailFormService(wsClient: WSClient, emailEmbedAgent: NewsletterSignupAgen .obj( "email" -> form.email, "set-lists" -> form.listNames, + "refViewId" -> form.refViewId, + "ref" -> form.ref, ) .fields, ) - val queryStringParameters = form.ref.map("ref" -> _).toList ++ - form.refViewId.map("refViewId" -> _).toList ++ - form.listNames.map("listName" -> _).toList - - //FIXME: this should go via the identity api client / app - // NOTE - always using the '/consent-signup' (no confirmation email) - // should we be splitting the list into newsletters that require confirmation - // and those that don't, then sending two separate requests? - // Currently, no editorial newsletters require confirmation emails, but the - // feature is still supported. wsClient - .url(s"${Configuration.id.apiRoot}/consent-signup") - .withQueryStringParameters(queryStringParameters: _*) + .url(s"${Configuration.id.apiRoot}/consent-email") .addHttpHeaders(getHeaders(request): _*) .post(consentMailerPayload) }