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

import iot.lidee.pay.api.api.refund.PayRefundApi;
import iot.lidee.pay.api.api.refund.dto.PayRefundCreateReqDTO;
import iot.lidee.pay.api.api.refund.dto.PayRefundRespDTO;
import iot.lidee.pay.core.convert.refund.PayRefundConvert;
import iot.lidee.pay.core.service.refund.PayRefundService;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;

import javax.annotation.Resource;

/**
 * 退款单 API 实现类
 *
 * @author 裕恒
 */
@Service
@Validated
public class PayRefundApiImpl implements PayRefundApi {

    @Resource
    private PayRefundService payRefundService;

    @Override
    public Long createRefund(PayRefundCreateReqDTO reqDTO) {
        return payRefundService.createPayRefund(reqDTO);
    }

    @Override
    public PayRefundRespDTO getRefund(Long id) {
        return PayRefundConvert.INSTANCE.convert02(payRefundService.getRefund(id));
    }

}
