Beispiel #1
0
        public override void OnPaymentConfirmed(ConfirmEventArgs e)
        {
            // Do any circle-specific processing here.

            // Call the base class event invocation method.
            base.OnPaymentConfirmed(e);
        }
Beispiel #2
0
        public void SetPropertiesCorrectly()
        {
            var code   = "*****@*****.**";
            var userId = "password123";

            var args = new ConfirmEventArgs(userId, code);

            Assert.AreSame(code, args.Code);
            Assert.AreSame(userId, args.UserId);
        }
Beispiel #3
0
        private void Pocket_OnConfirmRequired(object sender, ConfirmEventArgs args)
        {
            _confirmEventArgs = args;

            var b = new TestConsole.Browser(args.ConfirmUrl);

            b.Navigated += OnNavigated;

            Application.Run(b);
        }
 //The event-invoking method that derived classes can override.
 public virtual void OnPaymentConfirmed(ConfirmEventArgs e)
 {
     // Make a temporary copy of the event to avoid possibility of
     // a race condition if the last subscriber unsubscribes
     // immediately after the null check and before the event is raised.
     EventHandler<ConfirmEventArgs> handler = PaymentConfirmed;
     if (handler != null)
     {
         handler(this, e);
     }
 }
    public bool ConfirmSelection()
    {
        if (confirmed || Confirm == null)
        {
            return(false);
        }

        var e = new ConfirmEventArgs(AvailableSprites[SelectedIndex]);

        Confirm(this, e);
        if (!e.IsCanceled)
        {
            confirmed = true;
            RefreshColor();
            return(true);
        }
        return(false);
    }
Beispiel #6
0
        public override void Confirm()
        {
            var args = new ConfirmEventArgs();
            args.PaymentData = base.PaymentData;
            args.Success = true;
            args.TotalPaid = 0;

            string orderRef = HttpContext.Current.Request.Form["item_number"];
            var man = new OrdersManager<Order, OrdersFilter, OrderRow, OrderRowsFilter>(); //new OM();
            args.OrderToPay = man.GetByOrderRef(orderRef);

            if (args.OrderToPay.Id == 0)
            {
                args.Success = false;
                args.MessageName = "InvalidOrderRef";

                OnPaymentConfirmed(args);
                return;
            }

            args.MessageName = "OK";
            OnPaymentConfirmed(args);
        }
Beispiel #7
0
 private void UIGeneralEvents_OnConfirm(object sender, ConfirmEventArgs e)
 {
     e.IsConfirm = true;
 }
Beispiel #8
0
        public override void Confirm()
        {
            var args = new ConfirmEventArgs();
            args.PaymentData = base.PaymentData;
            args.Success = true;

            string orderRef = HttpContext.Current.Request.Form["item_number"];
            var man = new OrdersManager<Order, OrdersFilter, OrderRow, OrderRowsFilter>(); //new OM();
            args.OrderToPay = man.GetByOrderRef(orderRef);

            if (args.OrderToPay.Id == 0)
            {
                args.Success = false;
                args.MessageName = "InvalidOrderRef";

                OnPaymentConfirmed(args);
                return;
            }

            string strResponse = "";
            try
            {
                HttpWebRequest req = (HttpWebRequest)WebRequest.Create(base.PaymentData.PaySubmitUrl);
                req.Method = "POST";
                req.ContentType = "application/x-www-form-urlencoded";
                byte[] param = HttpContext.Current.Request.BinaryRead(HttpContext.Current.Request.ContentLength);
                string strRequest = Encoding.ASCII.GetString(param);
                strRequest += "&cmd=_notify-validate";
                req.ContentLength = strRequest.Length;

                StreamWriter streamOut = new StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII);
                streamOut.Write(strRequest);
                streamOut.Close();
                StreamReader streamIn = new StreamReader(req.GetResponse().GetResponseStream());
                strResponse = streamIn.ReadToEnd();
                streamIn.Close();
            }
            catch (Exception ex)
            {
                args.MessageName = "RequestErr";
                args.Success = false;
                args.Exception = ex;

                OnPaymentConfirmed(args);
                return;
            }

            if (strResponse == "VERIFIED")
            {

                var allowedStatus = new List<string>();
                allowedStatus.Add("completed");
                if (base.PaymentData.IsDebug)
                    allowedStatus.Add("pending");

                args.TotalPaid = 0;
                Decimal.TryParse(
                    HttpContext.Current.Request.Form["mc_gross"].Replace(',', '.'),
                    NumberStyles.Any,
                    new CultureInfo("en-US"),
                    out args.TotalPaid);

                string payment_status = HttpContext.Current.Request.Form["payment_status"].ToString();
                string receiver_email = HttpContext.Current.Request.Form["receiver_email"].ToString();

                if (!allowedStatus.Contains(payment_status.ToLower()))
                {
                    args.Success = false;
                    args.MessageName = "InvalidPaymentStatus";

                    OnPaymentConfirmed(args);
                    return;
                }

                if (base.PaymentData.PayAccount != receiver_email)
                {
                    args.Success = false;
                    args.MessageName = "InvalidReceiverEmail";

                    OnPaymentConfirmed(args);
                    return;
                }

            }
            else
            {
                args.Success = false;
                args.MessageName = "InvalidRespone:["+ strResponse +"] ";

                OnPaymentConfirmed(args);
                return;
            }

            args.MessageName = "OK";
            OnPaymentConfirmed(args);
        }
Beispiel #9
0
 private static void UIGeneralEvents_OnConfirm(object sender, ConfirmEventArgs e)
 {
     e.IsConfirm = MessageBox.Show(null, e.Message, "Pay Attention", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1) == DialogResult.Yes;
 }