From bfc283614df6bedf2e4acffb5723912c2eac8469 Mon Sep 17 00:00:00 2001 From: acn-sbuad Date: Wed, 14 Feb 2024 12:49:58 +0100 Subject: [PATCH] added new sms status codes --- .../Enums/SmsNotificationResultType.cs | 36 +++++++++++++++++-- .../Services/SmsNotificationSummaryService.cs | 12 +++++-- .../SmsNotificationSummaryServiceTests.cs | 12 +++++-- 3 files changed, 51 insertions(+), 9 deletions(-) diff --git a/src/Altinn.Notifications.Core/Enums/SmsNotificationResultType.cs b/src/Altinn.Notifications.Core/Enums/SmsNotificationResultType.cs index 0d12645e..3f40ff78 100644 --- a/src/Altinn.Notifications.Core/Enums/SmsNotificationResultType.cs +++ b/src/Altinn.Notifications.Core/Enums/SmsNotificationResultType.cs @@ -21,17 +21,47 @@ public enum SmsNotificationResultType Accepted, /// - /// Failed, unknown reason + /// Sms notification was successfully delivered to destination. + /// + Delivered, + + /// + /// Sms notification send operation failed /// Failed, /// - /// Failed, invalid mobilenumber + /// Sms notification send operation failed because the receiver number is barred/blocked/not in use. + /// + Failed_BarredReceiver, + + /// + /// Sms notification send operation failed because the message has been deleted. + /// + Failed_Deleted, + + /// + /// Sms notification send operation failed because the message validity period has expired. + /// + Failed_Expired, + + /// + /// Sms notification send operation failed due to invalid recipient /// Failed_InvalidRecipient, + /// + /// Sms notification send operation failed due to the SMS being undeliverable. + /// + Failed_Undelivered, + /// /// Recipient mobile number was not identified /// - Failed_RecipientNotIdentified + Failed_RecipientNotIdentified, + + /// + /// Message was rejected. + /// + Failed_Rejected } diff --git a/src/Altinn.Notifications.Core/Services/SmsNotificationSummaryService.cs b/src/Altinn.Notifications.Core/Services/SmsNotificationSummaryService.cs index 5b104a77..7a0a50b7 100644 --- a/src/Altinn.Notifications.Core/Services/SmsNotificationSummaryService.cs +++ b/src/Altinn.Notifications.Core/Services/SmsNotificationSummaryService.cs @@ -17,9 +17,15 @@ public class SmsNotificationSummaryService : ISmsNotificationSummaryService { SmsNotificationResultType.New, "The SMS has been created, but has not been picked up for processing yet." }, { SmsNotificationResultType.Sending, "The SMS is being processed and will be attempted sent shortly." }, { SmsNotificationResultType.Accepted, "The SMS has been accepted by the gateway service and will be sent shortly." }, - { SmsNotificationResultType.Failed, "The SMS was not sent due to an unspecified failure." }, - { SmsNotificationResultType.Failed_RecipientNotIdentified, "The SMS was not sent because the recipient's SMS address was not found." }, - { SmsNotificationResultType.Failed_InvalidRecipient, "The SMS was not sent because the recipient number was invalid." } + { SmsNotificationResultType.Delivered, "The SMS was successfully delivered to its destination." }, + { SmsNotificationResultType.Failed, "The SMS was not delivered due to an unspecified failure." }, + { SmsNotificationResultType.Failed_BarredReceiver, "The SMS was not delivered because the recipient's number is barred, blocked or not in use." }, + { SmsNotificationResultType.Failed_Deleted, "The SMS was not delivered because the message has been deleted." }, + { SmsNotificationResultType.Failed_Expired, "The SMS was not delivered because it has expired." }, + { SmsNotificationResultType.Failed_InvalidRecipient, "The SMS was not delivered because the recipient's mobile number was invalid." }, + { SmsNotificationResultType.Failed_Undelivered, "The SMS was not delivered due to invalid number or no available route to destination." }, + { SmsNotificationResultType.Failed_RecipientNotIdentified, "The SMS was not delivered because the recipient's mobile number was not found." }, + { SmsNotificationResultType.Failed_Rejected, "The SMS was not delivered because it was rejected." }, }; private readonly static List _successResults = new() diff --git a/test/Altinn.Notifications.Tests/Notifications.Core/TestingServices/SmsNotificationSummaryServiceTests.cs b/test/Altinn.Notifications.Tests/Notifications.Core/TestingServices/SmsNotificationSummaryServiceTests.cs index 62337c0d..9307f449 100644 --- a/test/Altinn.Notifications.Tests/Notifications.Core/TestingServices/SmsNotificationSummaryServiceTests.cs +++ b/test/Altinn.Notifications.Tests/Notifications.Core/TestingServices/SmsNotificationSummaryServiceTests.cs @@ -32,9 +32,15 @@ public void IsSuccessResult_CheckResultForAllEnums(SmsNotificationResultType res [InlineData(SmsNotificationResultType.New, "The SMS has been created, but has not been picked up for processing yet.")] [InlineData(SmsNotificationResultType.Sending, "The SMS is being processed and will be attempted sent shortly.")] [InlineData(SmsNotificationResultType.Accepted, "The SMS has been accepted by the gateway service and will be sent shortly.")] - [InlineData(SmsNotificationResultType.Failed, "The SMS was not sent due to an unspecified failure.")] - [InlineData(SmsNotificationResultType.Failed_RecipientNotIdentified, "The SMS was not sent because the recipient's SMS address was not found.")] - [InlineData(SmsNotificationResultType.Failed_InvalidRecipient, "The SMS was not sent because the recipient number was invalid.")] + [InlineData(SmsNotificationResultType.Delivered, "The SMS was successfully delivered to its destination.")] + [InlineData(SmsNotificationResultType.Failed, "The SMS was not delivered due to an unspecified failure.")] + [InlineData(SmsNotificationResultType.Failed_BarredReceiver, "The SMS was not delivered because the recipient's number is barred, blocked or not in use.")] + [InlineData(SmsNotificationResultType.Failed_Deleted, "The SMS was not delivered because the message has been deleted.")] + [InlineData(SmsNotificationResultType.Failed_Expired, "The SMS was not delivered because it has expired.")] + [InlineData(SmsNotificationResultType.Failed_InvalidRecipient, "The SMS was not delivered because the recipient's mobile number was invalid.")] + [InlineData(SmsNotificationResultType.Failed_Undelivered, "The SMS was not delivered due to invalid number or no available route to destination.")] + [InlineData(SmsNotificationResultType.Failed_RecipientNotIdentified, "The SMS was not delivered because the recipient's mobile number was not found.")] + [InlineData(SmsNotificationResultType.Failed_Rejected, "The SMS was not delivered because it was rejected.")] public void GetResultDescription_ExpectedDescription(SmsNotificationResultType result, string expected) { string actual = SmsNotificationSummaryService.GetResultDescription(result);