├── .gitignore ├── .scalafmt.conf ├── LICENSE ├── README.md ├── a11y ├── testUtils │ └── A11ySpec.scala └── views │ └── testSpec.scala ├── app ├── .DS_Store ├── assets │ ├── javascripts │ │ ├── card.js │ │ ├── pertaxBacklink.js │ │ └── webChat.js │ └── stylesheets │ │ ├── _bta-partial.scss │ │ ├── _card.scss │ │ ├── _flexbox.scss │ │ ├── modules │ │ └── _colors.scss │ │ ├── partials │ │ └── _home.scss │ │ └── pertaxMain.scss ├── config │ ├── ApplicationStartUp.scala │ ├── ConfigDecorator.scala │ ├── CryptoProvider.scala │ ├── HmrcModule.scala │ ├── NewsAndTilesConfig.scala │ └── SensitiveT.scala ├── connectors │ ├── AddressLookupConnector.scala │ ├── AgentClientAuthorisationConnector.scala │ ├── BreathingSpaceConnector.scala │ ├── CitizenDetailsConnector.scala │ ├── EnhancedPartialRetriever.scala │ ├── EnrolmentsConnector.scala │ ├── FandFConnector.scala │ ├── HttpClientResponse.scala │ ├── IdentityVerificationFrontendConnector.scala │ ├── PayApiConnector.scala │ ├── PertaxConnector.scala │ ├── PreferencesFrontendConnector.scala │ ├── SeissConnector.scala │ ├── SelfAssessmentConnector.scala │ ├── TaiConnector.scala │ └── UserGroupSearchConnector.scala ├── controllers │ ├── ApplicationController.scala │ ├── AssetsController.scala │ ├── HomeController.scala │ ├── InterstitialController.scala │ ├── LanguageSwitchController.scala │ ├── MessageController.scala │ ├── NiLetterController.scala │ ├── PaperlessPreferencesController.scala │ ├── PaymentsController.scala │ ├── PertaxBaseController.scala │ ├── PublicController.scala │ ├── RlsController.scala │ ├── SaWrongCredentialsController.scala │ ├── SelfAssessmentController.scala │ ├── SessionManagementController.scala │ ├── address │ │ ├── AddressController.scala │ │ ├── AddressErrorController.scala │ │ ├── AddressSelectorController.scala │ │ ├── AddressSubmissionController.scala │ │ ├── ClosePostalAddressController.scala │ │ ├── DoYouLiveInTheUKController.scala │ │ ├── PersonalDetailsController.scala │ │ ├── PostalDoYouLiveInTheUKController.scala │ │ ├── PostcodeLookupController.scala │ │ ├── StartChangeOfAddressController.scala │ │ ├── StartDateController.scala │ │ ├── UpdateAddressController.scala │ │ └── UpdateInternationalAddressController.scala │ ├── auth │ │ ├── AuditTags.scala │ │ ├── AuthJourney.scala │ │ ├── AuthRetrievals.scala │ │ ├── InternalAuthAction.scala │ │ ├── PertaxAuthAction.scala │ │ ├── SelfAssessmentStatusAction.scala │ │ ├── WithBreadcrumbAction.scala │ │ └── requests │ │ │ ├── AuthenticatedRequest.scala │ │ │ └── UserRequest.scala │ ├── bindable │ │ ├── AddrType.scala │ │ ├── Origin.scala │ │ └── package.scala │ ├── controllershelpers │ │ ├── AddressJourneyAuditingHelper.scala │ │ ├── AddressJourneyCachingHelper.scala │ │ ├── CountryHelper.scala │ │ ├── HomeCardGenerator.scala │ │ ├── PaperlessInterruptHelper.scala │ │ ├── RlsInterruptHelper.scala │ │ └── WelshWarningHelper.scala │ └── testOnly │ │ └── FeatureFlagsController.scala ├── error │ ├── ErrorRenderer.scala │ └── LocalErrorHandler.scala ├── models │ ├── Address.scala │ ├── AddressJourneyData.scala │ ├── AddressJourneyTTLModels.scala │ ├── AddressMoved.scala │ ├── AddressesLock.scala │ ├── AgentClientStatus.scala │ ├── BreathingSpaceIndicator.scala │ ├── BreathingSpaceIndicatorResponse.scala │ ├── Country.scala │ ├── DateTuple.scala │ ├── ETag.scala │ ├── EnrolmentStatus.scala │ ├── ErrorView.scala │ ├── ItsaEnrolment.scala │ ├── LocalTaxYearResolver.scala │ ├── MatchingDetails.scala │ ├── MessageCount.scala │ ├── NewsAndContentModel.scala │ ├── PaperlessStatusMessages.scala │ ├── PayApiModels.scala │ ├── PaymentRequest.scala │ ├── Person.scala │ ├── PersonDetails.scala │ ├── PertaxResponse.scala │ ├── ReconciliationStatus.scala │ ├── SaEnrolmentRequest.scala │ ├── SeissModel.scala │ ├── SeissRequest.scala │ ├── SelfAssessmentEnrolment.scala │ ├── SelfAssessmentUserType.scala │ ├── SummaryCardPartial.scala │ ├── TaxComponents.scala │ ├── TaxComponentsState.scala │ ├── UnusedAllowance.scala │ ├── UserAnswers.scala │ ├── UserDetails.scala │ ├── UserName.scala │ ├── addresslookup │ │ ├── Address.scala │ │ ├── AddressLookup.scala │ │ ├── AddressRecord.scala │ │ ├── Country.scala │ │ └── RecordSet.scala │ ├── admin │ │ └── FeatureFlags.scala │ ├── dto │ │ ├── AddressDto.scala │ │ ├── AddressFinderDto.scala │ │ ├── AddressPageVisitedDto.scala │ │ ├── AddressSelectorDto.scala │ │ ├── ClosePostalAddressChoiceDto.scala │ │ ├── DateDto.scala │ │ ├── Dto.scala │ │ ├── InternationalAddressChoiceDto.scala │ │ ├── ResidencyChoiceDto.scala │ │ └── SAWrongCredentialsDto.scala │ ├── enrolments │ │ ├── AccountDetails.scala │ │ ├── EACDEnrolment.scala │ │ ├── EnrolmentEnum.scala │ │ ├── IdentifiersOrVerifiers.scala │ │ ├── IdentityProviderType.scala │ │ ├── KnownFactQueryForNINO.scala │ │ ├── KnownFactResponseForNINO.scala │ │ ├── UsersAssignedEnrolment.scala │ │ └── UsersGroupResponse.scala │ └── models.scala ├── queries │ └── Query.scala ├── repositories │ ├── EditAddressLockRepository.scala │ ├── JourneyCacheRepository.scala │ └── SessionCacheRepository.scala ├── routePages │ ├── AddressFinderPage.scala │ ├── AddressLookupServiceDownPage.scala │ ├── HasAddressAlreadyVisitedPage.scala │ ├── QuestionPage.scala │ ├── SelectedAddressRecordPage.scala │ ├── SelectedRecordSetPage.scala │ ├── SelfAssessmentUserTypePage.scala │ ├── SubmittedAddressPage.scala │ ├── SubmittedInternationalAddressChoicePage.scala │ ├── SubmittedResidencyChoicePage.scala │ └── SubmittedStartDatePage.scala ├── services │ ├── AddressMovedService.scala │ ├── AddressSelectorService.scala │ ├── AgentClientAuthorisationService.scala │ ├── BreathingSpaceService.scala │ ├── CitizenDetailsService.scala │ ├── EnrolmentStoreCachingService.scala │ ├── FandfService.scala │ ├── IdentityVerificationFrontendService.scala │ ├── SeissService.scala │ ├── SelfAssessmentService.scala │ ├── SensitiveFormatService.scala │ ├── TaiService.scala │ └── partials │ │ ├── FormPartialService.scala │ │ ├── MessageFrontendService.scala │ │ ├── SaPartialService.scala │ │ └── TaxCalcPartialService.scala ├── util │ ├── AlertBannerHelper.scala │ ├── AuditServiceTools.scala │ ├── DateTimeTools.scala │ ├── EnrolmentsHelper.scala │ ├── Enumerable.scala │ ├── FormPartialUpgrade.scala │ ├── Formatters.scala │ ├── FutureEarlyTimeout.scala │ ├── LocalDateUtilities.scala │ ├── PertaxSessionKeys.scala │ ├── PertaxValidators.scala │ ├── RateLimiter.scala │ ├── TaxYearRetriever.scala │ ├── TemplateFunctions.scala │ ├── Tools.scala │ └── WithName.scala ├── viewmodels │ ├── AddressRowModel.scala │ ├── AlertBannerViewModel.scala │ ├── HomeViewModel.scala │ ├── PersonalDetailsTableRowModel.scala │ ├── PersonalDetailsViewModel.scala │ └── package.scala └── views │ ├── ErrorView.scala.html │ ├── HomeView.scala.html │ ├── InternalServerErrorView.scala.html │ ├── MainView.scala │ ├── ManualCorrespondenceView.scala.html │ ├── NotFoundView.scala.html │ ├── SelfAssessmentSummaryView.scala.html │ ├── ShutteringView.scala.html │ ├── UnauthenticatedErrorView.scala.html │ ├── UnauthenticatedMainView.scala │ ├── cards │ └── home │ │ ├── ChildBenefitSingleAccountView.scala.html │ │ ├── ItsaMergeView.scala.html │ │ ├── LatestNewsAndUpdatesView.scala.html │ │ ├── MarriageAllowanceView.scala.html │ │ ├── NISPView.scala.html │ │ ├── PayAsYouEarnView.scala.html │ │ ├── SaMergeView.scala.html │ │ ├── SeissView.scala.html │ │ ├── SelfAssessmentRegistrationView.scala.html │ │ ├── TaxCreditsEndedView.scala.html │ │ └── TaxSummariesView.scala.html │ ├── components │ ├── AdditionalJavascript.scala.html │ ├── Button.scala.html │ ├── ErrorSummary.scala.html │ ├── FullWidthMainContent.scala.html │ ├── H1.scala.html │ ├── H2.scala.html │ ├── H3.scala.html │ ├── HeadBlock.scala.html │ ├── InputDate.scala.html │ ├── InputRadios.scala.html │ ├── InputValue.scala.html │ ├── InputYesNo.scala.html │ ├── Link.scala.html │ ├── P.scala.html │ ├── P85Content.scala.html │ └── alertBanner │ │ ├── AlertBanner.scala.html │ │ ├── paperlessStatus │ │ ├── bouncedEmail.scala.html │ │ ├── unverifiedEmail.scala.html │ │ └── voluntaryContributionsAlertView.scala.html │ │ └── peakDemandBanner.scala.html │ ├── interstitial │ ├── CheckYourStatePensionCallBackView.scala.html │ ├── DisplayAddressInterstitialView.scala.html │ ├── SelfAssessmentRegistrationPageView.scala.html │ ├── TaxCreditsEndedInformationInterstitialView.scala.html │ ├── ViewBreathingSpaceView.scala.html │ ├── ViewChildBenefitsSummarySingleAccountInterstitialView.scala.html │ ├── ViewItsaMergePageView.scala.html │ ├── ViewNISPView.scala.html │ ├── ViewNationalInsuranceInterstitialHomeView.scala.html │ └── ViewNewsAndUpdatesView.scala.html │ ├── iv │ ├── failure │ │ ├── CannotConfirmIdentityView.scala.html │ │ ├── FailedIvContinueToActivateSaView.scala.html │ │ ├── FailedIvIncompleteView.scala.html │ │ ├── FailedIvSaFilerWithNoEnrolmentView.scala.html │ │ ├── LockedOutView.scala.html │ │ ├── TechnicalIssuesView.scala.html │ │ ├── TimeOutView.scala.html │ │ └── TwoFaFailIvSuccessView.scala.html │ ├── start │ │ └── ivStartPage.scala.html │ └── success │ │ └── SuccessView.scala.html │ ├── message │ ├── MessageDetailView.scala.html │ └── MessageInboxView.scala.html │ ├── personaldetails │ ├── AddressAlreadyUpdatedView.scala.html │ ├── AddressSelectorView.scala.html │ ├── CannotUpdateAddressEarlyDateView.scala.html │ ├── CannotUpdateAddressFutureDateView.scala.html │ ├── CannotUseServiceView.scala.html │ ├── CheckYourAddressInterruptView.scala.html │ ├── CloseCorrespondenceAddressChoiceView.scala.html │ ├── ConfirmCloseCorrespondenceAddressView.scala.html │ ├── EnterStartDateView.scala.html │ ├── InternationalAddressChoiceView.scala.html │ ├── PersonalDetailsView.scala.html │ ├── PostcodeLookupView.scala.html │ ├── ReviewChangesView.scala.html │ ├── StartChangeOfAddressView.scala.html │ ├── UpdateAddressConfirmationView.scala.html │ ├── UpdateAddressView.scala.html │ ├── UpdateInternationalAddressView.scala.html │ └── partials │ │ ├── AddressUnavailableView.scala.html │ │ ├── AddressView.scala.html │ │ └── CorrespondenceAddressView.scala.html │ ├── preferences │ └── managePrefs.scala.html │ ├── print │ └── NiLetterView.scala.html │ ├── public │ └── SessionTimeoutView.scala.html │ ├── selfassessment │ ├── DoYouKnowOtherCredentialsView.scala.html │ ├── DoYouKnowUserIdView.scala.html │ ├── FindYourUserIdView.scala.html │ ├── NeedToResetPasswordView.scala.html │ ├── RequestAccessToSelfAssessmentView.scala.html │ ├── Sa302InterruptView.scala.html │ ├── SignInAgainView.scala.html │ ├── SignedInWrongAccountView.scala.html │ ├── selfAssessmentForm.scala.html │ ├── selfAssessmentHeading.scala.html │ └── selfAssessmentUtr.scala.html │ └── tags │ ├── card.scala.html │ ├── cardHelper.scala.html │ ├── cardNewsAndUpdates.scala.html │ ├── formattedNino.scala.html │ ├── fullAddress.scala.html │ └── gaTrackAnchorEventTranslateLabel.scala.html ├── build.sbt ├── conf ├── admin.routes ├── application.conf ├── logback.xml ├── messages ├── messages.cy ├── no-logger.xml ├── prod.routes └── testOnlyDoNotUseInAppConf.routes ├── it └── test │ ├── MainViewSpec.scala │ ├── address │ ├── PersonalDetailsControllerSpec.scala │ └── RLSInterruptPageSpec.scala │ ├── controllers │ ├── ContentsCheckSpec.scala │ ├── HomeControllerAlertBannerISpec.scala │ ├── HomeControllerBreathingSpaceISpec.scala │ ├── HomeControllerChildBenefitsISpec.scala │ ├── HomeControllerErrorISpec.scala │ ├── HomeControllerFeedbackISpec.scala │ ├── HomeControllerMarriageAllowanceISpec.scala │ ├── HomeControllerMciISpec.scala │ ├── HomeControllerNISPISpec.scala │ ├── HomeControllerPayeISpec.scala │ ├── HomeControllerScaISpec.scala │ ├── HomeControllerSelfAssessmentISpec.scala │ ├── HomeControllerTrustedHelperISpec.scala │ ├── HomeControllerWebChatISpec.scala │ ├── PersonalDetailsControllerItSpec.scala │ ├── PostcodeLookupControllerISpec.scala │ ├── TimeoutsISpec.scala │ └── auth │ │ └── AuthJourneyItSpec.scala │ ├── repositories │ └── CachingItSpec.scala │ ├── resources │ ├── citizen-details.json │ ├── dashboard-data.json │ ├── person-details.json │ ├── reconciliations.json │ └── tax-components.json │ └── testUtils │ ├── FileHelper.scala │ ├── IntegrationSpec.scala │ └── WireMockHelper.scala ├── local-portal ├── running-local-portal.md ├── startLocalPortal.sh └── stopLocalPortal.sh ├── project ├── AppDependencies.scala ├── build.properties └── plugins.sbt ├── public ├── css │ ├── applicationMin.css │ └── ie.css └── images │ ├── HMRC-logo.jpg │ ├── HMRC-logo.png │ ├── covid-icon.png │ ├── covid-icon.svg │ ├── print-icon.png │ └── tick.png ├── repository.yaml ├── scalastyle-config.xml └── test ├── config ├── ConfigDecoratorSpec.scala └── NewsAndTilesConfigSpec.scala ├── connectors ├── AddressLookupConnectorSpec.scala ├── BreathingSpaceConnectorSpec.scala ├── CachingAgentClientAuthorisationConnectorSpec.scala ├── CachingCitizenDetailsConnectorSpec.scala ├── CitizenDetailsConnectorSpec.scala ├── ConnectorSpec.scala ├── DefaultAgentClientAuthorisationConnectorSpec.scala ├── EnhancedPartialRetrieverSpec.scala ├── EnrolmentsConnectorSpec.scala ├── FandFConnectorSpec.scala ├── HttpClientResponseSpec.scala ├── IdentityVerificationFrontendConnectorSpec.scala ├── PayApiConnectorSpec.scala ├── PertaxConnectorSpec.scala ├── PreferencesFrontendConnectorSpec.scala ├── SeissConnectorSpec.scala ├── SelfAssessmentConnectorSpec.scala ├── TaiConnectorSpec.scala └── UsersGroupsSearchConnectorSpec.scala ├── controllers ├── ApplicationControllerSpec.scala ├── HomeControllerSpec.scala ├── InterstitialControllerSpec.scala ├── LanguageControllerSpec.scala ├── MessageControllerSpec.scala ├── NiLetterControllerSpec.scala ├── PaperlessPreferencesControllerSpec.scala ├── PaymentsControllerSpec.scala ├── PertaxBaseControllerSpec.scala ├── PublicControllerSpec.scala ├── RlsControllerSpec.scala ├── SaWrongCredentialsControllerSpec.scala ├── SelfAssessmentControllerSpec.scala ├── SessionManagementControllerSpec.scala ├── address │ ├── AddressBaseSpec.scala │ ├── AddressControllerSpec.scala │ ├── AddressErrorControllerSpec.scala │ ├── AddressSelectorControllerSpec.scala │ ├── AddressSubmissionControllerSpec.scala │ ├── ClosePostalAddressControllerSpec.scala │ ├── DoYouLiveInTheUKControllerSpec.scala │ ├── PersonalDetailsControllerSpec.scala │ ├── PostalDoYouLiveInTheUKControllerSpec.scala │ ├── PostcodeLookupControllerSpec.scala │ ├── StartChangeOfAddressControllerSpec.scala │ ├── StartDateControllerSpec.scala │ ├── UpdateAddressControllerSpec.scala │ └── UpdateInternationalAddressControllerSpec.scala ├── auth │ ├── AuthRetrievalsSpec.scala │ ├── PertaxAuthActionSpec.scala │ ├── SelfAssessmentStatusActionSpec.scala │ └── requests │ │ └── UserRequestSpec.scala ├── bindable │ └── OriginSpec.scala └── controllershelpers │ ├── HomeCardGeneratorSpec.scala │ ├── PaperlessInterruptHelperSpec.scala │ └── RlsInterruptHelperSpec.scala ├── error └── LocalErrorHandlerSpec.scala ├── models ├── AddressJourneyDataSpec.scala ├── DateTupleSpec.scala ├── EtagSpec.scala ├── ModelsSpec.scala ├── PayApiModelsSpec.scala ├── PersonDetailsSpec.scala ├── SelfAssessmentUserTypeSpec.scala ├── SummaryCardPartialSpec.scala ├── TaxCalculationStateSpec.scala ├── TaxComponentsSpec.scala ├── UserAnswersSpec.scala ├── addressLookup │ ├── AddressRecordSpec.scala │ ├── AddressSpec.scala │ └── RecordSetSpec.scala └── dto │ ├── AddressDtoSpec.scala │ ├── AddressFinderDtoSpec.scala │ └── DateDtoSpec.scala ├── repositories ├── EditAddressLockRepositorySpec.scala ├── JourneyCacheRepositorySpec.scala └── SessionCacheRepositorySpec.scala ├── resources ├── address-lookup │ ├── recordSet.json │ └── recordSetWithMissingAddressLines.json ├── application.conf ├── paperless-status │ ├── PaperlessStatusAlright.json │ └── PaperlessStatusBounced.json └── tcs │ └── dashboard-data.json ├── services ├── AddressMovedServiceSpec.scala ├── AddressSelectorServiceSpec.scala ├── BreathingSpaceServiceSpec.scala ├── CitizenDetailsServiceSpec.scala ├── EnrolmentStoreCachingServiceSpec.scala ├── FandfServiceSpec.scala ├── FormPartialServiceSpec.scala ├── IdentityVerificationFrontendServiceSpec.scala ├── MessageFrontendServiceSpec.scala ├── SeissServiceSpec.scala ├── SelfAssessmentServiceSpec.scala ├── SensitiveFormatServiceSpec.scala ├── TaiServiceSpec.scala └── TaxCalcPartialServiceSpec.scala ├── testUtils ├── Addresses.scala ├── BaseSpec.scala ├── BetterOptionValues.scala ├── FileHelper.scala ├── Fixtures.scala ├── NullMetrics.scala ├── RetrievalOps.scala ├── UserRequestFixture.scala ├── WireMockHelper.scala ├── fakes │ ├── FakeAuthJourney.scala │ ├── FakePaperlessInterruptHelper.scala │ └── FakeRlsInterruptHelper.scala └── fixtures │ ├── AddressFixture.scala │ └── PersonFixture.scala ├── util ├── AlertBannerHelperSpec.scala ├── DateTimeToolsSpec.scala ├── EnrolmentsHelperSpec.scala ├── FormPartialUpgradeSpec.scala ├── LocalDateUtilitiesSpec.scala ├── MessagesSpec.scala ├── PertaxValidatorsSpec.scala ├── RateLimiterSpec.scala ├── TemplateFunctionSpec.scala └── ToolsSpec.scala ├── viewmodels ├── AddressRowModelSpec.scala ├── HomeViewModelSpec.scala └── PersonalDetailsViewModelSpec.scala └── views └── html ├── HomeViewSpec.scala ├── ViewSpec.scala ├── address ├── PostalInternationalAddressChoiceViewSpec.scala └── ReviewChangesViewSpec.scala ├── cards ├── ChildBenefitSingleAccountViewSpec.scala ├── ItsaMergeViewSpec.scala ├── LatestNewsAndUpdatesViewSpec.scala ├── NISPViewSpec.scala └── SaMergeViewSpec.scala ├── interstitial ├── TaxCreditsEndedInformationInterstitialViewSpec.scala ├── ViewBreathingSpaceViewSpec.scala ├── ViewChildBenefitsSummarySingleAccountInterstitialViewSpec.scala ├── ViewItsaMergePageViewSpec.scala ├── ViewNISPViewSpec.scala ├── ViewNationalInsuranceInterstitialHomeViewSpec.scala └── ViewNewsAndUpdatesViewSpec.scala └── personaldetails └── StartChangeOfAddressViewSpec.scala /.gitignore: -------------------------------------------------------------------------------- 1 | .* 2 | 3 | !.gitignore 4 | 5 | .cache 6 | /.classpath 7 | db 8 | dist 9 | .DS_Store 10 | **/*.DS_Store 11 | eclipse 12 | *.eml 13 | .history 14 | .idea 15 | /.idea_modules 16 | *.iml 17 | lib 18 | lib_managed 19 | log 20 | logs 21 | modules 22 | /out 23 | precompiled 24 | /.project 25 | project/project 26 | project/target 27 | /RUNNING_PID 28 | server.pid 29 | /.settings 30 | target 31 | .target 32 | test-result 33 | tmp 34 | .idea_modules 35 | bin 36 | node_modules 37 | -------------------------------------------------------------------------------- /.scalafmt.conf: -------------------------------------------------------------------------------- 1 | version = 2.7.1 2 | runner.dialect = scala212 3 | maxColumn = 120 4 | lineEndings = unix 5 | importSelectors = singleLine 6 | 7 | project { 8 | git = true 9 | } 10 | 11 | align { 12 | preset = most 13 | tokens = [ {code = "=>", owner = "Case|Type.Arg.ByName"}, "=", "<-", "->", "%", "%%", "should", "shouldBe", "shouldEqual", "shouldNot", "must" ] 14 | arrowEnumeratorGenerator = true 15 | openParenCallSite = false 16 | openParenDefnSite = false 17 | } 18 | 19 | binPack { 20 | parentConstructors = false 21 | } 22 | 23 | continuationIndent { 24 | callSite = 2 25 | defnSite = 2 26 | } 27 | 28 | newlines { 29 | penalizeSingleSelectMultiArgList = false 30 | sometimesBeforeColonInMethodReturnType = true 31 | } 32 | 33 | rewrite { 34 | rules = [RedundantBraces, RedundantParens, AsciiSortImports] 35 | redundantBraces { 36 | maxLines = 100 37 | includeUnitMethods = true 38 | stringInterpolation = true 39 | } 40 | } 41 | 42 | spaces { 43 | inImportCurlyBraces = false 44 | beforeContextBoundColon = Never 45 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #### pertax-frontend 2 | 3 | This is the repository for the Personal Tax Account (PTA) frontend project. 4 | 5 | ## To run locally 6 | 7 | ```sh 8 | ## Update service manager config. 9 | cd $WORKSPACE/service-manager-config && git pull 10 | 11 | ## Prepare MongoDB for take-off by increasing `ulimit` … 🚀 12 | sudo launchctl limit maxfiles 65536 200000 13 | 14 | ## Clone the repo. 15 | cd $WORKSPACE 16 | git clone git@github.com:hmrc/pertax-frontend.git 17 | 18 | ## Start the services and stop the frontend. 19 | sm --start PTA_ALL -r 20 | sm --stop PERTAX_FRONTEND 21 | 22 | ## Run tests and then run the service. 23 | cd $WORKSPACE/pertax-frontend 24 | sbt -mem 6699 test 25 | sbt -mem 6699 'run 9232' 26 | 27 | ## Service is now running at http://localhost:9232/personal-account/ 28 | ``` 29 | 30 | ## License 31 | 32 | This code is open source software licensed under the [Apache 2.0 License]("http://www.apache.org/licenses/LICENSE-2.0.html") 33 | -------------------------------------------------------------------------------- /app/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hmrc/pertax-frontend/f03aaaa032caeeb3d0a1f6c329f9e8f098b74397/app/.DS_Store -------------------------------------------------------------------------------- /app/assets/javascripts/pertaxBacklink.js: -------------------------------------------------------------------------------- 1 | /* global $ */ 2 | // ===================================================== 3 | // Back link mimics browser back functionality 4 | // ===================================================== 5 | // store referrer value to cater for IE - https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10474810/ */ 6 | var docReferrer = document.referrer; 7 | // prevent resubmit warning 8 | if ( 9 | window.history && 10 | window.history.replaceState && 11 | typeof window.history.replaceState === 'function' 12 | ) { 13 | window.history.replaceState(null, null, window.location.href); 14 | } 15 | // back click handle, dependent upon presence of referrer & no host change 16 | const backlink = document.getElementById('back-link'); 17 | 18 | if(backlink != null && backlink != 'undefined' ) { 19 | backlink.addEventListener('click', function (e) { 20 | e.preventDefault(); 21 | if ( 22 | window.history && 23 | window.history.back && 24 | typeof window.history.back === 'function' && 25 | docReferrer !== '' && 26 | docReferrer.indexOf(window.location.host) !== -1 27 | ) { 28 | window.history.back(); 29 | } 30 | }); 31 | } -------------------------------------------------------------------------------- /app/assets/javascripts/webChat.js: -------------------------------------------------------------------------------- 1 | /* global $ */ 2 | //Webchat automatic popup 3 | function offerChat(chatId) { 4 | (function (e, f) { 5 | var d, 6 | c, 7 | b, 8 | a = e.createElement('iframe'); 9 | a.src = 'about:blank'; 10 | a.title = ''; 11 | a.id = 'egot_iframe'; 12 | (a.frameElement || a).style.cssText = 'width:0;height:0;border:0'; 13 | b = e.getElementsByTagName('script'); 14 | b = b[b.length - 1]; 15 | b.parentNode.insertBefore(a, b); 16 | try { 17 | c = a.contentWindow.document; 18 | } catch (g) { 19 | (d = e.domain), 20 | (a.src = 21 | "javascript:var d=document.open();d.domain='" + d + "';void(0);"), 22 | (c = a.contentWindow.document); 23 | } 24 | c.open()._d = function () { 25 | var a = this.createElement('script'); 26 | d && (this.domain = d); 27 | a.src = f; 28 | this.isEGFIF = !0; 29 | this.body.appendChild(a); 30 | }; 31 | c.write(''); 32 | c.close(); 33 | })(document, '//analytics.analytics-egain.com/onetag/' + chatId); 34 | } 35 | 36 | //Webchat click to chat 37 | document.addEventListener("DOMContentLoaded", function(event) { 38 | if (typeof openChat !== 'undefined') { 39 | $('.webchat-container').css({ display: 'block' }); 40 | $('.openChat').click(openChat); 41 | } 42 | }); 43 | -------------------------------------------------------------------------------- /app/assets/stylesheets/_bta-partial.scss: -------------------------------------------------------------------------------- 1 | .button--payment, 2 | .button--payment:visited { 3 | background-color: $govuk-blue; 4 | } 5 | 6 | .button--payment:hover, 7 | .button--payment:focus { 8 | background-color: darken( $govuk-blue, 5% ); 9 | } 10 | 11 | .button--payment:active { 12 | box-shadow: 0 0 0 $govuk-blue; 13 | top: 2px; 14 | } 15 | -------------------------------------------------------------------------------- /app/assets/stylesheets/_flexbox.scss: -------------------------------------------------------------------------------- 1 | .flex-container { 2 | display: flex; 3 | flex-direction: row; 4 | flex-wrap: wrap; 5 | justify-content: flex-start; 6 | } 7 | -------------------------------------------------------------------------------- /app/assets/stylesheets/modules/_colors.scss: -------------------------------------------------------------------------------- 1 | $govuk-blue: #005ea5; 2 | $grey-1: #6f777b; 3 | $grey-2: #bfc1c3; 4 | $grey-4: #f8f8f8; 5 | $light-blue: #2b8cc4; 6 | $link-colour: $govuk-blue; 7 | $black: #0b0c0c; 8 | $white: #fff; 9 | $panel-colour: #dee0e2; 10 | $secondary-text-colour: $grey-1; 11 | $page-colour: $white; 12 | -------------------------------------------------------------------------------- /app/assets/stylesheets/partials/_home.scss: -------------------------------------------------------------------------------- 1 | .pertax-home { 2 | a, p { 3 | font-size: 16px; 4 | } 5 | 6 | a { 7 | 8 | &:hover { 9 | text-decoration: underline; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /app/assets/stylesheets/pertaxMain.scss: -------------------------------------------------------------------------------- 1 | $govuk-include-default-font-face: false; 2 | @import "modules/colors"; 3 | @import "card"; 4 | @import "flexbox"; 5 | @import "partials/home"; 6 | 7 | address { 8 | font-style: normal; 9 | } 10 | 11 | .nino > span { 12 | margin-right: 5px; 13 | } 14 | 15 | .yourProfileExtraLink { 16 | display: block; 17 | margin-top: 1em; 18 | } 19 | -------------------------------------------------------------------------------- /app/config/ApplicationStartUp.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package config 18 | 19 | import models.admin._ 20 | import uk.gov.hmrc.mongoFeatureToggles.model.FeatureFlagNamesLibrary 21 | 22 | class ApplicationStartUp { 23 | FeatureFlagNamesLibrary.addFlags(AllFeatureFlags.list) 24 | } 25 | -------------------------------------------------------------------------------- /app/config/CryptoProvider.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package config 18 | 19 | import play.api.Configuration 20 | import uk.gov.hmrc.crypto.{ApplicationCrypto, Decrypter, Encrypter} 21 | 22 | import javax.inject.{Inject, Provider, Singleton} 23 | 24 | @Singleton 25 | class CryptoProvider @Inject() ( 26 | configuration: Configuration 27 | ) extends Provider[Encrypter with Decrypter] { 28 | 29 | override def get(): Encrypter with Decrypter = 30 | new ApplicationCrypto(configuration.underlying).JsonCrypto 31 | } 32 | -------------------------------------------------------------------------------- /app/config/SensitiveT.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package config 18 | 19 | import uk.gov.hmrc.crypto.Sensitive 20 | 21 | case class SensitiveT[T](override val decryptedValue: T) extends Sensitive[T] 22 | -------------------------------------------------------------------------------- /app/controllers/AssetsController.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package controllers 18 | 19 | import com.google.inject.Inject 20 | import error.LocalErrorHandler 21 | import play.api.Environment 22 | 23 | class AssetsController @Inject() ( 24 | localErrorHandler: LocalErrorHandler, 25 | assetsMetaData: AssetsMetadata, 26 | environment: Environment 27 | ) extends AssetsBuilder(localErrorHandler, assetsMetaData, environment) 28 | -------------------------------------------------------------------------------- /app/controllers/LanguageSwitchController.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package controllers 18 | 19 | import com.google.inject.Inject 20 | import config.ConfigDecorator 21 | import play.api.i18n.Lang 22 | import play.api.mvc.{Action, AnyContent, ControllerComponents} 23 | import uk.gov.hmrc.play.language.{LanguageController, LanguageUtils} 24 | 25 | class LanguageSwitchController @Inject() ( 26 | configDecorator: ConfigDecorator, 27 | languageUtils: LanguageUtils, 28 | cc: ControllerComponents 29 | ) extends LanguageController(languageUtils, cc) { 30 | 31 | def enGb(): Action[AnyContent] = switchToLanguage(language = "english") 32 | def cyGb(): Action[AnyContent] = switchToLanguage(language = "cymraeg") 33 | def fallbackURL: String = configDecorator.personalAccount 34 | def languageMap: Map[String, Lang] = Map( 35 | "english" -> Lang("en"), 36 | "cymraeg" -> Lang("cy") 37 | ) 38 | 39 | } 40 | -------------------------------------------------------------------------------- /app/controllers/SessionManagementController.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package controllers 18 | 19 | import com.google.inject.Inject 20 | import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} 21 | import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendController 22 | 23 | class SessionManagementController @Inject() (mcc: MessagesControllerComponents) extends FrontendController(mcc) { 24 | 25 | def keepAlive: Action[AnyContent] = Action { 26 | Ok("") 27 | } 28 | 29 | def timeOut: Action[AnyContent] = Action { 30 | Redirect(routes.PublicController.sessionTimeout).withNewSession 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/controllers/auth/AuditTags.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package controllers.auth 18 | 19 | import play.api.mvc.Request 20 | import uk.gov.hmrc.http.HeaderCarrier 21 | 22 | private[auth] trait AuditTags { 23 | def buildTags(request: Request[_])(implicit hc: HeaderCarrier): Map[String, String] = 24 | Map( 25 | "X-Request-Id" -> hc.requestId.map(_.value).getOrElse(""), 26 | "X-Session-Id" -> hc.sessionId.map(_.value).getOrElse(""), 27 | "path" -> request.path, 28 | "clientIP" -> hc.trueClientIp.getOrElse(""), 29 | "clientPort" -> hc.trueClientPort.getOrElse(""), 30 | "type" -> "Audit" 31 | ) 32 | } 33 | -------------------------------------------------------------------------------- /app/controllers/auth/AuthJourney.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package controllers.auth 18 | 19 | import com.google.inject.{ImplementedBy, Inject} 20 | import controllers.auth.requests.UserRequest 21 | import play.api.mvc.{ActionBuilder, AnyContent, DefaultActionBuilder} 22 | 23 | @ImplementedBy(classOf[AuthJourneyImpl]) 24 | trait AuthJourney { 25 | def authWithPersonalDetails: ActionBuilder[UserRequest, AnyContent] 26 | } 27 | 28 | class AuthJourneyImpl @Inject() ( 29 | authAction: AuthRetrievals, 30 | selfAssessmentStatusAction: SelfAssessmentStatusAction, 31 | pertaxAuthAction: PertaxAuthAction, 32 | defaultActionBuilder: DefaultActionBuilder 33 | ) extends AuthJourney { 34 | 35 | def authWithPersonalDetails: ActionBuilder[UserRequest, AnyContent] = 36 | defaultActionBuilder andThen pertaxAuthAction andThen authAction andThen selfAssessmentStatusAction 37 | 38 | } 39 | -------------------------------------------------------------------------------- /app/controllers/auth/InternalAuthAction.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package controllers.auth 18 | 19 | import com.google.inject.Inject 20 | import config.ConfigDecorator 21 | import play.api.Logging 22 | import uk.gov.hmrc.internalauth.client.Predicate.Permission 23 | import uk.gov.hmrc.internalauth.client._ 24 | 25 | import scala.concurrent.ExecutionContext 26 | 27 | class InternalAuthAction @Inject() ( 28 | configDecorator: ConfigDecorator, 29 | internalAuth: BackendAuthComponents 30 | )(implicit 31 | val executionContext: ExecutionContext 32 | ) extends Logging { 33 | 34 | private val permission: Permission = 35 | Permission( 36 | resource = Resource( 37 | resourceType = ResourceType(configDecorator.internalAuthResourceType), 38 | resourceLocation = ResourceLocation("*") 39 | ), 40 | action = IAAction("ADMIN") 41 | ) 42 | 43 | def apply() = 44 | internalAuth.authorizedAction(permission, Retrieval.username) 45 | } 46 | -------------------------------------------------------------------------------- /app/controllers/auth/requests/AuthenticatedRequest.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package controllers.auth.requests 18 | 19 | import models.UserAnswers 20 | import play.api.mvc.{Request, WrappedRequest} 21 | import uk.gov.hmrc.auth.core.retrieve.Credentials 22 | import uk.gov.hmrc.auth.core.retrieve.v2.TrustedHelper 23 | import uk.gov.hmrc.auth.core.{AffinityGroup, ConfidenceLevel, Enrolment} 24 | import uk.gov.hmrc.domain.Nino 25 | 26 | case class AuthenticatedRequest[A]( 27 | authNino: Nino, 28 | credentials: Credentials, 29 | confidenceLevel: ConfidenceLevel, 30 | trustedHelper: Option[TrustedHelper], 31 | profile: Option[String], 32 | enrolments: Set[Enrolment], 33 | request: Request[A], 34 | affinityGroup: Option[AffinityGroup], 35 | userAnswers: UserAnswers 36 | ) extends WrappedRequest[A](request) 37 | -------------------------------------------------------------------------------- /app/controllers/bindable/package.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package controllers 18 | 19 | import play.api.mvc.PathBindable 20 | 21 | package object bindable { 22 | 23 | implicit def addrTypeBinder: PathBindable[AddrType] = new PathBindable[AddrType] { 24 | 25 | def bind(key: String, value: String): Either[String, AddrType] = 26 | AddrType(value).map(Right(_)).getOrElse(Left("Invalid address type in path")) 27 | 28 | def unbind(key: String, addrType: AddrType): String = addrType.toString 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/controllers/controllershelpers/WelshWarningHelper.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package controllers.controllershelpers 18 | 19 | object WelshWarningHelper { 20 | 21 | def usingWelsh(implicit messages: play.api.i18n.Messages): Boolean = messages.lang.code == "cy" 22 | } 23 | -------------------------------------------------------------------------------- /app/models/AddressJourneyData.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models 18 | 19 | import models.addresslookup.{AddressRecord, RecordSet} 20 | import models.dto._ 21 | 22 | case class AddressJourneyData( 23 | addressPageVisitedDto: Option[AddressPageVisitedDto], 24 | residencyChoiceDto: Option[ResidencyChoiceDto], 25 | recordSet: Option[RecordSet], 26 | addressFinderDto: Option[AddressFinderDto], 27 | selectedAddressRecord: Option[AddressRecord], 28 | submittedAddressDto: Option[AddressDto], 29 | submittedInternationalAddressChoiceDto: Option[InternationalAddressChoiceDto], 30 | submittedStartDateDto: Option[DateDto], 31 | addressLookupServiceDown: Boolean 32 | ) { 33 | def getAddressToDisplay: Option[AddressDto] = 34 | submittedAddressDto match { 35 | case Some(s) => Some(s) 36 | case None => 37 | selectedAddressRecord match { 38 | case Some(y) => Some(AddressDto.fromAddressRecord(y)) 39 | case None => None 40 | } 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /app/models/AddressMoved.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models 18 | 19 | sealed trait AddressChanged 20 | object MovedToScotland extends AddressChanged 21 | object MovedFromScotland extends AddressChanged 22 | object AnyOtherMove extends AddressChanged 23 | -------------------------------------------------------------------------------- /app/models/AddressesLock.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models 18 | 19 | case class AddressesLock(main: Boolean, postal: Boolean) 20 | -------------------------------------------------------------------------------- /app/models/AgentClientStatus.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models 18 | 19 | import play.api.libs.json.{Json, OFormat} 20 | 21 | case class AgentClientStatus( 22 | hasPendingInvitations: Boolean, 23 | hasInvitationsHistory: Boolean, 24 | hasExistingRelationships: Boolean 25 | ) 26 | 27 | object AgentClientStatus { 28 | implicit val formats: OFormat[AgentClientStatus] = Json.format[AgentClientStatus] 29 | } 30 | -------------------------------------------------------------------------------- /app/models/BreathingSpaceIndicator.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models 18 | 19 | import play.api.libs.json.{Json, OFormat} 20 | 21 | case class BreathingSpaceIndicator(breathingSpaceIndicator: Boolean) 22 | 23 | object BreathingSpaceIndicator { 24 | implicit val formats: OFormat[BreathingSpaceIndicator] = Json.format[BreathingSpaceIndicator] 25 | } 26 | -------------------------------------------------------------------------------- /app/models/BreathingSpaceIndicatorResponse.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models 18 | 19 | sealed trait BreathingSpaceIndicatorResponse 20 | object BreathingSpaceIndicatorResponse { 21 | case object WithinPeriod extends BreathingSpaceIndicatorResponse // true status 22 | case object OutOfPeriod extends BreathingSpaceIndicatorResponse // false status 23 | case object NotFound extends BreathingSpaceIndicatorResponse // not found response 24 | case object StatusUnknown 25 | extends BreathingSpaceIndicatorResponse // all others including feature disabled and exceptions 26 | 27 | def fromBoolean(b: Boolean): BreathingSpaceIndicatorResponse = 28 | if (b) WithinPeriod else OutOfPeriod 29 | } 30 | -------------------------------------------------------------------------------- /app/models/Country.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models 18 | 19 | import play.api.libs.json.{Json, OFormat} 20 | 21 | object Country { 22 | implicit val formats: OFormat[Country] = Json.format[Country] 23 | } 24 | case class Country(countryName: String) 25 | -------------------------------------------------------------------------------- /app/models/ETag.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models 18 | 19 | import play.api.libs.json.{Json, Reads} 20 | 21 | case class ETag(etag: String) 22 | 23 | object ETag { 24 | implicit lazy val reads: Reads[ETag] = Json.reads[ETag] 25 | } 26 | -------------------------------------------------------------------------------- /app/models/EnrolmentStatus.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models 18 | 19 | sealed trait EnrolmentStatus 20 | case object Activated extends EnrolmentStatus 21 | case object NotYetActivated extends EnrolmentStatus 22 | -------------------------------------------------------------------------------- /app/models/ErrorView.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models 18 | 19 | import play.api.libs.json.{Json, OFormat} 20 | 21 | case class ErrorView(url: String, statusCode: Int) 22 | 23 | object ErrorView { 24 | implicit val format: OFormat[ErrorView] = Json.format[ErrorView] 25 | } 26 | -------------------------------------------------------------------------------- /app/models/ItsaEnrolment.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models 18 | 19 | trait ItsaEnrolment 20 | 21 | case class ItsaEnrolmentEnrolled(status: EnrolmentStatus) extends ItsaEnrolment 22 | -------------------------------------------------------------------------------- /app/models/LocalTaxYearResolver.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models 18 | 19 | import com.google.inject.{Inject, Singleton} 20 | import config.ConfigDecorator 21 | import uk.gov.hmrc.time.CurrentTaxYear 22 | 23 | import java.time.LocalDate 24 | @Singleton 25 | class LocalTaxYearResolver @Inject() (val configDecorator: ConfigDecorator) extends CurrentTaxYear { 26 | 27 | override lazy val now: () => LocalDate = () => { 28 | configDecorator.currentLocalDate 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/models/MatchingDetails.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models 18 | 19 | import play.api.libs.json.JsValue 20 | import uk.gov.hmrc.domain.SaUtr 21 | 22 | case class MatchingDetails(saUtr: Option[SaUtr]) 23 | 24 | object MatchingDetails { 25 | def fromJsonMatchingDetails(matchingDetails: JsValue): MatchingDetails = 26 | MatchingDetails((matchingDetails \ "ids" \ "sautr").asOpt[String].map(SaUtr.apply)) 27 | } 28 | -------------------------------------------------------------------------------- /app/models/MessageCount.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models 18 | 19 | import play.api.libs.json.{Json, OFormat} 20 | 21 | case class MessageCount(count: Int) 22 | object MessageCount { 23 | implicit val formats: OFormat[MessageCount] = Json.format[MessageCount] 24 | } 25 | -------------------------------------------------------------------------------- /app/models/NewsAndContentModel.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models 18 | 19 | import java.time.LocalDate 20 | 21 | case class NewsAndContentModel( 22 | newsSectionName: String, 23 | shortDescription: String, 24 | content: String, 25 | isDynamic: Boolean, 26 | startDate: LocalDate 27 | ) 28 | -------------------------------------------------------------------------------- /app/models/PayApiModels.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models 18 | 19 | import play.api.libs.json.{Json, OFormat} 20 | 21 | final case class PayApiModels(journeyId: String, nextUrl: String) 22 | 23 | object PayApiModels { 24 | implicit val format: OFormat[PayApiModels] = Json.format[PayApiModels] 25 | } 26 | -------------------------------------------------------------------------------- /app/models/PaymentRequest.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models 18 | 19 | import config.ConfigDecorator 20 | import play.api.libs.json.{JsValue, Json, OFormat, Writes} 21 | import play.api.libs.ws.BodyWritable 22 | 23 | case class PaymentRequest(utr: String, returnUrl: String, backUrl: String) 24 | 25 | object PaymentRequest { 26 | def apply(configDecorator: ConfigDecorator, utr: String): PaymentRequest = { 27 | val homePageUrl = configDecorator.pertaxFrontendBackLink 28 | PaymentRequest(utr, homePageUrl, homePageUrl) 29 | } 30 | 31 | implicit val format: OFormat[PaymentRequest] = Json.format[PaymentRequest] 32 | 33 | implicit def jsonBodyWritable[T](implicit 34 | writes: Writes[T], 35 | jsValueBodyWritable: BodyWritable[JsValue] 36 | ): BodyWritable[T] = jsValueBodyWritable.map(writes.writes) 37 | } 38 | -------------------------------------------------------------------------------- /app/models/Person.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models 18 | 19 | import play.api.libs.json._ 20 | import uk.gov.hmrc.domain.Nino 21 | 22 | import java.time.LocalDate 23 | 24 | case class Person( 25 | firstName: Option[String], 26 | middleName: Option[String], 27 | lastName: Option[String], 28 | initials: Option[String], 29 | title: Option[String], 30 | honours: Option[String], 31 | sex: Option[String], 32 | dateOfBirth: Option[LocalDate], 33 | nino: Option[Nino] 34 | ) { 35 | lazy val shortName: Option[String] = (for { 36 | f <- firstName 37 | l <- lastName 38 | } yield List(f, l).mkString(" ")).map(_.trim) 39 | } 40 | 41 | object Person { 42 | implicit val formats: OFormat[Person] = Json.format[Person] 43 | } 44 | -------------------------------------------------------------------------------- /app/models/PersonDetails.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models 18 | 19 | import play.api.libs.json._ 20 | 21 | case class PersonDetails( 22 | person: Person, 23 | address: Option[Address], 24 | correspondenceAddress: Option[Address] 25 | ) 26 | 27 | object PersonDetails { 28 | implicit val formats: OFormat[PersonDetails] = Json.format[PersonDetails] 29 | } 30 | -------------------------------------------------------------------------------- /app/models/PertaxResponse.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models 18 | 19 | import play.api.libs.json.{Json, OFormat} 20 | 21 | case class PertaxResponse( 22 | code: String, 23 | message: String, 24 | errorView: Option[ErrorView] = None, 25 | redirect: Option[String] = None 26 | ) 27 | 28 | object PertaxResponse { 29 | implicit val formats: OFormat[PertaxResponse] = Json.format[PertaxResponse] 30 | } 31 | -------------------------------------------------------------------------------- /app/models/SaEnrolmentRequest.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models 18 | 19 | import play.api.libs.json.{JsValue, Json, Reads, Writes} 20 | import play.api.libs.ws.BodyWritable 21 | import uk.gov.hmrc.domain.SaUtr 22 | 23 | case class SaEnrolmentRequest(origin: String, utr: Option[SaUtr], providerId: String) 24 | 25 | object SaEnrolmentRequest { 26 | implicit val writes: Writes[SaEnrolmentRequest] = Json.writes[SaEnrolmentRequest] 27 | 28 | implicit def jsonBodyWritable[T](implicit 29 | writes: Writes[T], 30 | jsValueBodyWritable: BodyWritable[JsValue] 31 | ): BodyWritable[T] = jsValueBodyWritable.map(writes.writes) 32 | } 33 | 34 | case class SaEnrolmentResponse(redirectUrl: String) 35 | 36 | object SaEnrolmentResponse { 37 | implicit val reads: Reads[SaEnrolmentResponse] = Json.reads[SaEnrolmentResponse] 38 | } 39 | -------------------------------------------------------------------------------- /app/models/SeissModel.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models 18 | 19 | import play.api.libs.json.{Format, Json} 20 | 21 | final case class SeissModel(utr: String) 22 | 23 | object SeissModel { 24 | implicit val format: Format[SeissModel] = Json.format[SeissModel] 25 | } 26 | -------------------------------------------------------------------------------- /app/models/SeissRequest.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models 18 | 19 | import play.api.libs.json.{Format, JsValue, Json, Writes} 20 | import play.api.libs.ws.BodyWritable 21 | 22 | final case class SeissRequest(utr: String) 23 | 24 | object SeissRequest { 25 | implicit val format: Format[SeissRequest] = Json.format[SeissRequest] 26 | 27 | implicit def jsonBodyWritable[T](implicit 28 | writes: Writes[T], 29 | jsValueBodyWritable: BodyWritable[JsValue] 30 | ): BodyWritable[T] = jsValueBodyWritable.map(writes.writes) 31 | } 32 | -------------------------------------------------------------------------------- /app/models/SelfAssessmentEnrolment.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models 18 | 19 | import uk.gov.hmrc.domain.SaUtr 20 | 21 | case class SelfAssessmentEnrolment(saUtr: SaUtr, status: EnrolmentStatus) 22 | -------------------------------------------------------------------------------- /app/models/SummaryCardPartial.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models 18 | 19 | import play.api.libs.json.{JsString, JsSuccess, Json, Reads} 20 | import play.twirl.api.HtmlFormat 21 | 22 | case class SummaryCardPartial( 23 | partialName: String, 24 | partialContent: HtmlFormat.Appendable, 25 | partialReconciliationStatus: ReconciliationStatus 26 | ) 27 | 28 | object SummaryCardPartial { 29 | implicit val htmlReads: Reads[HtmlFormat.Appendable] = jsValue => { 30 | JsSuccess(HtmlFormat.raw(jsValue.as[JsString].value)) 31 | } 32 | 33 | implicit val reads: Reads[SummaryCardPartial] = Json.reads[SummaryCardPartial] 34 | } 35 | -------------------------------------------------------------------------------- /app/models/TaxComponents.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models 18 | 19 | import play.api.libs.json.JsValue 20 | 21 | case class TaxComponents(taxComponents: List[String]) { 22 | 23 | def isMarriageAllowanceRecipient: Boolean = taxComponents.contains("MarriageAllowanceReceived") 24 | 25 | def isMarriageAllowanceTransferor: Boolean = taxComponents.contains("MarriageAllowanceTransferred") 26 | 27 | def notMarriageAllowanceCustomer: Boolean = !(isMarriageAllowanceRecipient || isMarriageAllowanceTransferor) 28 | 29 | def isCompanyBenefitRecipient: Boolean = 30 | taxComponents.exists(componentType => componentType == "CarBenefit" || componentType == "MedicalInsurance") 31 | } 32 | 33 | object TaxComponents { 34 | def fromJsonTaxComponents(taxComponents: JsValue): TaxComponents = { 35 | 36 | val componentTypes = (taxComponents \\ "componentType").map(_.as[String]).toList 37 | 38 | TaxComponents(componentTypes) 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/models/TaxComponentsState.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models 18 | 19 | sealed trait TaxComponentsState { 20 | def getTaxComponents: Option[TaxComponents] = this match { 21 | case TaxComponentsAvailableState(tc) => Some(tc) 22 | case _ => None 23 | } 24 | } 25 | case object TaxComponentsDisabledState extends TaxComponentsState 26 | case object TaxComponentsUnreachableState extends TaxComponentsState 27 | case object TaxComponentsNotAvailableState extends TaxComponentsState 28 | case class TaxComponentsAvailableState(taxComponents: TaxComponents) extends TaxComponentsState 29 | -------------------------------------------------------------------------------- /app/models/UnusedAllowance.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models 18 | 19 | import play.api.libs.json.{Json, OFormat} 20 | 21 | case class UnusedAllowance(value: BigDecimal) 22 | 23 | object UnusedAllowance { 24 | implicit val formats: OFormat[UnusedAllowance] = Json.format[UnusedAllowance] 25 | } 26 | -------------------------------------------------------------------------------- /app/models/UserDetails.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models 18 | 19 | import play.api.libs.json.{Json, OFormat} 20 | 21 | case class UserDetails(authProviderType: String) 22 | object UserDetails { 23 | implicit val formats: OFormat[UserDetails] = Json.format[UserDetails] 24 | val GovernmentGatewayAuthProvider = "GovernmentGateway" 25 | } 26 | -------------------------------------------------------------------------------- /app/models/UserName.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models 18 | 19 | import uk.gov.hmrc.auth.core.retrieve.Name 20 | 21 | case class UserName(name: Name) { 22 | 23 | override def toString: String = 24 | s"${name.name.getOrElse("")} ${name.lastName.getOrElse("")}".trim 25 | 26 | def getOrElse(defaultName: String): String = 27 | name match { 28 | case Name(None, None) => defaultName 29 | case _ => this.toString 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/models/addresslookup/AddressLookup.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models.addresslookup 18 | 19 | import play.api.libs.json.{JsValue, Json, Writes} 20 | import play.api.libs.ws.BodyWritable 21 | 22 | case class AddressLookup(postcode: String, filter: Option[String]) 23 | 24 | object AddressLookup { 25 | implicit val writes: Writes[AddressLookup] = Json.writes[AddressLookup] 26 | 27 | implicit def jsonBodyWritable[T](implicit 28 | writes: Writes[T], 29 | jsValueBodyWritable: BodyWritable[JsValue] 30 | ): BodyWritable[T] = jsValueBodyWritable.map(writes.writes) 31 | } 32 | -------------------------------------------------------------------------------- /app/models/addresslookup/AddressRecord.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models.addresslookup 18 | 19 | import models.dto.Dto 20 | import play.api.libs.json.{Json, OFormat} 21 | 22 | /** Represents one address record. Arrays of these are returned from the address-lookup microservice. 23 | */ 24 | case class AddressRecord(id: String, address: Address, language: String) extends Dto { 25 | 26 | def isValid: Boolean = address.isValid 27 | } 28 | 29 | object AddressRecord { 30 | implicit val formats: OFormat[AddressRecord] = Json.format[AddressRecord] 31 | } 32 | -------------------------------------------------------------------------------- /app/models/addresslookup/RecordSet.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models.addresslookup 18 | 19 | import models.dto.Dto 20 | import play.api.libs.json._ 21 | 22 | case class RecordSet(addresses: Seq[AddressRecord]) extends Dto 23 | 24 | object RecordSet { 25 | def fromJsonAddressLookupService(addressListAsJson: JsValue): RecordSet = { 26 | val addresses: Seq[AddressRecord] = addressListAsJson.as[Seq[AddressRecord]] 27 | val validAddresses = removeInvalidAddresses(addresses) 28 | RecordSet(validAddresses) 29 | } 30 | 31 | private def removeInvalidAddresses(addresses: Seq[AddressRecord]): Seq[AddressRecord] = 32 | addresses.filter(_.isValid) 33 | 34 | implicit val formats: OFormat[RecordSet] = Json.format[RecordSet] 35 | 36 | } 37 | -------------------------------------------------------------------------------- /app/models/dto/AddressFinderDto.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models.dto 18 | 19 | import play.api.data.Form 20 | import play.api.data.Forms._ 21 | import play.api.libs.json.{Json, OFormat} 22 | import util.PertaxValidators._ 23 | case class AddressFinderDto(postcode: String, filter: Option[String]) extends Dto 24 | 25 | object AddressFinderDto { 26 | 27 | implicit val formats: OFormat[AddressFinderDto] = Json.format[AddressFinderDto] 28 | 29 | val form: Form[AddressFinderDto] = Form( 30 | mapping( 31 | "postcode" -> text 32 | .verifying( 33 | "error.enter_a_valid_uk_postcode", 34 | e => 35 | e match { 36 | case PostcodeRegex(_*) => true 37 | case _ => false 38 | } 39 | ), 40 | "filter" -> optional(nonEmptyText) 41 | .verifying("error.enter_valid_characters", e => validateAddressLineCharacters(e)) 42 | )(AddressFinderDto.apply)(AddressFinderDto.unapply) 43 | ) 44 | } 45 | -------------------------------------------------------------------------------- /app/models/dto/AddressPageVisitedDto.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models.dto 18 | import play.api.libs.json.{Json, OFormat} 19 | 20 | case class AddressPageVisitedDto(hasVisitedPage: Boolean) extends Dto 21 | 22 | object AddressPageVisitedDto { 23 | implicit val formats: OFormat[AddressPageVisitedDto] = Json.format[AddressPageVisitedDto] 24 | } 25 | -------------------------------------------------------------------------------- /app/models/dto/AddressSelectorDto.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models.dto 18 | 19 | import play.api.data.Form 20 | import play.api.data.Forms._ 21 | 22 | case class AddressSelectorDto(addressId: Option[String]) extends Dto 23 | 24 | object AddressSelectorDto { 25 | val form: Form[AddressSelectorDto] = Form( 26 | mapping( 27 | "addressId" -> optional(text) 28 | .verifying("error.address_select", _.isDefined) 29 | )(AddressSelectorDto.apply)(AddressSelectorDto.unapply) 30 | ) 31 | } 32 | -------------------------------------------------------------------------------- /app/models/dto/ClosePostalAddressChoiceDto.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models.dto 18 | 19 | import play.api.data.Form 20 | import play.api.data.Forms._ 21 | import play.api.libs.json.{Json, OFormat} 22 | 23 | case class ClosePostalAddressChoiceDto(value: Boolean) extends Dto 24 | 25 | object ClosePostalAddressChoiceDto { 26 | 27 | implicit val formats: OFormat[ClosePostalAddressChoiceDto] = Json.format[ClosePostalAddressChoiceDto] 28 | 29 | val form: Form[ClosePostalAddressChoiceDto] = Form( 30 | mapping( 31 | "onPageLoad" -> optional(boolean) 32 | .verifying("error.you_must_select_an_answer", _.isDefined) 33 | .transform[Boolean](_.getOrElse(false), Some(_)) 34 | )(ClosePostalAddressChoiceDto.apply)(ClosePostalAddressChoiceDto.unapply) 35 | ) 36 | } 37 | -------------------------------------------------------------------------------- /app/models/dto/Dto.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models.dto 18 | 19 | trait Dto 20 | -------------------------------------------------------------------------------- /app/models/dto/SAWrongCredentialsDto.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models.dto 18 | 19 | import play.api.data.Form 20 | import play.api.data.Forms._ 21 | import play.api.libs.json.{Json, OFormat} 22 | 23 | final case class SAWrongCredentialsDto(value: Boolean) extends Dto 24 | 25 | object SAWrongCredentialsDto { 26 | 27 | implicit val formats: OFormat[SAWrongCredentialsDto] = Json.format[SAWrongCredentialsDto] 28 | 29 | val form: Form[SAWrongCredentialsDto] = Form( 30 | mapping( 31 | "wrongCredentialsFormChoice" -> optional(boolean) 32 | .verifying("error.you_must_select_an_answer", _.isDefined) 33 | .transform[Boolean](_.getOrElse(false), Some(_)) 34 | )(SAWrongCredentialsDto.apply)(SAWrongCredentialsDto.unapply) 35 | ) 36 | } 37 | -------------------------------------------------------------------------------- /app/models/enrolments/EACDEnrolment.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models.enrolments 18 | 19 | import play.api.libs.json.{Format, Json} 20 | 21 | case class EACDEnrolment(identifiers: List[IdentifiersOrVerifiers], verifiers: List[IdentifiersOrVerifiers]) 22 | 23 | object EACDEnrolment { 24 | implicit val format: Format[EACDEnrolment] = Json.format[EACDEnrolment] 25 | } 26 | -------------------------------------------------------------------------------- /app/models/enrolments/EnrolmentEnum.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models.enrolments 18 | 19 | object EnrolmentEnum extends Enumeration { 20 | 21 | val hmrcPTKey: EnrolmentEnum.Value = Value("HMRC-PT") 22 | val IRSAKey: EnrolmentEnum.Value = Value("IR-SA") 23 | val hmrcMTDITKey: EnrolmentEnum.Value = Value("HMRC-MTD-IT") 24 | val hmrcNIKey: EnrolmentEnum.Value = Value("HMRC-NI") 25 | 26 | val saEnrolmentSet: Set[String] = 27 | Set(IRSAKey.toString, hmrcMTDITKey.toString, hmrcNIKey.toString) 28 | } 29 | -------------------------------------------------------------------------------- /app/models/enrolments/IdentifiersOrVerifiers.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models.enrolments 18 | 19 | import play.api.libs.json.{Format, Json} 20 | 21 | case class IdentifiersOrVerifiers(key: String, value: String) 22 | 23 | object IdentifiersOrVerifiers { 24 | implicit val format: Format[IdentifiersOrVerifiers] = 25 | Json.format[IdentifiersOrVerifiers] 26 | } 27 | -------------------------------------------------------------------------------- /app/models/enrolments/KnownFactQueryForNINO.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models.enrolments 18 | 19 | import play.api.libs.json.{Format, Json} 20 | import uk.gov.hmrc.domain.Nino 21 | 22 | case class KnownFactQueryForNINO(service: String, knownFacts: List[IdentifiersOrVerifiers]) 23 | 24 | object KnownFactQueryForNINO { 25 | def apply(nino: Nino, serviceKey: String): KnownFactQueryForNINO = KnownFactQueryForNINO( 26 | service = serviceKey, 27 | knownFacts = List(IdentifiersOrVerifiers("NINO", nino.nino)) 28 | ) 29 | 30 | implicit val format: Format[KnownFactQueryForNINO] = 31 | Json.format[KnownFactQueryForNINO] 32 | } 33 | -------------------------------------------------------------------------------- /app/models/enrolments/KnownFactResponseForNINO.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models.enrolments 18 | 19 | import play.api.libs.json.{Format, Json} 20 | 21 | case class KnownFactResponseForNINO(service: String, enrolments: List[EACDEnrolment]) { 22 | 23 | def getUTR: String = 24 | enrolments.head.identifiers.collect { 25 | case identifier if identifier.key == "UTR" => identifier.value 26 | }.head 27 | 28 | def getHMRCMTDIT: Option[String] = 29 | enrolments.head.verifiers.collect { 30 | case identifier if identifier.key == "MTDITID" => identifier.value 31 | }.headOption 32 | } 33 | 34 | object KnownFactResponseForNINO { 35 | implicit val format: Format[KnownFactResponseForNINO] = 36 | Json.format[KnownFactResponseForNINO] 37 | } 38 | -------------------------------------------------------------------------------- /app/models/enrolments/UsersAssignedEnrolment.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models.enrolments 18 | 19 | sealed trait EnrolmentResult 20 | 21 | case class UsersAssignedEnrolment(accountDetails: AccountDetails) extends EnrolmentResult 22 | 23 | case class EnrolmentDoesNotExist() extends EnrolmentResult 24 | 25 | case class EnrolmentError() extends EnrolmentResult 26 | -------------------------------------------------------------------------------- /app/queries/Query.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package queries 18 | 19 | import models.UserAnswers 20 | import play.api.libs.json.JsPath 21 | 22 | import scala.util.{Success, Try} 23 | 24 | sealed trait Query { 25 | 26 | def path: JsPath 27 | } 28 | 29 | trait Gettable[A] extends Query 30 | 31 | trait Settable[A] extends Query { 32 | 33 | def cleanup(userAnswers: UserAnswers): Try[UserAnswers] = 34 | Success(userAnswers) 35 | 36 | def cleanupBeforeSettingValue(userAnswers: UserAnswers): Try[UserAnswers] = Success(userAnswers) 37 | 38 | } 39 | -------------------------------------------------------------------------------- /app/routePages/AddressFinderPage.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package routePages 18 | 19 | import controllers.bindable.AddrType 20 | import models.dto.AddressFinderDto 21 | import play.api.libs.json.JsPath 22 | 23 | case class AddressFinderPage(typ: AddrType) extends QuestionPage[AddressFinderDto] { 24 | 25 | override def toString: String = "addressFinder" 26 | 27 | override def path: JsPath = JsPath \ s"$typ" \ toString 28 | } 29 | -------------------------------------------------------------------------------- /app/routePages/AddressLookupServiceDownPage.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package routePages 18 | 19 | import play.api.libs.json.JsPath 20 | 21 | case object AddressLookupServiceDownPage extends QuestionPage[Boolean] { 22 | 23 | override def toString: String = "addressLookupServiceDown" 24 | 25 | override def path: JsPath = JsPath \ toString 26 | } 27 | -------------------------------------------------------------------------------- /app/routePages/HasAddressAlreadyVisitedPage.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package routePages 18 | 19 | import models.dto.AddressPageVisitedDto 20 | import play.api.libs.json.JsPath 21 | 22 | case object HasAddressAlreadyVisitedPage extends QuestionPage[AddressPageVisitedDto] { 23 | 24 | override def toString: String = "addressPageVisited" 25 | override def path: JsPath = JsPath \ toString 26 | } 27 | -------------------------------------------------------------------------------- /app/routePages/QuestionPage.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package routePages 18 | 19 | import queries.{Gettable, Settable} 20 | 21 | trait QuestionPage[A] extends Gettable[A] with Settable[A] 22 | -------------------------------------------------------------------------------- /app/routePages/SelectedAddressRecordPage.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package routePages 18 | 19 | import controllers.bindable.AddrType 20 | import models.addresslookup.AddressRecord 21 | import play.api.libs.json.JsPath 22 | 23 | case class SelectedAddressRecordPage(typ: AddrType) extends QuestionPage[AddressRecord] { 24 | 25 | override def toString: String = "selectedAddressRecord" 26 | 27 | override def path: JsPath = JsPath \ s"$typ" \ toString 28 | } 29 | -------------------------------------------------------------------------------- /app/routePages/SelectedRecordSetPage.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package routePages 18 | 19 | import controllers.bindable.AddrType 20 | import models.addresslookup.RecordSet 21 | import play.api.libs.json.JsPath 22 | 23 | case class SelectedRecordSetPage(typ: AddrType) extends QuestionPage[RecordSet] { 24 | 25 | override def toString: String = "selectedRecordSet" 26 | 27 | override def path: JsPath = JsPath \ s"$typ" \ toString 28 | } 29 | -------------------------------------------------------------------------------- /app/routePages/SelfAssessmentUserTypePage.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package routePages 18 | 19 | import models.SelfAssessmentUserType 20 | import play.api.libs.json.JsPath 21 | 22 | case object SelfAssessmentUserTypePage extends QuestionPage[SelfAssessmentUserType] { 23 | 24 | override def toString: String = "selfAssessmentUserType" 25 | override def path: JsPath = JsPath \ toString 26 | } 27 | -------------------------------------------------------------------------------- /app/routePages/SubmittedAddressPage.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package routePages 18 | 19 | import controllers.bindable.AddrType 20 | import models.dto.AddressDto 21 | import play.api.libs.json.JsPath 22 | 23 | case class SubmittedAddressPage(typ: AddrType) extends QuestionPage[AddressDto] { 24 | 25 | override def toString: String = "submittedAddress" 26 | 27 | override def path: JsPath = JsPath \ s"$typ" \ toString 28 | } 29 | -------------------------------------------------------------------------------- /app/routePages/SubmittedInternationalAddressChoicePage.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package routePages 18 | 19 | import models.dto.InternationalAddressChoiceDto 20 | import play.api.libs.json.JsPath 21 | 22 | case object SubmittedInternationalAddressChoicePage extends QuestionPage[InternationalAddressChoiceDto] { 23 | 24 | override def toString: String = "internationalAddressChoice" 25 | override def path: JsPath = JsPath \ toString 26 | } 27 | -------------------------------------------------------------------------------- /app/routePages/SubmittedResidencyChoicePage.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package routePages 18 | 19 | import controllers.bindable.AddrType 20 | import models.dto.ResidencyChoiceDto 21 | import play.api.libs.json.JsPath 22 | 23 | case class SubmittedResidencyChoicePage(typ: AddrType) extends QuestionPage[ResidencyChoiceDto] { 24 | 25 | override def toString: String = "residencyChoice" 26 | 27 | override def path: JsPath = JsPath \ s"$typ" \ toString 28 | } 29 | -------------------------------------------------------------------------------- /app/routePages/SubmittedStartDatePage.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package routePages 18 | 19 | import controllers.bindable.AddrType 20 | import models.dto.DateDto 21 | import play.api.libs.json.JsPath 22 | 23 | case class SubmittedStartDatePage(typ: AddrType) extends QuestionPage[DateDto] { 24 | 25 | override def toString: String = "submittedStartDate" 26 | 27 | override def path: JsPath = JsPath \ s"$typ" \ toString 28 | } 29 | -------------------------------------------------------------------------------- /app/services/FandfService.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package services 18 | 19 | import com.google.inject.Inject 20 | import connectors.FandFConnector 21 | import play.api.Logging 22 | import play.api.http.Status.NOT_FOUND 23 | import uk.gov.hmrc.auth.core.retrieve.v2.TrustedHelper 24 | import uk.gov.hmrc.http.HeaderCarrier 25 | 26 | import scala.concurrent.{ExecutionContext, Future} 27 | 28 | class FandfService @Inject() ( 29 | fandFConnector: FandFConnector 30 | ) extends Logging { 31 | 32 | def getTrustedHelper()(implicit 33 | hc: HeaderCarrier, 34 | ec: ExecutionContext 35 | ): Future[Option[TrustedHelper]] = 36 | fandFConnector 37 | .getTrustedHelper() 38 | .foldF( 39 | { ex => 40 | if (ex.statusCode != NOT_FOUND) { 41 | logger.warn(s"Call to fandf failed with status ${ex.statusCode} and message ${ex.message}") 42 | } 43 | Future.successful(None) 44 | }, 45 | helper => Future.successful(helper) 46 | ) 47 | 48 | } 49 | -------------------------------------------------------------------------------- /app/services/SeissService.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package services 18 | 19 | import cats.implicits._ 20 | import com.google.inject.Inject 21 | import config.ConfigDecorator 22 | import connectors.SeissConnector 23 | import models.{SelfAssessmentUser, SelfAssessmentUserType} 24 | import uk.gov.hmrc.http.HeaderCarrier 25 | 26 | import scala.concurrent.{ExecutionContext, Future} 27 | 28 | class SeissService @Inject() (seissConnector: SeissConnector, appConfig: ConfigDecorator)(implicit 29 | ec: ExecutionContext 30 | ) { 31 | 32 | def hasClaims(saUserType: SelfAssessmentUserType)(implicit hc: HeaderCarrier): Future[Boolean] = 33 | if (appConfig.isSeissTileEnabled) { 34 | saUserType match { 35 | case user: SelfAssessmentUser => 36 | seissConnector.getClaims(user.saUtr.utr).fold(_ => false, claims => claims.nonEmpty) 37 | case _ => Future.successful(false) 38 | } 39 | } else { 40 | Future.successful(false) 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/services/partials/TaxCalcPartialService.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package services.partials 18 | 19 | import com.google.inject.{Inject, Singleton} 20 | import config.ConfigDecorator 21 | import connectors.EnhancedPartialRetriever 22 | import models.{BalancedSA, SummaryCardPartial} 23 | import play.api.mvc.RequestHeader 24 | 25 | import scala.concurrent.{ExecutionContext, Future} 26 | 27 | @Singleton 28 | class TaxCalcPartialService @Inject() ( 29 | configDecorator: ConfigDecorator, 30 | enhancedPartialRetriever: EnhancedPartialRetriever 31 | )(implicit executionContext: ExecutionContext) { 32 | 33 | def getTaxCalcPartial(implicit request: RequestHeader): Future[Seq[SummaryCardPartial]] = 34 | enhancedPartialRetriever 35 | .loadPartialAsSeqSummaryCard[SummaryCardPartial]( 36 | url = configDecorator.taxCalcPartialLinkUrl, 37 | timeoutInMilliseconds = configDecorator.taxCalcPartialTimeoutInMilliseconds 38 | ) 39 | .map(_.filter(_.partialReconciliationStatus != BalancedSA)) 40 | } 41 | -------------------------------------------------------------------------------- /app/util/DateTimeTools.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package util 18 | 19 | import play.api.Logging 20 | import uk.gov.hmrc.time.CurrentTaxYear 21 | 22 | import java.time.LocalDate 23 | 24 | object DateTimeTools extends CurrentTaxYear with Logging { 25 | //Returns for example 1516 in March 2016 26 | def previousAndCurrentTaxYear: String = previousAndCurrentTaxYearFromGivenYear(current.currentYear) 27 | 28 | def previousAndCurrentTaxYearFromGivenYear(year: Int): String = { 29 | def y = year 30 | (y - 1).toString.takeRight(2) + y.toString.takeRight(2) 31 | } 32 | 33 | override def now: () => LocalDate = () => LocalDate.now 34 | } 35 | -------------------------------------------------------------------------------- /app/util/FormPartialUpgrade.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package util 18 | 19 | import org.jsoup.Jsoup 20 | import play.twirl.api.Html 21 | 22 | object FormPartialUpgrade { 23 | 24 | //TODO: To be deleted. See DDCNL-6008 25 | def upgrade(partial: Html): Html = { 26 | val doc = Jsoup.parse(partial.toString) 27 | doc.getElementsByTag("a").addClass("govuk-link") 28 | doc.getElementsByTag("ul").removeClass("list-bullet").addClass("govuk-list govuk-list--bullet") 29 | doc.getElementsByTag("h2").addClass("govuk-heading-m") 30 | doc.getElementsByTag("p").addClass("govuk-body") 31 | doc.getElementsByClass("utr-heading").removeClass("utr-heading").addClass("govuk-inset-text") 32 | Html(doc.select("body").html) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/util/FutureEarlyTimeout.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package util 18 | 19 | case object FutureEarlyTimeout extends RuntimeException 20 | -------------------------------------------------------------------------------- /app/util/LocalDateUtilities.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package util 18 | 19 | import java.time.LocalDate 20 | 21 | class LocalDateUtilities { 22 | 23 | def isBetween(date: LocalDate, start: LocalDate, end: LocalDate): Boolean = 24 | isAfterOrEqual(date, start) && isBeforeOrEqual(date, end) 25 | 26 | private def isAfterOrEqual(date: LocalDate, that: LocalDate): Boolean = !date.isBefore(that) 27 | 28 | private def isBeforeOrEqual(date: LocalDate, that: LocalDate): Boolean = !date.isAfter(that) 29 | } 30 | -------------------------------------------------------------------------------- /app/util/PertaxSessionKeys.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package util 18 | 19 | object PertaxSessionKeys { 20 | val postcode = "postcode" 21 | val filter = "filter" 22 | } 23 | -------------------------------------------------------------------------------- /app/util/TaxYearRetriever.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package util 18 | 19 | import com.google.inject.ImplementedBy 20 | import uk.gov.hmrc.time.CurrentTaxYear 21 | 22 | import java.time.LocalDate 23 | 24 | @ImplementedBy(classOf[TaxYearRetrieverImpl]) 25 | trait TaxYearRetriever { 26 | def currentYear: Int 27 | } 28 | 29 | class TaxYearRetrieverImpl extends TaxYearRetriever with CurrentTaxYear { 30 | 31 | override def now: () => LocalDate = () => LocalDate.now() 32 | 33 | def currentYear: Int = current.currentYear 34 | 35 | } 36 | -------------------------------------------------------------------------------- /app/util/TemplateFunctions.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package util 18 | 19 | import org.apache.commons.text.WordUtils 20 | 21 | object TemplateFunctions { 22 | def upperCaseToTitleCase(s: String): String = if (!s.exists(_.isLower)) WordUtils.capitalizeFully(s) else s 23 | def formatCurrency(i: BigDecimal): String = "%,.2f".format(i) 24 | } 25 | -------------------------------------------------------------------------------- /app/util/Tools.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package util 18 | 19 | import com.google.inject.Inject 20 | import uk.gov.hmrc.crypto.{ApplicationCrypto, PlainText} 21 | 22 | import java.net.{URI, URLEncoder} 23 | 24 | class Tools @Inject() (val applicationCrypto: ApplicationCrypto) { 25 | def urlEncode(u: String): String = URLEncoder.encode(u, "UTF-8") 26 | def encryptOnly(s: String): String = 27 | applicationCrypto.QueryParameterCrypto.encrypt(PlainText(s)).value 28 | def encryptAndEncode(s: String): String = 29 | urlEncode(encryptOnly(s)) 30 | def isRelative(url: String): Boolean = !new URI(url).isAbsolute && url.take(2) != "//" 31 | } 32 | -------------------------------------------------------------------------------- /app/util/WithName.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package util 18 | 19 | class WithName(string: String) { 20 | override val toString: String = string 21 | } 22 | -------------------------------------------------------------------------------- /app/viewmodels/AlertBannerViewModel.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package viewmodels 18 | 19 | import play.twirl.api.Html 20 | 21 | final case class AlertBannerViewModel( 22 | alertBannerContent: List[Html] 23 | ) 24 | 25 | object AlertBannerViewModel { 26 | def apply(): AlertBannerViewModel = new AlertBannerViewModel(List.empty) 27 | } 28 | -------------------------------------------------------------------------------- /app/viewmodels/PersonalDetailsTableRowModel.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package viewmodels 18 | 19 | import play.twirl.api.HtmlFormat 20 | 21 | case class PersonalDetailsTableRowModel( 22 | id: String, 23 | titleMessage: String, 24 | content: HtmlFormat.Appendable, 25 | linkTextMessage: String, 26 | visuallyhiddenText: String, 27 | linkUrl: Option[String], 28 | displayChangelink: Boolean = true, 29 | isPostalAddressSame: Boolean = false 30 | ) 31 | -------------------------------------------------------------------------------- /app/views/ErrorView.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import scala.concurrent.ExecutionContext 18 | @import components.{H1, P} 19 | @import views.MainView 20 | @this(main: MainView, h1: H1, p: P) 21 | @(title: String, heading: Option[String] = None, body: List[String] = Nil)(implicit request: WrappedRequest[_], messages: play.api.i18n.Messages) 22 | 23 | @main( 24 | pageTitle = messages(title), 25 | showBackLink = true 26 | ) { 27 | 28 |
29 |
30 | 33 | @body.map{body => @p(Text(messages(body)))} 34 |
35 |
36 | 37 | } 38 | -------------------------------------------------------------------------------- /app/views/ManualCorrespondenceView.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import config.ConfigDecorator 18 | @import controllers.auth.requests.UserRequest 19 | @import scala.concurrent.ExecutionContext 20 | @import components.{H1, P, Link} 21 | @import views.MainView 22 | @this( 23 | main: MainView, 24 | h1: H1, 25 | p: P, 26 | link: Link 27 | ) 28 | 29 | @()(implicit request: UserRequest[_], configDecorator: ConfigDecorator, messages: play.api.i18n.Messages) 30 | 31 | @main( 32 | pageTitle = messages("label.you_cannot_access_your_account") 33 | ) { 34 | 35 | @h1("label.you_cannot_access_your_account") 36 | @p(HtmlContent(messages("label.we_need_to_speak_to_you_about_an_mci_error_"))) 37 | 38 | @p(HtmlContent(messages("label.how_to_contact_us") + " " + 39 | link(configDecorator.generalQueriesUrl, "label.resolve.mci.issue", inParagraph = true) 40 | )) 41 | 42 | } 43 | -------------------------------------------------------------------------------- /app/views/NotFoundView.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import controllers.auth.requests.UserRequest 18 | @import scala.concurrent.ExecutionContext 19 | @import components.{H1, P, Link} 20 | @import views.MainView 21 | @this( 22 | main: MainView, 23 | h1: H1, 24 | p: P, 25 | link: Link 26 | ) 27 | @()(implicit request: UserRequest[_], messages: play.api.i18n.Messages) 28 | 29 | @main( 30 | pageTitle = messages("global.page.not.found.error.title") 31 | ) { 32 | 33 | @h1("global.page.not.found.error.title") 34 | @p(Text(Messages("global.page.not.found.error.check.web.address.correct"))) 35 | @p(Text(Messages("global.page.not.found.error.check.web.address.full"))) 36 | @p(HtmlContent(Messages("global.page.not.found.error.contact") + " " + 37 | link(Messages("global.page.not.found.error.contact.link"), 38 | Messages("global.page.not.found.error.contact.link.text"), 39 | inParagraph = true, 40 | attrTarget = true) 41 | )) 42 | 43 | } 44 | -------------------------------------------------------------------------------- /app/views/SelfAssessmentSummaryView.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import controllers.auth.requests.UserRequest 18 | @import scala.concurrent.ExecutionContext 19 | @import views.MainView 20 | @this(main: MainView) 21 | 22 | @(formPartial: Html, saPartial: Html)(implicit request: UserRequest[_], messages: play.api.i18n.Messages) 23 | 24 | @main( 25 | pageTitle = messages("label.self_assessment_summary"), 26 | fullWidth = true 27 | ) { 28 |

@messages("label.self_assessment_summary")

29 |
30 | @saPartial 31 |
32 | 33 |
34 | @formPartial 35 |
36 | } -------------------------------------------------------------------------------- /app/views/UnauthenticatedErrorView.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import scala.concurrent.ExecutionContext 18 | @import components.{H1, P} 19 | @import views.UnauthenticatedMainView 20 | @this( 21 | main: UnauthenticatedMainView, 22 | h1: H1, 23 | p: P 24 | ) 25 | 26 | @(pageTitle: String, heading: String, message: String)(implicit request: Request[_], messages: play.api.i18n.Messages) 27 | 28 | @main( 29 | pageTitle = messages(pageTitle), 30 | showBackLink = true 31 | ) { 32 | 33 | @h1(heading) 34 | @p(HtmlContent(messages(message))) 35 | 36 | } 37 | -------------------------------------------------------------------------------- /app/views/cards/home/ChildBenefitSingleAccountView.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import tags._ 18 | @this() 19 | @()(implicit messages: play.api.i18n.Messages) 20 | 21 | @card( 22 | id = Some("child-benefit-card"), 23 | url = Some(routes.InterstitialController.displayChildBenefitsSingleAccountView.url), 24 | gaAction = Some("Benefits"), 25 | gaLabel = Some("Child Benefit"), 26 | heading = messages("label.child_benefit"), 27 | headingTag = "h2", 28 | bodyContent = Some(Html("

" + messages("label.a_payment_to_help_with_the_cost_of_bringing_up_children") + "

")) 29 | ) { 30 | } 31 | -------------------------------------------------------------------------------- /app/views/cards/home/ItsaMergeView.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import tags._ 18 | @import components.P 19 | 20 | @this(p: P) 21 | 22 | @(nextDeadlineTaxYear: String)(implicit messages: play.api.i18n.Messages) 23 | 24 | @cardContent = { 25 | @p(Text(messages("label.view_manage_your_mtd_it"))) 26 | @p(Text(messages("label.online_deadline_tax_returns", nextDeadlineTaxYear))) 27 | } 28 | 29 | @card( 30 | id = Some("sa-card"), 31 | url = Some(controllers.routes.InterstitialController.displayItsaMergePage.url), 32 | gaAction = Some("Income"), 33 | gaLabel = Some("Self Assessment"), 34 | heading = messages("label.mtd_for_itsa"), 35 | headingTag = "h2", 36 | bodyContent = Some(cardContent) 37 | ) { 38 | } 39 | -------------------------------------------------------------------------------- /app/views/cards/home/LatestNewsAndUpdatesView.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import config.NewsAndTilesConfig 18 | @import tags._ 19 | @import config.ConfigDecorator 20 | 21 | @this(newsAndTilesConfig: NewsAndTilesConfig) 22 | 23 | @()(implicit messages: play.api.i18n.Messages, configDecorator: ConfigDecorator) 24 | 25 | @cardNewsAndUpdates( 26 | id = Some("news-card"), 27 | heading = messages("label.latest_news_and_updates"), 28 | headingTag = "h2", 29 | newsAndContentModelList = newsAndTilesConfig.getNewsAndContentModelList(), 30 | configDecorator 31 | ) 32 | -------------------------------------------------------------------------------- /app/views/cards/home/NISPView.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import tags._ 18 | @import components.P 19 | 20 | @this(p: P) 21 | @()(implicit messages: play.api.i18n.Messages) 22 | 23 | @cardContent = { 24 | @p(Text(messages("label.view_national_insurance"))) 25 | @p(Text(messages("label.view_state_pension"))) 26 | } 27 | 28 | @card( 29 | id = Some("ni-and-sp-card"), 30 | url = Some(controllers.routes.InterstitialController.displayNISP.url), 31 | gaAction = Some("Income"), 32 | gaLabel = Some("National Insurance and State Pension"), 33 | heading = messages("label.national_insurance_and_state_pension"), 34 | headingTag = "h2", 35 | bodyContent = Some(cardContent) 36 | ) { 37 | } 38 | -------------------------------------------------------------------------------- /app/views/cards/home/PayAsYouEarnView.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import tags._ 18 | @import config.ConfigDecorator 19 | @this() 20 | @(configDecorator: ConfigDecorator, dataGroupValue: String)(implicit messages: play.api.i18n.Messages) 21 | 22 | @card( 23 | id = Some("paye-card"), 24 | url = Some(s"${configDecorator.taiHost}/check-income-tax/what-do-you-want-to-do"), 25 | gaAction = Some("Income"), 26 | gaLabel = Some("Pay As You Earn (PAYE)"), 27 | heading = messages("label.pay_as_you_earn_paye"), 28 | headingTag = "h2", 29 | bodyContent = Some(Html("

" + messages("label.your_income_from_employers_and_private_pensions_") + "

")), 30 | divAttr = Map("data-user-group" -> dataGroupValue) 31 | ) { 32 | } 33 | -------------------------------------------------------------------------------- /app/views/cards/home/SaMergeView.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import tags._ 18 | @import components.P 19 | @this(p: P) 20 | @(nextDeadlineTaxYear: String, redirectUrl: String, paragraphMessageKey: String)(implicit messages: play.api.i18n.Messages) 21 | 22 | @cardContent = { 23 | @p(Text(messages(paragraphMessageKey, nextDeadlineTaxYear))) 24 | } 25 | @card( 26 | id = Some("sa-card"), 27 | url = Some(redirectUrl), 28 | gaAction = Some("Income"), 29 | gaLabel = Some("Self Assessment"), 30 | heading = messages("label.self_assessment"), 31 | headingTag = "h2", 32 | bodyContent = Some(cardContent) 33 | ) { 34 | } 35 | -------------------------------------------------------------------------------- /app/views/cards/home/SeissView.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import tags._ 18 | @import config.ConfigDecorator 19 | 20 | @this(configDecorator: ConfigDecorator) 21 | @()(implicit messages: play.api.i18n.Messages) 22 | 23 | 24 | @card( 25 | id = Some("seiss-card"), 26 | url = Some(s"${configDecorator.seissFrontendHost}/self-employment-support/claim/your-claims"), 27 | gaAction = Some(""), 28 | gaLabel = Some(""), 29 | heading = messages("title.seiss"), 30 | headingTag = "h2", 31 | bodyContent = Some(Html("

" + messages("body.seiss") + "

")) 32 | ) { 33 | } 34 | -------------------------------------------------------------------------------- /app/views/cards/home/SelfAssessmentRegistrationView.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2025 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import components.P 18 | @import tags._ 19 | @this(p: P) 20 | @()(implicit messages: play.api.i18n.Messages) 21 | 22 | @cardContent = { 23 | @p(Text(messages("selfAssessment.register.findout"))) 24 | } 25 | 26 | @card( 27 | id = Some("sa-non-utr-card"), 28 | url = Some(controllers.routes.InterstitialController.displaySaRegistrationPage.url), 29 | gaAction = None, 30 | gaLabel = Some("Self Assessment who needs to register"), 31 | heading = messages("selfAssessment.whoNeedsToRegister"), 32 | bodyContent = Some(cardContent) 33 | ) { 34 | } 35 | -------------------------------------------------------------------------------- /app/views/cards/home/TaxCreditsEndedView.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import controllers.routes 18 | @import tags._ 19 | 20 | @this() 21 | @()(implicit messages: play.api.i18n.Messages) 22 | 23 | @cardUrl = @{ 24 | routes.InterstitialController.displayTaxCreditsEndedInformationInterstitialView.url 25 | } 26 | 27 | @{ 28 | card( 29 | id = Some("tax-credits-card"), 30 | url = Some(cardUrl), 31 | gaAction = Some("Benefits"), 32 | gaLabel = Some("Tax credits"), 33 | heading = messages("label.tax_credits_ended"), 34 | headingTag = "h2", 35 | bodyContent = Some(Html("

" + messages("label.tax_credits_ended_content") + "

")) 36 | )(Html("")) 37 | } 38 | -------------------------------------------------------------------------------- /app/views/cards/home/TaxSummariesView.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import config.ConfigDecorator 18 | @import tags._ 19 | @this() 20 | 21 | @(taxSummariesUrl: String)(implicit messages: play.api.i18n.Messages) 22 | 23 | 24 | @card( 25 | id = Some("ats-card"), 26 | url = Some(taxSummariesUrl), 27 | gaAction = Some("Tax Summaries"), 28 | gaLabel = Some("Annual Tax Summary"), 29 | heading = messages("card.ats.heading"), 30 | headingTag = "h2", 31 | bodyContent = Some(Html("

" + messages("card.ats.text") + "

")) 32 | ) { 33 | } 34 | -------------------------------------------------------------------------------- /app/views/components/AdditionalJavascript.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import views.html.helper.CSPNonce 18 | 19 | @this( 20 | autocompleteJavascript: HmrcAccessibleAutocompleteJavascript 21 | ) 22 | 23 | @(scripts: Option[Html])(implicit request: Request[_]) 24 | 25 | 26 | 27 | 28 | @autocompleteJavascript() 29 | @scripts 30 | -------------------------------------------------------------------------------- /app/views/components/Button.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @this(govukButton: GovukButton) 18 | 19 | @(msg: String, href: Option[String] = None, classes: Option[String] = None, name: Option[String] = None, id: String = "submit", attrs: Map[String, String] = Map.empty, isStartButton: Boolean = false)(implicit messages: Messages) 20 | 21 | 22 | @govukButton(Button(content = Text(messages(msg)), href = href, classes = classes.getOrElse(""), name = name, attributes = attrs ++ Map("id" -> id), isStartButton = isStartButton)) -------------------------------------------------------------------------------- /app/views/components/ErrorSummary.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @this(govukErrorSummary: GovukErrorSummary) 18 | 19 | @(form: Form[_], errorFieldName: Option[String] = None)(implicit messages: Messages) 20 | 21 | @if(form.hasErrors) { 22 | @defining(form.errors.map { error => 23 | ErrorLink( 24 | href = Some(s"#${errorFieldName.getOrElse(error.key)}"), 25 | content = Text(messages(s"head.${error.message}")) 26 | ) 27 | }) { errorLinks => 28 | @govukErrorSummary(ErrorSummary( 29 | errorList = errorLinks.toSeq, 30 | title = Text(messages("label.theres_a_problem")) 31 | )) 32 | } 33 | } -------------------------------------------------------------------------------- /app/views/components/FullWidthMainContent.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @this() 18 | 19 | @(contentBlock: Html) 20 | 21 |
22 |
23 | @contentBlock 24 |
25 |
-------------------------------------------------------------------------------- /app/views/components/H1.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @this() 18 | 19 | @(msg: String, classes: Option[String] = None, elmId: Option[String] = None, headerMarginZero: Boolean = false)(implicit messages: Messages) 20 |
21 |

@Html(messages(msg))

22 |
23 | -------------------------------------------------------------------------------- /app/views/components/H2.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @this() 18 | 19 | @(msg: String, classes: Option[String] = None, elmId: Option[String] = None, args: Seq[String] = Seq.empty)(implicit messages: Messages) 20 | 21 |

id="@{i}"} class="@classes.getOrElse("govuk-heading-m")">@Html(messages(msg, args))

22 | -------------------------------------------------------------------------------- /app/views/components/H3.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @this() 18 | 19 | @(msg: String, classes: Option[String] = None, elmId: Option[String] = None, args: Seq[String] = Seq.empty)(implicit messages: Messages) 20 | 21 |

id="@{i}"} class="@classes.getOrElse("govuk-heading-s")">@Html(messages(msg, args))

22 | -------------------------------------------------------------------------------- /app/views/components/HeadBlock.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import views.html.helper.CSPNonce 18 | 19 | @this(autocompleteCss: HmrcAccessibleAutocompleteCss) 20 | @(stylesheets: Option[Html])(implicit request: Request[_]) 21 | 22 | 23 | 24 | @autocompleteCss() 25 | @stylesheets -------------------------------------------------------------------------------- /app/views/components/P.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import uk.gov.hmrc.govukfrontend.views.viewmodels.content.Content 18 | 19 | @this() 20 | 21 | @(content: Content, elmId: Option[String] = None, classes: Option[String] = None) 22 | 23 |

@content.asHtml

24 | -------------------------------------------------------------------------------- /app/views/components/P85Content.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2024 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import config.ConfigDecorator 18 | 19 | @this( 20 | h2: H2, 21 | link: Link, 22 | p: P, 23 | configDecorator: ConfigDecorator 24 | ) 25 | 26 | @()(implicit messages: Messages) 27 | 28 | 29 | @h2("p85.heading") 30 | @p(HtmlContent(messages("p85.p1.before_link") + " " + link(configDecorator.p85Link, "p85.p1.link_text", inParagraph=true, attrTarget = true) + " " + messages("p85.p1.after_link"))) 31 | 32 | -------------------------------------------------------------------------------- /app/views/components/alertBanner/AlertBanner.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @this(govukNotificationBanner : GovukNotificationBanner) 18 | 19 | @(contents: List[Html])(implicit messages: Messages) 20 | 21 | @alertBannerHtml = { 22 | @contents.map { content => 23 |
@content
24 | } 25 | } 26 | 27 | @if(contents.nonEmpty) { 28 | @govukNotificationBanner(NotificationBanner( 29 | content = HtmlContent(alertBannerHtml), 30 | attributes = Map("id" -> "alert-banner") 31 | )) 32 | } 33 | -------------------------------------------------------------------------------- /app/views/components/alertBanner/paperlessStatus/bouncedEmail.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @this() 18 | @(bounceLink: String)(implicit messages: Messages) 19 | 20 |

21 | @messages("alert_banner.paperlessStatus.bounced_email.p1") 22 | @messages("alert_banner.paperlessStatus.bounced_email.p2.start") 23 | @messages("alert_banner.paperlessStatus.bounced_email.link") 24 | @messages("alert_banner.paperlessStatus.bounced_email.p2.end") 25 |

-------------------------------------------------------------------------------- /app/views/components/alertBanner/paperlessStatus/unverifiedEmail.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @this() 18 | @(verifyLink: String)(implicit messages: Messages) 19 | 20 |

21 | @messages("alert_banner.paperlessStatus.unverified_email.p1") 22 | @messages("alert_banner.paperlessStatus.unverified_email.link") 23 |

-------------------------------------------------------------------------------- /app/views/components/alertBanner/paperlessStatus/voluntaryContributionsAlertView.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2025 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @this() 18 | @()(implicit messages: Messages) 19 |

20 | @messages("waiting_for_callback")@messages("no_need_to_contact") @messages("voluntary_contributions_deadline") 21 |

-------------------------------------------------------------------------------- /app/views/components/alertBanner/peakDemandBanner.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2025 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @this() 18 | @()(implicit messages: Messages) 19 |

20 | @messages("alert_banner.peak_demand.message") 21 |

-------------------------------------------------------------------------------- /app/views/interstitial/DisplayAddressInterstitialView.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import controllers.auth.requests.UserRequest 18 | @import uk.gov.hmrc.play.bootstrap.binders.RedirectUrl 19 | @import scala.concurrent.ExecutionContext 20 | @import views.html.components.{H1, P, Button} 21 | @import views.MainView 22 | @this( 23 | mainView: MainView, 24 | h1: H1, 25 | p: P, 26 | button: Button 27 | ) 28 | @(continueUrl: String)(implicit request: UserRequest[_], messages: play.api.i18n.Messages) 29 | 30 | @mainView( 31 | pageTitle = messages("label.profile") 32 | ) { 33 | 34 | @h1("label.profile") 35 | @p(Text(messages("label.you_can_see_this_part_of_your_account_if_you_complete"))) 36 | @button(msg = "global.label.continue_button", href=Some(controllers.routes.ApplicationController.uplift(Some(RedirectUrl(continueUrl))).url)) 37 | 38 | } 39 | -------------------------------------------------------------------------------- /app/views/iv/failure/CannotConfirmIdentityView.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import config.ConfigDecorator 18 | @import scala.concurrent.ExecutionContext 19 | @import components.{H1, P, Link} 20 | @import views.UnauthenticatedMainView 21 | @this( 22 | main: UnauthenticatedMainView, 23 | h1: H1, 24 | p: P, 25 | link: Link 26 | ) 27 | 28 | @(retryUrl: String)(implicit request: Request[_], configDecorator: ConfigDecorator, messages: play.api.i18n.Messages) 29 | 30 | @main( 31 | pageTitle = messages("label.we_cannot_confirm_your_identity") 32 | ) { 33 | 34 | @h1("label.we_cannot_confirm_your_identity") 35 | 36 | @p(Text(messages("label.you_can"))) 37 | 38 | 42 | } 43 | -------------------------------------------------------------------------------- /app/views/iv/failure/FailedIvIncompleteView.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import config.ConfigDecorator 18 | @import scala.concurrent.ExecutionContext 19 | @import components.{H1, P, Link} 20 | @import views.UnauthenticatedMainView 21 | @this( 22 | main: UnauthenticatedMainView, 23 | h1: H1, 24 | p: P, 25 | link: Link 26 | ) 27 | 28 | @(retryUrl: String)(implicit request: Request[_], configDecorator: ConfigDecorator, messages: play.api.i18n.Messages) 29 | 30 | @main( 31 | pageTitle = messages("label.we_cannot_confirm_your_identity") 32 | ) { 33 | 34 | @h1("label.we_cannot_confirm_your_identity") 35 | @p(Text(messages("label.you_have_not_given_us_enough_information"))) 36 | @p(Text(messages("label.you_can"))) 37 | 38 | 42 | } 43 | -------------------------------------------------------------------------------- /app/views/iv/failure/LockedOutView.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import scala.concurrent.ExecutionContext 18 | @import components.{H1, P} 19 | @import views.UnauthenticatedMainView 20 | @this( 21 | main: UnauthenticatedMainView, 22 | h1: H1, 23 | p: P 24 | ) 25 | 26 | @()(implicit request: Request[_], messages: play.api.i18n.Messages) 27 | 28 | @main( 29 | pageTitle = messages("label.we_cannot_confirm_your_identity") 30 | ) { 31 | @h1("label.we_cannot_confirm_your_identity") 32 | @p(Text(messages("label.you_have_tried_to_confirm_your_identity_"))) 33 | @p(Text(messages("label.try_again_in_24_hours"))) 34 | } 35 | -------------------------------------------------------------------------------- /app/views/iv/failure/TimeOutView.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import components.{H1, P, Button} 18 | @import views.UnauthenticatedMainView 19 | @this( 20 | main: UnauthenticatedMainView, 21 | h1: H1, 22 | p: P, 23 | button: Button 24 | ) 25 | 26 | @()(implicit request: Request[_], messages: play.api.i18n.Messages) 27 | 28 | @main( 29 | pageTitle = messages("label.you_have_been_signed_out"), 30 | disableSessionExpired = true 31 | ) { 32 | 33 | @h1("label.youve_been_signed_out") 34 | @p(Text(messages("label.timeout_message"))) 35 | @button("label.sign_in", href=Some(controllers.routes.HomeController.index.url)) 36 | } 37 | -------------------------------------------------------------------------------- /app/views/iv/failure/TwoFaFailIvSuccessView.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import scala.concurrent.ExecutionContext 18 | @import components.{H1, P, Button} 19 | @import views.UnauthenticatedMainView 20 | @this( 21 | main: UnauthenticatedMainView, 22 | h1: H1, 23 | p: P, 24 | button: Button 25 | ) 26 | 27 | @()(implicit request: Request[_], messages: play.api.i18n.Messages) 28 | 29 | @main( 30 | pageTitle = messages("label.we_ve_confirmed_your_identity") 31 | ) { 32 | @h1("label.we_ve_confirmed_your_identity") 33 | @p(Text(messages("label.we_can_show_you_more_if_you_complete_2fa"))) 34 | @p(Text(messages("label.you_can_still_complete_your_sa"))) 35 | @button("global.label.continue_button", href = Some(controllers.routes.HomeController.index.url), id="continue") 36 | } 37 | -------------------------------------------------------------------------------- /app/views/iv/start/ivStartPage.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import controllers.auth.requests.UserRequest 18 | @import uk.gov.hmrc.play.bootstrap.binders.RedirectUrl 19 | @import scala.concurrent.ExecutionContext 20 | @import components.{H1, P, Button} 21 | @import views.MainView 22 | @this( 23 | mainView: MainView, 24 | h1: H1, 25 | p: P, 26 | button: Button 27 | ) 28 | 29 | @(redirectUrl: Option[String])(implicit request: UserRequest[_], messages: play.api.i18n.Messages) 30 | 31 | @mainView(messages("label.confirm_your_identity")) { 32 | 33 | @h1("label.confirm_your_identity") 34 | @p(Text(messages("label.before_you_continue_we_need_to_check"))) 35 | @p(Text(messages("label.we_re_going_to_ask_you_some_security_questions"))) 36 | @button("global.label.continue_button", href = Some(controllers.routes.ApplicationController.uplift(redirectUrl.map(RedirectUrl.apply)).url), id="continue") 37 | 38 | } 39 | -------------------------------------------------------------------------------- /app/views/iv/success/SuccessView.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import config.ConfigDecorator 18 | @import scala.concurrent.ExecutionContext 19 | @import components.{H1, P, Button} 20 | @import views.UnauthenticatedMainView 21 | @this( 22 | main: UnauthenticatedMainView, 23 | h1: H1, 24 | p: P, 25 | button: Button 26 | ) 27 | 28 | @(continueUrl: String)(implicit request: Request[_], messages: play.api.i18n.Messages) 29 | 30 | @main( 31 | pageTitle = messages("label.we_have_confirmed_your_identity") 32 | ) { 33 | 34 | @h1("label.we_have_confirmed_your_identity") 35 | 36 | @p(Text(messages("label.you_can_sign_in_to_your_personal_tax_account"))) 37 | 38 | @button("global.label.continue_button", href=Some(continueUrl), id="continue") 39 | } 40 | -------------------------------------------------------------------------------- /app/views/message/MessageDetailView.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import controllers.auth.requests.UserRequest 18 | @import scala.concurrent.ExecutionContext 19 | @import views.MainView 20 | @this(main: MainView) 21 | 22 | @(message: Html, title: String)(implicit request: UserRequest[_], messages: play.api.i18n.Messages) 23 | 24 | @main( 25 | pageTitle = title, 26 | showBackLink = true, 27 | messagesActive = true 28 | ) { 29 | @message 30 | } -------------------------------------------------------------------------------- /app/views/message/MessageInboxView.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import controllers.auth.requests.UserRequest 18 | @import scala.concurrent.ExecutionContext 19 | @import views.MainView 20 | @this(mainView: MainView) 21 | 22 | @(messageListPartial: Html)(implicit request: UserRequest[_], messages: play.api.i18n.Messages) 23 | @mainView( 24 | pageTitle = messages("label.your_messages"), 25 | showBackLink = true, 26 | messagesActive = true, 27 | fullWidth = true 28 | ) { 29 | 30 | @messageListPartial 31 | } -------------------------------------------------------------------------------- /app/views/personaldetails/partials/AddressUnavailableView.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import components.P 18 | 19 | @this( 20 | p: P 21 | ) 22 | @(displayAllLettersLine: Boolean)(implicit messages: play.api.i18n.Messages) 23 | 24 | @p(Text(messages("label.address_unavailable"))) 25 | @if(displayAllLettersLine) { 26 | 27 | @p(Text(messages("label.all_letters_will_be_sent_to_this_address"))) 28 | 29 | } 30 | -------------------------------------------------------------------------------- /app/views/personaldetails/partials/AddressView.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @this() 18 | @(address: models.Address, countries: List[Country]) 19 | 20 | @address.lines.map { line => 21 |
@upperCaseToTitleCase(line)
22 | } 23 |
@address.postcode.map(_.toUpperCase)
24 |
@if(!countries.contains(Country(address.country.getOrElse("")))) {@address.country.getOrElse("")}
25 | -------------------------------------------------------------------------------- /app/views/personaldetails/partials/CorrespondenceAddressView.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import components.P 18 | 19 | @this(addressView: AddressView, p: P) 20 | @(address: Option[models.Address], countries: List[Country])(implicit messages: play.api.i18n.Messages) 21 | 22 | @address.map { a => @addressView(a, countries)} 23 | 24 | @p(Text(messages("label.all_letters_will_be_sent_to_this_address"))) 25 | 26 | -------------------------------------------------------------------------------- /app/views/preferences/managePrefs.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import controllers.auth.requests.UserRequest 18 | @import scala.concurrent.ExecutionContext 19 | @import components.H1 20 | @import views.MainView 21 | @this( 22 | main: MainView, 23 | h1: H1, 24 | govukInsetText: GovukInsetText 25 | ) 26 | @(managePrefsPartial: Html)(implicit request: UserRequest[_], messages: play.api.i18n.Messages) 27 | 28 | @main( 29 | pageTitle = messages("label.manage_your_paperless_settings") 30 | ) { 31 | 32 | @h1("label.manage_your_paperless_settings") 33 | 34 | @govukInsetText(InsetText(content = Text(messages("label.any_updates_to_your_contact_details")))) 35 | 36 | @managePrefsPartial 37 | 38 | } 39 | -------------------------------------------------------------------------------- /app/views/print/NiLetterView.scala.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hmrc/pertax-frontend/f03aaaa032caeeb3d0a1f6c329f9e8f098b74397/app/views/print/NiLetterView.scala.html -------------------------------------------------------------------------------- /app/views/public/SessionTimeoutView.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import scala.concurrent.ExecutionContext 18 | @import components.{H1, P, Button} 19 | @import views.UnauthenticatedMainView 20 | @this( 21 | main: UnauthenticatedMainView, 22 | h1: H1, 23 | p: P, 24 | button: Button 25 | ) 26 | 27 | @()(implicit request: Request[_], messages: play.api.i18n.Messages) 28 | 29 | @main( 30 | pageTitle = messages("label.sign_in"), 31 | disableSessionExpired = true 32 | ) { 33 | 34 | @h1("label.youve_been_signed_out") 35 | @p(Text(messages("label.timeout_message"))) 36 | @button("label.sign_in", href=Some(controllers.routes.HomeController.index.url)) 37 | } 38 | -------------------------------------------------------------------------------- /app/views/selfassessment/DoYouKnowOtherCredentialsView.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import controllers.auth.requests.UserRequest 18 | @import views.html.selfassessment._ 19 | @import scala.concurrent.ExecutionContext 20 | @import views.MainView 21 | @this(main: MainView, saForm: selfAssessmentForm) 22 | 23 | @(wrongCredentialsUserForm: Form[dto.SAWrongCredentialsDto])(implicit request: UserRequest[_], messages: play.api.i18n.Messages) 24 | 25 | @title = { 26 | @if(wrongCredentialsUserForm.hasErrors){@messages("error.message.error") }@messages("title.do_you_know_other_credentials.h1") 27 | } 28 | 29 | @main( 30 | pageTitle = title.toString, 31 | showBackLink = true, 32 | backLinkID = false, 33 | backLinkUrl = controllers.routes.SaWrongCredentialsController.landingPage().url 34 | ) { 35 | @saForm(controllers.routes.SaWrongCredentialsController.processDoYouKnowOtherCredentials(), messages("title.do_you_know_other_credentials.h1"), wrongCredentialsUserForm) 36 | } 37 | 38 | -------------------------------------------------------------------------------- /app/views/selfassessment/DoYouKnowUserIdView.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import controllers.auth.requests.UserRequest 18 | @import views.html.selfassessment.selfAssessmentForm 19 | @import scala.concurrent.ExecutionContext 20 | @import views.MainView 21 | @this(main: MainView, saForm: selfAssessmentForm) 22 | @(wrongCredentialsUserForm: Form[dto.SAWrongCredentialsDto])(implicit request: UserRequest[_], messages: play.api.i18n.Messages) 23 | 24 | @title = { 25 | @if(wrongCredentialsUserForm.hasErrors){@messages("error.message.error") }@messages("title.do_you_know_user_id.h1") 26 | } 27 | 28 | @main( 29 | pageTitle = title.toString, 30 | showBackLink = true, 31 | backLinkID = false, 32 | backLinkUrl = routes.SaWrongCredentialsController.doYouKnowOtherCredentials().url 33 | ) { 34 | 35 | @saForm(routes.SaWrongCredentialsController.processDoYouKnowUserId(), messages("title.do_you_know_user_id.h1"), wrongCredentialsUserForm) 36 | 37 | } 38 | -------------------------------------------------------------------------------- /app/views/selfassessment/SignInAgainView.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import controllers.auth.requests.UserRequest 18 | @import views.html.selfassessment.selfAssessmentHeading 19 | @import scala.concurrent.ExecutionContext 20 | @import components.{P, Button} 21 | @import views.MainView 22 | @this(main: MainView, selfAssessmentHeading: selfAssessmentHeading, p: P, button: Button) 23 | 24 | @(signInAgainUrl: String)(implicit request: UserRequest[_], messages: play.api.i18n.Messages) 25 | 26 | @main( 27 | pageTitle = messages("title.sign_in_again.h1"), 28 | showBackLink = true, 29 | backLinkID = false, 30 | backLinkUrl = controllers.routes.SaWrongCredentialsController.doYouKnowOtherCredentials().url 31 | ) { 32 | @selfAssessmentHeading("title.sign_in_again.h1") 33 | 34 | @p(Text(messages("label.sign_in_again"))) 35 | 36 | @button("global.label.continue_button", href=Some(signInAgainUrl), id="continue") 37 | } 38 | -------------------------------------------------------------------------------- /app/views/selfassessment/SignedInWrongAccountView.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import controllers.auth.requests.UserRequest 18 | @import views.html.selfassessment.selfAssessmentHeading 19 | @import scala.concurrent.ExecutionContext 20 | @import components.{P, Button} 21 | @import views.MainView 22 | @this(main: MainView, selfAssessmentHeading: selfAssessmentHeading, p: P, button: Button) 23 | 24 | @()(implicit request: UserRequest[_], messages: play.api.i18n.Messages) 25 | 26 | @main( 27 | pageTitle = messages("title.signed_in_wrong_account.h1"), 28 | showBackLink = true, 29 | backLinkID = false, 30 | backLinkUrl = routes.HomeController.index.url 31 | ) { 32 | 33 | @selfAssessmentHeading("title.signed_in_wrong_account.h1") 34 | 35 | @p(Text(messages("label.signed_in_wrong_account"))) 36 | 37 | @button("global.label.continue_button", href=Some(routes.SaWrongCredentialsController.doYouKnowOtherCredentials().url), id="continue") 38 | 39 | } 40 | -------------------------------------------------------------------------------- /app/views/selfassessment/selfAssessmentHeading.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import views.MainView 18 | @this(hmrcPageHeading: HmrcPageHeading) 19 | 20 | @(title: String)(implicit messages: play.api.i18n.Messages) 21 | 22 | @hmrcPageHeading(PageHeading( 23 | text = messages(title), 24 | section = Some(messages("label.access_your_self_assessment")) 25 | )) 26 | -------------------------------------------------------------------------------- /app/views/selfassessment/selfAssessmentUtr.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import views.MainView 18 | @this() 19 | 20 | @(saUtr: Option[String])(implicit messages: play.api.i18n.Messages) 21 | 22 |

23 | @messages("labels.need_utr") 24 |

25 | 26 | @saUtr.map { utr => 27 |

28 | @messages("labels.your_utr_is") @utr. 29 |

30 | } -------------------------------------------------------------------------------- /app/views/tags/cardHelper.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @(cardLinkHref: String, 18 | gaAction: String, 19 | gaLabel: String, 20 | tileTitle: String, 21 | tileText: String 22 | )(tileLinks: Html) 23 | 24 |
25 | 29 |
30 |

@tileTitle

31 |

@tileText

32 |
33 |
34 | 37 |
38 |
39 | -------------------------------------------------------------------------------- /app/views/tags/cardNewsAndUpdates.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @import config.ConfigDecorator 18 | @(id: Option[String] = None, 19 | heading: String, 20 | headingTag: String = "h2", 21 | newsAndContentModelList: List[NewsAndContentModel], 22 | configDecorator: ConfigDecorator 23 | ) 24 | 25 |
id="@i" }> 26 | 27 |
28 | 29 | <@headingTag class="govuk-heading-s card-heading card-heading-news"> 30 | @heading 31 | 32 | 33 | 34 | @for(newsAndContentModel <- newsAndContentModelList) { 35 |

@newsAndContentModel.shortDescription

36 | } 37 |
38 | 39 |
40 | -------------------------------------------------------------------------------- /app/views/tags/formattedNino.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @(nino: Nino) 18 | 19 | @Html(nino.value.grouped(2).mkString("")) 20 | 21 | -------------------------------------------------------------------------------- /app/views/tags/fullAddress.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @(address: models.Address) 18 | 19 |
20 | @address.lines.map { line => 21 | @upperCaseToTitleCase(line)
22 | } 23 | 24 | @address.postcode.map(_.toUpperCase) 25 |
26 | -------------------------------------------------------------------------------- /app/views/tags/gaTrackAnchorEventTranslateLabel.scala.html: -------------------------------------------------------------------------------- 1 | @* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *@ 16 | 17 | @(key: String, lang: String)(implicit messagesApi: play.api.i18n.MessagesApi) @messagesApi.translate(key, "")(Lang(lang)) -------------------------------------------------------------------------------- /conf/admin.routes: -------------------------------------------------------------------------------- 1 | -> /featureFlags mongoFeatureTogglesAdmin.Routes 2 | -------------------------------------------------------------------------------- /conf/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | %coloredLevel %logger{15} - %message%n%xException{10} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /conf/no-logger.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /conf/testOnlyDoNotUseInAppConf.routes: -------------------------------------------------------------------------------- 1 | # IF THE MICRO-SERVICE DOES NOT NEED ANY TEST-ONLY END-POINTS (ALWAYS PREFERRED) DELETE THIS FILE. 2 | 3 | # !!!WARNING!!! This file MUST NOT be referenced in the "application.conf" file to avoid risk of rolling test routes in the production environment. 4 | # If you need test routes when running tests in CI make sure that the profile for this micro-service (used by service-manager) defines this router as parameter. 5 | # To do so add the following line to the micro-service profile: "-Dapplication.router=testOnlyDoNotUseInAppConf.Routes" 6 | # To start the micro-service locally using the test routes run the following command: "sbt run -Dapplication.router=testOnlyDoNotUseInAppConf.Routes" 7 | 8 | # Any test-only end-point should be defined here. 9 | # !!!WARNING!!! Every route defined in this file MUST be prefixed with "/test-only/". This is because NGINX is blocking every uri containing the string "test-only" in production. 10 | # Failing to follow this rule may result in test routes deployed in production. 11 | 12 | # Add all the application routes to the prod.routes file 13 | 14 | -> / prod.Routes 15 | 16 | -> /pertax-frontend/ mongoFeatureTogglesTestOnly.Routes 17 | -> /personal-account/ mongoFeatureTogglesTestOnly.Routes 18 | 19 | PUT /personal-account/test-only/setDefaultFlags controllers.testOnly.FeatureFlagsController.setDefaults() -------------------------------------------------------------------------------- /it/test/resources/citizen-details.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": { 3 | "current": { 4 | "firstName": "John", 5 | "lastName": "Smith" 6 | }, 7 | "previous": [] 8 | }, 9 | "ids": { 10 | "nino": "" 11 | }, 12 | "dateOfBirth": "11121971" 13 | } -------------------------------------------------------------------------------- /it/test/resources/person-details.json: -------------------------------------------------------------------------------- 1 | { 2 | "etag" : "115", 3 | "person" : { 4 | "firstName" : "HIPPY", 5 | "middleName" : "T", 6 | "lastName" : "NEWYEAR", 7 | "title" : "Mr", 8 | "honours": "BSC", 9 | "sex" : "M", 10 | "dateOfBirth" : "1952-04-01", 11 | "nino" : "", 12 | "deceased" : false 13 | }, 14 | "address" : { 15 | "line1" : "26 FARADAY DRIVE", 16 | "line2" : "PO BOX 45", 17 | "line3" : "LONDON", 18 | "postcode" : "CT1 1RQ", 19 | "startDate": "2009-08-29", 20 | "country" : "GREAT BRITAIN", 21 | "type" : "Residential" 22 | } 23 | } -------------------------------------------------------------------------------- /it/test/testUtils/FileHelper.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package testUtils 18 | 19 | import uk.gov.hmrc.domain.Nino 20 | import scala.io.Source.fromFile 21 | 22 | object FileHelper { 23 | 24 | def loadFile(name: String): String = { 25 | val source = fromFile(name) 26 | try source.mkString 27 | finally source.close() 28 | } 29 | 30 | def loadFileInterpolatingNino(name: String, nino: Nino): String = 31 | loadFile(name).replaceAll("", nino.nino) 32 | } 33 | -------------------------------------------------------------------------------- /it/test/testUtils/WireMockHelper.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package testUtils 18 | 19 | import com.github.tomakehurst.wiremock.WireMockServer 20 | import com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig 21 | import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach, Suite} 22 | 23 | trait WireMockHelper extends BeforeAndAfterAll with BeforeAndAfterEach { 24 | this: Suite => 25 | 26 | protected val server: WireMockServer = new WireMockServer(wireMockConfig().dynamicPort()) 27 | 28 | override def beforeAll(): Unit = { 29 | server.start() 30 | super.beforeAll() 31 | } 32 | 33 | override def beforeEach(): Unit = { 34 | server.resetAll() 35 | super.beforeEach() 36 | } 37 | 38 | override def afterAll(): Unit = { 39 | super.afterAll() 40 | server.stop() 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /local-portal/stopLocalPortal.sh: -------------------------------------------------------------------------------- 1 | portalnginx=/home/richardb/Applications/hmrc-development-environment/portal-environment/portal-nginx 2 | 3 | printf "Killing required services" 4 | while true;do echo -n .;sleep 1;done & 5 | sleep 5 6 | kill $!; trap 'kill $!' SIGTERM 7 | printf "\r\n" 8 | 9 | cd $portalnginx 10 | sm --stop $(cat services.txt) -f 11 | 12 | printf "Killing Tomcat instances" 13 | while true;do echo -n .;sleep 1;done & 14 | sleep 5 15 | kill $!; trap 'kill $!' SIGTERM 16 | printf "\r\n" 17 | pkill -9 -f tomcat 18 | 19 | printf "killing Docker containers" 20 | while true;do echo -n .;sleep 1;done & 21 | sleep 5 22 | kill $!; trap 'kill $!' SIGTERM 23 | printf "\r\n" 24 | 25 | docker kill $(docker ps -q) 26 | docker rm $(docker ps -a -q) 27 | -------------------------------------------------------------------------------- /project/AppDependencies.scala: -------------------------------------------------------------------------------- 1 | import play.sbt.PlayImport.* 2 | import sbt.* 3 | 4 | object AppDependencies { 5 | 6 | private val playVersion = "play-30" 7 | private val cryptoVersion = "8.2.0" 8 | private val webChatVersion = "1.7.0" 9 | private val scaWrapperVersion = "2.10.0" 10 | private val mongoFeatureClientVersion = "1.10.0" 11 | 12 | val compile: Seq[ModuleID] = Seq( 13 | ws, 14 | "uk.gov.hmrc" %% "tax-year" % "5.0.0", 15 | "io.lemonlabs" %% "scala-uri" % "4.0.3", 16 | "org.jsoup" % "jsoup" % "1.18.3", 17 | "org.typelevel" %% "cats-core" % "2.13.0", 18 | "org.typelevel" %% "cats-effect" % "3.5.4", 19 | "org.apache.commons" % "commons-text" % "1.12.0", 20 | "uk.gov.hmrc" %% s"sca-wrapper-$playVersion" % scaWrapperVersion, 21 | "uk.gov.hmrc" %% s"mongo-feature-toggles-client-$playVersion" % mongoFeatureClientVersion, 22 | "uk.gov.hmrc" %% s"crypto-json-$playVersion" % cryptoVersion, 23 | "uk.gov.hmrc" %% "digital-engagement-platform-chat-30" % webChatVersion 24 | ) 25 | 26 | val test: Seq[ModuleID] = Seq( 27 | "uk.gov.hmrc" %% s"sca-wrapper-test-$playVersion" % scaWrapperVersion, 28 | "uk.gov.hmrc" %% s"mongo-feature-toggles-client-test-$playVersion" % mongoFeatureClientVersion 29 | ).map(_ % "test") 30 | 31 | val all: Seq[ModuleID] = compile ++ test 32 | } 33 | -------------------------------------------------------------------------------- /project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version=1.10.10 2 | -------------------------------------------------------------------------------- /project/plugins.sbt: -------------------------------------------------------------------------------- 1 | resolvers += MavenRepository("HMRC-open-artefacts-maven2", "https://open.artefacts.tax.service.gov.uk/maven2") 2 | resolvers += Resolver.url("HMRC-open-artefacts-ivy2", url("https://open.artefacts.tax.service.gov.uk/ivy2"))( 3 | Resolver.ivyStylePatterns 4 | ) 5 | resolvers += "Typesafe Releases" at "https://repo.typesafe.com/typesafe/releases/" 6 | 7 | addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.3.0") 8 | addSbtPlugin("uk.gov.hmrc" % "sbt-auto-build" % "3.24.0") 9 | addSbtPlugin("uk.gov.hmrc" % "sbt-distributables" % "2.6.0") 10 | addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.6") 11 | addSbtPlugin("com.github.sbt" % "sbt-digest" % "2.0.0") 12 | addSbtPlugin("io.github.irundaia" % "sbt-sassify" % "1.5.2") 13 | addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.4") 14 | addSbtPlugin("uk.gov.hmrc" % "sbt-accessibility-linter" % "1.0.0") 15 | -------------------------------------------------------------------------------- /public/css/ie.css: -------------------------------------------------------------------------------- 1 | .ni-footer-info { display:none; } 2 | 3 | p.url, p.phone{ 4 | margin-bottom:5px; 5 | margin-to:0px; 6 | } 7 | 8 | p, li { 9 | font-size: 16px; 10 | } 11 | p.list-paragraph { 12 | margin-bottom:5px; 13 | } 14 | 15 | h2.keep-heading{ 16 | margin-top:5px; 17 | 18 | } 19 | 20 | p.available-information{ 21 | font-size: 24px; 22 | margin-bottom: 0; 23 | -webkit-print-color-adjust: exact; 24 | 25 | } 26 | 27 | 28 | -------------------------------------------------------------------------------- /public/images/HMRC-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hmrc/pertax-frontend/f03aaaa032caeeb3d0a1f6c329f9e8f098b74397/public/images/HMRC-logo.jpg -------------------------------------------------------------------------------- /public/images/HMRC-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hmrc/pertax-frontend/f03aaaa032caeeb3d0a1f6c329f9e8f098b74397/public/images/HMRC-logo.png -------------------------------------------------------------------------------- /public/images/covid-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hmrc/pertax-frontend/f03aaaa032caeeb3d0a1f6c329f9e8f098b74397/public/images/covid-icon.png -------------------------------------------------------------------------------- /public/images/covid-icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /public/images/print-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hmrc/pertax-frontend/f03aaaa032caeeb3d0a1f6c329f9e8f098b74397/public/images/print-icon.png -------------------------------------------------------------------------------- /public/images/tick.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hmrc/pertax-frontend/f03aaaa032caeeb3d0a1f6c329f9e8f098b74397/public/images/tick.png -------------------------------------------------------------------------------- /repository.yaml: -------------------------------------------------------------------------------- 1 | repoVisibility: public_0C3F0CE3E6E6448FAD341E7BFA50FCD333E06A20CFF05FCACE61154DDBBADF71 2 | test-repositories: 3 | - gateway-performance-tests 4 | - paye-performance-test 5 | - pensions-lifetime-allowance-performance-tests 6 | - pertax-performance-tests 7 | - platform-performance-tests 8 | - pertax-acceptance-tests 9 | -------------------------------------------------------------------------------- /test/controllers/address/AddressErrorControllerSpec.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package controllers.address 18 | 19 | import controllers.bindable.ResidentialAddrType 20 | import play.api.mvc._ 21 | import play.api.test.Helpers._ 22 | 23 | import scala.concurrent.Future 24 | 25 | class AddressErrorControllerSpec extends AddressBaseSpec { 26 | 27 | private lazy val controller: AddressErrorController = app.injector.instanceOf[AddressErrorController] 28 | 29 | "cannotUseThisService" must { 30 | 31 | "display the cannot use this service page" in { 32 | val result: Future[Result] = controller.cannotUseThisService(ResidentialAddrType)(currentRequest) 33 | 34 | status(result) mustBe INTERNAL_SERVER_ERROR 35 | contentAsString(result) must include("You cannot use this service to update your address") 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /test/models/PayApiModelsSpec.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models 18 | 19 | import play.api.libs.json.Json 20 | import testUtils.BaseSpec 21 | 22 | class PayApiModelsSpec extends BaseSpec { 23 | 24 | "PayApiModels" must { 25 | 26 | "serialise and de-serialise json" in { 27 | 28 | val obj = PayApiModels("123", "/fake-url/suffix") 29 | 30 | val json = Json.toJson(obj) 31 | 32 | json.as[PayApiModels] mustBe obj 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /test/models/SummaryCardPartialSpec.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models 18 | 19 | import play.api.libs.json.Json 20 | import testUtils.BaseSpec 21 | 22 | class SummaryCardPartialSpec extends BaseSpec { 23 | 24 | "Reads" must { 25 | "read valid json correctly" in { 26 | val json = Json.obj( 27 | "partialName" -> "card1", 28 | "partialContent" -> "

