Skip to content

Commit

Permalink
Merge pull request #1522 from alphagov/auth-1366-tidy-up
Browse files Browse the repository at this point in the history
AUTH-1366 - Remove support links as these are no longer used
  • Loading branch information
JHjava authored Mar 11, 2022
2 parents 3e055ca + b7ab56c commit 71fe333
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 78 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,6 @@ public Void handleRequest(SQSEvent event, Context context) {
emailUpdatePersonalisation.put(
"contact-us-link",
buildContactUsUrl("emailAddressUpdatedEmail"));
emailUpdatePersonalisation.put(
"customer-support-link",
buildURI(
configurationService.getFrontendBaseUrl(),
configurationService
.getCustomerSupportLinkRoute())
.toString());
LOG.info("Sending EMAIL_UPDATED email using Notify");
notificationService.sendEmail(
notifyRequest.getDestination(),
Expand All @@ -116,13 +109,6 @@ public Void handleRequest(SQSEvent event, Context context) {
Map<String, Object> accountDeletedPersonalisation = new HashMap<>();
accountDeletedPersonalisation.put(
"contact-us-link", buildContactUsUrl("accountDeletedEmail"));
accountDeletedPersonalisation.put(
"customer-support-link",
buildURI(
configurationService.getFrontendBaseUrl(),
configurationService
.getCustomerSupportLinkRoute())
.toString());
notificationService.sendEmail(
notifyRequest.getDestination(),
accountDeletedPersonalisation,
Expand All @@ -136,13 +122,6 @@ public Void handleRequest(SQSEvent event, Context context) {
phoneNumberUpdatedPersonalisation.put(
"contact-us-link",
buildContactUsUrl("phoneNumberUpdatedEmail"));
phoneNumberUpdatedPersonalisation.put(
"customer-support-link",
buildURI(
configurationService.getFrontendBaseUrl(),
configurationService
.getCustomerSupportLinkRoute())
.toString());
notificationService.sendEmail(
notifyRequest.getDestination(),
phoneNumberUpdatedPersonalisation,
Expand All @@ -155,13 +134,6 @@ public Void handleRequest(SQSEvent event, Context context) {
Map<String, Object> passwordUpdatedPersonalisation = new HashMap<>();
passwordUpdatedPersonalisation.put(
"contact-us-link", buildContactUsUrl("passwordUpdatedEmail"));
passwordUpdatedPersonalisation.put(
"customer-support-link",
buildURI(
configurationService.getFrontendBaseUrl(),
configurationService
.getCustomerSupportLinkRoute())
.toString());
notificationService.sendEmail(
notifyRequest.getDestination(),
passwordUpdatedPersonalisation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ public class NotificationHandlerTest {
private static final String TEST_PHONE_NUMBER = "01234567890";
private static final String TEMPLATE_ID = "12345667";
private static final String FRONTEND_BASE_URL = "https://localhost:8080/frontend";
private static final String CUSTOMER_SUPPORT_LINK_URL =
"https://localhost:8080/frontend/support";
private static final String CUSTOMER_SUPPORT_LINK_ROUTE = "support";
private static final String CONTACT_US_LINK_ROUTE = "contact-us";
private final Context context = mock(Context.class);
private final NotificationService notificationService = mock(NotificationService.class);
Expand All @@ -49,7 +46,6 @@ public class NotificationHandlerTest {
public void setUp() {
when(configService.getFrontendBaseUrl()).thenReturn(FRONTEND_BASE_URL);
when(configService.getContactUsLinkRoute()).thenReturn(CONTACT_US_LINK_ROUTE);
when(configService.getCustomerSupportLinkRoute()).thenReturn(CUSTOMER_SUPPORT_LINK_ROUTE);
handler = new NotificationHandler(notificationService, configService);
}

Expand Down Expand Up @@ -108,7 +104,6 @@ public void shouldSuccessfullyProcessUpdateEmailMessageFromSQSQueue()

Map<String, Object> personalisation = new HashMap<>();
personalisation.put("email-address", notifyRequest.getDestination());
personalisation.put("customer-support-link", CUSTOMER_SUPPORT_LINK_URL);
personalisation.put("contact-us-link", contactUsLinkUrl);

verify(notificationService).sendEmail(TEST_EMAIL_ADDRESS, personalisation, TEMPLATE_ID);
Expand All @@ -129,7 +124,6 @@ public void shouldSuccessfullyProcessUpdatePasswordMessageFromSQSQueue()
handler.handleRequest(sqsEvent, context);

Map<String, Object> personalisation = new HashMap<>();
personalisation.put("customer-support-link", CUSTOMER_SUPPORT_LINK_URL);
personalisation.put("contact-us-link", contactUsLinkUrl);

verify(notificationService).sendEmail(TEST_EMAIL_ADDRESS, personalisation, TEMPLATE_ID);
Expand All @@ -151,7 +145,6 @@ public void shouldSuccessfullyProcessUpdatePhoneNumberMessageFromSQSQueue()

Map<String, Object> personalisation = new HashMap<>();
personalisation.put("contact-us-link", contactUsLinkUrl);
personalisation.put("customer-support-link", CUSTOMER_SUPPORT_LINK_URL);

verify(notificationService).sendEmail(TEST_EMAIL_ADDRESS, personalisation, TEMPLATE_ID);
}
Expand All @@ -170,7 +163,6 @@ public void shouldSuccessfullyProcessDeleteAccountMessageFromSQSQueue()
handler.handleRequest(sqsEvent, context);

Map<String, Object> personalisation = new HashMap<>();
personalisation.put("customer-support-link", CUSTOMER_SUPPORT_LINK_URL);
personalisation.put("contact-us-link", contactUsLinkUrl);

verify(notificationService).sendEmail(TEST_EMAIL_ADDRESS, personalisation, TEMPLATE_ID);
Expand Down
9 changes: 4 additions & 5 deletions ci/terraform/account-management/sqs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,10 @@ resource "aws_lambda_function" "email_sqs_lambda" {
}
environment {
variables = merge(var.notify_template_map, {
FRONTEND_BASE_URL = module.dns.frontend_url
CUSTOMER_SUPPORT_LINK_ROUTE = var.customer_support_link_route
CONTACT_US_LINK_ROUTE = var.contact_us_link_route
NOTIFY_API_KEY = var.notify_api_key
NOTIFY_URL = var.notify_url
FRONTEND_BASE_URL = module.dns.frontend_url
CONTACT_US_LINK_ROUTE = var.contact_us_link_route
NOTIFY_API_KEY = var.notify_api_key
NOTIFY_URL = var.notify_url
})
}
kms_key_arn = data.terraform_remote_state.shared.outputs.lambda_env_vars_encryption_kms_key_arn
Expand Down
5 changes: 0 additions & 5 deletions ci/terraform/account-management/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,6 @@ variable "lambda_min_concurrency" {
description = "The number of lambda instance to keep 'warm'"
}

variable "customer_support_link_route" {
type = string
default = "support"
}

variable "contact_us_link_route" {
type = string
default = "contact-us"
Expand Down
17 changes: 8 additions & 9 deletions ci/terraform/oidc/sqs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,14 @@ resource "aws_lambda_function" "email_sqs_lambda" {
}
environment {
variables = merge(var.notify_template_map, {
FRONTEND_BASE_URL = module.dns.frontend_url
ACCOUNT_MANAGEMENT_URI = module.dns.account_management_url
RESET_PASSWORD_ROUTE = var.reset_password_route
CUSTOMER_SUPPORT_LINK_ROUTE = var.customer_support_link_route
CONTACT_US_LINK_ROUTE = var.contact_us_link_route
NOTIFY_API_KEY = var.notify_api_key
NOTIFY_URL = var.notify_url
NOTIFY_TEST_PHONE_NUMBER = var.notify_test_phone_number
SMOKETEST_SMS_BUCKET_NAME = local.sms_bucket_name
FRONTEND_BASE_URL = module.dns.frontend_url
ACCOUNT_MANAGEMENT_URI = module.dns.account_management_url
RESET_PASSWORD_ROUTE = var.reset_password_route
CONTACT_US_LINK_ROUTE = var.contact_us_link_route
NOTIFY_API_KEY = var.notify_api_key
NOTIFY_URL = var.notify_url
NOTIFY_TEST_PHONE_NUMBER = var.notify_test_phone_number
SMOKETEST_SMS_BUCKET_NAME = local.sms_bucket_name
})
}
kms_key_arn = local.lambda_env_vars_encryption_kms_key_arn
Expand Down
5 changes: 0 additions & 5 deletions ci/terraform/oidc/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,6 @@ variable "blocked_email_duration" {
default = 900
}

variable "customer_support_link_route" {
type = string
default = "support"
}

variable "contact_us_link_route" {
type = string
default = "contact-us"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@ public Void handleRequest(SQSEvent event, Context context) {
case PASSWORD_RESET_CONFIRMATION:
Map<String, Object> passwordResetConfirmationPersonalisation =
new HashMap<>();
passwordResetConfirmationPersonalisation.put(
"customer-support-link", buildCustomerSupportUrl());
passwordResetConfirmationPersonalisation.put(
"contact-us-link",
buildContactUsUrl("passwordResetConfirmationEmail"));
Expand Down Expand Up @@ -152,13 +150,6 @@ public Void handleRequest(SQSEvent event, Context context) {
return null;
}

private String buildCustomerSupportUrl() {
return buildURI(
configurationService.getFrontendBaseUrl(),
configurationService.getCustomerSupportLinkRoute())
.toString();
}

private String buildContactUsUrl(String referer) {
var queryParam = Map.of("referer", referer);
return buildURI(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ public class NotificationHandlerTest {
private static final String TEST_RESET_PASSWORD_LINK =
"https://localhost:8080/frontend?reset-password?code=123456.54353464565";
private static final String FRONTEND_BASE_URL = "https://localhost:8080/frontend";
private static final String CUSTOMER_SUPPORT_LINK_URL =
"https://localhost:8080/frontend/support";
private static final String CUSTOMER_SUPPORT_LINK_ROUTE = "support";
private static final String CONTACT_US_LINK_ROUTE = "contact-us";
private final Context context = mock(Context.class);
private final NotificationService notificationService = mock(NotificationService.class);
Expand All @@ -56,7 +53,6 @@ void setUp() {
when(configService.getNotifyTestPhoneNumber()).thenReturn(Optional.of(NOTIFY_PHONE_NUMBER));
when(configService.getSmoketestBucketName()).thenReturn(BUCKET_NAME);
when(configService.getFrontendBaseUrl()).thenReturn(FRONTEND_BASE_URL);
when(configService.getCustomerSupportLinkRoute()).thenReturn(CUSTOMER_SUPPORT_LINK_ROUTE);
when(configService.getContactUsLinkRoute()).thenReturn(CONTACT_US_LINK_ROUTE);
handler = new NotificationHandler(notificationService, configService, s3Client);
}
Expand Down Expand Up @@ -94,7 +90,6 @@ void shouldSuccessfullyProcessResetPasswordConfirmationFromSQSQueue()
handler.handleRequest(sqsEvent, context);

Map<String, Object> personalisation = new HashMap<>();
personalisation.put("customer-support-link", CUSTOMER_SUPPORT_LINK_URL);
personalisation.put("contact-us-link", contactUsLinkUrl);

verify(notificationService)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ public String getContactUsLinkRoute() {
return System.getenv().getOrDefault("CONTACT_US_LINK_ROUTE", "");
}

public String getCustomerSupportLinkRoute() {
return System.getenv().getOrDefault("CUSTOMER_SUPPORT_LINK_ROUTE", "");
}

public int getMaxPasswordRetries() {
return Integer.parseInt(System.getenv().getOrDefault("PASSWORD_MAX_RETRIES", "5"));
}
Expand Down

0 comments on commit 71fe333

Please sign in to comment.