Code Monkey home page Code Monkey logo

rave-java-library's Introduction

Coverage Status Maintainability Scrutinizer Code Quality

Flutterwave Rave (Rave-Java-Library)

Rave-Java-Library facilitates quick and easy development and integration of Java based applications with the Flutterwave API.

  • Contributors: Theresa Sogunle, Oluwole Adebiyi (KingFlamez)
  • Tags: rave, flutterwave, payment gateway, bank account, credit card, debit card, nigeria, kenya, ghana, international, mastercard, visa, KES, GHC, NGN, Java.

Getting Started

Prerequisite

Signup for a test account here

Signup for a live account here

Installation (Jar file)

Maven

<dependency>
  <groupId>com.github.theresasogunle</groupId>
  <artifactId>Rave</artifactId>
  <version>1.0.1</version>
  <type>jar</type>
</dependency>

Visit Bintray

Jar

  • Download latest Rave-Java-Library jar file from here

How to Install Jar Libraries

On Netbeans IDE: Project properties -> Libraries -> Compile -> ADD JAR/folder -> Add Jar

On Intelli J IDEA: File > Project Structure -> Project Settings > Modules > Dependencies > "+" sign > JARs or directories

  • Set to go ๐Ÿ’ช

Sample Use

  • Simple Card Charge
import com.rave.*;
import org.json.JSONObject;


public class Main {

    public static void main(String[] args) throws Exception  {

        RaveConstant.PUBLIC_KEY="FLWPUBK-8ba286388b24dbd6c20706def0b4ea23-X";
        RaveConstant.SECRET_KEY="FLWSECK-c45e0f704619e673263844e584bba013-X";
        RaveConstant.ENVIRONMENT=Environment.STAGING; //or live


        CardCharge ch = new CardCharge();

        ch.setCardno("4187427415564246")
                .setCvv("828")
                .setAmount("3000")
                .setExpiryyear("19")
                .setExpirymonth("09")
                .setEmail("[email protected]")
                .setTxRef("MXX-ASC-4578")
                .setSuggested_auth("PIN")
                .setPin("3310");

        JSONObject charge= ch.chargeMasterAndVerveCard();

        System.out.println(charge);
    }
}
  • Rave Card Charge
import com.rave.*;
import org.json.JSONObject;

public class Main {

    public static void main(String[] args)throws JSONException {
	//rave constants
        RaveConstant.PUBLIC_KEY="FLWPUBK-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-X";
        RaveConstant.SECRET_KEY="FLWSECK-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-X";
        RaveConstant.ENVIRONMENT=Environment.STAGING; //or live

	CardCharge ch=new CardCharge();
        ch.setCardno("4187427415564246")
          .setCvv("828")
          .setCurrency("NGN")
          .setCountry("NG")
          .setAmount("9000")
          .setExpiryyear("19")
          .setExpirymonth("09")
          .setEmail("[email protected]")
          .setIP("103.238.105.185")
          .setTxRef("MXX-ASC-4578")
          .setDevice_fingerprint("69e6b7f0sb72037aa8428b70fbe03986c");
     
         //for master card and verve
     
           ch.setPin("3310")
             .setSuggested_auth("PIN");
             JSONObject charge= ch.chargeMasterAndVerveCard();
            //if timeout
            JSONObject poll=ch.chargeMasterAndVerveCard(true);
   
       
       //for visa and intl cards
        ch.setRedirect_url("http://www.google.com");
        JSONObject chargevisa=ch.chargeVisaAndIntl();
	  //if timeout, poll
            JSONObject pollvisa=ch.chargeVisaAndIntl(true);
       
    }
}
  • Rave Account Charge
import com.rave.AccountCharge;
import com.rave.Encryption;
import org.json.JSONObject;

public class Main {

    public static void main(String[] args) throws JSONException{
      	   //rave constants
        RaveConstant.PUBLIC_KEY="FLWPUBK-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-X";
        RaveConstant.SECRET_KEY="FLWSECK-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-X";
        RaveConstant.ENVIRONMENT=Environment.STAGING; //or live

	  
            AccountCharge ch= new AccountCharge();
            
          ch.setAccountnumber("0690000031")
            .setAccountbank("044")
            .setAmount("1000")
            .setCountry("NG")
            .setCurrency("NGN")
            .setLastname("Theresa")
            .setIP("1.3.4.4")
            .setPayment_type("account")
            .setTxRef("MX-678DH")
            .setEmail("[email protected]");
          
         JSONObject result=ch.chargeAccount();
          //polling
            JSONObject poll=ch.chargeAccount(true);
        System.out.println(result);
        //Validate The Charge
         //do not forget to set your fields
        ch.setTransaction_reference("ACHG-1520028650995")
          .setOtp("12345");
        //for polling
        JSONObject val=ch.validateAccountCharge(true);
        //without polling
        JSONObject validate=ch.validateAccountCharge());
    }
}

Test Implementation

Classes and Methods

The documentation for each classes and methods

  1. AccountCharge
  2. AlternatePayment
  3. Bank
  4. CardCharge
  5. Encryption
  6. ExchangeRates
  7. Fees
  8. PreAuthorization
  9. Refund
  10. Transaction
  11. IntegrityChecksum

Todo

  • Recurring Payments

License

The MIT License (MIT). Please see License File for more information.

rave-java-library's People

Contributors

kingflamez avatar theresasogunle 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

Watchers

 avatar  avatar  avatar

rave-java-library's Issues

Tests

What's your plan on writing tests for the library?

Awesome Job though.

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.