新的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
+9
View File
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
+52 -1
View File
@@ -1,7 +1,8 @@
import React, { Component, useState, useEffect } from 'react'; 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 { import {
WalletType, WalletType,
BindErrorCode,
MobikwikPersonalBind, MobikwikPersonalBind,
FreechargePersonalBindResult, FreechargePersonalBindResult,
MobikwikPersonalBindResult, 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', walletType: 'paytm business',
label: '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', walletType: 'phonepe',
+39
View File
@@ -0,0 +1,39 @@
{
"proxys": [
{
"name": "iproyal",
"open": 1,
"priority": 0,
"one": "...",
"list": []
},
{
"name": "1024proxy",
"open": 1,
"priority": 1,
"one": "...",
"list": []
}
],
"wallet_conf": {
"switch_vendor": true,
"fail_count_for_change_vendor": 3,
"try_first_vendor_keep_sec": 300,
"wallet_list": [
{
"name": "paytm",
"proxy_vendors": [
"iproyal",
"1024proxy"
]
},
{
"name": "phonepe",
"proxy_vendors": [
"1024proxy",
"iproyal"
]
}
]
}
}
+1 -1
View File
@@ -29,7 +29,7 @@
"react-native-svg": "^14.1.0", "react-native-svg": "^14.1.0",
"react-native-svg-transformer": "^1.5.3", "react-native-svg-transformer": "^1.5.3",
"react-native-webview": "13.6.2", "react-native-webview": "13.6.2",
"rnwalletman": "./libs/rnwalletman" "rnwalletman": "./libs/rnwalletman/"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.20.0", "@babel/core": "^7.20.0",
+31 -4
View File
@@ -49,6 +49,7 @@ import {
PhonePePersonalOTPBind, PhonePePersonalOTPBind,
BharatPeBusinessOTPBind, BharatPeBusinessOTPBind,
PaytmBusinessOTPBind, PaytmBusinessOTPBind,
PaytmBusinessTokenBind,
PhonePeBusinessOTPBind, PhonePeBusinessOTPBind,
} from '../components/WalletBindComponents'; } from '../components/WalletBindComponents';
import { WalletSelectModal, WALLET_ICONS, WALLET_TYPE_COLORS } from '../components/WalletSelectModal'; import { WalletSelectModal, WALLET_ICONS, WALLET_TYPE_COLORS } from '../components/WalletSelectModal';
@@ -128,7 +129,7 @@ function getBindKeyForWallet(item: WalletItem): string | null {
case 'phonepe': case 'phonepe':
return otp ? 'phonepe_personal_otp' : 'phonepe_personal_token'; return otp ? 'phonepe_personal_otp' : 'phonepe_personal_token';
case 'paytm business': case 'paytm business':
return 'paytm_business'; return item.otpMode ? 'paytm_business' : 'paytm_business_token';
case 'phonepe business': case 'phonepe business':
return otp ? 'phonepe_business_otp' : 'phonepe_business_web'; return otp ? 'phonepe_business_otp' : 'phonepe_business_web';
case 'googlepay business': case 'googlepay business':
@@ -151,6 +152,7 @@ interface HomeScreenState {
showPaytmPersonalBind: boolean; showPaytmPersonalBind: boolean;
paytmPersonalBindType: 'otpMode' | 'tokenMode'; paytmPersonalBindType: 'otpMode' | 'tokenMode';
showPaytmBusinessBind: boolean; showPaytmBusinessBind: boolean;
paytmBusinessBindType: 'otpMode' | 'tokenMode';
showPhonePePersonalBind: boolean; showPhonePePersonalBind: boolean;
phonePePersonalBindType: 'otpMode' | 'tokenMode'; phonePePersonalBindType: 'otpMode' | 'tokenMode';
showPhonePeBusinessBind: boolean; showPhonePeBusinessBind: boolean;
@@ -202,6 +204,7 @@ export default class HomeScreen extends Component<any, HomeScreenState> {
paytmPersonalBindType: 'otpMode', paytmPersonalBindType: 'otpMode',
showPaytmPersonalBind: false, showPaytmPersonalBind: false,
showPaytmBusinessBind: false, showPaytmBusinessBind: false,
paytmBusinessBindType: 'otpMode',
showPhonePePersonalBind: false, showPhonePePersonalBind: false,
phonePePersonalBindType: 'otpMode', phonePePersonalBindType: 'otpMode',
showPhonePeBusinessBind: false, showPhonePeBusinessBind: false,
@@ -518,7 +521,7 @@ export default class HomeScreen extends Component<any, HomeScreenState> {
renderBindModal = () => { renderBindModal = () => {
const { const {
showPaytmPersonalBind, paytmPersonalBindType, showPhonePePersonalBind, phonePePersonalBindType, showPaytmPersonalBind, paytmPersonalBindType, showPhonePePersonalBind, phonePePersonalBindType,
showPaytmBusinessBind, showPhonePeBusinessBind, phonePeBusinessBindType, showGooglePayBusinessBind, showBharatPeBusinessBind, showPaytmBusinessBind, paytmBusinessBindType, showPhonePeBusinessBind, phonePeBusinessBindType, showGooglePayBusinessBind, showBharatPeBusinessBind,
showMobikwikPersonalBind, mobikwikPersonalBindType, showFreechargePersonalBind, freechargePersonalBindType, showMobikwikPersonalBind, mobikwikPersonalBindType, showFreechargePersonalBind, freechargePersonalBindType,
showAmazonPayPersonalBind, showAmazonPayPersonalBind,
bindPrefillMobile, bindPrefillMobile,
@@ -684,6 +687,27 @@ export default class HomeScreen extends Component<any, HomeScreenState> {
</Modal> </Modal>
); );
} }
if (showPaytmBusinessBind && paytmBusinessBindType === 'tokenMode') {
return (
<Modal
visible
transparent
onRequestClose={close('showPaytmBusinessBind')}
>
<PaytmBusinessTokenBind
isDebug
processString="Connecting to Paytm Business..."
onSuccess={(result) => {
this.handleBindSuccess('showPaytmBusinessBind', WalletType.PAYTM_BUSINESS, 'Paytm Business bound successfully')(result);
}}
onError={(code, message) => {
Alert.alert('Bind Failed', message || code);
close('showPaytmBusinessBind')();
}}
/>
</Modal>
);
}
if (showPaytmBusinessBind) { if (showPaytmBusinessBind) {
return ( return (
<Modal <Modal
@@ -759,7 +783,7 @@ export default class HomeScreen extends Component<any, HomeScreenState> {
<GooglePayBusinessBind <GooglePayBusinessBind
processString="Processing..." processString="Processing..."
isDebug isDebug
showClearCacheButton={GOOGLEPAY_BUSINESS_SHOW_CLEAR_CACHE} clearCookie={GOOGLEPAY_BUSINESS_SHOW_CLEAR_CACHE}
onSuccess={(result: GooglePayBusinessBindResult) => { onSuccess={(result: GooglePayBusinessBindResult) => {
console.log('GooglePayBusinessBindResult', result); console.log('GooglePayBusinessBindResult', result);
this.handleBindSuccess('showGooglePayBusinessBind', WalletType.GOOGLEPAY_BUSINESS, 'GooglePay Business bound successfully')(result); this.handleBindSuccess('showGooglePayBusinessBind', WalletType.GOOGLEPAY_BUSINESS, 'GooglePay Business bound successfully')(result);
@@ -937,7 +961,10 @@ export default class HomeScreen extends Component<any, HomeScreenState> {
this.setState({ showPaytmPersonalBind: true, paytmPersonalBindType: 'tokenMode' }); this.setState({ showPaytmPersonalBind: true, paytmPersonalBindType: 'tokenMode' });
break; break;
case 'paytm_business': case 'paytm_business':
this.setState({ showPaytmBusinessBind: true }); this.setState({ showPaytmBusinessBind: true, paytmBusinessBindType: 'otpMode' });
break;
case 'paytm_business_token':
this.setState({ showPaytmBusinessBind: true, paytmBusinessBindType: 'tokenMode' });
break; break;
case 'phonepe_personal_otp': case 'phonepe_personal_otp':
this.setState({ showPhonePePersonalBind: true, phonePePersonalBindType: 'otpMode' }); this.setState({ showPhonePePersonalBind: true, phonePePersonalBindType: 'otpMode' });