Exemplo n.º 1
0
        /**
         *
         * 充值下单
         * 该接口用于平台方从BlinkPayCard系统获取充值预下单号。
         * 平台方通过Post请求调用该接口,从返回结果中解析过预下单号(pre_order)。
         * @param BlinkPayCardData inputObj 提交给查询订单API的参数
         * @throws BlinkPayCardException
         * @return 预下单号
         */
        public static string PreOrder(BlinkPayCardData inputObj)
        {
            string url = "https://pay.api.blinkpaycard.com/pay/preOrder";

            inputObj.SetValue("app_id", BlinkPayCardConfig.GetConfig().GetAppID());
            inputObj.SetValue("mch_id", BlinkPayCardConfig.GetConfig().GetMchID());
            inputObj.SetValue("osu_number", GenerateNonceStr());
            inputObj.SetValue("amount", "100");
            inputObj.SetValue("currency", "CNY");
            inputObj.SetValue("sign_type", BlinkPayCardData.SIGN_TYPE_MD5);
            inputObj.SetValue("sign", inputObj.MakeSign(BlinkPayCardData.SIGN_TYPE_MD5));//签名


            string json = inputObj.ToJson();

            Console.WriteLine("PreOrder request : " + json);
            string response = HttpService.Post(json, url);//调用HTTP通信接口提交数据

            Console.WriteLine("PreOrder response : " + response);

            JsonData resultObj = JsonMapper.ToObject(response);
            string   pre_order = (string)resultObj["result"]["pre_order"];

            //JsonData preOrderObj = JsonMapper.ToObject(response);
            //string pre_order = (string)preOrderObj["pre_order"];

            return(pre_order);
        }
Exemplo n.º 2
0
        /**
         *
         * 查询订单
         * @param BlinkPayCardData inputObj 提交给查询订单API的参数
         * @throws BlinkPayCardException
         * @return 成功时返回订单查询结果,其他抛异常
         */
        public static BlinkPayCardData OrderQuery(BlinkPayCardData inputObj, string pre_order)
        {
            string url = "https://pay.api.blinkpaycard.com/pay/queryResult";

            inputObj.SetValue("app_id", BlinkPayCardConfig.GetConfig().GetAppID());
            inputObj.SetValue("mch_id", BlinkPayCardConfig.GetConfig().GetMchID());
            inputObj.SetValue("pre_order", pre_order);
            inputObj.SetValue("sign_type", BlinkPayCardData.SIGN_TYPE_MD5);
            inputObj.SetValue("sign", inputObj.MakeSign(BlinkPayCardData.SIGN_TYPE_MD5));//签名


            string json = inputObj.ToJson();

            Console.WriteLine("OrderQuery request : " + json);
            string response = HttpService.Post(json, url);//调用HTTP通信接口提交数据

            Console.WriteLine("OrderQuery response : " + response);

            BlinkPayCardData result = new BlinkPayCardData();

            return(result);
        }