void ReleaseDesignerOutlets()
        {
            if (FormClose != null)
            {
                FormClose.Dispose();
                FormClose = null;
            }

            if (EncapsulatingView != null)
            {
                EncapsulatingView.Dispose();
                EncapsulatingView = null;
            }

            if (PaymentButton != null)
            {
                PaymentButton.Dispose();
                PaymentButton = null;
            }

            if (TableView != null)
            {
                TableView.Dispose();
                TableView = null;
            }
        }
Ejemplo n.º 2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            Title = "Checkout";

            var footerView = new UIView(new CGRect(0, 0, View.Bounds.Width, 164));

            var creditCardButton = new UIButton(UIButtonType.RoundedRect);

            creditCardButton.SetTitle("Checkout with Credit Card", UIControlState.Normal);
            creditCardButton.BackgroundColor    = UIColor.FromRGBA(0.48f, 0.71f, 0.36f, 1.0f);
            creditCardButton.Layer.CornerRadius = 6;
            creditCardButton.SetTitleColor(UIColor.White, UIControlState.Normal);
            creditCardButton.TranslatesAutoresizingMaskIntoConstraints = false;
            creditCardButton.TouchUpInside += CheckoutWithCreditCard;
            footerView.AddSubview(creditCardButton);

            var webCheckoutButton = new UIButton(UIButtonType.RoundedRect);

            webCheckoutButton.SetTitle("Web Checkout", UIControlState.Normal);
            webCheckoutButton.BackgroundColor    = UIColor.FromRGBA(0.48f, 0.71f, 0.36f, 1.0f);
            webCheckoutButton.Layer.CornerRadius = 6;
            webCheckoutButton.SetTitleColor(UIColor.White, UIControlState.Normal);
            webCheckoutButton.TranslatesAutoresizingMaskIntoConstraints = false;
            webCheckoutButton.TouchUpInside += CheckoutOnWeb;
            footerView.AddSubview(webCheckoutButton);

            var applePayButton = PaymentButton.Create(PaymentButtonType.Buy, PaymentButtonStyle.Black);

            applePayButton.TranslatesAutoresizingMaskIntoConstraints = false;
            applePayButton.TouchUpInside += CheckoutWithApplePay;
            footerView.AddSubview(applePayButton);

            var views = NSDictionary.FromObjectsAndKeys(new [] {
                creditCardButton,
                webCheckoutButton,
                applePayButton
            }, new [] {
                "creditCardButton",
                "webCheckoutButton",
                "applePayButton"
            });

            footerView.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-[creditCardButton]-|", 0, null, views));
            footerView.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-[webCheckoutButton]-|", 0, null, views));
            footerView.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-[applePayButton]-|", 0, null, views));
            footerView.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|-[creditCardButton(44)]-[webCheckoutButton(==creditCardButton)]-[applePayButton(==creditCardButton)]-|", 0, null, views));

            TableView.TableFooterView = footerView;

            // Prefetch the shop object for Apple Pay
            client.GetShop((shop, error) => {
                this.shop = shop;
            });
        }
        private void EnumTap(PaymentButton obj)
        {
            currentButton            = obj;
            currentButton.IsSelected = true;
            foreach (var item in ToolbarItem)
            {
                if (item != currentButton)
                {
                    item.IsSelected = false;
                }
                if (item.Type == PaymenEnum.Personal_shipping_detail && obj.Type == PaymenEnum.Personal_shipping_detail)
                {
                    item.IsSelected = true;
                }
                else
                {
                    item.IsSelected = false;
                }
            }
            if (ToolbarItem[0].IsSelected == true)
            {
                obj.IsSelected = true;
            }
            else
            {
                obj.IsSelected = true;
            }
            if (obj.Type == PaymenEnum.Personal_shipping_detail)
            {
                FirstName    = "";
                LastName     = "";
                EmailAddress = "";
                PhoneNumber  = "";

                Country        = "";
                Address        = "";
                ZIPCode        = "";
                City           = "";
                obj.IsSelected = true;
                positionView   = 0;
            }
            else
            {
                obj.IsSelected            = false;
                ToolbarItem[0].IsSelected = true;
            }
        }
