Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
88573d5
Merge pull request #8 from Varorbc/master
John0King Nov 21, 2017
892c147
Merge pull request #9 from Varorbc/master
John0King Dec 7, 2017
8965a70
Merge pull request #10 from Varorbc/master
John0King Dec 22, 2017
22c5816
Merge pull request #11 from Varorbc/master
John0King Dec 26, 2017
e773f53
Merge pull request #13 from Varorbc/master
John0King Jan 17, 2018
60a5f9c
一些抽象接口的想法
John0King Jan 17, 2018
8f380f7
Merge pull request #14 from Varorbc/2.0.0-alpha
John0King Mar 7, 2018
eb5b163
a few code change
John0King Mar 7, 2018
e94d4ad
concept of IKeyValueProvider
John0King Mar 21, 2018
4f4999c
Merge pull request #15 from Varorbc/2.0.0-alpha
John0King Apr 18, 2018
44a7079
ServiceCollectionExtensions
Apr 18, 2018
3d86ed4
merge
John0King Apr 28, 2018
221ccdb
sync project
John0King Apr 28, 2018
9b52f88
abstractions
John0King Apr 29, 2018
4241fb6
添加 Asp.Net 的 Target
May 3, 2018
a4cbc73
[wip] notifyHub
May 3, 2018
e57f639
修复 DI 的问题,Singleton 的 IGatewayBuilder 配合 Scoped IGatewayProvider 会导…
John0King May 3, 2018
64fc676
修复 nuget 包
John0King May 3, 2018
a68a105
添加新测试
John0King May 4, 2018
b883acf
Merge remote-tracking branch 'varorbc/master' into 2.0.0-alpha
John0King May 4, 2018
458cee4
一点点更改
John0King May 4, 2018
d23dc9a
sync code
John0King Jun 3, 2018
36e27a8
一点点更新
John0King Jun 3, 2018
7b4991e
merge
John0King Jun 3, 2018
253b846
Merge remote-tracking branch 'varorbc/master' into 2.0.0-alpha
John0King Aug 24, 2018
467333a
some idea
John0King Aug 27, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 30 additions & 6 deletions PaySharp.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,22 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PaySharp.Core.Mvc", "src\Pa
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PaySharp.Wechatpay", "src\PaySharp.Wechatpay\PaySharp.Wechatpay.csproj", "{DC8772E4-9F01-4744-93A3-0A795117418C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PaySharp.UnitTest", "test\PaySharp.UnitTest\PaySharp.UnitTest.csproj", "{B9DD57BE-96FC-4F78-99E9-99CEAD33CC5F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PaySharp.Demo", "sample\PaySharp.Demo\PaySharp.Demo.csproj", "{8A0208C0-7046-44A7-A67F-DA122AB280A3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PaySharp.Qpay", "src\PaySharp.Qpay\PaySharp.Qpay.csproj", "{E63F24B7-C8EE-4E92-8897-38FB117CE371}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PaySharp.Demo(Net)", "sample\PaySharp.Demo(Net)\PaySharp.Demo(Net).csproj", "{C5D9D464-563B-44FC-A115-25889A73CA23}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PaySharp.AspNetCore", "src\PaySharp.AspNetCore\PaySharp.AspNetCore.csproj", "{E649A330-1B5C-487B-99F7-208248161B8F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PaySharp.AspNet", "src\PaySharp.AspNet\PaySharp.AspNet.csproj", "{D20AC625-43A7-45A1-A111-81C3EDC7F6A5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{9B98CFC6-581C-4006-ADB5-A757694915EF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PaySharp.UnitTest", "test\PaySharp.UnitTest\PaySharp.UnitTest.csproj", "{909EE2D9-5B9E-444B-91DF-A8E35F4D1076}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PaySharp.AspNetCoreTest", "test\PaySharp.AspNetCoreTest\PaySharp.AspNetCoreTest.csproj", "{7695B8A5-2737-444A-AC7B-09E43B09B9D9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -47,10 +55,6 @@ Global
{DC8772E4-9F01-4744-93A3-0A795117418C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DC8772E4-9F01-4744-93A3-0A795117418C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DC8772E4-9F01-4744-93A3-0A795117418C}.Release|Any CPU.Build.0 = Release|Any CPU
{B9DD57BE-96FC-4F78-99E9-99CEAD33CC5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B9DD57BE-96FC-4F78-99E9-99CEAD33CC5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B9DD57BE-96FC-4F78-99E9-99CEAD33CC5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B9DD57BE-96FC-4F78-99E9-99CEAD33CC5F}.Release|Any CPU.Build.0 = Release|Any CPU
{8A0208C0-7046-44A7-A67F-DA122AB280A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8A0208C0-7046-44A7-A67F-DA122AB280A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8A0208C0-7046-44A7-A67F-DA122AB280A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -63,10 +67,30 @@ Global
{C5D9D464-563B-44FC-A115-25889A73CA23}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C5D9D464-563B-44FC-A115-25889A73CA23}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C5D9D464-563B-44FC-A115-25889A73CA23}.Release|Any CPU.Build.0 = Release|Any CPU
{E649A330-1B5C-487B-99F7-208248161B8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E649A330-1B5C-487B-99F7-208248161B8F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E649A330-1B5C-487B-99F7-208248161B8F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E649A330-1B5C-487B-99F7-208248161B8F}.Release|Any CPU.Build.0 = Release|Any CPU
{D20AC625-43A7-45A1-A111-81C3EDC7F6A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D20AC625-43A7-45A1-A111-81C3EDC7F6A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D20AC625-43A7-45A1-A111-81C3EDC7F6A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D20AC625-43A7-45A1-A111-81C3EDC7F6A5}.Release|Any CPU.Build.0 = Release|Any CPU
{909EE2D9-5B9E-444B-91DF-A8E35F4D1076}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{909EE2D9-5B9E-444B-91DF-A8E35F4D1076}.Debug|Any CPU.Build.0 = Debug|Any CPU
{909EE2D9-5B9E-444B-91DF-A8E35F4D1076}.Release|Any CPU.ActiveCfg = Release|Any CPU
{909EE2D9-5B9E-444B-91DF-A8E35F4D1076}.Release|Any CPU.Build.0 = Release|Any CPU
{7695B8A5-2737-444A-AC7B-09E43B09B9D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7695B8A5-2737-444A-AC7B-09E43B09B9D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7695B8A5-2737-444A-AC7B-09E43B09B9D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7695B8A5-2737-444A-AC7B-09E43B09B9D9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{909EE2D9-5B9E-444B-91DF-A8E35F4D1076} = {9B98CFC6-581C-4006-ADB5-A757694915EF}
{7695B8A5-2737-444A-AC7B-09E43B09B9D9} = {9B98CFC6-581C-4006-ADB5-A757694915EF}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {35DA7CB4-3AB7-45FF-93D2-DBC4760221EF}
EndGlobalSection
Expand Down
22 changes: 22 additions & 0 deletions src/PaySharp.Alipay/DI/PaySharpBuilderExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PaySharp.Abstractions;
using PaySharp.Alipay.DI.fake;

namespace PaySharp.Alipay
{
public static class PaySharpBuilderExtensions
{
public static IPaySharpBuilder AddAlipay(this IPaySharpBuilder builder,Merchant option)
{
builder.AddOption(option);
builder.TryAddService<IAlipayClient, FakeAlipayClient>();
builder.TryAddService<IAlipayListener, FakeAlipayListener>();
builder.TryAddService<AlipayFactory, AlipayFactory>();
return builder;
}
}
}
29 changes: 29 additions & 0 deletions src/PaySharp.Alipay/DI/PaySharpProviderExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using PaySharp.Abstractions;
using PaySharp.Alipay.DI.fake;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PaySharp.Alipay.DI
{
public static class PaySharpProviderExtensions
{
public static IAlipayClient CreateAlipayClient(this IPaySharpProvider provider)
{
var option = provider.GetRequired<Merchant>();
return CreateAlipayClient(provider,option);
}
public static IAlipayClient CreateAlipayClient(this IPaySharpProvider provider,Merchant merchant)
{
var factory = provider.GetRequired<AlipayFactory>();
return factory.CreateClient(merchant);
}

public static IAlipayListener CreateAlipayListener(this IPaySharpProvider provider,Merchant merchant)
{
throw new NotImplementedException();
}
}
}
20 changes: 20 additions & 0 deletions src/PaySharp.Alipay/DI/fake/AlipayFactory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PaySharp.Alipay.DI.fake
{
class AlipayFactory
{
public IAlipayClient CreateClient(Merchant merchant)
{
throw new NotImplementedException();
}
public IAlipayListener CreateListener(Merchant merchant)
{
throw new NotImplementedException();
}
}
}
12 changes: 12 additions & 0 deletions src/PaySharp.Alipay/DI/fake/FakeAlipayClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PaySharp.Alipay.DI.fake
{
class FakeAlipayClient:IAlipayClient
{
}
}
12 changes: 12 additions & 0 deletions src/PaySharp.Alipay/DI/fake/FakeAlipayListener.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PaySharp.Alipay.DI.fake
{
class FakeAlipayListener:IAlipayListener
{
}
}
12 changes: 12 additions & 0 deletions src/PaySharp.Alipay/DI/fake/IAlipayClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PaySharp.Alipay.DI.fake
{
public interface IAlipayClient
{
}
}
12 changes: 12 additions & 0 deletions src/PaySharp.Alipay/DI/fake/IAlipayListener.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PaySharp.Alipay.DI.fake
{
public interface IAlipayListener
{
}
}
8 changes: 7 additions & 1 deletion src/PaySharp.Alipay/Merchant.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
using PaySharp.Core;
using PaySharp.Abstractions;
using System;
using System.ComponentModel.DataAnnotations;

namespace PaySharp.Alipay
{
public class Merchant : IMerchant
public class Merchant : IMerchant,IPaySharpOption
{
private string _name;
public string Name {
get => _name ?? AppId;
set => _name = value;
}
#region 属性

/// <summary>
Expand Down
82 changes: 82 additions & 0 deletions src/PaySharp.AspNet/HttpContextKeyValueProvider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
using PaySharp.Abstractions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;

namespace PaySharp.AspNetCore
{
/// <summary>
/// Asp.Net 的键值提供器
/// </summary>
public class HttpContextKeyValueProvider : IKeyValueProvider
{
public HttpContextBase HttpContext { get; }

public IEnumerable<string> SupportedParts => _supportedParts;

private IEnumerable<string> _supportedParts = new[] { "QueryString", "Form" };

public HttpContextKeyValueProvider(HttpContextBase httpContext)
{
HttpContext = HttpContext;
}

/// <inheritdoc />
public byte[] Get()
{
using (var ms = new MemoryStream())
{
HttpContext.Request.GetBufferedInputStream().CopyTo(ms);
return ms.ToArray();
}

}

/// <inheritdoc />
public IEnumerable<string> GetKeys(string part = null)
{
var request = HttpContext.Request;
var result = new List<string>();
if (NullEq(part, "QueryString"))
{
result.AddRange(request.QueryString.AllKeys);

}
if (NullEq(part, "Form"))
{
result.AddRange(request.Form.AllKeys);
}

return result.Distinct();
}

/// <inheritdoc />
public string GetValue(string key, string part = null)
{
var request = HttpContext.Request;
if (NullEq(part, "QueryString"))
{
return request.QueryString[key];
}

if (NullEq(part, "Form"))
{
return request.Form[key];
}

return null;
}


private bool NullEq(string val, string compare)
{
return string.IsNullOrEmpty(val) || string.Equals(val, compare, StringComparison.OrdinalIgnoreCase);
}
private bool Eq(string str1, string str2)
{
return string.Equals(str1, str2, StringComparison.OrdinalIgnoreCase);
}
}
}
15 changes: 15 additions & 0 deletions src/PaySharp.AspNet/PaySharp.AspNet.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net45</TargetFramework>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\PaySharp.Core\PaySharp.Core.csproj" />
</ItemGroup>

<ItemGroup>
<Reference Include="System.Web" />
</ItemGroup>

</Project>
Loading