-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not update the SMS order based on the gateway reference. (#707)
* Code refactoring Do not update the SMS order based on the gateway reference. * Remove the nullable operator and one test * Code refactoring * Enhance naming conventions and documentation to more accurately convey their intended purpose. * Remove an old test * Add a test to verify that an exception is throw if the identifier of the SMS is invalid * Check the IDs before deleting them * Improve the XML documentation. * Remove an unused directive and improve documentation. * Improve the documentation * Code refactoring * Increase test coverage * Code refactoring * Improve the unit tests to test a JSON string that results in a non-null outcome but with an empty Id and a null or empty GatewayReference. * Improving the documentation * Improve documentation * Remove two nullable directives. * Use lowerCamelCase * Do not count on the gateway reference * Rewrite unit tests. * Copy back two tests * Remove unused directive and update NuGet packages
- Loading branch information
1 parent
c48c2bd
commit 21506bc
Showing
19 changed files
with
374 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 14 additions & 14 deletions
28
src/Altinn.Notifications.Core/Enums/SmsNotificationResultType.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,72 @@ | ||
namespace Altinn.Notifications.Core.Enums; | ||
|
||
/// <summary> | ||
/// Enum describing sms notification result types | ||
/// Enum representing the result types for SMS notifications. | ||
/// </summary> | ||
public enum SmsNotificationResultType | ||
{ | ||
/// <summary> | ||
/// Default result for new notifications | ||
/// Indicates a new SMS notification. | ||
/// </summary> | ||
New, | ||
|
||
/// <summary> | ||
/// Sms notification being sent | ||
/// Indicates that the SMS is currently being sent. | ||
/// </summary> | ||
Sending, | ||
|
||
/// <summary> | ||
/// Sms notification sent to service provider | ||
/// Indicates that the SMS has been sent to the service provider. | ||
/// </summary> | ||
Accepted, | ||
|
||
/// <summary> | ||
/// Sms notification was successfully delivered to destination. | ||
/// Indicates that the SMS was successfully delivered to the recipient. | ||
/// </summary> | ||
Delivered, | ||
|
||
/// <summary> | ||
/// Sms notification send operation failed | ||
/// Indicates that the SMS send operation failed. | ||
/// </summary> | ||
Failed, | ||
|
||
/// <summary> | ||
/// Sms notification send operation failed due to invalid recipient | ||
/// Indicates that the SMS send operation failed due to an invalid recipient. | ||
/// </summary> | ||
Failed_InvalidRecipient, | ||
|
||
/// <summary> | ||
/// Failed, recipient is reserved in KRR | ||
/// Indicates that the SMS send operation failed because the recipient is reserved due to the contact and reservation register (KRR). | ||
/// </summary> | ||
Failed_RecipientReserved, | ||
|
||
/// <summary> | ||
/// Sms notification send operation failed because the receiver number is barred/blocked/not in use. | ||
/// Indicates that the SMS send operation failed because the recipient's number is barred, blocked, or not in use. | ||
/// </summary> | ||
Failed_BarredReceiver, | ||
|
||
/// <summary> | ||
/// Sms notification send operation failed because the message has been deleted. | ||
/// Indicates that the SMS send operation failed because the message has been deleted. | ||
/// </summary> | ||
Failed_Deleted, | ||
|
||
/// <summary> | ||
/// Sms notification send operation failed because the message validity period has expired. | ||
/// Indicates that the SMS send operation failed because the message validity period has expired. | ||
/// </summary> | ||
Failed_Expired, | ||
|
||
/// <summary> | ||
/// Sms notification send operation failed due to the SMS being undeliverable. | ||
/// Indicates that the SMS send operation failed because the SMS was undeliverable. | ||
/// </summary> | ||
Failed_Undelivered, | ||
|
||
/// <summary> | ||
/// Recipient mobile number was not identified | ||
/// Indicates that the SMS send operation failed because the recipient's mobile number was not identified. | ||
/// </summary> | ||
Failed_RecipientNotIdentified, | ||
|
||
/// <summary> | ||
/// Message was rejected. | ||
/// Indicates that the SMS send operation failed because the message was rejected. | ||
/// </summary> | ||
Failed_Rejected | ||
} |
27 changes: 13 additions & 14 deletions
27
src/Altinn.Notifications.Core/Models/Notification/INotification.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,36 @@ | ||
using System; | ||
|
||
using Altinn.Notifications.Core.Enums; | ||
using Altinn.Notifications.Core.Enums; | ||
|
||
namespace Altinn.Notifications.Core.Models.Notification; | ||
|
||
/// <summary> | ||
/// Interface describing a base notification. | ||
/// Defines the contract for a base notification. | ||
/// </summary> | ||
/// <typeparam name="TEnum">The type of the enumeration used to represent the notification status.</typeparam> | ||
public interface INotification<TEnum> | ||
where TEnum : struct, Enum | ||
{ | ||
/// <summary> | ||
/// Gets the id of the notification. | ||
/// Gets the unique identifier of the notification. | ||
/// </summary> | ||
public Guid Id { get; } | ||
Guid Id { get; } | ||
|
||
/// <summary> | ||
/// Gets the order id of the notification. | ||
/// Gets the unique identifier of the order associated with this notification. | ||
/// </summary> | ||
public Guid OrderId { get; } | ||
Guid OrderId { get; } | ||
|
||
/// <summary> | ||
/// Gets the requested send time of the notification. | ||
/// Gets the date and time when the notification is requested to be sent. | ||
/// </summary> | ||
public DateTime RequestedSendTime { get; } | ||
DateTime RequestedSendTime { get; } | ||
|
||
/// <summary> | ||
/// Gets the notifiction channel for the notification. | ||
/// Gets the communication channel through which the notification will be sent. | ||
/// </summary> | ||
public NotificationChannel NotificationChannel { get; } | ||
NotificationChannel NotificationChannel { get; } | ||
|
||
/// <summary> | ||
/// Gets the send result of the notification. | ||
/// Gets the result of the notification send operation. | ||
/// </summary> | ||
public NotificationResult<TEnum> SendResult { get; } | ||
NotificationResult<TEnum> SendResult { get; } | ||
} |
30 changes: 17 additions & 13 deletions
30
src/Altinn.Notifications.Core/Models/Notification/NotificationResult.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,44 @@ | ||
namespace Altinn.Notifications.Core.Models.Notification; | ||
|
||
/// <summary> | ||
/// A class represednting a notification result | ||
/// Represents the result of the notification send operation. | ||
/// </summary> | ||
/// <typeparam name="TEnum">The type of the enumeration used to represent the notification send status.</typeparam> | ||
public class NotificationResult<TEnum> | ||
where TEnum : struct, Enum | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="NotificationResult{TEnum}"/> class. | ||
/// </summary> | ||
/// <param name="result">The result of the notification send operation.</param> | ||
/// <param name="resultTime">The date and time when the result was set.</param> | ||
public NotificationResult(TEnum result, DateTime resultTime) | ||
{ | ||
ResultTime = resultTime; | ||
Result = result; | ||
ResultTime = resultTime; | ||
} | ||
|
||
/// <summary> | ||
/// Sets the result description | ||
/// </summary> | ||
public void SetResultDescription(string? description) | ||
{ | ||
ResultDescription = description; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the date and time for when the last result was set. | ||
/// Gets the date and time when the result was set. | ||
/// </summary> | ||
public DateTime ResultTime { get; } | ||
|
||
/// <summary> | ||
/// Gets the send result of the notification | ||
/// Gets the result of the notification send operation. | ||
/// </summary> | ||
public TEnum Result { get; } | ||
|
||
/// <summary> | ||
/// Gets the description of the send result | ||
/// Gets the description of the send result. | ||
/// </summary> | ||
public string? ResultDescription { get; private set; } | ||
|
||
/// <summary> | ||
/// Sets the description of the send result. | ||
/// </summary> | ||
/// <param name="description">The description of the send result.</param> | ||
public void SetResultDescription(string? description) | ||
{ | ||
ResultDescription = description; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.