A fast entegration library for deeplink Softpos apps.
implementation 'com.provisionpay:android-deeplink-sdk:latest-version'
You must set the launchMode property to singleTask for your main activity.
<activity android:name=".MainActivity" android:exported="true" android:launchMode="singleTask">
You must to add the following codes for deeplink definition.
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="your_scheme" />
<data
android:host="your_host"
android:pathPrefix="your_pathPrefix"/>
</intent-filter>
This method is used onNewIntent() method on MainActivity. The method provides categorize response status codes that comes Softpos applications.
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
setIntent(intent)
SoftposDeeplinkSdk.handleDeeplinkTransaction()
}
You have to use initalize method to be integrated into the project.
val privateKey = "your private key"
val activity = this.requireActivity()
val deeplinkUrl = "your softpos url"
SoftposDeeplinkSdk.initialize(InitializeConfig(privateKey = privateKey ,activity = activity ,deeplinkUrl = deeplinkUrl))
Throws: NullArgumentException, ArgumentLengthException
This method starts your payment and provides you to softpos application. The method takes paymentSessionToken as parameter. This token must be 16 character.
SoftposDeeplinkSdk.startPayment(paymentSessionToken)
Throws: MissingArgumentException, NullArgumentException, ArgumentLengthException
Subscribe method gives status codes responses.
SoftposDeeplinkSdk.subscribe {
object : SoftposDeeplinkSdkListener {
override fun onPaymentDone(transaction: Transaction, isApproved: Boolean) {
//TODO
}
override fun onCancel() {
//TODO
}
override fun onIntentData(dataFlow: IntentDataFlow, data : String) {
when(e){
dataFlow.DataDecrypted -> {
//TODO
}
dataFlow.DataFound -> {
//TODO
}
dataFlow.ActivityIntentDataIsNull -> {
//TODO
}
dataFlow.ActivityIntentParameterDataIsNull -> {
//TODO
}
}
override fun onTimeOut() {
//TODO()
}
override fun onError(e: Throwable) {
//TODO
}
override fun onOfflineDecline(paymentFailedResult: PaymentFailedResult?) {
//TODO
}
override fun onSoftposError(errorType: SoftposErrorType,description:String?) {
when (errorType) {
SoftposErrorType.TerminalNotFound -> {
//TODO
}
SoftposErrorType.UserHashNotFound -> {
//TODO
}
SoftposErrorType.ActivationNotFound -> {
//TODO
}
SoftposErrorType.HostError -> {
//TODO
}
else -> {}
}
}
}
}
This method takes your softpos url and gives BroadcastReceiverListener object. With this method you can listen eventType , evenTypeMessage and paymentSessionToken.
val packageId = "package id of softpos app"
SoftposDeeplinkSdk.registerBroadcastReceiver(packageId, {
object : BroadcastReceiverListener {
override fun onSoftposBroadcastReceived(
eventType: Int,
eventTypeMessage: String,
paymentSessionToken: String
) {
//TODO
}
}
}
Throws: NullArgumentException
Optionally this method is used to specify debug mode is on. Tag is "SOFTPOS".
SoftposDeeplinkSdk.setDebugMode(true)
Platform | Language | |
---|---|---|
Android | Kotlin | android-demo-kotlin |
Android | Java | android-demo-java |