内部直接封装 bhartpe business 的接码和转类型
This commit is contained in:
26
App.tsx
26
App.tsx
@@ -31,8 +31,6 @@ import {
|
||||
NotificationMessage,
|
||||
proxyBackgroundService,
|
||||
} from "rnwalletman";
|
||||
import BarcodeScanning from '@react-native-ml-kit/barcode-scanning';
|
||||
import RNFS from 'react-native-fs';
|
||||
|
||||
import {
|
||||
FreeChargeBind,
|
||||
@@ -161,18 +159,6 @@ export default class App extends Component<AppProps, WalletmanAppState> {
|
||||
}
|
||||
}
|
||||
|
||||
decodeQRFromUrl = async (url: string) => {
|
||||
const localPath = `${RNFS.CachesDirectoryPath}/temp_qr_${Date.now()}.jpg`;
|
||||
try {
|
||||
await RNFS.downloadFile({ fromUrl: url, toFile: localPath }).promise;
|
||||
const barcodes = await BarcodeScanning.scan(`file://${localPath}`);
|
||||
if (barcodes.length > 0) return barcodes[0].value;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
// Paytm Personal
|
||||
handleUploadPaytmPersonalToken = async (result: PaytmPersonalBindResult) => {
|
||||
try {
|
||||
@@ -239,17 +225,7 @@ export default class App extends Component<AppProps, WalletmanAppState> {
|
||||
handleUploadBharatPeBusiness = async (result: BharatPeBusinessBindResult) => {
|
||||
try {
|
||||
console.log(result);
|
||||
const qrCode = await this.decodeQRFromUrl(result.qrUrl || '');
|
||||
console.log('qrCode:', qrCode);
|
||||
const response = await Api.instance.register(WalletType.BHARATPE_BUSINESS, {
|
||||
cookie: result.cookie,
|
||||
accessToken: result.accessToken,
|
||||
merchantId: result.merchantId,
|
||||
userName: result.userName,
|
||||
email: result.email,
|
||||
mobile: result.mobile,
|
||||
qrCode: qrCode,
|
||||
});
|
||||
const response = await Api.instance.register(WalletType.BHARATPE_BUSINESS, result);
|
||||
console.log(response);
|
||||
this.setState({ showBharatPeBusinessBind: false });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user