Skip to content

Commit

Permalink
Merge pull request #110 from EasyAbp/revert-109-payment-event-handler…
Browse files Browse the repository at this point in the history
…-base-classes

Revert "Add payment event handler base classes"
  • Loading branch information
gdlcf88 authored Apr 13, 2024
2 parents 9e19660 + b5657a5 commit a7a4ee7
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 689 deletions.
2 changes: 1 addition & 1 deletion common.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Version>3.0.1</Version>
<Version>3.0.0</Version>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>EasyAbp Team</Authors>
Expand Down
12 changes: 8 additions & 4 deletions docs/WeChatPay.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,11 @@ public override void ConfigureServices (ServiceConfigurationContext context)
用户如果需要对支付结果进行处理,只需要实现一个或多个 `IWeChatPayEventHandler` 处理器即可。当框架接受到微信通知时,会触发开发人员编写的处理器,并将微信结果传递给这些处理器。

```csharp
public class PaidWeChatPayEventHandler : WeChatPayPaidEventHandlerBase
public class PaidWeChatPayEventHandler : IWeChatPayEventHandler<QueryOrderResponse>
{
public Task<WeChatRequestHandlingResult> HandleAsync(WeChatPayEventModel<WeChatPayPaidEventModel> model)
public WeChatHandlerType Type => WeChatHandlerType.Paid;

public Task<WeChatRequestHandlingResult> HandleAsync(WeChatPayEventModel<QueryOrderResponse> model)
{
Console.WriteLine("支付成功。");
return Task.FromResult(new WeChatRequestHandlingResult(true));
Expand Down Expand Up @@ -173,9 +175,11 @@ WeChatPay 模块默认提供了参数校验处理器,各个处理器的调用
用户如果需要对退款通知进行处理,只需要实现一个或多个 `IWeChatPayEventHandler` 处理器即可。当框架接受到微信通知时,会触发开发人员编写的处理器,并将微信结果传递给这些处理器。

```csharp
public class RefundWeChatPayEventHandler : WeChatPayRefundEventHandlerBase
public class RefundWeChatPayEventHandler : IWeChatPayEventHandler<RefundOrderResponse>
{
public Task<WeChatRequestHandlingResult> HandleAsync(WeChatPayEventModel<WeChatPayRefundEventModel> model)
public WeChatHandlerType Type => WeChatHandlerType.Refund;

public Task<WeChatRequestHandlingResult> HandleAsync(WeChatPayEventModel<RefundOrderResponse> model)
{
Console.WriteLine("退款成功。");
return Task.FromResult(new WeChatRequestHandlingResult(true));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ namespace EasyAbp.Abp.WeChat.Pay.RequestHandling
/// <summary>
/// 定义了微信支付回调处理器。
/// </summary>
public interface IWeChatPayEventHandler<TEventModel>
public interface IWeChatPayEventHandler<TResource>
{
WeChatHandlerType Type { get; }

Task<WeChatRequestHandlingResult> HandleAsync(WeChatPayEventModel<TEventModel> model);
Task<WeChatRequestHandlingResult> HandleAsync(WeChatPayEventModel<TResource> model);
}
}
Loading

0 comments on commit a7a4ee7

Please sign in to comment.