public void TestPaymentWithPreAuthorizationRequest()
        {
            Moip.Models.PaymentRequest paymentRequest = Helpers.RequestsCreator.CreatePaymentWithPreAuthorizationRequest();

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

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

            Assert.AreEqual(expectedPaymentRequestJson, paymentRequestJson,
                            "Payment request body should match exactly (string literal match)");
        }
Esempio n. 2
0
        public static Moip.Models.PaymentRequest CreatePaymentWithEscrowRequest()
        {
            Moip.Models.TaxDocument taxDocumentRequest = new Moip.Models.TaxDocument
            {
                Type   = "CPF",
                Number = "33333333333"
            };

            Moip.Models.Phone phoneRequest = new Moip.Models.Phone
            {
                CountryCode = "55",
                AreaCode    = "11",
                Number      = "66778899"
            };

            Moip.Models.HolderRequest holderRequest = new Moip.Models.HolderRequest
            {
                Fullname    = "Jose Goku da Silva",
                Birthdate   = "1988-12-30",
                TaxDocument = taxDocumentRequest,
                Phone       = phoneRequest
            };

            Moip.Models.CreditCardRequest creditCardRequest = new Moip.Models.CreditCardRequest
            {
                ExpirationMonth = "02",
                ExpirationYear  = "20",
                Number          = "5555666677778884",
                Cvc             = "123",
                Holder          = holderRequest
            };

            Moip.Models.FundingInstrumentRequest fundingInstrumentRequest = new Moip.Models.FundingInstrumentRequest
            {
                Method     = "CREDIT_CARD",
                CreditCard = creditCardRequest
            };

            Moip.Models.Escrow escrow = new Moip.Models.Escrow
            {
                Description = "Escrow test"
            };

            Moip.Models.PaymentRequest paymentRequest = new Moip.Models.PaymentRequest
            {
                InstallmentCount    = 1,
                StatementDescriptor = "MyStore",
                FundingInstrument   = fundingInstrumentRequest,
                Escrow = escrow
            };

            return(paymentRequest);
        }
Esempio n. 3
0
        public void TestReleasePaymentWithEscrow()
        {
            Moip.Models.PaymentRequest paymentRequest = Helpers.RequestsCreator.CreatePaymentWithEscrowRequest();

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

            Moip.Models.EscrowResponse escrowResponse = controller.ReleaseEscrow(paymentResponse.Escrows[0].Id);

            Assert.NotNull(paymentResponse.Id, "Id should not be null");
            Assert.AreEqual("RELEASED", escrowResponse.Status, "Should match exactly (string literal match)");
            Assert.AreEqual("Escrow test", escrowResponse.Description, "Should match exactly (string literal match)");
            Assert.AreEqual(3510, escrowResponse.Amount, "Should match exactly (string literal match)");
        }
Esempio n. 4
0
        public void TestCreatePaymentWithCreditCard()
        {
            Moip.Models.PaymentRequest paymentRequest = Helpers.RequestsCreator.CreatePaymentWithCCRequest();

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

            Assert.NotNull(paymentResponse.Id, "Id should not be null");
            Assert.AreEqual(1, paymentResponse.InstallmentCount, "Should match exactly (string literal match)");
            Assert.AreEqual("MyStore", paymentResponse.StatementDescriptor, "Should match exactly (string literal match)");
            Assert.AreEqual("CREDIT_CARD", paymentResponse.FundingInstrument.Method, "Should match exactly (string literal match)");
            Assert.AreEqual("Jose Goku da Silva", paymentResponse.FundingInstrument.CreditCard.Holder.Fullname, "Should match exactly (string literal match)");
            Assert.AreEqual("1988-12-30", paymentResponse.FundingInstrument.CreditCard.Holder.Birthdate, "Should match exactly (string literal match)");
            Assert.AreEqual("CPF", paymentResponse.FundingInstrument.CreditCard.Holder.TaxDocument.Type, "Should match exactly (string literal match)");
            Assert.AreEqual("33333333333", paymentResponse.FundingInstrument.CreditCard.Holder.TaxDocument.Number, "Should match exactly (string literal match)");
        }
Esempio n. 5
0
        public void TestCreatePartialPaymentRefundCC()
        {
            Moip.Models.PaymentRequest paymentRequest = Helpers.RequestsCreator.CreatePaymentWithCCRequest();

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

            Thread.Sleep(1000);

            Moip.Models.RefundCCRequest refundRequest = Helpers.RequestsCreator.CreatePartialCCRefundRequest();

            Moip.Models.RefundCCResponse refundResponse = controller.CreatePayment(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("COMPLETED", refundResponse.Status, "Should match exactly (string literal match)");
            Assert.AreEqual("CREDIT_CARD", refundResponse.RefundingInstrument.Method, "Should match exactly (string literal match)");
            Assert.AreEqual("MASTERCARD", refundResponse.RefundingInstrument.CreditCard.Brand, "Should match exactly (string literal match)");
            Assert.AreEqual("555566", refundResponse.RefundingInstrument.CreditCard.First6, "Should match exactly (string literal match)");
            Assert.AreEqual("8884", refundResponse.RefundingInstrument.CreditCard.Last4, "Should match exactly (string literal match)");
        }
Esempio n. 6
0
        public void TestListPaymentRefunds()
        {
            Moip.Models.PaymentRequest paymentRequest = Helpers.RequestsCreator.CreatePaymentWithCCRequest();

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

            Thread.Sleep(1000);

            Moip.Models.RefundCCRequest refundRequest1 = Helpers.RequestsCreator.CreatePartialCCRefundRequest();
            Moip.Models.RefundCCRequest refundRequest2 = Helpers.RequestsCreator.CreatePartialCCRefundRequest();

            Moip.Models.RefundCCResponse refundResponse1 = controller.CreatePayment(paymentId, refundRequest1);
            Moip.Models.RefundCCResponse refundResponse2 = controller.CreatePayment(paymentId, refundRequest2);

            Moip.Models.RefundsListResponse refundListResponse = controller.ListPaymentRefunds(paymentId);

            Assert.NotNull(refundListResponse.Refunds[0].Id, "Id should not be null");
            Assert.AreEqual("COMPLETED", refundListResponse.Refunds[0].Status, "Should match exactly (string literal match)");
            Assert.AreEqual("CREDIT_CARD", refundListResponse.Refunds[0].RefundingInstrument.Method, "Should match exactly (string literal match)");
            Assert.AreEqual("MASTERCARD", refundListResponse.Refunds[0].RefundingInstrument.CreditCard.Brand, "Should match exactly (string literal match)");
            Assert.AreEqual("555566", refundListResponse.Refunds[0].RefundingInstrument.CreditCard.First6, "Should match exactly (string literal match)");
            Assert.AreEqual("8884", refundListResponse.Refunds[0].RefundingInstrument.CreditCard.Last4, "Should match exactly (string literal match)");
            Assert.True(refundListResponse.Refunds.Count > 1, "Should have more than one refund");
        }