@SuppressWarnings("unchecked") @Test public void getGlCodesTest() { final ChartOfAccountContractResponse chartOfAccountContractResponse = getChartOfAccountContractResponse(); when(restTemplate.postForObject(any(String.class), any(Object.class), any(Class.class))) .thenReturn(chartOfAccountContractResponse); voucherService.getGlCodes(new RequestInfo(), "ap.kurnool", Long.valueOf("1224501"), new BigDecimal("5000"), true, false); }
public VoucherAccountCodeDetails getGlCodes(final RequestInfo requestInfo, final String tenantId, final Long accountId, final BigDecimal amount, final Boolean iscredit, final Boolean isDebit) { final VoucherAccountCodeDetails debitAccountCodeDetail = new VoucherAccountCodeDetails(); final List<ChartOfAccountContract> chartOfAccounts = getChartOfAccounts(requestInfo, tenantId, accountId); if (!chartOfAccounts.isEmpty()) { final ChartOfAccountContract chartOfAccount = chartOfAccounts.get(0); log.debug("Chart Of Account : " + chartOfAccount.getName() + chartOfAccount.getGlcode()); if (!chartOfAccount.getIsActiveForPosting()) throw new RuntimeException( "Chart of Account " + chartOfAccount.getName() + " is not active for posting"); else debitAccountCodeDetail.setGlcode(chartOfAccount.getGlcode()); } else throw new RuntimeException("Chart of Account is not present for account : " + accountId); if (iscredit) debitAccountCodeDetail.setCreditAmount(amount); if (isDebit) debitAccountCodeDetail.setDebitAmount(amount); log.debug("Account Code Detail :: " + debitAccountCodeDetail); return debitAccountCodeDetail; }
VoucherService { public VoucherAccountCodeDetails getGlCodes(final RequestInfo requestInfo, final String tenantId, final Long accountId, final BigDecimal amount, final Boolean iscredit, final Boolean isDebit) { final VoucherAccountCodeDetails debitAccountCodeDetail = new VoucherAccountCodeDetails(); final List<ChartOfAccountContract> chartOfAccounts = getChartOfAccounts(requestInfo, tenantId, accountId); if (!chartOfAccounts.isEmpty()) { final ChartOfAccountContract chartOfAccount = chartOfAccounts.get(0); log.debug("Chart Of Account : " + chartOfAccount.getName() + chartOfAccount.getGlcode()); if (!chartOfAccount.getIsActiveForPosting()) throw new RuntimeException( "Chart of Account " + chartOfAccount.getName() + " is not active for posting"); else debitAccountCodeDetail.setGlcode(chartOfAccount.getGlcode()); } else throw new RuntimeException("Chart of Account is not present for account : " + accountId); if (iscredit) debitAccountCodeDetail.setCreditAmount(amount); if (isDebit) debitAccountCodeDetail.setDebitAmount(amount); log.debug("Account Code Detail :: " + debitAccountCodeDetail); return debitAccountCodeDetail; } }
VoucherService { public VoucherAccountCodeDetails getGlCodes(final RequestInfo requestInfo, final String tenantId, final Long accountId, final BigDecimal amount, final Boolean iscredit, final Boolean isDebit) { final VoucherAccountCodeDetails debitAccountCodeDetail = new VoucherAccountCodeDetails(); final List<ChartOfAccountContract> chartOfAccounts = getChartOfAccounts(requestInfo, tenantId, accountId); if (!chartOfAccounts.isEmpty()) { final ChartOfAccountContract chartOfAccount = chartOfAccounts.get(0); log.debug("Chart Of Account : " + chartOfAccount.getName() + chartOfAccount.getGlcode()); if (!chartOfAccount.getIsActiveForPosting()) throw new RuntimeException( "Chart of Account " + chartOfAccount.getName() + " is not active for posting"); else debitAccountCodeDetail.setGlcode(chartOfAccount.getGlcode()); } else throw new RuntimeException("Chart of Account is not present for account : " + accountId); if (iscredit) debitAccountCodeDetail.setCreditAmount(amount); if (isDebit) debitAccountCodeDetail.setDebitAmount(amount); log.debug("Account Code Detail :: " + debitAccountCodeDetail); return debitAccountCodeDetail; }  }
VoucherService { public VoucherAccountCodeDetails getGlCodes(final RequestInfo requestInfo, final String tenantId, final Long accountId, final BigDecimal amount, final Boolean iscredit, final Boolean isDebit) { final VoucherAccountCodeDetails debitAccountCodeDetail = new VoucherAccountCodeDetails(); final List<ChartOfAccountContract> chartOfAccounts = getChartOfAccounts(requestInfo, tenantId, accountId); if (!chartOfAccounts.isEmpty()) { final ChartOfAccountContract chartOfAccount = chartOfAccounts.get(0); log.debug("Chart Of Account : " + chartOfAccount.getName() + chartOfAccount.getGlcode()); if (!chartOfAccount.getIsActiveForPosting()) throw new RuntimeException( "Chart of Account " + chartOfAccount.getName() + " is not active for posting"); else debitAccountCodeDetail.setGlcode(chartOfAccount.getGlcode()); } else throw new RuntimeException("Chart of Account is not present for account : " + accountId); if (iscredit) debitAccountCodeDetail.setCreditAmount(amount); if (isDebit) debitAccountCodeDetail.setDebitAmount(amount); log.debug("Account Code Detail :: " + debitAccountCodeDetail); return debitAccountCodeDetail; }  @SuppressWarnings({ "rawtypes", "unchecked" }) String createVoucher(final VoucherRequest voucherRequest, final String tenantId, final HttpHeaders headers); VoucherAccountCodeDetails getGlCodes(final RequestInfo requestInfo, final String tenantId,
            final Long accountId, final BigDecimal amount, final Boolean iscredit, final Boolean isDebit); List<ChartOfAccountContract> getChartOfAccounts(final RequestInfo requestInfo, final String tenantId,
            final Long accountId); List<ChartOfAccountDetailContract> getSubledgerDetails(final RequestInfo requestInfo, final String tenantId,
            final Long accountId); void validateSubLedgerDetails(final List<ChartOfAccountDetailContract> creditableCOA,
            final List<ChartOfAccountDetailContract> debitableCOA); VoucherRequest createRevaluationVoucherRequest(final Revaluation revaluation,
            final List<VoucherAccountCodeDetails> accountCodeDetails, final Long assetId, final Long departmentId,
            final HttpHeaders header); VoucherRequest createDisposalVoucherRequest(final Disposal disposal, final Long assetId,
            final Long departmentId, final List<VoucherAccountCodeDetails> accountCodeDetails,final String functionCode,
            final HttpHeaders header); VoucherRequest createDepreciationVoucherRequest(
            final List<DepreciationInputs> depreciationInputsList, final Long departmentId,final String functionCode,final Long assetId,
           final Long depreciationId,  final List<VoucherAccountCodeDetails> accountCodeDetails, final String tenantId, final HttpHeaders header); void setFinancialParameters(final Voucher voucher, final List<VoucherAccountCodeDetails> accountCodeDetails,
            final String tenantId,final String functionCode); }
