Skip to content

Commit

Permalink
Merge pull request #48 from JeffreySu/master
Browse files Browse the repository at this point in the history
同步代码
  • Loading branch information
mc7246 authored Jul 6, 2022
2 parents b2b20c3 + 6675316 commit 67aa87d
Show file tree
Hide file tree
Showing 63 changed files with 2,767 additions and 290 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ bak.zip
*.DotSettings
.vs
.vscode
.idea/
applicationhost.config
packages/
*/**/App_Data/SenparcTraceLog/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ public ActionResult Index()
return View();
}

/// <summary>
/// 支付应答
/// </summary>
/// <returns></returns>
public ActionResult FeedBack()
{
//创建支付应答对象
Expand All @@ -80,13 +84,16 @@ public ActionResult FeedBack()
return Content(result);
}

/// <summary>
/// JSAPI 支付
/// </summary>
/// <returns></returns>
public ActionResult JsApi()
{
//string appId = TenPayInfo.AppId;
string timeStamp = "";
string nonceStr = "";
string packageValue = "";
string paySign = "";
string timeStamp = null;
string nonceStr = null;
string packageValue = null;
string paySign = null;

string sp_billno = Request.Form["order_no"];
//当前时间 yyyyMMdd
Expand Down Expand Up @@ -136,15 +143,6 @@ public ActionResult JsApi()
paySignReqHandler.SetParameter("timestamp", timeStamp);
paySignReqHandler.SetParameter("package", packageValue);
paySign = paySignReqHandler.CreateSHA1Sign();
//TenPay.Delivernotify(TenPayInfo.AppId, "oX99MDgNcgwnz3zFN3DNmo8uwa-w", "111112222233333", sp_billno,
// timeStamp, "1", "ok", "53cca9d47b883bd4a5c85a9300df3da0cb48565c", "sha1");


//获取debug信息,建议把请求和debug信息写入日志,方便定位问题
//string pakcageDebuginfo = packageReqHandler.getDebugInfo();
//result +="<br/>pakcageDebuginfo:" + pakcageDebuginfo + "<br/>");
//string paySignDebuginfo = paySignReqHandler.getDebugInfo();
//result +="<br/>paySignDebuginfo:" + paySignDebuginfo + "<br/>");

//TODO:和JSSDK一样整合信息包
ViewData["appId"] = TenPayInfo.AppId;
Expand All @@ -156,7 +154,10 @@ public ActionResult JsApi()
return View();
}


/// <summary>
/// Native 支付
/// </summary>
/// <returns></returns>
public ActionResult Native()
{
string sp_billno = Request.Form["order_no"];
Expand Down Expand Up @@ -198,6 +199,10 @@ public ActionResult Native()
return View();
}

/// <summary>
/// NativeCall
/// </summary>
/// <returns></returns>
public ActionResult NativeCall()
{
string sp_billno = Request.Form["order_no"];
Expand Down Expand Up @@ -264,14 +269,12 @@ public ActionResult NativeCall()
return View();
}

public ActionResult Alert()
{
return Content("success");
}

/// <summary>
/// 支付回调
/// </summary>
/// <returns></returns>
public ActionResult PayNotifyUrl()
{

ResponseHandler resHandler = new ResponseHandler(null);
resHandler.Init();
resHandler.SetKey(TenPayInfo.Key, TenPayInfo.AppKey);
Expand Down Expand Up @@ -340,6 +343,10 @@ public ActionResult PayNotifyUrl()
return Content("Success");
}

