Name | pykuda JSON |
Version |
1.0.6
JSON |
| download |
home_page | |
Summary | A python package that simplifies using the Kuda Bank Api |
upload_time | 2023-12-30 06:48:28 |
maintainer | |
docs_url | None |
author | |
requires_python | >=3.10 |
license | |
keywords |
kuda bank
pykuda
open api
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# PyKuda
[![Downloads](https://static.pepy.tech/badge/pykuda)](https://pepy.tech/project/pykuda) [![Downloads](https://static.pepy.tech/badge/pykuda/month)](https://pepy.tech/project/pykuda) [![Downloads](https://static.pepy.tech/badge/pykuda/week)](https://pepy.tech/project/pykuda)
A python package that simplifies using the Kuda Bank API. This python package makes it seamless and easy to enjoy the beautiful Kuda Bank pen Api. PyKuda uses Kuda's Api v2 which authenticates using an `API key` and a `token`.
## Getting started
### Install PyKuda
To use this package, install it using the package manager [pip](https://pip.pypa.io/en/stable/):
```bash
pip install pykuda
```
PyKuda has some dependencies which will be installed (requests and python-decouple). `requests` is used by PyKuda to make http requests to Kuda's endpoints, while the `python-decouple` is responsible for getting the environmental variables which has to be set for the requests to be authenticated; more to be discussed below.
### Create Environmental variables
After installation, the next thing is to create a `.env` file where the environmental variables will be stored. Five variables are to be set in the `.env` file, and they are shown in an example below.
```shell
KUDA_KEY="Your Kuda Api Key"
TOKEN_URL="https://kuda-openapi.kuda.com/v2.1/Account/GetToken" # Kuda API v2.1 GetToken URL
REQUEST_URL="https://kuda-openapi.kuda.com/v2.1/" # Kuda API v2.1 Request URL
EMAIL="Your email used to register for the Kuda account"
MAIN_ACCOUNT_NUMBER="Your main Kuda account number"
```
Not setting these in the `.env` file will raise a value error as shown below.
```shell
>>> from pykuda.pykuda import PyKuda
>>> kuda = PyKuda()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/path/to/Python/version/lib/python/site-packages/pykuda/pykuda.py", line 16, in __init__
raise ValueError(response)
ValueError: TOKEN_URL, REQUEST_URL, EMAIL, MAIN_ACCOUNT_NUMBER are not set, please set in the environment or pass them as a dictionary when initialising PyKuda.
```
NB: Please make sure you do not push your `.env` file to public repositories as the details here are confidential.
### Initialize with credentials
If you do not want to set the credentials in the `.env` file, you can also initiaize `PyKuda` with a dictionary of your credentials.
```shell
>>> from pykuda.pykuda import PyKuda
>>> credentials = {
... "KUDA_KEY": "KUDA_KEY",
... "TOKEN_URL": "TOKEN_URL",
... "REQUEST_URL": "REQUEST_URL",
... "EMAIL": "EMAIL",
... "MAIN_ACCOUNT_NUMBER": "MAIN_ACCOUNT_NUMBER",
... }
>>> kuda = PyKuda(credentials) # Will not raise a ValueError
```
## Using PyKuda
### Successful request
```python
from pykuda.pykuda import PyKuda
kuda = PyKuda()
response = kuda.banks_list()
print(response)
# Example Response:
# PyKudaResponse(status_code=200, data=[list_of_banks], error=False)
```
### Failed request
In case the request wasn't successful, the PyKudaResponse will be different. The data will be a `Response` Object which you can check to investigate the cause (Maybe your Token is not correct, or the URL, or something else). Now, let's say the API Key in the .env file was not a correct one and a request was made, the example below shows the response to expect.
```python
print(response)
# PyKudaResponse(status_code=401, data=<Response [401]>, error=True)
print(response.data.text)
# 'Invalid Credentials'
print(response.data.reason)
# 'Unauthorized'
```
### Understanding PyKudaResponse
With `PyKuda`, every interaction with the Kuda API is elevated through the `PyKudaResponse` object, enriching the responses from Kuda. This custom response encapsulates three key attributes: `status_code`, `data`, and `error`.
`PyKudaResponse` serves as a tailored feedback mechanism provided by PyKuda. Its primary purpose is to enhance the interpretation of Kuda's responses and reliably confirm the success of a request. In cases where the request encounters issues, the `error` attribute is set to `True`, signaling that an error has occurred during the interaction. This nuanced approach ensures a more robust and dependable handling of API responses. It is imperative to systematically inspect the `error` attribute to ascertain the success of the method.
**Example:**
This illustrative example outlines a conventional approach to leverage PyKuda for verifying the success of a request.
```python
import logging
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework import status
from pykuda.pykuda import PyKuda, PyKudaResponse
logger = logging.getLogger(__name__)
# Initialize PyKuda instance
kuda = PyKuda()
class BanksListView(APIView):
"""
API view to retrieve a list of banks.
"""
def get(self, request) -> Response:
"""
Handle GET request to retrieve a list of banks.
Returns:
Response: JSON response containing the list of banks or an error message.
"""
# Retrieve list of banks from Kuda API
response = kuda.banks_list()
if not response.error:
# The request was successful
# Return the list of banks to the frontend
return Response(response.data, status=response.status_code)
else:
# There was an error in the request
# Log provider error details
self.log_kuda_error(response.data)
# Return an error and handle it in the frontend or according to your business model
return Response("Your custom error", status="error_code")
def log_kuda_error(self, error_response: PyKudaResponse) -> None:
"""
Log details of Kuda API error.
Args:
error_response (PyKudaResponse): The PyKudaResponse object containing error details.
"""
# Log error details
logger.error(
f"KUDA ERROR: \n"
f"STATUS CODE - {error_response.status_code} \n"
f"RESPONSE DATA - {error_response.data} \n"
f"ERROR - {error_response.error}"
)
```
As seen above, the PyKudaResponse returns the `status_code`, `data` and `error`; the data attribute already contains the appropriate data received from Kuda API. You can access the Kuda response data by executing `response.data`.
#### Important Note on Error Handling:
When interacting with the Kuda API, it is not recommended to rely solely on the response.status_code for error handling. The Kuda API may return a 200 status code even in cases where there are errors or typos in the request parameters.
For instance, when attempting to purchase airtime, passing an invalid tracking_reference will result in a 200 status code from Kuda, but the request will not be processed successfully.
To ensure robust error handling, it is crucial to examine the response data and utilize the error attribute in the PyKudaResponse object. `PyKuda` intelligently checks that if the request is not successful and was not processed by Kuda, the `response.error` will be `True`. This attribute indicates whether the API request was successful or if there were issues.
**Example:**
```python
response = kuda.virtual_account_purchase_bill(
amount='10000',
kuda_biller_item_identifier="KD-VTU-MTNNG",
customer_identifier="08030001234",
tracking_reference="invalid_tracking_reference", # Invalid tracking_reference
)
print(response)
# PyKudaResponse(status_code=200, data=<Response [200]>, error=True)
print(response.data.text)
# '{"message":"Invalid Virtual Account.","status":false,"data":null,"statusCode":"k-OAPI-07"}'
```
As shown in the [Successful request](#successful-request) section, it is recommended to use response.error to ensure that the request was successful.
## What else can PyKuda do?
PyKuda can be used to make other requests also. Below are examples of how to use the other methods available in the `ServiceType` class.
### Create Virtual Account
```python
response = kuda.create_virtual_account(
first_name="Ogbeni",
last_name="Lagbaja",
phone_number="08011122233",
email="ogbeni@temi.com",
middle_name="Middle",
business_name="ABC Ltd",
)
print(response)
# Example Response:
# PyKudaResponse(status_code=200, data=<response_data>, error=False)
print(response.data)
# {
# "account_number": "2000111222", # Newly generated account number from Kuda
# "tracking_reference": "trackingReference", # Tracking reference
# }
```
### Virtual Account Balance
```python
response = kuda.virtual_account_balance(tracking_reference="your_tracking_reference")
print(response.data)
# {
# "ledger": "ledgerBalance",
# "available": "availableBalance",
# "withdrawable": "withdrawableBalance",
# }
```
### Main Account Balance
```python
response = kuda.main_account_balance()
print(response.data)
# {
# "ledger": "ledgerBalance",
# "available": "availableBalance",
# "withdrawable": "withdrawableBalance",
# }
```
### Fund Virtual Account
```python
response = kuda.fund_virtual_account(
tracking_reference="your_tracking_reference",
amount="1000",
narration="Funding virtual account",
)
print(response.data)
# {"reference": "transactionReference"}
```
### Withdraw from Virtual Account
```python
response = kuda.withdraw_from_virtual_account(
tracking_reference="your_tracking_reference",
amount="500",
narration="Withdrawing from virtual account",
)
print(response.data)
# {"reference": "transactionReference"}
```
### Confirm Transfer Recipient
```python
response = kuda.confirm_transfer_recipient(
beneficiary_account_number="recipient_account_number",
beneficiary_bank_code="recipient_bank_code",
tracking_reference="your_tracking_reference",
)
print(response.data)
# {
# "beneficiary_account_number":
# "beneficiaryAccountNumber"
# ),
# "beneficiary_name": "beneficiaryName",
# "beneficiary_code": "beneficiaryBankCode",
# "session_id": "sessionID",
# "sender_account": "senderAccountNumber",
# "transfer_charge": "transferCharge",
# "name_enquiry_id": "nameEnquiryID",
# "tracking_reference": "SenderTrackingReference",
# }
```
### Send Funds from Main Account
```python
response = kuda.send_funds_from_main_account(
client_account_number="sender_account_number",
beneficiary_bank_code="recipient_bank_code",
beneficiary_account_number="recipient_account_number",
beneficiary_name="Recipient Name",
amount="1000",
naration="Sending funds",
name_enquiry_session_id="name_enquiry_session_id",
sender_name="Sender Name",
)
print(response.data)
# {
# "transaction_reference": "transactionReference",
# "request_reference": "requestReference",
# }
```
### Send Funds from Virtual Account
```python
response = kuda.send_funds_from_virtual_account(
tracking_reference="your_tracking_reference",
beneficiary_bank_code="recipient_bank_code",
beneficiary_account_number="recipient_account_number",
beneficiary_name="Recipient Name",
amount="1000",
naration="Sending funds",
name_enquiry_session_id="name_enquiry_session_id",
sender_name="Sender Name",
)
print(response.data)
# {
# "transaction_reference": "transactionReference",
# "request_reference": "requestReference",
# }
```
### Get Billers
```python
response = kuda.billers(biller_type="electricity")
print(response.data)
# {
# "billers": ["list_of_billers"]
# }
```
### Verify Bill Customer
```python
response = kuda.verify_bill_customer(
kuda_biller_item_identifier="bill_item_identifier",
customer_identifier="customer_identifier",
)
print(response.data)
# {
# "customer_name": "customerName,
# }
```
### Main Account Purchase Bill
```python
response = kuda.p.admin_purchase_bill(
amount="500",
kuda_biller_item_identifier="bill_item_identifier",
customer_identifier="customer_identifier",
tracking_reference="your_tracking_reference",
client_first_name="Lagbaja",
phone_number="customer_phone_number",
)
print(response.data)
# {
# "reference": "reference",
# }
```
### Virtual Account Purchase Bill
```python
response = kuda.virtual_account_purchase_bill(
amount="500",
kuda_biller_item_identifier="bill_item_identifier",
customer_identifier="customer_identifier",
tracking_reference="your_tracking_reference",
phone_number="customer_phone_number",
)
print(response.data)
# {
# "reference": "reference",
# }
```
### Disable Virtual Account
```python
response = kuda.disable_virtual_account(
tracking_reference="your_tracking_reference",
)
print(response.data)
# {
# "account_number": "accountNumber",
# }
```
### Enable Virtual Account
```python
response = kuda.enable_virtual_account(
tracking_reference="your_tracking_reference",
)
print(response.data)
# {
# "account_number": "accountNumber",
# }
```
### Update Virtual Account Name
```python
response = kuda.update_virtual_account_name(
tracking_reference="your_tracking_reference",
first_name="New_First_Name",
last_name="New_Last_Name",
)
print(response.data)
# {
# "account_number": "accountNumber"
# }
```
### Update Virtual Account Email
```python
response = kuda.update_virtual_account_email(
tracking_reference="your_tracking_reference",
email="new_email@example.com",
)
print(response.data)
# {
# "account_number": "accountNumber"
# }
```
### Retrieve Single Virtual Account
```python
response = kuda.retrieve_single_virtual_account(
tracking_reference="customer_tracking_reference",
)
print(response.data)
# {
# "accountNumber": "2504205433",
# "email": "08011122233",
# "phoneNumber": "08011111111",
# "lastName": "Lagbaja",
# "firstName": "Ogbeni",
# "middleName": "Middle",
# "bussinessName": "ABC LTD",
# "accountName": "(ABC LTD)-Lagbaja Ogbeni",
# "trackingReference": "tracking_reference",
# "creationDate": "2023-04-24T16:35:23.6033333",
# "isDeleted": false
# }
```
### Retrieve All Virtual Accounts
```python
response = kuda.retrieve_all_virtual_accounts()
print(response.data)
# [
# {
# "accountNumber": "2504205433",
# "email": "08011122233",
# "phoneNumber": "08011111111",
# "lastName": "Lagbaja",
# "firstName": "Ogbeni",
# "middleName": "Middle",
# "bussinessName": "ABC LTD",
# "accountName": "(ABC LTD)-Lagbaja Ogbeni",
# "trackingReference": "tracking_reference",
# "creationDate": "2023-04-24T16:35:23.6033333",
# "isDeleted": false
# },
# ........
# ]
```
## Contributions & Issues
- If you would like to contribute and improve this package or its documentation, please feel free to fork the repository, make changes and open a pull request.
- If you encounter any issue or bugs, please open an issue.
## Author
- [Kayode TemiTope](https://github.com/sir-temi)
Raw data
{
"_id": null,
"home_page": "",
"name": "pykuda",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "",
"keywords": "kuda bank,pykuda,Open API",
"author": "",
"author_email": "TemiTope Kayode <cwt@temilimited.com>",
"download_url": "https://files.pythonhosted.org/packages/ca/32/e503b23c0ff33642ea2b32f33ad4a7c980e58430a6ff18a5e3b389a5bd49/pykuda-1.0.6.tar.gz",
"platform": null,
"description": "# PyKuda\n\n[![Downloads](https://static.pepy.tech/badge/pykuda)](https://pepy.tech/project/pykuda) [![Downloads](https://static.pepy.tech/badge/pykuda/month)](https://pepy.tech/project/pykuda) [![Downloads](https://static.pepy.tech/badge/pykuda/week)](https://pepy.tech/project/pykuda)\n\nA python package that simplifies using the Kuda Bank API. This python package makes it seamless and easy to enjoy the beautiful Kuda Bank pen Api. PyKuda uses Kuda's Api v2 which authenticates using an `API key` and a `token`.\n\n## Getting started\n\n### Install PyKuda\n\nTo use this package, install it using the package manager [pip](https://pip.pypa.io/en/stable/):\n\n```bash\npip install pykuda\n```\n\nPyKuda has some dependencies which will be installed (requests and python-decouple). `requests` is used by PyKuda to make http requests to Kuda's endpoints, while the `python-decouple` is responsible for getting the environmental variables which has to be set for the requests to be authenticated; more to be discussed below.\n\n### Create Environmental variables\n\nAfter installation, the next thing is to create a `.env` file where the environmental variables will be stored. Five variables are to be set in the `.env` file, and they are shown in an example below.\n\n```shell\nKUDA_KEY=\"Your Kuda Api Key\"\nTOKEN_URL=\"https://kuda-openapi.kuda.com/v2.1/Account/GetToken\" # Kuda API v2.1 GetToken URL\nREQUEST_URL=\"https://kuda-openapi.kuda.com/v2.1/\" # Kuda API v2.1 Request URL\nEMAIL=\"Your email used to register for the Kuda account\"\nMAIN_ACCOUNT_NUMBER=\"Your main Kuda account number\"\n```\n\nNot setting these in the `.env` file will raise a value error as shown below.\n\n```shell\n>>> from pykuda.pykuda import PyKuda\n>>> kuda = PyKuda()\nTraceback (most recent call last):\n File \"<stdin>\", line 1, in <module>\n File \"/path/to/Python/version/lib/python/site-packages/pykuda/pykuda.py\", line 16, in __init__\n raise ValueError(response)\nValueError: TOKEN_URL, REQUEST_URL, EMAIL, MAIN_ACCOUNT_NUMBER are not set, please set in the environment or pass them as a dictionary when initialising PyKuda.\n```\n\nNB: Please make sure you do not push your `.env` file to public repositories as the details here are confidential.\n\n### Initialize with credentials\n\nIf you do not want to set the credentials in the `.env` file, you can also initiaize `PyKuda` with a dictionary of your credentials.\n\n```shell\n>>> from pykuda.pykuda import PyKuda\n>>> credentials = {\n... \"KUDA_KEY\": \"KUDA_KEY\",\n... \"TOKEN_URL\": \"TOKEN_URL\",\n... \"REQUEST_URL\": \"REQUEST_URL\",\n... \"EMAIL\": \"EMAIL\",\n... \"MAIN_ACCOUNT_NUMBER\": \"MAIN_ACCOUNT_NUMBER\",\n... }\n>>> kuda = PyKuda(credentials) # Will not raise a ValueError\n\n```\n\n## Using PyKuda\n\n### Successful request\n\n```python\nfrom pykuda.pykuda import PyKuda\n\nkuda = PyKuda()\nresponse = kuda.banks_list()\nprint(response)\n# Example Response:\n# PyKudaResponse(status_code=200, data=[list_of_banks], error=False)\n```\n\n### Failed request\n\nIn case the request wasn't successful, the PyKudaResponse will be different. The data will be a `Response` Object which you can check to investigate the cause (Maybe your Token is not correct, or the URL, or something else). Now, let's say the API Key in the .env file was not a correct one and a request was made, the example below shows the response to expect.\n\n```python\nprint(response)\n# PyKudaResponse(status_code=401, data=<Response [401]>, error=True)\n\nprint(response.data.text)\n# 'Invalid Credentials'\n\nprint(response.data.reason)\n# 'Unauthorized'\n```\n\n### Understanding PyKudaResponse\n\nWith `PyKuda`, every interaction with the Kuda API is elevated through the `PyKudaResponse` object, enriching the responses from Kuda. This custom response encapsulates three key attributes: `status_code`, `data`, and `error`.\n\n`PyKudaResponse` serves as a tailored feedback mechanism provided by PyKuda. Its primary purpose is to enhance the interpretation of Kuda's responses and reliably confirm the success of a request. In cases where the request encounters issues, the `error` attribute is set to `True`, signaling that an error has occurred during the interaction. This nuanced approach ensures a more robust and dependable handling of API responses. It is imperative to systematically inspect the `error` attribute to ascertain the success of the method.\n\n**Example:**\nThis illustrative example outlines a conventional approach to leverage PyKuda for verifying the success of a request.\n\n```python\nimport logging\n\nfrom rest_framework.response import Response\nfrom rest_framework.views import APIView\nfrom rest_framework import status\n\nfrom pykuda.pykuda import PyKuda, PyKudaResponse\n\n\nlogger = logging.getLogger(__name__)\n\n# Initialize PyKuda instance\nkuda = PyKuda()\n\nclass BanksListView(APIView):\n \"\"\"\n API view to retrieve a list of banks.\n \"\"\"\n\n def get(self, request) -> Response:\n \"\"\"\n Handle GET request to retrieve a list of banks.\n\n Returns:\n Response: JSON response containing the list of banks or an error message.\n \"\"\"\n # Retrieve list of banks from Kuda API\n response = kuda.banks_list()\n\n if not response.error:\n # The request was successful\n # Return the list of banks to the frontend\n return Response(response.data, status=response.status_code)\n else:\n # There was an error in the request\n # Log provider error details\n self.log_kuda_error(response.data)\n # Return an error and handle it in the frontend or according to your business model\n return Response(\"Your custom error\", status=\"error_code\")\n\n def log_kuda_error(self, error_response: PyKudaResponse) -> None:\n \"\"\"\n Log details of Kuda API error.\n\n Args:\n error_response (PyKudaResponse): The PyKudaResponse object containing error details.\n \"\"\"\n\n # Log error details\n logger.error(\n f\"KUDA ERROR: \\n\"\n f\"STATUS CODE - {error_response.status_code} \\n\"\n f\"RESPONSE DATA - {error_response.data} \\n\"\n f\"ERROR - {error_response.error}\"\n )\n```\n\nAs seen above, the PyKudaResponse returns the `status_code`, `data` and `error`; the data attribute already contains the appropriate data received from Kuda API. You can access the Kuda response data by executing `response.data`.\n\n#### Important Note on Error Handling:\n\nWhen interacting with the Kuda API, it is not recommended to rely solely on the response.status_code for error handling. The Kuda API may return a 200 status code even in cases where there are errors or typos in the request parameters.\n\nFor instance, when attempting to purchase airtime, passing an invalid tracking_reference will result in a 200 status code from Kuda, but the request will not be processed successfully.\n\nTo ensure robust error handling, it is crucial to examine the response data and utilize the error attribute in the PyKudaResponse object. `PyKuda` intelligently checks that if the request is not successful and was not processed by Kuda, the `response.error` will be `True`. This attribute indicates whether the API request was successful or if there were issues.\n\n**Example:**\n\n```python\nresponse = kuda.virtual_account_purchase_bill(\n amount='10000',\n kuda_biller_item_identifier=\"KD-VTU-MTNNG\",\n customer_identifier=\"08030001234\",\n tracking_reference=\"invalid_tracking_reference\", # Invalid tracking_reference\n)\n\nprint(response)\n# PyKudaResponse(status_code=200, data=<Response [200]>, error=True)\nprint(response.data.text)\n# '{\"message\":\"Invalid Virtual Account.\",\"status\":false,\"data\":null,\"statusCode\":\"k-OAPI-07\"}'\n```\n\nAs shown in the [Successful request](#successful-request) section, it is recommended to use response.error to ensure that the request was successful.\n\n## What else can PyKuda do?\n\nPyKuda can be used to make other requests also. Below are examples of how to use the other methods available in the `ServiceType` class.\n\n### Create Virtual Account\n\n```python\nresponse = kuda.create_virtual_account(\n first_name=\"Ogbeni\",\n last_name=\"Lagbaja\",\n phone_number=\"08011122233\",\n email=\"ogbeni@temi.com\",\n middle_name=\"Middle\",\n business_name=\"ABC Ltd\",\n)\nprint(response)\n# Example Response:\n# PyKudaResponse(status_code=200, data=<response_data>, error=False)\n\nprint(response.data)\n# {\n# \"account_number\": \"2000111222\", # Newly generated account number from Kuda\n# \"tracking_reference\": \"trackingReference\", # Tracking reference\n# }\n```\n\n### Virtual Account Balance\n\n```python\nresponse = kuda.virtual_account_balance(tracking_reference=\"your_tracking_reference\")\n\nprint(response.data)\n# {\n# \"ledger\": \"ledgerBalance\",\n# \"available\": \"availableBalance\",\n# \"withdrawable\": \"withdrawableBalance\",\n# }\n```\n\n### Main Account Balance\n\n```python\nresponse = kuda.main_account_balance()\nprint(response.data)\n# {\n# \"ledger\": \"ledgerBalance\",\n# \"available\": \"availableBalance\",\n# \"withdrawable\": \"withdrawableBalance\",\n# }\n```\n\n### Fund Virtual Account\n\n```python\nresponse = kuda.fund_virtual_account(\n tracking_reference=\"your_tracking_reference\",\n amount=\"1000\",\n narration=\"Funding virtual account\",\n)\nprint(response.data)\n# {\"reference\": \"transactionReference\"}\n```\n\n### Withdraw from Virtual Account\n\n```python\nresponse = kuda.withdraw_from_virtual_account(\n tracking_reference=\"your_tracking_reference\",\n amount=\"500\",\n narration=\"Withdrawing from virtual account\",\n)\nprint(response.data)\n# {\"reference\": \"transactionReference\"}\n```\n\n### Confirm Transfer Recipient\n\n```python\nresponse = kuda.confirm_transfer_recipient(\n beneficiary_account_number=\"recipient_account_number\",\n beneficiary_bank_code=\"recipient_bank_code\",\n tracking_reference=\"your_tracking_reference\",\n)\nprint(response.data)\n# {\n# \"beneficiary_account_number\":\n# \"beneficiaryAccountNumber\"\n# ),\n# \"beneficiary_name\": \"beneficiaryName\",\n# \"beneficiary_code\": \"beneficiaryBankCode\",\n# \"session_id\": \"sessionID\",\n# \"sender_account\": \"senderAccountNumber\",\n# \"transfer_charge\": \"transferCharge\",\n# \"name_enquiry_id\": \"nameEnquiryID\",\n# \"tracking_reference\": \"SenderTrackingReference\",\n# }\n```\n\n### Send Funds from Main Account\n\n```python\nresponse = kuda.send_funds_from_main_account(\n client_account_number=\"sender_account_number\",\n beneficiary_bank_code=\"recipient_bank_code\",\n beneficiary_account_number=\"recipient_account_number\",\n beneficiary_name=\"Recipient Name\",\n amount=\"1000\",\n naration=\"Sending funds\",\n name_enquiry_session_id=\"name_enquiry_session_id\",\n sender_name=\"Sender Name\",\n)\nprint(response.data)\n# {\n# \"transaction_reference\": \"transactionReference\",\n# \"request_reference\": \"requestReference\",\n# }\n```\n\n### Send Funds from Virtual Account\n\n```python\nresponse = kuda.send_funds_from_virtual_account(\n tracking_reference=\"your_tracking_reference\",\n beneficiary_bank_code=\"recipient_bank_code\",\n beneficiary_account_number=\"recipient_account_number\",\n beneficiary_name=\"Recipient Name\",\n amount=\"1000\",\n naration=\"Sending funds\",\n name_enquiry_session_id=\"name_enquiry_session_id\",\n sender_name=\"Sender Name\",\n)\n\nprint(response.data)\n# {\n# \"transaction_reference\": \"transactionReference\",\n# \"request_reference\": \"requestReference\",\n# }\n```\n\n### Get Billers\n\n```python\nresponse = kuda.billers(biller_type=\"electricity\")\nprint(response.data)\n# {\n# \"billers\": [\"list_of_billers\"]\n# }\n```\n\n### Verify Bill Customer\n\n```python\nresponse = kuda.verify_bill_customer(\n kuda_biller_item_identifier=\"bill_item_identifier\",\n customer_identifier=\"customer_identifier\",\n)\nprint(response.data)\n# {\n# \"customer_name\": \"customerName,\n# }\n```\n\n### Main Account Purchase Bill\n\n```python\nresponse = kuda.p.admin_purchase_bill(\n amount=\"500\",\n kuda_biller_item_identifier=\"bill_item_identifier\",\n customer_identifier=\"customer_identifier\",\n tracking_reference=\"your_tracking_reference\",\n client_first_name=\"Lagbaja\",\n phone_number=\"customer_phone_number\",\n)\nprint(response.data)\n# {\n# \"reference\": \"reference\",\n# }\n```\n\n### Virtual Account Purchase Bill\n\n```python\nresponse = kuda.virtual_account_purchase_bill(\n amount=\"500\",\n kuda_biller_item_identifier=\"bill_item_identifier\",\n customer_identifier=\"customer_identifier\",\n tracking_reference=\"your_tracking_reference\",\n phone_number=\"customer_phone_number\",\n)\nprint(response.data)\n# {\n# \"reference\": \"reference\",\n# }\n```\n\n### Disable Virtual Account\n\n```python\nresponse = kuda.disable_virtual_account(\n tracking_reference=\"your_tracking_reference\",\n)\nprint(response.data)\n# {\n# \"account_number\": \"accountNumber\",\n# }\n```\n\n### Enable Virtual Account\n\n```python\nresponse = kuda.enable_virtual_account(\n tracking_reference=\"your_tracking_reference\",\n)\nprint(response.data)\n# {\n# \"account_number\": \"accountNumber\",\n# }\n```\n\n### Update Virtual Account Name\n\n```python\nresponse = kuda.update_virtual_account_name(\n tracking_reference=\"your_tracking_reference\",\n first_name=\"New_First_Name\",\n last_name=\"New_Last_Name\",\n)\nprint(response.data)\n# {\n# \"account_number\": \"accountNumber\"\n# }\n```\n\n### Update Virtual Account Email\n\n```python\nresponse = kuda.update_virtual_account_email(\n tracking_reference=\"your_tracking_reference\",\n email=\"new_email@example.com\",\n)\nprint(response.data)\n# {\n# \"account_number\": \"accountNumber\"\n# }\n```\n\n### Retrieve Single Virtual Account\n\n```python\nresponse = kuda.retrieve_single_virtual_account(\n tracking_reference=\"customer_tracking_reference\",\n)\nprint(response.data)\n# {\n# \t \"accountNumber\": \"2504205433\",\n# \"email\": \"08011122233\",\n# \"phoneNumber\": \"08011111111\",\n# \"lastName\": \"Lagbaja\",\n# \"firstName\": \"Ogbeni\",\n# \"middleName\": \"Middle\",\n# \"bussinessName\": \"ABC LTD\",\n# \"accountName\": \"(ABC LTD)-Lagbaja Ogbeni\",\n# \"trackingReference\": \"tracking_reference\",\n# \"creationDate\": \"2023-04-24T16:35:23.6033333\",\n# \"isDeleted\": false\n# }\n```\n\n### Retrieve All Virtual Accounts\n\n```python\nresponse = kuda.retrieve_all_virtual_accounts()\nprint(response.data)\n# [\n # {\n # \t \"accountNumber\": \"2504205433\",\n # \"email\": \"08011122233\",\n # \"phoneNumber\": \"08011111111\",\n # \"lastName\": \"Lagbaja\",\n # \"firstName\": \"Ogbeni\",\n # \"middleName\": \"Middle\",\n # \"bussinessName\": \"ABC LTD\",\n # \"accountName\": \"(ABC LTD)-Lagbaja Ogbeni\",\n # \"trackingReference\": \"tracking_reference\",\n # \"creationDate\": \"2023-04-24T16:35:23.6033333\",\n # \"isDeleted\": false\n # },\n # ........\n# ]\n```\n\n## Contributions & Issues\n\n- If you would like to contribute and improve this package or its documentation, please feel free to fork the repository, make changes and open a pull request.\n- If you encounter any issue or bugs, please open an issue.\n\n## Author\n\n- [Kayode TemiTope](https://github.com/sir-temi)\n",
"bugtrack_url": null,
"license": "",
"summary": "A python package that simplifies using the Kuda Bank Api",
"version": "1.0.6",
"project_urls": {
"Bug Tracker": "https://github.com/sir-temi/pykuda/issues",
"Homepage": "https://github.com/sir-temi/pykuda"
},
"split_keywords": [
"kuda bank",
"pykuda",
"open api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c3f1917a1434a55581976263b1f5192bf3bd3563c0a0f9620c172bb9d12cac25",
"md5": "cb2c95979aa11efb1b964f4919f156c6",
"sha256": "dd5d921a94f012b407f9bc79695baa92e231c7d5d7f173ee3b0d2722ad197749"
},
"downloads": -1,
"filename": "pykuda-1.0.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "cb2c95979aa11efb1b964f4919f156c6",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 13655,
"upload_time": "2023-12-30T06:48:26",
"upload_time_iso_8601": "2023-12-30T06:48:26.118612Z",
"url": "https://files.pythonhosted.org/packages/c3/f1/917a1434a55581976263b1f5192bf3bd3563c0a0f9620c172bb9d12cac25/pykuda-1.0.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ca32e503b23c0ff33642ea2b32f33ad4a7c980e58430a6ff18a5e3b389a5bd49",
"md5": "aa28636fff09cd9ac6e262820a6e40be",
"sha256": "ea8bbdc7d5eaaaf5d492aa7acf8b4495a3355d05d719bf3c2793d796c58b46ee"
},
"downloads": -1,
"filename": "pykuda-1.0.6.tar.gz",
"has_sig": false,
"md5_digest": "aa28636fff09cd9ac6e262820a6e40be",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 16453,
"upload_time": "2023-12-30T06:48:28",
"upload_time_iso_8601": "2023-12-30T06:48:28.401423Z",
"url": "https://files.pythonhosted.org/packages/ca/32/e503b23c0ff33642ea2b32f33ad4a7c980e58430a6ff18a5e3b389a5bd49/pykuda-1.0.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-30 06:48:28",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sir-temi",
"github_project": "pykuda",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pykuda"
}