public ActionResult Index() { // 订阅支付通知事件 PaymentNotify notify = new PaymentNotify(_merchantList); notify.PaymentSucceed += notify_PaymentSucceed; notify.PaymentFailed += notify_PaymentFailed; notify.UnknownGateway += notify_UnknownGateway; // 接收并处理支付通知 notify.Received(); return(View()); }
protected void Page_Load(object sender, EventArgs e) { // 设置商户数据 Merchant alipayMerchant = new Merchant(); alipayMerchant.GatewayType = GatewayType.Alipay; alipayMerchant.UserName = "******"; alipayMerchant.Key = "000000000000000000000000000000000000000000"; Merchant yeepayMerchant = new Merchant(); yeepayMerchant.GatewayType = GatewayType.Yeepay; yeepayMerchant.UserName = "******"; yeepayMerchant.Key = "000000000000000000000000000000000000000000"; Merchant tenpayMerchant = new Merchant(); tenpayMerchant.GatewayType = GatewayType.Tenpay; tenpayMerchant.UserName = "******"; tenpayMerchant.Key = "000000000000000000000000000000000000000000"; Merchant weChatPaymentMerchant = new Merchant(); weChatPaymentMerchant.GatewayType = GatewayType.WeChatPay; weChatPaymentMerchant.UserName = "******"; weChatPaymentMerchant.Key = "000000000000000000000000000000000000000000"; // 添加到商户数据集合 List <Merchant> merchantList = new List <Merchant>(); merchantList.Add(alipayMerchant); merchantList.Add(yeepayMerchant); merchantList.Add(tenpayMerchant); merchantList.Add(weChatPaymentMerchant); // 订阅支付通知事件 PaymentNotify notify = new PaymentNotify(merchantList); notify.PaymentSucceed += new PaymentSucceedEventHandler(notify_PaymentSucceed); notify.PaymentFailed += new PaymentFailedEventHandler(notify_PaymentFailed); notify.UnknownGateway += new UnknownGatewayEventHandler(notify_UnknownGateway); // 接收并处理支付通知 notify.Received(); }
protected void Page_Load(object sender, EventArgs e) { // 设置商户数据 Merchant alipayMerchant = new Merchant(); alipayMerchant.GatewayType = GatewayType.Alipay; alipayMerchant.UserName = "******"; // 合作伙伴身份(PID) alipayMerchant.Key = "000000000000000000000000000000000000000000"; // MD5密钥 Merchant yeepayMerchant = new Merchant(); yeepayMerchant.GatewayType = GatewayType.Yeepay; yeepayMerchant.UserName = "******"; // 商户编号 yeepayMerchant.Key = "000000000000000000000000000000000000000000"; // 商户密钥 Merchant tenpayMerchant = new Merchant(); tenpayMerchant.GatewayType = GatewayType.Tenpay; tenpayMerchant.UserName = "******"; // 商户号 tenpayMerchant.Key = "000000000000000000000000000000000000000000"; // 密钥 Merchant weChatPaymentMerchant = new Merchant(); weChatPaymentMerchant.GatewayType = GatewayType.WeChatPay; weChatPaymentMerchant.UserName = "******"; // 微信支付商户号 weChatPaymentMerchant.Key = "000000000000000000000000000000000000000000"; // API密钥 // 添加到商户数据集合 List <Merchant> merchantList = new List <Merchant>(); merchantList.Add(alipayMerchant); merchantList.Add(yeepayMerchant); merchantList.Add(tenpayMerchant); merchantList.Add(weChatPaymentMerchant); // 订阅支付通知事件 PaymentNotify notify = new PaymentNotify(merchantList); notify.PaymentSucceed += notify_PaymentSucceed; notify.PaymentFailed += notify_PaymentFailed; notify.UnknownGateway += notify_UnknownGateway; // 接收并处理支付通知 notify.Received(); }
public void ServerNotify() { // 接收并处理支付通知 notify.Received(PaymentNotifyMethod.ServerNotify); }