blusalt_identity

Dart CI

Blusalt Flutter package for accessing Blusalt Identity Verification Services

Developers Preview Status

The Package is a pre-release , all issues should be logged in Issues.

Usage

To use this plugin, add blusalt_identity_plugin as a dependency in your pubspec.yaml file.

Getting Started

  • Get an API key at blusalt.io/

  • Initialize the SDK in your app.

import 'package:blusalt_identity/network/blusalt_sdk.dart';
import 'package:blusalt_identity/network/network_client.dart';

// Initialize the SDK with your Credentials
ApiCredentials credentials = ApiCredentials(
    apiKey: MY_API_KEY,
    clientID: MY_CLIENT_ID, 
    appName: MY_APP_NAME
  );
  var future = BlusaltSDK.initializeSDK(credentials);
  future.then((onValue){
    print(onValue);
  })
  .catchError((onError){
   // print(onError);
  });

Sample Usage

import 'package:blusalt_identity/network/blusalt_sdk.dart';
import 'package:blusalt_identity/network/network_client.dart';
import 'package:blusalt_identity/verification_manager.dart' as manager;

/// Verify BVN
void verifyBVN(BuildContext context) {
  initProgressBar(context);
  _progressDialog.show();
  BVNRequest bvnRequest = BVNRequest(bvnNumber: "bvn", phoneNumber: "phone number");
  var response = manager.verifyBVN(bvnRequest);
  response.then((onValue) {
    var success = onValue as Success;
    print((success.value as BVNResponse).results.serviceType);
  }).catchError((onError) {
    _progressDialog.dismiss();
    print((onError as NetworkResponseError).message);
    //print("Error: ${(onError as BlusaltException).errorMessage()} ");
    // showToast(context, onError.toString());
  });
}

void verifyPVC(BuildContext context) {
  initProgressBar(context);
  _progressDialog.show();
  PVCRequest pvcRequest = PVCRequest(
      pvcNumber: "pvc number",
      phoneNumber: "phone number",
      lastName: "last_name",
      state: "lagos");
  Future<dynamic> future;
  var response = manager.verifyPVC(pvcRequest);
  response.then((onValue) {
    var success = onValue as Success;
    print((success.value as PVCResponse).results.serviceType);
  }).catchError((onError) {
    _progressDialog.dismiss();
    //print("Error: ${(onError as NetworkResponseError).message}");
    // showToast(context, onError.toString());
  });
}

void verifyNIN(BuildContext context) {
  initProgressBar(context);
  _progressDialog.show();
  NINRequest ninRequest =
      NINRequest(ninNumber: "nin", phoneNumber: "phone number");
  var response = manager.verifyNIN(ninRequest);
  response.then((onValue) {
    var success = onValue as Success;
    print((success.value as NINResponse).results.serviceType);
  }).catchError((onError) {
    _progressDialog.dismiss();
    print("Error: ${(onError as NetworkResponseError).code}");
    // showToast(context, onError.toString());
  });
}

void verifyNIP(BuildContext context) {
  initProgressBar(context);
  _progressDialog.show();
  NIPRequest nipRequest =
      NIPRequest(passportNumber: "doc number", phoneNumber: "phone number");
  var response = manager.verifyNIP(nipRequest);
  response.then((onValue) {
    var success = onValue as Success;
    print((success.value as NIPResponse).results.serviceType);
  }).catchError((onError) {
    print(onError);
    //_progressDialog.dismiss();
    //print(onError.runtimeType);
    // showToast(context, onError.toString());
  });
}

void verifyDL(BuildContext context) {
  initProgressBar(context);
  _progressDialog.show();
  DLRequest dlRequest = DLRequest(dlNumber: "dl_number", phoneNumber: "phone number");
  var response = manager.verifyDriversLicence(dlRequest);
  response.then((onValue) {
    var success = onValue as Success;
    print((success.value as NINResponse).results.serviceType);
  }).catchError((onError) {
    _progressDialog.dismiss();
  });
}


Libraries

blusalt_sdk
bvn_response
config
converter
dl_response
exception
initialization_response
network_client
nin_response
nip_response
pvc_response
request
response
services
verification_manager