awasum closed pull request #8: Documenting accounting reports viz trial 
balance, chart of accounts, …
URL: https://github.com/apache/fineract-cn-accounting/pull/8
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/component-test/src/main/java/org/apache/fineract/cn/accounting/ChartOfAccountsApiDocumentation.java
 
b/component-test/src/main/java/org/apache/fineract/cn/accounting/ChartOfAccountsApiDocumentation.java
new file mode 100644
index 0000000..6373eae
--- /dev/null
+++ 
b/component-test/src/main/java/org/apache/fineract/cn/accounting/ChartOfAccountsApiDocumentation.java
@@ -0,0 +1,206 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.cn.accounting;
+
+import org.apache.fineract.cn.accounting.api.v1.EventConstants;
+import org.apache.fineract.cn.accounting.api.v1.domain.Account;
+import org.apache.fineract.cn.accounting.api.v1.domain.AccountType;
+import org.apache.fineract.cn.accounting.api.v1.domain.Ledger;
+import org.apache.fineract.cn.accounting.util.AccountGenerator;
+import org.apache.fineract.cn.accounting.util.LedgerGenerator;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.restdocs.JUnitRestDocumentation;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+import org.springframework.web.context.WebApplicationContext;
+
+import static 
org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
+import static 
org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.documentationConfiguration;
+import static 
org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get;
+import static 
org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessRequest;
+import static 
org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse;
+import static 
org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint;
+import static 
org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
+import static 
org.springframework.restdocs.payload.PayloadDocumentation.responseFields;
+import static 
org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+
+public class ChartOfAccountsApiDocumentation extends AbstractAccountingTest {
+
+  @Rule
+  public final JUnitRestDocumentation restDocumentation = new 
JUnitRestDocumentation("build/doc/generated-snippets/test-chart-of-accounts");
+
+  @Autowired
+  private WebApplicationContext context;
+
+  private MockMvc mockMvc;
+
+  @Before
+  public void setUp ( ) {
+
+    this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
+            .apply(documentationConfiguration(this.restDocumentation))
+            .alwaysDo(document("{method-name}", 
preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint())))
+            .build();
+  }
+
+  @Test
+  public void documentShowChartOfAccounts ( ) throws Exception {
+    final Ledger parentRevenueLedger = LedgerGenerator.createLedger("10000", 
AccountType.REVENUE);
+    parentRevenueLedger.setName("Parent Revenue");
+    parentRevenueLedger.setDescription("Parent Revenue Ledger");
+    this.testSubject.createLedger(parentRevenueLedger);
+    this.eventRecorder.wait(EventConstants.POST_LEDGER, 
parentRevenueLedger.getIdentifier());
+
+    final Ledger interestRevenueLedger = LedgerGenerator.createLedger("11000", 
AccountType.REVENUE);
+    interestRevenueLedger.setName("Interest Revenue");
+    interestRevenueLedger.setDescription("Interest Revenue Ledger");
+    this.testSubject.addSubLedger(parentRevenueLedger.getIdentifier(), 
interestRevenueLedger);
+    this.eventRecorder.wait(EventConstants.POST_LEDGER, 
interestRevenueLedger.getIdentifier());
+
+    final Account consumerInterestRevenueAccount =
+            
AccountGenerator.createAccount(interestRevenueLedger.getIdentifier(), "11100", 
AccountType.REVENUE);
+    consumerInterestRevenueAccount.setName("Consumer Interest");
+    this.testSubject.createAccount(consumerInterestRevenueAccount);
+    this.eventRecorder.wait(EventConstants.POST_ACCOUNT, 
consumerInterestRevenueAccount.getIdentifier());
+
+    final Ledger feeRevenueLedger = LedgerGenerator.createLedger("12000", 
AccountType.REVENUE);
+    feeRevenueLedger.setName("Fee Revenue");
+    feeRevenueLedger.setDescription("Fee Revenue Ledger");
+    this.testSubject.addSubLedger(parentRevenueLedger.getIdentifier(), 
feeRevenueLedger);
+    this.eventRecorder.wait(EventConstants.POST_LEDGER, 
feeRevenueLedger.getIdentifier());
+
+    final Ledger specialFeeRevenueLedger = 
LedgerGenerator.createLedger("12100", AccountType.REVENUE);
+    specialFeeRevenueLedger.setName("Special Fee Revenue");
+    specialFeeRevenueLedger.setDescription("Special Fee Revenue");
+    this.testSubject.addSubLedger(feeRevenueLedger.getIdentifier(), 
specialFeeRevenueLedger);
+    this.eventRecorder.wait(EventConstants.POST_LEDGER, 
specialFeeRevenueLedger.getIdentifier());
+
+    final Ledger parentAssetLedger = LedgerGenerator.createLedger("70000", 
AccountType.ASSET);
+    parentAssetLedger.setName("Parent Asset");
+    parentAssetLedger.setDescription("Parent Asset Ledger");
+    this.testSubject.createLedger(parentAssetLedger);
+    this.eventRecorder.wait(EventConstants.POST_LEDGER, 
parentAssetLedger.getIdentifier());
+
+    final Ledger consumerLoanAssetLedger = 
LedgerGenerator.createLedger("73000", AccountType.ASSET);
+    consumerInterestRevenueAccount.setName("Consumer Loan");
+    consumerLoanAssetLedger.setDescription("Consumer Loan Asset Ledger");
+    consumerLoanAssetLedger.setShowAccountsInChart(Boolean.FALSE);
+    this.testSubject.addSubLedger(parentAssetLedger.getIdentifier(), 
consumerLoanAssetLedger);
+    this.eventRecorder.wait(EventConstants.POST_LEDGER, 
consumerLoanAssetLedger.getIdentifier());
+
+    for (int i = 1; i < 100; i++) {
+      final String identifier = Integer.valueOf(73000 + i).toString();
+      final Account consumerLoanAccount =
+              
AccountGenerator.createAccount(consumerLoanAssetLedger.getIdentifier(), 
identifier, AccountType.ASSET);
+      this.testSubject.createAccount(consumerLoanAccount);
+      this.eventRecorder.wait(EventConstants.POST_ACCOUNT, identifier);
+    }
+
+    this.mockMvc.perform(get("/chartofaccounts")
+            .contentType(MediaType.APPLICATION_JSON_VALUE)
+            .accept(MediaType.ALL_VALUE))
+            .andExpect(status().isOk())
+            .andDo(document("document-show-chart-of-accounts", 
preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()),
+                    responseFields(
+                            
fieldWithPath("[].code").description("String").description("Date of Financial 
Condition Preparation"),
+                            
fieldWithPath("[].name").description("String").description("Type of assets 
section " +
+                                    " + \n" +
+                                    " + \n" +
+                                    " *enum* _Type_ { + \n" +
+                                    "  ASSET, + \n" +
+                                    "  EQUITY, + \n" +
+                                    "  LIABILITY, + \n" +
+                                    "}"),
+                            
fieldWithPath("[].description").type("String").description("first section's 
description"),
+                            
fieldWithPath("[].type").type("String").description("first entry's 
description"),
+                            
fieldWithPath("[].level").type("Integer").description("first entry's value"),
+                            
fieldWithPath("[1].code").description("String").description("Date of Financial 
Condition Preparation"),
+                            
fieldWithPath("[1].name").description("String").description("Type of assets 
section " +
+                                    " + \n" +
+                                    " + \n" +
+                                    " *enum* _Type_ { + \n" +
+                                    "  ASSET, + \n" +
+                                    "  EQUITY, + \n" +
+                                    "  LIABILITY, + \n" +
+                                    "}"),
+                            
fieldWithPath("[1].type").type("String").description("first entry's 
description"),
+                            
fieldWithPath("[1].level").type("Integer").description("first entry's value"),
+                            
fieldWithPath("[2].code").description("String").description("Date of Financial 
Condition Preparation"),
+                            
fieldWithPath("[2].name").description("String").description("Type of assets 
section " +
+                                    " + \n" +
+                                    " + \n" +
+                                    " *enum* _Type_ { + \n" +
+                                    "  ASSET, + \n" +
+                                    "  EQUITY, + \n" +
+                                    "  LIABILITY, + \n" +
+                                    "}"),
+                            
fieldWithPath("[2].type").type("String").description("first entry's 
description"),
+                            
fieldWithPath("[2].level").type("Integer").description("first entry's value"),
+                            
fieldWithPath("[3].code").description("String").description("Date of Financial 
Condition Preparation"),
+                            
fieldWithPath("[3].name").description("String").description("Type of assets 
section " +
+                                    " + \n" +
+                                    " + \n" +
+                                    " *enum* _Type_ { + \n" +
+                                    "  ASSET, + \n" +
+                                    "  EQUITY, + \n" +
+                                    "  LIABILITY, + \n" +
+                                    "}"),
+                            
fieldWithPath("[3].type").type("String").description("first entry's 
description"),
+                            
fieldWithPath("[3].level").type("Integer").description("first entry's value"),
+                            
fieldWithPath("[4].code").description("String").description("Date of Financial 
Condition Preparation"),
+                            
fieldWithPath("[4].name").description("String").description("Type of assets 
section " +
+                                    " + \n" +
+                                    " + \n" +
+                                    " *enum* _Type_ { + \n" +
+                                    "  ASSET, + \n" +
+                                    "  EQUITY, + \n" +
+                                    "  LIABILITY, + \n" +
+                                    "}"),
+                            
fieldWithPath("[4].type").type("String").description("first entry's 
description"),
+                            
fieldWithPath("[4].level").type("Integer").description("first entry's value"),
+                            
fieldWithPath("[5].code").description("String").description("Date of Financial 
Condition Preparation"),
+                            
fieldWithPath("[5].name").description("String").description("Type of assets 
section " +
+                                    " + \n" +
+                                    " + \n" +
+                                    " *enum* _Type_ { + \n" +
+                                    "  ASSET, + \n" +
+                                    "  EQUITY, + \n" +
+                                    "  LIABILITY, + \n" +
+                                    "}"),
+                            
fieldWithPath("[5].description").type("String").description("first section's 
description"),
+                            
fieldWithPath("[5].type").type("String").description("first entry's 
description"),
+                            
fieldWithPath("[5].level").type("Integer").description("first entry's value"),
+                            
fieldWithPath("[6].code").description("String").description("Date of Financial 
Condition Preparation"),
+                            
fieldWithPath("[6].name").description("String").description("Type of assets 
section " +
+                                    " + \n" +
+                                    " + \n" +
+                                    " *enum* _Type_ { + \n" +
+                                    "  ASSET, + \n" +
+                                    "  EQUITY, + \n" +
+                                    "  LIABILITY, + \n" +
+                                    "}"),
+                            
fieldWithPath("[6].type").type("String").description("first entry's 
description"),
+                            
fieldWithPath("[6].level").type("Integer").description("first entry's value")
+                    )));
+  }
+}
diff --git 
a/component-test/src/main/java/org/apache/fineract/cn/accounting/FinancialConditionApiDocumentation.java
 
b/component-test/src/main/java/org/apache/fineract/cn/accounting/FinancialConditionApiDocumentation.java
new file mode 100644
index 0000000..8999692
--- /dev/null
+++ 
b/component-test/src/main/java/org/apache/fineract/cn/accounting/FinancialConditionApiDocumentation.java
@@ -0,0 +1,217 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.cn.accounting;
+
+import org.apache.fineract.cn.accounting.api.v1.EventConstants;
+import org.apache.fineract.cn.accounting.api.v1.domain.Account;
+import org.apache.fineract.cn.accounting.api.v1.domain.AccountType;
+import org.apache.fineract.cn.accounting.api.v1.domain.JournalEntry;
+import org.apache.fineract.cn.accounting.api.v1.domain.Ledger;
+import org.apache.fineract.cn.accounting.util.AccountGenerator;
+import org.apache.fineract.cn.accounting.util.JournalEntryGenerator;
+import org.apache.fineract.cn.accounting.util.LedgerGenerator;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.restdocs.JUnitRestDocumentation;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+import org.springframework.web.context.WebApplicationContext;
+
+import static 
org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
+import static 
org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.documentationConfiguration;
+import static 
org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get;
+import static 
org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessRequest;
+import static 
org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse;
+import static 
org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint;
+import static 
org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
+import static 
org.springframework.restdocs.payload.PayloadDocumentation.responseFields;
+import static 
org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+
+public class FinancialConditionApiDocumentation extends AbstractAccountingTest 
{
+
+  @Rule
+  public final JUnitRestDocumentation restDocumentation = new 
JUnitRestDocumentation("build/doc/generated-snippets/test-financial-condition");
+
+  @Autowired
+  private WebApplicationContext context;
+
+  private MockMvc mockMvc;
+
+  @Before
+  public void setUp ( ) {
+
+    this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
+            .apply(documentationConfiguration(this.restDocumentation))
+            .alwaysDo(document("{method-name}", 
preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint())))
+            .build();
+  }
+
+  @Test
+  public void documentReturnFinancialCondition ( ) throws Exception {
+    this.fixtures();
+    this.sampleJournalEntries();
+
+    this.mockMvc.perform(get("/financialcondition")
+            .contentType(MediaType.APPLICATION_JSON_VALUE)
+            .accept(MediaType.ALL_VALUE))
+            .andExpect(status().isOk())
+            .andDo(document("document-return-financial-condition", 
preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()),
+                    responseFields(
+                            
fieldWithPath("date").description("String").description("Date of Financial 
Condition Preparation"),
+                            
fieldWithPath("financialConditionSections[].type").description("Type").description("Type
 of assets section " +
+                                    " + \n" +
+                                    " + \n" +
+                                    " *enum* _Type_ { + \n" +
+                                    "  ASSET, + \n" +
+                                    "  EQUITY, + \n" +
+                                    "  LIABILITY, + \n" +
+                                    "}"),
+                            
fieldWithPath("financialConditionSections[].description").type("String").description("first
 section's description"),
+                            
fieldWithPath("financialConditionSections[].financialConditionEntries[].description").type("String").description("first
 entry's description"),
+                            
fieldWithPath("financialConditionSections[].financialConditionEntries[].value").type("BigDecimal").description("first
 entry's value"),
+                            
fieldWithPath("financialConditionSections[].financialConditionEntries[1].description").type("String").description("second
 entry's description"),
+                            
fieldWithPath("financialConditionSections[].financialConditionEntries[1].value").type("BigDecimal").description("second
 entry's value"),
+                            
fieldWithPath("financialConditionSections[].subtotal").type("BigDecimal").description("First
 section's subtotal"),
+                            
fieldWithPath("financialConditionSections[1].type").description("Type").description("Type
 of first section " +
+                                    " + \n" +
+                                    " + \n" +
+                                    " *enum* _Type_ { + \n" +
+                                    "  INCOME, + \n" +
+                                    "  EXPENSES + \n" +
+                                    "}"),
+                            
fieldWithPath("financialConditionSections[1].description").type("String").description("first
 section's description"),
+                            
fieldWithPath("financialConditionSections[1].financialConditionEntries[].description").type("String").description("first
 entry's description"),
+                            
fieldWithPath("financialConditionSections[1].financialConditionEntries[].value").type("BigDecimal").description("first
 entry's value"),
+                            
fieldWithPath("financialConditionSections[1].subtotal").type("BigDecimal").description("Second
 section's subtotal"),
+                            
fieldWithPath("financialConditionSections[2].type").description("Type").description("Type
 of Equity & liability section " +
+                                    " + \n" +
+                                    " + \n" +
+                                    " *enum* _Type_ { + \n" +
+                                    "  ASSET, + \n" +
+                                    "  EQUITY, + \n" +
+                                    "  LIABILITY, + \n" +
+                                    "}"),
+                            
fieldWithPath("financialConditionSections[2].description").type("String").description("liability
 section's description"),
+                            
fieldWithPath("financialConditionSections[2].financialConditionEntries[].description").type("String").description("first
 entry's description"),
+                            
fieldWithPath("financialConditionSections[2].financialConditionEntries[].value").type("BigDecimal").description("first
 entry's value"),
+                            
fieldWithPath("financialConditionSections[2].financialConditionEntries[1].description").type("String").description("second
 entry's description"),
+                            
fieldWithPath("financialConditionSections[2].financialConditionEntries[1].value").type("BigDecimal").description("second
 entry's value"),
+                            
fieldWithPath("financialConditionSections[2].subtotal").type("BigDecimal").description("First
 section's subtotal"),
+                            
fieldWithPath("totalAssets").type("BigDecimal").description("Gross Profit"),
+                            
fieldWithPath("totalEquitiesAndLiabilities").type("BigDecimal").description("Total
 Expenses")
+                    )));
+  }
+
+  private void fixtures ( ) throws Exception {
+    final Ledger assetLedger = LedgerGenerator.createLedger("7000", 
AccountType.ASSET);
+    assetLedger.setName("Assets");
+    super.testSubject.createLedger(assetLedger);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_LEDGER, 
assetLedger.getIdentifier()));
+
+    final Ledger assetSubLedger7060 = LedgerGenerator.createLedger("7060", 
AccountType.ASSET);
+    
assetSubLedger7060.setParentLedgerIdentifier(assetLedger.getParentLedgerIdentifier());
+    assetSubLedger7060.setName("Loans to Members");
+    super.testSubject.addSubLedger(assetLedger.getIdentifier(), 
assetSubLedger7060);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_LEDGER, 
assetSubLedger7060.getIdentifier()));
+
+    final Ledger assetSubLedger7080 = LedgerGenerator.createLedger("7080", 
AccountType.ASSET);
+    
assetSubLedger7080.setParentLedgerIdentifier(assetLedger.getParentLedgerIdentifier());
+    assetSubLedger7080.setName("Lines of Credit to Members");
+    super.testSubject.addSubLedger(assetLedger.getIdentifier(), 
assetSubLedger7080);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_LEDGER, 
assetSubLedger7080.getIdentifier()));
+
+    final Account firstAssetAccount =
+            AccountGenerator.createAccount(assetSubLedger7060.getIdentifier(), 
"7061", AccountType.ASSET);
+    super.testSubject.createAccount(firstAssetAccount);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_ACCOUNT, 
firstAssetAccount.getIdentifier()));
+
+    final Account secondAssetAccount =
+            AccountGenerator.createAccount(assetSubLedger7080.getIdentifier(), 
"7081", AccountType.ASSET);
+    super.testSubject.createAccount(secondAssetAccount);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_ACCOUNT, 
secondAssetAccount.getIdentifier()));
+
+    final Ledger liabilityLedger = LedgerGenerator.createLedger("8000", 
AccountType.LIABILITY);
+    liabilityLedger.setName("Liabilities");
+    super.testSubject.createLedger(liabilityLedger);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_LEDGER, 
liabilityLedger.getIdentifier()));
+
+    final Ledger liabilitySubLedger8110 = LedgerGenerator.createLedger("8110", 
AccountType.LIABILITY);
+    
liabilitySubLedger8110.setParentLedgerIdentifier(liabilityLedger.getParentLedgerIdentifier());
+    liabilitySubLedger8110.setName("Accounts Payable");
+    super.testSubject.addSubLedger(liabilityLedger.getIdentifier(), 
liabilitySubLedger8110);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_LEDGER, 
liabilitySubLedger8110.getIdentifier()));
+
+    final Ledger liabilitySubLedger8220 = LedgerGenerator.createLedger("8220", 
AccountType.LIABILITY);
+    
liabilitySubLedger8220.setParentLedgerIdentifier(liabilityLedger.getParentLedgerIdentifier());
+    liabilitySubLedger8220.setName("Interest Payable");
+    super.testSubject.addSubLedger(liabilityLedger.getIdentifier(), 
liabilitySubLedger8220);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_LEDGER, 
liabilitySubLedger8220.getIdentifier()));
+
+    final Account firstLiabilityAccount =
+            
AccountGenerator.createAccount(liabilitySubLedger8110.getIdentifier(), "8110", 
AccountType.LIABILITY);
+    super.testSubject.createAccount(firstLiabilityAccount);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_ACCOUNT, 
firstLiabilityAccount.getIdentifier()));
+
+    final Account secondLiabilityAccount =
+            
AccountGenerator.createAccount(liabilitySubLedger8220.getIdentifier(), "8220", 
AccountType.LIABILITY);
+    super.testSubject.createAccount(secondLiabilityAccount);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_ACCOUNT, 
secondLiabilityAccount.getIdentifier()));
+
+    final Ledger equityLedger = LedgerGenerator.createLedger("9000", 
AccountType.EQUITY);
+    equityLedger.setName("Equities");
+    super.testSubject.createLedger(equityLedger);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_LEDGER, 
equityLedger.getIdentifier()));
+
+    final Ledger equitySubLedger9120 = LedgerGenerator.createLedger("9120", 
AccountType.EQUITY);
+    
equitySubLedger9120.setParentLedgerIdentifier(equityLedger.getParentLedgerIdentifier());
+    equitySubLedger9120.setName("Member Savings");
+    super.testSubject.addSubLedger(equityLedger.getIdentifier(), 
equitySubLedger9120);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_LEDGER, 
equitySubLedger9120.getIdentifier()));
+
+    final Account firstEquityAccount =
+            
AccountGenerator.createAccount(equitySubLedger9120.getIdentifier(), "9120", 
AccountType.EQUITY);
+    super.testSubject.createAccount(firstEquityAccount);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_ACCOUNT, 
firstEquityAccount.getIdentifier()));
+  }
+
+  private void sampleJournalEntries ( ) throws Exception {
+    final JournalEntry firstTransaction =
+            JournalEntryGenerator
+                    .createRandomJournalEntry("7061", "150.00", "8110", 
"150.00");
+    super.testSubject.createJournalEntry(firstTransaction);
+    
Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_JOURNAL_ENTRY, 
firstTransaction.getTransactionIdentifier()));
+
+    final JournalEntry secondTransaction =
+            JournalEntryGenerator
+                    .createRandomJournalEntry("7081", "100.00", "8220", 
"100.00");
+    super.testSubject.createJournalEntry(secondTransaction);
+    
Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_JOURNAL_ENTRY, 
secondTransaction.getTransactionIdentifier()));
+
+    final JournalEntry thirdTransaction =
+            JournalEntryGenerator
+                    .createRandomJournalEntry("8220", "50.00", "9120", 
"50.00");
+    super.testSubject.createJournalEntry(thirdTransaction);
+    
Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_JOURNAL_ENTRY, 
thirdTransaction.getTransactionIdentifier()));
+  }
+
+}
diff --git 
a/component-test/src/main/java/org/apache/fineract/cn/accounting/IncomeStatementApiDocumentation.java
 
