import axios from "../../utils/axios";
import { stringToUrl } from '@/common/js/utils';

// MQTT发送消息
export function sendMqttMessage(params) {
  return axios.post(`/SZWL-SERVER/purse/balance`, params);
}

// 获取余额
export function getBalance(params) {
  return axios.get(`/SZWL-SERVER/purse/balance?${stringToUrl(params)}`);
}

// 提现
export function withdraw(params) {
  return axios.post(`/SZWL-SERVER/purse/withdraw`, params);
}

// 提现记录
export function withdrawRecord(params) {
  return axios.post(`/SZWL-SERVER/purse/withdrawRecordList`, params);
}

// 导出提现记录
export function exportWithdrawRecord(params) {
  return axios.post(`/SZWL-SERVER/purse/exportWithdrawRecord`, params, { responseType: 'blob' });
}

// 查询提现状态
export function withdrawStatus(params) {
  return axios.get(`/SZWL-SERVER/purse/withdrawStatus?${stringToUrl(params)}`);
}

// 证照识别
export function idCardRecognition(params) {
  return axios.post(`/SZWL-SERVER/purse/ocrImage`, params);
}

// 汇聚获取商户信息
export function getJoinPayMch(params) {
  return axios.post(`/SZWL-SERVER/tJoinpayMch/getOne?${stringToUrl(params)}`, params);
}

// 汇聚入网
export function createMch(params) {
  return axios.post(`/SZWL-SERVER/tJoinpayMch/createMch`, params);
}

// 上传图片审核
export function uploadPhotos(params) {
  return axios.post(`/SZWL-SERVER/tJoinpayMch/uploadPhotos`, params);
}

// 汇聚更新图片审核情况
export function updateApproveStatus(params) {
  return axios.post(`/SZWL-SERVER/tJoinpayMch/updateApproveStatus`, params);
}

// 汇聚签约
export function altMchSign(params) {
  return axios.get(`/SZWL-SERVER/tJoinpayMch/altMchSign?${stringToUrl(params)}`);
}

// 查询证照
export function getPhotos(params) {
  return axios.get(`/SZWL-SERVER/purse/userLicense?${stringToUrl(params)}`);
}

// 汇聚更新商户认证状态
export function updateMchApproveStatus(params) {
  return axios.post(`/SZWL-SERVER/tJoinpayMch/updateMchApproveStatus`, params);
}

// 汇聚更新签约状态
export function updateMchSignStatus(params) {
  return axios.post(`/SZWL-SERVER/tJoinpayMch/updateMchSignStatus`, params);
}

// 汇聚切换结算方式
export function updateMchSettle(params) {
  return axios.post(`/SZWL-SERVER/tJoinpayMch/updateMchSettle`, params);
}

// 汇付获取商户信息
export function getHuifuMchCheck(params) {
  return axios.get(`/SZWL-SERVER/tHuifuMch/getHuifuMchCheck?${stringToUrl(params)}`);
}

// 汇付入网
export function createHuifuMch(params) {
  return axios.post(`/SZWL-SERVER/tHuifuMch/createMch`, params);
}

// 汇付签约
export function huifuMchSign(params) {
  return axios.get(`/SZWL-SERVER/tHuifuMch/signCon?${stringToUrl(params)}`);
}

// 汇付切换结算方式
export function updateSettlement(params) {
  return axios.post(`/SZWL-SERVER/tHuifuMch/updateSettlement`, params);
}
