增加 amazon pay
This commit is contained in:
@@ -272,3 +272,28 @@ export class PhonePePersonalOTPBind extends Component<{
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class AmazonPayOTPBind 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.AMAZONPAY_PERSONAL}
|
||||
title="Amazon Pay 绑定"
|
||||
otpLength={6}
|
||||
onRequestOTP={this.props.onRequestOTP}
|
||||
onVerifyOTP={this.props.onVerifyOTP}
|
||||
onSuccess={this.props.onSuccess}
|
||||
onError={this.props.onError}
|
||||
isDebug={this.props.isDebug}
|
||||
initialMobile={this.props.initialMobile}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
BIN
res/amazon.png
Normal file
BIN
res/amazon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
@@ -48,6 +48,7 @@ import {
|
||||
BharatPeBusinessOTPBind,
|
||||
PaytmBusinessOTPBind,
|
||||
PhonePeBusinessOTPBind,
|
||||
AmazonPayOTPBind,
|
||||
} from '../components/WalletBindComponents';
|
||||
|
||||
import Api, {
|
||||
@@ -67,6 +68,7 @@ const WALLET_ICONS: Record<string, any> = {
|
||||
'bharatpe business': require('../res/bharatpe-business.webp'),
|
||||
mobikwik: require('../res/mobikwik.png'),
|
||||
freecharge: require('../res/freecharge.png'),
|
||||
amazonpay: require('../res/amazon.png'),
|
||||
};
|
||||
|
||||
const WALLET_TYPE_COLORS: Record<string, string> = {
|
||||
@@ -78,6 +80,7 @@ const WALLET_TYPE_COLORS: Record<string, string> = {
|
||||
'bharatpe business': '#e91e63',
|
||||
mobikwik: '#00bcd4',
|
||||
freecharge: '#ff5722',
|
||||
amazonpay: '#ff9900',
|
||||
};
|
||||
|
||||
// wallet type display info (walletType matches server)
|
||||
@@ -154,6 +157,12 @@ const WALLET_TYPE_OPTIONS = [
|
||||
label: 'Freecharge Personal (Token)',
|
||||
mode: 'token',
|
||||
},
|
||||
{
|
||||
key: 'amazonpay_personal',
|
||||
walletType: 'amazonpay',
|
||||
label: 'Amazon Pay (OTP)',
|
||||
mode: 'otp',
|
||||
},
|
||||
];
|
||||
|
||||
function formatWalletTypeLabel(walletType: string) {
|
||||
@@ -195,6 +204,8 @@ function getBindKeyForWallet(item: WalletItem): string | null {
|
||||
return 'mobikwik_personal';
|
||||
case 'freecharge':
|
||||
return otp ? 'freecharge_personal' : 'freecharge_personal_token';
|
||||
case 'amazonpay':
|
||||
return 'amazonpay_personal';
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
@@ -214,6 +225,7 @@ interface HomeScreenState {
|
||||
showBharatPeBusinessBind: boolean;
|
||||
showMobikwikPersonalBind: boolean;
|
||||
showFreechargePersonalBind: boolean;
|
||||
showAmazonPayPersonalBind: boolean;
|
||||
// proxy
|
||||
proxyStatus: 'idle' | 'connecting' | 'connected' | 'disconnected' | 'error';
|
||||
proxyError?: string;
|
||||
@@ -260,6 +272,7 @@ export default class HomeScreen extends Component<any, HomeScreenState> {
|
||||
showMobikwikPersonalBind: false,
|
||||
showFreechargePersonalBind: false,
|
||||
freechargePersonalBindType: 'otpMode',
|
||||
showAmazonPayPersonalBind: false,
|
||||
proxyStatus: 'idle',
|
||||
showServerSettings: false,
|
||||
settingsHost: '',
|
||||
@@ -442,6 +455,7 @@ export default class HomeScreen extends Component<any, HomeScreenState> {
|
||||
showPaytmPersonalBind, paytmPersonalBindType, showPhonePePersonalBind, phonePePersonalBindType,
|
||||
showPaytmBusinessBind, showPhonePeBusinessBind, phonePeBusinessBindType, showGooglePayBusinessBind, showBharatPeBusinessBind,
|
||||
showMobikwikPersonalBind, showFreechargePersonalBind, freechargePersonalBindType,
|
||||
showAmazonPayPersonalBind,
|
||||
bindPrefillMobile,
|
||||
} = this.state;
|
||||
|
||||
@@ -773,6 +787,28 @@ export default class HomeScreen extends Component<any, HomeScreenState> {
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
if (showAmazonPayPersonalBind) {
|
||||
return (
|
||||
<Modal
|
||||
visible
|
||||
transparent
|
||||
onRequestClose={close('showAmazonPayPersonalBind')}
|
||||
>
|
||||
<AmazonPayOTPBind
|
||||
isDebug
|
||||
initialMobile={bindPrefillMobile}
|
||||
onRequestOTP={async (wt, p) => {
|
||||
return this.wrapOtpCall(() => Api.instance.requestOTP(wt, p.mobile, {}));
|
||||
}}
|
||||
onVerifyOTP={async (wt, p) => {
|
||||
return this.wrapOtpCall(() => Api.instance.verifyOTP(wt, p.mobile, p.otp, { sessionId: p.sessionId }));
|
||||
}}
|
||||
onSuccess={this.onOtpBindSuccess('showAmazonPayPersonalBind', 'Amazon Pay bound successfully')}
|
||||
onError={() => {}}
|
||||
/>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
@@ -816,6 +852,9 @@ export default class HomeScreen extends Component<any, HomeScreenState> {
|
||||
case 'freecharge_personal_token':
|
||||
this.setState({ showFreechargePersonalBind: true, freechargePersonalBindType: 'tokenMode' });
|
||||
break;
|
||||
case 'amazonpay_personal':
|
||||
this.setState({ showAmazonPayPersonalBind: true });
|
||||
break;
|
||||
}
|
||||
}, 300);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user