package iot.lidee.pay.core.api.order;

import iot.lidee.pay.api.api.order.PayOrderApi;
import iot.lidee.pay.api.api.order.dto.PayOrderCreateReqDTO;
import iot.lidee.pay.api.api.order.dto.PayOrderRespDTO;
import iot.lidee.pay.core.convert.order.PayOrderConvert;
import iot.lidee.pay.core.domain.dataobject.order.PayOrder;
import iot.lidee.pay.core.service.order.PayOrderService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 支付单 API 实现类
 *
 * @author 裕恒
 */
@Service
public class PayOrderApiImpl implements PayOrderApi {

    @Resource
    private PayOrderService payOrderService;

    @Override
    public Long createOrder(PayOrderCreateReqDTO reqDTO) {
        return payOrderService.createOrder(reqDTO);
    }

    @Override
    public PayOrderRespDTO getOrder(Long id) {
        PayOrder order = payOrderService.getOrder(id);
        return PayOrderConvert.INSTANCE.convert2(order);
    }

}
