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


import com.neusoft.smart.pos.dto.trade.request.PostRefundRequest;
import com.neusoft.smart.pos.dto.trade.response.PostRefundResponse;
import com.neusoft.smart.pos.framework.dto.ResponseData;
import com.neusoft.smart.pos.gateway.service.OrderRefundService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
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 javax.validation.Valid;

@Api(value = "商户订单退款管理使用rest接口", description = "商户订单退款管理使用rest接口")
@RestController
@RequestMapping(path = "/unionService/orderRefund")
@Validated
public class OrderRefundController {

	@Autowired
	private OrderRefundService orderRefundService;

	@ApiOperation(value = "POS端支付订单退款申请接口", notes = "POS端支付订单退款申请保存方法")
	@PostMapping("/refund")
	public ResponseData<PostRefundResponse> saveOrderRefund(@Valid @RequestBody PostRefundRequest refundRequest, BindingResult bindingResult) {
	    return new ResponseData<>(orderRefundService.saveOrderRefund(refundRequest));
	}

}
	