diff --git a/components/WalletBindComponents.tsx b/components/WalletBindComponents.tsx index b04c049..331a6ab 100644 --- a/components/WalletBindComponents.tsx +++ b/components/WalletBindComponents.tsx @@ -272,3 +272,28 @@ export class PhonePePersonalOTPBind extends Component<{ ); } } + +export class AmazonPayOTPBind 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/res/amazon.png b/res/amazon.png new file mode 100644 index 0000000..4a22084 Binary files /dev/null and b/res/amazon.png differ diff --git a/screens/HomeScreen.tsx b/screens/HomeScreen.tsx index b10e90d..6d90dd2 100644 --- a/screens/HomeScreen.tsx +++ b/screens/HomeScreen.tsx @@ -48,6 +48,7 @@ import { BharatPeBusinessOTPBind, PaytmBusinessOTPBind, PhonePeBusinessOTPBind, + AmazonPayOTPBind, } from '../components/WalletBindComponents'; import Api, { @@ -67,6 +68,7 @@ const WALLET_ICONS: Record = { '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 = { @@ -78,6 +80,7 @@ const WALLET_TYPE_COLORS: Record = { '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 { showMobikwikPersonalBind: false, showFreechargePersonalBind: false, freechargePersonalBindType: 'otpMode', + showAmazonPayPersonalBind: false, proxyStatus: 'idle', showServerSettings: false, settingsHost: '', @@ -442,6 +455,7 @@ export default class HomeScreen extends Component { 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 { ); } + if (showAmazonPayPersonalBind) { + return ( + + { + 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={() => {}} + /> + + ); + } return null; }; @@ -816,6 +852,9 @@ export default class HomeScreen extends Component { case 'freecharge_personal_token': this.setState({ showFreechargePersonalBind: true, freechargePersonalBindType: 'tokenMode' }); break; + case 'amazonpay_personal': + this.setState({ showAmazonPayPersonalBind: true }); + break; } }, 300); };