VoucherService { public VoucherAccountCodeDetails getGlCodes(final RequestInfo requestInfo, final String tenantId, final Long accountId, final BigDecimal amount, final Boolean iscredit, final Boolean isDebit) { final VoucherAccountCodeDetails debitAccountCodeDetail = new VoucherAccountCodeDetails(); final List<ChartOfAccountContract> chartOfAccounts = getChartOfAccounts(requestInfo, tenantId, accountId); if (!chartOfAccounts.isEmpty()) { final ChartOfAccountContract chartOfAccount = chartOfAccounts.get(0); log.debug("Chart Of Account : " + chartOfAccount.getName() + chartOfAccount.getGlcode()); if (!chartOfAccount.getIsActiveForPosting()) throw new RuntimeException( "Chart of Account " + chartOfAccount.getName() + " is not active for posting"); else debitAccountCodeDetail.setGlcode(chartOfAccount.getGlcode()); } else throw new RuntimeException("Chart of Account is not present for account : " + accountId); if (iscredit) debitAccountCodeDetail.setCreditAmount(amount); if (isDebit) debitAccountCodeDetail.setDebitAmount(amount); log.debug("Account Code Detail :: " + debitAccountCodeDetail); return debitAccountCodeDetail; }  @SuppressWarnings({ "rawtypes", "unchecked" }) String createVoucher(final VoucherRequest voucherRequest, final String tenantId, final HttpHeaders headers); VoucherAccountCodeDetails getGlCodes(final RequestInfo requestInfo, final String tenantId,
            final Long accountId, final BigDecimal amount, final Boolean iscredit, final Boolean isDebit); List<ChartOfAccountContract> getChartOfAccounts(final RequestInfo requestInfo, final String tenantId,
            final Long accountId); List<ChartOfAccountDetailContract> getSubledgerDetails(final RequestInfo requestInfo, final String tenantId,
            final Long accountId); void validateSubLedgerDetails(final List<ChartOfAccountDetailContract> creditableCOA,
            final List<ChartOfAccountDetailContract> debitableCOA); VoucherRequest createRevaluationVoucherRequest(final Revaluation revaluation,
            final List<VoucherAccountCodeDetails> accountCodeDetails, final Long assetId, final Long departmentId,
            final HttpHeaders header); VoucherRequest createDisposalVoucherRequest(final Disposal disposal, final Long assetId,
            final Long departmentId, final List<VoucherAccountCodeDetails> accountCodeDetails,final String functionCode,
            final HttpHeaders header); VoucherRequest createDepreciationVoucherRequest(
            final List<DepreciationInputs> depreciationInputsList, final Long departmentId,final String functionCode,final Long assetId,
           final Long depreciationId,  final List<VoucherAccountCodeDetails> accountCodeDetails, final String tenantId, final HttpHeaders header); void setFinancialParameters(final Voucher voucher, final List<VoucherAccountCodeDetails> accountCodeDetails,
            final String tenantId,final String functionCode);  }