Modules

mpesapy/models.py

class mpesapy.models.FlatModel(*args, **kwargs)

Defines common fields and function to be used by other models

class mpesapy.models.MpesaCtoBill(*args, **kwargs)

Table that holds M-Pesa paybill messages

class mpesapy.models.MpesaCtoBuy(id, removed, registered_date, updated_date, urlsafe, ipn_notification_id, text_message, mpesa_code, mpesa_amt, mpesa_msisdn, mpesa_sender, processed, date_received, date_processed, counter_checked)
class mpesapy.models.URLSafeField

Creates URL safe identifiers instead of table column ID nor slug field

classmethod encrypt(hash)

Generates the URL safe identifier from the table column ID and salt

Args:
hash(str): stringified table column ID
Returns:
str: The URL safe identifier
Raises:
AssertError: If the table column ID is not stringified

mpesapy/views.py

mpesapy.views.c2b_buy_goods(*args, **kwargs)

HTTP interface to be called by the M-Pesa Buy Goods IPN push. Accepts POST only.

mpesapy.views.c2b_paybill(*args, **kwargs)

HTTP interface to be called by the M-Pesa Pay Bill IPN push. Accepts POST only.

mpesapy/mpesa/mpull.py

class mpesapy.mpesa.mpull.MpesaPull(user, password, terminal_msisdn)

Pull request interfaces for confirming the push IPN from M-Pesa.

exception mpesapy.mpesa.mpull.PullError

Exception to be raised in this module