Exemple #1
0
        // GUARDAR ESTADO CANALES
        private async void guardarDatosCanales(string token, string pan, string cpcEstadoPos, string cpcEstadoAtm, string cpcEstadoEcom, string cpcEstadoMoto, int positionActual)
        {
            try
            {
                JsonValue jsonResponseOnOffCardStatus = await WebServiceSecurity.ServiciosSecurity.CallRESTChangePaymentChannels
                                                            (token, pan, cpcEstadoPos, cpcEstadoAtm, cpcEstadoEcom, cpcEstadoMoto, UtilAndroid.getRut(), parametriaLogUtil.getIdDispositivoParaLog(UtilAndroid.getIMEI(activity)), ParametriaLogUtil.GetIpLocal());

                if (!string.IsNullOrEmpty(jsonResponseOnOffCardStatus.ToString()))
                {
                    string codigoRespuesta = jsonResponseOnOffCardStatus["statusCode"];

                    if (codigoRespuesta.Equals(ConstantesOnOff.TEXTO_ESTADO_SUCCESS))
                    {
                        OnOffData elementoActual = datosTarjeta[positionActual];
                        elementoActual.estadoTarjetaCredito["estadoPos"]  = cpcEstadoPos;
                        elementoActual.estadoTarjetaCredito["estadoEcom"] = cpcEstadoEcom;
                        elementoActual.estadoTarjetaCredito["estadoAtm"]  = cpcEstadoAtm;
                        elementoActual.estadoTarjetaCredito["estadoMoto"] = cpcEstadoMoto;
                    }
                    else
                    {
                        DialogoErrorActivity.mostrarViewErrorHome(activity);
                    }
                }
                else
                {
                    DialogoErrorActivity.mostrarViewErrorHome(activity);
                }
            }
            catch (System.Exception x)
            {
                Console.WriteLine(x);
                DialogoErrorActivity.mostrarViewError(activity);
            }
        }
Exemple #2
0
        // GUARDAR ESTADOS TARJETA
        private async void guardarEstadoTarjetaCredito(int position, bool estadoTarjeta, string estadoTarjetaRequest, string token, string pan)
        {
            dialogoLoadingBcoSecurityActivity.mostrarViewLoadingSecurity();
            View     view       = listadoItemsView[position];
            TextView statusCard = view.FindViewById <TextView>(Resource.Id.lblStatusCard);
            TextView lblInfo    = view.FindViewById <TextView>(Resource.Id.lblInfo);

            try
            {
                JsonValue jsonResponseOnOffCardStatus = await WebServiceSecurity.ServiciosSecurity.CallRESTSetEnable(token, pan, estadoTarjetaRequest, UtilAndroid.getRut(), parametriaLogUtil.getIdDispositivoParaLog(UtilAndroid.getIMEI(activity)), ParametriaLogUtil.GetIpLocal());

                if (!string.IsNullOrEmpty(jsonResponseOnOffCardStatus.ToString()))
                {
                    string codigoRespuesta = jsonResponseOnOffCardStatus["statusCode"];

                    if (codigoRespuesta.Equals(ConstantesOnOff.TEXTO_ESTADO_SUCCESS) && estadoTarjeta)
                    {
                        statusCard.Text = ConstantesOnOff.TEXTO_ESTADO_ON;
                        statusCard.SetTextColor(statusCard.Context.Resources.GetColor(Resource.Color.green));
                        lblInfo.Text = ConstantesOnOff.GLOSA_CREDITO_ON;
                        OnOffData elementoActual = datosTarjeta[position];
                        elementoActual.estadoTarjetaCredito["estado"] = ConstantesOnOff.ESTADO_ACTIVADO_1;
                        cambiarEstadoPanelCanales(position, statusCard.Text);
                        DialogoLoadingBcoSecurityActivity.ocultarLoadingSecurity();
                    }
                    else if (codigoRespuesta.Equals(ConstantesOnOff.TEXTO_ESTADO_SUCCESS) && !estadoTarjeta)
                    {
                        statusCard.Text = ConstantesOnOff.TEXTO_ESTADO_OFF;
                        statusCard.SetTextColor(statusCard.Context.Resources.GetColor(Resource.Color.red));
                        lblInfo.Text = ConstantesOnOff.GLOSA_CREDITO_OFF;
                        OnOffData elementoActual = datosTarjeta[position];
                        elementoActual.estadoTarjetaCredito["estado"] = ConstantesOnOff.ESTADO_DESACTIVADO_0;
                        cambiarEstadoPanelCanales(position, statusCard.Text);
                        DialogoLoadingBcoSecurityActivity.ocultarLoadingSecurity();
                    }
                    else
                    {
                        DialogoErrorActivity.mostrarViewErrorHome(activity);
                    }
                }
                else
                {
                    DialogoErrorActivity.mostrarViewErrorHome(activity);
                }
            }
            catch (System.Net.WebException ex)
            {
                Console.WriteLine(ex);
                DialogoErrorActivity.mostrarViewErrorHome(activity);
            }
            catch (ArgumentException ax)
            {
                Console.WriteLine(ax);
                DialogoErrorActivity.mostrarViewErrorHome(activity);
            }
        }
