package com.yc.ship.module.trade.service.pay;



import com.yc.ship.framework.common.pojo.CommonResult;
import com.yc.ship.module.trade.controller.admin.order.vo.order.PayOrderReqVO;
import com.yc.ship.module.trade.controller.admin.order.vo.order.PayOrderRespVO;
import com.yc.ship.module.trade.enums.TradeOrderOperateTypeEnum;
import com.yc.ship.module.trade.framework.annotation.TradeOrderLog;

import java.util.Map;

/**
 * &#064;Description 订单支付service接口
 * &#064;Author qsl
 * &#064;Date 2025/6/4 15:03
 * @author qsl
 */
public interface TradeOrderPayService {

    String UPDATE_PAY_ORDER_LOCK = "payOrder:update:lock:%d";
    String UPDATE_PAY_OUTER_ORDER_LOCK = "payOuterOrder:update:lock:%d:%d";

    /**
     * 支付订单
     */
    CommonResult<PayOrderRespVO> payOrder(PayOrderReqVO payOrderReqVO);

    /**
     * 定金支付
     */
    CommonResult<PayOrderRespVO> payDeposiOrder(PayOrderReqVO payOrderReqVO);
    CommonResult<PayOrderRespVO> payBcOrder(PayOrderReqVO payOrderReqVO);

    /**
     * 处理支付成功通知,只有支付成功了，支付平台才调用
     */
    CommonResult<?> handlePayNotify(Map<String, Object> map);

    CommonResult<?> handleDeposiPayNotify(Map<String, Object> map);
    CommonResult<?> handleBcPayNotify(Map<String, Object> map);

    /**
     * 支付单反查
     * @return 0待支付(轮询) 1已支付 2未支付 8888已支付等待结果(轮询)
     */
    CommonResult<?> payOrderQuery(Long payOrderId);

    /**
     * 订单支付超时消息处理
     */
    CommonResult<?> orderPayTimeOutMessageHandler(Long orderId,Boolean isManual);

    @TradeOrderLog(operateType = TradeOrderOperateTypeEnum.PAY_TIMEOUT_SYSTEM_CANCEL)
    CommonResult<?> orderPayCancelHandler(Long orderId);

    /**
     * 取消订单
     */
    @TradeOrderLog(operateType = TradeOrderOperateTypeEnum.MANUL_CANCEL)
    CommonResult<?> cancelOrder(Long orderId);

    /**
     * 供应商出票重试
     */
    CommonResult<?> retryPaySupplierOrder(Long orderId,Long supplierOrderId);

    /**
     * 外部订单支付
     */
    CommonResult<PayOrderRespVO> payOuterOrder(PayOrderReqVO payOrderReqVO);

    CommonResult<?> queryOrderContract(Long payOrderId);
}
