Пример #1
0
        /// <summary>
        /// 易宝异步返回
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public YBResponsePara YBCallBack(HttpContext context)
        {
            YBResponsePara result = new YBResponsePara()
            {
                isPaySuccess = false,
                orderNumber  = "",
                paymentMoney = 0,
                resultMsg    = ""
            };

            try
            {
                if (context.Request["data"].IsNull() ||
                    context.Request["encryptkey"].IsNull())
                {
                    result.resultMsg = "回调参数不正确";
                    return(result);
                }
                //回调中的参数data
                string data = context.Request["data"].ToString();
                //回调中的参数encryptkey
                string encryptkey = context.Request["encryptkey"].ToString();
                //解密易宝支付回调结果
                string callback_result = YJPayUtil.checkYbCallbackResult(data, encryptkey);
                if (callback_result != "验签未通过")
                {
                    //string descstring = AES.Decrypt(data, APIURLConfig.merchantAesKey);
                    Dictionary <string, object> responsePara = callback_result.JsonToDocument <Dictionary <string, object> >();

                    if (!responsePara.IsNull())
                    {
                        result.isPaySuccess = true;
                        result.paymentMoney = AlipayConfig.MoneyFormatDco(responsePara["amount"].ToString());
                        result.orderNumber  = responsePara["orderid"].ToString();
                        result.resultMsg    = "返回成功";
                    }
                }
            }
            catch (Exception err)
            {
                result.resultMsg = err.Message;
            }

            return(result);
        }
Пример #2
0
        /// <summary>
        /// 易宝异步返回
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public YBResponsePara YBCallBack(HttpContext context)
        {
            YBResponsePara result = new YBResponsePara()
            {
                isPaySuccess = false,
                orderNumber = "",
                paymentMoney = 0,
                resultMsg = ""
            };

            try
            {
                
                if (context.Request["data"].IsNull() ||
                    context.Request["encryptkey"].IsNull())
                {
                    result.resultMsg = "回调参数不正确";
                    return result;
                }
                //回调中的参数data
                string data = context.Request["data"].ToString();
                //回调中的参数encryptkey  
                string encryptkey = context.Request["encryptkey"].ToString();
                //解密易宝支付回调结果
                string callback_result = YJPayUtil.checkYbCallbackResult(data, encryptkey);
                if (callback_result != "验签未通过")
                {
                    //string descstring = AES.Decrypt(data, APIURLConfig.merchantAesKey);
                    Dictionary<string, object> responsePara = callback_result.JsonToDocument<Dictionary<string, object>>();

                    if (!responsePara.IsNull())
                    {


                        result.isPaySuccess = true;
                        result.paymentMoney = AlipayConfig.MoneyFormatDco(responsePara["amount"].ToString());
                        result.orderNumber = responsePara["orderid"].ToString();
                        result.resultMsg = "返回成功";
                    }
                }
            }
            catch (Exception err)
            {
                result.resultMsg = err.Message;
            }

            return result;
        }