예제 #1
0
        public async Task <ActionResult> YeePayNotifyUrl()
        {
            try
            {
                if (Request["data"] == null)
                {
                    return(Content("参数不正确"));
                }
                //商户注意:接收到易宝的回调信息后一定要回写success用以保证握手成功!
                string data = Request["data"].ToString(); //回调中的参数data
                data = AESUtil.Decrypt(data, YeePayConfig.merchantKey);
                PayResultJson result = Newtonsoft.Json.JsonConvert.DeserializeObject <PayResultJson>(data);

                ///支付结果回调验签
                bool r = Digest.PayResultVerifyHMAC(result.customernumber, result.requestid, result.code, result.notifytype, result.externalid, result.amount, result.cardno, YeePayConfig.merchantKey, result.hmac);
                if (r && result.code == 1)
                {
                    //var opResult = await OrderContract.PayOrder(result.requestid, PayType.易宝);
                    //if (opResult.ResultType == OperationResultType.Success)
                    //{
                    //    return Content("SUCCESS");
                    //}
                }
                return(Content("FAIL"));
            }
            catch
            {
                return(Content("支付失败!"));
            }
        }