public void TestCreateCCPartialRefundRequest() { Moip.Models.RefundCCRequest refundRequest = Helpers.RequestsCreator.CreatePartialCCRefundRequest(); string refundRequestJson = Moip.Utilities.APIHelper.JsonSerialize(refundRequest); string expectedRefundRequestJson = Helpers.FileReader.readJsonFile(@"Refund\payment_partial_cc.json"); Assert.AreEqual(expectedRefundRequestJson, refundRequestJson, "Refund request body should match exactly (string literal match)"); }
public static Moip.Models.RefundCCRequest CreatePartialCCRefundRequest() { Moip.Models.Phone phoneRequest = new Moip.Models.Phone { CountryCode = "55", AreaCode = "11", Number = "66778899" }; Moip.Models.TaxDocument taxDocumentRequest = new Moip.Models.TaxDocument { Type = "CPF", Number = "33333333333" }; 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 { Number = "5555666677778884", ExpirationMonth = "02", ExpirationYear = "20", Cvc = "123", Holder = holderRequest }; Moip.Models.RefundingInstrumentCCRequest refundingInstrumentRequest = new Moip.Models.RefundingInstrumentCCRequest { Method = "CREDIT_CARD", CreditCard = creditCardRequest }; Moip.Models.RefundCCRequest refundRequest = new Moip.Models.RefundCCRequest { RefundingInstrument = refundingInstrumentRequest, Amount = 100 }; return(refundRequest); }
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)"); }
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"); }