package com.tashow.cloud.payapi.api.order;

import com.tashow.cloud.common.pojo.CommonResult;
import com.tashow.cloud.payapi.api.order.dto.PayOrderCreateReqDTO;
import com.tashow.cloud.payapi.enums.ApiConstants;
import com.tashow.cloud.sdk.payment.dto.order.PayOrderRespDTO;
import jakarta.annotation.security.PermitAll;
import jakarta.validation.Valid;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * RPC 服务 - 支付单
 */
@FeignClient(name = ApiConstants.NAME) //
public interface PayOrderApi {

    String PREFIX = ApiConstants.PREFIX + "/order";

    /*创建支付单*/
    @PostMapping(PREFIX + "/create")
    CommonResult<Long> createOrder(@Valid @RequestBody PayOrderCreateReqDTO reqDTO);

    /*获得支付单*/
    @GetMapping(PREFIX + "/get")
    @PermitAll
    CommonResult<PayOrderRespDTO> getOrder(@RequestParam("id") Long id);

    /**
     * 更新支付订单价格
     * @param id 支付单编号
     * @param payPrice 支付单价格
     * @return
     */
    @PutMapping(PREFIX + "/update-price")
    CommonResult<Boolean> updatePayOrderPrice(@RequestParam("id") Long id ,//支付单编号
                                              @RequestParam("payPrice") Integer payPrice);

}
