From ef0bba6c3ff841365ae2e7a31e922fbde2ac5503 Mon Sep 17 00:00:00 2001 From: Kjetil Valle Date: Fri, 4 Sep 2026 10:22:22 +0200 Subject: [PATCH] Add 'always-send' field to SmsNotification When activated, the notifiation will not be cancelled when the recipient reads the the message before the scheduled notification time. The notification will also be sent regardless of whether the recipient has allowed receipt of such notifications. --- .../representations/SmsNotification.java | 36 +++++++++++++++++-- src/main/resources/xsd/api_v8.xsd | 17 +++++++-- 2 files changed, 48 insertions(+), 5 deletions(-) diff --git a/src/main/java/no/digipost/api/client/representations/SmsNotification.java b/src/main/java/no/digipost/api/client/representations/SmsNotification.java index e8b6e51d..d08b02cc 100644 --- a/src/main/java/no/digipost/api/client/representations/SmsNotification.java +++ b/src/main/java/no/digipost/api/client/representations/SmsNotification.java @@ -28,6 +28,7 @@ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "sms-notification", propOrder = { "overrides", + "alwaysSend", "ats", "afterHours" }) @@ -35,6 +36,8 @@ public class SmsNotification { @XmlElement(name = "overrides") public final SmsOverrides overrides; + @XmlElement(name = "always-send") + public final boolean alwaysSend; @XmlElement(name = "at", nillable = false) public final List ats; @XmlElement(name = "after-hours", type = Integer.class, nillable = false) @@ -49,7 +52,19 @@ public SmsNotification(int afterHours) { } public SmsNotification(List ats, List afterHours) { - this(ats, afterHours, null); + this(ats, afterHours, false); + } + + /** + * This constructor requires that the sender is allowed to override the + * recipient's reservation against receiving sender-initiated SMS + * notifications from Digipost. If {@code alwaysSend} is {@code true}, the + * notification will also be sent even if the recipient has already read + * the message before the scheduled notification time, skipping the + * cancellation that would otherwise happen. + */ + public SmsNotification(List ats, List afterHours, boolean alwaysSend) { + this(ats, afterHours, null, alwaysSend); } /** @@ -57,13 +72,28 @@ public SmsNotification(List ats, List afterHours) { * preferences with {@link SmsOverrides}. */ public SmsNotification(List ats, SmsOverrides overrides) { - this(ats, null, overrides); + this(ats, null, overrides, false); + } + + /** + * This constructor requires that the sender is allowed to override SMS + * preferences with {@link SmsOverrides}, and, if {@code alwaysSend} + * is {@code true}, that the sender is allowed to override the recipient's + * reservation against receiving sender-initiated SMS notifications from + * Digipost. If {@code alwaysSend} is {@code true}, the notification will + * also be sent even if the recipient has already read the message before + * the scheduled notification time, skipping the cancellation that would + * otherwise happen. + */ + public SmsNotification(List ats, SmsOverrides overrides, boolean alwaysSend) { + this(ats, null, overrides, alwaysSend); } - private SmsNotification(List ats, List afterHours, SmsOverrides overrides) { + private SmsNotification(List ats, List afterHours, SmsOverrides overrides, boolean alwaysSend) { this.ats = ats != null ? new ArrayList<>(ats) : new ArrayList(); this.afterHours = afterHours != null ? new ArrayList<>(afterHours) : new ArrayList(); this.overrides = overrides; + this.alwaysSend = alwaysSend; } } diff --git a/src/main/resources/xsd/api_v8.xsd b/src/main/resources/xsd/api_v8.xsd index c499b674..782a5e95 100644 --- a/src/main/resources/xsd/api_v8.xsd +++ b/src/main/resources/xsd/api_v8.xsd @@ -782,10 +782,23 @@ + + + + If true, the SMS notification will be sent even if the recipient has reserved + themselves against receiving sender-initiated SMS notifications from Digipost. + It will also be sent even if the recipient has already read the message before + the scheduled notification time - normally a pending notification is cancelled + as soon as the message is read, but that cancellation is skipped when this is set. + Requires special permission for the sending organisation - using this while not + being permitted to will result in an error response. + + + - If the message is unread, a notification will be sent at these times. + If the message is unread (or always-send is activated), a notification will be sent at these times. SMS is only sent between 9-20. Any notification falling outside this interval, will be sent around 9 the next morning. @@ -793,7 +806,7 @@ - If the message is unread, a notification will be sent after the given amount of hours after delivery. + If the message is unread (or always-send is activated), a notification will be sent after the given amount of hours after delivery. SMS is only sent between 9-20. Any notification falling outside this interval, will be sent around 9 the next morning.