Giter VIP home page Giter VIP logo

simplify-android-partner-sample's Introduction

Simplify Commerce - Android Partner SDK Sample App

The Simplify Commerce Partner SDK allows easy you to easily integrate card reader support into your mPOS solution.

Installation

Getting the SDK

In your project's build.gradle file, include the ksoap2 repository by adding the maven declaration to your repositories closure

allprojects {
    repositories {
        jcenter()

        maven {
            url 'http://ksoap2-android.googlecode.com/svn/m2-repo'
        }
    }
}

In your app module, include the partner SDK dependency via Gradle:

compile 'com.simplify:partner-sdk-android:1.0.0@aar'

or Maven:

<dependency>
    <groupId>com.simplify</groupId>
    <artifactId>partner-sdk-android</artifactId>
    <version>1.0.0</version>
    <type>aar</type>
</dependency>

Obtaining the MagTek support library

The required MagTek library is included in this sample app, or you can download from MagTek directly:

  1. Download the Magtek audio library
  2. Navigate to the /Audio.And.BulleT/SampleCode/libs directory
  3. Copy the magtek-scra.jar file to your module’s libs directory
  4. Right-click on your module
  5. Click on "Open Module Settings"
  6. Click the "Dependencies" tab for you application module
  7. Click the "+" icon at the bottom of the window
  8. Choose "File dependency" from the drop down
  9. Select the library

Usage

To initialize the SDK with the correct Magtek device configuration, add the following to your Application onCreate method

try {
    CardReader.init(getBaseContext(), CardReader.ADAPTER_MAGTEK_UDYNAMO);
}
catch (CardReader.AdapterNotFoundException e) {
   e.printStackTrace();
}

Incorporating the UI

To receive card details from the UI, you need to implement a listener from your activity

private CardReaderDialogFragment.CardReaderListener mCardReaderListener;

@Override
protected void onCreate(Bundle savedInstanceState)
{
	// …

	mCardReaderListener = new CardReaderDialogFragment.CardReaderListener()
	{
		@Override
		public void onDisconnect() {
		}

		@Override
		public void onConnect() {
		}

		@Override
		public void onReadSuccess(Map<String, Object> cardInfo) {
		}

		@Override
		public void onReadError(String message) {
		}
	};
}

To show the UI, add the following to your context

public void showCardReaderDialog()
{
	CardReaderDialogFragment dialog = CardReaderDialogFragment.newInstance(mCardReaderListener);
	dialog.show(getFragmentManager(), “cardreader");
}

simplify-android-partner-sample's People

Contributors

nak5ive avatar

Watchers

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

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.