package cn.freemud.service.thirdparty;

import com.freemud.application.sdk.api.ordercenter.annotation.LogIgnoreFeign;
import cn.freemud.constant.ResponseCodeKeyConstant;
import cn.freemud.entities.dto.order.FacePayRequestDto;
import cn.freemud.entities.dto.order.UnifiedPayResponseDto;
import cn.freemud.entities.dto.order.InvoiceCreateResponse;
import cn.freemud.entities.dto.pay.*;
import cn.freemud.entities.dto.order.RefundQueryResponseDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * All rights Reserved, Designed By www.freemud.cn
 *
 * @version V1.0
 * @Title: PaymentNewClient
 * @Package cn.freemud.service.thirdparty
 * @Description:
 * @author: ping1.wu
 * @date: 2019/12/25 19:09
 * @Copyright: 2019 www.freemud.cn Inc. All rights reserved.
 * 注意：本内容仅限于上海非码科技内部传阅，禁止外泄以及用于其他的商业目
 */
@FeignClient(name = "payment-center-api",url="${payment.new.baseUrl:}")
@RequestMapping(produces = {"application/json;charset=UTF-8"})
public interface PaymentNewClient {

    /**
     * 扫脸支付，唤起支付
     */
    @LogIgnoreFeign(logMessage="facePay",statusCodeFieldName= ResponseCodeKeyConstant.STATUS_CODE)
    @PostMapping("paymentcenter/facePay")
    com.freemud.application.sdk.api.base.BaseResponse<UnifiedPayResponseDto> facePay(@RequestBody FacePayRequestDto orderPayDto);

    /**
     * 创建预支付订单，唤起支付
     */
    @LogIgnoreFeign(logMessage="unifiedOrder",statusCodeFieldName= ResponseCodeKeyConstant.CODE)
    @PostMapping("paymentcenter/unifiedOrder")
    com.freemud.application.sdk.api.base.BaseResponse<UnifiedPayResponseDto> unifiedOrder(@RequestBody UnifiedOrderRequestDto requestDto);

    /**
     * 支付退款查询，对接麦咖啡时使用了
     */
    @LogIgnoreFeign(logMessage="refundQuery")
    @PostMapping("paymentcenter/refundQuery")
    com.freemud.application.sdk.api.base.BaseResponse<RefundQueryResponseDto> refundQuery(@RequestBody FacePayRequestDto orderPayDto);

    /**
     * 开订单发票
     */
    @LogIgnoreFeign(logMessage="paymentcenter/invoice/create",statusCodeFieldName= ResponseCodeKeyConstant.STATUS_CODE)
    @PostMapping("paymentcenter/invoice/create")
    com.freemud.application.sdk.api.base.BaseResponse<InvoiceCreateResponse> createInvoice(@RequestBody InvoiceCreateRequest request);

    /**
     * 线下付，储值卡/礼品卡支付
     */
    @LogIgnoreFeign(logMessage="codePay",statusCodeFieldName= ResponseCodeKeyConstant.STATUS_CODE)
    @PostMapping("paymentcenter/codePay")
    com.freemud.application.sdk.api.base.BaseResponse<UnifiedPayResponseDto> codePay(@RequestBody FacePayRequestDto orderPayDto);

    /**
     * 关闭预支付订单
     */
    @LogIgnoreFeign(logMessage="payClose")
    @PostMapping("paymentcenter/close")
    com.freemud.application.sdk.api.base.BaseResponse<CloseUnifiedOrderResult> cancelNewUnifiedOrder(@RequestBody PaymentCloseUnifiedOrderRequest request);

    /**
     * 支付查询
     * 关闭预支付使用
     */
    @LogIgnoreFeign(logMessage="payQuery")
    @PostMapping("paymentcenter/query")
    com.freemud.application.sdk.api.base.BaseResponse<PaymentQueryResponseDto> payQuery(@RequestBody PaymentQueryRequestDto request);

//    /**
//     * 支付退款查询
//     */
//    @LogIgnoreFeign(logMessage="payQueryOrder")
//    @PostMapping("paymentcenter/queryOrder")
//    com.freemud.application.sdk.api.base.BaseResponse<PaymentQueryOrderResponseDto> payQueryOrder(@RequestBody PaymentQueryOrderRequestDto request);

//    /**
//     * 现金支付退款接口
//     */
//    @LogIgnoreFeign(logMessage="payRefund")
//    @PostMapping("paymentcenter/refund")
//    com.freemud.application.sdk.api.base.BaseResponse<PayRefundResponseDto> payRefund(@RequestBody PayRefundRequestDto request);
}
