Skip to content

Commit

Permalink
Merge pull request #1332 from JeffreySu/Developer
Browse files Browse the repository at this point in the history
Developer
  • Loading branch information
JeffreySu authored Aug 4, 2018
2 parents 33078f2 + d2a7e0c commit 8204966
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
"TenPayV3_Key": "TenPayV3_Key",
"TenPayV3_AppId": "TenPayV3_AppId",
"TenPayV3_AppSecret": "TenPayV3_AppId",
"TenPayV3_TenpayNotify": "TenPayV3_TenpayNotify",
"TenPayV3_TenpayNotify": "http://YourDomainName/TenpayV3/PayNotifyUrl",
//如果不设置TenPayV3_WxOpenTenpayNotify,默认在 TenPayV3_TenpayNotify 的值最后加上 "WxOpen"
"TenPayV3_WxOpenTenpayNotify": "TenPayV3_WxOpenTenpayNotify",
"TenPayV3_WxOpenTenpayNotify": "http://YourDomainName/TenpayV3/PayNotifyUrlWxOpen",

//开放平台
"Component_Appid": "Component_Appid",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -439,21 +439,23 @@ public ActionResult PayNotifyUrl(bool isWxOpenPay = false)//注意:统一下

if (isWxOpenPay)
{
//小程序支付,发送小程序模板消息
var templateData = new WxOpenTemplateMessage_PaySuccessNotice(
"在线购买(小程序支付)测试", DateTime.Now, "小程序支付", "1234567890",
100, "400-031-8816", "https://weixin.senparc.com");

var cacheStrategy = CacheStrategyFactory.GetObjectCacheStrategyInstance();
var prepayId = cacheStrategy.Get<string>($"WxOpenPrepayId-{openId}");//3天内可以发送模板消息
if (!string.IsNullOrEmpty(prepayId))
var unifiedorderRequestData = cacheStrategy.Get<TenPayV3UnifiedorderRequestData>($"WxOpenUnifiedorderRequestData-{openId}");//获取订单请求信息缓存
var unifedorderResult = cacheStrategy.Get<UnifiedorderResult>($"WxOpenUnifiedorderResultData-{openId}");//获取订单信息缓存

if (unifedorderResult != null || !string.IsNullOrEmpty(unifedorderResult.prepay_id))
{
Senparc.Weixin.WeixinTrace.SendCustomLog("支付成功模板消息参数(小程序)", appId + " , " + openId);

//小程序支付,发送小程序模板消息
var templateData = new WxOpenTemplateMessage_PaySuccessNotice(
"在线购买(小程序支付)测试", DateTime.Now, "小程序支付 | 注意:这条消息来自微信服务器异步回调,官方证明支付成功! | prepay_id:"+ unifedorderResult.prepay_id,
unifiedorderRequestData.OutTradeNo, unifiedorderRequestData.TotalFee, "400-031-8816", "https://weixin.senparc.com");

Senparc.Weixin.WxOpen.AdvancedAPIs
.Template.TemplateApi
.SendTemplateMessage(
Config.SenparcWeixinSetting.WxOpenAppId, openId, templateData.TemplateId, templateData, prepayId, "pages/index/index", "图书", "#fff00");
Config.SenparcWeixinSetting.WxOpenAppId, openId, templateData.TemplateId, templateData, unifedorderResult.prepay_id, "pages/index/index", "图书", "#fff00");
}
else
{
Expand Down Expand Up @@ -530,7 +532,8 @@ public ActionResult PayNotifyUrl(bool isWxOpenPay = false)//注意:统一下
public ActionResult PayNotifyUrlWxOpen()
{
WeixinTrace.SendCustomLog("小程序微信支付回调", "TenPayV3Controller.PayNotifyUrlWxOpen()");
return PayNotifyUrl(true);
return PayNotifyUrl(true);//调用正常的流程

}

#endregion
Expand Down Expand Up @@ -603,7 +606,7 @@ public ActionResult Refund()
int totalFee = (int)(Session["BillFee"]);
int refundFee = totalFee;
string opUserId = TenPayV3Info.MchId;
var notifyUrl = "https://sdk.weixin.senparc.com/TenPayV3/RefundNotifyUrl";
var notifyUrl = "http://sdk.weixin.senparc.com/TenPayV3/RefundNotifyUrl";
var dataInfo = new TenPayV3RefundRequestData(TenPayV3Info.AppId, TenPayV3Info.MchId, TenPayV3Info.Key,
null, nonceStr, null, outTradeNo, outRefundNo, totalFee, refundFee, opUserId, null, notifyUrl: notifyUrl);
var cert = @"D:\cert\apiclient_cert_SenparcRobot.p12";//根据自己的证书位置修改
Expand Down Expand Up @@ -631,7 +634,7 @@ public ActionResult Refund()
//string data = packageReqHandler.ParseXML();

////退款接口地址
//string url = "https://api.mch.weixin.qq.com/secapi/pay/refund";
//string url = "http://api.mch.weixin.qq.com/secapi/pay/refund";
////本地或者服务器的证书位置(证书在微信支付申请成功发来的通知邮件中)
//string cert = @"D:\cert\apiclient_cert_SenparcRobot.p12";
////私钥(在安装证书时设置)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ public ActionResult TemplateTest(string sessionId, string formId)
productName = "缓存获取 prepay_id 失败";
orderNumber = "1234567890";
}
productName += " | 注意:这条消息是从小程序发起的!仅作为UI上支付成功的演示!不能确定支付真实成功! | prepay_id:" + unifedorderResult.prepay_id;
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ and limitations under the License.
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("15.2.0.*")]
[assembly: AssemblyVersion("15.2.1.*")]
//[assembly: AssemblyInformationalVersion("13.3.1-alpha")]
//[assembly: AssemblyFileVersion("0.4.2.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ public static void Register(TenPayV3Info tenPayV3Info,string name)
}
}

/// <summary>
/// 索引 TenPayV3Info
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public new TenPayV3Info this[string key]
{
get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.4.1.*")]
[assembly: AssemblyVersion("3.5.0.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.1.2.*")]
[assembly: AssemblyVersion("2.2.0.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.1.2.*")]
[assembly: AssemblyVersion("2.2.0.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("5.1.6.*")]
[assembly: AssemblyVersion("5.1.7.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]

0 comments on commit 8204966

Please sign in to comment.