paytm business 改 otp 模式

This commit is contained in:
2026-03-11 22:48:39 +08:00
parent 8a104b3e7f
commit d94ebca61c
8 changed files with 560 additions and 9 deletions

23
App.tsx
View File

@@ -2,7 +2,6 @@ import React, { Component } from "react";
import { Alert, AppState, AppStateStatus, Modal, Text, TextInput, TouchableOpacity, View } from "react-native";
import DeviceInfo from 'react-native-device-info';
import {
PaytmBusinessBind,
PhonePeBusinessBind,
GooglePayBusinessBind,
WalletType,
@@ -33,6 +32,7 @@ import {
PayTmPersonalOTPBind,
PhonePePersonalOTPBind,
BharatPeBusinessOTPBind,
PaytmBusinessOTPBind,
} from './components/WalletBindComponents';
import Api from './services/api';
@@ -202,8 +202,8 @@ export default class App extends Component<AppProps, WalletmanAppState> {
handleUploadPaytmBusiness = async (result: PaytmBusinessBindResult) => {
try {
console.log(result);
await Api.instance.register(WalletType.PAYTM_BUSINESS, result);
this.setState({ showPaytmBusinessBind: false });
Alert.alert('绑定成功', 'Paytm Business 绑定成功');
} catch (error) {
Alert.alert('绑定失败', (error as Error).message);
this.setState({ showPaytmBusinessBind: false });
@@ -376,9 +376,24 @@ export default class App extends Component<AppProps, WalletmanAppState> {
renderPaytmBusinessBind = () => {
return (
<Modal visible transparent onRequestClose={() => this.setState({ showPaytmBusinessBind: false })}>
<PaytmBusinessBind
processString="Processing..."
<PaytmBusinessOTPBind
isDebug={true}
onRequestOTP={async (walletType, params) => {
try {
return await Api.instance.requestOTP(walletType, params.mobile, { password: params.password });
} catch (error) {
return { success: false, message: (error as Error).message };
}
}}
onVerifyOTP={async (walletType, params) => {
try {
return await Api.instance.verifyOTP(walletType, params.mobile, params.otp, {
sessionId: params.sessionId,
});
} catch (error) {
return { success: false, message: (error as Error).message };
}
}}
onSuccess={this.handleUploadPaytmBusiness}
onError={(error: string) => {
Alert.alert('绑定失败', error);