public async Task <ServiceMoneyList> DeleteServiceMoneyList(ServiceMoneyList ServiceMoneyListInfo)
 {
     return(await _repository.UpdateAsync(ServiceMoneyListInfo));
 }
Exemple #2
0
        /// <summary>
        /// 患者微信支付下订单
        /// </summary>
        /// <returns></returns>
        public async Task <TencentJSPayRequestModel> UnifiedorderAsync(bool sharing, string spbillCreateIp, YaeherConsultation consul, YaeherUser user, ServiceMoneyList product, SystemConfigs tencentparam)
        {
            TencentJSPayRequestModel jspay = new TencentJSPayRequestModel();

            try
            {
                TenPayV3Info tenPayV3Info = new TenPayV3Info(tencentparam.AppID, tencentparam.AppSecret, tencentparam.TenPayMchId, tencentparam.TenPayKey, tencentparam.TenPayNotify, tencentparam.TenPayWxOpenNotify);

                //生成订单10位序列号,此处用时间和随机数生成,商户根据自己调整,保证唯一
                //  var timestamp = DateTime.Now.ToString("yyyyMMddHHmmss");
                // var sjs =;//随机数
                var sjs       = consul.ConsultNumber.Substring(3, consul.ConsultNumber.Length - 3) + TenPayV3Util.BuildRandomStr(6);
                var sp_billno = sjs;
                //   var sp_billno = string.Format("{0}{1}", sjs, user.Id);
                var shortbillno = sp_billno;

                TenPayInfo tenPayInfo = new TenPayInfo();
                //   var body = product == null ? "怡芽问诊" : product.DoctorName+"医生" + product.ServiceType;
                var body      = "怡禾健康咨询";
                var price     = product == null ? 100 : (int)(product.ServiceExpense * 100);//单位:分
                var timeStamp = TenPayV3Util.GetTimestamp();
                var nonceStr  = TenPayV3Util.GetNoncestr();

                var xmlDataInfo = new TenPayV3UnifiedorderRequestData(tenPayV3Info.AppId, tenPayV3Info.MchId, body, sp_billno, price, spbillCreateIp, tenPayV3Info.TenPayV3Notify, TenPayV3Type.JSAPI, user.WecharOpenID, tenPayV3Info.Key, nonceStr);
                //CreateWrite("C:\\回调.txt", "订单参数:" + JsonHelper.ToJson(xmlDataInfo));
                var result = await UnifiedorderAsync(xmlDataInfo, sharing? "Y" : "N"); //调用统一订单接口

                //JsSdkUiPackage jsPackage = new JsSdkUiPackage(TenPayV3Info.AppId, timeStamp, nonceStr,);

                if (result.IsResultCodeSuccess())
                {
                    var package = string.Format("prepay_id={0}", result.prepay_id);
                    var paysign = TenPayV3.GetJsPaySign(tenPayV3Info.AppId, timeStamp, nonceStr, package, tenPayV3Info.Key);

                    jspay.product   = product;
                    jspay.timeStamp = timeStamp;
                    jspay.nonceStr  = nonceStr;
                    jspay.package   = package;
                    jspay.paySign   = paysign;
                    jspay.appid     = tenPayV3Info.AppId;
                    jspay.sp_billno = shortbillno;
                    jspay.code      = result.result_code;
                    jspay.msg       = result.return_msg;
                }
                else
                {
                    jspay.code = result.result_code;
                    jspay.msg  = result.return_msg;
                }
            }
            catch (Exception ex)
            {
                jspay.code = "FAIL";
                jspay.msg  = ex.Message.ToString();
            }
            return(jspay);
        }
        public async Task <ServiceMoneyList> CreateServiceMoneyList(ServiceMoneyList ServiceMoneyListInfo)
        {
            ServiceMoneyListInfo.Id = await _repository.InsertAndGetIdAsync(ServiceMoneyListInfo);

            return(ServiceMoneyListInfo);
        }