Пример #1
0
        public ConfirmaRespuestaPagoResponse ConfirmPayment(ConfirmaRespuestaPagoRequest request)
        {
            string methodName = string.Format("{0}", System.Reflection.MethodBase.GetCurrentMethod().Name);

            this.ProviderLogger.InfoLow(() => TagValue.New().MethodName(methodName)
                                        .Message("Started"));

            ConfirmaRespuestaPagoResponse response = new ConfirmaRespuestaPagoResponse();

            string sessionId = this.GetSessionId(request, response, out this.errorMessage);

            this.ProviderLogger.InfoLow(() => TagValue.New().MethodName(methodName)
                                        .Message("[" + sessionId + "] " + " Confirmando respuesta."));
            if (this.errorMessage != ErrorMessagesMnemonics.None)
            {
                this.LogResponse(response);
                return(response);
            }

            try
            {
                PSE_WS.PSEPortTypeClient client = new PSE_WS.PSEPortTypeClient();



                CustomBinding binding = new CustomBinding(
                    new CustomTextMessageBindingElement("iso-8859-1", "text/xml", MessageVersion.Soap11),
                    new HttpsTransportBindingElement());


                client.Endpoint.Binding = binding;



                string message;

                // string respuesta=pse.Listar_Bancos(this.PSEUSer, this.PSEPassword, this.PSEMD5Key, out message, out bankList);

                string respuesta = client.Confirma_Respuesta_Pago(this.PSEUSer, this.PSEPassword, this.PSEMD5Key, request.NumeroTransaccion, out message, out response.int_estado_pago, out response.str_nombre_banco, out response.str_codigo_transaccion, out response.int_ciclo_transaccion, out response.dat_fecha, out response.fechatransaccion,
                                                                  out response.horatransaccion, out response.descripcion_pago, out response.email, out response.nombre_cliente, out response.apellido_cliente, out response.telefono_cliente, out response.direccion, out response.pais, out response.ciudad, out response.info_opcional1, out response.info_opcional2, out response.info_opcional3, out response.firma, out response.ip, out response.total_con_iva, out response.valor_iva);
                response.respuesta       = respuesta;
                response.ResponseMessage = message;
                response.errorsms        = message;

                if (respuesta.Equals("OK"))
                {
                    response.ResponseCode = Convert.ToInt32(TransaccionEstado.Exitoso);
                }
                else if (respuesta.Equals("PENDING"))
                {
                    response.ResponseCode = Convert.ToInt32(TransaccionEstado.Pendiente);
                }
                else if (respuesta.Equals("NOT_AUTHORIZED"))
                {
                    response.ResponseCode = Convert.ToInt32(TransaccionEstado.Rechazado);
                }
                else if (respuesta.Equals("error"))
                {
                    response.ResponseCode = response.ResponseCode = Convert.ToInt32(TransaccionEstado.Error);
                }
                else
                {
                    response.ResponseCode = Convert.ToInt32(TransaccionEstado.Desconocido);
                }

                this.ProviderLogger.InfoLow(() => TagValue.New().MethodName(methodName).Message("[" + sessionId + "]").Tag("respuesta").Value(respuesta));


                //Si es error resuelto por PSE se consulta el segundo WS de TDC
                if (respuesta.Equals("error")) //o si es algún otro tipo de error.
                {
                    this.ProviderLogger.InfoLow(() => TagValue.New().MethodName(methodName).Message("[" + sessionId + "] Se inicia consulta WS TDC"));

                    TDC_WS.ProcesarTarjetaCreditoPortTypeClient tdcClient = new TDC_WS.ProcesarTarjetaCreditoPortTypeClient();
                    tdcClient.Endpoint.Binding = binding;
                    string codigoderespuesta, mensajesistema, fechatransaccion, numerodeautorizacion, numerodetransaccion, respuestadelared, logdelared, IPproveedordeinternet, IPlatitud, IPlongitud, IPciudad, IPpais, IPcontinente, IPzonahoraria, IPcodigoisopais, TARJETAbanco, TARJETApais, TARJETAtipo, extra1, extra2, extra3;
                    numerodetransaccion = request.NumeroTransaccion;

                    string respuestaTDC = tdcClient.Confirmar_Transaccion(this.PSEUSer, this.PSEPassword, this.PSEMD5Key, ref numerodetransaccion,
                                                                          out codigoderespuesta, out mensajesistema, out fechatransaccion, out numerodeautorizacion,
                                                                          out respuestadelared, out logdelared, out IPproveedordeinternet, out IPlatitud, out IPlongitud, out IPciudad, out IPpais, out IPcontinente, out IPzonahoraria,
                                                                          out IPcodigoisopais, out TARJETAbanco, out TARJETApais, out TARJETAtipo, out extra1, out extra2, out extra3);

                    this.ProviderLogger.InfoLow(() => TagValue.New().MethodName(methodName).Message("[" + sessionId + "]").Tag("respuesta TDC").Value(respuestaTDC).Tag("codigoderespuesta").Value(codigoderespuesta).Tag("mensajesistema").Value(mensajesistema));

                    this.ProviderLogger.InfoLow(() => TagValue.New().MethodName(methodName).Message("[" + sessionId + "] Se mapea resultado TDC con PSE WS TDC"));
                    response = SetResponseFromTDCWS(response, respuestaTDC, numerodetransaccion,
                                                    codigoderespuesta, mensajesistema, fechatransaccion, numerodeautorizacion,
                                                    respuestadelared, logdelared, IPproveedordeinternet, IPlatitud, IPlongitud, IPciudad, IPpais, IPcontinente, IPzonahoraria,
                                                    IPcodigoisopais, TARJETAbanco, TARJETApais, TARJETAtipo, extra1, extra2, extra3);
                    this.ProviderLogger.InfoLow(() => TagValue.New().MethodName(methodName).Message("[" + sessionId + "] fin de Mapeo TDC con PSE WS TDC"));
                }
            }
            catch (Exception e)
            {
                this.ProviderLogger.InfoLow(() => TagValue.New().MethodName(methodName).Message("[" + sessionId + "] Exception"));
                this.ProviderLogger.ExceptionHigh(() => TagValue.New().MethodName(methodName).Message("[" + sessionId + "] Exception").Exception(e));
            }
            finally {
                this.ProviderLogger.InfoLow(() => TagValue.New().MethodName(methodName)
                                            .Message("[" + sessionId + "] End"));
            }
            return(response);
        }
Пример #2
0
 public ConfirmaRespuestaPagoResponse ConfirmPayment(ConfirmaRespuestaPagoRequest confirmPaymentRequest)
 {
     return(new PaymentProvider().ConfirmPayment(confirmPaymentRequest));
 }