Ejemplo n.º 4
0
 private void BuildDailyParkingTariffs()
 {
     foreach (DailyParkingTariff dailyParkingTariff in (List <DailyParkingTariff>)DailyParkingTariffList.Tariff)
     {
         TimePeriod activePeriod1 = dailyParkingTariff.ActivePeriod;
         if (((TimePeriod)activePeriod1).IsCurrent())
         {
             TimePeriod    activePeriod2       = dailyParkingTariff.ActivePeriod;
             PaymentButton paymentAmountButton = this.GetPaymentAmountButton(18, ((TimePeriod)activePeriod2).Duration, this.m_ParkingPermit.StartDate, dailyParkingTariff.Amount);
             paymentAmountButton.Title                 = dailyParkingTariff.Name;
             paymentAmountButton.BackgroundImage       = (Image)Resources.BlueKeyGloss;
             paymentAmountButton.ForceFixedEndDateTime = dailyParkingTariff.IsFixedEndTime;
             PaymentButton paymentButton = paymentAmountButton;
             DateTime      today         = DateTime.Today;
             ref DateTime  local         = ref today;
             TimePeriod    activePeriod3 = dailyParkingTariff.ActivePeriod;
             TimeSpan      end           = ((TimePeriod)activePeriod3).End;
             DateTime      dateTime      = local.Add(end);
             paymentButton.EndDate = dateTime;
             paymentAmountButton.SetText();
             this.flowLayoutPanel2.Controls.Add((Control)paymentAmountButton);
         }
     }
Ejemplo n.º 5
0
        public IActionResult Post([FromBody] ButtonCreateInfo dto)
        {
            var errors        = dto.IsValid();
            var paymentMethod = Context.PaymentMethods
                                .Include(x => x.User)
                                .Include(x => x.Provider)
                                .SingleOrDefault(x => x.Id == dto.PaymentMethodId);

            if (paymentMethod == null)
            {
                errors.Add($"No existe medio de pago con id {dto.PaymentMethodId}");
            }
            if (paymentMethod != null && paymentMethod.User.Id != GetIdFromToken())
            {
                errors.Add("El medio de pago no pertenece al usuario logueado");
            }
            if (errors.Any())
            {
                return(BadRequest(errors));
            }
            var button = new PaymentButton {
                Code         = dto.Code,
                CreationDate = DateTime.Now,
                Method       = paymentMethod,
                Amount       = dto.Amount
            };

            Context.PaymentButtons.Add(button);
            Context.SaveChanges();
            return(Ok(new {
                button.Id,
                button.Code,
                button.Amount,
                button.CreationDate,
                button.Method.Provider.Name
            }));
        }
 private void UserControl_Loaded(object sender, RoutedEventArgs e)
 {
     PaymentButton.Focus();
 }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            TableView.SeparatorColor = UIColor.Clear;

            if (UIDevice.CurrentDevice.UserInterfaceIdiom != UIUserInterfaceIdiom.Pad)
            {
                NSNotificationCenter defaultCenter = NSNotificationCenter.DefaultCenter;
                defaultCenter.AddObserver(UIKeyboard.WillHideNotification, OnKeyboardNotification);
                defaultCenter.AddObserver(UIKeyboard.WillShowNotification, OnKeyboardNotification);
            }

            if (String.IsNullOrEmpty(tokenPayment.Token))
            {
                DispatchQueue.MainQueue.DispatchAfter(DispatchTime.Now, () => {
                    UIAlertView _error = new UIAlertView("Missing Token", "No Card Token found. Please provide application with token via Pre-Authentication or Payment", null, "ok", null);
                    _error.Show();

                    _error.Clicked += (sender, args) => {
                        PaymentButton.Disable();
                        if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
                        {
                            this.DismissViewController(true, null);
                        }
                        else
                        {
                            this.NavigationController.PopViewController(true);
                        }
                    };
                });
            }
            else
            {
                SetUpTableView();

                UITapGestureRecognizer tapRecognizer = new UITapGestureRecognizer();

                tapRecognizer.AddTarget(() => {
                    if (KeyboardVisible)
                    {
                        DismissKeyboardAction();
                    }
                });

                tapRecognizer.NumberOfTapsRequired    = 1;
                tapRecognizer.NumberOfTouchesRequired = 1;

                EncapsulatingView.AddGestureRecognizer(tapRecognizer);
                PaymentButton.Disable();

                PaymentButton.SetTitleColor(UIColor.Black, UIControlState.Application);

                PaymentButton.TouchUpInside += (sender, ev) => {
                    MakeTokenPayment();
                };

                if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
                {
                    FormClose.TouchUpInside += (sender, ev) => {
                        this.DismissViewController(true, null);
                    };
                }
            }
        }
        public void MakeTokenPayment()
        {
            try {
                LoadingScreen.ShowLoading(this.View);
                var instance = JudoConfiguration.Instance;
                tokenPayment.CV2 = tokenCell.CCV;

                PaymentButton.Disable();


                _paymentService.MakeTokenPreAuthorisation(tokenPayment, new ClientService()).ContinueWith(reponse => {
                    if (reponse.Exception != null)
                    {
                        LoadingScreen.HideLoading();
                        DispatchQueue.MainQueue.DispatchAfter(DispatchTime.Now, () => {
                            NavigationController.CloseView();

                            reponse.Exception.FlattenToJudoFailure(failureCallback);
                        });
                    }
                    else
                    {
                        var result = reponse.Result;
                        if (result != null && !result.HasError && result.Response.Result != "Declined")
                        {
                            PaymentReceiptModel paymentreceipt = result.Response as PaymentReceiptModel;
                            // call success callback
                            if (successCallback != null)
                            {
                                DispatchQueue.MainQueue.DispatchAfter(DispatchTime.Now, () => {
                                    NavigationController.CloseView();

                                    successCallback(paymentreceipt);
                                });
                            }
                        }
                        else
                        {
                            // Failure callback
                            if (failureCallback != null)
                            {
                                var judoError = new JudoError {
                                    ApiError = result != null ? result.Error : null
                                };
                                var paymentreceipt = result != null ? result.Response as PaymentReceiptModel : null;

                                if (paymentreceipt != null)
                                {
                                    // send receipt even we got card declined
                                    DispatchQueue.MainQueue.DispatchAfter(DispatchTime.Now, () => {
                                        NavigationController.CloseView();

                                        failureCallback(judoError, paymentreceipt);
                                    });
                                }
                                else
                                {
                                    DispatchQueue.MainQueue.DispatchAfter(DispatchTime.Now, () => {
                                        NavigationController.CloseView();

                                        failureCallback(judoError);
                                    });
                                }
                            }
                        }
                    }
                    LoadingScreen.HideLoading();
                });
            } catch (Exception ex) {
                LoadingScreen.HideLoading();
                // Failure callback
                if (failureCallback != null)
                {
                    var judoError = new JudoError {
                        Exception = ex
                    };
                    DispatchQueue.MainQueue.DispatchAfter(DispatchTime.Now, () => {
                        NavigationController.CloseView();

                        failureCallback(judoError);
                    });
                }
            }
        }