b/component-test/src/main/java/org/apache/fineract/cn/accounting/IncomeStatementApiDocumentation.java
new file mode 100644
index 0000000..ad1a7b4
--- /dev/null
+++ 
b/component-test/src/main/java/org/apache/fineract/cn/accounting/IncomeStatementApiDocumentation.java
@@ -0,0 +1,212 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.cn.accounting;
+
+import org.apache.fineract.cn.accounting.api.v1.EventConstants;
+import org.apache.fineract.cn.accounting.api.v1.domain.Account;
+import org.apache.fineract.cn.accounting.api.v1.domain.AccountType;
+import org.apache.fineract.cn.accounting.api.v1.domain.JournalEntry;
+import org.apache.fineract.cn.accounting.api.v1.domain.Ledger;
+import org.apache.fineract.cn.accounting.util.AccountGenerator;
+import org.apache.fineract.cn.accounting.util.JournalEntryGenerator;
+import org.apache.fineract.cn.accounting.util.LedgerGenerator;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.restdocs.JUnitRestDocumentation;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+import org.springframework.web.context.WebApplicationContext;
+
+import static 
org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
+import static 
org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.documentationConfiguration;
+import static 
org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get;
+import static 
org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessRequest;
+import static 
org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse;
+import static 
org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint;
+import static 
org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
+import static 
org.springframework.restdocs.payload.PayloadDocumentation.responseFields;
+import static 
org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+
+public class IncomeStatementApiDocumentation extends AbstractAccountingTest {
+
+  @Rule
+  public final JUnitRestDocumentation restDocumentation = new 
JUnitRestDocumentation("build/doc/generated-snippets/test-income-statement");
+
+  @Autowired
+  private WebApplicationContext context;
+
+  private MockMvc mockMvc;
+
+  @Before
+  public void setUp ( ) {
+
+    this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
+            .apply(documentationConfiguration(this.restDocumentation))
+            .alwaysDo(document("{method-name}", 
preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint())))
+            .build();
+  }
+
+  @Test
+  public void documentReturnIncomeStatement ( ) throws Exception {
+    this.fixtures();
+    this.sampleJournalEntries();
+
+    this.mockMvc.perform(get("/incomestatement")
+            .contentType(MediaType.APPLICATION_JSON_VALUE)
+            .accept(MediaType.ALL_VALUE))
+            .andExpect(status().isOk())
+            .andDo(document("document-return-income-statement", 
preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()),
+                    responseFields(
+                            
fieldWithPath("date").type("String").description("Date Of Income Statement 
Preparation"),
+                            
fieldWithPath("incomeStatementSections[].type").description("Type").description("Type
 of first section " +
+                                    " + \n" +
+                                    " + \n" +
+                                    " *enum* _Type_ { + \n" +
+                                    "  INCOME, + \n" +
+                                    "  EXPENSES + \n" +
+                                    "}"),
+                            
fieldWithPath("incomeStatementSections[].description").type("String").description("first
 section's description"),
+                            
fieldWithPath("incomeStatementSections[].incomeStatementEntries[].description").type("String").description("first
 entry's description"),
+                            
fieldWithPath("incomeStatementSections[].incomeStatementEntries[].value").type("BigDecimal").description("first
 entry's value"),
+                            
fieldWithPath("incomeStatementSections[].incomeStatementEntries[1].description").type("String").description("second
 entry's description"),
+                            
fieldWithPath("incomeStatementSections[].incomeStatementEntries[1].value").type("BigDecimal").description("second
 entry's value"),
+                            
fieldWithPath("incomeStatementSections[].subtotal").type("BigDecimal").description("First
 section's subtotal"),
+                            
fieldWithPath("incomeStatementSections[1].type").description("Type").description("Type
 of first section " +
+                                    " + \n" +
+                                    " + \n" +
+                                    " *enum* _Type_ { + \n" +
+                                    "  INCOME, + \n" +
+                                    "  EXPENSES + \n" +
+                                    "}"),
+                            
fieldWithPath("incomeStatementSections[1].description").type("String").description("first
 section's description"),
+                            
fieldWithPath("incomeStatementSections[1].incomeStatementEntries[].description").type("String").description("first
 entry's description"),
+                            
fieldWithPath("incomeStatementSections[1].incomeStatementEntries[].value").type("BigDecimal").description("first
 entry's value"),
+                            
fieldWithPath("incomeStatementSections[1].incomeStatementEntries[1].description").type("String").description("second
 entry's description"),
+                            
fieldWithPath("incomeStatementSections[1].incomeStatementEntries[1].value").type("BigDecimal").description("second
 entry's value"),
+                            
fieldWithPath("incomeStatementSections[1].subtotal").type("BigDecimal").description("First
 section's subtotal"),
+                            
fieldWithPath("grossProfit").type("BigDecimal").description("Gross Profit"),
+                            
fieldWithPath("totalExpenses").type("BigDecimal").description("Total Expenses"),
+                            
fieldWithPath("netIncome").type("BigDecimal").description("Net Income")
+                    )));
+  }
+
+  private void fixtures ( ) throws Exception {
+    final Ledger incomeLedger = LedgerGenerator.createLedger("1170", 
AccountType.REVENUE);
+    incomeLedger.setName("Revenue");
+    super.testSubject.createLedger(incomeLedger);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_LEDGER, 
incomeLedger.getIdentifier()));
+
+    final Ledger incomeSubLedger1100 = LedgerGenerator.createLedger("1070", 
AccountType.REVENUE);
+    
incomeSubLedger1100.setParentLedgerIdentifier(incomeLedger.getParentLedgerIdentifier());
+    incomeSubLedger1100.setName("Revenue From Loans");
+    super.testSubject.addSubLedger(incomeLedger.getIdentifier(), 
incomeSubLedger1100);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_LEDGER, 
incomeSubLedger1100.getIdentifier()));
+
+    final Ledger incomeSubLedger1300 = LedgerGenerator.createLedger("1370", 
AccountType.REVENUE);
+    
incomeSubLedger1300.setParentLedgerIdentifier(incomeLedger.getParentLedgerIdentifier());
+    incomeSubLedger1300.setName("Fees");
+    super.testSubject.addSubLedger(incomeLedger.getIdentifier(), 
incomeSubLedger1300);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_LEDGER, 
incomeSubLedger1300.getIdentifier()));
+
+    final Account account1170 =
+            
AccountGenerator.createAccount(incomeSubLedger1100.getIdentifier(), "1170", 
AccountType.REVENUE);
+    super.testSubject.createAccount(account1170);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_ACCOUNT, 
account1170.getIdentifier()));
+
+    final Account account1370 =
+            
AccountGenerator.createAccount(incomeSubLedger1300.getIdentifier(), "1370", 
AccountType.REVENUE);
+    super.testSubject.createAccount(account1370);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_ACCOUNT, 
account1370.getIdentifier()));
+
+    final Ledger expenseLedger = LedgerGenerator.createLedger("3070", 
AccountType.EXPENSE);
+    expenseLedger.setName("Expenses");
+    super.testSubject.createLedger(expenseLedger);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_LEDGER, 
expenseLedger.getIdentifier()));
+
+    final Ledger expenseSubLedger3570 = LedgerGenerator.createLedger("3570", 
AccountType.EXPENSE);
+    
expenseSubLedger3570.setParentLedgerIdentifier(expenseLedger.getParentLedgerIdentifier());
+    expenseSubLedger3570.setName("Annual Meeting Expenses");
+    super.testSubject.addSubLedger(expenseLedger.getIdentifier(), 
expenseSubLedger3570);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_LEDGER, 
expenseSubLedger3570.getIdentifier()));
+
+    final Ledger expenseSubLedger3770 = LedgerGenerator.createLedger("3770", 
AccountType.EXPENSE);
+    
expenseSubLedger3770.setParentLedgerIdentifier(expenseLedger.getParentLedgerIdentifier());
+    expenseSubLedger3770.setName("Interest (Dividend) Expense");
+    super.testSubject.addSubLedger(expenseLedger.getIdentifier(), 
expenseSubLedger3770);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_LEDGER, 
expenseSubLedger3770.getIdentifier()));
+
+    final Account account3570 =
+            
AccountGenerator.createAccount(expenseSubLedger3570.getIdentifier(), "3570", 
AccountType.EXPENSE);
+    super.testSubject.createAccount(account3570);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_ACCOUNT, 
account3570.getIdentifier()));
+
+    final Account account3770 =
+            
AccountGenerator.createAccount(expenseSubLedger3770.getIdentifier(), "3770", 
AccountType.EXPENSE);
+    super.testSubject.createAccount(account3770);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_ACCOUNT, 
account3770.getIdentifier()));
+
+    final Ledger assetLedger = LedgerGenerator.createLedger("7070", 
AccountType.ASSET);
+    super.testSubject.createLedger(assetLedger);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_LEDGER, 
assetLedger.getIdentifier()));
+
+    final Account assetAccount =
+            AccountGenerator.createAccount(assetLedger.getIdentifier(), 
"7077", AccountType.ASSET);
+    super.testSubject.createAccount(assetAccount);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_ACCOUNT, 
assetAccount.getIdentifier()));
+
+    final Ledger liabilityLedger = LedgerGenerator.createLedger("8070", 
AccountType.LIABILITY);
+    super.testSubject.createLedger(liabilityLedger);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_LEDGER, 
liabilityLedger.getIdentifier()));
+
+    final Account liabilityAccount =
+            AccountGenerator.createAccount(liabilityLedger.getIdentifier(), 
"8077", AccountType.LIABILITY);
+    super.testSubject.createAccount(liabilityAccount);
+    Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_ACCOUNT, 
liabilityAccount.getIdentifier()));
+  }
+
+  private void sampleJournalEntries ( ) throws Exception {
+    final JournalEntry firstTransaction =
+            JournalEntryGenerator
+                    .createRandomJournalEntry("7077", "150.00", "1170", 
"150.00");
+    super.testSubject.createJournalEntry(firstTransaction);
+    
Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_JOURNAL_ENTRY, 
firstTransaction.getTransactionIdentifier()));
+
+    final JournalEntry secondTransaction =
+            JournalEntryGenerator
+                    .createRandomJournalEntry("7077", "200.00", "1370", 
"200.00");
+    super.testSubject.createJournalEntry(secondTransaction);
+    
Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_JOURNAL_ENTRY, 
secondTransaction.getTransactionIdentifier()));
+
+    final JournalEntry thirdTransaction =
+            JournalEntryGenerator
+                    .createRandomJournalEntry("3570", "50.00", "8077", 
"50.00");
+    super.testSubject.createJournalEntry(thirdTransaction);
+    
Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_JOURNAL_ENTRY, 
thirdTransaction.getTransactionIdentifier()));
+
+    final JournalEntry fourthTransaction =
+            JournalEntryGenerator
+                    .createRandomJournalEntry("3770", "75.00", "8077", 
"75.00");
+    super.testSubject.createJournalEntry(fourthTransaction);
+    
Assert.assertTrue(super.eventRecorder.wait(EventConstants.POST_JOURNAL_ENTRY, 
fourthTransaction.getTransactionIdentifier()));
+  }
+}
diff --git 
a/component-test/src/main/java/org/apache/fineract/cn/accounting/LedgerApiDocumentation.java
 
