Search in sources :

Example 1 with RedPackQueryReqData

use of com.coolfish.weixin.redpack.protocol.query.RedPackQueryReqData in project vip by guangdada.

the class RedPackUtil method redPackQuery.

public static RedPackQueryResData redPackQuery(String mch_billno, String certLocalPath) {
    final RedPackQueryResData rprd = new RedPackQueryResData();
    try {
        WXPay.initSDKConfiguration("JTZM88CKRKSWNUAUUF8HMJ7FJPGIY3NA", "wx71e66431bed0303e", "1229321102", "", certLocalPath, "1229321102");
        PayConfig.setIp(Util.localIp());
        PayConfig.setHttpsRequestClassName("com.coolfish.weixin.pay.common.HttpsRequest");
        RedPackQueryReqData redPackQueryReqData = new RedPackQueryReqData(mch_billno);
        WXPay.doRedPackQueryBusiness(redPackQueryReqData, new RedPackQueryListener() {

            @Override
            public void onXmlError(RedPackResData payResData) {
                // TODO Auto-generated method stub
                rprd.setErr_code(payResData.getErr_code());
                rprd.setErr_code_des(payResData.getErr_code_des());
                rprd.setResult_code(payResData.getResult_code());
                rprd.setReturn_code(payResData.getReturn_code());
                rprd.setReturn_msg(payResData.getReturn_msg());
            }

            @Override
            public void onSystemError(RedPackResData payResData) {
                // TODO Auto-generated method stub
                rprd.setErr_code(payResData.getErr_code());
                rprd.setErr_code_des(payResData.getErr_code_des());
                rprd.setResult_code(payResData.getResult_code());
                rprd.setReturn_code(payResData.getReturn_code());
                rprd.setReturn_msg(payResData.getReturn_msg());
            }

            @Override
            public void onSignError(RedPackResData payResData) {
                // TODO Auto-generated method stub
                rprd.setErr_code(payResData.getErr_code());
                rprd.setErr_code_des(payResData.getErr_code_des());
                rprd.setResult_code(payResData.getResult_code());
                rprd.setReturn_code(payResData.getReturn_code());
                rprd.setReturn_msg(payResData.getReturn_msg());
            }

            @Override
            public void onParamError(RedPackResData payResData) {
                // TODO Auto-generated method stub
                rprd.setErr_code(payResData.getErr_code());
                rprd.setErr_code_des(payResData.getErr_code_des());
                rprd.setResult_code(payResData.getResult_code());
                rprd.setReturn_code(payResData.getReturn_code());
                rprd.setReturn_msg(payResData.getReturn_msg());
            }

            @Override
            public void onNoAuth(RedPackResData payResData) {
                // TODO Auto-generated method stub
                rprd.setErr_code(payResData.getErr_code());
                rprd.setErr_code_des(payResData.getErr_code_des());
                rprd.setResult_code(payResData.getResult_code());
                rprd.setReturn_code(payResData.getReturn_code());
                rprd.setReturn_msg(payResData.getReturn_msg());
            }

            @Override
            public void onFreqLimit(RedPackResData payResData) {
                // TODO Auto-generated method stub
                rprd.setErr_code(payResData.getErr_code());
                rprd.setErr_code_des(payResData.getErr_code_des());
                rprd.setResult_code(payResData.getResult_code());
                rprd.setReturn_code(payResData.getReturn_code());
                rprd.setReturn_msg(payResData.getReturn_msg());
            }

            @Override
            public void onCaError(RedPackResData payResData) {
                // TODO Auto-generated method stub
                rprd.setErr_code(payResData.getErr_code());
                rprd.setErr_code_des(payResData.getErr_code_des());
                rprd.setResult_code(payResData.getResult_code());
                rprd.setReturn_code(payResData.getReturn_code());
                rprd.setReturn_msg(payResData.getReturn_msg());
            }

            @Override
            public void onSuccess(RedPackQueryResData resData) {
                // TODO Auto-generated method stub
                rprd.setErr_code(resData.getErr_code());
                rprd.setErr_code_des(resData.getErr_code_des());
                rprd.setResult_code(resData.getResult_code());
                rprd.setReturn_code(resData.getReturn_code());
                rprd.setReturn_msg(resData.getReturn_msg());
                rprd.setStatus(resData.getStatus());
                rprd.setReason(resData.getReason());
                rprd.setRefund_time(resData.getRefund_time());
            }

            @Override
            public void onOtherError(RedPackQueryResData resData) {
                // TODO Auto-generated method stub
                rprd.setErr_code(resData.getErr_code());
                rprd.setErr_code_des(resData.getErr_code_des());
                rprd.setResult_code(resData.getResult_code());
                rprd.setReturn_code(resData.getReturn_code());
                rprd.setReturn_msg(resData.getReturn_msg());
                rprd.setStatus(resData.getStatus());
                rprd.setReason(resData.getReason());
                rprd.setRefund_time(resData.getRefund_time());
            }

            @Override
            public void onNotFound(RedPackQueryResData resData) {
                // TODO Auto-generated method stub
                rprd.setErr_code(resData.getErr_code());
                rprd.setErr_code_des(resData.getErr_code_des());
                rprd.setResult_code(resData.getResult_code());
                rprd.setReturn_code(resData.getReturn_code());
                rprd.setReturn_msg(resData.getReturn_msg());
                rprd.setStatus(resData.getStatus());
                rprd.setReason(resData.getReason());
                rprd.setRefund_time(resData.getRefund_time());
            }
        });
        return rprd;
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}
Also used : RedPackQueryReqData(com.coolfish.weixin.redpack.protocol.query.RedPackQueryReqData) RedPackQueryListener(com.coolfish.weixin.redpack.business.listener.RedPackQueryListener) RedPackQueryResData(com.coolfish.weixin.redpack.protocol.query.RedPackQueryResData) RedPackResData(com.coolfish.weixin.redpack.protocol.RedPackResData)

Aggregations

RedPackQueryListener (com.coolfish.weixin.redpack.business.listener.RedPackQueryListener)1 RedPackResData (com.coolfish.weixin.redpack.protocol.RedPackResData)1 RedPackQueryReqData (com.coolfish.weixin.redpack.protocol.query.RedPackQueryReqData)1 RedPackQueryResData (com.coolfish.weixin.redpack.protocol.query.RedPackQueryResData)1