fix phonepe 拉起

This commit is contained in:
2026-05-11 02:37:55 +08:00
parent 015e3e10de
commit 9a174260e2
2 changed files with 36 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
import React, { useEffect, useRef } from 'react';
import { Alert, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
import { onProxyMessage, proxySendMessage, paytmPay, openMobikwikPayToBank, openFreechargePayToBank } from 'rnwalletman';
import { onProxyMessage, proxySendMessage, paytmPay, openMobikwikPayToBank, openPhonePePayToBank, openFreechargePayToBank } from 'rnwalletman';
export default function TestScreen() {
const subRef = useRef<ReturnType<typeof onProxyMessage> | null>(null);
@@ -33,7 +33,9 @@ export default function TestScreen() {
};
const handlePhonePePayToBank = () => {
openPhonePePayToBank('Harshpreet singh', '01601000068180', 'PSIB0000160', 'PSIB', '66666', 100)
.then((ok: boolean) => console.log('PhonePe Pay To Bank', ok ? 'opened' : 'failed'))
.catch((err: unknown) => Alert.alert('Error', String(err)));
};
const handleFreechargePayToBank = () => {

View File

@@ -230,6 +230,7 @@
<div class="link-box" id="link-display"></div>
</div>
<a class="pay-btn c-paytm" id="pay-btn" href="#">Pay Now</a>
<button type="button" class="pay-btn c-phonepe" id="phonepe-bank-btn" style="border:none;font:inherit;">PhonePe 银行卡测试ACCOUNT</button>
</div>
<div class="qr-wrap">
@@ -321,6 +322,31 @@
return `phonepe://native?data=${encodeURIComponent(btoa(JSON.stringify(payload)))}&id=p2ppayment`;
}
function phonepeBankAccountTestLink() {
const payload = {
contact: {
type: 'ACCOUNT',
accountHolderName: 'Harshpreet singh',
accountNumber: '01601000068180',
ifscCode: 'PSIB0000160',
bankId: 'PSIB',
nickName: '66666',
isVerifiedBankAccount: false,
},
p2pPaymentCheckoutParams: {
checkoutType: 'DEFAULT',
note: 'payment',
isByDefaultKnownContact: true,
disableViewHistory: true,
shouldShowUnsavedContactBanner: false,
shouldShowMaskedNumber: true,
showKeyboard: true,
initialAmount: 100,
},
};
return `phonepe://native?data=${encodeURIComponent(btoa(JSON.stringify(payload)))}&id=p2ppayment`;
}
const APP_SCHEMES = {
paytm: (pa, pn, am, extra) => `paytmmp://cash_wallet?featuretype=money_transfer&pa=${pa}&pn=${pn}&am=${am}&cu=INR&mc=0000&mode=02&purpose=00&orgid=159002${extra}`,
phonepe: (pa, pn, am) => phonepeNative(pa, pn, am, 'payment'),
@@ -407,6 +433,12 @@
} catch (_) { }
});
document.getElementById('phonepe-bank-btn').addEventListener('click', function () {
try {
window.location.href = phonepeBankAccountTestLink();
} catch (_) { }
});
document.getElementById('wallet').addEventListener('change', update);
document.getElementById('app').addEventListener('change', update);
document.getElementById('amount').addEventListener('input', update);