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


import com.neusoft.smart.pos.dto.payment.request.DeletePayChannelRequest;
import com.neusoft.smart.pos.dto.payment.request.GetPayChannelRequest;
import com.neusoft.smart.pos.dto.payment.request.PostApplyPayChannelRequest;
import com.neusoft.smart.pos.dto.payment.request.PutPayChannelRequest;
import com.neusoft.smart.pos.dto.payment.response.DeletePayChannelResponse;
import com.neusoft.smart.pos.dto.payment.response.GetPayChannelResponse;
import com.neusoft.smart.pos.dto.payment.response.PostApplyPayChannelResponse;
import com.neusoft.smart.pos.dto.payment.response.PutPayChannelResponse;
import com.neusoft.smart.pos.framework.dto.ResponseData;
import com.neusoft.smart.pos.payment.service.MchPayChannelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(value = "商户支付渠道管理使用rest接口", description = "商户支付渠道管理使用rest接口")
@RestController
@RequestMapping(path = "/mchPayChannel")
public class MchPayChannelController {

	@Autowired
	private MchPayChannelService mchPayChannelService;

    @ApiOperation(value = "商户支付渠道申请接口", notes = "商户支付渠道申请接口")
    @PostMapping("/applyPayChannel")
    public ResponseData<PostApplyPayChannelResponse> applyPayChannel(@RequestBody PostApplyPayChannelRequest applyPayChannelRequest) {
        return new ResponseData<>(mchPayChannelService.applyPayChannel(applyPayChannelRequest));
    }

    @ApiOperation(value = "商户支付渠道信息查询接口", notes = "商户支付渠道信息查询接口")
    @GetMapping("/payChannel")
    public ResponseData<GetPayChannelResponse> queryPayChannel(GetPayChannelRequest payChannelRequest) {
        return new ResponseData<>(mchPayChannelService.queryPayChannel(payChannelRequest.getMcode(),payChannelRequest.getPayType()));
    }

    @ApiOperation(value = "商户支付渠道信息删除接口", notes = "商户支付渠道信息删除接口")
    @DeleteMapping("/payChannel")
    public ResponseData<DeletePayChannelResponse> deletePayChannel(DeletePayChannelRequest payChannelRequest) {
        return new ResponseData<>(mchPayChannelService.deletePayChannel(payChannelRequest.getMcode(),payChannelRequest.getPayType()));
    }

    @ApiOperation(value = "商户支付渠道信息修改接口", notes = "商户支付渠道信息修改接口")
    @PutMapping("/payChannel")
    public ResponseData<PutPayChannelResponse> updatePayChannel(@RequestBody PutPayChannelRequest payChannelRequest) {
        return new ResponseData<>(mchPayChannelService.updatePayChannel(payChannelRequest));
    }
}
	