GithubHelp home page GithubHelp logo

annastacia-dev / daraja-test Goto Github PK

View Code? Open in Web Editor NEW
18.0 18.0 6.0 621 KB

Implementing m-pesa stk push and query

Ruby 47.20% Procfile 0.07% JavaScript 3.19% SCSS 1.32% CSS 0.93% HTML 46.62% Shell 0.67%
mpesa mpesa-api mpesa-payments mpesa-sdk rails rails-api ruby

daraja-test's Introduction

Know me

💻 Web developer | Currently building with Ruby on Rails and React Js.
🎥 Aspiring cinephile | Former designer. 
Open to collaborations & contributing to projects. 

Connect with me

Languages and Tools

daraja-test's People

Contributors

annastacia-dev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

daraja-test's Issues

add views

Develop a UI view to make stk push, should have an input for phone number and amount and button that will send the request.
Show alert for request status

going live

Get a shortcode from Mpesa
Set up web hooks
Write a going live tutorial & add it to the README.md

code refactoring

Refactor code - readability, structure (DRY code, have concerns)
set up rubocop for linting and fix the errors

add more api services

Integrate more endpoints offered by daraja API

  • Dynamic QR
  • C2B
  • B2C
  • Transaction Status
  • Account Balance
  • Reversals
  • Tax Remittance
  • Business PayBill
  • Business Buy Goods
  • Bill Mananger
  • B2B Express Checkout

Add views (where applicable for these)

Current Integrations

  • Authorization
  • M-pesa Express

Bug

When using postman to make a #stkpush, I have encountered an error (as shown below), so I got into debug mode;

Processing by MpesasController#stkpush as /
  Parameters: {"phoneNumber"=>"2547
******", "amount"=>"1", "mpesa"=>{"phoneNumber"=>"2547********", "amount"=>"1"}}
Consumer Key:
Consumer Secret:
Encoded Userpass: Og==
Request Headers: {:Authorization=>"Bearer Og=="}
Completed 500 Internal Server Error in 15224ms (ActiveRecord: 1.9ms | Allocations: 5450)**

It's quite clear consumer key and consumer secret ,for lack of a better term, 'hazionekani'. Why? You have the following code in your config/application.rb;  
config.before_configuration do
env_file = File.join(Rails.root, 'config', 'local_env.yml')
YAML.load(File.open(env_file)).each do |key, value|
ENV[key.to_s] = value
end if File.exist?(env_file)
end

because of this line env_file = File.join(Rails.root, 'config', 'local_env.yml' consumer key and consumer secret hazionekani, you should move the local_env.yml from root and have it inside the config folder.

update readme

  • update readme with refactored code structure
  • segment docs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.