diff --git a/screens/TestScreen.tsx b/screens/TestScreen.tsx index 6c31a22..d0410bc 100644 --- a/screens/TestScreen.tsx +++ b/screens/TestScreen.tsx @@ -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 | 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 = () => { diff --git a/upi.html b/upi.html index cdb2710..defa248 100644 --- a/upi.html +++ b/upi.html @@ -230,6 +230,7 @@ Pay Now +
@@ -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);