Skip to content

hmrc/gmp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GMP Service

Guaranteed Minimum Pension microservice with HIP (Hosted Integration Platform) and DES (Data Exchange Service) integration.

Build Status Download

Features

  • SCON validation via HIP (Hosted Integration Platform)
  • Fallback to DES (Data Exchange Service) when HIP is unavailable
  • Secure logging with sensitive data redaction
  • Caching for improved performance
  • Comprehensive test coverage (98.68% statement, 91.43% branch)

SCON Structure(^S[0124568]\d{6}(?![GIOSUVZ])[A-Z]$)

  • An SCON always begins with S (mandatory).
  • It’s followed by a digit indicating the scheme type (e.g. 0,1,2,4,5,6,8 depending on the scheme rules).
  • Then 6 more digits.
  • Suffix letter, must avoid certain letters [GIOSUVZ].

API

PATH Supported Methods Description
/:userId/gmp/calculate POST Requests a GMP calculation for a specific user
/:userId/gmp/validateScon POST Validates the SCON for the specified user

gmp/calculate

Calculates GMP for a specific user. This method calls into a connected DES service to perform the actual calculation, and returns the result.

Request

Field Description
scon The person's scheme contracted out number
nino The national insurance number
surname The person's surname
firstForename The person's forename
calcType Optional The calculation type
revaluationDate Optional The date on which the GMP should be revalued
revaluationRate Optional The rate at which the GMP should be revalued
requestEarnings Optional Whether constants and earnings values should be returned in the response
dualCalc Optional Whether opposite gender calculation should be performed
terminationDate Optional The date on which the member left the scheme

Example JSON response:

{
   "name": "J Bloggs",
   "nino": "<user national insurance number>",
   "scon": "<user scon>",
   "revaluationRate": "HMRC",
   "revaluationDate": "2016-08-27",
   "calculationPeriods": [],
   "globalErrorCode": 0,
   "spaDate": "2010-02-25",
   "payableAgeDate": "2016-03-01",
   "dateOfDeath": "1999-05-01",
   "dualCalc": false,
   "calcType": 1
}

gmp/validateScon

An API method to validate whether a user's SCON exists or not. The service will attempt to use HIP (Hosted Integration Platform) by default, with a fallback to DES (Data Exchange Service) if configured.

Request

POST /:userId/gmp/validateScon
Content-Type: application/json

{
  "scon": "S1401234Q"
}

Request Fields

Field Required Description
scon Yes The user's SCON to validate (3-10 alphanumeric characters)

Response

Success (200 OK)

{
  "sconExists": true
}

Error Responses

Status Description Response Body
400 Bad Request Invalid SCON format {"error": "Invalid SCON format"}
500 Internal Server Error Service unavailable {"error": "Service unavailable"}

Features

  • HIP Integration: Validates SCONs using the Hosted Integration Platform
  • Caching: Responses are cached to improve performance
  • Secure Logging: All logs are automatically redacted to protect sensitive information
  • Fallback Mechanism: Automatically falls back to DES if HIP is unavailable (configurable)

Local Development

Prerequisites

  • Java 8 or later
  • sbt 1.5.0 or later
  • Service Manager (for dependent services)

Running the Application

  1. Start required services using Service Manager:

    sm2 --start GMP_ALL
  2. Run the application:

    sbt run 

Configuration

The following configuration options are available in application.conf:

Setting Default Description
app.hip.enabled true Enable/disable HIP integration
app.hip.url - Base URL for HIP service
app.hip.authorisationToken - Authorization token for HIP
app.cache.enabled true Enable/disable response caching

Testing

Run all tests:

sbt test

Generate coverage report:

sbt clean coverage test coverageReport

Logging

The application uses SLF4J with Logback for logging. Sensitive data is automatically redacted from logs.

  • Log Levels:
    • ERROR: Application errors and exceptions
    • WARN: Non-critical issues
    • INFO: Important application events
    • DEBUG: Detailed debug information (sensitive data is redacted)

Example log output:

[INFO] [ValidateSconController] HIP validation successful for SCON: S14******
[WARN] [HipConnector] HIP service returned 400 for SCON: S14******

License

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 45

Languages