Ejemplo n.º 1
0
        public static RequerimientoStruct_SimpleQueryTx GetRequestSimpleQueryTx(NpsModel model)
        {
            RequerimientoStruct_SimpleQueryTx req = new RequerimientoStruct_SimpleQueryTx();

            req.psp_Version         = "2.2";
            req.psp_MerchantId      = "arsa_smartcar";
            req.psp_QueryCriteria   = model.psp_QueryCriteria;
            req.psp_QueryCriteriaId = model.psp_QueryCriteriaId;
            req.psp_PosDateTime     = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

            NpsEncryptFields operations = new NpsEncryptFields();

            req.psp_SecureHash = operations.EncriptarCampos(GetCatParamsSimpleQueryTx(req));

            return(req);
        }
Ejemplo n.º 2
0
 public static string GetCatParamsSimpleQueryTx(RequerimientoStruct_SimpleQueryTx SimpleQueryTx)
 {
     return(string.Concat(SimpleQueryTx.psp_MerchantId, SimpleQueryTx.psp_PosDateTime,
                          SimpleQueryTx.psp_QueryCriteria, SimpleQueryTx.psp_QueryCriteriaId, SimpleQueryTx.psp_Version));
 }
Ejemplo n.º 3
0
        private tbPayment RequestSimpleQueryTx(NpsModel model)
        {
            try
            {
                tbPayment paymentResult = new tbPayment();
                //var proxy = new NpsService.PaymentServicePlatformPortTypeClient("PaymentServicePlatformPort");

                System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;

                PaymentServicePlatformPortTypeClient client =
                    new PaymentServicePlatformPortTypeClient("PaymentServicePlatformPort");

                RespuestaStruct_SimpleQueryTx     result = new RespuestaStruct_SimpleQueryTx();
                RequerimientoStruct_SimpleQueryTx query  = new RequerimientoStruct_SimpleQueryTx();
                query = GetRequestSimpleQueryTx(model);

                this.AuditRequestResponse(JsonConvert.SerializeObject(query));
                result = client.SimpleQueryTx(query);
                this.AuditRequestResponse(JsonConvert.SerializeObject(result));

                //Estoy actualizando por referencia los valores de los campos dentro del registro tbPaymentDetails
                _paymentDetail.pde_vendor_response_status = result.psp_ResponseCod;

                //Valido si el codigo de respuesta del simple query es OK = 2
                if (Int32.Parse(result.psp_ResponseCod).Equals(2))
                {
                    if (result.psp_Transaction != null)
                    {
                        int responseCode = Int32.Parse(result.psp_Transaction.psp_ResponseCod);
                        //y el codigo de la transaccion=0 "Compra online aprobada"
                        //result.psp_Transaction.psp_ResponseCod = 0 (Pago aceptado)
                        //result.psp_Transaction.psp_ResponseCod = 9 (Pago rechazado)
                        //result.psp_Transaction.psp_ResponseCod = 25 (Formulario en curso)
                        //result.psp_Transaction.psp_ResponseCod = 3 (fondos insuficientes)
                        //result.psp_Transaction.psp_ResponseCod = 9 (form vencido)
                        switch (responseCode)
                        {
                        case 0:
                        {
                            paymentResult.pst_id = (int)EnumPaymentStatus.PAGADO;
                            paymentResult.pay_informacion_adicional = result.psp_Transaction.psp_ResponseMsg;
                            break;
                        }

                        default:
                        {
                            paymentResult.pst_id = (int)EnumPaymentStatus.ERROR;
                            paymentResult.pay_informacion_adicional =
                                result.psp_Transaction.psp_ResponseMsg + " | " +
                                result.psp_Transaction.psp_ResponseExtended;
                            break;
                        }
                        }

                        //Estoy actualizando por referencia los valores de los campos dentro del registro tbPaymentDetails
                        _paymentDetail.pde_vendor_response_id = result.psp_Transaction.psp_TransactionId;
                    }
                }

                return(paymentResult);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }