From eb76839f6cea4fdb9f9a44564193d05953a5415c Mon Sep 17 00:00:00 2001 From: TQCasey <494294315@qq.com> Date: Thu, 3 Sep 2026 23:58:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E7=9A=84paytmbiz=20=E9=AD=94=E6=94=B9?= =?UTF-8?q?=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- android/.idea/android.iml | 9 +++++ components/WalletBindComponents.tsx | 53 ++++++++++++++++++++++++++++- components/WalletSelectModal.tsx | 5 ++- config.json | 39 +++++++++++++++++++++ package.json | 2 +- screens/HomeScreen.tsx | 35 ++++++++++++++++--- servers/walletman | 2 +- 7 files changed, 137 insertions(+), 8 deletions(-) create mode 100644 android/.idea/android.iml create mode 100644 config.json diff --git a/android/.idea/android.iml b/android/.idea/android.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/android/.idea/android.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/components/WalletBindComponents.tsx b/components/WalletBindComponents.tsx index 923d1ea..f3b3162 100644 --- a/components/WalletBindComponents.tsx +++ b/components/WalletBindComponents.tsx @@ -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 ( + + + {processString} + + ); +}; diff --git a/components/WalletSelectModal.tsx b/components/WalletSelectModal.tsx index 95ee4f1..438c4cd 100644 --- a/components/WalletSelectModal.tsx +++ b/components/WalletSelectModal.tsx @@ -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', diff --git a/config.json b/config.json new file mode 100644 index 0000000..23ce40a --- /dev/null +++ b/config.json @@ -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" + ] + } + ] + } +} \ No newline at end of file diff --git a/package.json b/package.json index 5cbea30..4e34e90 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "react-native-svg": "^14.1.0", "react-native-svg-transformer": "^1.5.3", "react-native-webview": "13.6.2", - "rnwalletman": "./libs/rnwalletman" + "rnwalletman": "./libs/rnwalletman/" }, "devDependencies": { "@babel/core": "^7.20.0", diff --git a/screens/HomeScreen.tsx b/screens/HomeScreen.tsx index b2b65e4..1ab2c4a 100644 --- a/screens/HomeScreen.tsx +++ b/screens/HomeScreen.tsx @@ -49,6 +49,7 @@ import { PhonePePersonalOTPBind, BharatPeBusinessOTPBind, PaytmBusinessOTPBind, + PaytmBusinessTokenBind, PhonePeBusinessOTPBind, } from '../components/WalletBindComponents'; import { WalletSelectModal, WALLET_ICONS, WALLET_TYPE_COLORS } from '../components/WalletSelectModal'; @@ -128,7 +129,7 @@ function getBindKeyForWallet(item: WalletItem): string | null { case 'phonepe': return otp ? 'phonepe_personal_otp' : 'phonepe_personal_token'; case 'paytm business': - return 'paytm_business'; + return item.otpMode ? 'paytm_business' : 'paytm_business_token'; case 'phonepe business': return otp ? 'phonepe_business_otp' : 'phonepe_business_web'; case 'googlepay business': @@ -151,6 +152,7 @@ interface HomeScreenState { showPaytmPersonalBind: boolean; paytmPersonalBindType: 'otpMode' | 'tokenMode'; showPaytmBusinessBind: boolean; + paytmBusinessBindType: 'otpMode' | 'tokenMode'; showPhonePePersonalBind: boolean; phonePePersonalBindType: 'otpMode' | 'tokenMode'; showPhonePeBusinessBind: boolean; @@ -202,6 +204,7 @@ export default class HomeScreen extends Component { paytmPersonalBindType: 'otpMode', showPaytmPersonalBind: false, showPaytmBusinessBind: false, + paytmBusinessBindType: 'otpMode', showPhonePePersonalBind: false, phonePePersonalBindType: 'otpMode', showPhonePeBusinessBind: false, @@ -518,7 +521,7 @@ export default class HomeScreen extends Component { renderBindModal = () => { const { showPaytmPersonalBind, paytmPersonalBindType, showPhonePePersonalBind, phonePePersonalBindType, - showPaytmBusinessBind, showPhonePeBusinessBind, phonePeBusinessBindType, showGooglePayBusinessBind, showBharatPeBusinessBind, + showPaytmBusinessBind, paytmBusinessBindType, showPhonePeBusinessBind, phonePeBusinessBindType, showGooglePayBusinessBind, showBharatPeBusinessBind, showMobikwikPersonalBind, mobikwikPersonalBindType, showFreechargePersonalBind, freechargePersonalBindType, showAmazonPayPersonalBind, bindPrefillMobile, @@ -684,6 +687,27 @@ export default class HomeScreen extends Component { ); } + if (showPaytmBusinessBind && paytmBusinessBindType === 'tokenMode') { + return ( + + { + this.handleBindSuccess('showPaytmBusinessBind', WalletType.PAYTM_BUSINESS, 'Paytm Business bound successfully')(result); + }} + onError={(code, message) => { + Alert.alert('Bind Failed', message || code); + close('showPaytmBusinessBind')(); + }} + /> + + ); + } if (showPaytmBusinessBind) { return ( { { console.log('GooglePayBusinessBindResult', result); this.handleBindSuccess('showGooglePayBusinessBind', WalletType.GOOGLEPAY_BUSINESS, 'GooglePay Business bound successfully')(result); @@ -937,7 +961,10 @@ export default class HomeScreen extends Component { this.setState({ showPaytmPersonalBind: true, paytmPersonalBindType: 'tokenMode' }); break; 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; case 'phonepe_personal_otp': this.setState({ showPhonePePersonalBind: true, phonePePersonalBindType: 'otpMode' }); diff --git a/servers/walletman b/servers/walletman index 2462752..b33cfa8 160000 --- a/servers/walletman +++ b/servers/walletman @@ -1 +1 @@ -Subproject commit 2462752a30bdc59bd87e77bff482c5cee030a1cb +Subproject commit b33cfa8fd1debdd4b57d258b5bd49db847aaad9b