private void remove_account_Tag(final UUID id, final ControlTagType controlTagType, final ObjectType type, final NextEvent... additionalEvents) throws TagDefinitionApiException, TagApiException { busHandler.pushExpectedEvent(NextEvent.TAG); busHandler.pushExpectedEvents(additionalEvents); tagUserApi.removeTag(id, type, controlTagType.getId(), callContext); assertListenerStatus(); }
tagUserApi.removeTag(account.getId(), ObjectType.ACCOUNT, ControlTagType.AUTO_INVOICING_OFF.getId(), callContext); assertListenerStatus();
@Test(groups = "slow") public void testNonOverdueAccountWith_OVERDUE_ENFORCEMENT_OFF() throws Exception { clock.setTime(new DateTime(2012, 5, 1, 0, 3, 42, 0)); setupAccount(); // Set the OVERDUE_ENFORCEMENT_OFF tag (we set the clear state, hence the blocking event) busHandler.pushExpectedEvents(NextEvent.TAG, NextEvent.BLOCK); tagUserApi.addTag(account.getId(), ObjectType.ACCOUNT, ControlTagType.OVERDUE_ENFORCEMENT_OFF.getId(), callContext); assertListenerStatus(); // Set next invoice to fail and create subscription paymentPlugin.makeAllInvoicesFailWithError(true); final DefaultEntitlement baseEntitlement = createBaseEntitlementAndCheckForCompletion(account.getId(), "externalKey", productName, ProductCategory.BASE, term, NextEvent.CREATE, NextEvent.BLOCK, NextEvent.INVOICE); bundle = subscriptionApi.getSubscriptionBundle(baseEntitlement.getBundleId(), callContext); invoiceChecker.checkInvoice(account.getId(), 1, callContext, new ExpectedInvoiceItemCheck(new LocalDate(2012, 5, 1), null, InvoiceItemType.FIXED, new BigDecimal("0"))); invoiceChecker.checkChargedThroughDate(baseEntitlement.getId(), new LocalDate(2012, 5, 1), callContext); // DAY 30 have to get out of trial before first payment addDaysAndCheckForCompletion(30, NextEvent.PHASE, NextEvent.INVOICE, NextEvent.PAYMENT_ERROR, NextEvent.INVOICE_PAYMENT_ERROR); invoiceChecker.checkInvoice(account.getId(), 2, callContext, new ExpectedInvoiceItemCheck(new LocalDate(2012, 5, 31), new LocalDate(2012, 6, 30), InvoiceItemType.RECURRING, new BigDecimal("249.95"))); invoiceChecker.checkChargedThroughDate(baseEntitlement.getId(), new LocalDate(2012, 6, 30), callContext); // DAY 36 -- RIGHT AFTER OD1 addDaysAndCheckForCompletion(6); // Should still be in clear state checkODState(OverdueWrapper.CLEAR_STATE_NAME); // Now remove OVERDUE_ENFORCEMENT_OFF tag busHandler.pushExpectedEvents(NextEvent.TAG, NextEvent.BLOCK); tagUserApi.removeTag(account.getId(), ObjectType.ACCOUNT, ControlTagType.OVERDUE_ENFORCEMENT_OFF.getId(), callContext); assertListenerStatus(); checkODState("OD1"); }
@Test(groups = "slow") public void testOverdueStateWith_WRITTEN_OFF() throws Exception { clock.setTime(new DateTime(2012, 5, 1, 0, 3, 42, 0)); setupAccount(); // Set next invoice to fail and create subscription paymentPlugin.makeAllInvoicesFailWithError(true); final DefaultEntitlement baseEntitlement = createBaseEntitlementAndCheckForCompletion(account.getId(), "externalKey", productName, ProductCategory.BASE, term, NextEvent.CREATE, NextEvent.BLOCK, NextEvent.INVOICE); bundle = subscriptionApi.getSubscriptionBundle(baseEntitlement.getBundleId(), callContext); invoiceChecker.checkInvoice(account.getId(), 1, callContext, new ExpectedInvoiceItemCheck(new LocalDate(2012, 5, 1), null, InvoiceItemType.FIXED, new BigDecimal("0"))); invoiceChecker.checkChargedThroughDate(baseEntitlement.getId(), new LocalDate(2012, 5, 1), callContext); // DAY 30 have to get out of trial before first payment addDaysAndCheckForCompletion(30, NextEvent.PHASE, NextEvent.INVOICE, NextEvent.PAYMENT_ERROR, NextEvent.INVOICE_PAYMENT_ERROR); final List<Invoice> invoices = invoiceUserApi.getInvoicesByAccount(account.getId(), false, false, callContext); assertEquals(invoices.size(), 2); final Invoice nonNullInvoice = invoices.get(1); assertTrue(nonNullInvoice.getBalance().compareTo(BigDecimal.ZERO) > 0); // Set the WRITTEN_OFF tag busHandler.pushExpectedEvents(NextEvent.TAG); tagUserApi.addTag(nonNullInvoice.getId(), ObjectType.INVOICE, ControlTagType.WRITTEN_OFF.getId(), callContext); assertListenerStatus(); // Move after what should be OD1 (if invoice had not been written off) addDaysAndCheckForCompletion(6); // Should still be in clear state because of WRITTEN_OFF tag checkODState(OverdueWrapper.CLEAR_STATE_NAME); // Remove the WRITTEN_OFF tag and verify overdue state is now OD1 busHandler.pushExpectedEvents(NextEvent.TAG, NextEvent.BLOCK); tagUserApi.removeTag(nonNullInvoice.getId(), ObjectType.INVOICE, ControlTagType.WRITTEN_OFF.getId(), callContext); assertListenerStatus(); checkODState("OD1"); }
tagUserApi.removeTag(account.getId(), ObjectType.ACCOUNT, ControlTagType.OVERDUE_ENFORCEMENT_OFF.getId(), callContext); assertListenerStatus();
tagUserApi.removeTag(account.getId(), ObjectType.ACCOUNT, ControlTagType.AUTO_INVOICING_OFF.getId(), callContext); assertListenerStatus();