# digio kyc workflow plugin

Digio kyc workflow flutter plugin

# Getting Started

[Example flutter kyc workflow application](https://drive.google.com/file/d/1VTKjC1vm5pSs6H44wInHJmfDTBtzQ3_Y
)

## Android
* Digio SDK supports android version 5.0 and above (SDK level 21 above)

1. Add it to your root build.gradle at the end of repositories:

```allprojects {
allprojects {
  repositories {
     ...
     maven { url 'https://jitpack.io' }
  }
}
```
2. Add the dependency:
```
implementation 'com.github.digio-tech:gateway:v4.0.13'
implementation 'com.github.digio-tech:gateway_kyc:v4.0.20'
```



3. Check your app’s build.gradle file (android/apps/build.gradle) to confirm a declaration similar
   to the following (depending on the build configuration you’ve selected):

```

android {
    compileSdkVersion 32

    defaultConfig {
        minSdkVersion 21
    }
  
   buildTypes {
        release {
            signingConfig signingConfigs.debug
            minifyEnabled true
        }
        debug {
            signingConfig signingConfigs.debug
            minifyEnabled true
        }
    }
        
    buildFeatures {
        viewBinding true
        dataBinding true
    }
    
    dependencies {
        implementation 'com.github.digio-tech:gateway:v4.0.13'
        implementation 'com.github.digio-tech:gateway_kyc:v4.0.20'
    
        implementation 'androidx.core:core:1.9.0'
        implementation 'androidx.appcompat:appcompat:1.5.1'
        implementation 'com.google.android.material:material:1.7.0'
        implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    
        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.camera:camera-core: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 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
        implementation 'com.google.android.gms:play-services-location:21.0.1'
    }
}
```


4. Module Build Gradle (android/build.gradle) has following

```
buildscript {
    ext.kotlin_version = '1.8.0'
    dependencies {
        classpath 'com.google.gms:google-services:4.3.14'
    }
}
```

Note: Kotlin plugin should be added at your project level inside build gradle

5. ### Add buildType relese and debug. You must add **minifyEnabled** as true
```
 buildTypes {

        release {
            // TODO: Add your own signing config for the release build.
            signingConfig signingConfigs.debug
            minifyEnabled true
        }
        debug {
            signingConfig signingConfigs.debug
            minifyEnabled true
        }
    }
```
Note: minifyEnabled should be added other wise application will not able to access camera.

6. Add required permissions in manifest file and run time.
```

<!-- RECORD_AUDIO and MODIFY_AUDIO_SETTINGS Permission required for Video KYC -->
   <uses-permission android:name="android.permission.RECORD_AUDIO" />
   <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />

/** Required for geo tagging */
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />


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

<uses-feature android:name="android.hardware.camera" android:required="true" />
<uses-feature android:name="android.hardware.camera.autofocus"   android:required="false" />

```
Refer android guide for android folder
[Android Guide](https://docs.google.com/document/d/155FtTQFdyWKlWf2IS5bkr2O7d8oA0ZTe9iswOsJ5ihg)

## IOS

In case of iOS, No need to put SDK. You can proceed with writting the code below.

DigioKycSDK requires permission mentioned below. Make sure to add these permissions in your app's
info.plist

```
<key>NSCameraUsageDescription</key>
<string>$(PRODUCT_NAME) would like to access your camera.</string>   
<key>NSPhotoLibraryUsageDescription</key> 
<string>$(PRODUCT_NAME) would like to access your photo.</string>   
<key>NSMicrophoneUsageDescription</key>
<string>$(PRODUCT_NAME) would like to access your microphone to capture video.</string>
<key>NSLocationWhenInUseUsageDescription</key> 
<string>$(PRODUCT_NAME) would like to access your location.</string> 
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>$(PRODUCT_NAME) would like to access your location.</string>
```

Refer ios guide for ios folder
[iOS Guide](https://docs.google.com/document/d/1hxOX_fORqSc-dVJj3gT3uw2QF3LV_HaRJTWroGvX-Qk)

* Digio SDK support for xcode 14.0 and above, Swift version 5.7

Also refer ios guide for ios folder setup :
[ios Guide](https://docs.google.com/document/d/1qaL75eXTiuvpFclaApk0S7R1_K-T4AgAZKrbG9N-ZJA/edit#heading=h.6pwhd0g8wzxq)

### Starting the digio kyc workflow

```
var digioConfig = DigioConfig();
digioConfig.theme.primaryColor = "#32a83a";
digioConfig.logo = "https://your_logo_url";
digioConfig.environment = Environment.SANDBOX;

final _kycWorkflowPlugin = KycWorkflow(digioConfig);
_kycWorkflowPlugin.setGatewayEventListener((GatewayEvent? gatewayEvent) {
    print("gateway event : " + gatewayEvent.toString());
});
workflowResult = await _kycWorkflowPlugin.start("KID23010416361850266BAKNKNORLP6W","abc@gmail.com","GWT230104163618520T2Y9IPUT2PBNC8",null);
print('workflowResult : ' + workflowResult.toString());
```

[Gateway Event Doc](https://docs.google.com/document/d/15LHtjGyXd_JNM0de8uH9zB7WllJikRl1d9e4qdy0-C0)
