Installation and configuration
Installation
Add this to your buildScript repositories declaration
repositories {
maven { url 'https://nexus.devops.geopagos.com/repository/android-geopagos_public/' }
google()
mavenCentral()
jcenter()
maven { url 'https://jitpack.io' }
}
And this to your module dependencies
dependencies {
implementation "com.geopagos.payments.sdk:payments-core:$paymentVersion"
}
And for each type of reader you want to support (you may choose to support one or more)
- QPOS
- MagicPOS
- Urovo SmartPOS
- MoreFun SmartPOS
dependencies {
implementation "com.geopagos.payments.sdk:sdk-reader-qpos:$paymentVersion"
}
dependencies {
implementation "com.geopagos.payments.sdk:sdk-reader-magicpos:$paymentVersion"
}
dependencies {
implementation "com.geopagos.payments.sdk:sdk-reader-urovo:$paymentVersion"
}
dependencies {
implementation "com.geopagos.payments.sdk:sdk-reader-morefun:$paymentVersion"
}
Configure the SDK
This consists of initializing the Readers SDK, provide data acording to code documentation.
First of all, SDK intialization is required, there is a Builder SDKPaymentsConfiguration.Builderto configure the required data:
val sdkPaymentsConfiguration = SDKPaymentsConfiguration.Builder()
.setLogger(<LOGGER>)
.setSwipePinDecider(<SWIPE_PIN_DECIDER>)
.build(
<CONTEXT>,
"<ENDPOINT>",
setOf(<READER_INSTALLER_SET>,
setOf(<PLUGIN_INSTALLER_SET>)
)
SDKPayments.init(sdkPaymentsConfiguration)
Where:
- CONTEXT* is the ApplicationContext
- ENDPOINT is a String with the URL path of the processor URL. Geopagos will provide this URL
- READER_INSTALLER_SET is a set of reader installers. According to the dependencies you added
- PLUGIN_INSTALLER_SET is a set of optional plugins. According to the dependencies you added. Geopagos will provide the corresponding documentation according to the contracted plugins
- LOGGER is a custom logger you can provide to get additional information about what the sdk is doing (is useful for debugging purposes)
- SWIPE_PIN_DECIDER is an interface that allows you to decide if the SDK should ask pin on swipe transactions. This is optional. By default the SDK is loaded with an implementation that decides if a Swipe Card requires PIN based on the last ServiceCode Digit
About installers
Each reader has its own installer. Whether you've added the QPOS, Urovo SmartPOS and/or MAGICPOS dependencies (see above), you'll gain access to SDKQposReader, SDKUrovoReader and/or SDKMagicPosReader that allows you to install each reader as is shown below.
- QPOS
- MagicPOS
- Urovo SmartPOS
- MoreFun SmartPOS
SDKQposReader.getInstaller()
SDKMagicPosReader.getInstaller()
SDKUrovoReader.getInstaller(
<READER_PROFILE>,
<SDK_FILE_WRAPPER>,
<PIN_KEYBOARD_CONFIGURATION>
)
Where:
- READER_PROFILE is the profile for your country.
- SDK_FILE_WRAPPER allows you to provide a configuration file to the getInstaller
- PIN_KEYBOARD_CONFIGURATION allows you to customize the buttons of the PIN keyboard. You can customize the texts and its sizes, the margins and the background colors.
SDKMoreFunReader.getInstaller(
<READER_PROFILE>,
<PIN_KEYBOARD_CONFIGURATION>,
<SDK_FILE_WRAPPER>
)
Where:
- READER_PROFILE is an enum representing the profile specific to your country.
enum class SDKMoreFunReaderProfile {
ARGENTINA, CHILE, MEXICO
}
- SDK_FILE_WRAPPER allows you to provide a configuration file to the getInstaller.
sealed class SDKFileWrapper(val context: Context) {
/**
* You should use this class if the file that you want to provide is stored as an asset on your application
*
* @param context the application context
* @param name the file name of the asset
* **/
class Asset(context: Context, val name: String) : SDKFileWrapper(context)
/**
* You should use this class if the file that you want to provide is stored as a file on your device
*
* @param context the application context
* @param path the path of the file
* **/
class File(context: Context, val path: String) : SDKFileWrapper(context)
}
// example
SDKFileWrapper.Asset(applicationContext, "morefun_smartpos_reader_config.xml")
- PIN_KEYBOARD_CONFIGURATION enables you to personalize the buttons on the PIN keyboard according to your preferences. You have the flexibility to customize the displayed text as illustrated in the example below (see also customize PIN keyboard ):
data class SDKMoreFunKeyboardTexts(
val title: String,
val okText: String,
val cancelText: String,
val deleteText: String
)
// example
SDKMoreFunKeyboardTexts(
title = "enter PIN",
okText = "ok",
cancelText = "cancel",
deleteText = "delete"
)
Initialization Example (supporting only MagicPos)
val swipePinDecider = object : SDKSwipePinDecider{
override fun decide(card: SDKTransactionCard.Magnetic, decision: (pinRequire: Boolean) -> Unit) {
decision(true)
}
}
val sdkPaymentsConfiguration = SDKPaymentsConfiguration.Builder()
.setLogger(myCustomLogger)
.setSwipePinDecider(swipePinDecider)
.build(
applicationContext,
"https://example.net/",
setOf(SDKMagicPosReader.getInstaller()),
setOf(SDKBinCvmContactlessDeciderPlugin.getInstaller(sdkBinTable))
)
SDKPayments.init(sdkPaymentsConfiguration)