package cn.pluss.platform.util;

import com.alibaba.fastjson.JSONObject;

/**
 * 随行付的请求链接
 */
public class SxfConfg {


    /**
     * 微信实名认证接口前缀
     */
    private static final String SXF_CERT_DOMAIN = "https://openapi.suixingpay.com";
    /**
     * 微信实名认证接口
     */
    public static final String SXF_WX_CERT = SXF_CERT_DOMAIN + "/merchant/realName/commitApply";

    /**
     * 查询微信认证授权状态
     */
    public static final String SXF_WX_CERT_STATUS = SXF_CERT_DOMAIN + "/merchant/realName/queryGrantStatus";

    /**
     * 微信实名认证申请结果查询接口
     */
    public static final String SXF_WX_CERT_RESULT = SXF_CERT_DOMAIN + "/merchant/realName/queryApplyInfo";
    /**
     * 微信实名认证申请撤销接口
     */
    public static final String SXF_WX_CERT_CANCEL = SXF_CERT_DOMAIN + "/merchant/realName/backApplyBill";
    public static String PRIVATE_KEY =
            "MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBAMRFhTpr+JWtfhHZ80UJcnDCMeydtcF38S5s+WdifTYNMequFN6uRYoSFJqzQrR0ls7/ZAjUFP/dZL0QJAsWlnRLLSvPsgUU/DzAF7myl6/swuK4eo9frwAYP4ItQcP+DsHBUFnqUbWUON8C3M5ggY92qKfKV1k59tVnFVjoPhbbAgMBAAECgYAzL/5jEi2uu6SZe0Iayy/xgHQMxcTVRDa+aOVStTj6k85k6im/OawhKj39aqsG7TE3oxuvwcAISvEu7bq4uZdbICPdeKLcfNpK4pIfVfokPROjlKSyDgm37gqM7F+T0ZoARVqcd7Mgj09UKKpq7Pi0a/FusEa5CdG2LrUTjZuHIQJBAOFzolrGsPsWaVMpoYGeRY2UrT0PjfXJ1E7nkHqLXCCgfrur374YEEWeLtjHCI6zaXgv/3Coj3USAhKMw4lDAYcCQQDe3bL3szwkGdUmZk61ebY7HanilKnIYNuhC9ALUEElDp2eA1ld5cQvRb4BAeNsvabptt2lRPcscFu9zvH0DaUNAkEAww8HAz8xVKyZSAiW4cyMJOjj0hapHmUXOYWELWJxvRDf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EY;
    /**
     * sxf渠道号
     */
    public static String SXF_SUB_CHANNEL_NO = "398434152";
    /**
     * sxf环境机构号
     */
    public static String ORG_ID;
    /**
     * 商户号
     */
    public static String MERCHANT_NO = "399200821899489";
    /**
     * 成功响应码
     */
    public static final String SXF_SUCCESS_CODE = "0000";
    /** 功能未开通 */
    public static final String SXF_NO_PERMIT = "0006";

    public static final String SXF_REFUND_SUCCESS_CODE = "2002";
    /**
     * 退款成功状态
     */
    public static final String SXF_REFUND_SUCCESS_STATUS_CODE = "REFUNDSUC";


    /********************************************进件相关***************************************************/
    /**
     * 退款成功失败状态
     */
    public static final String SXF_REFUND_FAIL_STATUS_CODE = "REFUNDFAIL";
    /**
     * 退款成功中状态
     */
    public static final String SXF_REFUND_ING_STATUS_CODE = "REFUNDING";
    /**
     * 失败响应码
     */
    public static final String SXF_FAIL_CODE = "0001";
    /**
     * sxf正式domain
     */
    private static String sxfDomain;
    /**
     * 进件相关
     * 正式环境图片上传
     */
    public static String SXF_MERCHANT_INCOME_PHOTO_UPLOAD = sxfDomain + "/merchant/uploadPicture";
    /**
     * 进件相关
     * 正式环境商户入驻
     */
    public static String SXF_MERCHANT_INCOME = sxfDomain + "/merchant/income";
    /**
     * 进件信息
     * 正式环境商户入驻信息修改
     * 备注：商户进件失败的信息修改
     */
    public static String SXF_UPADTE_MERCHANT_RZ = sxfDomain + "/merchant/updateMerchantInfo";

    /**
     * 该接口通过申请单号查询
     * 进件信息
     * 正式环境商户入驻接口查询
     */
    public static String SXF_QUERY_MERCHANT_INFO = sxfDomain + "/merchant/queryMerchantInfo";

    /**
     * 该接口通过商编查询商户信息
     */
    public static String SXF_MERCHANT_INFO_QUERY = sxfDomain + "/merchant/merchantInfoQuery";

