Exemple #1
0
        /// <summary>
        /// 还款界面
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        public async Task <RepaymentRsp> DianRongRepayment(RepaymentReq req)
        {
            req.NotNull("请求参数");
            req.Phone.NotNull("手机号");
            var channelId = configModel.ChannelId;
            var randomStr = DianrongHelper.GetRandomStr();
            // randomStr = "6rCnR0dVCVw=";
            var nonce   = DianrongHelper.GetNonce(randomStr, false);
            var reqData = new Dictionary <string, object>()
            {
                { "encryptPhone", req.Phone }, { "channelId", channelId }
            };
            var encryptReqData = DianrongHelper.GetReqData(reqData, randomStr);
            var sign           = JsonConvert.SerializeObject(reqData, Formatting.None).GetMd5String(true);
            var reqData2       = new Dictionary <string, string>()
            {
                { "encryptReqData", encryptReqData },
                { "sign", sign }
            };
            var encryptData = DianrongHelper.GetReqData(reqData2, randomStr);

            return(new RepaymentRsp()
            {
                BaseUrl = configModel.GetRepaymentUrl,
                ChannelId = channelId,
                Encrypt = WebUtility.UrlEncode(encryptData),
                Nonce = WebUtility.UrlEncode(nonce)
            });
        }
Exemple #2
0
        public async Task <IActionResult> GetRepaymentUrl([FromBody] RepaymentReq req)
        {
            var rst = await dianrongService.DianRongRepayment(req);

            return(Ok(rst));
        }