예제 #1
0
        public void TestCreatePartialPaymentRefundBankAccount()
        {
            Moip.Models.PaymentBoletoOrDebitRequest paymentRequest = Helpers.RequestsCreator.CreatePaymentWithOnlineDebitRequest();

            string paymentId = GetClient().Payments.CreateBoletoOrDebit(GetClient().Orders.CreateOrder(Helpers.RequestsCreator.createOrderRequest()).Id, paymentRequest).Id;

            Helpers.TestHelper.AuthorizePayment(paymentId, 2000);

            Thread.Sleep(1000);

            Moip.Models.RefundBankAccountRequest refundRequest = Helpers.RequestsCreator.CreatePartialBankAccountRefundRequest();

            Moip.Models.RefundBankAccountResponse refundResponse = controller.CreatePaymentBankAccount(paymentId, refundRequest);

            Assert.NotNull(refundResponse.Id, "Id should not be null");
            Assert.AreEqual(100, refundResponse.Amount.Total, "Should match exactly (string literal match)");
            Assert.AreEqual("PARTIAL", refundResponse.Type, "Should match exactly (string literal match)");
            Assert.AreEqual("REQUESTED", refundResponse.Status, "Should match exactly (string literal match)");
            Assert.AreEqual("341", refundResponse.RefundingInstrument.BankAccount.BankNumber, "Should match exactly (string literal match)");
            Assert.AreEqual("BANCO ITAÚ S.A.", refundResponse.RefundingInstrument.BankAccount.BankName, "Should match exactly (string literal match)");
            Assert.AreEqual("4444444", refundResponse.RefundingInstrument.BankAccount.AgencyNumber, "Should match exactly (string literal match)");
            Assert.AreEqual("2", refundResponse.RefundingInstrument.BankAccount.AgencyCheckNumber, "Should match exactly (string literal match)");
            Assert.AreEqual("1234", refundResponse.RefundingInstrument.BankAccount.AccountNumber, "Should match exactly (string literal match)");
            Assert.AreEqual("1", refundResponse.RefundingInstrument.BankAccount.AccountCheckNumber, "Should match exactly (string literal match)");
            Assert.AreEqual("BANK_ACCOUNT", refundResponse.RefundingInstrument.Method, "Should match exactly (string literal match)");
        }
예제 #2
0
        public static Moip.Models.PaymentBoletoOrDebitRequest CreatePaymentWithBoletoRequest()
        {
            Moip.Models.BoletoInstructionLines boletoInstructionLines = new Moip.Models.BoletoInstructionLines()
            {
                First  = "TESTETETSTTTST",
                Second = "tfcsddlksjsd",
                Third  = "lkshglashiuahgha"
            };

            Moip.Models.BoletoRequest boletoRequest = new Moip.Models.BoletoRequest()
            {
                ExpirationDate   = "2020-09-30",
                InstructionLines = boletoInstructionLines,
                LogoUri          = "http://"
            };

            Moip.Models.FundingInstrumentRequest fundingInstrumentRequest = new Moip.Models.FundingInstrumentRequest
            {
                Method = "BOLETO",
                Boleto = boletoRequest
            };

            Moip.Models.PaymentBoletoOrDebitRequest paymentRequest = new Moip.Models.PaymentBoletoOrDebitRequest
            {
                FundingInstrument = fundingInstrumentRequest
            };

            return(paymentRequest);
        }
