Пример #1
0
 /// <summary>
 ///     支付回调通知处理
 /// </summary>
 /// <param name="dic"></param>
 /// <returns></returns>
 public bool PayNotifyHandler(Dictionary <string, string> dic)
 {
     try
     {
         var allinpayKey = _allinpaySettings.AppKey;
         if (!dic.ContainsKey("sign"))//如果不包含sign,则不进行处理
         {
             LoggerAction?.Invoke("Error", "sign is null");
             return(false);
         }
         return(AllinpayUtil.ValidSign(dic, allinpayKey));
     }
     catch (Exception e)
     {
         LoggerAction?.Invoke("Error", e.Message);
         return(false);
     }
 }
        public AllinpayResponse WeChatMiniPay(WeChatMiniPayInput input)
        {
            var paramDic = BuildBasicParam();

            paramDic.Add("trxamt", input.Amount.ToString());
            paramDic.Add("reqsn", input.OrderNumber);
            paramDic.Add("paytype", "W06");
            paramDic.Add("body", input.Body);
            paramDic.Add("remark", input.Remark);
            paramDic.Add("acct", input.OpenId);
            paramDic.Add("sub_appid", _allinpaySettings.WeChatAppId);
            paramDic.Add("notify_url", _allinpaySettings.NotifyUrl);
            paramDic.Add("validtime", input.ValidTime);
            paramDic.Add("sign", AllinpayUtil.SignParam(paramDic, _allinpaySettings.AppKey));
            var result   = HttpRequestUtil.PostAsync($"{_allinpaySettings.ApiGateWay}/pay", paramDic).Result;
            var response = JsonConvert.DeserializeObject <AllinpayResponse>(result);

            return(response);
        }