package com.jwipc.finance.controller;

import com.jwipc.api.dto.ApiResult;
import com.jwipc.api.dto.OaCallBackDTO;
import com.jwipc.api.dto.PaymentCallBackDTO;
import com.jwipc.finance.dto.CreatePcaDetailDto;
import com.jwipc.finance.dto.PayableRefundApiDTO;
import com.jwipc.finance.dto.PaymentReceiptApiDTO;
import com.jwipc.finance.logic.PaymentCallBackLogic;
import com.jwipc.log.annotation.ApiOperateLog;
import com.jwipc.log.constant.ApiDirection;
import com.jwipc.log.constant.ThirdSysType;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author shenyang.ou
 * @date 2025/10/30 17:56
 * @desc
 */
@RestController
@RequestMapping("/open/api")
@RequiredArgsConstructor
public class PaymentCallBackApiController {
    private final PaymentCallBackLogic paymentCallBackLogic;

    @PostMapping("/callback")
    @ApiOperateLog(code = "paymentCallback",name = "付款&预付款回调", direction = ApiDirection.OTHER_TO_SRM, thirdSysType = ThirdSysType.ERP)
    public ApiResult callback(@RequestBody PaymentCallBackDTO callBackDTO) {
        return paymentCallBackLogic.callback(callBackDTO);
    }

    @PostMapping("/paymentReceipt")
    @ApiOperateLog(code = "paymentReceipt",name = "回执单绑定关系回传SRM", direction = ApiDirection.OTHER_TO_SRM, thirdSysType = ThirdSysType.ERP)
    public ApiResult paymentReceipt(@RequestBody PaymentReceiptApiDTO callBackDTO) {
        return paymentCallBackLogic.paymentReceipt(callBackDTO);
    }

    @PostMapping("/payableRefund")
    @ApiOperateLog(code = "payableRefund",name = "应付红字退款回传SRM", direction = ApiDirection.OTHER_TO_SRM, thirdSysType = ThirdSysType.ERP)
    public ApiResult payableRefund(@RequestBody PayableRefundApiDTO callBackDTO) {
        return paymentCallBackLogic.payableRefund(callBackDTO);
    }
}
