コード例 #1
0
        private AlipayDictionary SerializeBizModel <T>(AlipayDictionary requestParams, IAlipayRequest <T> request) where T : AlipayResponse
        {
            var result            = requestParams;
            var isBizContentEmpty = !requestParams.ContainsKey(AlipayConstants.BIZ_CONTENT) || string.IsNullOrEmpty(requestParams[AlipayConstants.BIZ_CONTENT]);
            var bizModel          = request.GetBizModel();

            if (isBizContentEmpty && bizModel != null)
            {
                var content = JsonSerializer.Serialize(bizModel, bizModel.GetType(), _jsonSerializerOptions);
                result.Add(AlipayConstants.BIZ_CONTENT, content);
            }

            return(result);
        }
コード例 #2
0
        private AlipayDictionary SerializeBizModel <T>(AlipayDictionary requestParams, IAlipayRequest <T> request) where T : AlipayResponse
        {
            var result            = requestParams;
            var isBizContentEmpty = !requestParams.ContainsKey(BIZ_CONTENT) || string.IsNullOrEmpty(requestParams[BIZ_CONTENT]);
            var bizModel          = request.GetBizModel();

            if (isBizContentEmpty && bizModel != null)
            {
                var content = JsonConvert.SerializeObject(bizModel, jsonSerializerSettings);
                result.Add(BIZ_CONTENT, content);
            }

            return(result);
        }