Esempio n. 1
0
        public void RegisterPayment()
        {
            var client = new PagoEfectivoClient();
            var result = client.RegisterNewPayment(new RegisterPayment
            {
                AdditionalData     = "First Payment",
                AdminEmail         = "*****@*****.**",
                Amount             = 100,
                Currency           = Currency.PEN,
                DateExpiry         = new DateTime(2021, 1, 3),
                PaymentConcept     = "Food",
                TransactionCode    = "123666321",
                UserCodeCountry    = "PE",
                UserCountry        = "PERU",
                UserDocumentNumber = "70007800",
                UserDocumentType   = UserDocumentType.DNI,
                UserEmail          = "*****@*****.**",
                UserLastName       = "Carbajal",
                UserName           = "******",
                UserPhone          = "980784506",
                UserUbigeo         = "150101"
            });

            Assert.AreEqual(result.Amount, 100);
            Assert.IsTrue(result.Cip > 0);
            Assert.IsTrue(result.CipUrl.Length > 10);
            Assert.AreEqual(result.Currency, "PEN");
            Assert.AreEqual(result.DateExpiry.DayOfYear, new DateTime(2021, 1, 3).DayOfYear);
        }
Esempio n. 2
0
        public RegisterPaymentResponse RegisterNewPayment(RegisterPayment registerPayment)
        {
            var transactionCode = repository.RegisterPagoEfectivoPayment(new RegisterPagoEfectivoPayment
            {
                AdditionalData     = registerPayment.AdditionalData,
                AdminEmail         = registerPayment.AdminEmail,
                Amount             = registerPayment.Amount,
                Currency           = registerPayment.Currency.ToString(),
                DateExpiry         = registerPayment.DateExpiry,
                PaymentConcept     = registerPayment.PaymentConcept,
                UserCodeCountry    = registerPayment.UserCodeCountry,
                UserCountry        = registerPayment.UserCountry,
                UserDocumentNumber = registerPayment.UserDocumentNumber,
                UserDocumentType   = registerPayment.UserDocumentType.ToString(),
                UserEmail          = registerPayment.UserEmail,
                UserLastName       = registerPayment.UserLastName,
                UserName           = registerPayment.UserName,
                UserPhone          = registerPayment.UserPhone,
                UserUbigeo         = registerPayment.UserUbigeo,
            });

            registerPayment.TransactionCode = transactionCode.ToString();
            var result = client.RegisterNewPayment(registerPayment);

            repository.UpdateCiffOnPagoEfectivoPayment(new UpdateCiffOnPagoEfectivoPayment
            {
                Cip             = result.Cip,
                TransaccionCode = transactionCode,
                CipUrl          = result.CipUrl
            });
            return(result);
        }
Esempio n. 3
0
        public void RegisterPaymentOnDb()
        {
            var repository      = new PagoEfectivoRepository();
            var client          = new PagoEfectivoClient();
            var transactionCode = repository.RegisterPagoEfectivoPayment(new RegisterPagoEfectivoPayment
            {
                AdditionalData     = "First Payment",
                AdminEmail         = "*****@*****.**",
                Amount             = 100,
                Currency           = Currency.PEN.ToString(),
                DateExpiry         = new DateTime(2021, 1, 3),
                PaymentConcept     = "Food",
                UserCodeCountry    = "PE",
                UserCountry        = "PERU",
                UserDocumentNumber = "70007800",
                UserDocumentType   = UserDocumentType.DNI.ToString(),
                UserEmail          = "*****@*****.**",
                UserLastName       = "Carbajal",
                UserName           = "******",
                UserPhone          = "980784506",
                UserUbigeo         = "150101"
            });
            var result = client.RegisterNewPayment(new RegisterPayment
            {
                AdditionalData     = "First Payment",
                AdminEmail         = "*****@*****.**",
                Amount             = 100,
                Currency           = Currency.PEN,
                DateExpiry         = new DateTime(2021, 1, 3),
                PaymentConcept     = "Food",
                TransactionCode    = transactionCode.ToString(),
                UserCodeCountry    = "PE",
                UserCountry        = "PERU",
                UserDocumentNumber = "70007800",
                UserDocumentType   = UserDocumentType.DNI,
                UserEmail          = "*****@*****.**",
                UserLastName       = "Carbajal",
                UserName           = "******",
                UserPhone          = "980784506",
                UserUbigeo         = "150101"
            });

            repository.UpdateCiffOnPagoEfectivoPayment(new UpdateCiffOnPagoEfectivoPayment
            {
                Cip             = result.Cip,
                TransaccionCode = transactionCode,
                CipUrl          = result.CipUrl
            });
            repository.RegisterPaymentOnPagoEfectivo(new RegisterPaymentOnPagoEfectivo
            {
                EventType       = "cip.paid",
                OperationNumber = 1233,
                PaymentDate     = DateTime.Now,
                TransaccionCode = transactionCode
            });
        }