加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ddd

发布时间:2020-12-14 05:44:41 所属栏目:百科 来源:网络整理
导读:using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using Syste

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class AutoReceive : System.Web.UI.Page
{
??? protected string v_oid; //订单号
??? protected string v_pstatus; //支付状态码
??? //20(支付成功,对使用实时银行卡进行扣款的订单);
??? //30(支付失败,对使用实时银行卡进行扣款的订单);

??? protected string v_pstring; //支付状态描述
??? protected string v_pmode; //支付银行
??? protected string v_md5str; //MD5校验码
??? protected string v_amount; //支付金额
??? protected string v_moneytype; //币种??
??? protected string remark1;//备注1
??? protected string remark2;//备注1


??? protected void Page_Load(object sender,EventArgs e)
??? {
??????? ???// MD5密钥要跟订单提交页相同,如Send.asp里的 key = "test",修改""号内 test 为您的密钥
???string key = "test";?// 如果您还没有设置MD5密钥请登陆我们为您提供商户后台,地址:https://merchant3.chinabank.com.cn/
??????// 登陆后在上面的导航栏里可能找到“资料管理”,在资料管理的二级导航栏里有“MD5密钥设置”
??????// 建议您设置一个16位以上的密钥或更高,密钥最多64位,但设置16位已经足够了???
???
???v_oid???? = Request["v_oid"];
???v_pstatus = Request["v_pstatus"];
???v_pstring = Request["v_pstring"];
???v_pmode?? = Request["v_pmode"];
???v_md5str? = Request["v_md5str"];
???v_amount? = Request["v_amount"];
???v_moneytype = Request["v_moneytype"];
???remark1 = Request["remark1"];
???remark2 = Request["remark2"];

???string str = v_oid+v_pstatus+v_amount+v_moneytype+key;
??????????? str = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str,"md5").ToUpper();
???
??????????? if(str==v_md5str)
???{
????Response.Write("ok"); //通知网银服务器验证通过,停止发送

????if(v_pstatus.Equals("20"))
????{
?????//支付成功
?????//商户系统的逻辑处理(例如判断金额,判断支付状态,更新订单状态等等).......
????}
???}
???else
???{
????Response.Write("error");? //验证失败,请求重发
???}
??? }
}
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Receive : System.Web.UI.Page
{
??? protected string v_oid;??// 订单号
??? protected string v_pstatus;?// 支付状态码
??? //20(支付成功,对使用实时银行卡进行扣款的订单);
??? //30(支付失败,对使用实时银行卡进行扣款的订单);

??? protected string v_pstring;?//支付状态描述
??? protected string v_pmode;?//支付银行
??? protected string v_md5info;?//MD5校验码
??? protected string v_amount;?//支付金额
??? protected string v_moneytype;?//币种??
??? protected string remark1;?// 备注1
??? protected string remark2;?// 备注1

??? protected string v_md5str;

??? protected string status_msg;

??? protected void Page_Load(object sender,EventArgs e)
??? {
??????? // MD5密钥要跟订单提交页相同,如Send.asp里的 key = "test",修改""号内 test 为您的密钥
??????? string key = "test";?// 如果您还没有设置MD5密钥请登陆我们为您提供商户后台,地址:https://merchant3.chinabank.com.cn/
??????? // 登陆后在上面的导航栏里可能找到“资料管理”,在资料管理的二级导航栏里有“MD5密钥设置”
??????? // 建议您设置一个16位以上的密钥或更高,密钥最多64位,但设置16位已经足够了

??????? v_oid = Request["v_oid"];
??????? v_pstatus = Request["v_pstatus"];
??????? v_pstring = Request["v_pstring"];
??????? v_pmode = Request["v_pmode"];
??????? v_md5str = Request["v_md5str"];
??????? v_amount = Request["v_amount"];
??????? v_moneytype = Request["v_moneytype"];
??????? remark1 = Request["remark1"];
??????? remark2 = Request["remark2"];

??????? string str = v_oid + v_pstatus + v_amount + v_moneytype + key;

??????? str = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str,"md5").ToUpper();???

??????? if (str == v_md5str)
??????? {

??????????? if (v_pstatus.Equals("20"))
??????????? {
??????????????? //支付成功
??????????????? //在这里商户可以写上自己的业务逻辑
??????????? }
??????? }
??????? else
??????? {
??????????? response.write("校验失败,数据可疑")
??????? }
??? }
}
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Send : System.Web.UI.Page
{
??? //必要的交易信息
??? protected string v_amount;?????? // 订单金额
??? protected string v_moneytype;??? // 币种
??? protected string v_md5info;????? // 对拼凑串MD5私钥加密后的值
??? protected string v_mid;?? // 商户号
??? protected string v_url;?? // 返回页地址
??? protected string v_oid;?? // 推荐订单号构成格式为 年月日-商户号-小时分钟秒

??? //收货信息
??? protected string v_rcvname;????? // 收货人
??? protected string v_rcvaddr;????? // 收货地址
??? protected string v_rcvtel;?????? // 收货人电话
??? protected string v_rcvpost;????? // 收货人邮编
??? protected string v_rcvemail;???? // 收货人邮件
??? protected string v_rcvmobile;??? // 收货人手机号

??? //订货人信息
??? protected string v_ordername;??? // 订货人姓名
??? protected string v_orderaddr;??? // 订货人地址
??? protected string v_ordertel;???? // 订货人电话
??? protected string v_orderpost;??? // 订货人邮编
??? protected string v_orderemail;?? // 订货人邮件
??? protected string v_ordermobile;? // 订货人手机号

??? //两个备注
??? protected string remark1;
??? protected string remark2;

??? protected void Page_Load(object sender,EventArgs e)
??? {
??????? v_mid = "1001";???? // 商户号,这里为测试商户号20000400,替换为自己的商户号即可
??????? v_url = "http://localhost/chinabank/Receive.aspx"; // 商户自定义返回接收支付结果的页面
??????? // MD5密钥要跟订单提交页相同,如Send.asp里的 key = "test",修改""号内 test 为您的密钥
??????? string key = "test";???? // 如果您还没有设置MD5密钥请登陆我们为您提供商户后台,地址:https://merchant3.chinabank.com.cn/
??????? // 登陆后在上面的导航栏里可能找到“资料管理”,在资料管理的二级导航栏里有“MD5密钥设置”
??????? // 建议您设置一个16位以上的密钥或更高,密钥最多64位,但设置16位已经足够了
??????? v_oid = Request["v_oid"];

??????? if (v_oid == null || v_oid.Equals(""))
??????? {
??????????? DateTime dt = DateTime.Now;
??????????? string v_ymd = dt.ToString("yyyyMMdd"); // yyyyMMdd
??????????? string timeStr = dt.ToString("HHmmss"); // HHmmss
??????????? v_oid = v_ymd + v_mid + timeStr;
??????? }

??????? v_amount = Request["v_amount"];

??????? v_moneytype = "CNY";

??????? string text = v_amount + v_moneytype + v_oid + v_mid + v_url + key; // 拼凑加密串

??????? v_md5info = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(text,"md5").ToUpper();

??????? //收货信息
??????? v_rcvname?? = Request["v_rcvname"];
??????? v_rcvaddr?? = Request["v_rcvaddr"];
??????? v_rcvtel??? = Request["v_rcvtel"];
??????? v_rcvpost?? = Request["v_rcvpost"];
??????? v_rcvemail? = Request["v_rcvemail"];
??????? v_rcvmobile = Request["v_rcvmobile"];

??????? //订货人信息
??????? v_ordername?? = Request["v_ordername"];
??????? v_orderaddr?? = Request["v_orderaddr"];
??????? v_ordertel??? = Request["v_ordertel"];
??????? v_orderpost?? = Request["v_orderpost"];
??????? v_orderemail? = Request["v_orderemail"];
??????? v_ordermobile = Request["v_ordermobile"];

??????? remark1 = Request["remark1"];??????? remark2 = Request["remark2"];??? }}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读