Ncba API

The NCBA gem is a wrapper that helps developers interface with the official NCBA OPEN BANKING API.

Installation

Add this line to your application's Gemfile:

gem 'ncba'

or install unstable version from git

gem 'ncba', git: '[email protected]:BerjisTech/ncba.git', branch: 'main'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install ncba

Usage

ncba_client = client = Ncba::Client.new(
  api_user: "your_user_name",
  api_key: "your_api_key"
)

NCBA accepts almost all variables as string except for amount which is float.

Ncba:: Client:: AccountOpening

ncba_client.(
    uid: "",
    customer_category: "",
    business_name: "",
    prefered_name: "",
    street: "",
    town_country: "",
    country: "",
    sector: "",
    industry: "",
    nationality: "",
    email: "",
    emergency_email: "",
    phone_number: "",
    building: "",
    website: "",
    bank_name: "",
    branch: "",
    account_number: "",
    bank_account_name: "",
    account_currency: "",
    cba_account: "",
    bank_code: "",
    swift_code: "",
    business_phone_number: "",
    postal_code: "",
    postal_address: "",
    stakeholder_director_shareholder: "",
    stakeholder_surname: "",
    stakeholder_forename: "",
    stakeholder_salutation: "",
    stakeholder_gender: "",
    stakeholder_email: "",
    stakeholder_phone: "",
    stakeholder_postal_address: "",
    stakeholder_town: "",
    stakeholder_postal_code: "",
    stakeholder_country: "",
    stakeholder_id_type: "",
    stakeholder_id_number: "",
    brn: ""
)

Ncba:: Client:: CreditDetails

ncba_client.credit_details(
    bizpawa_id: "",
    turnover_ratio: "",
    saas_payment_rate: "",
    payment_mode_rate: "",
    predictive_analysis: "",
    prev_loan_repayment_rate: "",
    pre_existing_cba_account: "",
    customer_bizpawa_age: "",
    inventory_turnover: "",
    director_listed_crb: "",
    business_listed_crb: "",
    bank_code: ""
)

Ncba:: Client:: CreditTransfer

ncba_client.credit_transfer(
    bank_code: '', # Bank Code (For ALL MWallets use 99), (For MPesa use 16 if RTGS), (For Pesalink 404)
      bank_swift_code: '',
      branch_code: '', # Branch code ( For ALL Mwallets use 002 )
      beneficiary_account_name: '',
      country: 'Kenya', # Kenya, Uganda, Tanzania (Case Sensitive)
      transaction_type: '', # Internal, Eft, RTGS, Pesalink, Mpesa, HalotelTz, AirtelTz, ZantelTz, TigoTz, VodacomTz
      reference: '',
      currency: '', # KES, TZS, UGX
      account: '', # 254XXXXXX (or your country code) for mobile, account number if bank
      amount: '',
      narration: '',
      transaction_date: '',
      validation_id: '', # Validation from mpesa_verification
      sender_name: '',
      purpose_of_payment: '',
      sender_principle_activity: '',
      sender_address: '',
      receiver_address: '',
      receiver_id: '',
      sender_id: '',
      beneficiary_name: ''
)

Ncba:: Client:: MpesaPhoneNumberValidation

ncba_client.mpesa_phone_number_validation(
    mobile_number: "",
    reference: ""
)

Ncba:: Client:: TransactionQuery

ncba_client.transaction_query(
    country: "",
    reference_number: ""
)

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/berjistech/ncba. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

We follow the GitHub Flow model:

  1. Check out this repo
  2. Create your branch with a descriptive name, prefixed with the associated issue number (if any): git checkout -b 10-branch-name
  3. Push the branch: git push origin 10-branch-name
  4. Create a pull request. This will serve as the central location for implementation discussion and code reviews. Assign it to yourself and label as "In Progress".
  5. Commit and push your changes: git commit -am '[#10] added a feature'
  6. Once satisfied, get another developer to review the changes by assigning the PR to them and changing the label to "Needs Review". Once changes are approved and all tests/cops pass, merge to main and deploy to Heroku.

We assume that main is always deploy-ready.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Ncba project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.