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/pay/toC/serve.ts
var serve_exports = {};
__export(serve_exports, {
  getPaymentInit: () => getPaymentInit,
  getPaymentList: () => getPaymentList,
  getPaymentsAndWalletPass: () => getPaymentsAndWalletPass,
  getWalletNameAndPopupStatus: () => getWalletNameAndPopupStatus
});
module.exports = __toCommonJS(serve_exports);
var import_utils = require("../../../utils");
var import_status = require("./status");
var import_utils2 = require("@pisell/utils");
var getPaymentList = async (values) => {
  let paymentList = [];
  let { data } = await import_utils.request.getRequest().get("/h5/pay/order/payments", values);
  paymentList = (data || []).filter(
    (d) => import_status.paymentKeys.includes(d.service)
  );
  let arr = [];
  if ((0, import_utils2.isWx)()) {
    arr = arr.concat(["mw.google"]);
  }
  if (!(0, import_utils2.isWx)()) {
    arr = arr.concat(["globepay.wechat.jsapi", "superpay.wechat.h5"]);
  }
  if (!(0, import_utils2.isIOS)()) {
    arr = arr.concat(["mw.apple"]);
  }
  paymentList = paymentList.filter((d) => !arr.includes(d.service));
  if (paymentList.length === 0) {
    return {
      message: "component.Payment.toast.the-payment-function-is-not-enabled",
      status: "error"
    };
  }
  return {
    message: "",
    status: "ready",
    paymentList
  };
};
var getPaymentsAndWalletPass = async (values) => {
  let { data } = await import_utils.request.getRequest().get("/h5/pay/order/payments-and-walletpass", values);
  const walletPass = (data.payment_list || []).find(
    (d) => d.service === "pisell.wallet_pass"
  );
  return {
    ...data,
    walletPass
  };
};
var getPaymentInit = async (values) => {
  let { data } = await import_utils.request.getRequest().post("/h5/pay/payment/init", values);
  return data;
};
var getWalletNameAndPopupStatus = async (values) => {
  const { data } = await import_utils.request.getRequest().get("/h5/wallet/setting", values);
  return data;
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  getPaymentInit,
  getPaymentList,
  getPaymentsAndWalletPass,
  getWalletNameAndPopupStatus
});
