You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
144 lines
4.7 KiB
Dart
144 lines
4.7 KiB
Dart
/// Shared response model for both fingerprint authentication endpoints:
|
|
/// - [POST api/Fingerprint/authenticate] (National ID flow)
|
|
/// - [POST api/Fingerprint/authenticate-passport] (Passport flow)
|
|
///
|
|
/// Both APIs return the same JSON shape.
|
|
class FingerprintVerifyResponseModel {
|
|
final bool success;
|
|
final String message;
|
|
final FingerprintVerifyData? data;
|
|
final List<String> errors;
|
|
|
|
const FingerprintVerifyResponseModel({
|
|
required this.success,
|
|
required this.message,
|
|
this.data,
|
|
this.errors = const [],
|
|
});
|
|
|
|
factory FingerprintVerifyResponseModel.fromJson(Map<String, dynamic> json) {
|
|
return FingerprintVerifyResponseModel(
|
|
success: json['success'] as bool? ?? false,
|
|
message: json['message'] as String? ?? '',
|
|
data: json['data'] != null
|
|
? FingerprintVerifyData.fromJson(
|
|
json['data'] as Map<String, dynamic>)
|
|
: null,
|
|
errors: (json['errors'] as List<dynamic>?)
|
|
?.map((e) => e.toString())
|
|
.toList() ??
|
|
const [],
|
|
);
|
|
}
|
|
}
|
|
|
|
/// The [data] payload inside [FingerprintVerifyResponseModel].
|
|
class FingerprintVerifyData {
|
|
final bool matchFlag;
|
|
final FingerprintPersonInfo? personInfo;
|
|
|
|
// ── Error / status fields returned directly in data ─────────────────────
|
|
final int? errorCode;
|
|
final String errorType;
|
|
final String errorDetail;
|
|
final String errorMessage;
|
|
final int? statusCode;
|
|
final bool isError;
|
|
final String? rawResponseBody;
|
|
final String? responseReceivedAt;
|
|
|
|
const FingerprintVerifyData({
|
|
required this.matchFlag,
|
|
this.personInfo,
|
|
this.errorCode,
|
|
this.errorType = '',
|
|
this.errorDetail = '',
|
|
this.errorMessage = '',
|
|
this.statusCode,
|
|
this.isError = false,
|
|
this.rawResponseBody,
|
|
this.responseReceivedAt,
|
|
});
|
|
|
|
factory FingerprintVerifyData.fromJson(Map<String, dynamic> json) {
|
|
return FingerprintVerifyData(
|
|
matchFlag: json['matchFlag'] as bool? ?? false,
|
|
personInfo: json['personInfo'] != null
|
|
? FingerprintPersonInfo.fromJson(
|
|
json['personInfo'] as Map<String, dynamic>)
|
|
: null,
|
|
errorCode: json['errorCode'] as int?,
|
|
errorType: json['errorType'] as String? ?? '',
|
|
errorDetail: json['errorDetail'] as String? ?? '',
|
|
errorMessage: json['errorMessage'] as String? ?? '',
|
|
statusCode: json['statusCode'] as int?,
|
|
isError: json['isError'] as bool? ?? false,
|
|
rawResponseBody: json['rawResponseBody'] as String?,
|
|
responseReceivedAt: json['responseReceivedAt'] as String?,
|
|
);
|
|
}
|
|
}
|
|
|
|
/// Person information returned inside [FingerprintVerifyData].
|
|
class FingerprintPersonInfo {
|
|
final String id;
|
|
final String firstNameT;
|
|
final String firstName;
|
|
final String fatherName;
|
|
final String fatherNameT;
|
|
final String grandFatherName;
|
|
final String grandFatherNameT;
|
|
final String familyName;
|
|
final String familyNameT;
|
|
final String? birthDateG;
|
|
final String sexCode;
|
|
final String occupationDescAr;
|
|
final String occupationDescEn;
|
|
final String occupationCode;
|
|
final String nationalityCode;
|
|
final String sponsorName;
|
|
final String sponsorNameT;
|
|
|
|
const FingerprintPersonInfo({
|
|
this.id = '',
|
|
this.firstNameT = '',
|
|
this.firstName = '',
|
|
this.fatherName = '',
|
|
this.fatherNameT = '',
|
|
this.grandFatherName = '',
|
|
this.grandFatherNameT = '',
|
|
this.familyName = '',
|
|
this.familyNameT = '',
|
|
this.birthDateG,
|
|
this.sexCode = '',
|
|
this.occupationDescAr = '',
|
|
this.occupationDescEn = '',
|
|
this.occupationCode = '',
|
|
this.nationalityCode = '',
|
|
this.sponsorName = '',
|
|
this.sponsorNameT = '',
|
|
});
|
|
|
|
factory FingerprintPersonInfo.fromJson(Map<String, dynamic> json) {
|
|
return FingerprintPersonInfo(
|
|
id: json['id'] as String? ?? '',
|
|
firstNameT: json['firstNameT'] as String? ?? '',
|
|
firstName: json['firstName'] as String? ?? '',
|
|
fatherName: json['fatherName'] as String? ?? '',
|
|
fatherNameT: json['fatherNameT'] as String? ?? '',
|
|
grandFatherName: json['grandFatherName'] as String? ?? '',
|
|
grandFatherNameT: json['grandFatherNameT'] as String? ?? '',
|
|
familyName: json['familyName'] as String? ?? '',
|
|
familyNameT: json['familyNameT'] as String? ?? '',
|
|
birthDateG: json['birthDateG'] as String?,
|
|
sexCode: json['sexCode'] as String? ?? '',
|
|
occupationDescAr: json['occupationDescAr'] as String? ?? '',
|
|
occupationDescEn: json['occupationDescEn'] as String? ?? '',
|
|
occupationCode: json['occupationCode'] as String? ?? '',
|
|
nationalityCode: json['nationalityCode'] as String? ?? '',
|
|
sponsorName: json['sponsorName'] as String? ?? '',
|
|
sponsorNameT: json['sponsorNameT'] as String? ?? '',
|
|
);
|
|
}
|
|
}
|