b/component-test/src/main/java/org/apache/fineract/cn/accounting/LedgerApiDocumentation.java
index f1748c1..15b9bb3 100644
--- 
a/component-test/src/main/java/org/apache/fineract/cn/accounting/LedgerApiDocumentation.java
+++ 
b/component-test/src/main/java/org/apache/fineract/cn/accounting/LedgerApiDocumentation.java
@@ -264,14 +264,14 @@ public void documentFindLedger ( ) throws Exception {
   public void documentAddSubLedger ( ) throws Exception {
 
     final Ledger parentLedger = LedgerGenerator.createRandomLedger();
-    parentLedger.setIdentifier("6200");
+    parentLedger.setIdentifier("6220");
     parentLedger.setName("Name of" + parentLedger.getIdentifier());
     parentLedger.setDescription("Description of " + 
parentLedger.getIdentifier());
     this.testSubject.createLedger(parentLedger);
     this.eventRecorder.wait(EventConstants.POST_LEDGER, 
parentLedger.getIdentifier());
 
     final Ledger subLedger = LedgerGenerator.createRandomLedger();
-    subLedger.setIdentifier("6201");
+    subLedger.setIdentifier("6221");
     subLedger.setName("SubLedger One of " + parentLedger.getIdentifier());
     subLedger.setDescription("First Sub Ledger of " + 
parentLedger.getIdentifier());
 
diff --git 
a/component-test/src/main/java/org/apache/fineract/cn/accounting/TrialBalanceApiDocumentation.java
 
b/component-test/src/main/java/org/apache/fineract/cn/accounting/TrialBalanceApiDocumentation.java
new file mode 100644
index 0000000..614af52
--- /dev/null
+++ 
b/component-test/src/main/java/org/apache/fineract/cn/accounting/TrialBalanceApiDocumentation.java
@@ -0,0 +1,212 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.cn.accounting;
+
+import org.apache.fineract.cn.accounting.api.v1.EventConstants;
+import org.apache.fineract.cn.accounting.api.v1.domain.Account;
+import org.apache.fineract.cn.accounting.api.v1.domain.AccountType;
+import org.apache.fineract.cn.accounting.api.v1.domain.JournalEntry;
+import org.apache.fineract.cn.accounting.api.v1.domain.Ledger;
+import org.apache.fineract.cn.accounting.util.AccountGenerator;
+import org.apache.fineract.cn.accounting.util.JournalEntryGenerator;
+import org.apache.fineract.cn.accounting.util.LedgerGenerator;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.restdocs.JUnitRestDocumentation;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+import org.springframework.web.context.WebApplicationContext;
+
+import static 
org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
+import static 
org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.documentationConfiguration;
+import static 
org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get;
+import static 
org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessRequest;
+import static 
org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse;
+import static 
org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint;
+import static 
org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
+import static 
org.springframework.restdocs.payload.PayloadDocumentation.responseFields;
+import static 
org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+
+public class TrialBalanceApiDocumentation extends AbstractAccountingTest {
+
+  @Rule
+  public final JUnitRestDocumentation restDocumentation = new 
JUnitRestDocumentation("build/doc/generated-snippets/test-trial-balance");
+
+  @Autowired
+  private WebApplicationContext context;
+
+  private MockMvc mockMvc;
+
+  @Before
+  public void setUp ( ) {
+
+    this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
+            .apply(documentationConfiguration(this.restDocumentation))
+            .alwaysDo(document("{method-name}", 
preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint())))
+            .build();
+  }
+
+  @Test
+  public void documentGenerateTrialBalance ( ) throws Exception {
+    final Ledger assetLedger = LedgerGenerator.createRandomLedger();
+    this.testSubject.createLedger(assetLedger);
+    this.eventRecorder.wait(EventConstants.POST_LEDGER, 
assetLedger.getIdentifier());
+
+    final Ledger assetSubLedgerOne = LedgerGenerator.createRandomLedger();
+    this.testSubject.addSubLedger(assetLedger.getIdentifier(), 
assetSubLedgerOne);
+    this.eventRecorder.wait(EventConstants.POST_LEDGER, 
assetSubLedgerOne.getIdentifier());
+
+    final Ledger assetSubLedgerTwo = LedgerGenerator.createRandomLedger();
+    this.testSubject.addSubLedger(assetLedger.getIdentifier(), 
assetSubLedgerTwo);
+    this.eventRecorder.wait(EventConstants.POST_LEDGER, 
assetSubLedgerTwo.getIdentifier());
+
+    final Ledger liabilityLedger = LedgerGenerator.createRandomLedger();
+    liabilityLedger.setType(AccountType.LIABILITY.name());
+    this.testSubject.createLedger(liabilityLedger);
+    this.eventRecorder.wait(EventConstants.POST_LEDGER, 
liabilityLedger.getIdentifier());
+
+    final Ledger liabilitySubLedger = LedgerGenerator.createRandomLedger();
+    liabilitySubLedger.setType(AccountType.LIABILITY.name());
+    this.testSubject.addSubLedger(liabilityLedger.getIdentifier(), 
liabilitySubLedger);
+    this.eventRecorder.wait(EventConstants.POST_LEDGER, 
liabilitySubLedger.getIdentifier());
+
+    final Account account4ledgerOne = 
AccountGenerator.createRandomAccount(assetSubLedgerOne.getIdentifier());
+    this.testSubject.createAccount(account4ledgerOne);
+    this.eventRecorder.wait(EventConstants.POST_ACCOUNT, 
account4ledgerOne.getIdentifier());
+
+    final Account secondAccount4ledgerOne = 
AccountGenerator.createRandomAccount(assetSubLedgerOne.getIdentifier());
+    this.testSubject.createAccount(secondAccount4ledgerOne);
+    this.eventRecorder.wait(EventConstants.POST_ACCOUNT, 
secondAccount4ledgerOne.getIdentifier());
+
+    final Account account4subLedgerOne = 
AccountGenerator.createRandomAccount(assetSubLedgerTwo.getIdentifier());
+    this.testSubject.createAccount(account4subLedgerOne);
+    this.eventRecorder.wait(EventConstants.POST_ACCOUNT, 
account4subLedgerOne.getIdentifier());
+
+    final Account account4ledgerTwo = 
AccountGenerator.createRandomAccount(liabilitySubLedger.getIdentifier());
+    account4ledgerTwo.setType(AccountType.LIABILITY.name());
+    this.testSubject.createAccount(account4ledgerTwo);
+    this.eventRecorder.wait(EventConstants.POST_ACCOUNT, 
account4ledgerTwo.getIdentifier());
+
+    final JournalEntry firstBooking =
+            
JournalEntryGenerator.createRandomJournalEntry(secondAccount4ledgerOne, 
"50.00", account4ledgerTwo, "50.00");
+    this.testSubject.createJournalEntry(firstBooking);
+    this.eventRecorder.wait(EventConstants.RELEASE_JOURNAL_ENTRY, 
firstBooking.getTransactionIdentifier());
+
+    final JournalEntry secondBooking =
+            
JournalEntryGenerator.createRandomJournalEntry(secondAccount4ledgerOne, 
"50.00", account4ledgerOne, "50.00");
+    this.testSubject.createJournalEntry(secondBooking);
+    this.eventRecorder.wait(EventConstants.RELEASE_JOURNAL_ENTRY, 
secondBooking.getTransactionIdentifier());
+
+    final JournalEntry thirdBooking =
+            
JournalEntryGenerator.createRandomJournalEntry(account4subLedgerOne, "50.00", 
account4ledgerTwo, "50.00");
+    this.testSubject.createJournalEntry(thirdBooking);
+    this.eventRecorder.wait(EventConstants.RELEASE_JOURNAL_ENTRY, 
thirdBooking.getTransactionIdentifier());
+
+    this.mockMvc.perform(get("/trialbalance")
+            .contentType(MediaType.APPLICATION_JSON_VALUE)
+            .accept(MediaType.ALL_VALUE))
+            .andExpect(status().isOk())
+            .andDo(document("document-show-chart-of-accounts", 
preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()),
+                    responseFields(
+                            
fieldWithPath("trialBalanceEntries[].ledger.identifier").description("String").description("First
 Trial Balance Entry Identifier"),
+                            
fieldWithPath("trialBalanceEntries[].ledger.type").description("Type").description("Type
 of trial balance " +
+                                    " + \n" +
+                                    " + \n" +
+                                    " *enum* _Type_ { + \n" +
+                                    "  DEBIT, + \n" +
+                                    "  CREDIT, + \n" +
+                                    "}"),
+                            
fieldWithPath("trialBalanceEntries[].ledger.name").description("String").description("Ledger
 Name"),
+                            
fieldWithPath("trialBalanceEntries[].ledger.description").description("String").description("Description
 of Ledger"),
+                            
fieldWithPath("trialBalanceEntries[].ledger.parentLedgerIdentifier").description("String").description("Parent
 Ledger"),
+                            
fieldWithPath("trialBalanceEntries[].ledger.subLedgers").description("String").description("Name
 of Subledger"),
+                            
fieldWithPath("trialBalanceEntries[].ledger.totalValue").description("BigDecimal").description("Total
 Value"),
+                            
fieldWithPath("trialBalanceEntries[].ledger.createdOn").description("String").description("Creation
 Date"),
+                            
fieldWithPath("trialBalanceEntries[].ledger.createdBy").description("String").description("Employee
 Who Created"),
+                            
fieldWithPath("trialBalanceEntries[].ledger.lastModifiedOn").description("String").description("Last
 Modified Date"),
+                            
fieldWithPath("trialBalanceEntries[].ledger.lastModifiedBy").description("String").description("Empoyee
 Who Last Modified"),
+                            
fieldWithPath("trialBalanceEntries[].ledger.showAccountsInChart").description("String").description("Should
 We Show Chart of Accounts"),
+                            
fieldWithPath("trialBalanceEntries[].type").description("Type").description("Type
 of trial balance entry " +
+                                    " + \n" +
+                                    " + \n" +
+                                    " *enum* _Type_ { + \n" +
+                                    "  DEBIT, + \n" +
+                                    "  CREDIT, + \n" +
+                                    "}"),
+                            
fieldWithPath("trialBalanceEntries[].amount").description("BigDecimal").description("Amount"),
+                            
fieldWithPath("trialBalanceEntries[1].ledger.identifier").description("String").description("Second
 Trial Balance Entry Identifier"),
+                            
fieldWithPath("trialBalanceEntries[1].ledger.type").description("Type").description("Type
 of trial balance " +
+                                    " + \n" +
+                                    " + \n" +
+                                    " *enum* _Type_ { + \n" +
+                                    "  DEBIT, + \n" +
+                                    "  CREDIT, + \n" +
+                                    "}"),
+                            
fieldWithPath("trialBalanceEntries[1].ledger.name").description("String").description("Ledger
 Name"),
+                            
fieldWithPath("trialBalanceEntries[1].ledger.description").description("String").description("Description
 of Ledger"),
+                            
fieldWithPath("trialBalanceEntries[1].ledger.parentLedgerIdentifier").description("String").description("Parent
 Ledger"),
+                            
fieldWithPath("trialBalanceEntries[1].ledger.subLedgers").description("String").description("Name
 of Subledger"),
+                            
fieldWithPath("trialBalanceEntries[1].ledger.totalValue").description("BigDecimal").description("Total
 Value"),
+                            
fieldWithPath("trialBalanceEntries[1].ledger.createdOn").description("String").description("Creation
 Date"),
+                            
fieldWithPath("trialBalanceEntries[1].ledger.createdBy").description("String").description("Employee
 Who Created"),
+                            
fieldWithPath("trialBalanceEntries[1].ledger.lastModifiedOn").description("String").description("Last
 Modified Date"),
+                            
fieldWithPath("trialBalanceEntries[1].ledger.lastModifiedBy").description("String").description("Empoyee
 Who Last Modified"),
+                            
fieldWithPath("trialBalanceEntries[1].ledger.showAccountsInChart").description("String").description("Should
 We Show Chart of Accounts"),
+                            
fieldWithPath("trialBalanceEntries[1].type").description("Type").description("Type
 of trial balance entry " +
+                                    " + \n" +
+                                    " + \n" +
+                                    " *enum* _Type_ { + \n" +
+                                    "  DEBIT, + \n" +
+                                    "  CREDIT, + \n" +
+                                    "}"),
+                            
fieldWithPath("trialBalanceEntries[1].amount").description("BigDecimal").description("Amount"),
+                            
fieldWithPath("trialBalanceEntries[1].ledger.identifier").description("String").description("Third
 Trial Balance Entry Identifier"),
+                            
fieldWithPath("trialBalanceEntries[2].ledger.type").description("Type").description("Type
 of trial balance " +
+                                    " + \n" +
+                                    " + \n" +
+                                    " *enum* _Type_ { + \n" +
+                                    "  DEBIT, + \n" +
+                                    "  CREDIT, + \n" +
+                                    "}"),
+                            
fieldWithPath("trialBalanceEntries[2].ledger.name").description("String").description("Ledger
 Name"),
+                            
fieldWithPath("trialBalanceEntries[2].ledger.description").description("String").description("Description
 of Ledger"),
+                            
fieldWithPath("trialBalanceEntries[2].ledger.parentLedgerIdentifier").description("String").description("Parent
 Ledger"),
+                            
fieldWithPath("trialBalanceEntries[2].ledger.subLedgers").description("String").description("Name
 of Subledger"),
+                            
fieldWithPath("trialBalanceEntries[2].ledger.totalValue").description("BigDecimal").description("Total
 Value"),
+                            
fieldWithPath("trialBalanceEntries[2].ledger.createdOn").description("String").description("Creation
 Date"),
+                            
fieldWithPath("trialBalanceEntries[2].ledger.createdBy").description("String").description("Employee
 Who Created"),
+                            
fieldWithPath("trialBalanceEntries[2].ledger.lastModifiedOn").description("String").description("Last
 Modified Date"),
+                            
fieldWithPath("trialBalanceEntries[2].ledger.lastModifiedBy").description("String").description("Empoyee
 Who Last Modified"),
+                            
fieldWithPath("trialBalanceEntries[2].ledger.showAccountsInChart").description("String").description("Should
 We Show Chart of Accounts"),
+                            
fieldWithPath("trialBalanceEntries[2].type").description("Type").description("Type
 of trial balance entry " +
+                                    " + \n" +
+                                    " + \n" +
+                                    " *enum* _Type_ { + \n" +
+                                    "  DEBIT, + \n" +
+                                    "  CREDIT, + \n" +
+                                    "}"),
+                            
fieldWithPath("trialBalanceEntries[2].amount").description("BigDecimal").description("Amount"),
+                            
fieldWithPath("debitTotal").type("BigDecimal").description("Total Debit"),
+                            
fieldWithPath("creditTotal").type("BigDecimal").description("Total Credit")
+                    )));
+  }
+}


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to