Skip to main content

"Unofficial Co-operative Bank of Kenya API Python SDK."

Project description

Build Status Build status Documentation Status License: GPLv3 Organization Views PRs Welcome GitHub pull-requests Language

pytekcoopbank

TralahTek TralahM TralahM

Co-operative Bank of Kenya Python SDK

Intuitive Python SDK for the Co-operative Bank of Kenya developer APIs.

Pre-requisites

Create an application

Create or login to your account at https://developer.co-opbank.co.ke:9443/store/

On the left panel, you can see a list of menus. Click on Applications to access the list of available applications in which case you can choose to use the default ones or create your own.

Subscribe to API(s)

  • Select the application or create your own application using steps described earlier.
  • Click “Subscribe”. A pop up message appears as shown:

Generate Keys

  • Click on “Applications” on the left panel.
  • Choose the application for which you want to generate keys
  • Choose the appropriate environment from the tabs(production or sandbox ).
  • Specify Callback URL and then click “Generate keys”. Leave other fields have default values;

Installation

Via PIP on pypi

# In terminal do:
$ pip install pytekcoopbank

Building from Source for Developers

$ git clone https://github.com/TralahM/pytekcoopbank.git
$ cd pytekcoopbank
$ python setup.py install

Documentation

Documentation

Setup

import tekcoopbank

config=dict(
        env                 = "sandbox",
        consumerKey         = "ss0sD2ANhjvhx_rHU0a6Xf8ROdYa",
        consumerSecret      = "zOfReXCIwn1TfnEYJJJGNP6l3Tka",
        accountNumber       = "54321987654321",
        bankCode            = "011",
        branchCode          = "00011001",
        callbackURL         = "/coop/callback",
        transactionCurrency = "KES",
)

COOP=tekcoopbank.setup_coop(config)

Usage

Check Account Balance

balance=COOP.balance.send(messageReference,accountNumber=None,callback=None)

Check Account Transactions

transactions=COOP.transactions.send(messageReference,accountNumber,NoOfTransactions=2,callback=None)

Account MiniStatement

mini_statement=COOP.mini_statement.send(messageReference,callback=None)

Account FullStatement

full_statement=COOP.full_statement.send(messageReference,callback=None)

Account Validation

validation=COOP.validation.send(messageReference,accountNumber,callback=None)

Get Exchange Rates

exchange_rate=COOP.exchange_rate.send(messageReference,
    accountNumber,
    fromCurrencyCode="KES",
    toCurrencyCode="USD",
    callback=None)

IFT Account to Account Transfer

ift_to_account=COOP.ift_to_account.send(messageReference,
    accountNumber,
    amount,
    transactionCurrency="KES",
    narration="Payment",
    destinations=[{},],
    callback=None)

PesaLink Account to Account Transfer

pesalink_to_account=COOP.pesalink_to_account.send(messageReference,
    accountNumber,
    amount,
    transactionCurrency="KES",
    narration="Payment",
    destinations=[{},],
    callback=None)

PesaLink Account to Phone Transfer

pesalink_to_account=COOP.pesalink_to_account.send(messageReference,
    phoneNumber,
    amount,
    transactionCurrency="KES",
    narration="Payment",
    destinations=[{},],
    callback=None)

Send to Mpesa

pesalink_to_account=COOP.pesalink_to_account.send(messageReference,
    mobileNumber,
    amount,
    transactionCurrency="KES",
    narration="Payment",
    destinations=[{},],
    callback=None)

Transaction Status

transaction_status=COOP.transaction_status.send(messageReference,callback=None)

Test Cases

As a developer, the test cases will be available to you for download as you are creating the sandbox app.

The test cases are in place to ensure that you have well understood the API structure for requests and responses for our different APIs. These test cases are in an excel spreadsheet that you should fill in with the results from each of the test scenarios that you want to consume.

As the Test cases will cover all the APIs available, you will only be required to carry out the test cases for the APIs you had initially selected.

Go - Live

Once you have already tried out the APIs on our platform and have tested these against our test cases provided, you can make a formal request to go to production.

You will need to have the test cases duly filled, then send an email request, together with these filled in test cases, to our support team who will guide you on the next steps to enable you to get to production.

Send the email request and the test cases to digitalbanking@co-opbank.co.ke

Contributing

See the Contributing File

See the Pull Request File

Support

LICENCE

Read the license here

Self-Promotion

TralahM TralahM

Blog

TralahTek

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytekcoopbank-0.0.0.tar.gz (22.4 kB view details)

Uploaded Source

Built Distribution

pytekcoopbank-0.0.0-py3-none-any.whl (22.0 kB view details)

Uploaded Python 3

File details

Details for the file pytekcoopbank-0.0.0.tar.gz.

File metadata

  • Download URL: pytekcoopbank-0.0.0.tar.gz
  • Upload date:
  • Size: 22.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for pytekcoopbank-0.0.0.tar.gz
Algorithm Hash digest
SHA256 f8fc4e7176ef3690cca0626625d4d15dd9bbe9ad3c6411d50ca179eec1f16d98
MD5 0fd44394b63c5e9d267c146cfe747956
BLAKE2b-256 7221fcd5030f17f9413c6291723333dccdc65a5ccd1613e101256469f48ff30b

See more details on using hashes here.

File details

Details for the file pytekcoopbank-0.0.0-py3-none-any.whl.

File metadata

  • Download URL: pytekcoopbank-0.0.0-py3-none-any.whl
  • Upload date:
  • Size: 22.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for pytekcoopbank-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8d601f46e99cad1a55d509d516f469513c40ecdf0662e6f30fe8c7d353d26247
MD5 dc864f0252ddfee1c913f5c6d9db51d4
BLAKE2b-256 f028c8ddb933db233f04b95eb3b7ef893d74ae373f66d70772ffb399ec3993ea

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page