MambuPy.api.connector.mambuconnector

Connectors to Mambu.

Currently supports REST.

Classes

MambuConnector()

Interface for Connectors

MambuConnectorReader()

Interface for Readers.

MambuConnectorWriter()

Interface for Writers.

class MambuPy.api.connector.mambuconnector.MambuConnector[source]

Bases: ABC

Interface for Connectors

__abstractmethods__ = frozenset({})
__dict__ = mappingproxy({'__module__': 'MambuPy.api.connector.mambuconnector', '__doc__': 'Interface for Connectors', '__dict__': <attribute '__dict__' of 'MambuConnector' objects>, '__weakref__': <attribute '__weakref__' of 'MambuConnector' objects>, '__abstractmethods__': frozenset(), '_abc_impl': <_abc_data object>, '__annotations__': {}})
__module__ = 'MambuPy.api.connector.mambuconnector'
__weakref__

list of weak references to the object (if defined)

_abc_impl = <_abc_data object>
class MambuPy.api.connector.mambuconnector.MambuConnectorReader[source]

Bases: ABC

Interface for Readers.

A Reader supports the followint operations:

  • get (gets a single entity)

  • get_all (gets several entities, filtering allowed)

  • search (gets several entities, advanced filtering)

  • get_documents_metadata (gets the metadata of documents attached to some

    entity)

__abstractmethods__ = frozenset({'mambu_get', 'mambu_get_all', 'mambu_get_comments', 'mambu_get_customfield', 'mambu_get_documents_metadata', 'mambu_loanaccount_getSchedule', 'mambu_search'})
__dict__ = mappingproxy({'__module__': 'MambuPy.api.connector.mambuconnector', '__doc__': 'Interface for Readers.\n\n    A Reader supports the followint operations:\n\n    - get (gets a single entity)\n    - get_all (gets several entities, filtering allowed)\n    - search (gets several entities, advanced filtering)\n    - get_documents_metadata (gets the metadata of documents attached to some\n                              entity)\n    ', 'mambu_get': <function MambuConnectorReader.mambu_get>, 'mambu_get_all': <function MambuConnectorReader.mambu_get_all>, 'mambu_search': <function MambuConnectorReader.mambu_search>, 'mambu_get_documents_metadata': <function MambuConnectorReader.mambu_get_documents_metadata>, 'mambu_loanaccount_getSchedule': <function MambuConnectorReader.mambu_loanaccount_getSchedule>, 'mambu_get_customfield': <function MambuConnectorReader.mambu_get_customfield>, 'mambu_get_comments': <function MambuConnectorReader.mambu_get_comments>, '__dict__': <attribute '__dict__' of 'MambuConnectorReader' objects>, '__weakref__': <attribute '__weakref__' of 'MambuConnectorReader' objects>, '__abstractmethods__': frozenset({'mambu_get_documents_metadata', 'mambu_get_comments', 'mambu_search', 'mambu_get', 'mambu_get_all', 'mambu_get_customfield', 'mambu_loanaccount_getSchedule'}), '_abc_impl': <_abc_data object>, '__annotations__': {}})
__module__ = 'MambuPy.api.connector.mambuconnector'
__weakref__

list of weak references to the object (if defined)

_abc_impl = <_abc_data object>
abstract mambu_get(entid, prefix, detailsLevel='BASIC')[source]

get, a single entity, identified by its entid.

Parameters:
  • entid (str) – ID for the entity

  • prefix (str) – entity’s URL prefix

  • detailsLevel (str BASIC/FULL) – ask for extra details or not

abstract mambu_get_all(prefix, filters=None, offset=None, limit=None, paginationDetails='OFF', detailsLevel='BASIC', sortBy=None, **kwargs)[source]

get_all, several entities, filtering allowed

Parameters:
  • prefix (str) – entity’s URL prefix

  • filters (dict) – key-value filters (depends on each entity)

  • offset (int) – pagination, index to start searching

  • limit (int) – pagination, number of elements to retrieve

  • paginationDetails (str ON/OFF) – ask for details on pagination

  • detailsLevel (str BASIC/FULL) – ask for extra details or not

  • sortBy (str) – field1:ASC,field2:DESC, sorting criteria for results

  • kwargs (dict) – extra parameters that a specific entity may receive in its get_all method

abstract mambu_get_comments(owner_id, owner_type)[source]

Retrieves the comments of entity with owner_id.

Parameters:
  • owner_id (str) – the id or encoded key of the owner

  • owner_type (str) – the type of the entity owning the comments

abstract mambu_get_customfield(customfieldid)[source]

Retrieves a Custom Field.

Parameters:

customfieldid (str) – the id or encoded key of the custom field

abstract mambu_get_documents_metadata(entid, owner_type, offset=None, limit=None, paginationDetails='OFF')[source]

Gets metadata for all the documents attached to an entity

Parameters:
  • entid (str) – the id or encoded key of the entity owning the document

  • owner_type (str) – the type of the owner of the document

  • offset (int) – pagination, index to start searching

  • limit (int) – pagination, number of elements to retrieve

  • paginationDetails (str ON/OFF) – ask for details on pagination

abstract mambu_loanaccount_getSchedule(loanid)[source]

Retrieves the installments schedule

Parameters:

loanid (str) – the id or encoded key of the loan account

search, several entities, filtering criteria allowed

Parameters:
  • filterCriteria (list of dicts) – fields according to LoanAccountFilterCriteria schema

  • sortingCriteria (dict) – fields according to LoanAccountSortingCriteria

  • offset (int) – pagination, index to start searching

  • limit (int) – pagination, number of elements to retrieve

  • paginationDetails (str ON/OFF) – ask for details on pagination

  • detailsLevel (str BASIC/FULL) – ask for extra details or not

