Exemplo n.º 1
0
        private ResponseParseItem ParseRespItem <T>(IAlipayRequest <T> request, string respBody, IAlipayParser <T> parser, string encryptKey, string encryptType) where T : AlipayResponse
        {
            try
            {
                logger?.LogDebug($"{DateTime.Now} 支付宝ParseRespItem");

                string realContent = null;

                if (request.GetNeedEncrypt())
                {
                    realContent = parser.EncryptSourceData(request, respBody, encryptType, encryptKey);
                }
                else
                {
                    realContent = respBody;
                }

                var item = new ResponseParseItem()
                {
                    realContent = realContent,
                    respContent = respBody
                };
                return(item);
            }
            catch (Exception ex)
            {
                logger?.LogError($"{DateTime.Now} 支付宝ParseRespItem报错", ex.Message);
                return(null);
            }
        }
Exemplo n.º 2
0
        private ResponseParseItem ParseRespItem <T>(IAlipayRequest <T> request, string respBody, IAlipayParser <T> parser, string encryptKey, string encryptType) where T : AlipayResponse
        {
            string realContent;

            if (request.GetNeedEncrypt())
            {
                realContent = parser.EncryptSourceData(request, respBody, encryptType, encryptKey);
            }
            else
            {
                realContent = respBody;
            }

            return(new ResponseParseItem
            {
                RealContent = realContent,
                RespContent = respBody
            });
        }