Exemple #3
0
        public void cambiarEstadoPanelCanales(int position, string estadoGeneral)
        {
            OnOffData elementoActual       = datosTarjeta[position];
            string    estadoTarjetaCredito = elementoActual.estadoTarjetaCredito["estado"];
            bool      estado = false;

            if (estadoTarjetaCredito.Equals(ConstantesOnOff.ESTADO_ACTIVADO_1))
            {
                estado = true;
            }

            View view = obtenerVista(position);

            cambiarEstadoSwitchCanales(elementoActual.estadoTarjetaCredito, view);

            try
            {
                using (Switch swtCanalComprasPresenciales = view.FindViewById <Switch>(Resource.Id.swtCanalComprasPresenciales)){
                    swtCanalComprasPresenciales.CheckedChange += null;
                    swtCanalComprasPresenciales.Enabled        = estado;
                    setColorSwitchCanalesBloqued(swtCanalComprasPresenciales, estado);
                    swtCanalComprasPresenciales.CheckedChange += eventoCanalPresencial;
                }

                using (Switch swtCanalComprasPorInternet = view.FindViewById <Switch>(Resource.Id.swtCanalComprasPorInternet)){
                    swtCanalComprasPorInternet.CheckedChange += null;
                    swtCanalComprasPorInternet.Enabled        = estado;
                    setColorSwitchCanalesBloqued(swtCanalComprasPorInternet, estado);
                    swtCanalComprasPorInternet.CheckedChange += eventoCanalInternet;
                }

                using (Switch swtCanaLGirosCajerosAutomaticos = view.FindViewById <Switch>(Resource.Id.swtCanaLGirosCajerosAutomaticos)){
                    swtCanaLGirosCajerosAutomaticos.CheckedChange += null;
                    swtCanaLGirosCajerosAutomaticos.Enabled        = estado;
                    setColorSwitchCanalesBloqued(swtCanaLGirosCajerosAutomaticos, estado);
                    swtCanaLGirosCajerosAutomaticos.CheckedChange += eventoCanalAutomatico;
                }

                using (Switch swtCanaLComprasViaTelefonica = view.FindViewById <Switch>(Resource.Id.swtCanaLComprasViaTelefonica)){
                    swtCanaLComprasViaTelefonica.CheckedChange += null;
                    swtCanaLComprasViaTelefonica.Enabled        = estado;
                    setColorSwitchCanalesBloqued(swtCanaLComprasViaTelefonica, estado);
                    swtCanaLComprasViaTelefonica.CheckedChange += eventoCanalTelefonica;
                }
            }
            catch (System.Exception x)
            {
                Console.WriteLine(x);
                DialogoErrorActivity.mostrarViewErrorHome(activity);
            }
        }
