Giter Club home page Giter Club logo

hmrc.customs-declarations-information's Introduction

Customs Declarations Information

This API permits requesting the status of a declaration.

The user must supply an MRN, DUCR, UCR or inventory reference as a parameter in the request URL. The endpoint returns a set of latest status details.

GET Status Request

GET /mrn/{mrn}/status

GET /ducr/{ducr}/status

GET /ucr/{ucr}/status

GET /inventory-reference/{inventoryReference}/status

curl command (using mrn as an example)

 curl -v -X GET "http://localhost:9000/mrn/{valid mrn}/status" \
  -H 'Accept: application/vnd.hmrc.1.0+xml' \
  -H 'Authorization: Bearer {ADD VALID TOKEN}' \
  -H 'X-Badge-Identifier: {Badge Id}' \
  -H 'X-Submitter-Identifier: {Submitter Id}' \
  -H 'X-Client-ID: {Valid Client Id}' \
  -H 'cache-control: no-cache' 


Lookup of authenticatedEori from api-subscription-fields service for CSPs only

The X-Client-ID header, together with the application context and version are used to call the api-subscription-fields service to get the authenticatedEori to pass on to the backend request (where it is known as authenticatedPartyID).

So there is a direct dependency on the api-subscription-fields service. Note the service to get the authenticatedEori is not currently stubbed.

Seeding Data in api-subscription-fields for local end to end testing

Make sure the api-subscription-fields service is running on port 9650. Then run the below curl command.

Please note that version 1.0 is used as an example in the commands given and you should insert the customs declarations information api version number which you will call subsequently.

Please note that value d65f2252-9fcf-4f04-9445-5971021226bb is used as an example in the commands given and you should insert the UUID value which suits your needs.

curl -v -X PUT "http://localhost:9650/field/application/d65f2252-9fcf-4f04-9445-5971021226bb/context/customs%2Fdeclarations-information/version/1.0" -H "Cache-Control: no-cache" -H "Content-Type: application/json" -d '{ "fields" : { "authenticatedEori" : "GB123456789000" } }'

When you then send a request to customs-declarations-information make sure you have the HTTP header X-Client-ID with the value d65f2252-9fcf-4f04-9445-5971021226bb

There is no lookup of api-subscription-fields for non-CSP requests.

Switching service endpoints

Dynamic switching of service endpoints has been implemented for the declaration status connector. To configure dynamic switching of the endpoint there must be a corresponding section in the application config file (see example below). This should contain the endpoint config details.

Example

The service customs-declarations-information has a default configuration and a stub configuration. Note that default configuration is declared directly inside the customs-declarations-information section.

Prod {
    ...
    services {
      ...

      declaration-status {
        host = some.host
        port = 80
        bearer-token = "some_token"
        context = /declarations/querystatusinformation/v1

        stub {
          host = localhost
          port = 9479
          bearer-token = "some_stub_token"
          context = /declarations/querystatusinformation/v1
        }
      }
    }
}

Switch service configuration to stub for an endpoint

REQUEST

default version (application/vnd.hmrc.1.0+xml):
curl -X "POST" http://customs-declarations-information-host/test-only/service/declaration-status/configuration -H 'content-type: application/json' -d '{ "environment": "stub" }'

RESPONSE

The service customs-declarations-information is now configured to use the stub environment

Switch service configuration to default for an endpoint

REQUEST

curl -X "POST" http://customs-declarations-information-host/test-only/service/declaration-status/configuration -H 'content-type: application/json' -d '{ "environment": "default" }'

RESPONSE

The service customs-declarations-information is now configured to use the default environment

Get the current configuration for a service

REQUEST

curl -X "GET" http://customs-declarations-information-host/test-only/service/declaration-status/configuration

RESPONSE

{
  "service": "declaration-status",
  "environment": "stub",
  "url": "http://currenturl/customs-declarations-information"
  "bearerToken": "current token"
}

License

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

hmrc.customs-declarations-information's People

Contributors

paulblakehmrc avatar rashadmughal avatar glidester avatar hmrc-web-operations avatar mailtogauravseth avatar raysonviswas avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.