public void Can_enable_billing_portal_access_by_system_Id() { // Arrange string referenceID = Guid.NewGuid().ToString(); var customer = new Customer() { FirstName = Faker.Name.FirstName(), LastName = Faker.Name.LastName(), Email = Faker.Internet.Email(), Phone = Faker.Phone.PhoneNumber(), Organization = Faker.Company.CompanyName(), SystemID = referenceID, ShippingAddress = Faker.Address.StreetAddress(false), ShippingAddress2 = Faker.Address.SecondaryAddress(), ShippingCity = Faker.Address.City(), ShippingState = Faker.Address.StateAbbr(), ShippingZip = Faker.Address.ZipCode(), ShippingCountry = "US", TaxExempt = true }; // Act var createdCustomer = Chargify.CreateCustomer(customer); Chargify.RevokeBillingPortalAccess(createdCustomer.ChargifyID); Chargify.EnableBillingPortalAccess(createdCustomer.SystemID); // Assert var managementLink = Chargify.GetManagementLink(createdCustomer.ChargifyID); Assert.IsNotNull(managementLink); Chargify.DeleteCustomer(createdCustomer.ChargifyID); }
public void Customer_CreateCustomer() { // Arrange string referenceID = Guid.NewGuid().ToString(); var customer = new Customer() { FirstName = Faker.Name.FirstName(), LastName = Faker.Name.LastName(), Email = Faker.Internet.Email(), Phone = Faker.Phone.PhoneNumber(), Organization = Faker.Company.CompanyName(), SystemID = referenceID, ShippingAddress = Faker.Address.StreetAddress(false), ShippingAddress2 = Faker.Address.SecondaryAddress(), ShippingCity = Faker.Address.City(), ShippingState = Faker.Address.StateAbbr(), ShippingZip = Faker.Address.ZipCode(), ShippingCountry = "US", TaxExempt = true }; // Act var createdCustomer = Chargify.CreateCustomer(customer); // Assert Assert.IsNotNull(createdCustomer); //Assert.IsInstanceOfType(createdCustomer, typeof(Customer)); Assert.IsTrue(createdCustomer.SystemID == customer.SystemID); Assert.IsTrue(createdCustomer.FirstName == customer.FirstName); Assert.IsTrue(createdCustomer.LastName == customer.LastName); Assert.IsTrue(createdCustomer.Organization == customer.Organization); Assert.IsTrue(createdCustomer.Email == customer.Email); Assert.IsTrue(createdCustomer.Phone == customer.Phone); Assert.IsTrue(createdCustomer.ShippingAddress == customer.ShippingAddress); Assert.IsTrue(createdCustomer.ShippingAddress2 == customer.ShippingAddress2); Assert.IsTrue(createdCustomer.ShippingCity == customer.ShippingCity); Assert.IsTrue(createdCustomer.ShippingState == customer.ShippingState); Assert.IsTrue(createdCustomer.ShippingZip == customer.ShippingZip); Assert.IsTrue(createdCustomer.ShippingCountry == customer.ShippingCountry); Assert.IsTrue(createdCustomer.TaxExempt); Chargify.DeleteCustomer(createdCustomer.ChargifyID); }
public void Can_revoke_billing_portal_access() { // Arrange string referenceID = Guid.NewGuid().ToString(); var customer = new Customer() { FirstName = Faker.Name.FirstName(), LastName = Faker.Name.LastName(), Email = Faker.Internet.Email(), Phone = Faker.Phone.PhoneNumber(), Organization = Faker.Company.CompanyName(), SystemID = referenceID, ShippingAddress = Faker.Address.StreetAddress(false), ShippingAddress2 = Faker.Address.SecondaryAddress(), ShippingCity = Faker.Address.City(), ShippingState = Faker.Address.StateAbbr(), ShippingZip = Faker.Address.ZipCode(), ShippingCountry = "US", TaxExempt = true }; // Act var createdCustomer = Chargify.CreateCustomer(customer); Chargify.RevokeBillingPortalAccess(createdCustomer.ChargifyID); // Assert try { Chargify.GetManagementLink(createdCustomer.ChargifyID); Assert.Fail("Error was expected, but not received"); } catch (ChargifyException chEx) { Assert.IsNotNull(chEx.ErrorMessages); Assert.AreEqual(1, chEx.ErrorMessages.Count); Assert.IsTrue(chEx.ErrorMessages.Any(e => e.Message.Contains("Billing Portal")), $"Found '{string.Join(", ", chEx.ErrorMessages.Select(x => x.Message))}'"); //todo: Need to run test to find out the exact error message } Chargify.DeleteCustomer(createdCustomer.ChargifyID); }