asp.net Alipay Interface

added by soyaiya
7/20/2010 10:07:18 PM

0 Kicks, 181 Views

Interface called Alipay very convenient, just make a package to achieve a virtual trading and barter. Solution has three projects, and NDoc generated documentation, a simple sequence diagram: CommonAliPay, package Alipay interfaces. TestAli,asp.net project TestCommonAliPay,Nunit project。 Call method: 1、Introduction CommonAliPay.dll 2、Implementation Alipay service interface method: AliPay ap = new AliPay(); string key = "";//your key string partner = "";//your Partner StandardGoods bp = new StandardGoods("trade_create_by_buyer", partner, key, "MD5", "卡2", Guid.NewGuid().ToString(), 2.551m, 1, "[email protected]", "[email protected]" , "EMS", 25.00m, "BUYER_PAY","1"); bp.Notify_Url = "http://203.86.79.185/ali/notify.aspx"; ap.CreateStandardTrade("https://www.alipay.com/cooperate/gateway.do", bp, this);(The above is a common way of calling)。 The following is only a way to support virtual goods: string key = "";//your key string partner = "";//your Partner AliPay ap = new AliPay(); DigitalGoods bp = new DigitalGoods("create_digital_goods_trade_p", partner, key, "MD5", "卡2", Guid.NewGuid().ToString(), 2.551m, 1, "[email protected]", "[email protected]"); bp.Notify_Url = "http://203.86.79.185/ali/notify.aspx"; ap.CreateDigitalTrade("https://www.alipay.com/cooperate/gateway.do", bp, this);3、Notification interface method implementation Alipay call (support for virtual and physical): protected void Page_Load(object sender, EventArgs e) { string key = "";//your key string partner = "";//your Partner AliPay ap = new AliPay(); string notifyid = Request.Form["notify_id"]; Verify v = new Verify("notify_verify", partner, notifyid); ap.WaitSellerSendGoods+=new AliPay.ProcessNotifyEventHandler(ap_WaitSellerSendGoods); ap.WaitBuyerPay += new AliPay.ProcessNotifyEventHandler(ap_WaitBuyerPay); ap.ProcessNotify(this, "https://www.alipay.com/cooperate/gateway.do",key,v, "utf-8"); } void ap_WaitBuyerPay(object sender, NotifyEventArgs e) { // //Add your own processing logic Log4net.log.Error("wait buyer pay fire"); } private void ap_WaitSellerSendGoods(object sender, NotifyEventArgs e) { //Add your own processing logic Log4net.log.Error("WaitSellerSendGoods fire"); }Alipay tr ADs: Enjoy mbt walking shoes at http://mbtshoessale100.com/.


0 comments