package com.neusoft.smart.pos.payment.controller;


import com.neusoft.smart.pos.dto.payment.request.*;
import com.neusoft.smart.pos.dto.payment.response.*;
import com.neusoft.smart.pos.framework.dto.ResponseData;
import com.neusoft.smart.pos.payment.service.GrantPayService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
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;

@Api(value = "资金授权支付管理使用rest接口", description = "资金授权支付管理使用rest接口")
@RestController
@RequestMapping(path = "/grantPay")
public class GrantPayController {

	@Autowired
	private GrantPayService grantPayService;


    @ApiOperation(value = "资金授权冻结使用方法(含主扫与被扫)", notes = "资金授权冻结使用方法(含主扫与被扫)")
    @PostMapping("/freezePay")
    public ResponseData<PostFreePayResponse> freezePay(@RequestBody PostFreePayRequest freePayRequest) {
        return new ResponseData<>(grantPayService.freezePay(freePayRequest));
    }
    
    @ApiOperation(value = "第三方支付单撤销接口", notes = "根据商户号订单编号撤销预付单信息方法")
    @PostMapping("/reversePayGrant")
    public ResponseData<PostReversePayGrantResponse> reversePayGrant(@RequestBody PostReversePayGrantRequest reversePayGrantRequest) {
        return new ResponseData<>(grantPayService.reversePayGrant(reversePayGrantRequest));
    }
    
    @ApiOperation(value = "资金授权解冻使用方法", notes = "资金授权解冻使用方法")
    @PostMapping("/unFreezePay")
    public ResponseData<PostUnFreezePayGrantResponse> unFreezePay(@RequestBody PostUnFreezePayGrantRequest unFreePayRequest) {
        return new ResponseData<>(grantPayService.unFreezePay(unFreePayRequest));
    }
    
    @ApiOperation(value = "第三方支付预授权订单信息查询接口", notes = "第三方支付预授权订单信息查询接口")
    @PostMapping("/queryPayGrant")
    public ResponseData<PostQueryPayGrantResponse> queryPayGrant(@RequestBody PostQueryPayGrantRequest queryPayGrantRequest) {
        return new ResponseData<>(grantPayService.queryPayGrant(queryPayGrantRequest));
    }
    
    @ApiOperation(value = "第三方支付预授权转支付接口", notes = "第三方支付预授权转支付接口")
    @PostMapping("/grantToPay")
    public ResponseData<PostGrantToPayResponse> grantToPay(@RequestBody PostGrantToPayRequest grantToPayRequest) {
        return new ResponseData<>(grantPayService.grantToPay(grantToPayRequest));
    }
    
    @ApiOperation(value = "第三方支付单退款申请接口", notes = "根据商户号订申请退款方法")
    @PostMapping("/grantPayRefund")
    public ResponseData<PostGrantPayRefundResponse> grantPayRefund(@RequestBody PostGrantPayRefundRequest grantPayRefundRequest) {
        return new ResponseData<>(grantPayService.grantPayRefund(grantPayRefundRequest));
    }
    
//    @ApiOperation(value = "第三方支付单取消接口", notes = "根据商户号订单编号取消预付单信息方法")
//    @PostMapping("/cancelOrder")
//    public ResponseData<PostCancelOrderResponse> cancelOrder(@RequestBody PostCancelOrderRequest cannelOrderRequest) {
//        return new ResponseData<>(payService.cancelOrder(cannelOrderRequest));
//    }


}
	