class MambuPy.api.connector.mambuconnector.MambuConnectorWriter[source]

Bases: ABC

Interface for Writers.

A Reader supports the followint operations:

  • update (updates an entity)

  • create (creates an entity)

  • patch (patches an entity)

  • upload_document (gets a single entity)

  • delete_document (gets several entities, filtering allowed)

__abstractmethods__ = frozenset({'mambu_change_state', 'mambu_comment', 'mambu_create', 'mambu_delete_document', 'mambu_loanaccount_writeoff', 'mambu_make_disbursement', 'mambu_make_repayment', 'mambu_patch', 'mambu_update', 'mambu_upload_document'})
__dict__ = mappingproxy({'__module__': 'MambuPy.api.connector.mambuconnector', '__doc__': 'Interface for Writers.\n\n    A Reader supports the followint operations:\n\n    - update (updates an entity)\n    - create (creates an entity)\n    - patch (patches an entity)\n    - upload_document (gets a single entity)\n    - delete_document (gets several entities, filtering allowed)\n    ', 'mambu_update': <function MambuConnectorWriter.mambu_update>, 'mambu_create': <function MambuConnectorWriter.mambu_create>, 'mambu_patch': <function MambuConnectorWriter.mambu_patch>, 'mambu_upload_document': <function MambuConnectorWriter.mambu_upload_document>, 'mambu_delete_document': <function MambuConnectorWriter.mambu_delete_document>, 'mambu_change_state': <function MambuConnectorWriter.mambu_change_state>, 'mambu_comment': <function MambuConnectorWriter.mambu_comment>, 'mambu_make_disbursement': <function MambuConnectorWriter.mambu_make_disbursement>, 'mambu_make_repayment': <function MambuConnectorWriter.mambu_make_repayment>, 'mambu_loanaccount_writeoff': <function MambuConnectorWriter.mambu_loanaccount_writeoff>, '__dict__': <attribute '__dict__' of 'MambuConnectorWriter' objects>, '__weakref__': <attribute '__weakref__' of 'MambuConnectorWriter' objects>, '__abstractmethods__': frozenset({'mambu_delete_document', 'mambu_loanaccount_writeoff', 'mambu_update', 'mambu_patch', 'mambu_upload_document', 'mambu_comment', 'mambu_make_repayment', 'mambu_create', 'mambu_change_state', 'mambu_make_disbursement'}), '_abc_impl': <_abc_data object>, '__annotations__': {}})
__module__ = 'MambuPy.api.connector.mambuconnector'
__weakref__

list of weak references to the object (if defined)

_abc_impl = <_abc_data object>
abstract mambu_change_state(entid, prefix, action, notes)[source]

change state of mambu entity

Parameters:
  • entid (str) – the id or encoded key of the entity owning the document

  • prefix (str) – entity’s URL prefix

  • action (str) – specify the action state

  • notes (str) – notes to associate to the change of status

abstract mambu_comment(owner_id, owner_type, text)[source]

Comments an entity with owner_id.

Parameters:
  • owner_id (str) – the id or encoded key of the owner

  • owner_type (str) – the type of the entity owning the comments

  • text (str) – the text of the comment

abstract mambu_create(prefix, attrs)[source]

creates a mambu entity

Parameters:
  • prefix (str) – entity’s URL prefix

  • attrs (dict) – entity to be created, complying with Mambu’s schemas

abstract mambu_delete_document(documentId)[source]

deletes an attachment by its documentId

Parameters:

documentId (str) – the id or encodedkey of the document to be deleted

abstract mambu_loanaccount_writeoff(loanid, notes)[source]

Writesoff a loan account

Parameters:
  • loanid (str) – the id or encoded key of the loan account

  • notes (str) – notes to associate to the writeoff operation in Mambu

abstract mambu_make_disbursement(loan_id, firstRepaymentDate, notes, valueDate, allowed_fields, **kwargs)[source]

Make a disbursement transacton on a loan account.

Parameters:
  • loan_id (str) – loan account id to disburse

  • firstRepaymentDate (str) – first repayment date in ISO format

  • notes (str) – notes for the disbursement transaction

  • valueDate (str) – entry date for the disbursement transaction

  • allowed_fields (list) – extra fields allowed for the transaction

  • kwargs (dict) – key-values of extra fields for the transaction

abstract mambu_make_repayment(loan_id, amount, notes, valueDate, allowed_fields, **kwargs)[source]

Make a repayment transaction on a loan account.

Parameters:
  • loan_id (str) – loan account id to make a repayment

  • amount (float) – the amount of the repayment

  • notes (str) – notes for the repayment transaction

  • valueDate (str) – entry date for the repayment transaction

  • allowed_fields (list) – extra fields allowed for the transaction

  • kwargs (dict) – key-values of extra fields for the transaction

abstract mambu_patch(entid, prefix, fields)[source]

patches certain parts of a mambu entity

abstract mambu_update(entid, prefix, attrs)[source]

updates a mambu entity

Parameters:
  • entid (str) – the id or encoded key of the entity owning the document

  • prefix (str) – entity’s URL prefix

  • attrs (dict) – entity to be updated, complying with Mambu’s schemas

abstract mambu_upload_document(owner_type, entid, filename, name, notes)[source]

uploads an attachment to this entity

Parameters:
  • owner_type (str) – the type of the owner of the document

  • entid (str) – the id or encoded key of the entity owning the document

  • filename (str) – path and filename of file to upload as attachment

  • name (str) – name to assign to the attached file in Mambu

  • notes (str) – notes to associate to the attached file in Mambu