A Java API wrapper for the facilitation of quick and easy development and integration of Java based applications with the the Credo API.
CredoJava removes the grunt involved in consuming the Credo API and implements a diverse array of helper methods to enable rapid prototyping and testing.
- Unirest (Installation procedures here: https://github.com/Mashape/unirest-java#installing)
- Download CredoJava
- Add jar file as a Module to your Java project:
- On Intellij IDEA: File -> Project Structure -> Modules -> Dependencies Tab -> Add -> JARs or Directories -> Attach jar
- On Netbeans: Project properties -> Libraries -> Compile -> ADD JAR/folder -> Add Jar
To create a new Credo payments:
Payments payments = new Payments();
payments.pay("[transRef]", "[amount]", "[customerEmail]","[customerName]", "[paymentOptions]", "[customerPhoneNo]", "[currency]","[redirectUrl]"
)
Remember to always shut down the API connection once you are done making requests
CredoJava utilizes a background event loop and your Java application won't be able to exit until you manually shutdown all the threads by invoking:
ApiConnection.shutDown();
CredoJava utilizes a Keys.json file for the management of api key resources. This file must be placed in your root project directory and has the following structure:
{
"API_KEYS":{
"KEY_IN_USE": "sk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"TEST_SECRET_KEY": "sk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"TEST_PUBLIC_KEY": "pk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"LIVE_SECRET_KEY": "sk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"LIVE_PUBLIC_KEY": "pk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}
- connectAndQuery [JSONObject]
- connectAndQueryWithGet [JSONObject]
- connectAndQueryWithPut [JSONObject]
- shutDown [void]
- newQuery [void]
- putParams [JSONObject]
- initializeTransaction [JSONObject]
- verifyTransaction [JSONObject]
- fetchTransaction [JSONObject]
The MIT License (MIT)
Copyright (c) 2021 Moses Bassey
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.