您的位置:首页 > 其它

第三方支付接口(原)

2007-03-24 12:27 267 查看
一个英属处女岛上的支接口

代码:
string inv;
string acctNo;
string curr;
string amount;
string status;
string ssn;
//read post from PayNetCom system
//post back to PayNetCom system to validate
MSXML2.XMLHTTP _xmlhttp = new MSXML2.XMLHTTPClass();
_xmlhttp.open("Post", "https://www.click-pay.com/cp/verifySign.do", false, null, null);
_xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
_xmlhttp.send(Request.Form.ToString());
// assign posted variables to local variables
inv = Request.Form["inv"];
acctNo = Request.Form["acctNo"];
curr = Request.Form["curr"];
amount = Request.Form["amount"];
status = Request.Form["status"];
ssn = Request.Form["ssn"];
//Check notification validation
if (_xmlhttp.status != 200)
{
//HTTP error handling
//交易失败(通信故障)
Response.Redirect("info.aspx?code=1006&back=deposit.aspx");
}
else if (_xmlhttp.responseText == "VERIFIED")
{
//check that inv is success
//check that acctNo ount are correct
if (_xmlhttp.status == 000)
{
//process payment
//充值成功
//增加金额
int mid = Convert.ToInt32(acctNo);
decimal momey = Convert.ToDecimal(amount);
MDAO.UpdateMemberMoneyById(mid, momey);

//设置为充值成功

//存款记录ID
int id = Convert.ToInt32(inv);
DRDAO.updateSuccess(id);

//增加财务记录
fbean.MemberId = mid;
fbean.FinanceDatetime = DateTime.Now.ToString();
fbean.OperationType = "银行充值";
fbean.Detail = "充值记录号" + id;
fbean.AccountChange = momey;
FDAO.Insert(fbean);

Response.Redirect("deposit.aspx");
}
else if (_xmlhttp.status == 111)
{
//用户名或密码不正确
Response.Redirect("info.aspx?code=1003&back=deposit.aspx");
}
else
{
Response.Redirect("info.aspx?code=1003&back=deposit.aspx");
}

}
else if (_xmlhttp.responseText == "NOT_VERIFIED")
{
//log for manual investigation
Response.Redirect("info.aspx?code=1007&back=deposit.aspx");
}
else
{
//error
Response.Redirect("info.aspx?code=1003&back=deposit.aspx");

}
_xmlhttp.abort();

//
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: