Repository navigation
Home
Rajat Subhra Chatterjee edited this page May 15, 2018
·
4 revisions
- At first add binary dependencies (vc-sdk-android and vc-sdk-libucube) to your project.
- Add some buildConfig field as follows [Note: You can add those on defaultConfig{} or If your project has flavors then add to the specific flavor.] -
buildConfigField 'Boolean', 'DUMMY_PAYMENTS', 'true'
buildConfigField 'String', 'KICC_IP_ADDRESS', "\"203.233.72.55\""
buildConfigField 'Integer', 'KICC_TRANSACTION_PORT', '15300'
buildConfigField "String", "ENDPOINT_URL", "\"https://qa.veea.co/mb/\""
- You should add all Gradle dependencies as follows -
//sdk direct dependencies
implementation project(':vc-sdk-android')
implementation project(':vc-sdk-libucube')
//sdk indirect dependencies
implementation 'com.tbruyelle.rxpermissions:rxpermissions:0.5.2@aar'
implementation 'com.google.zxing:core:3.3.2'
implementation "org.threeten:threetenbp:1.3.3"
implementation "com.github.greenfrvr:rubber-loader:1.1.2@aar"
implementation "com.android.support:gridlayout-v7:$supportLibVersion"
implementation "com.android.support:design:$supportLibVersion"
implementation "com.android.support:cardview-v7:$supportLibVersion"
implementation "com.android.support:support-v4:$supportLibVersion"
implementation 'com.google.android:flexbox:0.2.6'
implementation "com.chauthai.swipereveallayout:swipe-reveal-layout:1.4.0"
implementation 'com.roughike:bottom-bar:2.3.1'
implementation "info.android15.nucleus:nucleus:$nucleusVersion"
implementation "info.android15.nucleus:nucleus-support-v7:$nucleusVersion"
implementation "info.android15.nucleus:nucleus-support-v4:$nucleusVersion"
implementation('com.afollestad.material-dialogs:core:0.9.4.7') {
exclude group: 'com.android.support'
}
implementation 'org.java-websocket:Java-WebSocket:1.3.4'
implementation "frankiesardo:icepick:$icepickVersion"
annotationProcessor "frankiesardo:icepick-processor:$icepickVersion"
implementation "com.squareup.okhttp3:okhttp:$okHttpVersion"
implementation "com.squareup.okhttp3:logging-interceptor:$okHttpVersion"
implementation "io.reactivex:rxandroid:1.2.1"
implementation "com.google.dagger:dagger:$daggerVersion"
annotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion"
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
implementation "com.squareup.retrofit2:adapter-rxjava:$retrofitVersion"
implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
implementation "android.arch.persistence.room:runtime:$roomVersion"
annotationProcessor "android.arch.persistence.room:compiler:$roomVersion"
- You have to initialize SDK [Note - you can do that on your application onCreate() method]
Max2SdkInternal.builder(this)
.subscribeOnScheduler(Schedulers.io())
.observeOnScheduler(AndroidSchedulers.mainThread())
.baseUrl(BuildConfig.ENDPOINT_URL) //provided by Veea
.debug(BuildConfig.DEBUG)
.kiccIpAddress(BuildConfig.KICC_IP_ADDRESS) //provided by Veea
.kiccPort(BuildConfig.KICC_TRANSACTION_PORT) //provided by Veea
.dummyPayments(BuildConfig.DUMMY_PAYMENTS) //if successful test transactions are needed
.init();
- Need to implement two BroadcastRecivers, respond to broadcast messages from SDK -
- AuthenticationBroadcastReceiver
public class AuthenticationBroadcastReceiver extends BroadcastReceiver { private static final String TAG = "AuthenticationBroadcastReceiver"; @Override public void onReceive(Context context, Intent intent) { if (intent != null) { if (intent.getExtras() != null) { boolean authenticationResult; Log.d(TAG, "Received intent with status " + (authenticationResult = intent.getBooleanExtra(AuthenticationRequestSupport.KEY_AUTHENTICATION_STATUS, false))); } else { Log.d(TAG, "Received empty intent"); } } } } - PaymentsBroadcastReceiver
public class PaymentsBroadcastReceiver extends BroadcastReceiver { private static final String TAG = "PaymentsBroadcastReceiver"; @Override public void onReceive(Context context, Intent intent) { if (intent != null) { if (intent.getExtras() != null) { Log.d(TAG, "Received intent with status " + TransactionStatusDetails.Status.fromInt( intent.getIntExtra(PaymentRequestSupport.KEY_TRANSACTION_STATUS, TransactionStatusDetails.Status.AUTHORIZE_FAILED.intVal())) + " and receipt " + intent.getStringExtra(PaymentRequestSupport.KEY_TRANSACTION_RECEIPT) ); } else { Log.d(TAG, "Received empty intent"); App.getInstance().getEventBus().post(new PaymentCancelledEvent()); } } } }
- AuthenticationBroadcastReceiver
- Don't forget to add those receivers on your AndroidManifest file and listen for those reciever on specific activity/fragment -
<receiver android:name="PaymentsBroadcastReceiver">
<intent-filter>
<action android:name="com.max2.veeaconnect.Payments" />
</intent-filter>
</receiver>
<receiver android:name="AuthenticationBroadcastReceiver">
<intent-filter>
<action android:name="com.max2.veeaconnect.Authentication" />
</intent-filter>
</receiver>
-
Integrating Login and Payment Screens
-
API Direct Integration