package cn.yyxx.commsdk.base.entity;

import org.json.JSONException;
import org.json.JSONObject;

import cn.yyxx.support.JsonUtils;

public class SdkOrderInfo {
    public String getPay_web_url() {
        return this.pay_web_url;
    }

    public void setPay_web_url(final String pay_web_url) {
        this.pay_web_url = pay_web_url;
    }

    public String getOrder_id() {
        return this.order_id;
    }

    public void setOrder_id(final String order_id) {
        this.order_id = order_id;
    }

    public String getOrder_ext() {
        return this.order_ext;
    }

    public void setOrder_ext(final String order_ext) {
        this.order_ext = order_ext;
    }

    public String getQuery_params() {
        return this.query_params;
    }

    public void setQuery_params(final String query_params) {
        this.query_params = query_params;
    }

    public SdkChargeInfo getSdkChargeInfo() {
        return this.sdkChargeInfo;
    }

    public void setSdkChargeInfo(final SdkChargeInfo sdkChargeInfo) {
        this.sdkChargeInfo = sdkChargeInfo;
    }

    public int getSdk_pay() {
        return this.sdk_pay;
    }

    public void setSdk_pay(final int sdk_pay) {
        this.sdk_pay = sdk_pay;
    }

    String pay_web_url,order_id,order_ext,query_params;
    SdkChargeInfo sdkChargeInfo;
    int sdk_pay = 1;

    public void initOrderInfo(SdkChargeInfo sdkChargeInfo,String orderInfo){
        this.sdkChargeInfo = sdkChargeInfo;

        JSONObject info = null;
        try {
            info = new JSONObject(orderInfo);
            if (JsonUtils.hasJsonKey(info, "query_params")) {
                query_params = info.optString("query_params");
             }
            if (JsonUtils.hasJsonKey(info, "pay_web_url")) {
                pay_web_url = info.optString("pay_web_url");
            }
            if (JsonUtils.hasJsonKey(info, "sdk_pay")) {
                sdk_pay = info.optInt("sdk_pay",1);
            }if (JsonUtils.hasJsonKey(info, "3rdext")) {
                order_ext = info.optString("3rdext");
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }


    }


}
