package com.medical.ydl.medical.http

import com.google.gson.Gson
import com.medical.ydl.medical.bean.CreatePayReqDtoBody
import com.medical.ydl.medical.bean.CreatePayRespose
import com.medical.ydl.medical.bean.PayTimeReqDtoBody
import com.medical.ydl.medical.bean.PayTimeRespose
import com.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlnet.YDLHttpUtils
import io.reactivex.Observable
import okhttp3.MediaType
import okhttp3.RequestBody


/**
 *
 * */
class MedicalPayServiceImpl {
    companion object{
        /**
         * 获取下单的信息
         */
        fun getOrderInfo(bean: CreatePayReqDtoBody): Observable<BaseResponse<CreatePayRespose>> {
            var str = Gson().toJson(bean)
            val body = RequestBody.create(
                MediaType.parse("application/json; charset=utf-8"),
                str
            ) as RequestBody
            return YDLHttpUtils.obtainApi(MedicalPayServices::class.java).getOrderInfo(body)
        }

        /**
         * 获取下单的信息
         * @param inquiryOrderId 订单id
         */
        fun getSurplusPayTime(inquiryOrderId: String): Observable<BaseResponse<PayTimeRespose>> {
            return YDLHttpUtils.obtainApi(MedicalPayServices::class.java).getSurplusPayTime(inquiryOrderId)
        }
    }
}