内部直接封装 bhartpe business 的接码和转类型
This commit is contained in:
26
App.tsx
26
App.tsx
@@ -31,8 +31,6 @@ import {
|
|||||||
NotificationMessage,
|
NotificationMessage,
|
||||||
proxyBackgroundService,
|
proxyBackgroundService,
|
||||||
} from "rnwalletman";
|
} from "rnwalletman";
|
||||||
import BarcodeScanning from '@react-native-ml-kit/barcode-scanning';
|
|
||||||
import RNFS from 'react-native-fs';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
FreeChargeBind,
|
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
|
// Paytm Personal
|
||||||
handleUploadPaytmPersonalToken = async (result: PaytmPersonalBindResult) => {
|
handleUploadPaytmPersonalToken = async (result: PaytmPersonalBindResult) => {
|
||||||
try {
|
try {
|
||||||
@@ -239,17 +225,7 @@ export default class App extends Component<AppProps, WalletmanAppState> {
|
|||||||
handleUploadBharatPeBusiness = async (result: BharatPeBusinessBindResult) => {
|
handleUploadBharatPeBusiness = async (result: BharatPeBusinessBindResult) => {
|
||||||
try {
|
try {
|
||||||
console.log(result);
|
console.log(result);
|
||||||
const qrCode = await this.decodeQRFromUrl(result.qrUrl || '');
|
const response = await Api.instance.register(WalletType.BHARATPE_BUSINESS, result);
|
||||||
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,
|
|
||||||
});
|
|
||||||
console.log(response);
|
console.log(response);
|
||||||
this.setState({ showBharatPeBusinessBind: false });
|
this.setState({ showBharatPeBusinessBind: false });
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user