Skip to content

hmrc/essttp-backend

Repository files navigation

essttp-backend

This repository contains the backend microservice for eSSTTP (Enhanced Self Service Time To Pay). It is built using Scala (2.13) and the Play framework (2.8). We use linting tools such as WartRemover and Scalariform. This microservice acts as a state machine, utilising mongodb. As users progress through the frontend journey various rest endpoints are called to update the state of the users journey. This project makes use of sbt modules - which act as libraries for our models and anything else we may want to reuse in the frontend. We have coined the term cor for these modules - collection of routines


Contents


Dictionary

Acronyms used in a codebase. To speed up writing and reading.

Phrase Description
Sj Start Journey
Bta Business Tax Account - client app
Pta Personal Tax Account - client app
Epaye Employers' Pay as you earn - tax type
Vat Value-added tax - tax type
Sa Self Assessment - tax type

Diagram of flow state

graph TD;
    Started --> ComputedTaxId;
    ComputedTaxId --> EligibilityCheck;
    EligibilityCheck --> EligibilityCheck.Eligible;
    EligibilityCheck --> EligibilityCheck.Ineligible;
    EligibilityCheck.Eligible --> ObtainedWhyCannotPayInFullAnswers;
    ObtainedWhyCannotPayInFullAnswers --> AnsweredCanPayUpfront.Yes;
    ObtainedWhyCannotPayInFullAnswers --> AnsweredCanPayUpfront.No;
    AnsweredCanPayUpfront.No --> RetrievedExtremeDates;
    AnsweredCanPayUpfront.Yes --> EnteredUpfrontPaymentAmount --> RetrievedExtremeDates;
    RetrievedExtremeDates --> RetrievedAffordabilityResult;
    RetrievedAffordabilityResult --> ObtainedCanPayWithinSixMonthsAnswers;
    ObtainedCanPayWithinSixMonthsAnswers --> ObtainedCanPayWithinSixMonthsAnswers.Yes;
    ObtainedCanPayWithinSixMonthsAnswers --> ObtainedCanPayWithinSixMonthsAnswers.No;
    ObtainedCanPayWithinSixMonthsAnswers --> ObtainedCanPayWithinSixMonthsAnswers.NotRequired;
    ObtainedCanPayWithinSixMonthsAnswers.Yes --> EnteredMonthlyPaymentAmount;
    ObtainedCanPayWithinSixMonthsAnswers.No --> StartedPEGACase;
    StartedPEGACase --> CheckedPaymentPlan;
    ObtainedCanPayWithinSixMonthsAnswers.NotRequired --> EnteredMonthlyPaymentAmount;
    EnteredMonthlyPaymentAmount --> EnteredDayOfMonth;
    EnteredDayOfMonth --> RetrievedStartDates;
    RetrievedStartDates --> RetrievedAffordableQuotes;
    RetrievedAffordableQuotes --> ChosenPaymentPlan;
    ChosenPaymentPlan --> CheckedPaymentPlan;
    CheckedPaymentPlan --> EnteredCanYouSetUpDirectDebit.CannotSetUpDirectDebit;
    CheckedPaymentPlan --> EnteredCanYouSetUpDirectDebit.CanSetUpDirectDebit;
    EnteredCanYouSetUpDirectDebit.CanSetUpDirectDebit --> EnteredDirectDebitDetails;
    EnteredDirectDebitDetails --> ConfirmedDirectDebitDetails;
    ConfirmedDirectDebitDetails --> EmailAddressRequired;
    ConfirmedDirectDebitDetails --> EmailAddressNotRequired;
    EmailAddressRequired --> EmailChosen;
    EmailChosen --> Locked;
    EmailChosen --> VerificationSuccess;
    VerificationSuccess --> SubmittedArrangement;
    EmailAddressNotRequired --> SubmittedArrangement;
Loading

To edit this, use mermaid live editor

Stages in code base


Running locally

You can run the service locally using sbt: sbt run

If running locally, the service runs on port 9216


Running tests

You can run the unit/integration tests locally using sbt: sbt test

To run a specific spec, run sbt 'testOnly *<SpecName>', e.g. sbt 'testOnly *JourneyControllerSpec'


Developing locally

If you want to make changes to one of the cors and test those changes locally before raising a pull request, you can publish your changes locally.

To do this, simply run

sbt publishLocal

to create a snapshot version of backend locally (e.g. 1.10.0-SNAPSHOT) then use that as the cor version in frontend.


Examples of requests

There are examples of http requests here


License

This code is open source software licensed under the Apache 2.0 License.