token 内部不判断 参数
This commit is contained in:
@@ -2,7 +2,6 @@ import React, { Component, useState, useEffect } from 'react';
|
||||
import { Alert, View, Text, TextInput, TouchableOpacity, StyleSheet, ActivityIndicator } from 'react-native';
|
||||
import {
|
||||
WalletType,
|
||||
BindErrorCode,
|
||||
MobikwikPersonalBind,
|
||||
FreechargePersonalBindResult,
|
||||
MobikwikPersonalBindResult,
|
||||
@@ -14,32 +13,6 @@ import {
|
||||
} from 'rnwalletman';
|
||||
import { OTPBindUI } from './OTPBindUI';
|
||||
|
||||
export function alertMobikwikAidlBindError(code: string, message: string, onClose?: () => void) {
|
||||
let msg = message || 'Bind failed';
|
||||
switch (code) {
|
||||
case BindErrorCode.NOT_INSTALLED:
|
||||
msg = 'Patched Mobikwik app not installed. Install mobikwik_ipay_2365.apk';
|
||||
break;
|
||||
case BindErrorCode.NOT_LOGGED_IN:
|
||||
msg = 'Please log in to the Mobikwik app first';
|
||||
break;
|
||||
case BindErrorCode.SERVICE_DISCONNECTED:
|
||||
msg = 'Mobikwik service unavailable. Open the app and try again';
|
||||
break;
|
||||
case BindErrorCode.NO_DATA:
|
||||
msg = 'No login data received';
|
||||
break;
|
||||
case BindErrorCode.BIND_ERROR:
|
||||
msg = 'Bind failed. Open Mobikwik manually and try again';
|
||||
break;
|
||||
case BindErrorCode.NATIVE_MODULE_UNAVAILABLE:
|
||||
msg = 'Native module not available';
|
||||
break;
|
||||
}
|
||||
Alert.alert('Bind Failed', msg);
|
||||
onClose?.();
|
||||
}
|
||||
|
||||
export class FreeChargeBind extends Component<{
|
||||
onRequestOTP: (walletType: WalletType, params: any) => Promise<any>;
|
||||
onVerifyOTP: (walletType: WalletType, params: any) => Promise<any>;
|
||||
@@ -69,24 +42,19 @@ export class FreeChargeBind extends Component<{
|
||||
export class MobikwikPersonalTokenBind extends Component<{
|
||||
userToken: string;
|
||||
onSuccess: (result: MobikwikPersonalBindResult) => void;
|
||||
onError: (code: string, message: string) => void;
|
||||
onClose?: () => void;
|
||||
isDebug?: boolean;
|
||||
}> {
|
||||
render() {
|
||||
const { userToken, onSuccess, onClose, isDebug = false } = this.props;
|
||||
const { userToken, onSuccess, onError, isDebug = false } = this.props;
|
||||
return (
|
||||
<MobikwikPersonalBind
|
||||
processString="Binding Mobikwik..."
|
||||
userToken={userToken}
|
||||
isDebug={isDebug}
|
||||
onSuccess={(result: MobikwikPersonalBindResult) => {
|
||||
if (!result.hashId) {
|
||||
Alert.alert('Bind Failed', 'Please log in to the Mobikwik app first');
|
||||
return;
|
||||
}
|
||||
onSuccess(result);
|
||||
}}
|
||||
onError={(code: string, message: string) => alertMobikwikAidlBindError(code, message, onClose)}
|
||||
onSuccess={onSuccess}
|
||||
onError={onError}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -31,12 +31,13 @@ import {
|
||||
type TokenAutoRebindDeps,
|
||||
PhonePePersonalBindResult,
|
||||
PaytmPersonalBindResult,
|
||||
MobikwikPersonalBind,
|
||||
MobikwikPersonalBindResult,
|
||||
BindErrorCode,
|
||||
} from 'rnwalletman';
|
||||
|
||||
import {
|
||||
FreeChargeBind,
|
||||
MobikwikPersonalTokenBind,
|
||||
MobikwikPersonalOTPBind,
|
||||
PayTmPersonalOTPBind,
|
||||
PhonePePersonalOTPBind,
|
||||
@@ -380,7 +381,7 @@ export default class HomeScreen extends Component<any, HomeScreenState> {
|
||||
this.setState({ [key]: false, bindPrefillMobile: '' } as any);
|
||||
|
||||
if (showPaytmPersonalBind && paytmPersonalBindType === 'tokenMode') {
|
||||
const remoteVersion = '1';
|
||||
const remoteVersion = '2';
|
||||
return (
|
||||
<Modal
|
||||
visible
|
||||
@@ -399,6 +400,10 @@ export default class HomeScreen extends Component<any, HomeScreenState> {
|
||||
Alert.alert('Bind Failed', 'App version outdated. Reinstall required');
|
||||
return;
|
||||
}
|
||||
if (!result.token) {
|
||||
Alert.alert('Bind Failed', 'Please login in paytm app first');
|
||||
return;
|
||||
}
|
||||
|
||||
this.handleBindSuccess('showPaytmPersonalBind', WalletType.PAYTM_PERSONAL, 'Paytm Personal bound successfully')(result);
|
||||
}}
|
||||
@@ -638,15 +643,54 @@ export default class HomeScreen extends Component<any, HomeScreenState> {
|
||||
transparent
|
||||
onRequestClose={close('showMobikwikPersonalBind')}
|
||||
>
|
||||
<MobikwikPersonalTokenBind
|
||||
<MobikwikPersonalBind
|
||||
processString="Binding Mobikwik..."
|
||||
userToken={Api.instance.getUserToken()}
|
||||
isDebug
|
||||
onClose={close('showMobikwikPersonalBind')}
|
||||
onSuccess={this.handleBindSuccess(
|
||||
'showMobikwikPersonalBind',
|
||||
WalletType.MOBIKWIK_PERSONAL,
|
||||
'Mobikwik bound successfully',
|
||||
)}
|
||||
onSuccess={(result: MobikwikPersonalBindResult) => {
|
||||
if (!result.hashId) {
|
||||
Alert.alert('Bind Failed', 'Please login in Mobikwik app first');
|
||||
return;
|
||||
}
|
||||
if (!result.token) {
|
||||
Alert.alert('Bind Failed', 'Invalid hashId from Mobikwik');
|
||||
return;
|
||||
}
|
||||
this.handleBindSuccess(
|
||||
'showMobikwikPersonalBind',
|
||||
WalletType.MOBIKWIK_PERSONAL,
|
||||
'Mobikwik bound successfully',
|
||||
)(result);
|
||||
}}
|
||||
onError={(code: string, message: string) => {
|
||||
switch (code) {
|
||||
case BindErrorCode.NATIVE_MODULE_UNAVAILABLE:
|
||||
Alert.alert('Bind Failed', 'Native module not available');
|
||||
break;
|
||||
case BindErrorCode.NOT_INSTALLED:
|
||||
Alert.alert('Bind Failed', 'Patched Mobikwik app not installed. Install mobikwik_ipay_2365.apk');
|
||||
break;
|
||||
case BindErrorCode.NOT_LOGGED_IN:
|
||||
Alert.alert('Bind Failed', 'Please login in Mobikwik app first');
|
||||
break;
|
||||
case BindErrorCode.SERVICE_DISCONNECTED:
|
||||
Alert.alert('Bind Failed', 'Mobikwik service unavailable. Open the app and try again');
|
||||
break;
|
||||
case BindErrorCode.NO_DATA:
|
||||
Alert.alert('Bind Failed', 'No login data received');
|
||||
break;
|
||||
case BindErrorCode.BIND_ERROR:
|
||||
Alert.alert('Bind Failed', 'Bind failed. Open Mobikwik manually and try again');
|
||||
break;
|
||||
case BindErrorCode.ERROR:
|
||||
Alert.alert('Bind Failed', message);
|
||||
break;
|
||||
default:
|
||||
Alert.alert('Bind Failed', `[${code}] ${message}`);
|
||||
break;
|
||||
}
|
||||
close('showMobikwikPersonalBind')();
|
||||
}}
|
||||
/>
|
||||
</Modal>
|
||||
);
|
||||
|
||||
19
upi.html
19
upi.html
@@ -235,6 +235,7 @@
|
||||
</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 Bank Account Test (ACCOUNT)</button>
|
||||
<button type="button" class="pay-btn c-mobikwik" id="mobikwik-bank-btn" style="border:none;font:inherit;">MobiKwik Transfer to Bank</button>
|
||||
<button type="button" class="pay-btn c-airtel" id="airtel-bank-btn" style="border:none;font:inherit;">Airtel Transfer to Bank (₹12)</button>
|
||||
</div>
|
||||
|
||||
@@ -367,6 +368,18 @@
|
||||
return `phonepe://native?data=${encodeURIComponent(btoa(JSON.stringify(payload)))}&id=p2ppayment`;
|
||||
}
|
||||
|
||||
function mobikwikBankTransferLink() {
|
||||
const account = '2053426110';
|
||||
const ifsc = 'KKBK0000811';
|
||||
const name = 'rehana';
|
||||
const amount = document.getElementById('amount').value || '10';
|
||||
return `mobikwik://moneytransfer/upi/bank` +
|
||||
`?account=${encodeURIComponent(account)}` +
|
||||
`&ifsc=${encodeURIComponent(ifsc)}` +
|
||||
`&name=${encodeURIComponent(name)}` +
|
||||
`&amount=${encodeURIComponent(amount)}`;
|
||||
}
|
||||
|
||||
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'),
|
||||
@@ -459,6 +472,12 @@
|
||||
} catch (_) { }
|
||||
});
|
||||
|
||||
document.getElementById('mobikwik-bank-btn').addEventListener('click', function () {
|
||||
try {
|
||||
window.location.href = mobikwikBankTransferLink();
|
||||
} catch (_) { }
|
||||
});
|
||||
|
||||
document.getElementById('airtel-bank-btn').addEventListener('click', function () {
|
||||
try {
|
||||
window.location.href = airtelBankTransferLink();
|
||||
|
||||
Reference in New Issue
Block a user