diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/BusinessCircle/MallRefundResource.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/BusinessCircle/MallRefundResource.cs
similarity index 96%
rename from src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/BusinessCircle/MallRefundResource.cs
rename to src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/BusinessCircle/MallRefundResource.cs
index d431a418..92a8f8ee 100644
--- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/BusinessCircle/MallRefundResource.cs
+++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/BusinessCircle/MallRefundResource.cs
@@ -1,12 +1,12 @@
using System;
using System.Collections.Generic;
-namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Resources
+namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Events
{
///
/// 表示 MALL_REFUND.SUCCESS 通知的数据。
///
- public class MallRefundResource : WechatTenpayCallback.Types.IDecryptedResource
+ public class MallRefundResource : WechatTenpayEvent.Types.IDecryptedResource
{
///
/// 获取或设置微信商户号。
diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/BusinessCircle/MallTransactionResource.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/BusinessCircle/MallTransactionResource.cs
similarity index 95%
rename from src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/BusinessCircle/MallTransactionResource.cs
rename to src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/BusinessCircle/MallTransactionResource.cs
index 20cc362b..e3416a14 100644
--- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/BusinessCircle/MallTransactionResource.cs
+++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/BusinessCircle/MallTransactionResource.cs
@@ -1,12 +1,12 @@
using System;
using System.Collections.Generic;
-namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Resources
+namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Events
{
///
/// 表示 MALL_TRANSACTION.SUCCESS 通知的数据。
///
- public class MallTransactionResource : WechatTenpayCallback.Types.IDecryptedResource
+ public class MallTransactionResource : WechatTenpayEvent.Types.IDecryptedResource
{
///
/// 获取或设置微信商户号。
diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/CombineTransactions/CombineTransactionResource.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/CombineTransactions/CombineTransactionResource.cs
similarity index 94%
rename from src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/CombineTransactions/CombineTransactionResource.cs
rename to src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/CombineTransactions/CombineTransactionResource.cs
index 9d8184bf..5480aac1 100644
--- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/CombineTransactions/CombineTransactionResource.cs
+++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/CombineTransactions/CombineTransactionResource.cs
@@ -1,12 +1,12 @@
using System;
using System.Collections.Generic;
-namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Resources
+namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Events
{
///
/// 表示 TRANSACTION.SUCCESS 通知的数据。
///
- public class CombineTransactionResource : WechatTenpayCallback.Types.IDecryptedResource
+ public class CombineTransactionResource : WechatTenpayEvent.Types.IDecryptedResource
{
public static class Types
{
diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/DiscountCard/DiscountCardResource.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/DiscountCard/DiscountCardResource.cs
similarity index 97%
rename from src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/DiscountCard/DiscountCardResource.cs
rename to src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/DiscountCard/DiscountCardResource.cs
index 5ec84b82..9bb006fa 100644
--- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/DiscountCard/DiscountCardResource.cs
+++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/DiscountCard/DiscountCardResource.cs
@@ -1,14 +1,14 @@
using System;
using System.Collections.Generic;
-namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Resources
+namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Events
{
///
/// 表示 DISCOUNT_CARD.USER_ACCEPTED 通知的数据。
/// 表示 DISCOUNT_CARD.AGREEMENT_ENDED 通知的数据。
/// 表示 DISCOUNT_CARD.USER_PAID 通知的数据。
///
- public class DiscountCardResource : WechatTenpayCallback.Types.IDecryptedResource
+ public class DiscountCardResource : WechatTenpayEvent.Types.IDecryptedResource
{
public static class Types
{
diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/MarketingBusifavor/MarketingBusifavorCouponResource.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/MarketingBusifavor/MarketingBusifavorCouponResource.cs
similarity index 98%
rename from src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/MarketingBusifavor/MarketingBusifavorCouponResource.cs
rename to src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/MarketingBusifavor/MarketingBusifavorCouponResource.cs
index 2a779619..d3a12614 100644
--- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/MarketingBusifavor/MarketingBusifavorCouponResource.cs
+++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/MarketingBusifavor/MarketingBusifavorCouponResource.cs
@@ -1,12 +1,12 @@
using System;
using System.Collections.Generic;
-namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Resources
+namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Events
{
///
/// 表示 COUPON.SEND 通知的数据。
///
- public class MarketingBusifavorCouponResource : WechatTenpayCallback.Types.IDecryptedResource
+ public class MarketingBusifavorCouponResource : WechatTenpayEvent.Types.IDecryptedResource
{
public static class Types
{
diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/MarketingFavor/MarketingFavorCouponResource.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/MarketingFavor/MarketingFavorCouponResource.cs
similarity index 97%
rename from src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/MarketingFavor/MarketingFavorCouponResource.cs
rename to src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/MarketingFavor/MarketingFavorCouponResource.cs
index b53f2b38..9038d1a7 100644
--- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/MarketingFavor/MarketingFavorCouponResource.cs
+++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/MarketingFavor/MarketingFavorCouponResource.cs
@@ -1,12 +1,12 @@
using System;
using System.Collections.Generic;
-namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Resources
+namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Events
{
///
/// 表示 COUPON.USE 通知的数据。
///
- public class MarketingFavorCouponResource : WechatTenpayCallback.Types.IDecryptedResource
+ public class MarketingFavorCouponResource : WechatTenpayEvent.Types.IDecryptedResource
{
public static class Types
{
diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/MerchantService/ComplaintResource.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/MerchantService/ComplaintResource.cs
similarity index 84%
rename from src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/MerchantService/ComplaintResource.cs
rename to src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/MerchantService/ComplaintResource.cs
index 41681b34..93333eb7 100644
--- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/MerchantService/ComplaintResource.cs
+++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/MerchantService/ComplaintResource.cs
@@ -1,13 +1,13 @@
using System;
using System.Collections.Generic;
-namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Resources
+namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Events
{
///
/// 表示 COMPLAINT.CREATE 通知的数据。
/// 表示 COMPLAINT.STATE_CHANGE 通知的数据。
///
- public class ComplaintResource : WechatTenpayCallback.Types.IDecryptedResource
+ public class ComplaintResource : WechatTenpayEvent.Types.IDecryptedResource
{
///
/// 获取或设置投诉单号。
diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/PayPartnerTransactions/PartnerRefundResource.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/PayPartnerTransactions/PartnerRefundResource.cs
similarity index 96%
rename from src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/PayPartnerTransactions/PartnerRefundResource.cs
rename to src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/PayPartnerTransactions/PartnerRefundResource.cs
index b94e717a..e07f08d5 100644
--- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/PayPartnerTransactions/PartnerRefundResource.cs
+++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/PayPartnerTransactions/PartnerRefundResource.cs
@@ -1,14 +1,14 @@
using System;
using System.Collections.Generic;
-namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Resources
+namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Events
{
///
/// 表示 REFUND.SUCCESS (仅服务商)通知的数据。
/// 表示 REFUND.ABNORMAL (仅服务商)通知的数据。
/// 表示 REFUND.CLOSED (仅服务商)通知的数据。
///
- public class PartnerRefundResource : WechatTenpayCallback.Types.IDecryptedResource
+ public class PartnerRefundResource : WechatTenpayEvent.Types.IDecryptedResource
{
public static class Types
{
diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/PayPartnerTransactions/PartnerTransactionResource.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/PayPartnerTransactions/PartnerTransactionResource.cs
similarity index 97%
rename from src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/PayPartnerTransactions/PartnerTransactionResource.cs
rename to src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/PayPartnerTransactions/PartnerTransactionResource.cs
index 71b04c7e..9b65d2ce 100644
--- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/PayPartnerTransactions/PartnerTransactionResource.cs
+++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/PayPartnerTransactions/PartnerTransactionResource.cs
@@ -1,12 +1,12 @@
using System;
using System.Collections.Generic;
-namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Resources
+namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Events
{
///
/// 表示 TRANSACTION.SUCCESS (仅限服务商)通知的数据。
///
- public class PartnerTransactionResource : WechatTenpayCallback.Types.IDecryptedResource
+ public class PartnerTransactionResource : WechatTenpayEvent.Types.IDecryptedResource
{
public static class Types
{
diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/PayScorePartnerPermissions/PayScorePartnerPermissionsResource.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/PayScorePartnerPermissions/PayScorePartnerPermissionsResource.cs
similarity index 97%
rename from src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/PayScorePartnerPermissions/PayScorePartnerPermissionsResource.cs
rename to src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/PayScorePartnerPermissions/PayScorePartnerPermissionsResource.cs
index c000df75..a533b38c 100644
--- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/PayScorePartnerPermissions/PayScorePartnerPermissionsResource.cs
+++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/PayScorePartnerPermissions/PayScorePartnerPermissionsResource.cs
@@ -1,13 +1,13 @@
using System;
using System.Collections.Generic;
-namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Resources
+namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Events
{
///
/// 表示 PAYSCORE.USER_OPEN_SERVICE 通知的数据。
/// 表示 PAYSCORE.USER_CLOSE_SERVICE 通知的数据。
///
- public class PayScorePartnerPermissionsResource : WechatTenpayCallback.Types.IDecryptedResource
+ public class PayScorePartnerPermissionsResource : WechatTenpayEvent.Types.IDecryptedResource
{
///
/// 获取或设置服务商商户号。
diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/PayScorePartnerServiceOrder/PayScorePartnerServiceOrderResource.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/PayScorePartnerServiceOrder/PayScorePartnerServiceOrderResource.cs
similarity index 98%
rename from src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/PayScorePartnerServiceOrder/PayScorePartnerServiceOrderResource.cs
rename to src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/PayScorePartnerServiceOrder/PayScorePartnerServiceOrderResource.cs
index 35c4d8ad..cdcbc7e0 100644
--- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/PayScorePartnerServiceOrder/PayScorePartnerServiceOrderResource.cs
+++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/PayScorePartnerServiceOrder/PayScorePartnerServiceOrderResource.cs
@@ -1,13 +1,13 @@
using System;
using System.Collections.Generic;
-namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Resources
+namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Events
{
///
/// 表示 PAYSCORE.USER_CONFIRM 通知的数据。
/// 表示 PAYSCORE.USER_PAID 通知的数据。
///
- public class PayScorePartnerServiceOrderResource : WechatTenpayCallback.Types.IDecryptedResource
+ public class PayScorePartnerServiceOrderResource : WechatTenpayEvent.Types.IDecryptedResource
{
public static class Types
{
diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/PayScorePermissions/PayScorePermissionsResource.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/PayScorePermissions/PayScorePermissionsResource.cs
similarity index 94%
rename from src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/PayScorePermissions/PayScorePermissionsResource.cs
rename to src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/PayScorePermissions/PayScorePermissionsResource.cs
index c943cb6a..b46dda6d 100644
--- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/PayScorePermissions/PayScorePermissionsResource.cs
+++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/PayScorePermissions/PayScorePermissionsResource.cs
@@ -1,13 +1,13 @@
using System;
using System.Collections.Generic;
-namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Resources
+namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Events
{
///
/// 表示 PAYSCORE.USER_OPEN_SERVICE 通知的数据。
/// 表示 PAYSCORE.USER_CLOSE_SERVICE 通知的数据。
///
- public class PayScorePermissionsResource : WechatTenpayCallback.Types.IDecryptedResource
+ public class PayScorePermissionsResource : WechatTenpayEvent.Types.IDecryptedResource
{
///
/// 获取或设置微信商户号。
diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/PayScoreServiceOrder/PayScoreServiceOrderResource.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/PayScoreServiceOrder/PayScoreServiceOrderResource.cs
similarity index 98%
rename from src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/PayScoreServiceOrder/PayScoreServiceOrderResource.cs
rename to src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/PayScoreServiceOrder/PayScoreServiceOrderResource.cs
index 9c6877eb..7a271259 100644
--- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/PayScoreServiceOrder/PayScoreServiceOrderResource.cs
+++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/PayScoreServiceOrder/PayScoreServiceOrderResource.cs
@@ -1,13 +1,13 @@
using System;
using System.Collections.Generic;
-namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Resources
+namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Events
{
///
/// 表示 PAYSCORE.USER_CONFIRM 通知的数据。
/// 表示 PAYSCORE.USER_PAID 通知的数据。
///
- public class PayScoreServiceOrderResource : WechatTenpayCallback.Types.IDecryptedResource
+ public class PayScoreServiceOrderResource : WechatTenpayEvent.Types.IDecryptedResource
{
public static class Types
{
diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/PayTransactions/TransactionResource.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/PayTransactions/TransactionResource.cs
similarity index 97%
rename from src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/PayTransactions/TransactionResource.cs
rename to src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/PayTransactions/TransactionResource.cs
index b31969ed..6540b364 100644
--- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/PayTransactions/TransactionResource.cs
+++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/PayTransactions/TransactionResource.cs
@@ -1,12 +1,12 @@
using System;
using System.Collections.Generic;
-namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Resources
+namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Events
{
///
/// 表示 TRANSACTION.SUCCESS (仅限直连商户)通知的数据。
///
- public class TransactionResource : WechatTenpayCallback.Types.IDecryptedResource
+ public class TransactionResource : WechatTenpayEvent.Types.IDecryptedResource
{
public static class Types
{
diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/Refund/RefundResource.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/Refund/RefundResource.cs
similarity index 96%
rename from src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/Refund/RefundResource.cs
rename to src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/Refund/RefundResource.cs
index fedd5944..1619507f 100644
--- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Resources/Refund/RefundResource.cs
+++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Events/Refund/RefundResource.cs
@@ -1,14 +1,14 @@
using System;
using System.Collections.Generic;
-namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Resources
+namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Events
{
///
/// 表示 REFUND.SUCCESS (仅直连商户)通知的数据。
/// 表示 REFUND.ABNORMAL (仅直连商户)通知的数据。
/// 表示 REFUND.CLOSED (仅直连商户)通知的数据。
///
- public class RefundResource : WechatTenpayCallback.Types.IDecryptedResource
+ public class RefundResource : WechatTenpayEvent.Types.IDecryptedResource
{
public static class Types
{
diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Exceptions/WechatTenpayCallbackDecryptionException.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Exceptions/WechatTenpayCallbackDecryptionException.cs
deleted file mode 100644
index 62571972..00000000
--- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Exceptions/WechatTenpayCallbackDecryptionException.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using System;
-
-namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Exceptions
-{
- public class WechatTenpayCallbackDecryptionException : WechatTenpayException
- {
- ///
- internal WechatTenpayCallbackDecryptionException()
- {
- }
-
- ///
- internal WechatTenpayCallbackDecryptionException(string message)
- : base(message)
- {
- }
-
- ///
- internal WechatTenpayCallbackDecryptionException(string message, Exception innerException)
- : base(message, innerException)
- {
- }
- }
-}
diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Exceptions/WechatTenpayEventDecryptionException.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Exceptions/WechatTenpayEventDecryptionException.cs
new file mode 100644
index 00000000..8c22cd21
--- /dev/null
+++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Exceptions/WechatTenpayEventDecryptionException.cs
@@ -0,0 +1,24 @@
+using System;
+
+namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Exceptions
+{
+ public class WechatTenpayEventDecryptionException : WechatTenpayException
+ {
+ ///
+ internal WechatTenpayEventDecryptionException()
+ {
+ }
+
+ ///
+ internal WechatTenpayEventDecryptionException(string message)
+ : base(message)
+ {
+ }
+
+ ///
+ internal WechatTenpayEventDecryptionException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+ }
+}
diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientCallbackDeserializationExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientEventExtensions.cs
similarity index 68%
rename from src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientCallbackDeserializationExtensions.cs
rename to src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientEventExtensions.cs
index 2b983938..cabb2dec 100644
--- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientCallbackDeserializationExtensions.cs
+++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientEventExtensions.cs
@@ -5,21 +5,20 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
///
/// 为 提供回调通知事件的扩展方法。
///
- public static class WechatTenpayClientCallbackDeserializationExtensions
+ public static class WechatTenpayClientEventExtensions
{
///
- /// 反序列化得到 对象。
+ /// 反序列化得到 对象。
///
- ///
///
///
///
- public static WechatTenpayCallback DeserializeCallback(this WechatTenpayClient client, string callbackJson)
+ public static WechatTenpayEvent DeserializeEvent(this WechatTenpayClient client, string callbackJson)
{
if (client == null) throw new ArgumentNullException(nameof(client));
if (string.IsNullOrEmpty(callbackJson)) throw new ArgumentNullException(callbackJson);
- return client.JsonSerializer.Deserialize(callbackJson);
+ return client.JsonSerializer.Deserialize(callbackJson);
}
///
@@ -29,13 +28,13 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
///
///
///
- public static T DecryptCallbackResource(this WechatTenpayClient client, WechatTenpayCallback callback)
- where T : WechatTenpayCallback.Types.IDecryptedResource, new()
+ public static T DecryptEventResource(this WechatTenpayClient client, WechatTenpayEvent callback)
+ where T : WechatTenpayEvent.Types.IDecryptedResource, new()
{
if (client == null) throw new ArgumentNullException(nameof(client));
if (callback == null) throw new ArgumentNullException(nameof(callback));
- return DecryptCallbackResource(client, callback.Resource);
+ return DecryptEventResource(client, callback.Resource);
}
///
@@ -45,8 +44,8 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
///
///
///
- public static T DecryptCallbackResource(this WechatTenpayClient client, WechatTenpayCallback.Types.Resource resource)
- where T : WechatTenpayCallback.Types.IDecryptedResource, new()
+ public static T DecryptEventResource(this WechatTenpayClient client, WechatTenpayEvent.Types.Resource resource)
+ where T : WechatTenpayEvent.Types.IDecryptedResource, new()
{
if (client == null) throw new ArgumentNullException(nameof(client));
if (resource == null) throw new ArgumentNullException(nameof(resource));
@@ -66,12 +65,12 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
}
catch (Exception ex)
{
- throw new Exceptions.WechatTenpayCallbackDecryptionException("Decrypt callback failed.", ex);
+ throw new Exceptions.WechatTenpayEventDecryptionException("Decrypt event resource failed.", ex);
}
}
else
{
- throw new Exceptions.WechatTenpayCallbackDecryptionException("Unknown encrypt algorithm of the resource.");
+ throw new Exceptions.WechatTenpayEventDecryptionException("Unknown encrypt algorithm of the resource.");
}
return client.JsonSerializer.Deserialize(plainJson);
diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientResponseDecryptionExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientResponseDecryptionExtensions.cs
index 481e685a..9aa778c9 100644
--- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientResponseDecryptionExtensions.cs
+++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientResponseDecryptionExtensions.cs
@@ -14,12 +14,10 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
/// REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay4_3.shtml
/// REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/wechatpay/wechatpay4_3.shtml
///
- ///
///
///
///
- public static TResponse DecryptResponseEncryptedData(this WechatTenpayClient client, TResponse response)
- where TResponse : WechatTenpayResponse
+ public static Models.GetEcommerceApplymentByOutRequestNumberResponse DecryptResponseEncryptedData(this WechatTenpayClient client, Models.GetEcommerceApplymentByOutRequestNumberResponse response)
{
if (client == null) throw new ArgumentNullException(nameof(client));
if (response == null) throw new ArgumentNullException(nameof(response));
@@ -30,42 +28,6 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
if (!response.IsSuccessful())
throw new Exceptions.WechatTenpayResponseDecryptionException("Decrypt response failed, because of the response is not successful.");
- if (response is Models.GetEcommerceApplymentByOutRequestNumberResponse resGetEcommerceApplymentByOutRequestNumber)
- {
- DecryptResponse(resGetEcommerceApplymentByOutRequestNumber, client.MerchantCertPrivateKey);
- return (resGetEcommerceApplymentByOutRequestNumber as TResponse)!;
- }
- else if (response is Models.GetEcommerceBillFundflowBillResponse resGetEcommerceBillFundflowBill)
- {
- DecryptResponse(resGetEcommerceBillFundflowBill, client.MerchantCertPrivateKey);
- return (resGetEcommerceBillFundflowBill as TResponse)!;
- }
- else if (response is Models.GetMerchantServiceComplaintByComplaintIdResponse resGetMerchantServiceComplaintByComplaintId)
- {
- DecryptResponse(resGetMerchantServiceComplaintByComplaintId, client.MerchantCertPrivateKey);
- return (resGetMerchantServiceComplaintByComplaintId as TResponse)!;
- }
- else if (response is Models.QueryCertificatesResponse resQueryCertificates)
- {
- DecryptResponse(resQueryCertificates, client.MerchantV3Secret);
- return (resQueryCertificates as TResponse)!;
- }
- else if (response is Models.QueryMerchantServiceComplaintsResponse resQueryMerchantServiceComplaints)
- {
- DecryptResponse(resQueryMerchantServiceComplaints, client.MerchantCertPrivateKey);
- return (resQueryMerchantServiceComplaints as TResponse)!;
- }
- else if (response is Models.QuerySmartGuidesResponse resQuerySmartGuides)
- {
- DecryptResponse(resQuerySmartGuides, client.MerchantCertPrivateKey);
- return (resQuerySmartGuides as TResponse)!;
- }
-
- return response;
- }
-
- private static void DecryptResponse(Models.GetEcommerceApplymentByOutRequestNumberResponse response, string privateKey)
- {
if (response.AccountValidation != null)
{
IList exceptions = new List();
@@ -77,7 +39,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
try
{
accountValidationModel.AccountNameEncryptedData = Utilities.RsaUtil.DecryptWithECB(
- privateKey,
+ client.MerchantCertPrivateKey,
accountValidationModel.AccountNameEncryptedData
);
}
@@ -92,7 +54,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
try
{
accountValidationModel.AccountNumberEncryptedData = Utilities.RsaUtil.DecryptWithECB(
- privateKey,
+ client.MerchantCertPrivateKey,
accountValidationModel.AccountNumberEncryptedData!
);
}
@@ -105,10 +67,29 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
if (exceptions.Any())
throw new Exceptions.WechatTenpayResponseDecryptionException("Decrypt response failed.", new AggregateException(exceptions));
}
+
+ return response;
}
- private static void DecryptResponse(Models.GetEcommerceBillFundflowBillResponse response, string privateKey)
+ ///
+ /// 解密响应中返回的敏感数据。该方法会改变传入的响应信息。
+ /// REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay4_3.shtml
+ /// REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/wechatpay/wechatpay4_3.shtml
+ ///
+ ///
+ ///
+ ///
+ public static Models.GetEcommerceBillFundflowBillResponse DecryptResponseEncryptedData(this WechatTenpayClient client, Models.GetEcommerceBillFundflowBillResponse response)
{
+ if (client == null) throw new ArgumentNullException(nameof(client));
+ if (response == null) throw new ArgumentNullException(nameof(response));
+
+ if (string.IsNullOrEmpty(client.MerchantCertPrivateKey))
+ throw new Exceptions.WechatTenpayResponseDecryptionException("Decrypt response failed, because of there is no merchant private key.");
+
+ if (!response.IsSuccessful())
+ throw new Exceptions.WechatTenpayResponseDecryptionException("Decrypt response failed, because of the response is not successful.");
+
if (response.DownloadBillList != null)
{
IList exceptions = new List();
@@ -120,7 +101,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
try
{
downloadBillModel.EncryptKeyEncryptedData = Utilities.RsaUtil.DecryptWithECB(
- privateKey,
+ client.MerchantCertPrivateKey,
downloadBillModel.EncryptKeyEncryptedData
);
}
@@ -134,10 +115,29 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
if (exceptions.Any())
throw new Exceptions.WechatTenpayResponseDecryptionException("Decrypt response failed.", new AggregateException(exceptions));
}
+
+ return response;
}
- private static void DecryptResponse(Models.GetMerchantServiceComplaintByComplaintIdResponse response, string privateKey)
+ ///
+ /// 解密响应中返回的敏感数据。该方法会改变传入的响应信息。
+ /// REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay4_3.shtml
+ /// REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/wechatpay/wechatpay4_3.shtml
+ ///
+ ///
+ ///
+ ///
+ public static Models.GetMerchantServiceComplaintByComplaintIdResponse DecryptResponseEncryptedData(this WechatTenpayClient client, Models.GetMerchantServiceComplaintByComplaintIdResponse response)
{
+ if (client == null) throw new ArgumentNullException(nameof(client));
+ if (response == null) throw new ArgumentNullException(nameof(response));
+
+ if (string.IsNullOrEmpty(client.MerchantCertPrivateKey))
+ throw new Exceptions.WechatTenpayResponseDecryptionException("Decrypt response failed, because of there is no merchant private key.");
+
+ if (!response.IsSuccessful())
+ throw new Exceptions.WechatTenpayResponseDecryptionException("Decrypt response failed, because of the response is not successful.");
+
if (response.ComplaintDetail != null)
{
if (!string.IsNullOrEmpty(response.PayerPhoneEncryptedData))
@@ -145,7 +145,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
try
{
response.PayerPhoneEncryptedData = Utilities.RsaUtil.DecryptWithECB(
- privateKey,
+ client.MerchantCertPrivateKey,
response.PayerPhoneEncryptedData!
);
}
@@ -155,10 +155,29 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
}
}
}
+
+ return response;
}
- private static void DecryptResponse(Models.QueryCertificatesResponse response, string aesKey)
+ ///
+ /// 解密响应中返回的敏感数据。该方法会改变传入的响应信息。
+ /// REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay4_3.shtml
+ /// REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/wechatpay/wechatpay4_3.shtml
+ ///
+ ///
+ ///
+ ///
+ public static Models.QueryCertificatesResponse DecryptResponseEncryptedData(this WechatTenpayClient client, Models.QueryCertificatesResponse response)
{
+ if (client == null) throw new ArgumentNullException(nameof(client));
+ if (response == null) throw new ArgumentNullException(nameof(response));
+
+ if (string.IsNullOrEmpty(client.MerchantV3Secret))
+ throw new Exceptions.WechatTenpayResponseDecryptionException("Decrypt response failed, because of there is no merchant secret.");
+
+ if (!response.IsSuccessful())
+ throw new Exceptions.WechatTenpayResponseDecryptionException("Decrypt response failed, because of the response is not successful.");
+
if (response.CertificateList != null)
{
IList exceptions = new List();
@@ -170,7 +189,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
try
{
certificateModel.EncryptCertificate.CipherText = Utilities.AesUtil.DecryptWithGCM(
- aesKey: aesKey,
+ aesKey: client.MerchantV3Secret,
nonce: certificateModel.EncryptCertificate.Nonce,
associatedData: certificateModel.EncryptCertificate.AssociatedData,
cipherText: certificateModel.EncryptCertificate.CipherText
@@ -190,10 +209,29 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
if (exceptions.Any())
throw new Exceptions.WechatTenpayResponseDecryptionException("Decrypt response failed.", new AggregateException(exceptions));
}
+
+ return response;
}
- private static void DecryptResponse(Models.QueryMerchantServiceComplaintsResponse response, string privateKey)
+ ///
+ /// 解密响应中返回的敏感数据。该方法会改变传入的响应信息。
+ /// REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay4_3.shtml
+ /// REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/wechatpay/wechatpay4_3.shtml
+ ///
+ ///
+ ///
+ ///
+ public static Models.QueryMerchantServiceComplaintsResponse DecryptResponseEncryptedData(this WechatTenpayClient client, Models.QueryMerchantServiceComplaintsResponse response)
{
+ if (client == null) throw new ArgumentNullException(nameof(client));
+ if (response == null) throw new ArgumentNullException(nameof(response));
+
+ if (string.IsNullOrEmpty(client.MerchantCertPrivateKey))
+ throw new Exceptions.WechatTenpayResponseDecryptionException("Decrypt response failed, because of there is no merchant private key.");
+
+ if (!response.IsSuccessful())
+ throw new Exceptions.WechatTenpayResponseDecryptionException("Decrypt response failed, because of the response is not successful.");
+
if (response.ComplaintList != null)
{
IList exceptions = new List();
@@ -205,7 +243,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
try
{
complaintModel.PayerPhoneEncryptedData = Utilities.RsaUtil.DecryptWithECB(
- privateKey,
+ client.MerchantCertPrivateKey,
complaintModel.PayerPhoneEncryptedData!
);
}
@@ -219,10 +257,29 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
if (exceptions.Any())
throw new Exceptions.WechatTenpayResponseDecryptionException("Decrypt response failed.", new AggregateException(exceptions));
}
+
+ return response;
}
- private static void DecryptResponse(Models.QuerySmartGuidesResponse response, string privateKey)
+ ///
+ /// 解密响应中返回的敏感数据。该方法会改变传入的响应信息。
+ /// REF: https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay4_3.shtml
+ /// REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/wechatpay/wechatpay4_3.shtml
+ ///
+ ///
+ ///
+ ///
+ public static Models.QuerySmartGuidesResponse DecryptResponseEncryptedData(this WechatTenpayClient client, Models.QuerySmartGuidesResponse response)
{
+ if (client == null) throw new ArgumentNullException(nameof(client));
+ if (response == null) throw new ArgumentNullException(nameof(response));
+
+ if (string.IsNullOrEmpty(client.MerchantCertPrivateKey))
+ throw new Exceptions.WechatTenpayResponseDecryptionException("Decrypt response failed, because of there is no merchant private key.");
+
+ if (!response.IsSuccessful())
+ throw new Exceptions.WechatTenpayResponseDecryptionException("Decrypt response failed, because of the response is not successful.");
+
if (response.GuideList != null)
{
IList exceptions = new List();
@@ -234,7 +291,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
try
{
guideModel.UserNameEncryptedData = Utilities.RsaUtil.DecryptWithECB(
- privateKey,
+ client.MerchantCertPrivateKey,
guideModel.UserNameEncryptedData
);
}
@@ -249,7 +306,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
try
{
guideModel.UserMobileEncryptedData = Utilities.RsaUtil.DecryptWithECB(
- privateKey,
+ client.MerchantCertPrivateKey,
guideModel.UserMobileEncryptedData
);
}
@@ -263,6 +320,8 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
if (exceptions.Any())
throw new Exceptions.WechatTenpayResponseDecryptionException("Decrypt response failed.", new AggregateException(exceptions));
}
+
+ return response;
}
}
}
diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/WechatTenpayCallback.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/WechatTenpayEvent.cs
similarity index 98%
rename from src/SKIT.FlurlHttpClient.Wechat.TenpayV3/WechatTenpayCallback.cs
rename to src/SKIT.FlurlHttpClient.Wechat.TenpayV3/WechatTenpayEvent.cs
index ff36c268..2dfba023 100644
--- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/WechatTenpayCallback.cs
+++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/WechatTenpayEvent.cs
@@ -6,7 +6,8 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
///
/// 表示微信支付 API 回调通知事件的基类。
///
- public abstract class WechatTenpayCallback
+ [Serializable]
+ public class WechatTenpayEvent
{
public static class Types
{