Objects

class fineract.objects.Client(request_handler, attributes, completed)[source]

This class represents a Client.

activate(date=None)[source]

Activates a client

Parameters:date – Date of client activation
Returns:bool
add_document(name, description, file, filename)[source]

Add a document to client

Parameters:
  • name
  • description
  • file
  • filename
Return type:

fineract.objects.document.Document

close(closure_reason_id, date=None)[source]

Close a client

Parameters:
  • closure_reason_id – Closure reason id
  • date – Date of client close
Returns:

bool

classmethod create(request_handler, firstname, lastname, office_id, active=True, activation_date=None, mobile_no=None, external_id=None, group_id=None, staff_id=None, savings_product_id=None, gender_id=None, client_type_id=None, client_classification_id=None, account_no=None, middlename=None, submittedon_date=None)[source]

Create a client and return a Client object

Parameters:
  • account_no
  • client_classification_id
  • external_id
  • group_id
  • staff_id
  • savings_product_id
  • gender_id
  • client_type_id
  • mobile_no
  • request_handler
  • firstname
  • lastname
  • middlename
  • office_id
  • active
  • activation_date
Return type:

fineract.objects.client.Client

delete()[source]

Deletes a client (Must be in pending state)

document(document_id)[source]

Get a document that matches document_id

Parameters:document_id
Return type:fineract.objects.document.Document
documents()[source]

Get all documents for a client

Return type:list of fineract.objects.document.Document
download_image()[source]

Download a document

Returns:file content
classmethod get_client_by_phone_no(request_handler, phone_no)[source]

Get a client by phone no

Parameters:
  • request_handler
  • phone_no
Return type:

fineract.objects.client.Client

get_loans()[source]

Get the loans of a client

Return type:list of fineract.objects.loan.Loan
get_loans_in_arrears(active=True, all_loans=False)[source]

Get loans in arrears

Parameters:
  • active – boolean flag to choose between closed/open loans
  • all_loans – flag to choose between returning all loans in arrears or specific loans based on active parameter
Return type:

list of fineract.objects.loan.Loan

get_outstanding_loans()[source]

Get the outstanding loans of a client

Return type:list of fineract.objects.loan.Loan
is_activated()[source]

Check if client has been activated :return: bool

reactivate(date=None)[source]

Reactivate a client

Parameters:date – Date of client reactivation
Returns:bool
reject(rejection_reason_id, date=None)[source]

Reject a client

Parameters:
  • rejection_reason_id – Rejection reason id
  • date – Date of client rejection
Returns:

bool

set_image(file, filename, content_type='image/png')[source]

Set the image for a client. Pass None to delete an image.

Parameters:file
undo_reject(date=None)[source]

Undo client rejection

Parameters:date – Date of client rejection undoing
Returns:bool
undo_withdrawal(date=None)[source]

Undo client withdrawal

Parameters:date – Date of client withdrawal undoing
Returns:bool
update(data)[source]

Update the core fields of a client

Parameters:data – dict
withdraw(withdrawal_reason_id, date=None)[source]

Withdraw a client

Parameters:
  • withdrawal_reason_id – Withdrawal reason id
  • date – Date of client rejection
Returns:

bool

class fineract.objects.DataTable(request_handler, attributes, completed)[source]

This class represents a datatable

classmethod create(request_handler, name, apptable_name, columns, is_multirow=False)[source]

Create a datatable and return a DataTable object

Parameters:
  • request_handler
  • name
  • apptable_name
  • columns
  • is_multirow
Return type:

fineract.objects.datatable.DataTable

delete()[source]

Delete the datatable

Returns:bool
delete_data(app_table_id, datatable_id=None)[source]

Delete the data of a specific app_table_id.

In multirow datatables datatable_id references the row id

Parameters:
  • app_table_id
  • datatable_id
Returns:

bool

classmethod deregister(request_handler, name)[source]

Deregister a datatable. After this action, the datatable won’t be visible from the API

Parameters:
  • request_handler
  • name
Returns:

bool

classmethod get(request_handler, name)[source]

Get a DataTable object based name

Parameters:
  • request_handler
  • name
Return type:

