Esempio n. 1
0
def update_borrower(borrower, idx, borrowers, deed_token):
    borrower_service = BorrowerService()

    borrower_json = {
        "id": "",
        "token": "",
        "forename": borrower['forename'],
        "surname": borrower['surname']
    }

    if 'middle_name' in borrower:
        borrower_json["middle_name"] = borrower["middle_name"]

    if 'id' not in borrower:
        created_borrower = borrower_service.saveBorrower(borrower, deed_token)

        borrower_json["id"] = created_borrower.id
        borrower_json["token"] = created_borrower.token
    else:
        borrower_updater = BorrowerModel()
        updated_borrower = borrower_updater.update_borrower_by_id(borrower)

        borrower_json["id"] = int(borrower["id"])
        borrower_json["token"] = updated_borrower.token

    return borrower_json
Esempio n. 2
0
    def test_delete_borrower(self, client):

        borrowerService = BorrowerService()
        borrower = valid_deed["borrowers"][0]

        newBorrower = borrowerService.saveBorrower(borrower, "aaaaaa")
        response = client.delete('/deed/borrowers/delete/'+str(newBorrower.id))

        self.assertEqual(response.status_code, 200)
Esempio n. 3
0
    def test_validate_borrower(self, client):
        borrowerService = BorrowerService()

        borrower = valid_deed["borrowers"][0]

        newBorrower = borrowerService.saveBorrower(borrower, "aaaaaa")
        response = client.post('/borrower/validate',
                               data=json.dumps({"borrower_token": newBorrower.token,
                                                "dob": "23/01/1986"}),
                               headers=self.webseal_headers)
        self.assertEqual(response.status_code, 200)
Esempio n. 4
0
def update_borrower(borrower, idx, borrowers, deed_token):
    borrower_service = BorrowerService()

    borrower_json = {
        "id": "",
        "token": "",
        "forename": borrower['forename'],
        "surname": borrower['surname']
    }

    if 'middle_name' in borrower:
        borrower_json["middle_name"] = borrower["middle_name"]

    created_borrower = borrower_service.saveBorrower(borrower, deed_token)

    borrower_json["id"] = created_borrower.id
    borrower_json["token"] = created_borrower.token

    return borrower_json
Esempio n. 5
0
def update_borrower(borrower, idx, borrowers, deed_token):
    borrower_service = BorrowerService()

    borrower_json = {
        "id": "",
        "token": "",
        "forename": borrower['forename'],
        "surname": borrower['surname']
    }

    if 'middle_name' in borrower:
        borrower_json["middle_name"] = borrower["middle_name"]

    created_borrower = borrower_service.saveBorrower(borrower, deed_token)

    borrower_json["id"] = created_borrower.id
    borrower_json["token"] = created_borrower.token

    return borrower_json