示例#1
0
            public void DiscoverPaymentMethodBVG()
            {
                PaymentMethodsBVG paymentMethodsBVG = new PaymentMethodsBVG();

                try
                {
                    paymentMethodsBVG = connector.DiscoverPaymentMethodBVG();

                    foreach (Dictionary <string, Object> elementDic in paymentMethodsBVG.GetPaymentMethodsBVGList())
                    {
                        printDictionary(elementDic, "");
                    }
                }
                catch (ResponseException ex)
                {
                    Console.WriteLine(ex.Message);
                }
                catch (ConnectionException ex)
                {
                    Console.WriteLine(ex.Message);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        public void DiscoverPaymentMethodsFailTest()
        {
            BvgConnectorMock connector = GetConnector(DiscoverDataProvider.GetDiscoverFailResponse());

            PaymentMethodsBVG response = connector.DiscoverPaymentMethodBVG();

            Assert.AreNotEqual(null, response);

            Assert.AreEqual(0, response.GetPaymentMethodsBVGList().Count);
        }
示例#3
0
        public static PaymentMethodsBVG ParseJsonToPaymentMethod(string json)
        {
            PaymentMethodsBVG paymentMethodsBVG = new PaymentMethodsBVG();
            List <Dictionary <string, Object> > paymentMethodsBVGList = new List <Dictionary <string, Object> >();
            string message = "Response vacio o nulo";

            if (json != null && json.Equals(""))
            {
                throw new ResponseException(message);
            }

            try
            {
                List <Dictionary <string, Object> > jsonlist = ParseJsonToList(json);

                foreach (Dictionary <string, Object> jsonElement in jsonlist)
                {
                    Dictionary <string, Object> paymentMethodsBVGDic = new Dictionary <string, Object>();
                    paymentMethodsBVGDic.Add(ElementNames.BVG_ID_MEDIO_PAGO, (string)jsonElement[ElementNames.BVG_ID_MEDIO_PAGO]);
                    paymentMethodsBVGDic.Add(ElementNames.BVG_NOMBRE, (string)jsonElement[ElementNames.BVG_NOMBRE]);
                    paymentMethodsBVGDic.Add(ElementNames.BVG_TIPO_MEDI_PAGO, (string)jsonElement[ElementNames.BVG_TIPO_MEDI_PAGO]);
                    paymentMethodsBVGDic.Add(ElementNames.BVG_ID_BANCO, (string)jsonElement[ElementNames.BVG_ID_BANCO]);
                    paymentMethodsBVGDic.Add(ElementNames.BVG_NOMBRE_BANCO, (string)jsonElement[ElementNames.BVG_NOMBRE_BANCO]);
                    paymentMethodsBVGList.Add(paymentMethodsBVGDic);
                }
            }
            catch (JsonSerializationException)
            {
                Dictionary <string, Object> paymentMethodsBVGDic = new Dictionary <string, Object>();
                paymentMethodsBVGList.Add(paymentMethodsBVGDic);
            }
            catch (Exception ex)
            {
                throw new ResponseException(ex.Message);
            }

            paymentMethodsBVG.SetPaymentMethodsBVGList(paymentMethodsBVGList);

            return(paymentMethodsBVG);
        }
        public void DiscoverPaymentMethodsOKTest()
        {
            BvgConnectorMock connector = GetConnector(DiscoverDataProvider.GetDiscoverOkResponse());

            PaymentMethodsBVG response = connector.DiscoverPaymentMethodBVG();

            Assert.AreNotEqual(null, response);

            Assert.AreNotEqual(null, response.GetPaymentMethodsBVGList());

            Assert.AreEqual(true, response.GetPaymentMethodsBVGList().Count > 0);

            Dictionary <string, Object> paymentCollection = response.GetPaymentMethodsBVGList()[0];

            Assert.AreEqual(true, paymentCollection.Count > 0);

            Assert.AreEqual(true, paymentCollection.ContainsKey("idMedioPago"));
            Assert.AreEqual(true, paymentCollection.ContainsKey("nombre"));
            Assert.AreEqual(true, paymentCollection.ContainsKey("tipoMedioPago"));
            Assert.AreEqual(true, paymentCollection.ContainsKey("idBanco"));
            Assert.AreEqual(true, paymentCollection.ContainsKey("nombreBanco"));
        }
        public PaymentMethodsBVG DiscoverPaymentMethodBVG()
        {
            PaymentMethodsBVG result = bvgClient.DiscoverPaymentMethodBVG();

            return(result);
        }