public void TestAddCreditCardRequest() { Moip.Models.CustomerCreditCardRequest customerCreditCardRequest = Helpers.RequestsCreator.CreateCustomerCreditCardRequest(); string customerCreditCardRequestJson = Moip.Utilities.APIHelper.JsonSerialize(customerCreditCardRequest); string expectedCustomerCreditCardRequestJson = Helpers.FileReader.readJsonFile(@"Customer\add_credit_card.json"); Assert.AreEqual(expectedCustomerCreditCardRequestJson, customerCreditCardRequestJson, "Notification request body should match exactly (string literal match)"); }
public static Moip.Models.CustomerCreditCardRequest CreateCustomerCreditCardRequest() { Moip.Models.ShippingAddress shippingAddressRequest = new Moip.Models.ShippingAddress { Street = "Rua test", StreetNumber = "123", Complement = "Ap test", District = "Bairro test", City = "TestCity", State = "SP", Country = "BRA", ZipCode = "01234000" }; 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.CustomerCreditCardRequest customerCreditCardRequest = new Moip.Models.CustomerCreditCardRequest { Method = "CREDIT_CARD", CreditCard = creditCardRequest }; return(customerCreditCardRequest); }
public void TestDeleteCreditCard() { string date = DateTime.Now.ToString(); Moip.Models.CustomerRequest customerRequest = Helpers.RequestsCreator.CreateCustomerRequest(date); string customerId = controller.CreateCustomer(customerRequest).Id; Moip.Models.CustomerCreditCardRequest customerCreditCardRequest = Helpers.RequestsCreator.CreateCustomerCreditCardRequest(); string customerCreditCardId = controller.CreateCreditCard(customerCreditCardRequest, customerId).CreditCard.Id; bool deleteCreditCardResponse = controller.DeleteCreditCard(customerCreditCardId); Assert.IsTrue(deleteCreditCardResponse, "Should be true"); }
public void TestAddCreditCardToCustomer() { string date = DateTime.Now.ToString(); Moip.Models.CustomerRequest customerRequest = Helpers.RequestsCreator.CreateCustomerRequest(date); string customerId = controller.CreateCustomer(customerRequest).Id; Moip.Models.CustomerCreditCardRequest customerCreditCardRequest = Helpers.RequestsCreator.CreateCustomerCreditCardRequest(); Moip.Models.CustomerCreditCardResponse customerCreditCardResponse = controller.CreateCreditCard(customerCreditCardRequest, customerId); Assert.NotNull(customerCreditCardResponse.CreditCard.Id, "Id should not be null"); Assert.AreEqual("MASTERCARD", customerCreditCardResponse.CreditCard.Brand, "Should match exactly (string literal match)"); Assert.AreEqual("555566", customerCreditCardResponse.CreditCard.First6, "Should match exactly (string literal match)"); Assert.AreEqual("8884", customerCreditCardResponse.CreditCard.Last4, "Should match exactly (string literal match)"); Assert.IsTrue(customerCreditCardResponse.CreditCard.Store, "Store should be true"); Assert.AreEqual("MASTERCARD", customerCreditCardResponse.Card.Brand, "Should match exactly (string literal match)"); Assert.IsTrue(customerCreditCardResponse.Card.Store, "Store should be true"); Assert.AreEqual("CREDIT_CARD", customerCreditCardResponse.Method, "Should match exactly (string literal match)"); }