예제 #3
0
        public void TestCreatePaymentWithOnlineDebit()
        {
            Moip.Models.PaymentBoletoOrDebitRequest paymentRequest = Helpers.RequestsCreator.CreatePaymentWithOnlineDebitRequest();

            Moip.Models.PaymentResponse paymentResponse = controller.CreateBoletoOrDebit(GetClient().Orders.CreateOrder(Helpers.RequestsCreator.createOrderRequest()).Id, paymentRequest);

            Assert.NotNull(paymentResponse.Id, "Id should not be null");
            Assert.AreEqual("ONLINE_BANK_DEBIT", paymentResponse.FundingInstrument.Method, "Should match exactly (string literal match)");
            Assert.AreEqual("341", paymentResponse.FundingInstrument.OnlineBankDebit.BankNumber, "Should match exactly (string literal match)");
            Assert.AreEqual("2020-09-30", paymentResponse.FundingInstrument.OnlineBankDebit.ExpirationDate, "Should match exactly (string literal match)");
        }
        public void TestPaymentWithOnlineDebitRequest()
        {
            Moip.Models.PaymentBoletoOrDebitRequest paymentRequest = Helpers.RequestsCreator.CreatePaymentWithOnlineDebitRequest();

            string paymentRequestJson = Moip.Utilities.APIHelper.JsonSerialize(paymentRequest);

            string expectedPaymentRequestJson = Helpers.FileReader.readJsonFile(@"Payment\payment_with_online_debit.json");

            Assert.AreEqual(expectedPaymentRequestJson, paymentRequestJson,
                            "Payment request body should match exactly (string literal match)");
        }
예제 #5
0
        public void TestCreatePaymentWithBoleto()
        {
            Moip.Models.PaymentBoletoOrDebitRequest paymentRequest = Helpers.RequestsCreator.CreatePaymentWithBoletoRequest();

            Moip.Models.PaymentResponse paymentResponse = controller.CreateBoletoOrDebit(GetClient().Orders.CreateOrder(Helpers.RequestsCreator.createOrderRequest()).Id, paymentRequest);

            Assert.NotNull(paymentResponse.Id, "Id should not be null");
            Assert.AreEqual("BOLETO", paymentResponse.FundingInstrument.Method, "Should match exactly (string literal match)");
            Assert.AreEqual("2020-09-30", paymentResponse.FundingInstrument.Boleto.ExpirationDate, "Should match exactly (string literal match)");
            Assert.AreEqual("TESTETETSTTTST", paymentResponse.FundingInstrument.Boleto.InstructionLines.First, "Should match exactly (string literal match)");
            Assert.AreEqual("tfcsddlksjsd", paymentResponse.FundingInstrument.Boleto.InstructionLines.Second, "Should match exactly (string literal match)");
            Assert.AreEqual("lkshglashiuahgha", paymentResponse.FundingInstrument.Boleto.InstructionLines.Third, "Should match exactly (string literal match)");
            Assert.AreEqual("http://", paymentResponse.FundingInstrument.Boleto.LogoUri, "Should match exactly (string literal match)");
            Assert.AreEqual("https://checkout-sandbox.moip.com.br/boleto/" + paymentResponse.Id + "/print", paymentResponse.Links.PayBoleto.PrintHref, "Should match exactly (string literal match)");
            Assert.AreEqual("https://checkout-sandbox.moip.com.br/boleto/" + paymentResponse.Id, paymentResponse.Links.PayBoleto.RedirectHref, "Should match exactly (string literal match)");
        }
예제 #6
0
        public static Moip.Models.PaymentBoletoOrDebitRequest CreatePaymentWithOnlineDebitRequest()
        {
            Moip.Models.OnlineBankDebitRequest onlineBankDebitRequest = new Moip.Models.OnlineBankDebitRequest()
            {
                BankNumber     = 341,
                ExpirationDate = "2020-09-30"
            };

            Moip.Models.FundingInstrumentRequest fundingInstrumentRequest = new Moip.Models.FundingInstrumentRequest
            {
                Method          = "ONLINE_BANK_DEBIT",
                OnlineBankDebit = onlineBankDebitRequest
            };

            Moip.Models.PaymentBoletoOrDebitRequest paymentRequest = new Moip.Models.PaymentBoletoOrDebitRequest
            {
                FundingInstrument = fundingInstrumentRequest
            };

            return(paymentRequest);
        }