import { buildTamRequestPayload, tamRequest, type TamRequestPayload, type TamResponse, } from '@/api/tam' type NetDebitEmptyBody = Record export type NetDebitSendPayload = TamRequestPayload export type NetDebitQueryPayload = TamRequestPayload export type NetDebitAdjustPayload = TamRequestPayload export type NetDebitSendResult = TamResponse export type NetDebitQueryResult = TamResponse export type NetDebitAdjustResult = TamResponse export type NetDebitAdjustType = 'INCR' | 'DECR' export type NetDebitAdjustForm = { /** 调整类型:INCR 调增,DECR 调减。 */ adjustType: NetDebitAdjustType /** 调整值,按页面输入的万元数值原样传递。 */ adjustVal: string } export type NetDebitQuotaDetail = { /** 净借记限额 */ availableDrAmt?: string /** 查询处理状态 */ busiStatus?: string /** 委托日期 */ consignDate?: string /** 授信额度 */ creditAmt?: string /** 可用净借记限额 */ currentAvailableDrAmt?: string /** 圈存资金 */ encloseAmt?: string /** 质押额度 */ impawnLimit?: string /** 报文标识号 */ msgRefNo?: string /** 被查询行行号 */ rcvBankCode?: string /** 平台流水号 */ refNo?: string /** 应答委托日期 */ responseDate?: string /** 应答报文序号 */ responseNo?: string /** 被查询清算行行号 */ settleBankCode?: string /** 业务处理状态 */ status?: string /** 发送交易返回的平台流水号,页面状态流转使用。 */ requestRefNo?: string } type NetDebitSendBody = { /** 平台流水号,后续查询交易 body.msgId 使用该值。 */ refNo?: string } type NetDebitQueryBody = { /** 发送交易返回的平台流水号。 */ msgId: string } type NetDebitAdjustBody = NetDebitAdjustForm type NetDebitAdjustResponseBody = { /** 调整交易返回的平台流水号。 */ refNo?: string } const SEND_TRAN_CODE = '/TAM/0001/140110003' const QUERY_TRAN_CODE = '/TAM/0001/140110004' const ADJUST_TRAN_CODE = '/TAM/0001/140110005' export function buildNetDebitSendPayload(): NetDebitSendPayload { return buildTamRequestPayload({ tranCode: SEND_TRAN_CODE, body: {}, }) } export async function sendNetDebitRequest( payload: NetDebitSendPayload, ): Promise { return tamRequest(payload) } export function buildNetDebitQueryPayload(msgId: string): NetDebitQueryPayload { return buildTamRequestPayload({ tranCode: QUERY_TRAN_CODE, body: { msgId, }, }) } export async function queryNetDebitQuota( payload: NetDebitQueryPayload, ): Promise { return tamRequest(payload) } export function buildNetDebitAdjustPayload(form: NetDebitAdjustForm): NetDebitAdjustPayload { return buildTamRequestPayload({ tranCode: ADJUST_TRAN_CODE, body: { adjustType: form.adjustType, adjustVal: form.adjustVal.trim(), }, }) } export async function adjustNetDebitLimit( payload: NetDebitAdjustPayload, ): Promise { return tamRequest(payload) }