Skip to content

Commit

Permalink
[JB][OPS-8200] update face-to-face emails to format amount in gds for…
Browse files Browse the repository at this point in the history
…mat (#1098)

* [JB][OPS-8200] update face-to-face emails to format amount in gds format

* format change
  • Loading branch information
barnesjake authored Sep 21, 2023
1 parent 4d814cf commit d58f1be
Show file tree
Hide file tree
Showing 17 changed files with 68 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ object AmountFormatter extends Logging {

def formatAmount(amount: String): String = formatter.format(toDouble(amount))
def formatAmountInPence(amountInPence: String): String = formatter.format(toDouble(amountInPence) / 100)
def formatAmountInPenceGdsFormat(amountInPence: String): String =
formatter
.format(toDouble(amountInPence) / 100)
.replace(".00", "")

private def toDouble(s: String): Double =
Try(s.toDouble)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*@

@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.AmountFormatter.formatAmountInPence
@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.AmountFormatter.formatAmountInPenceGdsFormat

@(params: Map[String, Any])

Expand Down Expand Up @@ -42,18 +42,18 @@

<tr>
<th>Amount</th>
<td>@formatAmountInPence(params("amountInPence").toString)</td>
<td>@formatAmountInPenceGdsFormat(params("amountInPence").toString)</td>
</tr>

@{
if(params.contains("transactionFeeInPence")) {
<tr>
<th>Card fee</th>
<td>{formatAmountInPence(params("transactionFeeInPence").toString)}</td>
<td>{formatAmountInPenceGdsFormat(params("transactionFeeInPence").toString)}</td>
</tr>
<tr>
<th>Total paid</th>
<td>{formatAmountInPence(params("totalAmountInPence").toString)}</td>
<td>{formatAmountInPenceGdsFormat(params("totalAmountInPence").toString)}</td>
</tr>
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*@

@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.AmountFormatter.formatAmountInPence
@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.AmountFormatter.formatAmountInPenceGdsFormat

@(params: Map[String, Any])

Expand All @@ -38,14 +38,14 @@


Amount
@formatAmountInPence(params("amountInPence").toString)
@formatAmountInPenceGdsFormat(params("amountInPence").toString)

@if(params.contains("transactionFeeInPence")) {
Card fee
@formatAmountInPence(params("transactionFeeInPence").toString)
@formatAmountInPenceGdsFormat(params("transactionFeeInPence").toString)

Total paid
@formatAmountInPence(params("totalAmountInPence").toString)
@formatAmountInPenceGdsFormat(params("totalAmountInPence").toString)
}


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

@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.AmountFormatter.formatAmountInPence
@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.AmountFormatter.formatAmountInPenceGdsFormat

@(params: Map[String, Any])

Expand Down Expand Up @@ -42,19 +42,19 @@

<tr>
<th>Swm</th>
<td>@formatAmountInPence(params("amountInPence").toString)</td>
<td>@formatAmountInPenceGdsFormat(params("amountInPence").toString)</td>
</tr>

@{
if(params.contains("transactionFeeInPence")) {
<tr>
<th>Ffi’r cerdyn</th>
<td>{formatAmountInPence(params("transactionFeeInPence").toString)}</td>
<td>{formatAmountInPenceGdsFormat(params("transactionFeeInPence").toString)}</td>
</tr>

<tr>
<th>Cyfanswm a dalwyd</th>
<td>{formatAmountInPence(params("totalAmountInPence").toString)}</td>
<td>{formatAmountInPenceGdsFormat(params("totalAmountInPence").toString)}</td>
</tr>
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*@

@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.AmountFormatter.formatAmountInPence
@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.AmountFormatter.formatAmountInPenceGdsFormat

@(params: Map[String, Any])

Expand All @@ -34,14 +34,14 @@
@params("transactionReference")

Swm
@formatAmountInPence(params("amountInPence").toString)
@formatAmountInPenceGdsFormat(params("amountInPence").toString)

@if(params.contains("transactionFeeInPence")) {
Ffi’r cerdyn
@formatAmountInPence(params("transactionFeeInPence").toString)
@formatAmountInPenceGdsFormat(params("transactionFeeInPence").toString)

Cyfanswm a dalwyd
@formatAmountInPence(params("totalAmountInPence").toString)
@formatAmountInPenceGdsFormat(params("totalAmountInPence").toString)
}

Os oes gennych gyfrif treth ar-lein, bydd eich taliad yn cymryd 3 i 5 diwrnod i ymddangos yn eich cyfrif.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*@

@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.AmountFormatter.formatAmountInPence
@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.AmountFormatter.formatAmountInPenceGdsFormat

@(params: Map[String, Any])

Expand Down Expand Up @@ -42,19 +42,19 @@

<tr>
<th>Amount</th>
<td>@formatAmountInPence(params("amountInPence").toString)</td>
<td>@formatAmountInPenceGdsFormat(params("amountInPence").toString)</td>
</tr>

@{
if(params.contains("transactionFeeInPence")) {
<tr>
<th>Card fee</th>
<td>{formatAmountInPence(params("transactionFeeInPence").toString)}</td>
<td>{formatAmountInPenceGdsFormat(params("transactionFeeInPence").toString)}</td>
</tr>

<tr>
<th>Total</th>
<td>{formatAmountInPence(params("totalAmountInPence").toString)}</td>
<td>{formatAmountInPenceGdsFormat(params("totalAmountInPence").toString)}</td>
</tr>
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*@

@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.AmountFormatter.formatAmountInPence
@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.AmountFormatter.formatAmountInPenceGdsFormat

@(params: Map[String, Any])

Expand All @@ -35,14 +35,14 @@ Your card payment to HMRC has not been made. No money has been taken from your a
@params("transactionReference")

Amount
@formatAmountInPence(params("amountInPence").toString)
@formatAmountInPenceGdsFormat(params("amountInPence").toString)

@if(params.contains("transactionFeeInPence")) {
Card fee
@formatAmountInPence(params("transactionFeeInPence").toString)
@formatAmountInPenceGdsFormat(params("transactionFeeInPence").toString)

Total
@formatAmountInPence(params("totalAmountInPence").toString)
@formatAmountInPenceGdsFormat(params("totalAmountInPence").toString)
}

If you still need to pay
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*@

@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.AmountFormatter.formatAmountInPence
@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.AmountFormatter.formatAmountInPenceGdsFormat

@(params: Map[String, Any])

Expand Down Expand Up @@ -42,19 +42,19 @@

<tr>
<th>Swm</th>
<td>@formatAmountInPence(params("amountInPence").toString)</td>
<td>@formatAmountInPenceGdsFormat(params("amountInPence").toString)</td>
</tr>

@{
if(params.contains("transactionFeeInPence")) {
<tr>
<th>Ffi’r cerdyn</th>
<td>{formatAmountInPence(params("transactionFeeInPence").toString)}</td>
<td>{formatAmountInPenceGdsFormat(params("transactionFeeInPence").toString)}</td>
</tr>

<tr>
<th>Cyfanswm</th>
<td>{formatAmountInPence(params("totalAmountInPence").toString)}</td>
<td>{formatAmountInPenceGdsFormat(params("totalAmountInPence").toString)}</td>
</tr>
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*@

@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.AmountFormatter.formatAmountInPence
@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.AmountFormatter.formatAmountInPenceGdsFormat

@(params: Map[String, Any])

Expand All @@ -34,14 +34,14 @@ Nid yw’r taliad drwy ddefnyddio’ch cerdyn wedi’i gyflwyno i CThEF. Does di
@params("transactionReference")

Swm
@formatAmountInPence(params("amountInPence").toString)
@formatAmountInPenceGdsFormat(params("amountInPence").toString)

@if(params.contains("transactionFeeInPence")) {
Ffi’r cerdyn
@formatAmountInPence(params("transactionFeeInPence").toString)
@formatAmountInPenceGdsFormat(params("transactionFeeInPence").toString)

Cyfanswm
@formatAmountInPence(params("totalAmountInPence").toString)
@formatAmountInPenceGdsFormat(params("totalAmountInPence").toString)
}

Os oes dal angen i chi dalu
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*@

@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.AmountFormatter.formatAmountInPence
@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.AmountFormatter.formatAmountInPenceGdsFormat

@(params: Map[String, Any])

Expand Down Expand Up @@ -42,19 +42,19 @@

<tr>
<th>Amount</th>
<td>@formatAmountInPence(params("amountInPence").toString)</td>
<td>@formatAmountInPenceGdsFormat(params("amountInPence").toString)</td>
</tr>

@{
if(params.contains("transactionFeeInPence")) {
<tr>
<th>Card fee</th>
<td>{formatAmountInPence(params("transactionFeeInPence").toString)}</td>
<td>{formatAmountInPenceGdsFormat(params("transactionFeeInPence").toString)}</td>
</tr>

<tr>
<th>Total paid</th>
<td>{formatAmountInPence(params("totalAmountInPence").toString)}</td>
<td>{formatAmountInPenceGdsFormat(params("totalAmountInPence").toString)}</td>
</tr>
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*@

@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.AmountFormatter.formatAmountInPence
@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.AmountFormatter.formatAmountInPenceGdsFormat

@(params: Map[String, Any])

Expand All @@ -34,14 +34,14 @@
@params("transactionReference")

Amount
@formatAmountInPence(params("amountInPence").toString)
@formatAmountInPenceGdsFormat(params("amountInPence").toString)

@if(params.contains("transactionFeeInPence")) {
Card fee
@formatAmountInPence(params("transactionFeeInPence").toString)
@formatAmountInPenceGdsFormat(params("transactionFeeInPence").toString)

Total paid
@formatAmountInPence(params("totalAmountInPence").toString)
@formatAmountInPenceGdsFormat(params("totalAmountInPence").toString)
}

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

@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.AmountFormatter.formatAmountInPence
@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.AmountFormatter.formatAmountInPenceGdsFormat

@(params: Map[String, Any])

Expand Down Expand Up @@ -42,19 +42,19 @@

<tr>
<th>Swm</th>
<td>@formatAmountInPence(params("amountInPence").toString)</td>
<td>@formatAmountInPenceGdsFormat(params("amountInPence").toString)</td>
</tr>

@{
if(params.contains("transactionFeeInPence")) {
<tr>
<th>Ffi’r cerdyn</th>
<td>{formatAmountInPence(params("transactionFeeInPence").toString)}</td>
<td>{formatAmountInPenceGdsFormat(params("transactionFeeInPence").toString)}</td>
</tr>

<tr>
<th>Cyfanswm a dalwyd</th>
<td>{formatAmountInPence(params("totalAmountInPence").toString)}</td>
<td>{formatAmountInPenceGdsFormat(params("totalAmountInPence").toString)}</td>
</tr>
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*@

@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.AmountFormatter.formatAmountInPence
@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.AmountFormatter.formatAmountInPenceGdsFormat

@(params: Map[String, Any])

Expand All @@ -34,14 +34,14 @@
@params("transactionReference")

Swm
@formatAmountInPence(params("amountInPence").toString)
@formatAmountInPenceGdsFormat(params("amountInPence").toString)

@if(params.contains("transactionFeeInPence")) {
Ffi’r cerdyn
@formatAmountInPence(params("transactionFeeInPence").toString)
@formatAmountInPenceGdsFormat(params("transactionFeeInPence").toString)

Cyfanswm a dalwyd
@formatAmountInPence(params("totalAmountInPence").toString)
@formatAmountInPenceGdsFormat(params("totalAmountInPence").toString)
}

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

@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.AmountFormatter.formatAmountInPence
@import uk.gov.hmrc.hmrcemailrenderer.templates.onlinepaymentservice.AmountFormatter.formatAmountInPenceGdsFormat

@(params: Map[String, Any])

Expand Down Expand Up @@ -42,19 +42,19 @@

<tr>
<th>Amount</th>
<td>@formatAmountInPence(params("amountInPence").toString)</td>
<td>@formatAmountInPenceGdsFormat(params("amountInPence").toString)</td>
</tr>

@{
if(params.contains("transactionFeeInPence")) {
<tr>
<th>Card fee</th>
<td>{formatAmountInPence(params("transactionFeeInPence").toString)}</td>
<td>{formatAmountInPenceGdsFormat(params("transactionFeeInPence").toString)}</td>
</tr>

<tr>
<th>Total</th>
<td>{formatAmountInPence(params("totalAmountInPence").toString)}</td>
<td>{formatAmountInPenceGdsFormat(params("totalAmountInPence").toString)}</td>
</tr>
}
}
Expand Down
Loading

0 comments on commit d58f1be

Please sign in to comment.