Skip to content

Commit

Permalink
feat: new document type support (#1654)
Browse files Browse the repository at this point in the history
  • Loading branch information
Merculiar authored Dec 24, 2024
1 parent 5d29edd commit 969e65c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import 'package:kyc_client_dart/kyc_client_dart.dart';

enum DocumentType {
voterId('Voter ID', 'VOTER_ID');
voterId('Voter ID', 'VOTER_ID'),
ninV2('NIN_V2', 'NIN_V2');

const DocumentType(this.name, this.value);

Expand All @@ -12,12 +13,14 @@ enum DocumentType {
extension DocumentTypeExtension on DocumentType {
IdType toIdType() => switch (this) {
DocumentType.voterId => IdType.voterId,
DocumentType.ninV2 => IdType.ninV2,
};
}

extension IdTypeExtension on IdType {
DocumentType? toDocumentType() => switch (this) {
IdType.voterId => DocumentType.voterId,
IdType.ninV2 => DocumentType.ninV2,
// ignore: avoid-wildcard-cases-with-enums, check if needed
_ => null,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,3 @@ extension UserDataExtensions on UserData {
extension StringNullIfEmpty on String {
String? get nullIfEmpty => this.isEmpty ? null : this;
}

extension IdTypeExtension on IdType {
String get name => switch (this) {
IdType.voterId => 'Voter ID',
IdType.passport => 'Passport',
IdType.driverLicense => 'Driver License',
IdType.other => 'Other',
};
}
4 changes: 2 additions & 2 deletions packages/espressocash_app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1239,8 +1239,8 @@ packages:
dependency: "direct main"
description:
path: "."
ref: "67e55ba61a31e0debf26b14e7c7a057304d6de90"
resolved-ref: "67e55ba61a31e0debf26b14e7c7a057304d6de90"
ref: "1ed0206a55b3dc33b255a0164c6eefa4008b6d76"
resolved-ref: "1ed0206a55b3dc33b255a0164c6eefa4008b6d76"
url: "https://github.com/espresso-cash/kyc_client_dart.git"
source: git
version: "1.0.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/espressocash_app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ dependencies:
kyc_client_dart:
git:
url: https://github.com/espresso-cash/kyc_client_dart.git
ref: 67e55ba61a31e0debf26b14e7c7a057304d6de90
ref: 1ed0206a55b3dc33b255a0164c6eefa4008b6d76
logging: ^1.2.0
meta: ^1.10.0
mixpanel_flutter: ^2.2.0
Expand Down

0 comments on commit 969e65c

Please sign in to comment.