jumaallan / android-mpesa-api Goto Github PK
View Code? Open in Web Editor NEWAndroid MPESA SDK Library to provide smooth MPESA Experience in Android - Dubbed Daraja
Home Page: https://androidstudy.com
License: MIT License
Android MPESA SDK Library to provide smooth MPESA Experience in Android - Dubbed Daraja
Home Page: https://androidstudy.com
License: MIT License
Hi Juma i noticed currently getting the Accesstoken from the library has a high failure rate and hence no stk push is shown can you help check
There is a 12 character limit for the account reference.
Funny thing is the response returned says request is being processed, however the actual push is not made to device. Was trying this out today on the Safaricom portal earlier, probably a bug on their end.
Since we have Dokka plugin setup on the repo, it makes sense to add code documentation
Rename the function to requestMPESAExpress
Hello @jumaallan. I have noticed that unit tests have not been addressed in this project. If this is something that was overlooked, I would be more than happy to work on it
Migrate from GSON
Is it possible to retrieve transaction history?
Is your feature request related to a problem? Please describe.
making it smooth for newbies to contribute to the project in accordance to Github's recommended community standards
Describe the solution you'd like
Add code of conduct and contributor guidelines file to align with Github's recommended community standards
Describe alternatives you've considered
N/A
Additional context: screenshot
I'd be delighted to work on this issue if accepted
Migrate the DI setup to KOIN, from Dagger
Describe the bug
I created a small demo and tried using the library but I keep getting this exception below. I went ahead and cloned this repo and executed it on my Android Studio but still the same exception. I then went ahead and replaced the credential with mine, but still the same error.
com.androidstudy.daraja.callback.DarajaException: 400.002.02 : Bad Request - Invalid BusinessShortCode
To Reproduce
Steps to reproduce the behavior:
We can do lower than API 16, to allow support on devices running old versions of Android
Describe the bug
We have a local bash script that runs analysis on the code, which fails
To Reproduce
Steps to reproduce the behavior:
./codeAnalysis
Expected behavior
The task should run and complete successfully
Screenshots
If applicable, add screenshots to help explain your problem.
Is your feature request related to a problem? Please describe.
Not based on any problem but just some nice documentation of the code.
Describe the solution you'd like
The best approach is to comment on the code using Javadoc explaining what some of the methods do.
Describe alternatives you've considered
N/A
Additional context
N/A
The linked url redirects to a domain purchase or is broken
Handle callbacks and push notifications to the device.
This is an enhancement to show how to handle server callbacks on successful response from Safaricom, and also show a nice way to push successful transactions back to a device
Use Firebase Cloud Functions and Cloud Messaging
Leverage on Firebase, as its easier to use on Android. This will be bundled in the example project, and not necessarily the only implementation that can be used
I am getting this error.
Failed. MPESA cannot complete this operation. The parameter is incorrect No till is found for CustomerPayMerchant.
Every time I use this, the error is printed in the logcat. Nothing more that is helpful. What does it mean?
Upgrade the project to use AGP 7
Add support for Java 11 in our CI
I setup all the credentials as per the details provided on my daraja API account. I keep on getting the above named error in the console log. I am farely new to Daraja API so any assistance would be highly appreciated. Did I miss something? nothing happens when after I input the phone number and press 'Request MpesaExpress'
`//TODO :: REPLACE WITH YOUR OWN CREDENTIALS :: THIS IS SANDBOX DEMO
daraja = Daraja.with("[I set my own from daraja api]", "[same here", new DarajaListener() {
@OverRide
public void onResult(@nonnull AccessToken accessToken) {
Log.i(MPESAExpressActivity.this.getClass().getSimpleName(), accessToken.getAccess_token());
Toast.makeText(MPESAExpressActivity.this, "TOKEN : " + accessToken.getAccess_token(), Toast.LENGTH_SHORT).show();
}
@Override
public void onError(String error) {
Log.e(MPESAExpressActivity.this.getClass().getSimpleName(), error);
}
});`
Set as well:
//TODO :: REPLACE WITH YOUR OWN CREDENTIALS :: THIS IS SANDBOX DEMO LNMExpress lnmExpress = new LNMExpress( "600616", "[set]", //https://developer.safaricom.co.ke/test_credentials TransactionType.CustomerBuyGoodsOnline, // TransactionType.CustomerPayBillOnline <- Apply any of these two "10", "254708374149", "174379", phoneNumber, "http://mycallbackurl.com/checkout.php", "001ABC", "Goods Payment" );
I believe the API could be streamlined to support the common use cause of a business that wants to start receiving payments.
ie
//Final implementation
Daraja daraja = new Daraja.Builder() //could be injected or single instanced
.setConsumerKey("")
.setConsumerSecrtet("")
.setCallbackUrl("")
.setBusinessShortCode("")
.setAccountType(TransactionType.CustomerBuyGoodsOnline)
.setParty(""); //not sure if partyA or partyB
//simpler API requests that returns the DarajaListener
daraja.pay("phone", "amount", "description"); //creates an LNMExpress class from Daraja and does api request
Currently, LNMExpress class holds to much scope, some of which should be held in the Daraja class.
I am willing to create a PR to demonstrate the same
Describe the bug
Add support for androidx
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The given artifact contains a string literal with a package reference 'android.support.v4.content' that cannot be safely rewritten. Libraries using reflection such as annotation processors need to be updated manually to add support for androidx.
Is your feature request related to a problem? Please describe.
jCenter() has been shut down, meaning we need to do the next release on mavenCentral() to keep this library alive ๐
Describe the solution you'd like
Setting up a way to publish the artifact to mavenCentral() directly, maybe starting the version 2.0.0
Add Kotlin Support and Examples to this project - Enhancements
Add a Maven/jCenter Badge to show the Build Version Number, on the Readme Header
updated to v1.0.2
Daraja.Builder
Environment.SANDBOX
previously from Env.SANDBOX
@Provides
@Singleton
Daraja providesDaraja() {
return Daraja.Builder(Config.CONSUMER_KEY, Config.CONSUMER_SECRET)
.setBusinessShortCode(Config.BUSINESS_SHORTCODE)
.setPassKey(AppUtils.getPassKey())
.setTransactionType(Config.ACCOUNT_TYPE)
.setCallbackUrl(Config.CALLBACK_URL)
.setEnvironment(Environment.SANDBOX)
.build();
}
Since we have unlimited build times for public repos, we can move the CI to Github Actions
The readme appears to have a broken badge, that needs to be removed and update it after the library overhaul.
Caused by an issue with Timber. This results in Circle CI Build Failure
From what I can see, it requires the user inputting their callbacks
, Passkeys
, and even Business shortcodes
.
This info cannot surely be mangled by anything whether proguard, or R8 or yGuard, which I presume some users
will even put the variables holding this info in static final Strings ๐คฃ making it easier for attackers.
If someone is to de-compile an app using this library what security is put into place to avoid leaking out the data stated on top.
EG:
A hacker decompiles, and just greps output for "https://" to get callback urls, and then begins sending dummy requests to it,
now if the user of this library has it that that callback is used to validate a purchase, a hacker can do unlimited purchases without paying a single coin.
This is just an example, I assume there are many more attack vectors.
Maybe users of the library can be adviced to not store those variables directly in their app but pull them from some REST Api in an encrypted format, decrypt on the device and use it?
Does the Toast really need to be there,is a bad practise to have such a token shown to users
Add tests to the app and Daraja Module
Currently everything in the .idea folder is checked into VCS but some files are unique to each environment e.g. build_file_checksums. This causes issues when merging changes. It would really help if the folder can be ignored.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.