Coder Social home page Coder Social logo

kn9ts / project-mulla Goto Github PK

View Code? Open in Web Editor NEW
301.0 301.0 117.0 1.3 MB

Talk to MPESA API via a REST API. Bringing the MPESA G2 API to the 21st century. --

Home Page: http://kn9ts.github.io/project-mulla/

License: GNU Lesser General Public License v3.0

JavaScript 97.41% HTML 1.15% CSS 1.43%
mediator mobile-money mpesa mpesa-api online-payments payments safaricom sag soap xml

project-mulla's People

Contributors

gangachris avatar kn9ts avatar snyk-support avatar yoda-yoda avatar

Stargazers

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

Watchers

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

project-mulla's Issues

testing with curl and httpie

Hi thanks again for this project, i have set up everything however i am having problems testing it with curl or httpie, I am getting many errors in the response, how should I place this in the CMD LINE because it is not working at all
$ curl -i -X POST
--url http://localhost:8080/api/v1/payment/request
--data 'phoneNumber=254723000000'
--data 'totalAmount=10.00'
--data 'clientName="Eugene Mutai"'
--data 'clientLocation=Kilimani' \

http POST localhost:8080/api/v1/payment/request
phoneNumber=254723000000
totalAmount=10.00
clientName='Eugene Mutai'
clientLocation='Kilimani'

All requests require an encrypted password, make it a route middleware (to stop deduping it)

data.timeStamp = moment().format('YYYYMMDDHHmmss'); // In PHP => "YmdHis"
data.encryptedPassword = new EncryptPassword(data.timeStamp).hashedPassword;

Move the above piece of code to an express route middleware for any request targeting a request to any URL involving /payment/...

It then shall be added to the req object passed in all route handlers, and used/referenced from there.

Till number

Hi i have the passkey for a till number will this be able to work with project mulla?

not compatible with operating system

Hi I am using windows when I git clone the project it tells me that its not compatible with my operating system and architecture, even though the project is showing in my folder, it did not install successfully.

C2B till number

Hi I am using a till number instead of a paybill number, however it is not working when I can confirm the payment, the status code shows 400:10 that 'the phone number is not registered with mpesa' even though it is, what could be the problem

after npm start

after npm start the program works well, how do I do a start run?

Update README with installations steps

There are no instructions on how to install this software even for testing

This has been intentional since it is not shipping-ready. The request seems valid still for anyone who wants to test it out even before shipping.

Authentication Failed

HTTP/1.1 500 Internal Server Error
Content-Length: 71
Content-Type: application/json; charset=utf-8
Date: Fri, 10 Jun 2016 19:13:59 GMT
ETag: W/"47-QF6qBiKtCUQCLU0A2DNoVg"
X-Powered-By: Express
set-cookie: connect.sid=s%3ADBjDmYnygsM3- 82Cw9e20F_8at65WasY.sSMgGuVZT0SxTBegG6TVOetY24eo7rp4FVr%2FuGnwOTs; Path=/; HttpOnly

{
"response": {
"description": "authentication failed",
"return_code": "42"
}
}
Am getting an Authentication error, any way around it?

Add sample request and response to README

The best form of explanation is a sample backend one. An sample or example visualises what may have been missed from your explanation.

We need to add one to the README of instantiating a payment request via /api/v1/payment/request

  • How one can instantiate it (HTTP method, route and params)
  • An example of the JSON response they get back

Add field/params validation to /payment/request route

/payment/request route recieves 4 params, 2 required, 2 optional (system generates replacements for these)

Parameters:

  • phoneNumber - The phone number of your client
  • totalAmount - The total amount you are charging the client
  • referenceID - The reference ID of the order or service [optional]
  • merchantTransactionID - This specific order's or service's transaction ID [optional]

We need to validate the required params, namely:

  • phoneNumber - 10 digit numerical value that starts with +25 (plus sign optional)
  • totalAmount - numerical values only

Support for non-requested payments

The current status of the projects seems to allow only payments that are requested for. Are there plans to have payments that are not pulled? The typical payments where one goes to his Mpesa Menu and enters the paybill number and amount.

Unpublish .coveralls.yml

Publishing the .coveralls.yml file in the repo means that anyone with the token can submit coverage data to coveralls as project-mulla
i.e. If I use the project-mulla token on another repo with 0% coverage, this means the coverage on this repo will show up as 0%

Remove return_code from JSON response

Should we remove the return_code property from the JSON response, it is the one provided by SAG but project mulla uses HTTP status codes to represent this in it's REST api

How a response looks like now:

