Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 45 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ Documentation of Digio Gateway Integration and their usage
Instantiate the Digio instance with `environment` & other options

```tsx
import { Digio, DigioConfig, DigioResponse } from '@digiotech/react-native';
import { Digio, DigioConfig, DigioResponse, ServiceMode } from '@digiotech/react-native';

const config: DigioConfig = { environment: Environment.PRODUCTION };
const config: DigioConfig = { environment: Environment.PRODUCTION, serviceMode: ServiceMode.OTP };
const digio = new Digio(config);
const documentId = "<document_id>";
const identifier = "<email_or_phone>";
Expand All @@ -36,7 +36,7 @@ For a complete list of events and the payload associated with it, refer [here](h

```tsx
import { useEffect } from 'react';
import { Digio, DigioConfig, GatewayEvent } from '@digiotech/react-native';
import { Digio, DigioConfig, GatewayEvent, ServiceMode } from '@digiotech/react-native';

function YourComponent() {
useEffect(() => {
Expand All @@ -57,7 +57,7 @@ function YourComponent() {

```tsx
import { useEffect } from 'react';
import { Digio, DigioConfig, GatewayEvent } from '@digiotech/react-native';
import { Digio, DigioConfig, GatewayEvent, ServiceMode } from '@digiotech/react-native';

function YourComponent() {
useEffect(() => {
Expand All @@ -73,7 +73,7 @@ function YourComponent() {
}, []);

const triggerDigioGateway = async () => {
const config: DigioConfig = { environment: Environment.PRODUCTION };
const config: DigioConfig = { environment: Environment.PRODUCTION, serviceMode: ServiceMode.OTP };
const digio = new Digio(config);
const documentId = "<document_id>";
const identifier = "<email_or_phone>";
Expand All @@ -85,18 +85,17 @@ function YourComponent() {
```

## Android
#### Note: Incase you are using camera feature and facing black screen on camera then follow below steps
- Add digioKycworkflow.aar file inside your react project under android/app/libs folder. [Download digio_kyc_workflow-4.0.15.aar](https://drive.google.com/file/d/1nHeZhDBPavLxwJp0VgNrMiEZpXswENgz/view?usp=sharing)


- Add below in your project under build.gradle (module:app)file inside dependencies

```tsx
implementation fileTree(dir: 'libs', include: ['*.aar'])
// Required for KYC/work_flow /video/2way video
implementation 'com.github.digio-tech:gateway_kyc:v4.0.20'
// Required for esign/mandate sign
implementation 'com.github.digio-tech:protean-esign:v3.2'
// under android {} of build.gradle(module:app)
buildFeatures {
viewBinding true
dataBinding true
}

```

## SDK Reference
Expand All @@ -105,11 +104,12 @@ implementation 'com.github.digio-tech:protean-esign:v3.2'

**Parameters:**

| Name | Type | Description |
|-----------------|---------|----------------------------------------------------------------------------------------|
| environment* | string | Environment for which you want to open gateway. One of `sandbox` or `production` |
| logo | string | Pass an URL of your brand logo. **Note:** Pass an optimised image url for best results |
| theme | string | Options for changing the appearance of the gateway. See below for options under it. |
| Name | Type | Description |
|-----------------|---------|---------------------------------------------------------------------------------------------|
| environment* | string | Environment for which you want to open gateway. One of `sandbox` or `production` |
| logo | string | Pass an URL of your brand logo. **Note:** Pass an optimised image url for best results |
| theme | string | Options for changing the appearance of the gateway. See below for options under it. |
| serviceMode* | string | ServiceMode can be OTP/FACE/IRIS/FP <Default it's OTP> you can set based on your requirment|

**Theme:**

Expand Down Expand Up @@ -140,9 +140,17 @@ Add required permissions in the manifest file. Note - This is the common SDK for
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
/** Required for geotagging */
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

/** Required for ID card analysis, selfie and face match**/
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />

<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />


```
A fintech Android app can't access the following permission
- Read_external_storage
Expand All @@ -152,6 +160,26 @@ A fintech Android app can't access the following permission
- Read_phone_numbers
- Read_media_videos

## You get a build error due to a theme issue.
- Please add tools:replace="android:theme" under your android manifest.
```
<application
....
tools:replace="android:theme"
...
>
.....
</application>

```
## You get a build error due to a duplicate class android.support.v4
- Check your gradle.properties below should be added.
```
android.enableJetifier=true
reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64

```

### IOS Permission

Permissions need to add in your info.plist
Expand Down
80 changes: 53 additions & 27 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -88,32 +88,58 @@ dependencies {
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+"
implementation 'com.github.digio-tech:gateway:v4.0.14'
compileOnly 'com.github.digio-tech:gateway_kyc:v4.0.20'
implementation 'com.github.digio-tech:gateway_esign:4.0.12'
// compileOnly fileTree(dir: "libs", include: ["*.aar"])
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation "androidx.camera:camera-core:1.2.2"
implementation "androidx.camera:camera-camera2:1.2.2"
implementation "androidx.camera:camera-lifecycle:1.2.2"
implementation "androidx.camera:camera-view:1.2.2"
implementation 'androidx.navigation:navigation-fragment:2.5.3'
implementation 'androidx.navigation:navigation-ui:2.5.3'
implementation 'androidx.preference:preference:1.2.0'
implementation 'com.google.android.gms:play-services-mlkit-face-detection:17.1.0'
implementation 'com.google.android.gms:play-services-location:21.0.1'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'

compileOnly 'com.github.digio-tech:protean-esign:v3.2'
implementation 'com.android.volley:volley:1.2.1'
implementation 'com.scottyab:rootbeer-lib:0.1.0'

implementation 'com.squareup.okhttp3:okhttp:4.10.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.10.0'
implementation 'com.github.digio-tech:cvl_esign:v1.0.1'
implementation 'com.github.digio-tech:cvl_rdservice:v1.0.0'
implementation 'com.google.code.gson:gson:2.9.1'
// core dependencies
implementation(platform("com.github.digio-tech:digio-bom:v1.0.10"))
implementation("androidx.appcompat:appcompat")
implementation("com.google.android.material:material")
implementation("androidx.navigation:navigation-fragment-ktx")
implementation("androidx.navigation:navigation-ui-ktx")

implementation("com.github.digio-tech:gateway")

implementation("androidx.swiperefreshlayout:swiperefreshlayout")
implementation("com.android.volley:volley")
implementation("com.squareup.okhttp3:okhttp")
implementation("com.squareup.okhttp3:logging-interceptor")
implementation("com.google.code.gson:gson")
implementation("com.github.digio-tech:digio_permissions")
implementation("com.google.android.gms:play-services-location")

implementation("com.github.digio-tech:sdk_offlinekyc")

implementation("com.github.digio-tech:esign_otp")
compileOnly("com.github.digio-tech:protean-esign")
implementation("com.github.digio-tech:cvl_esign")
implementation("com.scottyab:rootbeer-lib")
implementation("com.afollestad.material-dialogs:core") //giving duplicate class with upi

implementation("com.github.digio-tech:esign_biometrics")
implementation("com.github.digio-tech:cvl_rdservice")

implementation("com.github.digio-tech:esign_mandate")

implementation("com.github.digio-tech:sdk_native_camera")
implementation("com.github.digio-tech:image_processor")
implementation("androidx.exifinterface:exifinterface")

implementation("com.github.digio-tech:sdk_ml_camera")
implementation("com.google.mlkit:face-detection")
implementation("androidx.camera:camera-core")
implementation("androidx.camera:camera-camera2")
implementation("androidx.camera:camera-lifecycle")
implementation("androidx.camera:camera-view")
implementation("androidx.camera:camera-video")
implementation("androidx.preference:preference-ktx")
implementation("androidx.exifinterface:exifinterface")

implementation("com.github.digio-tech:sdk_upi")
implementation("androidx.core:core-ktx")
implementation("com.squareup.retrofit2:retrofit")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core")
implementation("androidx.fragment:fragment-ktx")
implementation("androidx.lifecycle:lifecycle-livedata-ktx")
implementation("com.squareup.retrofit2:converter-gson")

}

Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,17 @@
import in.digio.sdk.gateway.DigioActivity;
import in.digio.sdk.gateway.DigioConstants;
import in.digio.sdk.gateway.enums.DigioEnvironment;
import in.digio.sdk.gateway.enums.DigioServiceMode;
import in.digio.sdk.gateway.enums.DigioErrorCode;
import in.digio.sdk.gateway.model.DigioConfig;
import in.digio.sdk.gateway.model.DigioTheme;


@ReactModule(name = DigioReactNativeModule.NAME)
public class DigioReactNativeModule extends ReactContextBaseJavaModule implements LifecycleEventListener {
public static final String NAME = "DigioReactNative";

public static final String AAR_VERSION = "4.0.8";
public static final String AAR_VERSION = "5.0.1";
public static final int DIGIO_ACTIVITY = 73457843;
private Promise resultPromise;
private boolean isReceiverRegistered = false;
Expand All @@ -55,17 +57,19 @@ public class DigioReactNativeModule extends ReactContextBaseJavaModule implement

@Override
public void onReceive(Context context, Intent intent) {
if (intent.getStringExtra("data") != null) {
if (intent.getStringExtra("updateGatewayEvent") != null) {
// if (intent.getStringExtra("data") != null) {
JSONObject jsonObject = null;
try {
jsonObject = new JSONObject(
intent.getStringExtra(
"data"
)
// intent.getStringExtra("data")
intent.getStringExtra("updateGatewayEvent")
);
} catch (JSONException e) {
e.printStackTrace();
}
// Log.e("CheckResponse"," gatewayEvent "+jsonObject);

WritableMap resultMap = MapUtil.jsonToWritableMap(jsonObject);
getReactApplicationContext()
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
Expand All @@ -78,7 +82,8 @@ public void onReceive(Context context, Intent intent) {
@Override
public void onActivityResult(Activity activity, int requestCode, int resultCode, @Nullable Intent intent) {
if (requestCode == DIGIO_ACTIVITY) {
onNativeActivityResult(resultCode, intent);
int responseCode = intent.getIntExtra("responseCode", 0);
onNativeActivityResult(responseCode, intent);
}
}

Expand All @@ -92,16 +97,19 @@ private void onNativeActivityResult(int resultCode, Intent data) {
WritableMap resultMap = Arguments.createMap();
resultMap.putInt("code", resultCode);
if (data != null) {
// Log.e("CheckResponse"," resultCode "+resultCode+ " data "+data.getDataString());

resultMap.putString("message", data.getStringExtra("message"));
String screenName = data.getStringExtra("screen_name");
String screenName = data.getStringExtra("currentState");
// String screenName = data.getStringExtra("screen_name");
if (TextUtils.isEmpty(screenName)) {
screenName = "starting_digio";
}
resultMap.putString("screen", screenName);
resultMap.putString("step", data.getStringExtra("step"));
resultMap.putString("documentId", data.getStringExtra("document_id"));
resultMap.putString("failingUrl", data.getStringExtra("failing_url"));
resultMap.putInt("errorCode", data.getIntExtra("error_code", resultCode));
resultMap.putString("failingUrl", data.getStringExtra("failingUrl"));
resultMap.putInt("errorCode", data.getIntExtra("errorCode", resultCode));
String[] stringArrayExtra = data.getStringArrayExtra("permissions");
WritableArray permissionArray = Arguments.createArray();
if (stringArrayExtra != null && stringArrayExtra.length > 0) {
Expand Down Expand Up @@ -142,7 +150,7 @@ public void onHostResume() {
compatRegisterReceiver(this.getReactApplicationContext(), eventBroadcastReceiver, filter, true);
isReceiverRegistered = true;
}

}

@Override
Expand Down Expand Up @@ -174,14 +182,17 @@ private void compatRegisterReceiver(Context context, BroadcastReceiver receiver,
}
}

@ReactMethod
@ReactMethod
public void start(String documentId, String identifier, String tokenId, ReadableMap additionalData, ReadableMap config, Promise promise) {
this.resultPromise = promise;
try {
Intent intent = new Intent(this.getCurrentActivity(), DigioActivity.class);
// set everything under digioConfig
DigioConfig digioConfig = new DigioConfig();
String environment = config.getString("environment");
String logo = config.getString("logo");
String mode = config.getString("mode");
// Log.e("Digio_mode ", ""+mode);
if (!TextUtils.isEmpty(environment)) {
try {
digioConfig.setEnvironment(DigioEnvironment.valueOf(environment.toUpperCase(Locale.ENGLISH)));
Expand Down Expand Up @@ -217,17 +228,16 @@ public void start(String documentId, String identifier, String tokenId, Readable

digioConfig.setTheme(digioTheme);

intent.putExtra("config", digioConfig);
intent.putExtra("aar_version", AAR_VERSION);
if (documentId.startsWith("ENA") || documentId.startsWith("DID")) {
intent.putExtra("navigation_graph", in.digio.sdk.esign.R.navigation.esign);
} else {
intent.putExtra("navigation_graph", in.digio.sdk.kyc.R.navigation.workflow);
digioConfig.setAarVersion(AAR_VERSION);
if (!TextUtils.isEmpty(mode)) {
digioConfig.setServiceMode(DigioServiceMode.valueOf(mode.toUpperCase(Locale.ENGLISH)));
}

intent.putExtra("document_id", documentId);
intent.putExtra("customer_identifier", identifier);
intent.putExtra("token_id", tokenId);
digioConfig.setGToken(tokenId);
digioConfig.setRequestId(documentId);
digioConfig.setUserIdentifier(identifier);
digioConfig.setLinkApproach(false);

HashMap additionalDataMap = new HashMap();
if (additionalData != null) {
Iterator<Map.Entry<String, Object>> entryIterator = additionalData.getEntryIterator();
Expand All @@ -236,7 +246,9 @@ public void start(String documentId, String identifier, String tokenId, Readable
additionalDataMap.put(objectEntry.getKey(), objectEntry.getValue());
}
}
intent.putExtra("additional_data", additionalDataMap);
digioConfig.setAdditionalData(additionalDataMap);
intent.putExtra("config", digioConfig);

this.getCurrentActivity().startActivityForResult(intent, DIGIO_ACTIVITY);
} catch (Exception e) {
// Throws DigioException if WorkflowResponseListener is not implemented/passed, or
Expand Down
6 changes: 5 additions & 1 deletion example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,17 @@ android {
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
buildFeatures {
viewBinding true
dataBinding true
}
}

dependencies {
// The version of react-native is set by the React Native Gradle Plugin
implementation("com.facebook.react:react-android")
// implementation fileTree(dir: 'libs', include: ['*.aar'])
implementation 'com.github.digio-tech:gateway_kyc:v4.0.20'
// implementation 'com.github.digio-tech:gateway_kyc:v4.0.20'
implementation 'com.github.digio-tech:protean-esign:v3.2'
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
Expand Down
Loading
Loading