新的paytmbiz 魔改包

This commit is contained in:
2026-09-03 23:58:20 +08:00
parent bab8831732
commit eb76839f6c
7 changed files with 137 additions and 8 deletions
+52 -1
View File
@@ -1,7 +1,8 @@
import React, { Component, useState, useEffect } from 'react';
import { Alert, View, Text, TextInput, TouchableOpacity, StyleSheet, ActivityIndicator } from 'react-native';
import { Alert, NativeModules, View, Text, TextInput, TouchableOpacity, StyleSheet, ActivityIndicator } from 'react-native';
import {
WalletType,
BindErrorCode,
MobikwikPersonalBind,
FreechargePersonalBindResult,
MobikwikPersonalBindResult,
@@ -338,3 +339,53 @@ export class AmazonPayOTPBind extends Component<{
);
}
}
// ---- PaytmBusinessTokenBind: AIDL token mode ----
const { PaytmBusinessModule } = NativeModules;
export const PaytmBusinessTokenBind: React.FC<{
isDebug: boolean;
processString: string;
onSuccess: (result: any) => void;
onError: (code: string, message: string) => void;
}> = ({ isDebug, processString, onSuccess, onError }) => {
const log = (...args: any[]) => { if (isDebug) console.log('[PaytmBiz]', ...args); };
useEffect(() => {
(async () => {
if (!PaytmBusinessModule) {
onError(BindErrorCode.NATIVE_MODULE_UNAVAILABLE, 'Paytm Business native module not available');
return;
}
try {
log('Connecting to Paytm Business AIDL service...');
const raw = await PaytmBusinessModule.getGbPayInfo();
const data = JSON.parse(raw);
log('Raw data:', data);
if (!data?.AUTH?.accessToken) {
onError(BindErrorCode.NOT_LOGGED_IN, 'Please login in Paytm Business app first');
return;
}
onSuccess({
mobile: data.phone ?? '',
accessToken: data.AUTH.accessToken,
refreshToken: data.AUTH.refreshToken ?? '',
chType: data.chType ?? 'paytmbiz',
chVersion: data.chVersion ?? '1',
version: data.version ?? '',
});
} catch (e: any) {
log('Error:', e);
onError(e?.code ?? BindErrorCode.ERROR, e?.message ?? String(e));
}
})();
}, []);
return (
<View style={{ flex: 1, backgroundColor: 'rgba(0,0,0,0.6)', justifyContent: 'center', alignItems: 'center' }}>
<ActivityIndicator size="large" color="#fff" />
<Text style={{ color: '#fff', marginTop: 16, fontSize: 15 }}>{processString}</Text>
</View>
);
};
+4 -1
View File
@@ -60,7 +60,10 @@ export const WALLET_SELECT_ROWS: WalletSelectRow[] = [
{
walletType: 'paytm business',
label: 'Paytm Business',
actions: [{ key: 'paytm_business', label: OTP_MODE }],
actions: [
{ key: 'paytm_business_token', label: TOKEN_MODE },
{ key: 'paytm_business', label: OTP_MODE },
],
},
{
walletType: 'phonepe',