package cn.iocoder.yudao.module.project.controller.admin;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.order.service.RepairOrderInfoService;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.SignatureException;
import java.util.Map;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@Tag(name = "管理后台 - 维修模块 支付模块")
@RestController
@RequestMapping("/admin-api/pay")
@Validated
public class RepairPayController {
    @Resource
    private RepairOrderInfoService repairOrderInfoService;

    /**
     * 支付吊起接口
     * @param orderId 订单主键
     * @return
     */
    @GetMapping("/toPay")
    public CommonResult<Map<String, Object>> payTransactions(String orderId) throws IOException, NoSuchAlgorithmException, SignatureException, InvalidKeyException {
        Map<String, Object> res = repairOrderInfoService.payTransactions(orderId);
        return success(res);
    }

}
