Esempio n. 1
0
        public void SendPaygoParams(String action)
        {
            Dictionary <String, String> dictionaryValues = new Dictionary <string, string>();

            if (action.Equals("SALE") || action.Equals("CANCEL"))
            {
                dictionaryValues.Add("valor", editTextValueTEF.Text);
                dictionaryValues.Add("parcelas", editTextInstallmentsTEF.Text);
                dictionaryValues.Add("formaPagamento", selectedPaymentMethod);
                dictionaryValues.Add("tipoParcelamento", selectedInstallmentsMethod);
                if (action.Equals("SALE"))
                {
                    PayGo.efetuaTransacao(Operacoes.Venda, dictionaryValues);
                }
                else if (action.Equals("CANCEL"))
                {
                    PayGo.efetuaTransacao(Operacoes.Cancelamento, dictionaryValues);
                }
            }
            else
            {
                PayGo.efetuaTransacao(Operacoes.Administrativa, dictionaryValues);
            }
        }
Esempio n. 2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.tef);

            //retornoTEF = FindViewById<TextView>(Resource.Id.textViewRetornoTef);
            //retornoTEF.MovementMethod = new Android.Text.Method.ScrollingMovementMethod();

            context = this;

            //INIT IMAGE VIEW VIA PAYGO
            imageViewViaPaygo = FindViewById <ImageView>(Resource.Id.imageViewViaPaygo);

            //INIT IMAGE VIEW VIA PAYGO
            textViewViaMsitef = FindViewById <TextView>(Resource.Id.textViewViaMsitef);

            //MSitef
            intentToMsitef = new Intent("br.com.softwareexpress.sitef.msitef.ACTIVITY_CLISITEF");

            //Setando atividade da Impressora
            Printer.setActivity(this);

            //Inicializando Impressora Interna
            Printer.printerInternalImpStart();

            //Inicializando Paygo
            PayGo.setActivity(this);

            //INIT BUTTONS TYPE TEF
            buttonMsitefOption = FindViewById <Button>(Resource.Id.buttonMsitefOption);
            buttonPaygoOption  = FindViewById <Button>(Resource.Id.buttonPaygoOption);

            //INIT EDIT TEXTs
            editTextValueTEF        = FindViewById <EditText>(Resource.Id.editTextInputValueTEF);
            editTextInstallmentsTEF = FindViewById <EditText>(Resource.Id.editTextInputInstallmentsTEF);
            editTextIpTEF           = FindViewById <EditText>(Resource.Id.editTextInputIPTEF);

            //INIT BUTTONS TYPES PAYMENTS
            buttonCreditOption  = FindViewById <Button>(Resource.Id.buttonCreditOption);
            buttonDebitOption   = FindViewById <Button>(Resource.Id.buttonDebitOption);
            buttonVoucherOption = FindViewById <Button>(Resource.Id.buttonVoucherOption);

            //INIT BUTTONS TYPE INSTALLMENTS
            buttonStoreOption  = FindViewById <Button>(Resource.Id.buttonStoreOption);
            buttonAdmOption    = FindViewById <Button>(Resource.Id.buttonAdmOption);
            buttonAvistaOption = FindViewById <Button>(Resource.Id.buttonAvistaOption);

            //INIT BUTTONS ACTIONS TEF
            buttonSendTransaction    = FindViewById <Button>(Resource.Id.buttonSendTransactionTEF);
            buttonCancelTransaction  = FindViewById <Button>(Resource.Id.buttonCancelTransactionTEF);
            buttonConfigsTransaction = FindViewById <Button>(Resource.Id.buttonConfigsTEF);



            //SELECT INITIALS OPTIONS
            buttonPaygoOption.BackgroundTintList  = GetColorStateList(Resource.Color.verde);
            buttonCreditOption.BackgroundTintList = GetColorStateList(Resource.Color.verde);
            buttonAvistaOption.BackgroundTintList = GetColorStateList(Resource.Color.verde);

            //INIT DEFAULT INPUTS
            editTextValueTEF.Text        = "2000";
            editTextInstallmentsTEF.Text = "1";
            editTextIpTEF.Text           = "192.168.0.31";

            editTextIpTEF.Enabled = false;
            editTextIpTEF.FocusableInTouchMode = false;
            textViewViaMsitef.Visibility       = ViewStates.Invisible;

            //SELECT OPTION M-SITEF
            buttonMsitefOption.Click += delegate
            {
                selectedTefType = "M-Sitef";

                buttonMsitefOption.BackgroundTintList = GetColorStateList(Resource.Color.verde);
                buttonPaygoOption.BackgroundTintList  = GetColorStateList(Resource.Color.black);

                editTextIpTEF.Enabled = true;
                editTextIpTEF.FocusableInTouchMode = true;
                buttonAvistaOption.Enabled         = false;

                if (selectedInstallmentsMethod.Equals("Avista"))
                {
                    selectedInstallmentsMethod            = "Crédito";
                    buttonAvistaOption.BackgroundTintList = GetColorStateList(Resource.Color.black);
                    buttonStoreOption.BackgroundTintList  = GetColorStateList(Resource.Color.verde);
                }
                textViewViaMsitef.Visibility = ViewStates.Visible;

                buttonAvistaOption.Visibility = ViewStates.Invisible;
                imageViewViaPaygo.Visibility  = ViewStates.Invisible;
            };

            //SELECT OPTION PAYGO
            buttonPaygoOption.Click += delegate
            {
                selectedTefType = "PayGo";

                buttonMsitefOption.BackgroundTintList = GetColorStateList(Resource.Color.black);
                buttonPaygoOption.BackgroundTintList  = GetColorStateList(Resource.Color.verde);

                editTextIpTEF.Enabled = false;
                editTextIpTEF.FocusableInTouchMode = false;
                buttonAvistaOption.Enabled         = true;

                buttonAvistaOption.Visibility = ViewStates.Visible;
                textViewViaMsitef.Visibility  = ViewStates.Invisible;
                imageViewViaPaygo.Visibility  = ViewStates.Visible;
            };


            //SELECT OPTION CREDIT PAYMENT
            buttonCreditOption.Click += delegate
            {
                selectedPaymentMethod = "Crédito";

                buttonCreditOption.BackgroundTintList  = GetColorStateList(Resource.Color.verde);
                buttonDebitOption.BackgroundTintList   = GetColorStateList(Resource.Color.black);
                buttonVoucherOption.BackgroundTintList = GetColorStateList(Resource.Color.black);
            };

            //SELECT OPTION DEBIT PAYMENT
            buttonDebitOption.Click += delegate
            {
                selectedPaymentMethod = "Débito";

                buttonCreditOption.BackgroundTintList  = GetColorStateList(Resource.Color.black);
                buttonDebitOption.BackgroundTintList   = GetColorStateList(Resource.Color.verde);
                buttonVoucherOption.BackgroundTintList = GetColorStateList(Resource.Color.black);
            };

            //SELECT OPTION VOUCHER PAYMENT
            buttonVoucherOption.Click += delegate
            {
                selectedPaymentMethod = "Todos";

                buttonCreditOption.BackgroundTintList  = GetColorStateList(Resource.Color.black);
                buttonDebitOption.BackgroundTintList   = GetColorStateList(Resource.Color.black);
                buttonVoucherOption.BackgroundTintList = GetColorStateList(Resource.Color.verde);
            };

            //SELECT OPTION STORE INSTALLMENT
            buttonStoreOption.Click += delegate
            {
                selectedInstallmentsMethod = "Loja";

                buttonStoreOption.BackgroundTintList  = GetColorStateList(Resource.Color.verde);
                buttonAdmOption.BackgroundTintList    = GetColorStateList(Resource.Color.black);
                buttonAvistaOption.BackgroundTintList = GetColorStateList(Resource.Color.black);
            };

            //SELECT OPTION ADM INSTALLMENT
            buttonAdmOption.Click += delegate
            {
                selectedInstallmentsMethod = "Adm";

                buttonStoreOption.BackgroundTintList  = GetColorStateList(Resource.Color.black);
                buttonAdmOption.BackgroundTintList    = GetColorStateList(Resource.Color.verde);
                buttonAvistaOption.BackgroundTintList = GetColorStateList(Resource.Color.black);
            };

            //SELECT OPTION AVISTA INSTALLMENT
            buttonAvistaOption.Click += delegate
            {
                selectedInstallmentsMethod = "Avista";

                buttonStoreOption.BackgroundTintList  = GetColorStateList(Resource.Color.black);
                buttonAdmOption.BackgroundTintList    = GetColorStateList(Resource.Color.black);
                buttonAvistaOption.BackgroundTintList = GetColorStateList(Resource.Color.verde);
            };

            //SELECT BUTTON SEND TRANSACTION
            buttonSendTransaction.Click += delegate
            {
                if (IsEntriesValid())
                {
                    StartActionTef("SALE");
                }
            };

            //SELECT BUTTON CANCEL TRANSACTION
            buttonCancelTransaction.Click += delegate
            {
                if (IsEntriesValid())
                {
                    StartActionTef("CANCEL");
                }
            };

            //SELECT BUTTON CONFIGS TRANSACTION
            buttonConfigsTransaction.Click += delegate
            {
                if (IsEntriesValid())
                {
                    StartActionTef("CONFIGS");
                }
            };
        }