fineract.objects.datatable.DataTable

get_data(app_table_id, order=None, desc=False)[source]

Get all the data for for a specific app_table id

Parameters:
  • app_table_id
  • order
  • desc
Returns:

list of dict

insert(app_table_id, data)[source]

Insert data into a datatable

Parameters:
  • app_table_id
  • data – dict
Returns:

bool

classmethod register(request_handler, name, apptable_name)[source]

Register a datatable with an app table

Parameters:
  • request_handler
  • name
  • apptable_name
Returns:

bool

update(apptable_name=None, drop_columns=None, add_columns=None, change_columns=None)[source]

Update the columns of datatable

See: https://demo.openmf.org/api-docs/apiLive.htm#datatables_updateTable

Parameters:
  • apptable_name
  • drop_columns
  • add_columns
  • change_columns
update_data(app_table_id, data, datatable_id=None)[source]

Update the data of a specific app_table_id.

In multirow datatables datatable_id references the row id

Parameters:
  • app_table_id
  • data
  • datatable_id
Returns:

bool

class fineract.objects.Document(request_handler, attributes, completed)[source]

This class represents a document

classmethod create(request_handler, entity_type, entity_id, name, description, file, filename, content_type=None)[source]

Add a document to an entity of type entity_type with id entity_id

Parameters:
  • request_handler
  • entity_type
  • entity_id
  • name
  • description
  • file
  • filename
  • content_type
Return type:

fineract.objects.document.Document

delete()[source]

Delete a document

Returns:bool
download()[source]

Download a document

Returns:file content
classmethod get(request_handler, entity_type, entity_id, document_id)[source]

Get a document for an entity of type entity_type with id entity_id if it matches document_id

Parameters:
  • request_handler
  • entity_type
  • entity_id
  • document_id
Return type:

fineract.objects.document.Document

classmethod get_all(request_handler, entity_type, entity_id)[source]

Get all documents for an entity of type entity_type with id entity_id

Parameters:
  • request_handler
  • entity_type
  • entity_id
Return type:

fineract.pagination.PaginatedList of fineract.objects.document.Document

class fineract.objects.Report(request_handler, attributes, completed)[source]
classmethod create(request_handler, report_name, report_type, report_category, report_sql, report_subtype='', description='', use_report=False, report_parameters=None) → fineract.objects.report.Report[source]

Create a report

Parameters:
  • request_handler
  • report_name
  • report_type
  • report_category
  • report_sql
  • report_subtype
  • description
  • use_report
  • report_parameters
Return type:

fineract.objects.report.Report

static exists(request_handler, name) → bool[source]

Check whether a report with the name (case sensitive) exists

Parameters:
  • request_handlerfineract.handlers.RequestHandler
  • name – Report name
Returns:

bool

classmethod get_by_name(request_handler, name) → Optional[fineract.objects.report.Report][source]

Return a report that matches name

Parameters:
  • request_handler
  • name
Return type:

fineract.objects.report.Report

static run(request_handler, name, generic_result_set=True, **kwargs) → Union[List[T], Dict[KT, VT]][source]

Run the report name if it exists

Parameters:
  • request_handlerfineract.handlers.RequestHandler
  • name – Report name
  • generic_result_set – if ‘True’ an optimised JSON forma is returned. If ‘False’ a simple JSON format is returned
  • kwargs – Report parameters
Returns:

list of dict

class fineract.objects.Hook(request_handler, attributes, completed)[source]
classmethod create_web_hook(request_handler, display_name, payload_url, events, content_type='json', is_active=False, template_id=None) → fineract.objects.hook.Hook[source]

Create a web hook

Parameters:
  • request_handler
  • display_name
  • payload_url
  • events
  • content_type
  • is_active
  • template_id
Return type:

fineract.objects.hook.Hook

static exists(request_handler, name) → bool[source]

Check whether a hook with the name (case sensitive) exists

Parameters:
  • request_handler
  • name – Hook name
Returns:

bool

classmethod get(request_handler, id) → fineract.objects.hook.Hook[source]

Get a hook with id id

Parameters:
  • request_handler
  • id
Return type:

fineract.objects.hook.Hook

