Skip to content

Commit

Permalink
[DE-117] DE-527 Add logs for TestTeardown
Browse files Browse the repository at this point in the history
  • Loading branch information
michalpierog committed Dec 5, 2023
1 parent b1aff46 commit 86d2afc
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@
import com.maxio.advancedbilling.models.CustomerResponse;
import com.maxio.advancedbilling.models.ListCustomersInput;
import com.maxio.advancedbilling.models.SubscriptionResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.List;

public class TestTeardown {
private static final Logger LOGGER = LoggerFactory.getLogger(TestTeardown.class);

private final AdvancedBillingClient advancedBillingClient = TestClient.createClient();

public void deleteCustomer(Customer customer) throws IOException, ApiException {
Expand All @@ -20,10 +24,14 @@ public void deleteCustomer(Customer customer) throws IOException, ApiException {
}
List<SubscriptionResponse> subscriptions = advancedBillingClient.getCustomersController().listCustomerSubscriptions(customer.getId());
for (SubscriptionResponse subscription : subscriptions) {
LOGGER.info("Purging subscription: {}", subscription.getSubscription().getId());
advancedBillingClient.getSubscriptionsController()
.purgeSubscription(subscription.getSubscription().getId(), customer.getId(), null);
LOGGER.info("Subscription purged successfully: {}", subscription.getSubscription().getId());
}
LOGGER.info("Deleting customer: {}", customer.getId());
advancedBillingClient.getCustomersController().deleteCustomer(customer.getId());
LOGGER.info("Customer deleted: {}", customer.getId());
}

public void deleteCustomers() throws IOException, ApiException {
Expand Down

0 comments on commit 86d2afc

Please sign in to comment.