LandRegistry/deed-api

Name: deed-api

Owner: HM Land Registry

Description: null

Created: 2017-04-25 11:57:20.0

Updated: 2017-11-21 12:22:54.0

Pushed: 2017-11-21 12:22:51.0

Homepage: null

Size: 1873

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

dm-deed-api

The Deed API is a JSON API which stores deed objects.

This API holds the functionality for creating the migrating tables, getting data from the database and putting a new JSON deed onto a database that returns an endpoint to that deed.

The API also holds the functionality to capture personal information provided and save it in a separate table to be used at a later date for matching.

Please note that sensitive environment variables are inherited from the environment-store service and you would need to bring it into your devenv config for these to be set.

Contents
Usage
    /health                                 # Test endpoint for the application
    /health/service-check                   # Check the health of all services connected to deed-api
    /deed/<deed_reference>                  # Get a deed with an id in the URL
    /dashboard/<status>                     # Gets the total amount of deeds for each status
    /deed/retrieve-signed                   # Get all deeds that have been signed
    /deed/                                  # Create a deed by posting a json object reflecting the schema
    /deed/<deed_reference>/make-effective   # Makes a deed effective.
    /deed/<deed_reference>/verify-auth-code # Verify the auth code provided by a borrower, for their prospective deed.
    /deed/<deed_reference>                  # Update a deed. A new id is generated unless the id field is present in the payload
te  /borrowers/delete/<borrower_id>         # delete a borrower from the borrower table
Getting Started
  1. Clone the repo
  2. In the directory enter the command
    install -r requirements.txt
    
  3. To run the application run the command
    ce run.sh
    
Migration

Run the Migration

on manage.py db upgrade

Add a migration

on manage.py db revision --autogenerate

For some helpful documentation on using alembic go here

Unit tests

Run the unit tests

ce unit_test.sh

If you get the following errors:

and "python setup.py egg_info" failed with error code 1 in /private/var/folders/7c/lgmjhvmj5f3f0dvgk01ygzz80000gq/T/pip-build-c5k5vmpa/psycopg2/

then install (on a Mac)

 install postgresql

ror: dlopen() failed to load a library: cairo / cairo-2

then install (on a Mac)

 install python cairo pango gdk-pixbuf libxml2 libxslt libffi
Integration tests
ce integration_tests.sh
Current Schema

The Deed requires a title number, md ref and at least 1 borrower

Deed

The schema can be found in the application/deed/schemas folder under the filename of deed-api

Example payload with Enact-style lender-reference, date of mortgage offer, miscellaneous information:


"title_number": "CYM123457",
"md_ref": "e-MD1291A",
"property_address": "0 The Drive, This Town, This County, PL0 0TH",
"borrowers": [{
    "forename": "Ann",
    "surname": "Smith",
    "gender": "Male",
    "address": "test address with postcode, PL0 0JR",
    "dob": "02/02/1922",
    "phone_number": "07777777777"
}],
"identity_checked": "Y",
"date_of_mortgage_offer": "a date string",
"miscellaneous_information": "A Conveyancer"

Validate borrower

 -X POST -d '{"borrower_token":"AHDHDI", "dob":"02/02/1922"}' -H "Content-Type:application/json" localhost:9020/borrower/validate

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.