增加 amazon pay

This commit is contained in:
2026-05-27 12:30:52 +08:00
parent 38b89d240d
commit d7e16ee9c4
3 changed files with 64 additions and 0 deletions

View File

@@ -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);
};