public void documentFindPayrollConfiguration()

in component-test/src/main/java/org/apache/fineract/cn/payroll/PayrollApiDocumentation.java [134:180]


  public void documentFindPayrollConfiguration ( ) throws Exception {

    final PayrollConfiguration payrollConf = DomainObjectGenerator.getPayrollConfiguration();
    payrollConf.setMainAccountNumber("AB12345");

    final PayrollAllocation savingsAllocation = new PayrollAllocation();
    savingsAllocation.setAccountNumber("BAH97531");
    savingsAllocation.setAmount(BigDecimal.valueOf(73.00D));
    savingsAllocation.setProportional(Boolean.TRUE);

    final PayrollAllocation tradeUnionAllocation = new PayrollAllocation();
    tradeUnionAllocation.setAccountNumber("CAG24680");
    tradeUnionAllocation.setAmount(BigDecimal.valueOf(21.00D));
    tradeUnionAllocation.setProportional(Boolean.TRUE);

    final ArrayList <PayrollAllocation> payrollAllocations = new ArrayList <>();
    payrollConf.setPayrollAllocations(payrollAllocations);
    payrollAllocations.add(savingsAllocation);
    payrollAllocations.add(tradeUnionAllocation);

    final Customer customer = new Customer();
    customer.setIdentifier("faundCostoma");

    this.prepareConfigurationMocks(customer.getIdentifier(), payrollConf);
    super.testSubject.setPayrollConfiguration(customer.getIdentifier(), payrollConf);
    super.eventRecorder.wait(EventConstants.PUT_CONFIGURATION, customer.getIdentifier());

    this.mockMvc.perform(get("/customers/" + customer.getIdentifier() + "/payroll")
            .accept(MediaType.APPLICATION_JSON_VALUE)
            .contentType(MediaType.APPLICATION_JSON_VALUE))
            .andExpect(status().isOk())
            .andDo(document("document-find-payroll-configuration", preprocessResponse(prettyPrint()),
                    responseFields(
                            fieldWithPath("mainAccountNumber").description("Main account number"),
                            fieldWithPath("payrollAllocations[].accountNumber").description("Account from where you pay first allocation"),
                            fieldWithPath("payrollAllocations[].amount").type("Integer").description("Amount to be paid during first allocation"),
                            fieldWithPath("payrollAllocations[].proportional").type("Boolean").description("Should payments be proportional ?"),
                            fieldWithPath("payrollAllocations[1].accountNumber").description("Account from where you pay second allocation"),
                            fieldWithPath("payrollAllocations[1].amount").type("Integer").description("Amount to be paid during first allocation"),
                            fieldWithPath("payrollAllocations[1].proportional").type("Boolean").description("Should payments be proportional ?"),
                            fieldWithPath("createdBy").description("Employee who configured payroll"),
                            fieldWithPath("createdOn").description("Date when payroll was configured"),
                            fieldWithPath("lastModifiedBy").type("String").description("Employee who last modified payroll"),
                            fieldWithPath("lastModifiedOn").type("String").description("Date when payroll was last modified")
                    )
            ));
  }