From 78de0f5c0f667552b6bfa089bd081c69a6b97598 Mon Sep 17 00:00:00 2001 From: gdlcf88 <47396430@qq.com> Date: Sun, 10 May 2020 11:22:15 +0800 Subject: [PATCH] Fix XmlDocument usage. --- modules/EasyAbp.EShop.Baskets/common.props | 2 +- modules/EasyAbp.EShop.Orders/common.props | 2 +- .../common.props | 2 +- .../WeChatPay/EShopWeChatPayHandler.cs | 8 ++++---- .../WeChatPayPaymentServiceProvider.cs | 18 +++++++++--------- modules/EasyAbp.EShop.Payments/common.props | 2 +- modules/EasyAbp.EShop.Products/common.props | 2 +- modules/EasyAbp.EShop.Stores/common.props | 2 +- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/modules/EasyAbp.EShop.Baskets/common.props b/modules/EasyAbp.EShop.Baskets/common.props index 81f31d0a..3abf4b4a 100644 --- a/modules/EasyAbp.EShop.Baskets/common.props +++ b/modules/EasyAbp.EShop.Baskets/common.props @@ -1,7 +1,7 @@ latest - 0.1.9 + 0.1.10 $(NoWarn);CS1591 true EasyAbp Team diff --git a/modules/EasyAbp.EShop.Orders/common.props b/modules/EasyAbp.EShop.Orders/common.props index 81f31d0a..3abf4b4a 100644 --- a/modules/EasyAbp.EShop.Orders/common.props +++ b/modules/EasyAbp.EShop.Orders/common.props @@ -1,7 +1,7 @@ latest - 0.1.9 + 0.1.10 $(NoWarn);CS1591 true EasyAbp Team diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/common.props b/modules/EasyAbp.EShop.Payments.WeChatPay/common.props index 80da1d4e..b234022e 100644 --- a/modules/EasyAbp.EShop.Payments.WeChatPay/common.props +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/common.props @@ -1,7 +1,7 @@ latest - 0.1.9 + 0.1.10 $(NoWarn);CS1591 true EasyAbp Team diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain/EasyAbp/EShop/Payments/WeChatPay/EShopWeChatPayHandler.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain/EasyAbp/EShop/Payments/WeChatPay/EShopWeChatPayHandler.cs index 55b8c744..28a213cd 100644 --- a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain/EasyAbp/EShop/Payments/WeChatPay/EShopWeChatPayHandler.cs +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain/EasyAbp/EShop/Payments/WeChatPay/EShopWeChatPayHandler.cs @@ -33,21 +33,21 @@ namespace EasyAbp.EShop.Payments.WeChatPay var xml = xmlDocument.SelectSingleNode("xml") ?? throw new XmlDocumentMissingRequiredElementException("xml"); - if (xml.SelectSingleNode("return_code")?.Value != "SUCCESS") + if (xml.SelectSingleNode("return_code")?.InnerText != "SUCCESS") { return; } // Todo: sign check - if (xml.SelectSingleNode("result_code")?.Value == "SUCCESS") + if (xml.SelectSingleNode("result_code")?.InnerText == "SUCCESS") { - var orderId = Guid.Parse(xml.SelectSingleNode("out_trade_no")?.Value ?? + var orderId = Guid.Parse(xml.SelectSingleNode("out_trade_no")?.InnerText ?? throw new XmlDocumentMissingRequiredElementException("out_trade_no")); var payment = await _paymentRepository.GetAsync(orderId); - payment.SetExternalTradingCode(xml.SelectSingleNode("transaction_id")?.Value ?? + payment.SetExternalTradingCode(xml.SelectSingleNode("transaction_id")?.InnerText ?? throw new XmlDocumentMissingRequiredElementException("transaction_id")); payment.CompletePayment(_clock.Now); diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain/EasyAbp/EShop/Payments/WeChatPay/WeChatPayPaymentServiceProvider.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain/EasyAbp/EShop/Payments/WeChatPay/WeChatPayPaymentServiceProvider.cs index 52f8da66..0f0a8cc2 100644 --- a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain/EasyAbp/EShop/Payments/WeChatPay/WeChatPayPaymentServiceProvider.cs +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain/EasyAbp/EShop/Payments/WeChatPay/WeChatPayPaymentServiceProvider.cs @@ -81,21 +81,21 @@ namespace EasyAbp.EShop.Payments.WeChatPay var xml = result.SelectSingleNode("xml") ?? throw new UnifiedOrderFailedException(); - if (xml.SelectSingleNode("return_code")?.Value != "SUCCESS") + if (xml.SelectSingleNode("return_code")?.InnerText != "SUCCESS") { - throw new UnifiedOrderFailedException(xml.SelectSingleNode("return_code")?.Value, xml.SelectSingleNode("return_msg")?.Value); + throw new UnifiedOrderFailedException(xml.SelectSingleNode("return_code")?.InnerText, xml.SelectSingleNode("return_msg")?.InnerText); } - if (xml.SelectSingleNode("result_code")?.Value != "SUCCESS") + if (xml.SelectSingleNode("result_code")?.InnerText != "SUCCESS") { - throw new UnifiedOrderFailedException(xml.SelectSingleNode("return_code")?.Value, - xml.SelectSingleNode("return_msg")?.Value, xml.SelectSingleNode("err_code_des")?.Value, - xml.SelectSingleNode("err_code")?.Value); + throw new UnifiedOrderFailedException(xml.SelectSingleNode("return_code")?.InnerText, + xml.SelectSingleNode("return_msg")?.InnerText, xml.SelectSingleNode("err_code_des")?.InnerText, + xml.SelectSingleNode("err_code")?.InnerText); } - payment.SetProperty("trade_type", xml.SelectSingleNode("trade_type")); - payment.SetProperty("prepay_id", xml.SelectSingleNode("prepay_id")); - payment.SetProperty("code_url", xml.SelectSingleNode("code_url")); + payment.SetProperty("trade_type", xml.SelectSingleNode("trade_type")?.InnerText); + payment.SetProperty("prepay_id", xml.SelectSingleNode("prepay_id")?.InnerText); + payment.SetProperty("code_url", xml.SelectSingleNode("code_url")?.InnerText); return await _paymentRepository.UpdateAsync(payment, true); } diff --git a/modules/EasyAbp.EShop.Payments/common.props b/modules/EasyAbp.EShop.Payments/common.props index 81f31d0a..3abf4b4a 100644 --- a/modules/EasyAbp.EShop.Payments/common.props +++ b/modules/EasyAbp.EShop.Payments/common.props @@ -1,7 +1,7 @@ latest - 0.1.9 + 0.1.10 $(NoWarn);CS1591 true EasyAbp Team diff --git a/modules/EasyAbp.EShop.Products/common.props b/modules/EasyAbp.EShop.Products/common.props index 81f31d0a..3abf4b4a 100644 --- a/modules/EasyAbp.EShop.Products/common.props +++ b/modules/EasyAbp.EShop.Products/common.props @@ -1,7 +1,7 @@ latest - 0.1.9 + 0.1.10 $(NoWarn);CS1591 true EasyAbp Team diff --git a/modules/EasyAbp.EShop.Stores/common.props b/modules/EasyAbp.EShop.Stores/common.props index 81f31d0a..3abf4b4a 100644 --- a/modules/EasyAbp.EShop.Stores/common.props +++ b/modules/EasyAbp.EShop.Stores/common.props @@ -1,7 +1,7 @@ latest - 0.1.9 + 0.1.10 $(NoWarn);CS1591 true EasyAbp Team