Esempio n. 1
0
        public async Task <string> SendPostRequestAsync(FubeiBizParam param)
        {
            var requestParam = _fubeiSignatureService.GenerateFubeiRequestParam(param);
            var url          = _applicationConfiguration.Api;

            return(await HttpUtil.PostRequest(url, requestParam));
        }
Esempio n. 2
0
        public async Task <T> SendPostRequestAsync <T>(FubeiBizParam param)
        {
            var requestParam = _fubeiSignatureService.GenerateFubeiRequestParam(param);
            var url          = _applicationConfiguration.Api;
            var json         = await HttpUtil.PostRequest(url, requestParam);

            return(JsonConvert.DeserializeObject <T>(json));
        }
        /// <summary>
        /// 生成付呗请求参数(带签名)
        /// </summary>
        /// <param name="bizParam">业务数据</param>
        /// <returns></returns>
        public FubeiRequestParam GenerateFubeiRequestParam(FubeiBizParam bizParam)
        {
            var requestParam = new FubeiRequestParam
            {
                AppId      = _applicationConfiguration.AppId,
                AppSecret  = _applicationConfiguration.AppSecret,
                BizContent = JsonConvert.SerializeObject(bizParam, Formatting.Indented, AppJsonSerializeSettings.IgnoreNullvalueHandling),
                Nonce      = RandomStringUtil.RandomAlphanumeric(32),
                Method     = bizParam.Method
            };

            // 对请求参数进行签名
            FubeiSignatureUtil.DoSign(ref requestParam);
            return(requestParam);
        }
Esempio n. 4
0
 protected async Task <FubeiApiCommonResult <T> > PostRequestAsync <T>(FubeiBizParam obj) where T : new()
 {
     return(await FubeiApiRequestService.SendPostRequestAsync <FubeiApiCommonResult <T> >(obj));
 }