From aaaa750e9e9ab685c32c3df32282977829548e6f Mon Sep 17 00:00:00 2001 From: Stefan Ranoszek Date: Tue, 9 Apr 2024 08:16:04 +0100 Subject: [PATCH] fix:added delay to allow email to be created --- pom.xml | 2 +- src/main/java/activesupport/aws/s3/S3.java | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 832c042..3838c1a 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.dvsa.testing.lib active-support - 2.0.1.7 + 2.0.1.8 https://nexus.olcs.dev-dvsacloud.uk/repository/maven-releases diff --git a/src/main/java/activesupport/aws/s3/S3.java b/src/main/java/activesupport/aws/s3/S3.java index ab39eda..77274b4 100644 --- a/src/main/java/activesupport/aws/s3/S3.java +++ b/src/main/java/activesupport/aws/s3/S3.java @@ -92,7 +92,8 @@ public static String getTempPassword(@NotNull String emailAddress, @NotNull Stri } - public static String getGovSignInCode(String sesBucketName, String sesBucketPath) throws MissingRequiredArgument { + public static String getGovSignInCode(String sesBucketName, String sesBucketPath) throws MissingRequiredArgument, InterruptedException { + TimeUnit.SECONDS.sleep(10L); String lastModified = listObjectsByLastModified(sesBucketName, sesBucketPath); if (client().doesObjectExist(sesBucketName, lastModified)) { S3Object s3Object = client().getObject(sesBucketName, lastModified); @@ -102,7 +103,7 @@ public static String getGovSignInCode(String sesBucketName, String sesBucketPath } } - public static String getSignInCode() { + public static String getSignInCode() throws InterruptedException { return getGovSignInCode(sesBucketName, sesBucketPath); } @@ -158,6 +159,15 @@ public static String getUsernameInfoLink(@NotNull String emailAddress) throws Mi return extractUsernameFromS3Object(s3Object); } + public static String getForgottenUsernameInfoLink(@NotNull String emailAddress) throws MissingRequiredArgument { + String S3ObjectName = Util.s3RetrieveObject(emailAddress, "__Your_account_information"); + String stringCap = S3ObjectName.substring(0, Math.min(S3ObjectName.length(), 100)); + String s3Path = Util.s3Path(stringCap); + S3Object s3Object = getS3Object(s3BucketName, s3Path); + return extractUsernameFromS3Object(s3Object); + } + + public static boolean checkLastTMLetterAttachment(@NotNull String emailAddress, String licenceNo) throws MissingRequiredArgument { S3Object emailObject = getTMLastLetterEmail(emailAddress);