var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/components/wallet/serve.ts
var serve_exports = {};
__export(serve_exports, {
  customer: () => customer,
  getWalletList: () => getWalletList,
  goOrder: () => goOrder,
  setRequest: () => setRequest,
  unbindList: () => unbindList
});
module.exports = __toCommonJS(serve_exports);
var import_utils = require("./../../utils/");
var import_utils2 = require("@pisell/utils");
var getWalletList = async (params) => {
  try {
    const { data } = await import_utils.request.getRequest().get(`/h5/machinecode/lowcode/list`, params);
    return data || { list: [], count: 0 };
  } catch (error) {
    console.error(import_utils2.locales.getText("page.wallet.log.getWalletListFailed"), error);
    return { list: [], count: 0 };
  }
};
var customer = async (params, errCallback) => {
  try {
    const { data } = await import_utils.request.getRequest().put(`/h5/voucher/bind/customer`, params);
    return data;
  } catch (error) {
    console.error(import_utils2.locales.getText("page.wallet.log.bindCustomerFailed"), error);
    errCallback();
    return null;
  }
};
var unbindList = async (params, errCallback) => {
  try {
    const { data } = await import_utils.request.getRequest().get(`/h5/machinecode/unbind/list`, params);
    if (Array.isArray(data)) {
      return data;
    } else {
      console.warn("[unbindList] " + import_utils2.locales.getText("page.wallet.log.unexpectedResponseFormat") + ":", data);
      errCallback();
      return null;
    }
  } catch (error) {
    console.error(import_utils2.locales.getText("page.wallet.log.getUnbindListFailed"), error);
    errCallback();
    return null;
  }
};
var goOrder = async (params) => {
  try {
    const { data } = await import_utils.request.getRequest().post(`/h5/store/order/add`, params);
    return data;
  } catch (error) {
    console.error(import_utils2.locales.getText("page.wallet.log.orderFailed"), error);
    throw error;
  }
};
var setRequest = (req) => {
  import_utils.request.setRequest(req);
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  customer,
  getWalletList,
  goOrder,
  setRequest,
  unbindList
});
