NAV Navbar
heretically
  • (940) 252-6660
  • 563-425-8263
  • 709-213-6159
  • 9182599487
  • Staff Endpoints
  • (905) 818-0635
  • Introduction

    Arvofinance a loan disbursment platform. Here"s the list of the breakdown of the Api"s for the platform:

    Installation and Setup

    Using SSH:

    git clone git@github.com:ayodelevm/slate.git

    Using

    git clone /github.com/ayodelevm/slate.git

    System Requirements to Note

    Customer Endpoints

    Sign-up [POST - /api/v1/customer/signup]

    Request Body

    {
      "firstName": "Toria Tobias",
      "lastName": "toria",
      "password": "ay324ab",
      "confirmPassword": "ay324ab",
      "email": "name@mail.com",
      "telephone": "08087583456",
    }
    

    This endpoint creates a new individual customer and sends OTP to the customers phone and email

    onSuccess - Status Code [201]

    Sample Response

    {
      "data": {
        "id": "A7BNKDS87KIHSL",
        "email": "name@mail.com",
        "applicationComplete": false
      },
      "message": "Check your phone or email for otp",
      "success": true
    }
    

    Verify-OTP [POST - /api/v1/customer/verifyotp?email="name@mail.com"&id="A7BNKDS87KIHSL"]

    Request Body

    {
      "token": "456789",
      "success": true
    }
    

    This endpoint verifies OTP token sent to the customers phone number and email after signup or login

    onSuccess - Status Code [200]

    Sample Response

    {
      "user": {
        "id": "A7BNKDS87KIHSL",
        "email": "name@mail.com",
        "customerType": "not in network"
        ...
      },
      "token": "Xtydsj8fDSHJFfs.Hhhsjhwyi99eb.JGJDs0djwjfc2",
      "success": true
    }
    

    Resend-OTP [GET - /api/v1/customer/resendotp]

    Response Body

    {
      "token": "456789",
      "success": true
    }
    

    This endpoint sends an OTP token to the customers phone number and email after signup

    onSuccess - Status Code [200]

    Forgot Password [POST - /api/v1/customer/password/forgotlink]

    Request Body

    {
      "email": "ay@gmail.com"
    }
    

    This endpoint handles verifying that a user who wants to reset password is registered and then sends a reset password link to the users email

    onSuccess - Status Code [200]

    Sample Response

    {
      "message": "Please check your mail for the reset link!",
      "success": true
    }
    

    Reset Password [PUT - /api/v1/customer/password/reset?tok="Udfj.fhkd.fsd"]

    Request Body

    {
      "password": "newpassword",
      "confirmPassord": "newpassword"
    }
    

    Upon reception of an email to reset password, this method receives the new password entered by the user and replaces the user's old password with the nnew one

    onSuccess - Status Code [201]

    Sample Response

    {
      "message": "password reset successful, Please login to continue!",
      "success": true
    }
    

    Change Password [PUT - /api/v1/customer/password/change]

    Request Body

    {
      "oldPassword": "oldpassword",
      "newPassword": "newpassword",
      "confirmPassword": "newpassword"
    }
    

    This method replaces the user's old password with the new one

    onSuccess - Status Code [201]

    Sample Response

    {
      "updatedUser":{
        "id": "jUHFdmflsd0u3804",
        "firstName": "testing"
        ...
      },
      "success": true
    }
    

    Login [POST - /api/v1/customer/login]

    Request Body

    {
      "email": "ay@gmail.com",
      "phoneDigits" "3456",
      "password": "ay324ab"
    }
    

    This endpoint verifies if a customer is registered and then logs the customer if verified or throws the appropriate error if not verified. N.B: If the

    onSuccess - Status Code [200]

    Sample Response (Application Complete)

    {
      "user": {
        "id": "A7BNKDS87KIHSL",
        "email": "name@mail.com"
        ...
      },
      "token": "kfjbHJKD787ygiduewedykdubc8ebwu.Yjgkcdveucvo",  
      "success": true
    }
    

    Sample Response (Application Not Complete)

    {
      "data": {
        "id": "A7BNKDS87KIHSL",
        "email": "name@mail.com",
        "applicationComplete": false
      },
      "message": "Check your phone or email for otp",
      "success": true
    }
    

    Save Personal Details [PUT - /api/v1/customer/personaldetails/save]

    Request Body

    {
       "title": "miss",
       "gender": "female",
       "lastName": "Ogunlade",
       "firstName": "Iyanu",
       "otherNames": "Tunde",
       "dateOfBirth": "12-may-2000",
       "maritalStatus": "Single", / ["Single", "Married", "Widowed", "Divorced"]
       "telephone": "09043894345",
       "email": "titi@mail.com",
       "homeAddress": "2, tokunbo street, Lagos",
       "state": "Oyo",
       "lga": "Ibadan"
    }
    

    This endpoint handles updating a users personal details

    onSuccess - Status Code [200]

    Sample Response

    {
      "message": "record updated succesfully!",
      "success": true
    }
    

    Create Employment Record [POST - /api/v1/customer/employmentrecord/create]

    Request Body

    {
      "employmentStatus": "employed",
      "occupation": "teaching",
      "designation": "",
      "employerName": "Ibim Securities",
      "timeInCurrentEmployment": "6", /In months
      "officeEmail": "tunde@ibimsecuritiescom",
      "officeAddress": "3, Kosofe, Lagos",
      "officeState": "Lagos",
      "officeLga": "Kosofe",
      "jobsInLastFiveMonths": 2,
      "netMonthlyIncome": "80,000",
      "extraIncomeSource": "Yes"
    }
    

    This endpoint handles creating a new employment record for customer if not exists or updating an existing one

    onSuccess - Status Code [200]

    Sample Response

    {
      "employmentRecord": {
        "employmentStatus": "employed",
        "occupation": "teaching",
        ...
      },
      "success": true
    }
    

    Update Employment Record [PUT - /api/v1/customer/employmentrecord/update]

    Request Body

    {
      "employmentStatus": "employed",
      "occupation": "teaching",
      "designation": "",
      "employerName": "Ibim Securities",
      "timeInCurrentEmployment": "6", /In months
      "officeEmail": "tunde@ibimsecuritiescom",
      "officeAddress": "3, Kosofe, Lagos",
      "officeState": "Lagos",
      "officeLga": "Kosofe",
      "jobsInLastFiveMonths": 2,
      "netMonthlyIncome": "80,000",
      "extraIncomeSource": "Yes"
    }
    

    This endpoint handles updating an existing employment record. Any of the fields in the request body is required

    onSuccess - Status Code [200]

    Sample Response

    {
      "employmentRecord": {
        "employmentStatus": "employed",
        "occupation": "teaching",
        ...
      },
      "success": true
    }
    

    Request Loan [POST - /api/v1/customer/requestloan]

    Request Body

    {
      "loanType": "payday loan",
      "loanAmount": 20000,
      "loanTenor": "4", /In months
      "creditAmount": 19400,
      "capitalRepayment": 30000,
      "interestRepayment": 6000,
      "monthlyRepayment": 9000,
      "totalRepayment": 36000,
      "interestOnLoan": 4, /In percentage
      "processingFee": 2 /In percentage
    }
    

    Endpoint handles creating a new record and updating an existing record for a loan request. N.B. A customer can only update a loan request that is still pending and a customer can have only one active loan at a time. Once a loan has been approved, the customer can no longer update it neither can he request another loan until he has paid off the current loan

    onSuccess - Status Code [201]

    Sample Response

    {
      "loanRequest": {
        "loanType": "payday loan",
        "loanAmount": 20000,
        "loanPurpose": "Personal",
        ...
      },
      "success": true
    }
    

    Update Loan Request [PUT - /api/v1/customer/loanrequest/update']

    Request Body

    {
      "loanType": "payday loan",
      "loanAmount": 20000,
      "loanPurpose": "Personal",
      "loanTenor": "4", /In months
      "modeOfRepayment": "Direct debit", /['Direct debit', 'Bank deposit', 'Cheque']
      "existingLoans": true,
      "bvn": "09855479294",
      "accountName": "Tope Ogunlade",
      "accountNumber": "64873492",
      "bank": "Union Bank",
      "typeOfAccount": "savings",
      "creditAmount": 19400,
      "capitalRepayment": 30000,
      "interestRepayment": 6000,
      "monthlyRepayment": 9000,
      "totalRepayment": 36000,
      "interestOnLoan": 4, /In percentage
      "processingFee": 2 /In percentage
    }
    

    Endpoint handles updating record for a loan request. N.B. A customer can only update a loan request that is still pending and a customer can have only one active loan at a time. Once a loan has been approved, the customer can no longer update it neither can he request another loan until he has paid off the current loan

    onSuccess - Status Code [201]

    Sample Response

    {
      "loanRequest": {
        "loanType": "payday loan",
        "loanAmount": 20000,
        "loanPurpose": "Personal",
        ...
      },
      "success": true
    }
    

    Add Uploads [POST - /api/v1/customer/uploads/add]

    Request Body

    {
      "pensionStatement": "/image.jpg",
      "payslip": ["/image.jpg", "/image2.jpg"], /.pdf or 6 copies of .jpg
      "utilityBill": "/image.jpg",
      "employmentOrConfirmationLetter": "/image.jpg",
      "passport": "/image.jpg",
      "employeeId": "/image.jpg",
      "validId": "/image.jpg"
    }
    

    Save links returned from cloudinary to the database

    onSuccess - Status Code [200]

    Sample Response

    {
      "uploads": {
        "pensionStatement": "/image.jpg",
        "payslip": ["/image.jpg", "/image2.jpg"],
        ...
      },
      "success": true
    }
    

    Update Uploads [PUT - /api/v1/customer/uploads/update]

    Request Body

    {
      "pensionStatement": "/image.jpg",
      "payslip": ["/image.jpg", "/image2.jpg"], /.pdf or 6 copies of .jpg
      "utilityBill": "/image.jpg",
      "employmentOrConfirmationLetter": "/image.jpg",
      "passport": "/image.jpg",
      "employeeId": "/image.jpg",
      "validId": "/image.jpg"
    }
    

    Save links returned from cloudinary to the database. Any of the fields in request body is required

    onSuccess - Status Code [200]

    Sample Response

    {
      "uploads": {
        "pensionStatement": "/image.jpg",
        "payslip": ["/image.jpg", "/image2.jpg"],
        ...
      },
      "success": true
    }
    

    Complete Application [PUT - /api/v1/customer/completeapplication]

    Request Body

    {
    }
    

    Endpoints updates the db once a user has fulfilled all required inputs and is satisfied with all that's been supplied

    onSUccess - Status Code [200]

    Sample Response

    {
      "message": "Application completed successfully",
      "success": true
    }
    

    Get Customer Records [GET - /api/v1/customer/getrecords]

    Request Body

    Endpoints returns a customers personal details, employment details, loan details, and uploaded files

    onSUccess - Status Code [200]

    Sample Response

    {
      "records": {
            "id": "96d6a928-919f-41f8-9805-35ca2ec6516d",
            "firstName": "vica",
            "lastName": "ayoa",
            "otherNames": null,
            "dateOfBirth": null,
            "maritalStatus": "Single",
            "homeAddress": null,
            "state": null,
            "lga": null,
            "email": "ayodelevm@outlook.com",
            "telephone": "08106816144",
            "address": null,
            "customerType": "not in network",
            "activeLoanStatus": false,
            "applicationComplete": false,
            "EmploymentRecord": {
              "employmentStatus": "employed",
              "occupation": "teaching",
              ...
            },
            "Requests": [{
              "loanType": "payday loan",
              "loanAmount": 20000,
              "loanPurpose": "Personal",
              ...
            }],
            "CustomerUpload": {
              "pensionStatement": "/image.jpg",
              "payslip": ["/image.jpg", "/image2.jpg"],
              ...
            }
        },
        "success": true
    }
    

    Accept Loan Offer [PUT - /api/v1/customer/loanoffer/accept?requestId=Udjsk-dskjf]

    Request Body

    {
      "customerDecision": "isAccepted" 
    }
    

    This endpoint handles a customers decision to accept a loan offer after it has been processed

    onSUccess - Status Code [200]

    Sample Response

    {
      "message": "Your decision to accept loan offer has been received!",
      "success": true
    }
    

    Cancel Loan Request [PUT - /api/v1/customer/loanrequest/cancel?requestId=Udjsk-dskjf]

    Request Body

    {
      "customerDecision": "isCancelled" 
    }
    

    This endpoint handles a customers decision to cancel a loan request after it has been processed and an offer has been made

    onSUccess - Status Code [200]

    Sample Response

    {
      "message": "loan request is successfully cancelled",
      "success": true
    }
    

    Deactivate Account [DELETE - /api/v1/customer/account/deactivate]

    Request Body

    {
    }
    

    This endpoint handles deactivating a customers account

    onSUccess - Status Code [200]

    Sample Response

    {
      "message": "Your account has been successfully deactivated",
      "success": true
    }
    

    Get Notifications [GET - /api/v1/customer/notifications/retrieve]

    Request Body

    {
    }
    

    This endpoint handles retrieveing all notifications for a customer

    onSUccess - Status Code [200]

    Sample Response

    {
      "notifications": [
            {
                "id": 1,
                "notificationMessage": "Your decision to accept loan offer has been received!",
                "notificationType": "Offer Accepted",
                "readStatus": "Unread",
                "createdAt": "2018-09-10T04:14:33.092Z",
                "updatedAt": "2018-09-10T04:14:33.092Z",
                "deletedAt": null,
                "customerId": "b04bc7ff-1f6b-4f78-8f62-b93e3b00b071"
            },
            {
                "id": 2,
                "notificationMessage": "Your decision to accept loan offer has been received!",
                "notificationType": "Offer Accepted",
                "readStatus": "Unread",
                "createdAt": "2018-09-10T04:15:48.117Z",
                "updatedAt": "2018-09-10T04:15:48.117Z",
                "deletedAt": null,
                "customerId": "b04bc7ff-1f6b-4f78-8f62-b93e3b00b071"
            }],
      "success": true
    }
    

    Update Notification Read Status [PUT - /api/v1/customer/notification/update]

    Request Body

    {
    }
    

    This endpoint handles a deactivating a customers account

    onSUccess - Status Code [200]

    Sample Response

    {
      "message": "Notification status has been updated successfully",
      "success": true
    }
    

    Partner Organization Endpoints

    Partnership Request [POST - /api/v1/partnerorg/partnershiprequest]

    Request Body

    {
      "firstName": "Test",
      "lastName": "Company",
      "companyName": "Testers",
      "jobTitle": "HR",
      "companyWebsite": "/testers.cx.in",
      "employeeNumber": 32,
      "email": "test@mail.com",
      "telephone": "09123243893"
    }
    

    This endpoint handles a deactivating a customers account

    onSUccess - Status Code [200]

    Sample Response

    {
      "message": "Your partnership request has been received successfully, a member of our organization will reach out to you soon. Thanks.",
      "success": true
    }
    

    Login [POST - /api/v1/partnerorg/login]

    Request Body

    {
      "companyId": "PO-1-87429328",
      "password": "ay324ab"
    }
    

    This endpoint verifies if a company is registered and then logs the company in if verified or throws the appropriate error if not verified.

    onSuccess - Status Code [200]

    Sample Response (Application Not Complete)

    {
      "user": {
        "id": "A7BNKDS87KIHSL",
        "contactEmailAddress": "name@mail.com",
        "companyId": "PO-1-87429328"
        ...
      },
      "token": "ujdknclNIDsjld9ew.jkljfi9fuiu.89fn4farui",
      "success": true
    }
    

    Forgot Password [POST - /api/v1/partnerorg/password/forgotlink]

    Request Body

    {
      "email": "ay@gmail.com"
    }
    

    This endpoint handles verifying that a company who wants to reset password is registered and then sends a reset password link to the company's contact email

    onSuccess - Status Code [200]

    Sample Response

    {
      "message": "Please check your mail for the reset link!",
      "success": true
    }
    

    Reset Password [PUT - /api/v1/partnerorg/password/reset?tok="Udfj.fhkd.fsd"]

    Request Body

    {
      "password": "newpassword",
      "confirmPassord": "newpassword"
    }
    

    Upon reception of an email to reset password, this method receives the new password entered by the user and replaces the company's old password with the nnew one

    onSuccess - Status Code [201]

    Sample Response

    {
      "message": "password reset successful, Please login to continue!",
      "success": true
    }
    

    Change Password [PUT - /api/v1/partnerorg/password/change]

    Request Body

    {
      "oldPassword": "oldpassword",
      "newPassword": "newpassword",
      "confirmPassword": "newpassword"
    }
    

    This method replaces the company's old password with the new one

    onSuccess - Status Code [201]

    Sample Response

    {
      "updatedUser":{
        "id": "jUHFdmflsd0u3804",
        "firstName": "testing"
        ...
      },
      "success": true
    }
    

    Request Edit [POST - /api/v1/partnerorg/staffrecord/requestedit?id="hlhdshajkafdgjds"]

    Request Body

    {
      "firstName": "name",
      "surname": "test",
      "employeeId": "Emp-Id-001",
      "dateOfBirth": "22-feb-1998",
      "position": "HR",
      "telephone": "09087483743",
      "email": "test@mail.com",
      "salaryAccountNo": "0749373239",
      "salaryAccountBank": "Fidelity",
      "netMonthlySalary": "8748420",
      "existingLoanRepayment": "Yes",
      "employmentDate": "19-June-2012",
      "employmentType": "Contract" / ['Contract or Permanent']
    }
    

    This method sends a request to the admin to edit a staffs record

    onSuccess - Status Code [201]

    Sample Response

    {
      "message": "Your edit request has been received and will be processed accordingly.",
      "success": true
    }
    

    Request Delete [POST - /api/v1/partnerorg/staffrecord/requestdelete?id="hlhdshajkafdgjds"]

    Request Body

    {
    }
    

    This method sends a request to the admin to delete a staffs record

    onSuccess - Status Code [201]

    Sample Response

    {
      "message": "Your delete request has been received and will be processed accordingly.",
      "success": true
    }
    

    Staff Endpoints

    Create Staff Account [POST - /api/v1/staff/createaccount]

    Request Body

    {
      "firstName": "Toria Tobias",
      "lastName": "toria",
      "password": "ay324ab",
      "confirmPassword": "ay324ab",
      "email": "name@mail.com",
      "telephone": "08087583456",
      "role": "staff user"
    }
    

    This endpoint allows a superadmin to create a new staff account and sends the login details to the recipients email

    onSuccess - Status Code [201]

    Sample Response

    {
      "loginData": {
            "email": "name@mail.com",
            "telephone": "08087583456",
            "password": "ay324ab"
        },
      "message": "login details has been sent to the recipients email",
      "success": true
    }
    

    Verify-OTP [POST - /api/v1/staff/verifyotp?email="name@mail.com"&id="A7BNKDS87KIHSL"]

    Request Body

    {
      "token": "456789",
      "success": true
    }
    

    This endpoint sends an OTP token to the customers phone number and email after signup

    onSuccess - Status Code [200]

    Sample Response

    {
      "user": {
        "id": "A7BNKDS87KIHSL",
        "email": "name@mail.com"
        ...
      },
      "token": "Xtydsj8fDSHJFfs.Hhhsjhwyi99eb.JGJDs0djwjfc2",
      "success": true
    }
    

    Resend-OTP [GET - /api/v1/staff/resendotp]

    Response Body

    {
      "token": "456789",
      "success": true
    }
    

    This endpoint sends an OTP token to the customers phone number and email after signup

    onSuccess - Status Code [200]

    Login [POST - /api/v1/staff/login]

    Request Body

    {
      "staffId": "ST-1-8372383",
      "password": "ay324ab"
    }
    

    This endpoint verifies if a staff is registered and then logs the staff in if verified or throws the appropriate error if not verified.

    onSuccess - Status Code [200]

    Sample Response (Application Not Complete)

    {
      "user": {
        "id": "A7BNKDS87KIHSL",
        "email": "name@mail.com"
        ...
      },
      "message": "Check your phone or email for otp",
      "success": true
    }
    

    Update Staff Details [POST - /api/v1/staff/updateaccount]

    Request Body

    {
       "gender": "female",
       "lastName": "Ogunlade",
       "firstName": "Iyanu",
       "otherNames": "Tunde",
       "dateOfBirth": "12-may-2000",
       "maritalStatus": "Single", /['Single', 'Married', 'Widowed', 'Divorced']
       "telephone": "09043894345",
       "personalEmail": "titi@mail.com",
       "homeAddress": "2, tokunbo street, Lagos",
       "state": "Oyo",
       "lga": "Ibadan"
    }
    

    This endpoint updates a staff's record except the staff's role and password

    onSuccess - Status Code [200]

    Sample Response (Application Not Complete)

    {
      "message": "record updated succesfully!",
      "success": true
    }
    

    Update Staff Role [POST - /api/v1/staff/updaterole]

    Request Body

    {
       "role": "admin"
    }
    

    This endpoint updates a staff's role. You have to be a super admin to perform this operation

    onSuccess - Status Code [200]

    Sample Response (Application Not Complete)

    {
      "message": "record updated succesfully!",
      "success": true
    }
    

    Note

    Error Codes

    POST-It App uses the following error codes:

    Code Meaning
    400 Bad Request -- Request data is invalid.
    401 Unauthorized -- User was not authorized successfully, e.g during login, or token verification failed.
    403 Forbidden -- This request can be performed only by the group admin.
    404 Not Found -- The specified request was not found.
    409 CONFLICT -- The specified request already exists or conflicts with an existing parameter.
    500 Internal Server Error -- A problem occured with our server. Try again later.