Exemple #4
0
        private View consultarEstadoTarjetaDebito(int position, View itemView, Switch swtNameCard)
        {
            try
            {
                JsonValue jsonResponseAccessToken = WebServiceSecurity.ServiciosSecurity.CallRESTToken();
                OnOffData detalleTarjeta          = (OnOffData)datosTarjeta[position];
                if (!string.IsNullOrEmpty(jsonResponseAccessToken.ToString()))
                {
                    JsonValue token      = jsonResponseAccessToken["access_token"];
                    TextView  nameCard   = itemView.FindViewById <TextView>(Resource.Id.lblNameCard);
                    TextView  statusCard = itemView.FindViewById <TextView>(Resource.Id.lblStatusCard);
                    TextView  lblInfo    = itemView.FindViewById <TextView>(Resource.Id.lblInfo);

                    string pan           = datosTarjeta[position].Pan;
                    int    contadorFinal = pan.Length - 3;
                    pan = pan.Substring(3, contadorFinal); // para redbank no se envia los ceros del comienzo.
                    JsonValue jsonResponseCheckCardStatus = detalleTarjeta.estadoTarjetaDebito;
                    string    estadoTarjetaDebito         = jsonResponseCheckCardStatus["statusDescription"];

                    if (estadoTarjetaDebito.Equals(ConstantesOnOff.ESTADO_ACTIVADO_ON))
                    {
                        swtNameCard.Checked = true;
                        statusCard.Text     = ConstantesOnOff.TEXTO_ESTADO_ON;
                        statusCard.SetTextColor(statusCard.Context.Resources.GetColor(Resource.Color.security_on_off_activado));
                        lblInfo.Text = ConstantesOnOff.GLOSA_DEBITO_ON;
                    }
                    else
                    {
                        swtNameCard.Checked = false;
                        statusCard.Text     = ConstantesOnOff.TEXTO_ESTADO_OFF;
                        statusCard.SetTextColor(statusCard.Context.Resources.GetColor(Resource.Color.security_on_off_desactivado));
                        lblInfo.Text = ConstantesOnOff.GLOSA_DEBITO_OFF;
                    }
                    var font = Typeface.CreateFromAsset(activity.Assets, ConstantesOnOff.rutaFuenteTitilium);
                    lblInfo.Typeface    = font;
                    statusCard.Typeface = font;
                    nameCard.Typeface   = font;
                }
                else
                {
                    DialogoErrorActivity.mostrarViewErrorHome(activity);
                }
            }
            catch (System.Exception se)
            {
                Console.WriteLine(se);
                DialogoErrorActivity.mostrarViewErrorHome(activity);
            }
            return(itemView);
        }