classmethod get_by_name(request_handler, name) → Optional[fineract.objects.hook.Hook][source]

Get a hook that matches name

Parameters:
  • request_handler
  • name
Return type:

fineract.objects.hook.Hook

static template(request_handler) → dict[source]

Get a hook template

Parameters:request_handler
Returns:dict
update(payload_url, events) → fineract.objects.hook.Hook[source]

Update a web hook

Parameters:
  • payload_url
  • events
Returns:

class fineract.objects.Loan(request_handler, attributes, completed)[source]

This class represents a Loan.

classmethod apply(request_handler, client_id, product_id, principal, expected_disbursement_date=datetime.datetime(2020, 8, 20, 20, 43, 39, 863294), submitted_date=datetime.datetime(2020, 8, 20, 20, 43, 39, 863303), **kwargs) → fineract.objects.loan.Loan[source]

Submit a new loan application

Parameters:
  • submitted_date
  • request_handler
  • client_id
  • product_id
  • principal
  • expected_disbursement_date
Returns:

fineract.objects.loan.Loan

approve(approved_on_date=datetime.datetime(2020, 8, 20, 20, 43, 39, 863306), approved_loan_amount=None, expected_disbursement_date=None) → bool[source]

Approve a loan application

Parameters:
  • approved_on_date
  • approved_loan_amount
  • expected_disbursement_date
Returns:

bool

days_in_arrears() → int[source]

Return the number of days in arrears

Returns:int
delete() → bool[source]

Delete a loan application. Only loans with status of “Submitted and awaiting approval”

Returns:bool
disburse(actual_disbursement_date=datetime.datetime(2020, 8, 20, 20, 43, 39, 863308), transaction_amount=None, fixed_emi_amount=None) → bool[source]

Disburse an approved loan application

Parameters:
  • actual_disbursement_date
  • transaction_amount
  • fixed_emi_amount
Returns:

bool

is_closed() → bool[source]

Check whether a loan is closed or not

Returns:bool
make_repayment(amount, transaction_date, **kwargs)[source]

Make a repayment on a loan

Parameters:
Returns:

bool

static template(request_handler, client_id=None, template_type='individual', product_id=None) → bool[source]

Get a loan template

Parameters:
  • template_type
  • product_id
  • client_id
  • request_handler
Returns:

dict

class fineract.objects.Note(request_handler, attributes, completed)[source]

This class represents a note

classmethod create(request_handler, entity_type, entity_id, note) → fineract.objects.note.Note[source]

Add a note to an entity of type entity_type with id entity_id

Parameters:
  • request_handler
  • entity_type
  • entity_id
  • note
Return type:

fineract.objects.note.Note

delete() → bool[source]

Delete a note

Returns:bool
classmethod get(request_handler, entity_type, entity_id, note_id) → fineract.objects.note.Note[source]

Get a note for an entity of type entity_type with id entity_id if it matches note_id

Parameters:
  • request_handler
  • entity_type
  • entity_id
  • note_id
Return type:

fineract.objects.note.Note

classmethod get_all(request_handler, entity_type, entity_id)[source]

Get all notes for an entity of type entity_type with id entity_id

Parameters:
  • request_handler
  • entity_type
  • entity_id
Return type:

fineract.pagination.PaginatedList of fineract.objects.note.Note

class fineract.objects.Savings(request_handler, attributes, completed)[source]

This class represents Savings.

activate(activated_on_date=datetime.datetime(2020, 8, 20, 20, 43, 39, 865874)) → bool[source]

Activate a savings account

Parameters:activated_on_date
Returns:bool
classmethod apply(request_handler, client_id, product_id, submitted_on_date=datetime.datetime(2020, 8, 20, 20, 43, 39, 865865)) → fineract.objects.savings.Savings[source]
Parameters:
  • request_handler
  • client_id
  • product_id
  • submitted_on_date
Returns:

fineract.objects.savings.Savings

approve(approved_on_date=datetime.datetime(2020, 8, 20, 20, 43, 39, 865872)) → bool[source]

Approve a savings application

Parameters:approved_on_date
Returns:bool
undo_approve() → bool[source]

Undo savings application approval

Returns:bool