icanpay是乙個支援多商戶多種支付方式的跨平台閘道器處理類庫,使用icanpay可以簡化訂單的建立、查詢、退款和接收閘道器返回的支付通知等操作。
下面以支付寶為例,其餘兩種支付,請參考wiki
services.addicanpay(a =>
;gateways.add(new alipaygateway(merchant));
return gateways;
});
以上就簡單的完成了對icanpay的配置操作
icanpay支援多種支付方式,下面就來講解如何使用
private readonly igateways gateways;
public yourcontroller(igateways gateways)
var order = new order()
;
var gateway = gateways.get(gatewaytradetype.web);
gateway.payment(order);
特殊說明:gatewaytradetype.barcode支付方式,需要再實現paymentsucceed和paymentfailed事件
private readonly igateways gateways;
public notifycontroller(igateways gateways)
paymentnotify notify = new paymentnotify(gateways);
notify.paymentsucceed += notify_paymentsucceed;
notify.paymentfailed += notify_paymentfailed;
notify.unknowngateway += notify_unknowngateway;
private void notify_paymentsucceed(object sender, paymentsucceedeventargs e)
}private void notify_paymentfailed(object sender, paymentfailedeventargs e)
private void notify_unknowngateway(object sender, unknowngatewayeventargs e)
await notify.receivedasync();
var notify = (notify)gateway.query(new auxiliary
);
var notify = (notify)gateway.cancel(new auxiliary
);
var notify = (notify)gateway.close(new auxiliary
);
var notify = (notify)gateway.refund(new auxiliary
);
var notify = (notify)gateway.refundquery(new auxiliary
);
gateway.billdownload(new auxiliary
{billtype = "trade",
billdate = "2017-10-31"
談跨平台c 動態連線庫
我對與 solaris hp windows 這三個平台的動態庫的實現,進行了探索,對於 soloaris,hp 等unix 平台來講,主要是 make 檔案的製作,而 windows 下還需要對類頭進行修飾.本列主要實現了乙個動態庫和乙個呼叫動態庫的執行程式,動態庫包括 mytime.h myti...
談跨平台C 動態連線庫的實現
我對與solaris hp windows這三個平台的動態庫的實現,進行了探索,對於soloaris,hp等unix平台來講,主要是make檔案的製作,而windows下還需要對類頭進行修飾.本列主要實現了乙個動態庫和乙個呼叫動態庫的執行程式,動態庫包括mytime.h mytime.cpp 在wi...
談跨平台C 動態連線庫的實現
我對與solaris hp windows這三個平台的動態庫的實現,進行了探索,對於soloaris,hp等unix平台來講,主要是make檔案的製作,而windows下還需要對類頭進行修飾.本列主要實現了乙個動態庫和乙個呼叫動態庫的執行程式,動態庫包括mytime.h mytime.cpp 在wi...