增加airtel钱包
This commit is contained in:
@@ -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}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 }],
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
+1
-1
Submodule libs/rnwalletman updated: 1ebf593be4...85aac56b50
Binary file not shown.
|
After Width: | Height: | Size: 52 KiB |
@@ -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);
|
||||
};
|
||||
|
||||
+1
-1
Submodule servers/walletman updated: dc1ef85ee8...cbb69ab9ac
Reference in New Issue
Block a user