package com.izouma.jiashanxia.web;

import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
import com.izouma.jiashanxia.service.ConsumptionService;
import com.izouma.jiashanxia.utils.SecurityUtils;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@AllArgsConstructor
@RestController
@RequestMapping("/pay")
public class ConsumptionController {
    private ConsumptionService consumptionService;

    @ApiOperation("支付")
    @GetMapping("/wx")
    public WxPayMpOrderResult wx(Long orderId) {
        return consumptionService.payOrder(SecurityUtils.getAuthenticatedUser().getId(), orderId);
    }

}
