diff --git a/App.tsx b/App.tsx index b302b7a..ea79e4f 100644 --- a/App.tsx +++ b/App.tsx @@ -45,13 +45,27 @@ interface AppProps { } interface WalletmanAppState { - showPaytmBusinessBind: boolean; + + /* Paytm Personal */ showPaytmPersonalBind: boolean; + paytmPersonalBindType: 'otpMode' | 'authMode'; + showPaytmBusinessBind: boolean; + + /* PhonePe Personal */ showPhonePePersonalBind: boolean; + phonePePersonalBindType: 'otpMode' | 'authMode'; showPhonePeBusinessBind: boolean; + + /* GooglePay Business */ showGooglePayBusinessBind: boolean; + + /* BharatPe Business */ showBharatPeBusinessBind: boolean; + + /* Mobikwik Personal */ showMobikwikPersonalBind: boolean; + + /* Freecharge Personal */ showFreechargePersonalBind: boolean; } @@ -67,7 +81,7 @@ const styles = StyleSheet.create({ backgroundColor: "lightblue", borderRadius: 5, width: 200, - height: 50, + height: 55, }, text: { fontSize: 20, @@ -84,17 +98,18 @@ const styles = StyleSheet.create({ alignItems: "center", }, bindButton: { - padding: 10, borderRadius: 5, - width: 250, - height: 40, + width: 350, + height: 50, justifyContent: "center", alignItems: "center", - margin: 10, + marginBottom : 10, }, bindButtonText: { fontSize: 15, fontWeight: "bold", + textAlign: "center", + textAlignVertical: "center", }, }); @@ -184,8 +199,10 @@ export default class App extends Component { constructor(props: AppProps) { super(props); this.state = { + paytmPersonalBindType: 'otpMode', showPaytmBusinessBind: false, showPaytmPersonalBind: false, + phonePePersonalBindType: 'otpMode', showPhonePeBusinessBind: false, showPhonePePersonalBind: false, showGooglePayBusinessBind: false, @@ -370,8 +387,8 @@ export default class App extends Component { }; /* 绑定 Paytm Personal */ - handlePaytmPersonalBind = () => { - this.setState({ showPaytmPersonalBind: true }); + handlePaytmPersonalBind = (type: 'otpMode' | 'authMode') => { + this.setState({ showPaytmPersonalBind: true ,paytmPersonalBindType: type}); } /* 上传 Paytm Personal 到服务器 */ @@ -442,8 +459,8 @@ export default class App extends Component { } /* 绑定 PhonePe Personal */ - handlePhonePePersonalBind = () => { - this.setState({ showPhonePePersonalBind: true }); + handlePhonePePersonalBind = (type: 'otpMode' | 'authMode') => { + this.setState({ showPhonePePersonalBind: true ,phonePePersonalBindType: type}); } /* 上传 PhonePe Personal 到服务器 */ @@ -524,6 +541,44 @@ export default class App extends Component { renderBindModal = () => { + /* 绑定 Paytm Personal */ + if (this.state.showPaytmPersonalBind) { + return ( + this.setState({ showPaytmPersonalBind: false })}> + { + try { + const response = await Api.instance.requestOTP(walletType, params.mobile, {}); + return response; + } catch (error) { + return { success: false, message: (error as Error).message }; + } + }} + onVerifyOTP={async (walletType: WalletType, params: any) => { + try { + const response = await Api.instance.verifyOTP(walletType, params.mobile, params.otp, { + sessionId: params.sessionId, // 只需要传 sessionId + }); + return response; + } catch (error) { + return { success: false, message: (error as Error).message }; + } + }} + onSuccess={(result: PaytmPersonalBindResult) => { + this.handleUploadPaytmPersonal(result); + }} + onError={(error) => { + console.log(error); + this.setState({ showPaytmPersonalBind: false }); + }} + /> + + ); + } + /* 绑定 PhonePe Personal */ if (this.state.showPhonePePersonalBind) { return ( @@ -531,7 +586,7 @@ export default class App extends Component { { try { const response = await Api.instance.requestOTP(walletType, params.mobile, {}); @@ -639,25 +694,6 @@ export default class App extends Component { ); } - /* 绑定 Paytm Personal */ - if (this.state.showPaytmPersonalBind) { - return ( - this.setState({ showPaytmPersonalBind: false })}> - { - this.handleUploadPaytmPersonal(result); - }} - onError={(error) => { - console.log(error); - this.setState({ showPaytmPersonalBind: false }); - }} - /> - - ); - } - /* 绑定 Mobikwik Personal */ if (this.state.showMobikwikPersonalBind) { return ( @@ -749,15 +785,25 @@ export default class App extends Component { return ( {this.renderBindModal()} - - 绑定 Paytm Personal - + + + 绑定 Paytm Personal(OTP) + + + 绑定 Paytm Personal(授权) + + 绑定 Paytm Business - - 绑定 PhonePe Personal - + + + 绑定 PhonePe Personal(OTP) + + + 绑定 PhonePe Personal(授权) + + 绑定 PhonePe Business diff --git a/libs/rnwalletman b/libs/rnwalletman index 00a0866..ad66622 160000 --- a/libs/rnwalletman +++ b/libs/rnwalletman @@ -1 +1 @@ -Subproject commit 00a0866c9464e8c1defa79d48f0412e1654c67a2 +Subproject commit ad666221617d441b948b8194013b41a932ef2960 diff --git a/servers/walletman b/servers/walletman index 134c37c..2bbe0eb 160000 --- a/servers/walletman +++ b/servers/walletman @@ -1 +1 @@ -Subproject commit 134c37cceb92121cc820146dae23769967411089 +Subproject commit 2bbe0eb87742ad64a6e2f0a7d6a5e3d5436f4925