增加 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,
|
BharatPeBusinessOTPBind,
|
||||||
PaytmBusinessOTPBind,
|
PaytmBusinessOTPBind,
|
||||||
PhonePeBusinessOTPBind,
|
PhonePeBusinessOTPBind,
|
||||||
|
AmazonPayOTPBind,
|
||||||
} from '../components/WalletBindComponents';
|
} from '../components/WalletBindComponents';
|
||||||
|
|
||||||
import Api, {
|
import Api, {
|
||||||
@@ -67,6 +68,7 @@ const WALLET_ICONS: Record<string, any> = {
|
|||||||
'bharatpe business': require('../res/bharatpe-business.webp'),
|
'bharatpe business': require('../res/bharatpe-business.webp'),
|
||||||
mobikwik: require('../res/mobikwik.png'),
|
mobikwik: require('../res/mobikwik.png'),
|
||||||
freecharge: require('../res/freecharge.png'),
|
freecharge: require('../res/freecharge.png'),
|
||||||
|
amazonpay: require('../res/amazon.png'),
|
||||||
};
|
};
|
||||||
|
|
||||||
const WALLET_TYPE_COLORS: Record<string, string> = {
|
const WALLET_TYPE_COLORS: Record<string, string> = {
|
||||||
@@ -78,6 +80,7 @@ const WALLET_TYPE_COLORS: Record<string, string> = {
|
|||||||
'bharatpe business': '#e91e63',
|
'bharatpe business': '#e91e63',
|
||||||
mobikwik: '#00bcd4',
|
mobikwik: '#00bcd4',
|
||||||
freecharge: '#ff5722',
|
freecharge: '#ff5722',
|
||||||
|
amazonpay: '#ff9900',
|
||||||
};
|
};
|
||||||
|
|
||||||
// wallet type display info (walletType matches server)
|
// wallet type display info (walletType matches server)
|
||||||
@@ -154,6 +157,12 @@ const WALLET_TYPE_OPTIONS = [
|
|||||||
label: 'Freecharge Personal (Token)',
|
label: 'Freecharge Personal (Token)',
|
||||||
mode: 'token',
|
mode: 'token',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: 'amazonpay_personal',
|
||||||
|
walletType: 'amazonpay',
|
||||||
|
label: 'Amazon Pay (OTP)',
|
||||||
|
mode: 'otp',
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
function formatWalletTypeLabel(walletType: string) {
|
function formatWalletTypeLabel(walletType: string) {
|
||||||
@@ -195,6 +204,8 @@ function getBindKeyForWallet(item: WalletItem): string | null {
|
|||||||
return 'mobikwik_personal';
|
return 'mobikwik_personal';
|
||||||
case 'freecharge':
|
case 'freecharge':
|
||||||
return otp ? 'freecharge_personal' : 'freecharge_personal_token';
|
return otp ? 'freecharge_personal' : 'freecharge_personal_token';
|
||||||
|
case 'amazonpay':
|
||||||
|
return 'amazonpay_personal';
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -214,6 +225,7 @@ interface HomeScreenState {
|
|||||||
showBharatPeBusinessBind: boolean;
|
showBharatPeBusinessBind: boolean;
|
||||||
showMobikwikPersonalBind: boolean;
|
showMobikwikPersonalBind: boolean;
|
||||||
showFreechargePersonalBind: boolean;
|
showFreechargePersonalBind: boolean;
|
||||||
|
showAmazonPayPersonalBind: boolean;
|
||||||
// proxy
|
// proxy
|
||||||
proxyStatus: 'idle' | 'connecting' | 'connected' | 'disconnected' | 'error';
|
proxyStatus: 'idle' | 'connecting' | 'connected' | 'disconnected' | 'error';
|
||||||
proxyError?: string;
|
proxyError?: string;
|
||||||
@@ -260,6 +272,7 @@ export default class HomeScreen extends Component<any, HomeScreenState> {
|
|||||||
showMobikwikPersonalBind: false,
|
showMobikwikPersonalBind: false,
|
||||||
showFreechargePersonalBind: false,
|
showFreechargePersonalBind: false,
|
||||||
freechargePersonalBindType: 'otpMode',
|
freechargePersonalBindType: 'otpMode',
|
||||||
|
showAmazonPayPersonalBind: false,
|
||||||
proxyStatus: 'idle',
|
proxyStatus: 'idle',
|
||||||
showServerSettings: false,
|
showServerSettings: false,
|
||||||
settingsHost: '',
|
settingsHost: '',
|
||||||
@@ -442,6 +455,7 @@ export default class HomeScreen extends Component<any, HomeScreenState> {
|
|||||||
showPaytmPersonalBind, paytmPersonalBindType, showPhonePePersonalBind, phonePePersonalBindType,
|
showPaytmPersonalBind, paytmPersonalBindType, showPhonePePersonalBind, phonePePersonalBindType,
|
||||||
showPaytmBusinessBind, showPhonePeBusinessBind, phonePeBusinessBindType, showGooglePayBusinessBind, showBharatPeBusinessBind,
|
showPaytmBusinessBind, showPhonePeBusinessBind, phonePeBusinessBindType, showGooglePayBusinessBind, showBharatPeBusinessBind,
|
||||||
showMobikwikPersonalBind, showFreechargePersonalBind, freechargePersonalBindType,
|
showMobikwikPersonalBind, showFreechargePersonalBind, freechargePersonalBindType,
|
||||||
|
showAmazonPayPersonalBind,
|
||||||
bindPrefillMobile,
|
bindPrefillMobile,
|
||||||
} = this.state;
|
} = this.state;
|
||||||
|
|
||||||
@@ -773,6 +787,28 @@ export default class HomeScreen extends Component<any, HomeScreenState> {
|
|||||||
</Modal>
|
</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;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -816,6 +852,9 @@ export default class HomeScreen extends Component<any, HomeScreenState> {
|
|||||||
case 'freecharge_personal_token':
|
case 'freecharge_personal_token':
|
||||||
this.setState({ showFreechargePersonalBind: true, freechargePersonalBindType: 'tokenMode' });
|
this.setState({ showFreechargePersonalBind: true, freechargePersonalBindType: 'tokenMode' });
|
||||||
break;
|
break;
|
||||||
|
case 'amazonpay_personal':
|
||||||
|
this.setState({ showAmazonPayPersonalBind: true });
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}, 300);
|
}, 300);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user