Exemple #5
0
        private async void guardarEstadoTarjetaDebito(int position, bool estadoTarjeta, string estadoTarjetaRequest, string token, string pan)
        {
            dialogoLoadingBcoSecurityActivity.mostrarViewLoadingSecurity();
            View     view          = listadoItemsView[position];
            TextView statusCard    = view.FindViewById <TextView>(Resource.Id.lblStatusCard);
            TextView lblInfo       = view.FindViewById <TextView>(Resource.Id.lblInfo);
            int      contadorFinal = pan.Length - 3;

            pan = pan.Substring(3, contadorFinal); // para redbank no se envia los ceros del comienzo.
            try
            {
                JsonValue jsonResponseOnOffCardStatus = await WebServiceSecurity.ServiciosSecurity.CallRESTOnOffCardStatus
                                                            (token, SecurityEndpoints.oceFi, SecurityEndpoints.oceAbaBranch, pan, SecurityEndpoints.oceAccountType, estadoTarjetaRequest, UtilAndroid.getRut(), parametriaLogUtil.getIdDispositivoParaLog(UtilAndroid.getIMEI(activity)), ParametriaLogUtil.GetIpLocal());

                if (!string.IsNullOrEmpty(jsonResponseOnOffCardStatus.ToString()))
                {
                    string codigoRespuesta = jsonResponseOnOffCardStatus["statusCode"];
                    if (codigoRespuesta.Equals(ConstantesOnOff.TEXTO_ESTADO_SUCCESS) && estadoTarjeta)
                    {
                        statusCard.Text = ConstantesOnOff.TEXTO_ESTADO_ON;
                        statusCard.SetTextColor(statusCard.Context.Resources.GetColor(Resource.Color.green));
                        lblInfo.Text = ConstantesOnOff.GLOSA_DEBITO_ON;
                        DialogoLoadingBcoSecurityActivity.ocultarLoadingSecurity();
                    }
                    else if (codigoRespuesta.Equals(ConstantesOnOff.TEXTO_ESTADO_SUCCESS) && !estadoTarjeta)
                    {
                        statusCard.Text = ConstantesOnOff.TEXTO_ESTADO_OFF;
                        statusCard.SetTextColor(statusCard.Context.Resources.GetColor(Resource.Color.red));
                        lblInfo.Text = ConstantesOnOff.GLOSA_DEBITO_OFF;
                        DialogoLoadingBcoSecurityActivity.ocultarLoadingSecurity();
                    }
                    else
                    {
                        DialogoErrorActivity.mostrarViewErrorHome(activity);
                    }
                }
                else
                {
                    DialogoErrorActivity.mostrarViewErrorHome(activity);
                }
            }
            catch (System.Exception x)
            {
                Console.WriteLine(x);
                DialogoErrorActivity.mostrarViewError(activity);
            }
        }
Exemple #6
0
 public View consultarEstadoTarjetaCredito(int position, View itemView, Switch switchEstadoTarjeta)
 {
     try
     {
         OnOffData detalleTarjeta          = (OnOffData)datosTarjeta[position];
         TextView  nameCard                = itemView.FindViewById <TextView>(Resource.Id.lblNameCard);
         TextView  statusCard              = itemView.FindViewById <TextView>(Resource.Id.lblStatusCard);
         TextView  lblInfo                 = itemView.FindViewById <TextView>(Resource.Id.lblInfo);
         JsonValue jsonResponseAccessToken = WebServiceSecurity.ServiciosSecurity.CallRESTToken();
         if (!string.IsNullOrEmpty(jsonResponseAccessToken.ToString()))
         {
             JsonValue token = jsonResponseAccessToken["access_token"];
             JsonValue jsonResponseCheckCardStatus            = detalleTarjeta.estadoTarjetaCredito;
             string    jsonResponseCheckCardStatus_StatusCode = jsonResponseCheckCardStatus["statusCode"];
             string    estadoTarjetaCredito = jsonResponseCheckCardStatus["estado"];
             if (estadoTarjetaCredito.Equals(ConstantesOnOff.ESTADO_ACTIVADO_1))
             {
                 switchEstadoTarjeta.Checked = true;
                 statusCard.Text             = ConstantesOnOff.TEXTO_ESTADO_ON;
                 statusCard.SetTextColor(statusCard.Context.Resources.GetColor(Resource.Color.security_on_off_activado));
                 lblInfo.Text = ConstantesOnOff.GLOSA_CREDITO_ON;
             }
             else
             {
                 switchEstadoTarjeta.Checked = false;
                 statusCard.Text             = ConstantesOnOff.TEXTO_ESTADO_OFF;
                 statusCard.SetTextColor(statusCard.Context.Resources.GetColor(Resource.Color.security_on_off_desactivado));
                 lblInfo.Text = ConstantesOnOff.GLOSA_CREDITO_OFF;
             }
             var font = Typeface.CreateFromAsset(activity.Assets, ConstantesOnOff.rutaFuenteTitilium);
             lblInfo.Typeface    = font;
             statusCard.Typeface = font;
             nameCard.Typeface   = font;
         }
         else
         {
             DialogoErrorActivity.mostrarViewErrorHome(activity);
         }
     }
     catch (System.Exception x)
     {
         Console.WriteLine(x);
         DialogoErrorActivity.mostrarViewErrorHome(activity);
     }
     return(itemView);
 }
