package com.hc.web.controller.browser.back;

import com.alipay.api.AlipayApiException;
import com.hc.business.service.AliPayService;
import com.hc.core.utils.pay.browser.alipay.bean.AliPayRefundBean;
import com.hc.core.utils.result.Result;
import io.swagger.annotations.ApiOperation;
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;

/**
 * @author 10696
 */

@RestController
@RequestMapping("/new/api/back/ali")
public class BackAliPayController {

    /**
     * 服务对象
     */
    private final AliPayService aliPayService;

    public BackAliPayController(AliPayService aliPayService) {
        this.aliPayService = aliPayService;
    }

    @PostMapping("/refund")
    @ApiOperation(value = "阿里云支付退款", response = Result.class)
    public Result aliRefund(@RequestBody AliPayRefundBean aliPayRefundBean)
            throws AlipayApiException {
        return Result.success(aliPayService.refund(aliPayRefundBean));
    }

}
