From 77297a1eb2c000d10020b468c68fdd360214904b Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Sat, 5 Dec 2026 22:36:27 +0500 Subject: [PATCH] bml to fahipay support --- .../main/java/sh/sar/basedbank/util/AccountInputParser.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/java/sh/sar/basedbank/util/AccountInputParser.kt b/app/src/main/java/sh/sar/basedbank/util/AccountInputParser.kt index 6e326b1..7e434fc 100644 --- a/app/src/main/java/sh/sar/basedbank/util/AccountInputParser.kt +++ b/app/src/main/java/sh/sar/basedbank/util/AccountInputParser.kt @@ -5,6 +5,7 @@ object AccountInputParser { enum class InputType { MIB_ACCOUNT, // 17 digits starting with 9 BML_ACCOUNT, // 13 digits starting with 7 + FAHIPAY_ACCOUNT, // 12 digits starting with 5 PHONE, // 7 digits starting with 7 or 9 NATIONAL_ID, // A followed by 6 digits EMAIL, @@ -26,11 +27,16 @@ object AccountInputParser { return s } + fun isMibAccount(input: String) = detect(input) == InputType.MIB_ACCOUNT + fun isBmlAccount(input: String) = detect(input) == InputType.BML_ACCOUNT + fun isFahipayAccount(input: String) = detect(input) == InputType.FAHIPAY_ACCOUNT + fun detect(input: String): InputType { val s = input.trim() return when { s.matches(Regex("^9\\d{16}$")) -> InputType.MIB_ACCOUNT s.matches(Regex("^7\\d{12}$")) -> InputType.BML_ACCOUNT + s.matches(Regex("^5\\d{11}$")) -> InputType.FAHIPAY_ACCOUNT s.matches(Regex("^[79]\\d{6}$")) -> InputType.PHONE s.matches(Regex("^[Aa]\\d{6}$")) -> InputType.NATIONAL_ID s.contains("@") -> InputType.EMAIL