基本信息
源码名称:通联支付接口示例源码(.net/php/java)
源码大小:1.72M
文件格式:.rar
开发语言:C#
更新时间:2019-03-09
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using uniondemo.com.allinpay.syb;
namespace uniondemo
{
public partial class Test : System.Web.UI.Page
{
SybWxPayService sybService = new SybWxPayService();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btn_pay_Click(object sender, EventArgs e)
{
try
{
Dictionary<String, String> rsp = sybService.pay(1, DateTime.Now.ToFileTime().ToString(), "W01", "商品内容", "备注", "", "", "http://baidu.com", "", "", "", "");
printRsp(rsp);
}
catch (Exception ex)
{
this.tblank.Value = ex.Message;
}
}
protected void btn_cancel_Click(object sender, EventArgs e)
{
try
{
Dictionary<String, String> rsp = sybService.cancel(1, DateTime.Now.ToFileTime().ToString(), "12525075", "");
printRsp(rsp);
}
catch (Exception ex)
{
this.tblank.Value = ex.Message;
}
}
protected void btn_refund_Click(object sender, EventArgs e)
{
try
{
Dictionary<String, String> rsp = sybService.refund(1, DateTime.Now.ToFileTime().ToString(), "12525075", "");
printRsp(rsp);
}
catch (Exception ex)
{
this.tblank.Value = ex.Message;
}
}
protected void btn_query_Click(object sender, EventArgs e)
{
try
{
Dictionary<String, String> rsp = sybService.query("", "17273218");
printRsp(rsp);
}
catch (Exception ex)
{
this.tblank.Value = ex.Message;
}
}
private void doRequest(Dictionary<String, String> param, String url)
{
String rsp = HttpUtil.CreatePostHttpResponse(AppConstants.API_URL url, param, Encoding.UTF8);
Dictionary<String, String> rspDic = (Dictionary<String, String>)JsonConvert.DeserializeObject(rsp, typeof(Dictionary<String, String>));
rsp = "请求返回数据:" rsp "\n";
if ("SUCCESS".Equals(rspDic["retcode"]))//验签
{
String signRsp = rspDic["sign"];
rspDic.Remove("sign");
String sign = AppUtil.signParam(rspDic, AppConstants.APPKEY);
if (signRsp.Equals(sign))
{
rsp = rsp "验签成功";
}
else
rsp = rsp "验签失败";
}
this.tblank.Value = rsp;
}
private void printRsp(Dictionary<String, String> rspDic)
{
string rsp = "请求返回数据:\n";
foreach (var item in rspDic)
{
rsp = item.Key "-----" item.Value ";\n";
}
this.tblank.Value = rsp;
}
}
}