performFacialVerification static method
Implementation
static Future<Map> performFacialVerification(
{required BuildContext context,
required String bvn,
required String appToken,
required String poweredBy,
required String assetLogo,
required int compressQualityiOS,
required String bearToken,
required int compressQualityandroid}) async {
try {
String path = await detectLiveness(
poweredBy: poweredBy,
assetLogo: assetLogo,
compressQualityiOS: compressQualityiOS,
compressQualityandroid: compressQualityandroid);
if (path.isEmpty) {
throw Exception("path is empty. user didn't take photo");
}
if (context.mounted) {
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) => const ProgressDialog(
status: 'Verifying...',
));
}
var response = await HttpHeler.uploadImage(
path,
'https://integrations.getravenbank.com/v1/image/match',
'image',
bvn.trim(),
bearToken,
);
if (response['status'] != 'success') {
// ignore: use_build_context_synchronously
Navigator.pop(context);
return response;
}
Map map = {
'token': appToken,
'fname': response['data']['first_name'],
'lname': response['data']['last_name'],
'bvn': bvn.trim(),
};
var responseConfirm = await HttpHeler.postRequest(map, 'update_business');
// ignore: use_build_context_synchronously
Navigator.pop(context);
return responseConfirm;
} catch (ex) {
throw Exception();
}
}