/// <summary>
/// 退款
/// </summary>
/// <returns></returns>
protected ActionResult Refund()
{
//创建请求对象
Expand Down Expand Up @@ -370,6 +377,7 @@ protected ActionResult Refund()
reqHandler.SetParameter("service_version", "1.1");

string requestUrl = reqHandler.GetRequestURL();
//输入证书地址和秘钥,根据实际情况修改
httpClient.SetCertInfo("c:\\key\\1900000109.pfx", "1900000109");
//设置请求内容
httpClient.SetReqContent(requestUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ namespace Senparc.Weixin.Sample.Net6.Controllers
{
/*
* 友情提示:微信支付正式上线之前,请进行沙箱测试!
* 单元测试见:Senparc.Weixin.MP.Test.TenPayV3/TenPayV3Test.cs/GetSignKeyTest()
* 单元测试见:Senparc.Weixin.MP.Test/TenPayV3/TenPayV3Test.cs/GetSignKeyTest()
*/


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Version>6.5.14</Version>
<Version>6.5.15</Version>
<UserSecretsId>35e58786-0820-4cde-b1ff-f4c6198d00f7</UserSecretsId>
<PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
目前 Senparc.Weixin SDK 已支持微信 8.x API 中几乎所有接口以及<strong>小程序</strong>
</h1>
<p>
当前站点运行 <a href="https://github.com/JeffreySu/WeiXinMPSDK/tree/master/Samples/netcore3-mvc/" target="_blank">Sample</a>
当前站点运行 <a href="https://github.com/JeffreySu/WeiXinMPSDK/tree/master/Samples/All/net6-mvc/" target="_blank">Sample</a>
版本:v@(TempData["SampleVersion"]) (@TempData["BuildTime"])
</p>
<p>&nbsp;</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@
<p>@Html.ActionLink("点击这里使用H5支付", "H5Pay", "TenPayV3", new { productId = Model.Id, hc = Model.GetHashCode() }, null)</p>
<hr />

<h2>支付方式二:“扫一扫”支付</h2>
<h2>支付方式二:“扫一扫”支付(JsApi)</h2>
<p>
使用微信“扫一扫”下方二维码完成支付:<br />
<img src="@Url.Action("ProductPayCode",new{productId=Model.Id,hc=Model.GetHashCode()})" width="300" />
</p>
<p>提示:如果是在微信内部打开商品页面,则不会进入此页面,直接进入 JsApi 支付。</p>
<hr />

</body>
Expand Down
2 changes: 1 addition & 1 deletion Samples/MP/Senparc.Weixin.Sample.MP/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
{
options.AccountSettingFunc = context => Senparc.Weixin.Config.SenparcWeixinSetting;
});

#endregion

#endregion
Expand Down Expand Up @@ -69,7 +70,6 @@
#endif
#endregion


app.UseRouting();

app.UseAuthorization();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@

<!--引用 Nuget 包-->
<ItemGroup>
<PackageReference Include="Senparc.Weixin.AspNet" Version="0.7.7" />
<PackageReference Include="Senparc.Weixin.MP" Version="16.17.9" />
<PackageReference Include="Senparc.Weixin.MP.Middleware" Version="0.7.7" />
<PackageReference Include="Senparc.Weixin.MP.MVC" Version="7.11.7" />
<PackageReference Include="Senparc.Weixin.AspNet" Version="0.8.1" />
<PackageReference Include="Senparc.Weixin.MP" Version="16.18.2.1" />
<PackageReference Include="Senparc.Weixin.MP.Middleware" Version="0.8.1" />
<PackageReference Include="Senparc.Weixin.MP.MVC" Version="7.12.1" />
</ItemGroup>

<!--直接引用源码-->
Expand Down
33 changes: 16 additions & 17 deletions Samples/MP/Senparc.Weixin.Sample.MP/appsettings.json
Original file line number Diff line number Diff line change
@@ -1,42 +1,41 @@
{
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*",

//以下信息会被自动识别,如无特殊说明,不用的参数可以删除,但修改 key 后将会无法自动识别!
//以下信息会被自动识别,如无特殊说明,不用的参数可以删除,但修改 key 后将会无法自动识别!

//CO2NET 设置
//CO2NET 设置
"SenparcSetting": {
//以下为 CO2NET 的 SenparcSetting 全局配置,请勿修改 key,勿删除任何项
//以下为 CO2NET 的 SenparcSetting 全局配置,请勿修改 key,勿删除任何项

"IsDebug": true,
"DefaultCacheNamespace": "DefaultCache",

//分布式缓存
"Cache_Redis_Configuration": "#{Cache_Redis_Configuration}#", //Redis配置
"Cache_Memcached_Configuration": "#{Cache_Memcached_Configuration}#", //Memcached配置
//分布式缓存
"Cache_Redis_Configuration": "#{Cache_Redis_Configuration}#", //Redis配置
"Cache_Memcached_Configuration": "#{Cache_Memcached_Configuration}#", //Memcached配置
"SenparcUnionAgentKey": "#{SenparcUnionAgentKey}#" //SenparcUnionAgentKey
},
//Senparc.Weixin SDK 设置
//Senparc.Weixin SDK 设置
"SenparcWeixinSetting": {
//以下为 Senparc.Weixin 的 SenparcWeixinSetting 微信配置
//注意:所有的字符串值都可能被用于字典索引,因此请勿留空字符串(但可以根据需要,删除对应的整条设置)!
//以下为 Senparc.Weixin 的 SenparcWeixinSetting 微信配置
//注意:所有的字符串值都可能被用于字典索引,因此请勿留空字符串(但可以根据需要,删除对应的整条设置)!

//微信全局
//微信全局
"IsDebug": true,

//以下不使用的参数可以删除,key 修改后将会失效
//以下不使用的参数可以删除,key 修改后将会失效

//公众号
"Token": "#{Token}#", //说明:字符串内两侧#和{}符号为 Azure DevOps 默认的占位符格式,如果您有明文信息,请删除同占位符,修改整体字符串,不保留#和{},如:{"Token": "MyFullToken"}
//公众号
"Token": "#{Token}#", //说明:字符串内两侧#和{}符号为 Azure DevOps 默认的占位符格式,如果您有明文信息,请删除同占位符,修改整体字符串,不保留#和{},如:{"Token": "MyFullToken"}
"EncodingAESKey": "#{EncodingAESKey}#",
"WeixinAppId": "#{WeixinAppId}#",
"WeixinAppSecret": "#{WeixinAppSecret}#"

//可以追加更多其他平台的配置信息
}
}
Loading

0 comments on commit 67aa87d

Please sign in to comment.