package cn.sikey.hmd.api;

import cn.sikey.framework.common.pojo.CommonResult;
import cn.sikey.hmd.api.hmd.PaymentApi;
import cn.sikey.hmd.api.hmd.vo.payments.PaymentsReqVO;
import cn.sikey.hmd.api.hmd.vo.payments.PaymentsRespVO;
import cn.sikey.hmd.service.payments.PaymentService;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;

/**
 * 付款记录 API 接口实现类
 *
 * @author qin
 */
@RestController // 提供 RESTful API 接口，给 Feign 调用
@Validated
public class PaymentApiImpl implements PaymentApi {

    @Resource
    private PaymentService paymentService;

    @Override
    public CommonResult<Void> savePayments(PaymentsReqVO paymentsReqVO) {
        paymentService.savePayments(paymentsReqVO);
        return CommonResult.success();
    }

    @Override
    public CommonResult<Void> updatePayments(PaymentsReqVO paymentsReqVO) {
        paymentService.updatePayments(paymentsReqVO);
        return CommonResult.success();
    }

    @Override
    public CommonResult<PaymentsRespVO> queryPayments(Long orderId) {
        return CommonResult.success(paymentService.queryPayments(orderId));
    }
}
