增加airtel钱包

This commit is contained in:
2026-09-08 01:35:01 +08:00
parent 9ad191ffc6
commit 3771faf12b
6 changed files with 68 additions and 3 deletions
+26
View File
@@ -339,3 +339,29 @@ export class AmazonPayOTPBind extends Component<{
);
}
}
export class AirtelPersonalOTPBind extends Component<{
onRequestOTP: (walletType: WalletType, params: any) => Promise<any>;
onVerifyOTP: (walletType: WalletType, params: any) => Promise<any>;
onSuccess: (result: any) => void;
onError: (error: string) => void;
isDebug: boolean;
initialMobile?: string;
}> {
render() {
return (
<OTPBindUI
walletType={WalletType.AIRTEL_PERSONAL}
title="Bind Airtel"
subtitle="4-digit OTP via Airtel web API"
otpLength={4}
onRequestOTP={this.props.onRequestOTP}
onVerifyOTP={this.props.onVerifyOTP}
onSuccess={this.props.onSuccess}
onError={this.props.onError}
isDebug={this.props.isDebug}
initialMobile={this.props.initialMobile}
/>
);
}
}
+8 -1
View File
@@ -31,6 +31,7 @@ export const WALLET_ICONS: Record<string, number> = {
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<string, string> = {
@@ -43,6 +44,7 @@ export const WALLET_TYPE_COLORS: Record<string, string> = {
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 }],
},
];
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

+32
View File
@@ -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<any, HomeScreenState> {
showFreechargePersonalBind: false,
freechargePersonalBindType: 'otpMode',
showAmazonPayPersonalBind: false,
showAirtelPersonalBind: false,
proxyStatus: 'idle',
showServerSettings: false,
settingsHost: '',
@@ -525,6 +530,7 @@ export default class HomeScreen extends Component<any, HomeScreenState> {
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<any, HomeScreenState> {
</Modal>
);
}
if (showAirtelPersonalBind) {
return (
<Modal
visible
transparent
onRequestClose={close('showAirtelPersonalBind')}
>
<AirtelPersonalOTPBind
isDebug
initialMobile={bindPrefillMobile}
onRequestOTP={async (wt, p) => {
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={() => {}}
/>
</Modal>
);
}
return null;
};
@@ -1000,6 +1029,9 @@ export default class HomeScreen extends Component<any, HomeScreenState> {
case 'amazonpay_personal':
this.setState({ showAmazonPayPersonalBind: true });
break;
case 'airtel_personal':
this.setState({ showAirtelPersonalBind: true });
break;
}
}, 300);
};