Beispiel #1
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();

            if (!string.IsNullOrEmpty(_customerid))
            {
                RestForms restclient  = new RestForms();
                var       listofcards = await restclient.Get <List <Card> >($"{_baseurl}/Payment/GetCustomerCards/{_customerid}/{App.IdCliente}", new Dictionary <string, object>());

                if (listofcards != null)
                {
                    ListOfCards.ItemsSource = listofcards;
                }
                else
                {
                    ErrorMessage.IsVisible = true;
                }
            }
            else
            {
                ErrorMessage.IsVisible = true;
            }

            ProgressIndicator.IsVisible = false;
        }
Beispiel #2
0
        public async Task GetNotifications()
        {
            Usuario userlast = null;

            try
            {
                Connection connection = new Connection();
                var        db         = connection.GetDataBase();
                userlast = db.Usuario.LastOrDefault();
            }
            catch
            {
            }
            if (userlast != null)
            {
                var client = new RestForms();
                NotificationsResult result = null;
                string url = "";
                if (userlast.IdPerfil == 1)
                {
                    url = $"{App.BaseUrl}/Notification/GetBouchers";
                }
                else if (userlast.IdPerfil == 4)
                {
                    url = $"{App.BaseUrl}/Notification/GetVerificados";
                }
                else if (userlast.IdPerfil == 2)
                {
                    url = $"{App.BaseUrl}/Notification/GetGuias/{userlast.IdUsuario}";
                }
                result = await client.Post <NotificationsResult>(url, new Dictionary <string, object>());

                ProcessNotificationsResult(result);
            }
        }
Beispiel #3
0
        private async void Client_OnSuccess(object sender, string e)
        {
            await Navigation.PopAsync();

            RestForms restclient = new RestForms();
            var       response   = await restclient.Post <ChargeResult, Charge>($"{_baseurl}/Payment/AddChargeToCard/{_customerid}/{App.IdCliente}", new Charge
            {
                amount            = _amount,
                capture           = false,
                currency          = "MXN",
                cvv2              = _card.cvv2,
                description       = _description,
                device_session_id = e,
                source_id         = _token,
                order_id          = $"{_token}_droidshop",
                method            = "card"
            });

            if (response != null && response.status == Openpay.ChargeResult.completed)
            {
                ChargeResult?.Invoke(this, response);
                Instance = null;
            }
            else
            {
                await DisplayAlert("Pago con tarjeta", "Tuvimos un problema para realizar la transaccion con esta tarjeta, verifica el cvv, intenta de nuevo o intenta con otra tarjeta", "Aceptar");

                Device.BeginInvokeOnMainThread(() =>
                {
                    ProgressIndicator.IsVisible = false;
                    StackListCards.IsVisible    = true;
                    FormCvvCard.IsVisible       = false;
                });
            }
        }