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.2.tar.gz (22.4 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytekcoopbank-0.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 844e299492f8618284f5c51663eaf346ec43d0399f8581b56b5936865e1cd728
MD5 0b2acc4075fea2bcc1ef87b25ffe7cc5
BLAKE2b-256 9091b0da03e7f392b488ab8c49e852ef47c60dc5ff5327a415a57612c92bef89

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pytekcoopbank-0.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 df7ea32512d32d281ce48040b31b272da9c73913d09bf100b8ef42cb5047509b
MD5 bdb09a2fd42ebaf838b2ca433182ea2e
BLAKE2b-256 bf794ac8c84320d91534ca21f46e4f707c8943157edd2375ff6cd94fef2ae83c

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