agent-services-account

Download

Running the tests

sbt test it:test

Running the tests with coverage

sbt clean coverageOn test it:test coverageReport

Running the app locally

sm --start AGENT_MTD -f
sm --stop AGENT_SERVICES_ACCOUNT
sbt run

It should then be listening on port 9402

browse http://localhost:9402/agent-services-account

API

Get Agency name for the logged in Agent user

GET /agent/agency-name

Possible responses:

OK

{
    "agencyName": "<Agent's agency name>"
}

No Content

If the agency is found in DES but there is no Agency name for it then a 204 response is returned.

Error

{
    "statusCode": "<ERROR_CODE>",
    "message": "<Error message>"
}

..where ERROR_CODE is something like 503 (DES is unavailable), 401 (user not authenticated), 403 (not an agent user with HMRC-AS-AGENT enrolment).

Get Agency name by ARN

GET /client/agency-name/:arn

Possible responses:

OK

{
    "agencyName": "<Agent's agency name>"
}

No Content

If the agency is found in DES but there is no Agency name for it then a 204 response is returned.

Bad Request (invalid ARN)

If the ARN is not valid, a Bad Request is returned with a JSON body like:

{
    "statusCode": 400,
    "message": "Invalid Arn"
}

Error

{
    "statusCode": "<ERROR_CODE>",
    "message": "<Error message>"
}

..where ERROR_CODE is something like 503 (DES is unavailable), 404 (DES does not know of the ARN), 401 (user not authenticated), 403 (not a user with HMRC-MTD-IT enrolment and MTDITID identifier).

Get Agency names for multiple ARNs

POST /client/agency-names

Here's the json request required:

["<Agent reference number1>", "<Agent reference number2>"]

Possible responses:

OK

[
    { 
        "arn": "<Agent reference number>"
        "agencyName": "<Agent's agency name>"
    }
]

If the agency is found in DES but there is no Agency name for it then a pre configured value or an empty string is returned.

Bad Request (invalid ARN)

If the ARN is not valid, a Bad Request is returned with a JSON body like:

{
    "statusCode": 400,
    "message": "Invalid Arn"
}

Error

{
    "statusCode": "<ERROR_CODE>",
    "message": "<Error message>"
}

..where ERROR_CODE is something like 503 (DES is unavailable), 404 (DES does not know of the ARN), 401 (user not authenticated), 403 (not a user with HMRC-MTD-IT enrolment and MTDITID identifier).

License

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