This commit is contained in:
2026-01-26 12:02:53 +08:00
parent c6d22754ef
commit 5629c548e9
3 changed files with 23 additions and 4 deletions

23
App.tsx
View File

@@ -320,8 +320,7 @@ export default class App extends Component<AppProps, AppState> {
handleUploadPhonePePersonal = async (result: PhonePePersonalBindResult) => {
try {
console.log(JSON.stringify(result));
const response = await Api.instance.register(WalletType.PHONEPE_PERSONAL, result);
console.log(response);
Alert.alert('绑定成功', 'PhonePe Personal 绑定成功');
this.setState({ showPhonePePersonalBind: false });
} catch (error) {
Alert.alert('Bind PhonePe Personal Error', (error as Error).message || 'Unknown error');
@@ -402,11 +401,31 @@ export default class App extends Component<AppProps, AppState> {
<PhonePePersonalBind
processString="Processing PhonePe Personal..."
isDebug={true}
otpMode={true}
onRequestOTP={async (walletType: WalletType, params: any) => {
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: PhonePePersonalBindResult) => {
this.handleUploadPhonePePersonal(result);
}}
onError={(error: string) => {
console.log(error);
Alert.alert('绑定失败', error);
this.setState({ showPhonePePersonalBind: false });
}}
/>