{
    "amountInDoubleFloat": "10.00", 
    "clientPhoneNumber": "0723001575", 
    "cust_msg": "to complete this transaction, enter your bonga pin on your handset. if you don't have one dial *126*5# for instructions", 
    "description": "success", 
    "extraPayload": "{}", 
    "http_code": 200, 
    "merchantTransactionID": "4938a780-1f3b-11e6-acc6-5dabc98661b9", 
    "message": "Transaction carried successfully", 
    "referenceID": "f765b1ef-6890-44f2-bc7a-9be23013da1c", 
    "return_code": "00", 
    "timeStamp": "20160521130337", 
    "trx_id": "6c1b1dcc796ed6c1d5ea6d03d34ddb7f"
}

ADD CORS to the header

Hi I cannot be able to send a cross-domain request from my website to the project-mulla heroku app, do you happen to know how allow this on heroku? I keep getting the error No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:5000' is therefore not allowed access. The response had HTTP status code 503.

Add Mobile PUSH Notification support via FCM

The current support of Project Mulla favours web applications only. What if one just wanted to build an app without the web server as the endpoint on the other side of Project Mulla

The last SAG POST which takes place on a successful complete transaction can be conveyed to Project Mulla and pushed to the device using Push/Cloud messaging using XMPP.

Can be for Milestone v1.1.0

authentication failed

Hi,

What could be causing this? My credentials are a-ok,I tested them on anothet platform and even when I use safaricom's default paybill, the response is the same.

Docs: Sample Usage Examples

A step-by-step walk through with a practical sample usage will be of benefit to those checking out the project -- and will actually drive adoption.

However, good work done here @kn9ts

Endpoint and USSD Push

Great work Gene. I deployed mulla and tested successfully. However a curl request will succeed (200) but no USSD push is invoked as specified by the g2 specification and my endpoint as specifed in the app.yaml file is not respected as well. It seems to work but it actually doesn't.
Yaml file

env_variables:
   PAYBILL_NUMBER: 'XXXXXX'
   PASSKEY: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
   MERCHANT_ENDPOINT: 'https://my-domain/pay/test/callback'

RAW CURL:

$ curl -i -X POST \
>   --url https://my-domain/api/v1/payment/request \
>   --data 'phoneNumber=2547xxxxxxxx' \
>   --data 'totalAmount=10.00' \
>   --data 'clientName="Foo Bar"' \
>   --data 'clientLocation=Lorem Ipsum' \

RESPONSE:

{   
    "response": {
        "return_code":"00",
        "status_code":200,
        "message":"Transaction carried successfully",
        "trx_id":"9deff9552f55547c8d541c04c9efc9dd",
        "cust_msg":"to complete this transaction, enter your pin on your handset. if you don't have a pin, press 0 and follow the instructions.",
        "description":"success",
        "reference_id":"37e5f9c3-5c87-4615-855b-f6392e2c2d5c",
        "merchant_transaction_id":"44ebfd80-6667-11e6-be4e-5d93dc3b794e",
        "amount_in_double_float":"10.00",
        "client_phone_number":"2547xxxxxxxx",
        "extra_payload": {
            "clientName":"\"Foo Bar\"",
            "clientLocation":"Lorem Ipsum"
        },
        "time_stamp":"20160820024720",
        "callback_url":"http://my-domain/api/v1/payment/success"
    }
}

As you can see, not even the https protocol I access mulla from is respected in the callback.

Refactor ES6 import and any ES2015 feature not supported by Argon (node.js v4.4.4.)

Most features I have used are supported by Argon (node v4.4.4) but some are not. Thus am using babel-node for development and transforming the code base to ES5 for production in a ./dist directory. I think this is pretty ugly especially when it comes to debugging. Since you are not debugging the same code you wrote.

I prefer Project mulla working with Argon for now and later on to the next LTS.

Example of such pieces in ./index.js in the codebase:

import './environment';
import express from 'express';
import path from 'path';

looking for this fie

CBInterface_C2BPaymentValidationAndConfirmation.wsdl
please place it here my safaricom contact can't find it

Software QA: Write unit tests for all the scripts

Test all resources tied to the routes. One can test them through making requests to the routes and validating the response.

Preferably is to test each piece of the resource individually without any HTTP request invocation.

Basically unit testing.

No account number and sender name

Hi I am migrating from the M-Pesa IPN to the API
Where the account number(reference ID in Request Payment) and Sender Name are not provided
sample output.

{
  "response": {
    "msisdn": "254723001575",
    "amount": "450",
    "mpesa_trx_date": "2014-12-01 16:24:06",
    "mpesa_trx_id": "6jk45hsjdhjjky5hjk36wdsgha",
    "trx_status": "success",
    "return_code": "00",
    "description": "success",
    "merchant_transaction_id": "320903",
    "trx_id": "ds9d7f98asf809d8f9098sa098f9008f8"
  }
}

or am I missing something?

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.