# SDK Initialisation

  1. Clone the develop branch of the repository mmapi-java-sdk:
git clone git@github.com:gsmainclusivetechlab/mmapi-java-sdk.git -b develop
export MMAPI_JAVA_SDK=$(pwd)/mmapi-java-sdk
cd $MMAPI_JAVA_SDK
  1. Create the file config.properties inside the directories $MMAPI_JAVA_SDK/mmapi-java-sdk/src/test/resources and $MMAPI_JAVA_SDK/mmapi-java-sdk-samples/resources.
touch $MMAPI_JAVA_SDK/mmapi-java-sdk/src/test/resources/config.properties
touch $MMAPI_JAVA_SDK/mmapi-java-sdk-samples/resources/config.properties
  1. Replace <consumer_key> , <consumer_secret> and <api_key> with the values taken from your mmapi developer account. Also replace <callback_url> with the value according to your environment.
CONSUMER_KEY=<consumer_key>
CONSUMER_SECRET=<consumer_secret>
API_KEY=<api_key>
CALLBACK_URL=<callback_url>
  1. Sample code to initialise Java SDK:
package sdkinit;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import com.mobilemoney.common.constants.Environment;
import com.mobilemoney.base.constants.SecurityLevel;
import com.mobilemoney.base.constants.Constants;
import com.mobilemoney.base.context.MMClient;

public class SDKInit {
  private static Properties properties;
  static {
    try (InputStream input = new FileInputStream("resources/config.properties")) {
      properties = new Properties();
      properties.load(input);
    } catch (IOException io) {
    }
  }

  public static String get(String key) {
    return properties.getProperty(key);
  }

  /***
  *
  * @param args
  */
  public static void main(String... args) {
    /***
    * instance of MMClient Class
    */
    MMClient mmClient = new MMClient(
                  get("CONSUMER_KEY"),
                  get("CONSUMER_SECRET"),
                  get("API_KEY"),
                  Environment.SANDBOX,
                  SecurityLevel.DEVELOPMENT);
                  
    System.out.println("Consumer Key : " + get("CONSUMER_KEY"));
    System.out.println("Consumer Secret : " + get("CONSUMER_SECRET"));
    System.out.println("API Key : " + get("API_KEY"));
    System.out.println("Environment : " + Environment.SANDBOX);
    System.out.println("Security Level : " + SecurityLevel.DEVELOPMENT);
    System.out.println("Callback URL : " + get("CALLBACK_URL"));
    System.out.println("MMAPI URL : " + Constants.REST_API_SANDBOX_ENDPOINT);
  }
}