public ActionResult DownloadBill(DownloadBillModel downloadBill) { if (!Request.IsLocal()) { return(Forbid("无权访问!限本地访问")); } if (string.IsNullOrWhiteSpace(downloadBill.NonceStr)) { downloadBill.NonceStr = TenPayV3Util.GetNoncestr(); } if (string.IsNullOrWhiteSpace(downloadBill.BillType)) { downloadBill.BillType = "ALL"; } if (string.IsNullOrWhiteSpace(downloadBill.DeviceInfo)) { downloadBill.DeviceInfo = TenPyConfigRead.DeviceInfo; } TenPayV3DownloadBillRequestData data = new TenPayV3DownloadBillRequestData( appId: TenPyConfigRead.AppId, mchId: TenPyConfigRead.MchId, nonceStr: downloadBill.NonceStr, deviceInfo: downloadBill.DeviceInfo, billDate: downloadBill.BillDate, billType: downloadBill.BillType, key: TenPyConfigRead.Key ); // TenPayV3DownloadBillRequestData data = new TenPayV3DownloadBillRequestData(TenPayV3Info.AppId, TenPayV3Info.MchId, nonceStr, null, date, "ALL", TenPayV3Info.Key, null); var result = TenPayV3.DownloadBill(data); return(Content(result)); }
public ActionResult DownloadBillGet([FromQuery] DownloadBillModel downloadBill) { //if (!Request.IsLocal()) //{ // return Forbid("无权访问!"); //} if (string.IsNullOrWhiteSpace(downloadBill.NonceStr)) { downloadBill.NonceStr = TenPayV3Util.GetNoncestr(); } if (string.IsNullOrWhiteSpace(downloadBill.BillType)) { downloadBill.BillType = "ALL"; } if (string.IsNullOrWhiteSpace(downloadBill.DeviceInfo)) { downloadBill.DeviceInfo = TenPyConfigRead.DeviceInfo; } TenPayV3DownloadBillRequestData data = new TenPayV3DownloadBillRequestData( appId: TenPyConfigRead.AppId, mchId: TenPyConfigRead.MchId, nonceStr: downloadBill.NonceStr, deviceInfo: downloadBill.DeviceInfo, billDate: downloadBill.BillDate, billType: downloadBill.BillType, key: TenPyConfigRead.Key ); // TenPayV3DownloadBillRequestData data = new TenPayV3DownloadBillRequestData(TenPayV3Info.AppId, TenPayV3Info.MchId, nonceStr, null, date, "ALL", TenPayV3Info.Key, null); var result = TenPayV3.DownloadBill(data); var log = _logger.CreateLogger("关闭订单"); log.LogInformation(downloadBill.BillDate); return(Content(result)); }
private void DownloadBillTest(string sandBoxKey, string nonceStr) { var dataInfo = new TenPayV3DownloadBillRequestData(base._appId, base._mchId, nonceStr, "Senparc POS 1", SystemTime.Now.ToString("yyyyMMdd"), "ALL", sandBoxKey); var result = TenPayV3.DownloadBill(dataInfo); Assert.IsTrue(!string.IsNullOrEmpty(result)); Console.WriteLine(result); }
/// <summary> /// 下载对账单 /// </summary> /// <param name="date">日期,格式如:20170716</param> /// <returns></returns> public ActionResult DownloadBill(string date) { if (!Request.IsLocal) { return Content("出于安全考虑,此操作限定在本机上操作(实际项目可以添加登录权限限制后远程操作)!"); } string nonceStr = TenPayV3Util.GetNoncestr(); TenPayV3DownloadBillRequestData data = new TenPayV3DownloadBillRequestData(TenPayV3Info.AppId, TenPayV3Info.MchId, nonceStr, null, date, "ALL", TenPayV3Info.Key, null); var result = TenPayV3.DownloadBill(data); return Content(result); }