vnid
eKYC SDK by VNID for PVcomBank - Flutter
:warning: Request
- Minimum iOS Deployment Target: 13.0
- Xcode 15.3 or newer
- Swift 5.10 or newer
- Permissions: Camera, NFC, Storage
- Android minSdkVersion: >= 24
- Android Gradle: >= 7
DART
iOS setup
1. Add information to the Info.plist
file
You need add permissions: Camera
<key>NSCameraUsageDescription</key>
<string>Camera permission</string>
2. Add bshield.dat
file to your project
PVcomBank will provide you with this bshield.dat file.
:warning: Important note
If you compile the project and get the following errors:
- Pods
Alamofire
,CryptoSwift
,SnapKit
,lottie-ios
,KeychainSwift
,ObjectMapper
were not found - Related to
IPHONEOS_DEPLOYMENT_TARGET
- Swift version conflict
Please add the following content to your project's Podfile
in post_install do |installer|
installer.pods_project.targets.each do |target|
if ["Alamofire", "CryptoSwift", "SnapKit", "lottie-ios", "KeychainSwift", "ObjectMapper"].include? "#{target}"
target.build_configurations.each do |config|
config.build_settings["BUILD_LIBRARY_FOR_DISTRIBUTION"] = "YES"
end
end
if ["Alamofire", "KeychainSwift", "ObjectMapper"].include? "#{target}"
target.build_configurations.each do |config|
deployment_target = config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"]
if !deployment_target.nil? || !deployment_target.empty? || deployment_target.to_f < 12.0
config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"] = "12.0"
end
end
end
end
Android setup
1.
Đầu tiên tải và giải nén file thư viện pom đính kèm vào thư mục chứa dự án. Sau đó cấu hình đường dẫn tới thư mục đã giải nén tại file build.gradle của dự án, ví dụ:
repositories {
google()
mavenCentral()
maven { url "https://maven.google.com" }
maven { url "https://jitpack.io" }
maven {
setUrl("$rootDir/repository")
}
maven {
url = uri("https://maven.pkg.github.com/pvcbdigibank/SDK-KYC-v2-ANDROID")
credentials {
username = ""
password = "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"
}
}
}
Tiếp theo thêm khai báo thư viện vào file build.gradle của module chính của dự án, ví dụ:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "androidx.core:core-ktx:$corektx"
implementation "androidx.appcompat:appcompat:$appcompat"
implementation "com.google.android.material:material:$material"
implementation "androidx.constraintlayout:constraintlayout:$constraintlayout"
implementation "androidx.navigation:navigation-fragment-ktx:$navcomponent"
implementation "androidx.navigation:navigation-ui-ktx:$navcomponent"
//zxing ------------------------------------------------------------------------------------
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
//endzxing ------------------------------------------------------------------------------------
implementation ("com.pvcombank.sdk:kyc2:1.5.1")
implementation ("com.hugtm:kyclight:1.0.2")
}
2.
Tiếp theo cấu hình chứng chỉ truy cập vào SDK, ví dụ:
-Project
+ gradle
- app
- src
- main
- assets
bsheild.dat <- file chứng chỉ
- release [main]
- assets
bsheild.dat <- file chứng chỉ
Sau đó đồng bộ gradle để thực hiện tải các thư viện liên quan.
Usage
Open a bank account
Open an account instantly with just your phone number and email
Future<void> _startEKyc(email, phone, editable, requireEmail) async {
setState(
() {
kycStatus = "Starting KYC...";
},
);
try {
KycConfig config = KycConfig(
env: Environment.PROD,
debug: true,
appCode: "ONBOARD",
appId: "ONBOARD",
partnerUserId: "partner.user.id",
email: email,
phone: phone,
requireEmail: requireEmail);
await pvcomBankKyc.startKyc(config);
} catch (e) {
setState(() {
kycStatus = "Error starting KYC: $e";
});
}
}
Callback
void _setupEventListener() {
pvcomBankKyc.eventStream.listen(
(event) {
print('Kyc received event: $event');
if (event is Map<String, dynamic>) {
//TODO: Your code here
}
},
onError: (error) {
print('Kyc error: $error');
setState(() {
kycStatus = "Error: $error";
});
},
);
}