/** * Creates a flat rate contract with term and an order with a product under flatrate. Checks that * the order and it's invoice candidate is correctly processed with regard to the flat rate term. * * @return */ public TermAndOrder createTermThenOrder() { final I_C_Flatrate_Term term = contractTerm(); final ContractsTestConfig testConfig = helper.getContractsTestConfig(); // creating a standard order with our product under flatrate final I_C_Order order = helper .mkOrderHelper() .setDocSubType(X_C_DocType.DOCSUBTYPE_StandardOrder) .setBPartnerName(testConfig.getC_BPartner_Value()) .setInvoiceRule(OrderHelper.Order_InvoiceRule.IMMEDIATE) .setComplete(DocAction.STATUS_Completed) .addLine( // note: the price doesn't really matter, so I set it to 99 testConfig.getM_Product_Matching_Flatfee_Value(), testConfig.getCustomParamBD(PARAM_BD_ACTUAL_QTY), 99, 99) .createOrder(); driver.fireTestEvent(EventType.ORDER_STANDARD_COMPLETE_AFTER, order); invoiceCandHelper.runProcess_UpdateInvoiceCands(); final TermAndOrder termAndOrder = new TermAndOrder(term, order); afterTermAndOrderCreation(termAndOrder); return termAndOrder; }