package com.yc.ship.module.trade.api.trade;

import com.yc.ship.framework.common.pojo.CommonResult;
import com.yc.ship.framework.common.util.object.BeanUtils;
import com.yc.ship.module.trade.api.dto.PayOrderReqDTO;
import com.yc.ship.module.trade.api.dto.PayOrderRespDTO;
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.service.pay.impl.TradeOrderPayServiceImpl;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author ：
 * @description：TODO
 * @date ：2026/4/7 11:45
 **/
@RestController
@Validated
public class TradeApiImpl implements TradeApi {

    @Resource
    private TradeOrderPayServiceImpl tradeOrderPayService;


    @Override
    public CommonResult<PayOrderRespDTO> payOuterOrder(PayOrderReqDTO reqDTO) {
        PayOrderReqVO payOrderReqDTO = BeanUtils.toBean(reqDTO, PayOrderReqVO.class);
        CommonResult<PayOrderRespVO> payOrderRespVOCommonResult = tradeOrderPayService.payOuterOrder(payOrderReqDTO);
        return CommonResult.success(BeanUtils.toBean(payOrderRespVOCommonResult.getData(), PayOrderRespDTO.class));
    }
}