Skip to content

Commit

Permalink
[AC][OPS-13224] CDS nudges (#1212)
Browse files Browse the repository at this point in the history
* [AC][OPS-13224] CDS nudges

* remove unecessary regimes
  • Loading branch information
AndyHWChung authored Jan 21, 2025
1 parent 6919325 commit 843f798
Show file tree
Hide file tree
Showing 16 changed files with 161 additions and 22 deletions.
28 changes: 28 additions & 0 deletions app/preview/TemplateParams.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3556,6 +3556,34 @@ object TemplateParams3 {
"amountInPence" -> "192",
"transactionFeeInPence" -> "100"
),
"cds_ddi_amended_dcs_alert" -> Map(
"recipientName_line1" -> "Joe Smith",
"cds_regime" -> "CDS"
),
"cds_ddi_cancelled_dcs_alert" -> Map(
"recipientName_line1" -> "Joe Smith",
"cds_regime" -> "CDS"
),
"cds_ddi_not_acceptable_dcs_alert" -> Map(
"recipientName_line1" -> "Joe Smith",
"cds_regime" -> "CDS"
),
"cds_ddi_reinstated_dcs_alert" -> Map(
"recipientName_line1" -> "Joe Smith",
"cds_regime" -> "CDS"
),
"cds_ddi_reminder_dcs_alert" -> Map(
"recipientName_line1" -> "Joe Smith",
"cds_regime" -> "CDS"
),
"cds_ddi_setup_dcs_alert" -> Map(
"recipientName_line1" -> "Joe Smith",
"cds_regime" -> "CDS"
),
"cds_ddi_unpaid_dcs_alert" -> Map(
"recipientName_line1" -> "Joe Smith",
"cds_regime" -> "CDS"
),
"sdds_ddi_setup_dcs_alert" -> Map(
"subject" -> "regime Direct Debit Setup",
"recipientName_line1" -> "Joe Smith",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
* Copyright 2023 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice
import CdsDdiTemplateParameters.CdsRegime._

object CdsDdiTemplateParameters {

sealed trait CdsRegime

object CdsRegime {
case object Cds extends CdsRegime

case object Atwd extends CdsRegime

case object Extp extends CdsRegime

case object Exts extends CdsRegime

case object Brvt extends CdsRegime

}

private val regimeKey: String = "cds_regime"

def regime(fromParams: Map[String, Any]): CdsRegime =
fromParams
.get(regimeKey)
.map { value =>
value.toString.toLowerCase match {
case "cds" => Cds
case "atwd" => Atwd
case "extp" => Extp
case "exts" => Exts
case "brvt" => Brvt
case other => sys.error(s"Unknown CDS regime: $other")
}
}
.getOrElse(Cds)

def isDutyDeferment(fromParams: Map[String, Any]): Boolean =
regime(fromParams) match {
case Cds | Atwd => true
case Extp | Exts | Brvt => false
}

def regimeName(fromParams: Map[String, Any]): String =
regime(fromParams) match {
case Cds | Atwd => "HMRC Duty Deferred"
case Extp => "Tobacco Products Duty (TP7)"
case Exts => "Export Tax Shops"
case Brvt => "Beer Duty VAT (EX46)"
}

def `ifYouWantToContinueTo...`(formParams: Map[String, Any]): String =
if (isDutyDeferment(formParams)) "use your duty deferment account" else "pay by Direct Debit"

def `toPayYour...`(formParams: Map[String, Any]): String =
regime(formParams) match {
case Cds | Atwd => "duty deferment account balance"
case Extp => "Tobacco Products Duty return"
case Exts => "Export Tax Shops return"
case Brvt => "Beer Duty VAT return"
}

def ddiSetUpMessage(formParams: Map[String, Any]): String =
if (isDutyDeferment(formParams)) "A Direct Debit is active on your duty deferment account."
else "Your Direct Debit is active."

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
* limitations under the License.
*@

@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.CdsDdiTemplateParameters.regimeName

@(params: Map[String, Any])

@uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.template_main(params, "HMRC Duty Deferred: Direct Debit amended") {
@uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.template_main(params, s"${regimeName(params)}: Direct Debit amended") {
@uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.salutationLine1(params)

<p style="margin: 0 0 30px; font-size: 19px;">Your Direct Debit has been amended.</p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
@(params: Map[String, Any])HMRC Duty Deferred: Direct Debit amended
@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.CdsDdiTemplateParameters.regimeName

@(params: Map[String, Any])@regimeName(params): Direct Debit amended

@uk.gov.hmrc.hmrcemailrenderer.templates.helpers.txt.salutationLine1(params)
Your Direct Debit has been amended.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
* limitations under the License.
*@

@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.CdsDdiTemplateParameters._

@(params: Map[String, Any])

@uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.template_main(params, "HMRC Duty Deferred: Direct Debit cancelled") {
@uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.template_main(params, s"${regimeName(params)}: Direct Debit cancelled") {
@uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.salutationLine1(params)

<p style="margin: 0 0 30px; font-size: 19px;">Your Direct Debit has been cancelled.</p>
Expand All @@ -29,7 +31,7 @@
</ol>

<p style="margin: 0 0 30px; font-size: 19px;">
If you have outstanding charges to pay, you will need to pay them immediately. If you want to continue to use your duty deferment account, you will need to set up a new Direct Debit instruction.
If you have outstanding charges to pay, you will need to pay them immediately. If you want to continue to @{`ifYouWantToContinueTo...`(params)}, you will need to set up a new Direct Debit instruction.
</p>

<p style="margin: 0 0 30px; font-size: 19px;">From HMRC Direct Debit team</p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
@(params: Map[String, Any])HMRC Duty Deferred: Direct Debit cancelled
@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.CdsDdiTemplateParameters._

@(params: Map[String, Any])@regimeName(params): Direct Debit cancelled

@uk.gov.hmrc.hmrcemailrenderer.templates.helpers.txt.salutationLine1(params)

Expand All @@ -9,6 +11,6 @@ We have sent you a secure message. To read it:
1. Go to GOV.UK.
2. Search for ‘Manage your import duties and VAT accounts’ and sign in.

If you have outstanding charges to pay, you will need to pay them immediately. If you want to continue to use your duty deferment account, you will need to set up a new Direct Debit instruction.
If you have outstanding charges to pay, you will need to pay them immediately. If you want to continue to @{`ifYouWantToContinueTo...`(params)}, you will need to set up a new Direct Debit instruction.

From HMRC Direct Debit team
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
* limitations under the License.
*@

@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.CdsDdiTemplateParameters._

@(params: Map[String, Any])

@uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.template_main(params, "HMRC Duty Deferred: Direct Debit instruction cannot be used") {
@uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.template_main(params, s"${regimeName(params)}: Direct Debit instruction cannot be used") {
@uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.salutationLine1(params)

<p style="margin: 0 0 30px; font-size: 19px;">Your bank has told us we cannot collect payments using this Direct Debit instruction.</p>
Expand All @@ -29,7 +31,7 @@
</ol>

<p style="margin: 0 0 30px; font-size: 19px;">
If you have outstanding charges to pay, you will need to pay them immediately. If you want to continue to use your duty deferment account, you will need to set up a new Direct Debit instruction.
If you have outstanding charges to pay, you will need to pay them immediately. If you want to continue to @{`ifYouWantToContinueTo...`(params)}, you will need to set up a new Direct Debit instruction.
</p>

<p style="margin: 0 0 30px; font-size: 19px;">From HMRC Direct Debit team</p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
@(params: Map[String, Any])HMRC Duty Deferred: Direct Debit instruction cannot be used
@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.CdsDdiTemplateParameters._

@(params: Map[String, Any])@regimeName(params): Direct Debit instruction cannot be used

@uk.gov.hmrc.hmrcemailrenderer.templates.helpers.txt.salutationLine1(params)
Your bank has told us we cannot collect payments using this Direct Debit instruction.
Expand All @@ -8,6 +10,6 @@ We have sent you a secure message. To read it:
1. Go to GOV.UK.
2. Search for ‘Manage your import duties and VAT accounts’ and sign in.

If you have outstanding charges to pay, you will need to pay them immediately. If you want to continue to use your duty deferment account, you will need to set up a new Direct Debit instruction.
If you have outstanding charges to pay, you will need to pay them immediately. If you want to continue to @{`ifYouWantToContinueTo...`(params)}, you will need to set up a new Direct Debit instruction.

From HMRC Direct Debit team
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
* limitations under the License.
*@

@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.CdsDdiTemplateParameters.regimeName

@(params: Map[String, Any])

@uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.template_main(params, "HMRC Duty Deferred: Direct Debit reinstated") {
@uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.template_main(params, s"${regimeName(params)}: Direct Debit reinstated") {
@uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.salutationLine1(params)

<p style="margin: 0 0 30px; font-size: 19px;">Your Direct Debit has been reinstated.</p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
@(params: Map[String, Any])HMRC Duty Deferred: Direct Debit reinstated
@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.CdsDdiTemplateParameters.regimeName

@(params: Map[String, Any])@regimeName(params): Direct Debit reinstated

@uk.gov.hmrc.hmrcemailrenderer.templates.helpers.txt.salutationLine1(params)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
* limitations under the License.
*@

@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.CdsDdiTemplateParameters._

@(params: Map[String, Any])

@uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.template_main(params, "HMRC Duty Deferred Direct Debit: reminder of payment collection") {
@uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.template_main(params, s"${regimeName(params)} Direct Debit: reminder of payment collection") {
@uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.salutationLine1(params)

<p style="margin: 0 0 30px; font-size: 19px;">You have a Direct Debit set up to pay your duty deferment account balance. This is a reminder we will collect payment shortly.</p>
<p style="margin: 0 0 30px; font-size: 19px;">You have a Direct Debit set up to pay your @{`toPayYour...`(params)}. This is a reminder we will collect payment shortly.</p>

<p style="margin: 0 0 30px; font-size: 19px;">We have sent you a secure message. To read it:</p>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
@(params: Map[String, Any])HMRC Duty Deferred Direct Debit: reminder of payment collection
@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.CdsDdiTemplateParameters._

@(params: Map[String, Any])@regimeName(params) Direct Debit: reminder of payment collection

@uk.gov.hmrc.hmrcemailrenderer.templates.helpers.txt.salutationLine1(params)
You have a Direct Debit set up to pay your duty deferment account balance. This is a reminder we will collect payment shortly.
You have a Direct Debit set up to pay your @{`toPayYour...`(params)}. This is a reminder we will collect payment shortly.

We have sent you a secure message. To read it:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
* limitations under the License.
*@

@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.CdsDdiTemplateParameters._

@(params: Map[String, Any])

@uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.template_main(params, "HMRC Duty Deferred Direct Debit: confirmation of instruction") {
@uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.template_main(params, s"${regimeName(params)} Direct Debit: confirmation of instruction") {
@uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.salutationLine1(params)

<p style="margin: 0 0 30px; font-size: 19px;">A Direct Debit is active on your duty deferment account.</p>
<p style="margin: 0 0 30px; font-size: 19px;">@ddiSetUpMessage(params)</p>

<p style="margin: 0 0 30px; font-size: 19px;">We have sent you a secure message. To read it:</p>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
@(params: Map[String, Any])HMRC Duty Deferred Direct Debit: confirmation of instruction
@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.CdsDdiTemplateParameters._

@(params: Map[String, Any])@regimeName(params) Direct Debit: confirmation of instruction

@uk.gov.hmrc.hmrcemailrenderer.templates.helpers.txt.salutationLine1(params)

A Direct Debit is active on your duty deferment account.
@ddiSetUpMessage(params)

We have sent you a secure message. To read it:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
* limitations under the License.
*@

@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.CdsDdiTemplateParameters._

@(params: Map[String, Any])

@uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.template_main(params, "HMRC Duty Deferred Direct Debit: payment not collected") {
@uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.template_main(params, s"${regimeName(params)} Direct Debit: payment not collected") {
@uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.salutationLine1(params)

<p style="margin: 0 0 30px; font-size: 19px;">We were unable to collect your Direct Debit payment.</p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
@(params: Map[String, Any])HMRC Duty Deferred Direct Debit: payment not collected
@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.CdsDdiTemplateParameters._

@(params: Map[String, Any])@regimeName(params) Direct Debit: payment not collected

@uk.gov.hmrc.hmrcemailrenderer.templates.helpers.txt.salutationLine1(params)

Expand Down

0 comments on commit 843f798

Please sign in to comment.