# Power Loan

## Verify customer

<mark style="color:green;">`POST`</mark> `https://sandbox-api1117v2.fint.ng/v1/powerverifyCustomer`

This endpoint is used to check if a particular customer's phone number is registered on the  FINT Power Loan Platform or not

#### Headers

| Name             | Type   | Description    |
| ---------------- | ------ | -------------- |
| x-requested-with | String | XMLHttpRequest |

#### Request Body

| Name                                            | Type   | Description                                             |
| ----------------------------------------------- | ------ | ------------------------------------------------------- |
| partner\_meta<mark style="color:red;">\*</mark> | string | This is the FINT Partner Meta, issued prior integration |
| phone<mark style="color:red;">\*</mark>         | string | The phone number to be verified e.g 08111111111         |

{% tabs %}
{% tab title="200 Customer Exists" %}

```
{
    "status": true,
    "msg": "Customer exists",
    "data": {
        "customerExists": true,
        "hasMeter": true,
        "meterNumber": "239337873733",
        "borrower": {
            "id": 156949,
            "f_name": "Daniel",
            "l_name": "Alome",
            "email": "tech@fint.ng"
        }
    }
}
```

{% endtab %}

{% tab title="404: Not Found Customer does not Exist" %}

```
{
    "status": false,
    "msg": "Customer Not Found",
    "data": {
        "customerExists": false,
        "borrower": null
    }
}
```

{% endtab %}
{% endtabs %}

## Register a new Customer

<mark style="color:green;">`POST`</mark> `https://sandbox-api1117v2.fint.ng/v1/power/registerCustomer`

This endpoint is used to register new Customers a  power Loan

#### Headers

| Name                                               | Type   | Description    |
| -------------------------------------------------- | ------ | -------------- |
| x-requested-with<mark style="color:red;">\*</mark> | String | XMLHttpRequest |

#### Request Body

| Name                                               | Type   | Description                                                                                               |
| -------------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------- |
| partner\_meta<mark style="color:red;">\*</mark>    | string | This is the partner Meta key, it will be provided prior to integration                                    |
| transaction\_pin<mark style="color:red;">\*</mark> | string | This is a four digits PIN chosen by the user, it will be used to authorize his transactions in the future |
| phone<mark style="color:red;">\*</mark>            | string | This is the phone number of the user E.g 081111111111                                                     |
| first\_name<mark style="color:red;">\*</mark>      | string | This is the first name of the User                                                                        |
| last\_name<mark style="color:red;">\*</mark>       | string | This is the Last name of the user                                                                         |

{% tabs %}
{% tab title="200 " %}

```
{
    "status": true,
    "msg": "Registration Success",
    "data": {
        "first_name": "Misan",
        "last_name": "Okerentie",
        "phone": "07010194962"
    }
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```
{
    "status": false,
    "msg": "Validation Error",
    "data": [
        "phone already in use."
    ]
}
```

{% endtab %}
{% endtabs %}

## Get Utility Provider&#x20;

<mark style="color:blue;">`GET`</mark> `https://sandbox-api1117v2.fint.ng/v1/power/getUtilityServiceProviders`

This endpoint is used to get the lists of Power Utility Provided that is currently partnered with FINT

#### Headers

| Name                                               | Type   | Description    |
| -------------------------------------------------- | ------ | -------------- |
| x-requested-with<mark style="color:red;">\*</mark> | String | XMLHttpRequest |

{% tabs %}
{% tab title="200 " %}

```
{
    "status": true,
    "msg": "Utility Service Providers",
    "data": [
        {
            "name": "Eko Electricity Distribution Company",
            "slug": "EKEDP"
        },
        {
            "name": "Ikeja Electric Distribution Company",
            "slug": "IKEDC"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## Link Meter number to a Borrower profile

<mark style="color:green;">`POST`</mark> `https://sandbox-api1117v2.fint.ng/v1/power/linkMeterNumber`

This endpoint is used to link a Meter number to a Borrower account

#### Headers

| Name                                               | Type   | Description    |
| -------------------------------------------------- | ------ | -------------- |
| x-requested-with<mark style="color:red;">\*</mark> | String | XMLHttpRequest |

#### Request Body

| Name                                            | Type   | Description                                                                      |
| ----------------------------------------------- | ------ | -------------------------------------------------------------------------------- |
| phone<mark style="color:red;">\*</mark>         | String | This is the phone number of the borrower                                         |
| provider<mark style="color:red;">\*</mark>      | String | This is the selected Disco, gotten from the /getUtilityServiceProviders endpoint |
| meter\_number<mark style="color:red;">\*</mark> | String | This is the meter number to be linked                                            |
| partner\_meta<mark style="color:red;">\*</mark> | String | This is the partner Meta                                                         |

{% tabs %}
{% tab title="200: OK Meter Number Linked Successfully " %}

<pre class="language-javascript"><code class="lang-javascript">```json
{
    "status": true,
    "message": "Meter number linked successfully",
    "data": {
        "minPayable": 1060,
        "meterNumber": "0101165005147",
        "customerName": "Adene Jonah",
<strong>        "provider": "EKDEP",
</strong>        "supGrpRef": "100405",
        "tariffIdx": "52",
        "tokenTechCode": "02",
        "algCode": "05",
        "keyRevNum": "1"
    }
}
```
</code></pre>

