示例#1
0
 private ProxyPagoServicios.Form ObtenerElementosAdicionales(PagoServiciosInfoAdicional infoAdicional, int moduleId)
 {
     ProxyPagoServicios.Form           formulario = new ProxyPagoServicios.Form();
     ProxyPagoServicios.ArrayOfElement lista      = new ProxyPagoServicios.ArrayOfElement();
     foreach (ElementoFormulario elemento in infoAdicional.ElementosFormulario)
     {
         ProxyPagoServicios.element nuevoElemento = new ProxyPagoServicios.element();
         nuevoElemento.m_value    = elemento.Valor;
         nuevoElemento.m_name     = elemento.Nombre;
         nuevoElemento.m_readonly = elemento.SoloLectura;
         if (elemento.TipoElementoFormulario == "input")
         {
             nuevoElemento.m_eType = ProxyPagoServicios.elementType.input;
             nuevoElemento.m_input = new ProxyPagoServicios.inputElement();
             if (elemento.DefinicionElementoInput.TipoInput == "dinero")
             {
                 nuevoElemento.m_input.m_iType = ProxyPagoServicios.iType.dinero;
             }
             else if (elemento.DefinicionElementoInput.TipoInput == "fecha")
             {
                 nuevoElemento.m_input.m_iType = ProxyPagoServicios.iType.fecha;
             }
             else if (elemento.DefinicionElementoInput.TipoInput == "numero")
             {
                 nuevoElemento.m_input.m_iType = ProxyPagoServicios.iType.numero;
             }
             else if (elemento.DefinicionElementoInput.TipoInput == "password")
             {
                 nuevoElemento.m_input.m_iType = ProxyPagoServicios.iType.password;
             }
             else if (elemento.DefinicionElementoInput.TipoInput == "submit")
             {
                 nuevoElemento.m_input.m_iType = ProxyPagoServicios.iType.submit;
             }
             else if (elemento.DefinicionElementoInput.TipoInput == "texto")
             {
                 nuevoElemento.m_input.m_iType = ProxyPagoServicios.iType.texto;
             }
             nuevoElemento.m_input.m_iMaxValue = elemento.DefinicionElementoInput.ValorMaximo;
             nuevoElemento.m_input.m_iMinValue = elemento.DefinicionElementoInput.ValorMinimo;
         }
         else if (elemento.TipoElementoFormulario == "select")
         {
             nuevoElemento.m_eType            = ProxyPagoServicios.elementType.select;
             nuevoElemento.m_select           = new ProxyPagoServicios.selectElement();
             nuevoElemento.m_select.m_options = new ProxyPagoServicios.ArrayOfOption();
             foreach (OpcionSelect opcionSelect in elemento.DefinicionElementoSelect.Opciones)
             {
                 ProxyPagoServicios.option opcion = new ProxyPagoServicios.option();
                 opcion.m_amount = opcionSelect.Cantidad;
                 opcion.m_text   = opcionSelect.Texto;
                 opcion.m_value  = opcionSelect.Valor;
                 nuevoElemento.m_select.m_options.Add(opcion);
             }
         }
         lista.Add(nuevoElemento);
     }
     formulario.m_form     = lista;
     formulario.m_moduleId = moduleId;
     return(formulario);
 }
示例#2
0
 private string Form2_xmlDevData(ProxyPagoServicios.Form formOpciones)
 {
     return(transact.form2_xmlDevData(formOpciones));
 }
示例#3
0
 private ProxyPagoServicios.TResponse GetDot(string requestId, string userName, string skuCode, string numeroCuenta, float monto, int numeroCaja, ProxyPagoServicios.Form form)
 {
     ProxyPagoServicios.TResponse respuesta = transact.DoT(requestId, userName, skuCode, numeroCuenta, monto, numeroCaja, form);
     return(respuesta);
 }
示例#4
0
        /// <summary>
        /// Pago de servicio
        /// </summary>
        /// <returns></returns>
        public ResponseBussiness <OperationResponse> PagoServicio(PagoServiciosRequest pagoServiciosRequest, float monto, string folio)
        {
            SecurityCCK.encripta encripta = new encripta();
            int    intento = 1;
            string resultadoConfirmarEnvioRecibido = "";

            return(tryCatch.SafeExecutor(() =>
            {
                OperationResponse operation = new OperationResponse();
                string requestId = string.Empty;
                requestId = GetRequestId(0);
                if (requestId != "")
                {
                    object cuenta = pagoServiciosRequest.Cuenta;
                    var cuanteEncripatada = encripta.Encrypt(ref cuenta);
                    ProxyPagoServicios.Form formulario = this.ObtenerElementosAdicionales(pagoServiciosRequest.InfoAdicional, pagoServiciosRequest.InfoAdicional.ModuloId);
                    ProxyPagoServicios.TResponse respuestaDot = GetDot(requestId, this.credenciales.UserName, pagoServiciosRequest.SkuCodePagoServicio, cuanteEncripatada.ToString(), monto, this.token.CodeBox, formulario);

                    if (respuestaDot.rcode == 2)//En proceso
                    {
                        while (intento <= this.credenciales.NumeroIntentos)
                        {
                            Thread.Sleep(5000 * 1);
                            ProxyPagoServicios.TResponse respuestaVerificarTransaccion = this.ChecarTransaccion(requestId, this.credenciales.UserName);
                            //si la respuesta es qeu no esta en proceso
                            if (respuestaVerificarTransaccion.rcode != 2)
                            {
                                resultadoConfirmarEnvioRecibido = this.TerminarTransaccionCorrecta(respuestaDot.rcode, requestId, respuestaVerificarTransaccion.op_authorization);
                                intento = 1000;
                            }
                            intento++;
                        }
                        if (resultadoConfirmarEnvioRecibido == "")
                        {
                            ProxyPagoServicios.ReverseResponse respuestaDor = this.DoR(requestId, this.credenciales.UserName);

                            operation.CodeNumber = respuestaDor.rcode.ToString();
                            operation.CodeDescription = respuestaDor.rcode_description;
                        }
                        else
                        {
                            operation.CodeNumber = "1";
                            operation.CodeDescription = resultadoConfirmarEnvioRecibido;
                        }
                    }
                    else if (respuestaDot.rcode == 0 || respuestaDot.rcode == 1) //termino correctamente con ó sin autorizacion
                    {
                        resultadoConfirmarEnvioRecibido = this.TerminarTransaccionCorrecta(respuestaDot.rcode, requestId, respuestaDot.op_authorization);
                        operation.CodeNumber = "1";
                        operation.CodeDescription = resultadoConfirmarEnvioRecibido;

                        this.repository.RegistrarAutorizacionPago(pagoServiciosRequest.SkuCodePagoServicio, pagoServiciosRequest.SkuCode, folio, respuestaDot.op_authorization);
                    }
                    else
                    {
                        operation.CodeNumber = "0";
                        operation.CodeDescription = respuestaDot.rcode_description;
                    }
                }
                else
                {
                    operation.CodeDescription = "Error del Web Service, contactar a Administrador del Sistema";
                    operation.CodeNumber = "0";
                }
                return operation;
            }));
        }