package com.yidianling.ydl_pay.http

import com.ydl.ydlcommon.base.config.YDL_DOMAIN
import com.ydl.ydlcommon.base.config.YDL_DOMAIN_JAVA
import com.ydl.ydlcommon.data.http.BaseResponse
import com.yidianling.ydl_pay.bean.*
import io.reactivex.Observable
import okhttp3.RequestBody
import retrofit2.http.*

/**
 * @author jiucheng
 * @描述:支付相关的接口
 * @Copyright Copyright (c) 2018
 * @Company 壹点灵
 * @date 2019/4/16
 */
interface PayServices {

    /**
     * 获取下单的信息
     */
    @POST("auth/Order/getOrderInfo")
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
    fun getOrderInfo(@Body body: RequestBody): Observable<BaseResponse<OrderInfoBean>>

    /**
     * 验证课程兑换券是否可用
     */
    @POST("auth/course/checkCourseCoupon")
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
    fun checkCourseCoupon(@Body body: RequestBody): Observable<BaseResponse<CouponCodeInfoBean>>


    /**
     *  下单时候选择优惠券
     */
    @POST("auth/new_coupon/selectCoupon")
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
    fun selectCoupon(@Body body: RequestBody): Observable<BaseResponse<AllCouponListBean>>


    /**
     *  创建订单
     */
    @POST("auth/Order/createOrder")
    @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
    fun createOrder(@Body body: RequestBody): Observable<BaseResponse<PayOrderBean>>


    /**
     *  支付宝在线支付
     */
    @FormUrlEncoded
    @POST("pay/get-recharge")
    fun getAliPayOrderId(@FieldMap params: Map<String, String>): Observable<BaseResponse<CommonPayRecharge>>

    /**
     *  微信在线支付
     */
    @FormUrlEncoded
    @POST("pay/to-pay")
    fun wxPay(@FieldMap params: Map<String, String>): Observable<BaseResponse<CommonWXPayBean>>

    //行为动作埋点统计接口
    @POST("maidian/writeMaiDianData")
    fun actionDataCount(@Body body: RequestBody): Observable<BaseResponse<String>>
}