Exemple #7
0
        private async void eventoCanalGenerico(View view, int positionActual)
        {
            try
            {
                Switch swtCanalComprasPresenciales     = view.FindViewById <Switch>(Resource.Id.swtCanalComprasPresenciales);
                Switch swtCanalComprasPorInternet      = view.FindViewById <Switch>(Resource.Id.swtCanalComprasPorInternet);
                Switch swtCanaLGirosCajerosAutomaticos = view.FindViewById <Switch>(Resource.Id.swtCanaLGirosCajerosAutomaticos);
                Switch swtCanaLComprasViaTelefonica    = view.FindViewById <Switch>(Resource.Id.swtCanaLComprasViaTelefonica);

                string pan           = datosTarjeta[positionActual].Pan;
                bool   cpcEstadoPos  = swtCanalComprasPresenciales.Checked;
                bool   cpcEstadoAtm  = swtCanalComprasPorInternet.Checked;
                bool   cpcEstadoEcom = swtCanaLGirosCajerosAutomaticos.Checked;
                bool   cpcEstadoMoto = swtCanaLComprasViaTelefonica.Checked;

                string cpcEstadoPosRequest  = swtCanalComprasPresenciales.Checked ? "1" : "0";
                string cpcEstadoEcomRequest = swtCanalComprasPorInternet.Checked ? "1" : "0";
                string cpcEstadoAtmRequest  = swtCanaLGirosCajerosAutomaticos.Checked ? "1" : "0";
                string cpcEstadoMotoRequest = swtCanaLComprasViaTelefonica.Checked ? "1" : "0";

                JsonValue jsonResponseAccessToken = await WebServiceSecurity.ServiciosSecurity.CallRESTaccessToken();

                if (!string.IsNullOrEmpty(jsonResponseAccessToken.ToString()))
                {
                    JsonValue token = jsonResponseAccessToken["access_token"];
                    guardarDatosCanales(token, pan, cpcEstadoPosRequest, cpcEstadoAtmRequest, cpcEstadoEcomRequest, cpcEstadoMotoRequest, positionActual);
                }
                else
                {
                    DialogoErrorActivity.mostrarViewErrorHome(activity);
                }
            }
            catch (System.Exception x)
            {
                Console.WriteLine(x);
                DialogoErrorActivity.mostrarViewErrorHome(activity);
            }
        }
Exemple #8
0
        private async void eventoCambioEstadoOnOFF(object sender, EventArgs e)
        {
            try
            {
                Switch btnEvento            = (Switch)sender;
                int    positionActual       = (int)btnEvento.GetTag(Resource.Id.swtNameCard);
                string tipoTarjeta          = datosTarjeta[positionActual].TipoProducto;
                string pan                  = datosTarjeta[positionActual].Pan;
                bool   estadoTarjeta        = btnEvento.Checked;
                string estadoTarjetaRequest = estadoTarjeta ? "1" : "0";

                JsonValue jsonResponseAccessToken = await WebServiceSecurity.ServiciosSecurity.CallRESTaccessToken();

                if (!string.IsNullOrEmpty(jsonResponseAccessToken.ToString()))
                {
                    JsonValue token = jsonResponseAccessToken["access_token"];
                    if (tipoTarjeta.Equals(ConstantesOnOff.TIPO_TARJETA_DEBITO))
                    {
                        guardarEstadoTarjetaDebito(positionActual, estadoTarjeta, estadoTarjetaRequest, token, pan);
                    }
                    else if (tipoTarjeta.Equals(ConstantesOnOff.TIPO_TARJETA_CREDITO))
                    {
                        guardarEstadoTarjetaCredito(positionActual, estadoTarjeta, estadoTarjetaRequest, token, pan);
                    }
                }
                else
                {
                    DialogoErrorActivity.mostrarViewErrorHome(activity);
                }
            }
            catch (System.Exception x)
            {
                Console.WriteLine(x);
                DialogoErrorActivity.mostrarViewErrorHome(activity);
            }
        }