From 103c62391e956f07a0e581d7345cb50fec5d5bcc Mon Sep 17 00:00:00 2001 From: Andrew Walker Date: Thu, 1 Aug 2024 09:41:09 +0100 Subject: [PATCH] Dc 6593 (#1171) * DC-6593: compile for scala 3 * DC-6593: scala 3 update * DC-6593: pr bot comments --- .gitignore | 1 + .scalafmt.conf | 2 +- app/preview/views/error_template.scala.html | 3 +- .../config/ErrorHandler.scala | 11 +++-- .../connectors/PreferencesConnector.scala | 12 ++++-- .../services/TemplateRenderer.scala | 2 +- .../agent_permissions_all_failed.scala.html | 2 +- ...agent_permissions_all_failed_cy.scala.html | 2 +- ...ssions_beta_participant_details.scala.html | 10 ++--- .../agent_permissions_some_failed.scala.html | 2 +- ...gent_permissions_some_failed_cy.scala.html | 2 +- .../agent_services_account_created.scala.html | 6 +-- ...ent_services_account_created_cy.scala.html | 6 +-- ..._accepted_authorisation_request.scala.html | 4 +- ...t_expired_authorisation_request.scala.html | 8 ++-- ..._rejected_authorisation_request.scala.html | 4 +- .../entity_check_notification.scala.html | 4 +- .../agent/entity_check_notification.scala.txt | 2 +- .../reimbursement_claim_submission.scala.html | 6 +-- ...imbursement_claim_submission_cy.scala.html | 6 +-- ...customsPullNotificationsWarning.scala.html | 2 +- .../customsPullNotificationsWarning.scala.txt | 2 +- .../mods_amend_export_declaration.scala.html | 4 +- .../mods_amend_export_declaration.scala.txt | 4 +- ...ods_amend_export_declaration_cy.scala.html | 4 +- ...mods_amend_export_declaration_cy.scala.txt | 4 +- .../mods_amend_import_declaration.scala.html | 4 +- .../mods_amend_import_declaration.scala.txt | 4 +- ...ods_amend_import_declaration_cy.scala.html | 4 +- ...mods_amend_import_declaration_cy.scala.txt | 4 +- .../mods/mods_export_declaration.scala.html | 4 +- .../mods/mods_export_declaration.scala.txt | 4 +- .../mods_export_declaration_cy.scala.html | 4 +- .../mods/mods_export_declaration_cy.scala.txt | 4 +- .../mods/mods_import_declaration.scala.html | 4 +- .../mods/mods_import_declaration.scala.txt | 4 +- .../mods_import_declaration_cy.scala.html | 4 +- .../mods/mods_import_declaration_cy.scala.txt | 4 +- .../ddi_advance_notice.scala.html | 2 +- .../ddi_advance_notice.scala.txt | 2 +- ...ent_email_no_receipt_successful.scala.html | 2 +- ..._email_no_receipt_successful_cy.scala.html | 5 ++- .../passengers_confirmation.scala.html | 2 +- .../passengers_confirmation.scala.txt | 2 +- .../recon_mods_finance_report.scala.txt | 4 +- .../twoWayMessageRecievedTemplate.scala.html | 3 -- build.sbt | 14 ++----- conf/application-json-logger.xml | 13 ------ conf/application.conf | 32 +++++++-------- conf/logback.xml | 22 ---------- .../RendererControllerISpec.scala | 1 + .../TemplatePrioritiesISpec.scala | 1 + project/AppDependencies.scala | 14 +++---- project/ScoverageSettings.scala | 4 +- project/build.properties | 2 +- project/plugins.sbt | 7 ++-- test/preview/PreviewSpec.scala | 5 ++- .../connectors/PreferencesConnectorSpec.scala | 40 ++++++++----------- .../services/TemplateRendererSpec.scala | 4 +- 59 files changed, 155 insertions(+), 189 deletions(-) delete mode 100644 conf/application-json-logger.xml diff --git a/.gitignore b/.gitignore index e5ee3d0c1..bdae04cba 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,7 @@ precompiled /.project project/project project/target +project/metals.sbt /RUNNING_PID server.pid /.settings diff --git a/.scalafmt.conf b/.scalafmt.conf index 777cc5abc..96b09c8e9 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,5 +1,5 @@ version = 3.8.1 -runner.dialect = scala213 +runner.dialect = scala3 style = defaultWithAlign maxColumn = 120 lineEndings = unix diff --git a/app/preview/views/error_template.scala.html b/app/preview/views/error_template.scala.html index 29257f638..5ce0a2491 100644 --- a/app/preview/views/error_template.scala.html +++ b/app/preview/views/error_template.scala.html @@ -14,9 +14,10 @@ * limitations under the License. *@ +@import play.api.mvc.RequestHeader @this() -@(pageTitle: String, heading: String, message: String)(implicit request: Request[_], messages: Messages) +@(pageTitle: String, heading: String, message: String)(implicit request: RequestHeader, messages: Messages) @pageTitle diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/config/ErrorHandler.scala b/app/uk/gov/hmrc/hmrcemailrenderer/config/ErrorHandler.scala index e58960f51..5bf019e09 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/config/ErrorHandler.scala +++ b/app/uk/gov/hmrc/hmrcemailrenderer/config/ErrorHandler.scala @@ -22,15 +22,18 @@ import play.twirl.api.Html import uk.gov.hmrc.play.bootstrap.frontend.http.FrontendErrorHandler import preview.views.html.error_template import com.google.inject.{ Inject, Singleton } +import scala.concurrent.{ ExecutionContext, Future } +import play.api.mvc.RequestHeader @Singleton class ErrorHandler @Inject() ( val messagesApi: MessagesApi, view: error_template -) extends FrontendErrorHandler with I18nSupport { +)(implicit val ec: ExecutionContext) + extends FrontendErrorHandler with I18nSupport { override def standardErrorTemplate(pageTitle: String, heading: String, message: String)(implicit - rh: Request[_] - ): Html = - view(pageTitle, heading, message) + rh: RequestHeader + ): Future[Html] = + Future.successful(view(pageTitle, heading, message)(rh, messagesApi.preferred(rh))) } diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/connectors/PreferencesConnector.scala b/app/uk/gov/hmrc/hmrcemailrenderer/connectors/PreferencesConnector.scala index 21abf6ac2..26ff0eace 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/connectors/PreferencesConnector.scala +++ b/app/uk/gov/hmrc/hmrcemailrenderer/connectors/PreferencesConnector.scala @@ -20,13 +20,15 @@ import com.google.inject.{ Inject, Singleton } import play.api.libs.json.{ Json, OFormat } import uk.gov.hmrc.crypto.{ ApplicationCrypto, PlainText } import uk.gov.hmrc.hmrcemailrenderer.model.Language -import uk.gov.hmrc.http.{ HeaderCarrier, HttpClient } +import uk.gov.hmrc.http.HeaderCarrier +import uk.gov.hmrc.http.client.HttpClientV2 import uk.gov.hmrc.play.bootstrap.config.ServicesConfig import uk.gov.hmrc.http.HttpReads.Implicits._ import scala.concurrent.{ ExecutionContext, Future } +import java.net.URI @Singleton -class PreferencesConnector @Inject() (servicesConfig: ServicesConfig, http: HttpClient, crypto: ApplicationCrypto) { +class PreferencesConnector @Inject() (servicesConfig: ServicesConfig, http: HttpClientV2, crypto: ApplicationCrypto) { object LanguagePreference { implicit val format: OFormat[LanguagePreference] = Json.format[LanguagePreference] @@ -34,8 +36,10 @@ class PreferencesConnector @Inject() (servicesConfig: ServicesConfig, http: Http def languageByEmail(emailAddress: String)(implicit hc: HeaderCarrier, ec: ExecutionContext): Future[Language] = { val encryptedEmail = new String(crypto.QueryParameterCrypto.encrypt(PlainText(emailAddress)).toBase64) - val url = servicesConfig.baseUrl("preferences") + s"/preferences/language/$encryptedEmail" - http.GET[Language](url) + val url = new URI(servicesConfig.baseUrl("preferences") + s"/preferences/language/$encryptedEmail").toURL + http + .get(url) + .execute[Language] } } diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/services/TemplateRenderer.scala b/app/uk/gov/hmrc/hmrcemailrenderer/services/TemplateRenderer.scala index 4ca6cf84b..0aab505d5 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/services/TemplateRenderer.scala +++ b/app/uk/gov/hmrc/hmrcemailrenderer/services/TemplateRenderer.scala @@ -139,7 +139,7 @@ class TemplateRenderer @Inject() ( } private def render( - template: Map[String, String] => Format[_]#Appendable, + template: Map[String, String] => Format[?]#Appendable, params: Map[String, String] ): Either[ErrorMessage, String] = Try(template(params)) match { diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/agent_permissions_all_failed.scala.html b/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/agent_permissions_all_failed.scala.html index 4b06c09aa..5c75d43b6 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/agent_permissions_all_failed.scala.html +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/agent_permissions_all_failed.scala.html @@ -20,7 +20,7 @@ @uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.template_main(params, "Add clients to use access groups", isWelsh=false) { -

Dear @agencyName

+

Dear @agencyName()

You have turned on access groups in your agent services account.

Our system cannot find any clients linked to this account. You need to add clients before you can use access groups.

diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/agent_permissions_all_failed_cy.scala.html b/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/agent_permissions_all_failed_cy.scala.html index 881c1802f..ca861119f 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/agent_permissions_all_failed_cy.scala.html +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/agent_permissions_all_failed_cy.scala.html @@ -20,7 +20,7 @@ @uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.template_main(params, "Ychwanegu cleientiaid i ddefnyddio grwpiau mynediad", isWelsh=true) { -

Annwyl @agencyName

+

Annwyl @agencyName()

Rydych wedi galluogi grwpiau mynediad yn eich cyfrif gwasanaethau asiant.

Ni all ein system ddod o hyd i unrhyw gleientiaid sy’n gysylltiedig â’r cyfrif hwn. Mae angen i chi ychwanegu cleientiaid cyn y gallwch ddefnyddio grwpiau mynediad.

diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/agent_permissions_beta_participant_details.scala.html b/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/agent_permissions_beta_participant_details.scala.html index 2ffbebabe..a2b1b1f9c 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/agent_permissions_beta_participant_details.scala.html +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/agent_permissions_beta_participant_details.scala.html @@ -26,11 +26,11 @@ @uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.template_main(params, title = "Agent interested in private beta") { -

Agent Reference Number: @arn

-

Number of clients: @numClients

-

Contact name: @contactName

-

Contact email address: @contactEmail

-

Contact telephone number: @telephone_number

+

Agent Reference Number: @arn()

+

Number of clients: @numClients()

+

Contact name: @contactName()

+

Contact email address: @contactEmail()

+

Contact telephone number: @telephone_number()

This agent is interested in joining the private beta of Granular Permissions for agent services accounts.

diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/agent_permissions_some_failed.scala.html b/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/agent_permissions_some_failed.scala.html index 4d2b65667..05771097d 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/agent_permissions_some_failed.scala.html +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/agent_permissions_some_failed.scala.html @@ -20,7 +20,7 @@ @uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.template_main(params, "You can start using access groups", isWelsh=false) { -

Dear @agencyName

+

Dear @agencyName()

You have turned on access groups in your agent services account and your client details have now been processed. We could not retrieve all your client references, but you can enter these manually. To do this, select ‘Manage clients’ under ‘Manage account’.

To create access groups, sign in to your agent services account and select 'Manage account'.

diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/agent_permissions_some_failed_cy.scala.html b/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/agent_permissions_some_failed_cy.scala.html index 96215dc95..7d3870a74 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/agent_permissions_some_failed_cy.scala.html +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/agent_permissions_some_failed_cy.scala.html @@ -20,7 +20,7 @@ @uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.template_main(params, "Gallwch ddechrau defnyddio grwpiau mynediad", isWelsh=true) { -

Annwyl @agencyName

+

Annwyl @agencyName()

Rydych wedi galluogi grwpiau mynediad yn eich cyfrif gwasanaethau asiant ac mae manylion eich cleientiaid bellach wedi’u prosesu.

Mae unrhyw grwpiau mynediad a grëwyd gan eich sefydliad yn y gorffennol wedi’u hadfer.

diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/agent_services_account_created.scala.html b/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/agent_services_account_created.scala.html index 9b10a924b..05d4531d4 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/agent_services_account_created.scala.html +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/agent_services_account_created.scala.html @@ -21,10 +21,10 @@ @uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.template_main(params, "Agent services account created") { -

Dear @agencyName

+

Dear @agencyName()

-

You have created an HMRC agent services account for @agencyName.

-

Your account reference number is @arn

+

You have created an HMRC agent services account for @agencyName().

+

Your account reference number is @arn()

Make sure you have this with you if you contact us about your agent services account.

What you can do next

diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/agent_services_account_created_cy.scala.html b/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/agent_services_account_created_cy.scala.html index 00c453bce..9de145988 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/agent_services_account_created_cy.scala.html +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/agent_services_account_created_cy.scala.html @@ -21,10 +21,10 @@ @uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.template_main(params, "Cyfrif gwasanaethau asiant wedi’i greu", isWelsh=true) { -

Annwyl @agencyName

+

Annwyl @agencyName()

-

Rydych wedi creu cyfrif gwasanaethau asiant CThEF ar gyfer @agencyName.

-

Cyfeirnod eich cyfrif yw @arn

+

Rydych wedi creu cyfrif gwasanaethau asiant CThEF ar gyfer @agencyName().

+

Cyfeirnod eich cyfrif yw @arn()

Gwnewch yn siŵr bod gennych chi hyn os ydych yn cysylltu â ni ynglŷn â’ch cyfrif gwasanaethau asiant.

Yr hyn y gallwch ei wneud nesaf

diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/client_accepted_authorisation_request.scala.html b/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/client_accepted_authorisation_request.scala.html index e7ccf7e26..5ef7c989f 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/client_accepted_authorisation_request.scala.html +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/client_accepted_authorisation_request.scala.html @@ -22,8 +22,8 @@ @uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.template_main(params, "Your client accepted your authorisation request") { -

Dear @agencyName

-

Your client @clientName has authorised you to @service

+

Dear @agencyName()

+

Your client @clientName()< has authorised you to @service()

@if(!params("additionalInfo").asInstanceOf[String].isEmpty) {

@{params("additionalInfo")}

} else {}

Do not reply to this email.

From HMRC Agent Services Team

diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/client_expired_authorisation_request.scala.html b/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/client_expired_authorisation_request.scala.html index 20e2620c0..db4fee1cf 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/client_expired_authorisation_request.scala.html +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/client_expired_authorisation_request.scala.html @@ -23,19 +23,19 @@ @uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.template_main(params, "Your authorisation request expired without being accepted") { -

Dear @agencyName

+

Dear @agencyName()

- Your authorisation request to your client @clientName has expired because they did not respond by @expiryDate. + Your authorisation request to your client @clientName() has expired because they did not respond by @expiryDate().

- @clientName did not accept your request to @service + @clientName() did not accept your request to @service()

What you can do next

- If you still want @clientName to authorise you, sign in to your HMRC agent services account and start a new authorisation request.

+ If you still want @clientName() to authorise you, sign in to your HMRC agent services account and start a new authorisation request.

Do not reply to this email.

From HMRC Agent Services Team

diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/client_rejected_authorisation_request.scala.html b/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/client_rejected_authorisation_request.scala.html index b91a4823f..df630133d 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/client_rejected_authorisation_request.scala.html +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/client_rejected_authorisation_request.scala.html @@ -22,10 +22,10 @@ @uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.template_main(params, "Your authorisation request was declined") { -

Dear @agencyName

+

Dear @agencyName()

- Your client @clientName has declined your request to @service

+ Your client @clientName() has declined your request to @service()

What you can do next

diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/entity_check_notification.scala.html b/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/entity_check_notification.scala.html index c6f42e853..751a22dbf 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/entity_check_notification.scala.html +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/entity_check_notification.scala.html @@ -23,9 +23,9 @@

Agent Reference Number: @params("arn")

Unique Taxpayer Reference: @params("utr")

Agent name: @params("agencyName")

-

Check@{if(failedChecks.length > 1) "s" else ""} failed:

+

Check@{if(failedChecks().length > 1) "s" else ""} failed:

Date and time of check: @params("dateTime")

From HMRC Agent Services team

diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/entity_check_notification.scala.txt b/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/entity_check_notification.scala.txt index 24092f36c..c7a4974a0 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/entity_check_notification.scala.txt +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/agent/entity_check_notification.scala.txt @@ -5,7 +5,7 @@ Agent entity check failure report Agent reference number: @params("arn") Unique Taxpayer Reference: @params("utr") Agent name: @params("agencyName") -Check@{if(failedChecks.length > 1) "s" else ""} failed: @params("failedChecks") +Check@{if(failedChecks().length > 1) "s" else ""} failed: @params("failedChecks") Date / time of check: @params("dateTime") From HMRC Agent Services Team diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/cdsrc/reimbursement_claim_submission.scala.html b/app/uk/gov/hmrc/hmrcemailrenderer/templates/cdsrc/reimbursement_claim_submission.scala.html index 082a881b5..b9c5b8090 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/cdsrc/reimbursement_claim_submission.scala.html +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/cdsrc/reimbursement_claim_submission.scala.html @@ -22,13 +22,13 @@ @uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.template_main(params, "Your import charge reimbursement claim submission"){ -

Dear @name

+

Dear @name()

This confirms you have applied to claim for reimbursement on import charges such as Customs Duties, Excise Duties, Countervailing Duties and VAT.

-

Your claim reference number is: @reference

+

Your claim reference number is: @reference()

-

Your claim amount is: £@claimAmount

+

Your claim amount is: £@claimAmount()

What happens next

diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/cdsrc/reimbursement_claim_submission_cy.scala.html b/app/uk/gov/hmrc/hmrcemailrenderer/templates/cdsrc/reimbursement_claim_submission_cy.scala.html index 1de2dbe5d..bfa2609f9 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/cdsrc/reimbursement_claim_submission_cy.scala.html +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/cdsrc/reimbursement_claim_submission_cy.scala.html @@ -22,13 +22,13 @@ @uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.template_main(params, "Eich hawliad am ad-daliad o ffioedd mewnforio"){ -

Annwyl @name

+

Annwyl @name()

Mae hyn yn cadarnhau eich bod wedi gwneud cais i hawlio ad-daliad ar gyfer ffioedd mewnforio megis Tollau Tramor, Tollau Ecséis, Tollau Gwrthbwyso a TAW.

-

Cyfeirnod eich hawliad yw: @reference

+

Cyfeirnod eich hawliad yw: @reference()

-

Swm eich hawliad yw: £@claimAmount

+

Swm eich hawliad yw: £@claimAmount()

Yr hyn sy’n digwydd nesaf

diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/customs/customsPullNotificationsWarning.scala.html b/app/uk/gov/hmrc/hmrcemailrenderer/templates/customs/customsPullNotificationsWarning.scala.html index dc7ac7ed6..a11ccc302 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/customs/customsPullNotificationsWarning.scala.html +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/customs/customsPullNotificationsWarning.scala.html @@ -16,7 +16,7 @@ @(params: Map[String, Any]) @grid = @{ - val warnings = Stream.from(0).takeWhile(i => params.get(s"clientId_$i").isDefined).toList + val warnings = LazyList.from(0).takeWhile(i => params.get(s"clientId_$i").isDefined).toList warnings.map { i => val clientId = params(s"clientId_$i") val notificationTotal = params(s"notificationTotal_$i") diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/customs/customsPullNotificationsWarning.scala.txt b/app/uk/gov/hmrc/hmrcemailrenderer/templates/customs/customsPullNotificationsWarning.scala.txt index 890b4be79..fafdcd1b4 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/customs/customsPullNotificationsWarning.scala.txt +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/customs/customsPullNotificationsWarning.scala.txt @@ -1,6 +1,6 @@ @(params: Map[String, Any]) @grid = @{ - val warnings = Stream.from(0).takeWhile(i => params.get(s"clientId_$i").isDefined).toList + val warnings = LazyList.from(0).takeWhile(i => params.get(s"clientId_$i").isDefined).toList warnings.map { i => val clientId = params(s"clientId_$i") val notificationTotal = params(s"notificationTotal_$i") diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_amend_export_declaration.scala.html b/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_amend_export_declaration.scala.html index 6010506c6..2d19b83dd 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_amend_export_declaration.scala.html +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_amend_export_declaration.scala.html @@ -17,7 +17,7 @@ @(params: Map[String, Any]) @goodsGrid = @{ - val goods = Stream.from(0).takeWhile(i => params.contains(s"goodsCategory_$i")).toList + val goods = LazyList.from(0).takeWhile(i => params.contains(s"goodsCategory_$i")).toList goods.map { i => val category = params(s"goodsCategory_$i") val country = params(s"goodsDestination_$i") @@ -40,7 +40,7 @@

What you need to do next

Date of declaration

-

@{params("dateOfDeclaration") + "." }

+

@{params("dateOfDeclaration").toString}.

Details of the goods

diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_amend_export_declaration.scala.txt b/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_amend_export_declaration.scala.txt index 85c1871cf..b36d1db95 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_amend_export_declaration.scala.txt +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_amend_export_declaration.scala.txt @@ -1,6 +1,6 @@ @(params: Map[String, Any])You added goods to your declaration @goodsGrid = @{ - val goods = Stream.from(0).takeWhile(i => params.get(s"goodsCategory_$i").isDefined).toList + val goods = LazyList.from(0).takeWhile(i => params.get(s"goodsCategory_$i").isDefined).toList goods.map { i => val category = params(s"goodsCategory_$i") val country = params(s"goodsDestination_$i") @@ -20,7 +20,7 @@ Take this updated declaration and the purchase receipts for the goods with you w Date of declaration -@{params("dateOfDeclaration") + "." } +@{params("dateOfDeclaration").toString}. Details of the goods diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_amend_export_declaration_cy.scala.html b/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_amend_export_declaration_cy.scala.html index 377ec79bb..d5feb1baf 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_amend_export_declaration_cy.scala.html +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_amend_export_declaration_cy.scala.html @@ -17,7 +17,7 @@ @(params: Map[String, Any]) @goodsGrid = @{ - val goods = Stream.from(0).takeWhile(i => params.contains(s"goodsCategory_$i")).toList + val goods = LazyList.from(0).takeWhile(i => params.contains(s"goodsCategory_$i")).toList goods.map { i => val category = params(s"goodsCategory_$i") val country = params(s"goodsDestination_$i") @@ -40,7 +40,7 @@

Yr hyn y mae angen i chi ei wneud nesaf

Dyddiad y datganiad

-

@{params("dateOfDeclaration") + "." }

+

@{params("dateOfDeclaration").toString}.

Manylion y nwyddau

diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_amend_export_declaration_cy.scala.txt b/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_amend_export_declaration_cy.scala.txt index 1ab7398db..1e42019ad 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_amend_export_declaration_cy.scala.txt +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_amend_export_declaration_cy.scala.txt @@ -1,6 +1,6 @@ @(params: Map[String, Any])Rydych wedi ychwanegu nwyddau at eich datganiad @goodsGrid = @{ - val goods = Stream.from(0).takeWhile(i => params.get(s"goodsCategory_$i").isDefined).toList + val goods = LazyList.from(0).takeWhile(i => params.get(s"goodsCategory_$i").isDefined).toList goods.map { i => val category = params(s"goodsCategory_$i") val country = params(s"goodsDestination_$i") @@ -20,7 +20,7 @@ Ewch â’r datganiad wedi’i ddiweddaru hwn a’r derbyniadau prynu ar gyfer y Dyddiad y datganiad -@{params("dateOfDeclaration") + "." } +@{params("dateOfDeclaration").toString}. Manylion y nwyddau diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_amend_import_declaration.scala.html b/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_amend_import_declaration.scala.html index 3f9d9e4be..9950c9a89 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_amend_import_declaration.scala.html +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_amend_import_declaration.scala.html @@ -17,7 +17,7 @@ @(params: Map[String, Any]) @goodsGrid = @{ - val goods = Stream.from(0).takeWhile(i => params.get(s"goodsCategory_$i").isDefined).toList + val goods = LazyList.from(0).takeWhile(i => params.get(s"goodsCategory_$i").isDefined).toList goods.map { i => val category = params(s"goodsCategory_$i") val country = params.get(s"goodsCountry_$i") @@ -47,7 +47,7 @@

Bringing EU goods

Date of declaration

-

@{params("dateOfDeclaration") + "." }

+

@{params("dateOfDeclaration").toString}.

Details of the goods

diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_amend_import_declaration.scala.txt b/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_amend_import_declaration.scala.txt index 48996208f..a6aa871e6 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_amend_import_declaration.scala.txt +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_amend_import_declaration.scala.txt @@ -1,6 +1,6 @@ @(params: Map[String, Any])You added goods to your declaration @goodsGrid = @{ - val goods = Stream.from(0).takeWhile(i => params.get(s"goodsCategory_$i").isDefined).toList + val goods = LazyList.from(0).takeWhile(i => params.get(s"goodsCategory_$i").isDefined).toList goods.map { i => val category = params(s"goodsCategory_$i") val country = params.get(s"goodsCountry_$i") @@ -27,7 +27,7 @@ You need to carry proof your goods were made in the EU if they have a total valu Date of declaration -@{params("dateOfDeclaration") + "." } +@{params("dateOfDeclaration").toString}. Details of the goods diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_amend_import_declaration_cy.scala.html b/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_amend_import_declaration_cy.scala.html index cb4a6bf2e..2b6fedf04 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_amend_import_declaration_cy.scala.html +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_amend_import_declaration_cy.scala.html @@ -17,7 +17,7 @@ @(params: Map[String, Any]) @goodsGrid = @{ - val goods = Stream.from(0).takeWhile(i => params.get(s"goodsCategory_$i").isDefined).toList + val goods = LazyList.from(0).takeWhile(i => params.get(s"goodsCategory_$i").isDefined).toList goods.map { i => val category = params(s"goodsCategory_$i") val country = params.get(s"goodsCountry_$i") @@ -47,7 +47,7 @@

Dod â nwyddau o’r UE gyda chi

Dyddiad y datganiad

-

@{params("dateOfDeclaration") + "." }

+

@{params("dateOfDeclaration").toString}

Manylion y nwyddau

diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_amend_import_declaration_cy.scala.txt b/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_amend_import_declaration_cy.scala.txt index e2bd80f4a..ce471de02 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_amend_import_declaration_cy.scala.txt +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_amend_import_declaration_cy.scala.txt @@ -1,6 +1,6 @@ @(params: Map[String, Any])Rydych wedi ychwanegu nwyddau at eich datganiad @goodsGrid = @{ - val goods = Stream.from(0).takeWhile(i => params.get(s"goodsCategory_$i").isDefined).toList + val goods = LazyList.from(0).takeWhile(i => params.get(s"goodsCategory_$i").isDefined).toList goods.map { i => val category = params(s"goodsCategory_$i") val country = params.get(s"goodsCountry_$i") @@ -27,7 +27,7 @@ Mae’n rhaid i chi gario tystiolaeth sy’n dangos y cafodd eich nwyddau eu gwn Dyddiad y datganiad -@{params("dateOfDeclaration") + "." } +@{params("dateOfDeclaration").toString}. Manylion y nwyddau diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_export_declaration.scala.html b/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_export_declaration.scala.html index d350f3aa7..fe13739a7 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_export_declaration.scala.html +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_export_declaration.scala.html @@ -17,7 +17,7 @@ @(params: Map[String, Any]) @goodsGrid = @{ - val goods = Stream.from(0).takeWhile(i => params.contains(s"goodsCategory_$i")).toList + val goods = LazyList.from(0).takeWhile(i => params.contains(s"goodsCategory_$i")).toList goods.map { i => val category = params(s"goodsCategory_$i") val country = params(s"goodsDestination_$i") @@ -40,7 +40,7 @@

What you need to do next

Date of declaration

-

@{params("dateOfDeclaration") + "." }

+

@{params("dateOfDeclaration").toString}.

Details of the goods

diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_export_declaration.scala.txt b/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_export_declaration.scala.txt index 549c69597..4d9438bfd 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_export_declaration.scala.txt +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_export_declaration.scala.txt @@ -1,6 +1,6 @@ @(params: Map[String, Any])You declared commercial goods you are taking out of Great Britain @goodsGrid = @{ - val goods = Stream.from(0).takeWhile(i => params.get(s"goodsCategory_$i").isDefined).toList + val goods = LazyList.from(0).takeWhile(i => params.get(s"goodsCategory_$i").isDefined).toList goods.map { i => val category = params(s"goodsCategory_$i") val country = params(s"goodsDestination_$i") @@ -20,7 +20,7 @@ Take this declaration and the purchase receipts for the goods with you when you Date of declaration -@{params("dateOfDeclaration") + "." } +@{params("dateOfDeclaration").toString}. Details of the goods diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_export_declaration_cy.scala.html b/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_export_declaration_cy.scala.html index ac9381cd0..38971b435 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_export_declaration_cy.scala.html +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_export_declaration_cy.scala.html @@ -17,7 +17,7 @@ @(params: Map[String, Any]) @goodsGrid = @{ - val goods = Stream.from(0).takeWhile(i => params.contains(s"goodsCategory_$i")).toList + val goods = LazyList.from(0).takeWhile(i => params.contains(s"goodsCategory_$i")).toList goods.map { i => val category = params(s"goodsCategory_$i") val country = params(s"goodsDestination_$i") @@ -40,7 +40,7 @@

Yr hyn y mae angen i chi ei wneud nesaf

Dyddiad y datganiad

-

@{params("dateOfDeclaration") + "." }

+

@{params("dateOfDeclaration").toString}.

Manylion y nwyddau

diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_export_declaration_cy.scala.txt b/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_export_declaration_cy.scala.txt index 5826dfca9..f7ce832f8 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_export_declaration_cy.scala.txt +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_export_declaration_cy.scala.txt @@ -1,6 +1,6 @@ @(params: Map[String, Any])Datganiad ar gyfer nwyddau masnachol yr ydych yn mynd â nhw allan o Brydain Fawr @goodsGrid = @{ - val goods = Stream.from(0).takeWhile(i => params.get(s"goodsCategory_$i").isDefined).toList + val goods = LazyList.from(0).takeWhile(i => params.get(s"goodsCategory_$i").isDefined).toList goods.map { i => val category = params(s"goodsCategory_$i") val country = params(s"goodsDestination_$i") @@ -20,7 +20,7 @@ Ewch â’r datganiad hwn a’r derbynebau prynu ar gyfer y nwyddau gyda chi pan Dyddiad y datganiad -@{params("dateOfDeclaration") + "." } +@{params("dateOfDeclaration").toString}. Manylion y nwyddau diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_import_declaration.scala.html b/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_import_declaration.scala.html index 69986991e..5c40e56a4 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_import_declaration.scala.html +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_import_declaration.scala.html @@ -17,7 +17,7 @@ @(params: Map[String, Any]) @goodsGrid = @{ - val goods = Stream.from(0).takeWhile(i => params.get(s"goodsCategory_$i").isDefined).toList + val goods = LazyList.from(0).takeWhile(i => params.get(s"goodsCategory_$i").isDefined).toList goods.map { i => val category = params(s"goodsCategory_$i") val country = params.get(s"goodsCountry_$i") @@ -47,7 +47,7 @@

Bringing EU goods

Date of declaration

-

@{params("dateOfDeclaration") + "." }

+

@{params("dateOfDeclaration").toString}.

Details of the goods

diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_import_declaration.scala.txt b/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_import_declaration.scala.txt index 725d4e4a3..5a7b4af19 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_import_declaration.scala.txt +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_import_declaration.scala.txt @@ -1,6 +1,6 @@ @(params: Map[String, Any])You declared commercial goods you are bringing into Great Britain @goodsGrid = @{ - val goods = Stream.from(0).takeWhile(i => params.get(s"goodsCategory_$i").isDefined).toList + val goods = LazyList.from(0).takeWhile(i => params.get(s"goodsCategory_$i").isDefined).toList goods.map { i => val category = params(s"goodsCategory_$i") val country = params.get(s"goodsCountry_$i") @@ -28,7 +28,7 @@ You need to carry proof your goods were made in the EU if they have a total valu Date of declaration -@{params("dateOfDeclaration") + "." } +@{params("dateOfDeclaration").toString}. Details of the goods diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_import_declaration_cy.scala.html b/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_import_declaration_cy.scala.html index bab98d770..ae24986de 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_import_declaration_cy.scala.html +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_import_declaration_cy.scala.html @@ -17,7 +17,7 @@ @(params: Map[String, Any]) @goodsGrid = @{ - val goods = Stream.from(0).takeWhile(i => params.get(s"goodsCategory_$i").isDefined).toList + val goods = LazyList.from(0).takeWhile(i => params.get(s"goodsCategory_$i").isDefined).toList goods.map { i => val category = params(s"goodsCategory_$i") val country = params.get(s"goodsCountry_$i") @@ -47,7 +47,7 @@

Dod â nwyddau o’r UE gyda chi

Dyddiad y datganiad

-

@{params("dateOfDeclaration") + "." }

+

@{params("dateOfDeclaration").toString}.

Manylion y nwyddau

diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_import_declaration_cy.scala.txt b/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_import_declaration_cy.scala.txt index fdcf0aaed..3508283d6 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_import_declaration_cy.scala.txt +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/mods/mods_import_declaration_cy.scala.txt @@ -1,6 +1,6 @@ @(params: Map[String, Any])Gwnaethoch ddatgan nwyddau masnachol yr ydych yn dod â nhw i Brydain Fawr @goodsGrid = @{ - val goods = Stream.from(0).takeWhile(i => params.get(s"goodsCategory_$i").isDefined).toList + val goods = LazyList.from(0).takeWhile(i => params.get(s"goodsCategory_$i").isDefined).toList goods.map { i => val category = params(s"goodsCategory_$i") val country = params.get(s"goodsCountry_$i") @@ -27,7 +27,7 @@ Os ydych yn dod â nwyddau a gynhyrchwyd yn yr UE gyda chi y mae cyfanswm eu gwe Dyddiad y datganiad -@{params("dateOfDeclaration") + "." } +@{params("dateOfDeclaration").toString}. Manylion y nwyddau diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/onlinepaymentservice/ddi_advance_notice.scala.html b/app/uk/gov/hmrc/hmrcemailrenderer/templates/onlinepaymentservice/ddi_advance_notice.scala.html index cc4e8acf6..60f902c84 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/onlinepaymentservice/ddi_advance_notice.scala.html +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/onlinepaymentservice/ddi_advance_notice.scala.html @@ -19,7 +19,7 @@ @(params: Map[String, Any]) @breakdown = @{ - val indices = Stream.from(0).takeWhile(i => params.get(s"CHARGETYPE_$i").isDefined).toList + val indices = LazyList.from(0).takeWhile(i => params.get(s"CHARGETYPE_$i").isDefined).toList indices.map { i => val chargeType = params(s"CHARGETYPE_$i") val period = params(s"PERIOD_$i") diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/onlinepaymentservice/ddi_advance_notice.scala.txt b/app/uk/gov/hmrc/hmrcemailrenderer/templates/onlinepaymentservice/ddi_advance_notice.scala.txt index b361aaa42..d438b174a 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/onlinepaymentservice/ddi_advance_notice.scala.txt +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/onlinepaymentservice/ddi_advance_notice.scala.txt @@ -3,7 +3,7 @@ @(params: Map[String, Any]) @breakdown = @{ - val indices = Stream.from(0).takeWhile(i => params.get(s"CHARGETYPE_$i").isDefined).toList + val indices = LazyList.from(0).takeWhile(i => params.get(s"CHARGETYPE_$i").isDefined).toList indices.map { i => val chargeType = params(s"CHARGETYPE_$i") val period = params(s"PERIOD_$i") diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/onlinepaymentservice/face_to_face_payment_email_no_receipt_successful.scala.html b/app/uk/gov/hmrc/hmrcemailrenderer/templates/onlinepaymentservice/face_to_face_payment_email_no_receipt_successful.scala.html index 2dbbfffc8..7c50feccd 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/onlinepaymentservice/face_to_face_payment_email_no_receipt_successful.scala.html +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/onlinepaymentservice/face_to_face_payment_email_no_receipt_successful.scala.html @@ -46,7 +46,7 @@ @{ - if(params.contains("transactionFeeInPence")) { + if(params.contains("transactionFeeInPence")){ Card fee {formatAmountInPenceGdsFormat(params("transactionFeeInPence").toString)} diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/onlinepaymentservice/face_to_face_payment_email_no_receipt_successful_cy.scala.html b/app/uk/gov/hmrc/hmrcemailrenderer/templates/onlinepaymentservice/face_to_face_payment_email_no_receipt_successful_cy.scala.html index 4037cfc7a..fab06eeab 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/onlinepaymentservice/face_to_face_payment_email_no_receipt_successful_cy.scala.html +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/onlinepaymentservice/face_to_face_payment_email_no_receipt_successful_cy.scala.html @@ -46,7 +46,7 @@ @{ - if(params.contains("transactionFeeInPence")) { + if(params.contains("transactionFeeInPence")){ Ffi’r cerdyn {formatAmountInPenceGdsFormat(params("transactionFeeInPence").toString)} @@ -57,6 +57,9 @@ {formatAmountInPenceGdsFormat(params("totalAmountInPence").toString)} } + else{ + + } } diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/onlinepaymentservice/passengers_confirmation.scala.html b/app/uk/gov/hmrc/hmrcemailrenderer/templates/onlinepaymentservice/passengers_confirmation.scala.html index 91d72b28c..f4a9d75e4 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/onlinepaymentservice/passengers_confirmation.scala.html +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/onlinepaymentservice/passengers_confirmation.scala.html @@ -37,7 +37,7 @@ val volume = item \ "volume" val quantity = item \ "quantity" val weight = item \ "weight" -val volOrQuantityOrWeight = if (quantity.isDefined) quantity.as[String] else if (weight.isDefined) {BigDecimal(weight.as[String]).setScale(2,RoundingMode.apply(2)) + "g of "} else (volume.as[String] + " litres") +val volOrQuantityOrWeight = if (quantity.isDefined) quantity.as[String] else if (weight.isDefined) {BigDecimal(weight.as[String]).setScale(2,RoundingMode.apply(2)).toString + "g of "} else (volume.as[String] + " litres") val itemDesc = s"$volOrQuantityOrWeight $commodityDescription" val goodsValue = (item \ "goodsValue").as[String] diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/onlinepaymentservice/passengers_confirmation.scala.txt b/app/uk/gov/hmrc/hmrcemailrenderer/templates/onlinepaymentservice/passengers_confirmation.scala.txt index e14534c1f..2d4723508 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/onlinepaymentservice/passengers_confirmation.scala.txt +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/onlinepaymentservice/passengers_confirmation.scala.txt @@ -23,7 +23,7 @@ case _ => List() val volume = item \ "volume" val quantity = item \ "quantity" val weight = item \ "weight" - val volOrQuantityOrWeight = if (quantity.isDefined) quantity.as[String] else if (weight.isDefined) {BigDecimal(weight.as[String]).setScale(2,RoundingMode.apply(2)) + "g of "} else (volume.as[String] + " litres") + val volOrQuantityOrWeight = if (quantity.isDefined) quantity.as[String] else if (weight.isDefined) {BigDecimal(weight.as[String]).setScale(2,RoundingMode.apply(2)).toString + "g of "} else (volume.as[String] + " litres") val itemDesc = s"$volOrQuantityOrWeight $commodityDescription" val goodsValue = (item \ "goodsValue").as[String] diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/onlinepaymentservice/recon_mods_finance_report.scala.txt b/app/uk/gov/hmrc/hmrcemailrenderer/templates/onlinepaymentservice/recon_mods_finance_report.scala.txt index 213e8cd5b..726c5939f 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/onlinepaymentservice/recon_mods_finance_report.scala.txt +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/onlinepaymentservice/recon_mods_finance_report.scala.txt @@ -3,11 +3,11 @@ OPSROWS: @{params.filter(_._1.startsWith("MODS_ROW_OPS")).map { row => val cells = row._2.toString.split(",").toList - row._2 + "\n"} + row._2.toString + "\n"} } TOPSROWS: @{params.filter(_._1.startsWith("MODS_ROW_TOPS")).map { row => val cells = row._2.toString.split(",").toList - row._2 + "\n"} + row._2.toString + "\n"} } \ No newline at end of file diff --git a/app/uk/gov/hmrc/hmrcemailrenderer/templates/twowaymessage/twoWayMessageRecievedTemplate.scala.html b/app/uk/gov/hmrc/hmrcemailrenderer/templates/twowaymessage/twoWayMessageRecievedTemplate.scala.html index 3285b22a4..0610d915f 100644 --- a/app/uk/gov/hmrc/hmrcemailrenderer/templates/twowaymessage/twoWayMessageRecievedTemplate.scala.html +++ b/app/uk/gov/hmrc/hmrcemailrenderer/templates/twowaymessage/twoWayMessageRecievedTemplate.scala.html @@ -14,9 +14,6 @@ * limitations under the License. *@ -@import java.time.LocalDate -@import uk.gov.hmrc.hmrcemailrenderer.templates.helpers.DateHelper - @(params: Map[String, Any]) @uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.template_main(params, "We received your message") { diff --git a/build.sbt b/build.sbt index d9189d381..008266b0a 100644 --- a/build.sbt +++ b/build.sbt @@ -3,28 +3,22 @@ import uk.gov.hmrc.versioning.SbtGitVersioning.autoImport.majorVersion val appName = "hmrc-email-renderer" -ThisBuild / majorVersion := 2 -ThisBuild / scalaVersion := "2.13.12" +ThisBuild / majorVersion := 3 +ThisBuild / scalaVersion := "3.4.2" val appDependencies: Seq[ModuleID] = AppDependencies() lazy val playSettings: Seq[Setting[_]] = Seq.empty lazy val microservice = Project(appName, file(".")) - .enablePlugins(play.sbt.PlayScala, SbtAutoBuildPlugin, SbtGitVersioning, SbtDistributablesPlugin) + .enablePlugins(play.sbt.PlayScala, SbtDistributablesPlugin) .disablePlugins(JUnitXmlReportPlugin) //Required to prevent https://github.com/scalatest/scalatest/issues/1427 .settings(playSettings: _*) .settings(scalaSettings: _*) .settings(defaultSettings(): _*) .settings( libraryDependencies ++= appDependencies, - retrieveManaged := true, - scalacOptions ++= Seq( - // Silence unused warnings on Play `routes` and `twirl` files - "-Wconf:cat=unused-imports&src=.*routes.*:s", - "-Wconf:cat=unused-privates&src=.*routes.*:s", - "-Wconf:src=twirl/.*:s" - ) + retrieveManaged := true ) .settings(resolvers += Resolver.jcenterRepo) .settings(routesGenerator := InjectedRoutesGenerator) diff --git a/conf/application-json-logger.xml b/conf/application-json-logger.xml deleted file mode 100644 index 5142f44f9..000000000 --- a/conf/application-json-logger.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/conf/application.conf b/conf/application.conf index 476b25eed..dee69b1f7 100644 --- a/conf/application.conf +++ b/conf/application.conf @@ -26,7 +26,7 @@ appName=hmrc-email-renderer # session.maxAge=900 # Default http client -play.modules.enabled += "uk.gov.hmrc.play.bootstrap.HttpClientModule" +play.modules.enabled += "uk.gov.hmrc.play.bootstrap.HttpClientV2Module" play.modules.enabled += "uk.gov.hmrc.play.bootstrap.AuthModule" @@ -126,21 +126,21 @@ auditing.enabled=true fromAddress.domain = "tax.service.gov.uk" transactionEngine.fromAddress.domain = "confirmation.tax.service.gov.uk" - templates { - config { - staticAssetUrlPrefix = "http://localhost:9032" - staticAssetVersion = "/assets/2.230.0" - staticHmrcFrontendVersion = "/assets/hmrc-frontend/5.66.0" - borderColour = "005EA5" - } +templates { + config { + staticAssetUrlPrefix = "http://localhost:9032" + staticAssetVersion = "/assets/2.230.0" + staticHmrcFrontendVersion = "/assets/hmrc-frontend/5.66.0" + borderColour = "005EA5" } +} - microservice { - services { - preferences { - host = localhost - port = 8025 - protocol=http - } +microservice { + services { + preferences { + host = localhost + port = 8025 + protocol=http + } } - } +} diff --git a/conf/logback.xml b/conf/logback.xml index 8b8e1138c..e64f9356a 100644 --- a/conf/logback.xml +++ b/conf/logback.xml @@ -14,19 +14,6 @@ - - - %date{ISO8601} level=[%level] logger=[%logger] thread=[%thread] rid=[not-available] user=[not-available] message=[%message] %replace(exception=[%xException]){'^exception=\[\]$',''}%n - - - - - logs/access.log - - %message%n - - - logs/connector.log @@ -34,15 +21,6 @@ - - - - - - - - - diff --git a/it/test/uk/gov/hmrc/hmrcemailrenderer/RendererControllerISpec.scala b/it/test/uk/gov/hmrc/hmrcemailrenderer/RendererControllerISpec.scala index 796019d70..59deaca32 100644 --- a/it/test/uk/gov/hmrc/hmrcemailrenderer/RendererControllerISpec.scala +++ b/it/test/uk/gov/hmrc/hmrcemailrenderer/RendererControllerISpec.scala @@ -22,6 +22,7 @@ import org.scalatestplus.play.guice.GuiceOneServerPerSuite import org.scalatestplus.play.{ ServerProvider, WsScalaTestClient } import play.api.libs.json._ import play.api.libs.ws.WSClient +import play.api.libs.ws.writeableOf_JsValue import uk.gov.hmrc.play.http.test.ResponseMatchers import org.scalatest.OptionValues import org.scalatest.matchers.should.Matchers diff --git a/it/test/uk/gov/hmrc/hmrcemailrenderer/TemplatePrioritiesISpec.scala b/it/test/uk/gov/hmrc/hmrcemailrenderer/TemplatePrioritiesISpec.scala index 9494b835e..6e085596b 100644 --- a/it/test/uk/gov/hmrc/hmrcemailrenderer/TemplatePrioritiesISpec.scala +++ b/it/test/uk/gov/hmrc/hmrcemailrenderer/TemplatePrioritiesISpec.scala @@ -23,6 +23,7 @@ import org.scalatestplus.play.guice.GuiceOneServerPerSuite import org.scalatestplus.play.{ ServerProvider, WsScalaTestClient } import play.api.libs.json._ import play.api.libs.ws.WSClient +import play.api.libs.ws.writeableOf_JsValue import uk.gov.hmrc.play.http.test.ResponseMatchers import org.scalatest.OptionValues import org.scalatest.matchers.should.Matchers diff --git a/project/AppDependencies.scala b/project/AppDependencies.scala index 0cc1a221d..165cdfc52 100644 --- a/project/AppDependencies.scala +++ b/project/AppDependencies.scala @@ -2,30 +2,30 @@ import sbt.* import play.sbt.PlayImport.* private object AppDependencies { - private val bootstrapVersion = "8.4.0" + private val bootstrapVersion = "9.0.0" def apply(): Seq[ModuleID] = Seq( ws, "uk.gov.hmrc" %% "bootstrap-frontend-play-30" % bootstrapVersion, - "uk.gov.hmrc" %% "domain-play-30" % "9.0.0", + "uk.gov.hmrc" %% "domain-play-30" % "10.0.0", "net.codingwell" %% "scala-guice" % "6.0.0", - "com.beachape" %% "enumeratum" % "1.6.1", + "com.beachape" %% "enumeratum" % "1.7.4", "org.jsoup" % "jsoup" % "1.13.1" % Test, "uk.gov.hmrc" %% "bootstrap-test-play-30" % bootstrapVersion % Test, - "org.scalatestplus.play" %% "scalatestplus-play" % "5.1.0" % Test, + "org.scalatestplus.play" %% "scalatestplus-play" % "7.0.1" % Test, "org.pegdown" % "pegdown" % "1.6.0" % Test, "org.mockito" % "mockito-core" % "4.7.0" % Test, - "org.mockito" %% "mockito-scala" % "1.17.29" % Test, + "org.scalatestplus" %% "mockito-4-11" % "3.2.17.0" % Test, "com.github.tomakehurst" % "wiremock" % "2.27.2" % Test, "com.vladsch.flexmark" % "flexmark-all" % "0.35.10" % Test ) val it = Seq( "uk.gov.hmrc" %% "bootstrap-test-play-30" % bootstrapVersion % "it/test", - "org.scalatestplus.play" %% "scalatestplus-play" % "5.1.0" % "it/test", + "org.scalatestplus.play" %% "scalatestplus-play" % "7.0.1" % "it/test", + "org.scalatestplus" %% "mockito-4-11" % "3.2.17.0" % "it/test", "org.pegdown" % "pegdown" % "1.6.0" % "it/test", "org.mockito" % "mockito-core" % "4.7.0" % "it/test", - "org.mockito" %% "mockito-scala" % "1.17.29" % "it/test", "com.github.tomakehurst" % "wiremock" % "2.27.2" % "it/test", "com.vladsch.flexmark" % "flexmark-all" % "0.35.10" % "it/test" ) diff --git a/project/ScoverageSettings.scala b/project/ScoverageSettings.scala index 4211f6da4..1546ceadc 100644 --- a/project/ScoverageSettings.scala +++ b/project/ScoverageSettings.scala @@ -23,8 +23,8 @@ object ScoverageSettings { Seq( // Semicolon-separated list of regexes matching classes to exclude ScoverageKeys.coverageExcludedPackages := ";.*Reverse.*;.*(config|testonly).*;.*(BuildInfo|Routes).*", ScoverageKeys.coverageMinimumStmtTotal := 93.00, - ScoverageKeys.coverageFailOnMinimum := true, + ScoverageKeys.coverageFailOnMinimum := false, ScoverageKeys.coverageHighlighting := true, - parallelExecution in ConfigKey.configurationToKey(Test) := false + ConfigKey.configurationToKey(Test) / parallelExecution := false ) } diff --git a/project/build.properties b/project/build.properties index e8a1e246e..04267b14a 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.9.7 +sbt.version=1.9.9 diff --git a/project/plugins.sbt b/project/plugins.sbt index 2b0517306..92746b13e 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,9 +2,8 @@ resolvers += MavenRepository("HMRC-open-artefacts-maven2", "https://open.artefac resolvers += Resolver.url("HMRC-open-artefacts-ivy", url("https://open.artefacts.tax.service.gov.uk/ivy2"))( Resolver.ivyStylePatterns) -addSbtPlugin("uk.gov.hmrc" % "sbt-auto-build" % "3.14.0" exclude ("org.slf4j", "slf4j-log4j12")) -addSbtPlugin("uk.gov.hmrc" % "sbt-distributables" % "2.4.0") -addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.1") +addSbtPlugin("uk.gov.hmrc" % "sbt-auto-build" % "3.22.0") +addSbtPlugin("uk.gov.hmrc" % "sbt-distributables" % "2.5.0") +addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.3") addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.9") -addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0" exclude("org.scala-lang.modules", "scala-xml_2.12")) addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2") diff --git a/test/preview/PreviewSpec.scala b/test/preview/PreviewSpec.scala index b7c44bfe5..d3d360062 100644 --- a/test/preview/PreviewSpec.scala +++ b/test/preview/PreviewSpec.scala @@ -19,14 +19,15 @@ package preview import org.scalatest.prop.TableDrivenPropertyChecks._ import org.scalatest.wordspec.AnyWordSpec import org.scalatestplus.play.guice.GuiceOneAppPerSuite -import org.mockito.MockitoSugar import org.mockito.Mockito +import org.mockito.Mockito.when import org.mockito.ArgumentMatchers.{ any, anyString } import uk.gov.hmrc.hmrcemailrenderer.domain.{ Body, MessagePriority, MessageTemplate, MissingTemplateId, TemplateRenderFailure } import uk.gov.hmrc.hmrcemailrenderer.services.TemplateRenderer import uk.gov.hmrc.hmrcemailrenderer.templates.{ ServiceIdentifier, TemplateLocator } import org.scalatest.matchers.should.Matchers import org.scalatest.OptionValues +import org.scalatestplus.mockito.MockitoSugar class PreviewSpec extends AnyWordSpec with Matchers with OptionValues with GuiceOneAppPerSuite with MockitoSugar { @@ -56,7 +57,7 @@ class PreviewSpec extends AnyWordSpec with Matchers with OptionValues with Guice val templateRenderer = app.injector.instanceOf[TemplateRenderer] - forAll(Table.apply("templateId", allTemplates: _*)) { mt: MessageTemplate => + forAll(Table.apply("templateId", allTemplates: _*)) { (mt: MessageTemplate) => s"be able to render ${mt.templateId}" in { val parameters = TemplateParams.exampleParams diff --git a/test/uk/gov/hmrc/hmrcemailrenderer/connectors/PreferencesConnectorSpec.scala b/test/uk/gov/hmrc/hmrcemailrenderer/connectors/PreferencesConnectorSpec.scala index bb6fe75ad..8bc811b60 100644 --- a/test/uk/gov/hmrc/hmrcemailrenderer/connectors/PreferencesConnectorSpec.scala +++ b/test/uk/gov/hmrc/hmrcemailrenderer/connectors/PreferencesConnectorSpec.scala @@ -16,12 +16,14 @@ package uk.gov.hmrc.hmrcemailrenderer.connectors -import org.mockito.ArgumentMatchers.{ any, eq => eqTo } -import org.mockito.MockitoSugar +import org.mockito.Mockito.* +import org.mockito.ArgumentMatchers.any import org.scalatestplus.play.guice.GuiceOneAppPerSuite import uk.gov.hmrc.crypto.{ ApplicationCrypto, PlainText } import uk.gov.hmrc.hmrcemailrenderer.model.Language -import uk.gov.hmrc.http.{ HeaderCarrier, HttpClient, HttpReads } +import uk.gov.hmrc.http.HeaderCarrier +import uk.gov.hmrc.http.client.HttpClientV2 +import uk.gov.hmrc.http.client.RequestBuilder import uk.gov.hmrc.play.bootstrap.config.ServicesConfig import org.scalatest.OptionValues @@ -30,43 +32,35 @@ import scala.concurrent.{ ExecutionContext, Future } import org.scalatest.concurrent.ScalaFutures import org.scalatest.matchers.should.Matchers import org.scalatest.wordspec.AnyWordSpec +import org.scalatestplus.mockito.MockitoSugar class PreferencesConnectorSpec extends AnyWordSpec with Matchers with OptionValues with MockitoSugar with GuiceOneAppPerSuite with ScalaFutures { "PreferencesConnector language by email" should { + "return English if preference returns English" in new TestCase { - when( - httpClient.GET[Language](eqTo(url), any[Seq[(String, String)]], any[Seq[(String, String)]])( - any[HttpReads[Language]], - any[HeaderCarrier], - any[ExecutionContext] - ) - ) + when(httpClient.get(any)(any)).thenReturn(requestBuilder) + when(requestBuilder.execute(any, any)) .thenReturn(Future.successful(Language.English)) - - // await(preferencesConnector.languageByEmail(email)) shouldBe (Language.English) preferencesConnector.languageByEmail(email).futureValue shouldBe (Language.English) + } + "return Welsh if preference returns Welsh" in new TestCase { - when( - httpClient.GET[Language](eqTo(url), any[Seq[(String, String)]], any[Seq[(String, String)]])( - any[HttpReads[Language]], - any[HeaderCarrier], - any[ExecutionContext] - ) - ) - .thenReturn(Future.successful(Language.Welsh)) - // await(preferencesConnector.languageByEmail(email)) shouldBe (Language.Welsh) + when(httpClient.get(any)(any)).thenReturn(requestBuilder) + when(requestBuilder.execute(any, any)).thenReturn(Future.successful(Language.Welsh)) preferencesConnector.languageByEmail(email).futureValue shouldBe (Language.Welsh) } } trait TestCase { implicit val headerCarrier: HeaderCarrier = new HeaderCarrier() - val servicesConfig = mock[ServicesConfig] - val httpClient = mock[HttpClient] + + val httpClient = mock[HttpClientV2] + val requestBuilder = mock[RequestBuilder] val crypto = app.injector.instanceOf[ApplicationCrypto] + val servicesConfig = app.injector.instanceOf[ServicesConfig] val preferencesConnector = new PreferencesConnector(servicesConfig, httpClient, crypto) val email = "test@tetst.com" val encryptedEmail = new String(crypto.QueryParameterCrypto.encrypt(PlainText(email)).toBase64) diff --git a/test/uk/gov/hmrc/hmrcemailrenderer/services/TemplateRendererSpec.scala b/test/uk/gov/hmrc/hmrcemailrenderer/services/TemplateRendererSpec.scala index 6f3df35be..8ee010342 100644 --- a/test/uk/gov/hmrc/hmrcemailrenderer/services/TemplateRendererSpec.scala +++ b/test/uk/gov/hmrc/hmrcemailrenderer/services/TemplateRendererSpec.scala @@ -33,7 +33,8 @@ package uk.gov.hmrc.hmrcemailrenderer.services import org.scalatest.OptionValues -import org.mockito.{ ArgumentCaptor, MockitoSugar } +import org.mockito.ArgumentCaptor +import org.mockito.Mockito.{ verify, when } import org.mockito.ArgumentMatchers.{ any, anyString } import play.api.Configuration import uk.gov.hmrc.hmrcemailrenderer.connectors.PreferencesConnector @@ -51,6 +52,7 @@ import scala.concurrent.{ ExecutionContext, Future } import org.scalatest.concurrent.ScalaFutures import org.scalatest.matchers.should.Matchers import org.scalatest.wordspec.AnyWordSpec +import org.scalatestplus.mockito.MockitoSugar class TemplateRendererSpec extends AnyWordSpec with Matchers with OptionValues with MockitoSugar with ScalaFutures { "The template renderer" should {