test-html

", 29 | "partialReconciliationStatus" -> Json.obj( 30 | "code" -> 5, 31 | "name" -> "Underpaid" 32 | ) 33 | ) 34 | val actual = json.as[SummaryCardPartial] 35 | actual.partialName mustBe "card1" 36 | actual.partialContent.toString().contains("test-html") 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /test/models/TaxCalculationStateSpec.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | -------------------------------------------------------------------------------- /test/models/addressLookup/AddressRecordSpec.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models.addressLookup 18 | 19 | import models.addresslookup.{Address, AddressRecord, Country} 20 | import testUtils.BaseSpec 21 | 22 | class AddressRecordSpec extends BaseSpec { 23 | 24 | "calling AddressRecord.validAddress" must { 25 | 26 | "return true where the address has at least one line" in { 27 | val addressLines = List("some line") 28 | val validAddress = Address(addressLines, None, None, "Some Postcode", None, Country("UK", "United Kingdom")) 29 | AddressRecord("some id", validAddress, "en").isValid mustBe true 30 | } 31 | 32 | "return false where the address has no lines" in { 33 | val noAddressLines = List() 34 | val invalidAddress = 35 | Address(noAddressLines, None, None, "Some Postcode", None, Country("UK", "United Kingdom")) 36 | AddressRecord("some id", invalidAddress, "en").isValid mustBe false 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /test/models/addressLookup/AddressSpec.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package models.addressLookup 18 | 19 | import models.addresslookup.{Address, Country} 20 | import testUtils.BaseSpec 21 | 22 | class AddressSpec extends BaseSpec { 23 | 24 | "calling hasAddressLines" must { 25 | "return true where the address has at least one line" in { 26 | val addressLines = List("some line") 27 | Address(addressLines, None, None, "Some Postcode", None, Country("UK", "United Kingdom")).isValid mustBe true 28 | } 29 | 30 | "return false where the address has no lines" in { 31 | val noAddressLines = List() 32 | Address( 33 | noAddressLines, 34 | None, 35 | None, 36 | "Some Postcode", 37 | None, 38 | Country("UK", "United Kingdom") 39 | ).isValid mustBe false 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /test/resources/address-lookup/recordSet.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": "GB990091234514", 4 | "address": { 5 | "lines": [ 6 | "2 Other Place", 7 | "Some District" 8 | ], 9 | "town": "Anytown", 10 | "postcode": "AA1 1AA", 11 | "country": { 12 | "code": "UK", 13 | "name": "United Kingdom" 14 | }, 15 | "subdivision": { 16 | "code": "GB-ENG", 17 | "name": "England" 18 | }, 19 | "status": 0 20 | }, 21 | "language": "en" 22 | }, 23 | { 24 | "id": "GB990091234515", 25 | "address": { 26 | "lines": [ 27 | "3 Other Place", 28 | "Some District" 29 | ], 30 | "town": "Anytown", 31 | "postcode": "AA1 1AA", 32 | "country": { 33 | "code": "UK", 34 | "name": "United Kingdom" 35 | }, 36 | "subdivision":{ 37 | "code": "GB-SCT", 38 | "name": "Scotland" 39 | }, 40 | "status": 0 41 | }, 42 | "language": "en" 43 | } 44 | ] 45 | -------------------------------------------------------------------------------- /test/resources/address-lookup/recordSetWithMissingAddressLines.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": "GB990091234514", 4 | "address": { 5 | "lines": [ 6 | ], 7 | "town": "Anytown", 8 | "postcode": "AA1 1AA", 9 | "country": { 10 | "code": "UK", 11 | "name": "United Kingdom" 12 | }, 13 | "subdivision": { 14 | "code": "GB-ENG", 15 | "name": "England" 16 | }, 17 | "status": 0 18 | }, 19 | "language": "en" 20 | }, 21 | { 22 | "id": "GB990091234515", 23 | "address": { 24 | "lines": [ 25 | "3 Other Place", 26 | "Some District" 27 | ], 28 | "town": "Anytown", 29 | "postcode": "AA1 1AA", 30 | "country": { 31 | "code": "UK", 32 | "name": "United Kingdom" 33 | }, 34 | "subdivision":{ 35 | "code": "GB-SCT", 36 | "name": "Scotland" 37 | }, 38 | "status": 0 39 | }, 40 | "language": "en" 41 | } 42 | ] 43 | -------------------------------------------------------------------------------- /test/resources/application.conf: -------------------------------------------------------------------------------- 1 | # Copyright 2023 HM Revenue & Customs 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include "/conf/application.conf" 16 | 17 | play.ws.timeout.request = "1000ms" 18 | play.ws.timeout.connection = "500ms" 19 | 20 | -------------------------------------------------------------------------------- /test/resources/paperless-status/PaperlessStatusAlright.json: -------------------------------------------------------------------------------- 1 | { 2 | "status": { 3 | "name": "ALRIGHT", 4 | "category": "INFO", 5 | "text": "You chose to get your Self Assessment tax letters online" 6 | }, 7 | "url": { 8 | "link": "http://localhost:9024/paperless/check-settings?returnUrl=VYBxyuFWQBQZAGpe5tSgmw%3D%3D&returnLinkText=VYBxyuFWQBQZAGpe5tSgmw%3D%3D", 9 | "text": "Check your settings" 10 | } 11 | } -------------------------------------------------------------------------------- /test/resources/paperless-status/PaperlessStatusBounced.json: -------------------------------------------------------------------------------- 1 | { 2 | "status": { 3 | "name": "BOUNCED_EMAIL", 4 | "category": "ACTION_REQUIRED", 5 | "text": "We cannot deliver emails to you. You need to take action before you can get Self Assessment tax letters online." 6 | }, 7 | "url": { 8 | "link": "http://localhost:9024/paperless/check-settings?returnUrl=VYBxyuFWQBQZAGpe5tSgmw%3D%3D&returnLinkText=VYBxyuFWQBQZAGpe5tSgmw%3D%3D", 9 | "text": "Confirm or change your email address" 10 | } 11 | } -------------------------------------------------------------------------------- /test/testUtils/BetterOptionValues.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package testUtils 18 | 19 | import org.scalactic.source 20 | import org.scalatest.exceptions.{StackDepthException, TestFailedException} 21 | 22 | object BetterOptionValues { 23 | implicit class OptionOps[T](val opt: Option[T]) extends AnyVal { 24 | 25 | def getValue(implicit pos: source.Position): T = 26 | try opt.get 27 | catch { 28 | case cause: NoSuchElementException => 29 | throw new TestFailedException( 30 | (_: StackDepthException) => Some("The Option on which value was invoked was not defined."), 31 | Some(cause), 32 | pos 33 | ) 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /test/testUtils/FileHelper.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package testUtils 18 | 19 | import uk.gov.hmrc.domain.Nino 20 | 21 | import scala.io.Source.fromFile 22 | 23 | object FileHelper { 24 | 25 | def loadFile(name: String): String = { 26 | val source = fromFile(name) 27 | try source.mkString 28 | finally source.close() 29 | } 30 | 31 | def loadFileInterpolatingNino(name: String, nino: Nino): String = 32 | loadFile(name).replaceAll("", nino.nino) 33 | } 34 | -------------------------------------------------------------------------------- /test/testUtils/NullMetrics.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package testUtils 18 | 19 | import com.codahale.metrics.MetricRegistry 20 | import uk.gov.hmrc.play.bootstrap.metrics.Metrics 21 | 22 | class NullMetrics extends Metrics { 23 | override def defaultRegistry: MetricRegistry = new MetricRegistry 24 | } 25 | -------------------------------------------------------------------------------- /test/testUtils/RetrievalOps.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package testUtils 18 | 19 | import uk.gov.hmrc.auth.core.retrieve.~ 20 | 21 | object RetrievalOps { 22 | implicit class Ops[A](a: A) { 23 | def ~[B](b: B): A ~ B = new ~(a, b) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test/testUtils/WireMockHelper.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package testUtils 18 | 19 | import com.github.tomakehurst.wiremock.WireMockServer 20 | import com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig 21 | import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach, Suite} 22 | 23 | trait WireMockHelper extends BeforeAndAfterAll with BeforeAndAfterEach { 24 | this: Suite => 25 | 26 | val server: WireMockServer = new WireMockServer(wireMockConfig().dynamicPort()) 27 | 28 | override def beforeAll(): Unit = { 29 | server.start() 30 | super.beforeAll() 31 | } 32 | 33 | override def beforeEach(): Unit = { 34 | server.resetAll() 35 | super.beforeEach() 36 | } 37 | 38 | override def afterAll(): Unit = { 39 | super.afterAll() 40 | server.stop() 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /test/testUtils/fakes/FakePaperlessInterruptHelper.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package testUtils.fakes 18 | 19 | import controllers.auth.requests.UserRequest 20 | import controllers.controllershelpers.{PaperlessInterruptHelper} 21 | import play.api.mvc._ 22 | 23 | import scala.concurrent.{ExecutionContext, Future} 24 | 25 | class FakePaperlessInterruptHelper extends PaperlessInterruptHelper { 26 | def enforcePaperlessPreference( 27 | block: => Future[Result] 28 | )(implicit request: UserRequest[_], ec: ExecutionContext): Future[Result] = block 29 | } 30 | -------------------------------------------------------------------------------- /test/testUtils/fakes/FakeRlsInterruptHelper.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package testUtils.fakes 18 | 19 | import controllers.auth.requests.UserRequest 20 | import controllers.controllershelpers.RlsInterruptHelper 21 | import play.api.mvc._ 22 | 23 | import scala.concurrent.{ExecutionContext, Future} 24 | 25 | class FakeRlsInterruptHelper extends RlsInterruptHelper { 26 | def enforceByRlsStatus( 27 | block: => Future[Result] 28 | )(implicit request: UserRequest[_], ec: ExecutionContext): Future[Result] = block 29 | } 30 | -------------------------------------------------------------------------------- /test/testUtils/fixtures/AddressFixture.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package testUtils.fixtures 18 | 19 | import models.Address 20 | import java.time.LocalDate 21 | 22 | object AddressFixture { 23 | 24 | def address( 25 | line1: Option[String] = None, 26 | line2: Option[String] = None, 27 | line3: Option[String] = None, 28 | line4: Option[String] = None, 29 | line5: Option[String] = None, 30 | postcode: Option[String] = None, 31 | country: Option[String] = None, 32 | startDate: Option[LocalDate] = None, 33 | endDate: Option[LocalDate] = None, 34 | `type`: Option[String] = None, 35 | isRls: Boolean = false 36 | ): Address = 37 | Address(line1, line2, line3, line4, line5, postcode, country, startDate, endDate, `type`, isRls) 38 | 39 | } 40 | -------------------------------------------------------------------------------- /test/testUtils/fixtures/PersonFixture.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package testUtils.fixtures 18 | 19 | import models.Person 20 | 21 | object PersonFixture { 22 | 23 | def emptyPerson: Person = Person(None, None, None, None, None, None, None, None, None) 24 | 25 | } 26 | -------------------------------------------------------------------------------- /test/util/DateTimeToolsSpec.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package util 18 | 19 | import testUtils.BaseSpec 20 | import util.DateTimeTools.previousAndCurrentTaxYearFromGivenYear 21 | 22 | class DateTimeToolsSpec extends BaseSpec { 23 | "previousAndCurrentTaxYearFromGivenYear" when { 24 | "provided with a year" must { 25 | "return the expected result" in { 26 | previousAndCurrentTaxYearFromGivenYear(2022) mustBe "2122" 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /test/views/html/cards/NISPViewSpec.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 HM Revenue & Customs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package views.html.cards 18 | 19 | import org.jsoup.nodes.Document 20 | import views.html.ViewSpec 21 | import views.html.cards.home.NISPView 22 | 23 | class NISPViewSpec extends ViewSpec { 24 | 25 | val nispView: NISPView = inject[NISPView] 26 | 27 | val doc: Document = asDocument(nispView().toString) 28 | 29 | "NISPView" must { 30 | "render the correct heading" in { 31 | doc.text() must include( 32 | messages("label.national_insurance_and_state_pension") 33 | ) 34 | } 35 | 36 | "render the correct content" in { 37 | doc.text() must include( 38 | messages("label.view_national_insurance") 39 | ) 40 | 41 | doc.text() must include( 42 | messages("label.view_state_pension") 43 | ) 44 | } 45 | } 46 | } 47 | --------------------------------------------------------------------------------