    /********************************************支付相关***************************************************/
    /**
     * 进件信息
     * 正式环境商户进件信息修改
     * 备注：商户进件成功的信息修改
     */
    public static String SXF_UPDATE_MERCHANT_INFO = sxfDomain + "/merchant/editMerchantInfo";

    /**
     * 进件信息
     * 正式环境商户信息修改审核结果查询
     */
    public static String SXF_UPDATE_MERCHANT_INFO_RESULT = sxfDomain + "/merchant/queryModifyResult";

    /**
     * 商户设置
     * 正式环境修改商户费率信息 次日0时 生效
     */
    public static String SXF_UPDATE_MERCHANT_RATE = sxfDomain + "/merchant/merchantSetup";
    /**
     * 商户查询
     * 正式环境商户详情查询
     */
    public static String SXF_QUERY_MERCHANT_DETAIL = sxfDomain + "/merchant/merchantInfoQuery";
    /**
     * 主扫付款
     * 正式环境商户主扫接口
     */
    public static String SXF_REVERSE_SCAN_PAY = sxfDomain + "/order/reverseScan";
    /**
     * 商户被扫付款
     * 正式环境商户被扫接口
     */
    public static String SXF_JSAPI_SCAN_PAY = sxfDomain + "/order/jsapiScan";
    /**
     * 退款
     * 正式环境退款接口地址
     */
    public static String SXF_REFUND_PAY = sxfDomain + "/order/refund";
    /**
     * 交易查询
     * 正式环境交易查询
     */
    public static String SXF_TRADE_QUERY_PAY = sxfDomain + "/query/tradeQuery";
    /**
     * 订单关闭
     * 订单关闭接口
     */
    public static String SXF_CLOSE_ORDER = sxfDomain + "/query/close";
    /**
     * 订单撤销
     * 订单撤销接口
     */
    public static String SXF_CANCEL_ORDER = sxfDomain + "/query/cancel";
    /**
     * sxf 辅助接口 获取wxopenId
     */
    public static String SXF_GET_WX_OPENID = sxfDomain + "/query/getSubOPenid";
    /**
     * sxf 辅助接口 获取银联用户标识
     */
    public static String SXF_GET_UNION_USERID = sxfDomain + "/query/getUnionInfo";
    /**
     * 转账接口地址
     */
    public static String SXF_ORG_TRANS_FER = sxfDomain + "/capital/fundManage/orgTransfer";

    /**
     * 商户生成带金额的付款码用户扫码付款
     * 正式环境商户被扫接口
     */
    public static String SXF_ACTIVE_SCAN_PAY = sxfDomain + "/order/activeScan";

    public static JSONObject ok() {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("code", "success");
        jsonObject.put("msg", "成功");
        return jsonObject;
    }

    /**
     * 参数初始化
     * @param domain        sxf链接前缀
     * @param publicKey     公钥
     * @param orgId         机构id
     */
    public static void init(String domain, String publicKey, String orgId) {
        sxfDomain = domain;
        PUBLIC_KEY = publicKey;
        ORG_ID = orgId;

        SXF_MERCHANT_INCOME_PHOTO_UPLOAD = sxfDomain + "/merchant/uploadPicture";
        SXF_MERCHANT_INCOME = sxfDomain + "/merchant/income";
        SXF_UPADTE_MERCHANT_RZ = sxfDomain + "/merchant/updateMerchantInfo";
        SXF_QUERY_MERCHANT_INFO = sxfDomain + "/merchant/queryMerchantInfo";
        SXF_UPDATE_MERCHANT_INFO = sxfDomain + "/merchant/editMerchantInfo";
        SXF_UPDATE_MERCHANT_INFO_RESULT = sxfDomain + "/merchant/queryModifyResult";
        SXF_UPDATE_MERCHANT_RATE = sxfDomain + "/merchant/merchantSetup";
        SXF_QUERY_MERCHANT_DETAIL = sxfDomain + "/merchant/merchantInfoQuery";
        SXF_REVERSE_SCAN_PAY = sxfDomain + "/order/reverseScan";
        SXF_JSAPI_SCAN_PAY = sxfDomain + "/order/jsapiScan";
        SXF_REFUND_PAY = sxfDomain + "/order/refund";
        SXF_TRADE_QUERY_PAY = sxfDomain + "/query/tradeQuery";
        SXF_CLOSE_ORDER = sxfDomain + "/query/close";
        SXF_CANCEL_ORDER = sxfDomain + "/query/cancel";
        SXF_GET_WX_OPENID = sxfDomain + "/query/getSubOPenid";
        SXF_GET_UNION_USERID = sxfDomain + "/query/getUnionInfo";
        SXF_ORG_TRANS_FER = sxfDomain + "/capital/fundManage/orgTransfer";
        SXF_MERCHANT_INFO_QUERY = sxfDomain + "/merchant/merchantInfoQuery";
        SXF_ACTIVE_SCAN_PAY = sxfDomain + "/order/activeScan";
    }
}
