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 bizId 订单id
         * @param bizType 1-问诊订单 3-药品订单
         */
        fun getSurplusPayTime(bizId: String,bizType:Int): Observable<BaseResponse<Long>> {
            return YDLHttpUtils.obtainApi(MedicalPayServices::class.java).getSurplusPayTime(bizId,bizType)
        }
    }
}