{% endtab %}

{% tab title="404: Not Found Meter Number not Valid" %}

```javascript
{     "status": false,     "msg": "Customer not found. Please check the meter number and try again" }
```

{% endtab %}

{% tab title="404: Not Found Borrower not found" %}

````javascript
```json
{
    "status": false,
    "msg": "Customer not found"
}
```
````

{% endtab %}
{% endtabs %}

## Unlink Meter number from a Borrower Profile

<mark style="color:green;">`POST`</mark> `https://sandbox-api1117v2.fint.ng/v1/power/unlinkMeterNumber`

This endpoint is used to unlink a Meter number from a Borrower Profile

#### Headers

| Name                                               | Type   | Description    |
| -------------------------------------------------- | ------ | -------------- |
| x-requested-with<mark style="color:red;">\*</mark> | String | XMLHttpRequest |

#### Request Body

| Name                                               | Type   | Description                                 |
| -------------------------------------------------- | ------ | ------------------------------------------- |
| phone<mark style="color:red;">\*</mark>            | String | This is the phone number of the borrower    |
| transaction\_pin<mark style="color:red;">\*</mark> | String | This is the transaction pin of the borrower |
| partner\_meta<mark style="color:red;">\*</mark>    | String | This is the partner Meta                    |

{% tabs %}
{% tab title="200: OK Meter Number Unlinked Succesfully" %}

````javascript
```json
{
    "status": true,
    "message": "Meter number unlinked successfully",
    "data": []
}
```
````

{% endtab %}

{% tab title="401: Unauthorized Invalid Transaction Pin Entered" %}

````javascript
```json
{
    "status": false,
    "msg": "Validation Error",
    "data": [
        "4-digit transaction pin is not valid."
    ]
}
```
````

{% endtab %}
{% endtabs %}

## Disburse Loan

<mark style="color:green;">`POST`</mark> `https://sandbox-api1117v2.fint.ng/v1/power/disburseLoan`

This endpoint is used to disburse the Power loan

#### Headers

| Name                                               | Type   | Description    |
| -------------------------------------------------- | ------ | -------------- |
| x-requested-with<mark style="color:red;">\*</mark> | String | XMLHttpRequest |

#### Request Body

| Name                                               | Type   | Description                                                                                                                              |
| -------------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------- |
| phone<mark style="color:red;">\*</mark>            | string | This is the phone number of the customer                                                                                                 |
| amount<mark style="color:red;">\*</mark>           | string | This is the amount that will be disbursed, it should not be less than the minPayable amount returned from the validate customer endpoint |
| partner\_meta<mark style="color:red;">\*</mark>    | string | This is the FINT partnerMeta provided                                                                                                    |
| transaction\_pin<mark style="color:red;">\*</mark> | string | This is the transaction PIN of the user                                                                                                  |

{% tabs %}
{% tab title="200 The returned data object contains meterNumer and paymentReference, these values will be further used to generate the Meter recharge token.
NB: The Value of the "msg" key should ALWAYS be DISPLAYED to the customer" %}

```
{
    "status": true,
    "msg": "Loan Disburse Successful",
    "data": {
        "meterNumber": "0101165005147",
        "paymentReference": "FINT_EKEDC_J9WST2ZXMGXF"
    }
}
```

{% endtab %}

{% tab title="400: Bad Request The value of the "msg" returned should ALWAYS be DISPLAYED to the customer" %}

```
{
    "status": false,
    "msg": "Amount Requested is Less Than Customer's Minimum Payable.",
    "data": {
        "minPayable": 900,
        "amountRequested": 100
    }
}
```

{% endtab %}

{% tab title="404: Not Found " %}

```
{"status":false,"msg":"Customer not found"}
```

{% endtab %}
{% endtabs %}

## Get Meter Recharge Token

<mark style="color:blue;">`GET`</mark> `https://sandbox-api1117v2.fint.ng/v1/power/getRechargeToken`

This endpoint is used to get the recharge token details after a successful [loan disbursement ](#disburse-loan)

#### Path Parameters

| Name                                            | Type   | Description |
| ----------------------------------------------- | ------ | ----------- |
| partner\_meta<mark style="color:red;">\*</mark> | String |             |
| reference<mark style="color:red;">\*</mark>     | String |             |

#### Headers

| Name                                               | Type   | Description    |
| -------------------------------------------------- | ------ | -------------- |
| x-requested-with<mark style="color:red;">\*</mark> | String | XMLHttpRequest |

#### Request Body

| Name                                               | Type   | Description                                                            |
| -------------------------------------------------- | ------ | ---------------------------------------------------------------------- |
| paymentReference<mark style="color:red;">\*</mark> | string | This is the payment reference returned from the disburse loan endpoint |
| provider                                           | string | This is the Utility provider the customer selected e.g EKEDP           |

{% tabs %}
{% tab title="200 The Value of the "msg" key should ALWAYS be DISPLAYED to the customer" %}

```
{
    "status": true,
    "msg": "Get Meter Recharge Token",
    "data": {
        "stdToken": "85557590821929616136",
        "units": "33333.332",
        "unitsType": "kWh"
    }
}
```

{% endtab %}
{% endtabs %}
