diff --git a/components/WalletBindComponents.tsx b/components/WalletBindComponents.tsx index 30dcf91..3b6a9f3 100644 --- a/components/WalletBindComponents.tsx +++ b/components/WalletBindComponents.tsx @@ -339,3 +339,29 @@ export class AmazonPayOTPBind extends Component<{ ); } } + +export class AirtelPersonalOTPBind extends Component<{ + onRequestOTP: (walletType: WalletType, params: any) => Promise; + onVerifyOTP: (walletType: WalletType, params: any) => Promise; + onSuccess: (result: any) => void; + onError: (error: string) => void; + isDebug: boolean; + initialMobile?: string; +}> { + render() { + return ( + + ); + } +} diff --git a/components/WalletSelectModal.tsx b/components/WalletSelectModal.tsx index 0088337..849ae4f 100644 --- a/components/WalletSelectModal.tsx +++ b/components/WalletSelectModal.tsx @@ -31,6 +31,7 @@ export const WALLET_ICONS: Record = { mobikwik: require('../res/mobikwik.png'), freecharge: require('../res/freecharge.png'), amazonpay: require('../res/amazon.png'), + airtel: require('../res/airtel.png'), }; export const WALLET_TYPE_COLORS: Record = { @@ -43,6 +44,7 @@ export const WALLET_TYPE_COLORS: Record = { mobikwik: '#00bcd4', freecharge: '#ff5722', amazonpay: '#ff9900', + airtel: '#e40000', }; const TOKEN_MODE = 'Token Mode'; @@ -110,7 +112,12 @@ export const WALLET_SELECT_ROWS: WalletSelectRow[] = [ { walletType: 'amazonpay', label: 'Amazon Pay', - actions: [{ key: 'amazonpay_personal', label: TOKEN_MODE }], + actions: [{ key: 'amazonpay_personal', label: OTP_MODE }], + }, + { + walletType: 'airtel', + label: 'Airtel Personal', + actions: [{ key: 'airtel_personal', label: OTP_MODE }], }, ]; diff --git a/libs/rnwalletman b/libs/rnwalletman index 1ebf593..85aac56 160000 --- a/libs/rnwalletman +++ b/libs/rnwalletman @@ -1 +1 @@ -Subproject commit 1ebf593be4a5201a26bc908409a4eeac8636f25a +Subproject commit 85aac56b503807b57facc890fd74ecb02ac4c800 diff --git a/res/airtel.png b/res/airtel.png new file mode 100644 index 0000000..4b046d1 Binary files /dev/null and b/res/airtel.png differ diff --git a/screens/HomeScreen.tsx b/screens/HomeScreen.tsx index 99a6dd6..27f01c3 100644 --- a/screens/HomeScreen.tsx +++ b/screens/HomeScreen.tsx @@ -52,6 +52,7 @@ import { BharatPeBusinessOTPBind, PaytmBusinessOTPBind, PhonePeBusinessOTPBind, + AirtelPersonalOTPBind, } from '../components/WalletBindComponents'; import { WalletSelectModal, WALLET_ICONS, WALLET_TYPE_COLORS } from '../components/WalletSelectModal'; import { ServerSettingsModal } from '../components/ServerSettingsModal'; @@ -143,6 +144,8 @@ function getBindKeyForWallet(item: WalletItem): string | null { return otp ? 'freecharge_personal' : 'freecharge_personal_token'; case 'amazonpay': return 'amazonpay_personal'; + case 'airtel': + return 'airtel_personal'; default: return null; } @@ -165,6 +168,7 @@ interface HomeScreenState { mobikwikPersonalBindType: 'otpMode' | 'tokenMode'; showFreechargePersonalBind: boolean; showAmazonPayPersonalBind: boolean; + showAirtelPersonalBind: boolean; // proxy proxyStatus: 'idle' | 'connecting' | 'connected' | 'disconnected' | 'error'; proxyError?: string; @@ -217,6 +221,7 @@ export default class HomeScreen extends Component { showFreechargePersonalBind: false, freechargePersonalBindType: 'otpMode', showAmazonPayPersonalBind: false, + showAirtelPersonalBind: false, proxyStatus: 'idle', showServerSettings: false, settingsHost: '', @@ -525,6 +530,7 @@ export default class HomeScreen extends Component { showPaytmBusinessBind, paytmBusinessBindType, showPhonePeBusinessBind, phonePeBusinessBindType, showGooglePayBusinessBind, showBharatPeBusinessBind, showMobikwikPersonalBind, mobikwikPersonalBindType, showFreechargePersonalBind, freechargePersonalBindType, showAmazonPayPersonalBind, + showAirtelPersonalBind, bindPrefillMobile, } = this.state; @@ -946,6 +952,29 @@ export default class HomeScreen extends Component { ); } + if (showAirtelPersonalBind) { + return ( + + { + this._otpCardId = this._pendingCardId ?? newCardId(Api.instance.getUserId(), wt, p.mobile); + return this.wrapOtpCall(() => Api.instance.requestOTP(wt, p.mobile, {}, this._otpCardId)); + }} + onVerifyOTP={async (wt, p) => { + return this.wrapOtpCall(() => Api.instance.verifyOTP(wt, p.mobile, p.otp, { hashId: p.hashId }, this._otpCardId)); + }} + onSuccess={this.onOtpBindSuccess('showAirtelPersonalBind', 'Airtel bound successfully')} + onError={() => {}} + /> + + ); + } return null; }; @@ -1000,6 +1029,9 @@ export default class HomeScreen extends Component { case 'amazonpay_personal': this.setState({ showAmazonPayPersonalBind: true }); break; + case 'airtel_personal': + this.setState({ showAirtelPersonalBind: true }); + break; } }, 300); }; diff --git a/servers/walletman b/servers/walletman index dc1ef85..cbb69ab 160000 --- a/servers/walletman +++ b/servers/walletman @@ -1 +1 @@ -Subproject commit dc1ef85ee87a1bb3047edfacefcefca0ad8812dc +Subproject commit cbb69ab9ac283b4c09455e41f4337f77699f3a8f