Пример #1
0
        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.WeChatPayment;
            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();
        }
Пример #2
0
 /// <summary>
 /// ����̻����ݡ�����ӵ��̻������ظ������ؽ��ᱻɾ��
 /// </summary>
 /// <param name="merchant">�̻�����</param>
 public void AddMerchant(Merchant merchant)
 {
     RemoveMerchant(merchant.GatewayType);
     merchantList.Add(merchant);
 }
Пример #3
0
 /// <summary>
 /// ��ʼ�������Ķ�������PaymentNotify
 /// </summary>
 /// <param name="merchant">�̻�����</param>
 public PaymentNotify(Merchant merchant)
 {
     merchantList = new List<Merchant>();
     AddMerchant(merchant);
 }
Пример #4
0
 public PaymentSetting(GatewayType gatewayType, Merchant merchant, Order order)
     : this(gatewayType)
 {
     gateway.Merchant = merchant;
     gateway.Order = order;
 }
Пример #5
0
 /// <summary>
 /// 初始化接受阅读反馈的PaymentNotify
 /// </summary>
 /// <param name="merchant">商户数据</param>
 public PaymentNotify(Merchant merchant) : this()
 {
     AddMerchant(merchant);
 }
Пример #6
0
 /// <summary>
 /// 添加商户数据。与添加的商户数据重复的网关将会被删除
 /// </summary>
 /// <param name="merchant">商户数据</param>
 public void AddMerchant(Merchant merchant)
 {
     RemoveMerchant(merchant.GatewayType);
     merchantList.Add(merchant);
 }
Пример #7
0
 public PaymentSetting(GatewayType gatewayType, Merchant merchant, Order order)
     : this(gatewayType)
 {
     gateway.Merchant = merchant;
     gateway.Order    = order;
 }
Пример #8
0
 /// <summary>
 /// 初始化接受阅读反馈的PaymentNotify
 /// </summary>
 /// <param name="merchant">商户数据</param>
 public PaymentNotify(Merchant merchant)
 {
     merchantList = new List <Merchant>();
     AddMerchant(merchant);
 }