| import { EnumOcrAccess } from '@12333/constants'; | 
| import * as accountServices from '@12333/services/api/Account'; | 
| import * as ocrUtilsServices from '@12333/services/apiV2/ocrUtils'; | 
| import { FileItem } from '@nutui/nutui-taro/dist/types/__VUE/uploader/type'; | 
| import _ from 'lodash'; | 
|   | 
| type VatLicenseOptions = { | 
|   onSuccess?: (res: API.LicenseOcrModel) => any; | 
| }; | 
|   | 
| export async function vatLicense(response: FileItem, options: VatLicenseOptions = {}) { | 
|   try { | 
|     if (response?.url) { | 
|       const { onSuccess } = options; | 
|       let res = await accountServices.vatLicense({ | 
|         url: response.url, | 
|       }); | 
|       onSuccess?.( | 
|         _.mapValues(res, (x) => { | 
|           if (x === '无') return ''; | 
|           return x; | 
|         }) | 
|       ); | 
|     } | 
|   } catch (error) {} | 
| } | 
|   | 
| type UserCredentialVerifyOcrIDCardOptions = { | 
|   access?: EnumOcrAccess; | 
|   scene?: string; | 
|   isOssUrl?: boolean; | 
|   response?: FileItem; | 
|   onSuccess?: (res: API.GetIdentityFrontOcrCommandResult) => any; | 
| }; | 
|   | 
| export async function userCredentialVerifyOcrIDCard( | 
|   options: UserCredentialVerifyOcrIDCardOptions = {} | 
| ) { | 
|   try { | 
|     const { onSuccess, access, isOssUrl, response, scene } = options; | 
|     if (response?.path) { | 
|       let res = await ocrUtilsServices.getIdentityFrontOcr({ | 
|         access: access, | 
|         url: response.path, | 
|         isOssUrl: isOssUrl, | 
|       }); | 
|       onSuccess?.(res); | 
|     } | 
|   } catch (error) {} | 
| } |