Ejemplo n.º 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)");
        }
Ejemplo n.º 2
0
        public void TestCreateBankAccountPartialRefundRequest()
        {
            Moip.Models.RefundBankAccountRequest refundRequest = Helpers.RequestsCreator.CreatePartialBankAccountRefundRequest();

            string refundRequestJson = Moip.Utilities.APIHelper.JsonSerialize(refundRequest);

            string expectedRefundRequestJson = Helpers.FileReader.readJsonFile(@"Refund\payment_partial_bankAccount.json");

            Assert.AreEqual(expectedRefundRequestJson, refundRequestJson,
                            "Refund request body should match exactly (string literal match)");
        }
Ejemplo n.º 3
0
        public static Moip.Models.RefundBankAccountRequest CreatePartialBankAccountRefundRequest()
        {
            Moip.Models.TaxDocument taxDocumentRequest = new Moip.Models.TaxDocument
            {
                Type   = "CPF",
                Number = "22222222222"
            };

            Moip.Models.HolderRequest holderRequest = new Moip.Models.HolderRequest
            {
                Fullname    = "Fulano de Tal",
                Birthdate   = "1990-01-01",
                TaxDocument = taxDocumentRequest,
            };

            Moip.Models.BankAccountRefundingInstrumentRequest bankAccountRefundRequest = new Moip.Models.BankAccountRefundingInstrumentRequest
            {
                BankNumber         = "341",
                AgencyNumber       = "4444444",
                AgencyCheckNumber  = "2",
                AccountNumber      = "1234",
                AccountCheckNumber = "1",
                Type   = "CHECKING",
                Holder = holderRequest
            };

            Moip.Models.RefundingInstrumentBankAccountRequest refundingInstrumentRequest = new Moip.Models.RefundingInstrumentBankAccountRequest
            {
                Method      = "BANK_ACCOUNT",
                BankAccount = bankAccountRefundRequest
            };

            Moip.Models.RefundBankAccountRequest refundRequest = new Moip.Models.RefundBankAccountRequest
            {
                RefundingInstrument = refundingInstrumentRequest,
                Amount = 100
            };

            return(refundRequest);
        }