Ejemplo n.º 1
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)");
        }
Ejemplo n.º 2
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");
        }