diff --git a/packages/espressocash_app/lib/features/kyc_sharing/data/kyc_repository.dart b/packages/espressocash_app/lib/features/kyc_sharing/data/kyc_repository.dart index cb1367e81..ec027c4e2 100644 --- a/packages/espressocash_app/lib/features/kyc_sharing/data/kyc_repository.dart +++ b/packages/espressocash_app/lib/features/kyc_sharing/data/kyc_repository.dart @@ -64,7 +64,9 @@ class KycRepository extends ChangeNotifier { return await _initWrapper( () => _getUserData(includeValues: includeValues), ); - } on Exception { + } on Exception catch (exception) { + reportError(exception); + return null; } } diff --git a/packages/espressocash_app/lib/features/kyc_sharing/utils/kyc_exception.dart b/packages/espressocash_app/lib/features/kyc_sharing/utils/kyc_exception.dart index b78aaa0b3..dd2b69310 100644 --- a/packages/espressocash_app/lib/features/kyc_sharing/utils/kyc_exception.dart +++ b/packages/espressocash_app/lib/features/kyc_sharing/utils/kyc_exception.dart @@ -11,6 +11,7 @@ sealed class KycException with _$KycException implements Exception { const factory KycException.invalidData() = KycInvalidData; const factory KycException.invalidToken() = KycInvalidToken; const factory KycException.genericError() = KycGenericError; + const factory KycException.phoneTooManyAttempts() = KycPhoneTooManyAttempts; } extension ErrorExt on Exception { @@ -29,6 +30,8 @@ extension ErrorExt on Exception { 'invalid phone' => const KycException.invalidPhone(), 'invalid code' => const KycException.invalidCode(), 'invalid data' => const KycException.invalidData(), + 'too many verification attempts' => + const KycException.phoneTooManyAttempts(), _ => const KycException.genericError(), }; } diff --git a/packages/espressocash_app/lib/features/kyc_sharing/widgets/extensions.dart b/packages/espressocash_app/lib/features/kyc_sharing/widgets/extensions.dart index 274452468..1d8c5b3d7 100644 --- a/packages/espressocash_app/lib/features/kyc_sharing/widgets/extensions.dart +++ b/packages/espressocash_app/lib/features/kyc_sharing/widgets/extensions.dart @@ -24,7 +24,13 @@ extension KycBuildContext on BuildContext { final message = switch (error) { KycInvalidEmail() => context.l10n.invalidEmail, - _ => context.l10n.failedToSendVerificationCode, + KycInvalidCode() || + KycInvalidData() || + KycInvalidToken() || + KycInvalidPhone() || + KycPhoneTooManyAttempts() || + KycGenericError() => + context.l10n.failedToSendVerificationCode, }; showCpErrorSnackbar(context, message: message); @@ -50,7 +56,13 @@ extension KycBuildContext on BuildContext { final message = switch (error) { KycInvalidPhone() => context.l10n.invalidPhone, - _ => context.l10n.failedToSendVerificationCode, + KycPhoneTooManyAttempts() => context.l10n.phoneTooManyAttempts, + KycInvalidCode() || + KycInvalidEmail() || + KycInvalidData() || + KycInvalidToken() || + KycGenericError() => + context.l10n.failedToSendVerificationCode, }; showCpErrorSnackbar(context, message: message); diff --git a/packages/espressocash_app/lib/l10n/intl_en.arb b/packages/espressocash_app/lib/l10n/intl_en.arb index 51458fedc..b56570c30 100644 --- a/packages/espressocash_app/lib/l10n/intl_en.arb +++ b/packages/espressocash_app/lib/l10n/intl_en.arb @@ -1203,7 +1203,9 @@ "pendingKycDialogTitle": "We’re still verifying your *identity.*", "@pendingKycDialogTitle": {}, "pendingKycDialogMessage": "Your identity verification is currently under review and will be completed shortly. You can check the Activity page for real-time updates on your verification status.", - "@pendingKycDialogMessage": {}, + "@pendingKycDialogMessage": {}, "continueVerification": "Continue Verification", - "@continueVerification": {} -} + "@continueVerification": {}, + "phoneTooManyAttempts": "Too many verification attempts. Please try again later", + "@phoneTooManyAttempts": {} +} \ No newline at end of file