├── .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 |" + 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 |@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 |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 |@tileText
32 |