Age Analysis Report

Get a school's age analysis report

GET https://integrate.d6plus.co.za/api/v1/finplus/debtmanagement/ageanalysis/{school_login_id}

Use this endpoint to generate an age analysis report for the specified school.

By default, only active accounts (current learners or accounts with an outstanding balance) will be returned. You can use the all_accounts query parameter to generate the report for all accounts (includes left learners and 0 balance accounts).

The report, by default, will be grouped by family and parent. Use the per_learner or per_category query parameter to group the data accordingly. If the per_learner and the per_category parameters are used in combination, the results will be grouped per learner, per category.

Additionally it is possible to filter on a specific debtor_code , learner_id , accountable_person_id and/or category_id.

Path Parameters

Name
Type
Description

school_login_id*

Integer

The login ID of the school to retrieve data from

Headers

Name
Type
Description

HTTP-X-USERNAME*

String

As provided by d6

HTTP-X-PASSWORD*

String

As provided by d6

Query Parameters

Name
Type
Description

all_accounts

Boolean

Whether to include all accounts

per_learner

Boolean

Whether to group the data per learner

per_category

Boolean

Whether to group the data per category (can be used in conjunction with per_learner)

debtor_code

Integer

To filter on a specific Debtor Code

learner_id

Integer

To filter on a specific Learner ID

accountable_person_id

Integer

To filter on a specific Accountable Person ID

category_id

Integer

To filter on a specific Category ID

Response Examples

[
    {
        "debtor_code": "1001",
        "accountable_person_id": "40",
        "date": "2024-04-10",
        "balance_current": "3500.00",
        "balance_30days": "3500.00",
        "balance_60days": "3500.00",
        "balance_90days": "3500.00",
        "balance_120days": "850.00",
        "balance_150days": "5850.00",
        "balance_180days": "4500.00",
        "balance_total": "25200.00"
    },
    {
        "debtor_code": "1002",
        "accountable_person_id": "3",
        "date": "2024-04-10",
        "balance_current": "3500.00",
        "balance_30days": "3500.00",
        "balance_60days": "3500.00",
        "balance_90days": "3500.00",
        "balance_120days": "850.00",
        "balance_150days": "5850.00",
        "balance_180days": "20000.00",
        "balance_total": "40700.00"
    }
]

Code Samples

<?php

const BASE_URL = 'https://integrate.d6plus.co.za/api/v1/finplus/debtmanagement/ageanalysis';
const SCHOOL_LOGIN_ID = '1000';
const PARAMS = [
    'per_learner' => 1, 
    'all_accounts' => 1,
    'debtor_code' => 1001,
    'learner_id' => 2,
    'accountable_person_id' => 3
    ];
const API_USERNAME = getenv('API_USERNAME'); // Assuming you have these environment variables set
const API_PASSWORD = getenv('API_PASSWORD');

$curl = curl_init();

$query = http_build_query(PARAMS);

$options = [
    CURLOPT_URL => BASE_URL . '/' . SCHOOL_LOGIN_ID . '?' . $query,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_SSL_VERIFYPEER => true,
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => [
        "HTTP-X-USERNAME: " . API_USERNAME,
        "HTTP-X-PASSWORD: " . API_PASSWORD
    ],
];

curl_setopt_array($curl, $options);

$response = curl_exec($curl);

if (curl_errno($curl)) {
    throw new Exception('Curl error: ' . curl_error($curl));
}

curl_close($curl);

echo $response;

Last updated