public Integer updateLoan(final Integer id, final String loanApplicationJSON) { return Utils.performServerPut( this.requestSpec, this.responseSpec, "/mifosng-provider/api/v1/loans/" + id + "?" + Utils.TENANT_IDENTIFIER, loanApplicationJSON, "loanId"); }
public Integer getLoanProductId(final String loanProductJSON) { return Utils.performServerPost( this.requestSpec, this.responseSpec, CREATE_LOAN_PRODUCT_URL, loanProductJSON, "resourceId"); }
public HashMap getLoanSummary( final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final Integer loanID) { final String URL = "/mifosng-provider/api/v1/loans/" + loanID + "?associations=all&" + Utils.TENANT_IDENTIFIER; final HashMap response = Utils.performServerGet(requestSpec, responseSpec, URL, "summary"); return response; }
public Integer addChargesForLoan(final Integer loanId, final String request) { System.out.println( "--------------------------------- ADD CHARGES FOR LOAN --------------------------------"); final String ADD_CHARGES_URL = "/mifosng-provider/api/v1/loans/" + loanId + "/charges?" + Utils.TENANT_IDENTIFIER; final HashMap response = Utils.performServerPost(requestSpec, responseSpec, ADD_CHARGES_URL, request, ""); return (Integer) response.get("resourceId"); }
public static HashMap getStatusOfFixedDepositAccount( final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final String fixedDepositAccountID) { final String GET_STATUS_OF_FIXED_DEPOSIT_ACCOUNT_URL = FIXED_DEPOSIT_ACCOUNT_URL + "/" + fixedDepositAccountID + "?" + Utils.TENANT_IDENTIFIER; return Utils.performServerGet( requestSpec, responseSpec, GET_STATUS_OF_FIXED_DEPOSIT_ACCOUNT_URL, "status"); }
public Object createLoanAccount( final String loanApplicationJSON, final String responseAttribute) { return Utils.performServerPost( this.requestSpec, this.responseSpec, APPLY_LOAN_URL, loanApplicationJSON, responseAttribute); }
public Object getLoanDetail( final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final Integer loanID, final String param) { final String URL = "/mifosng-provider/api/v1/loans/" + loanID + "?associations=all&" + Utils.TENANT_IDENTIFIER; return Utils.performServerGet(requestSpec, responseSpec, URL, param); }
public Account createExpenseAccount() { String assetAccountJSON = new GLAccountBuilder().withAccountTypeAsExpense().build(); Integer accountID = Utils.performServerPost( requestSpec, responseSpec, CREATE_GL_ACCOUNT_URL, assetAccountJSON, GL_ACCOUNT_ID_RESPONSE); return new Account(accountID, Account.AccountType.EXPENSE); }
public Integer waiveInterestAndReturnTransactionId( final String date, final String amountToBeWaived, final Integer loanID) { Integer resourceId = Utils.performServerPost( this.requestSpec, this.responseSpec, createLoanTransactionURL(WAIVE_INTEREST_COMMAND, loanID), getWaiveBodyAsJSON(date, amountToBeWaived), "resourceId"); return resourceId; }
private Object performLoanTransaction( final String postURLForLoanTransaction, final String jsonToBeSent, final String responseAttribute) { return Utils.performServerPost( this.requestSpec, this.responseSpec, postURLForLoanTransaction, jsonToBeSent, responseAttribute); }
private HashMap performLoanTransaction( final String postURLForLoanTransaction, final String jsonToBeSent) { final HashMap response = Utils.performServerPost( this.requestSpec, this.responseSpec, postURLForLoanTransaction, jsonToBeSent, "changes"); return (HashMap) response.get("status"); }
public static Object getCodeById( final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final Integer codeId, final String jsonAttributeToGetback) { return Utils.performServerGet( requestSpec, responseSpec, CODE_URL + "/" + codeId + "?" + Utils.TENANT_IDENTIFIER, jsonAttributeToGetback); }
public HashMap getPrepayAmount( final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final Integer loanID) { final String URL = "/mifosng-provider/api/v1/loans/" + loanID + "/transactions/template?command=prepayLoan&" + Utils.TENANT_IDENTIFIER; final HashMap response = Utils.performServerGet(requestSpec, responseSpec, URL, ""); return response; }
public GLAccountBuilder withAccountTypeAsAsset() { GLAccountBuilder.accountType = ASSET_ACCOUNT; GLAccountBuilder.GLCode = Utils.randomStringGenerator("ASSET_", 2); GLAccountBuilder.GLCode += Calendar.getInstance().getTimeInMillis() + ""; // Added // unique // timestamp // for // avoiding // random // collisions return this; }
public static Object getCodeValuesForCode( final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final Integer codeId, final String jsonAttributeToGetback) { return Utils.performServerGet( requestSpec, responseSpec, CODE_VALUE_URL.replace("[codeId]", codeId.toString()) + "?" + Utils.TENANT_IDENTIFIER, jsonAttributeToGetback); }
public Object getLoanProductDetail( final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final Integer loanProductId, final String jsonAttributeToGetBack) { final String URL = "/mifosng-provider/api/v1/loanproducts/" + loanProductId + "?associations=all&" + Utils.TENANT_IDENTIFIER; return Utils.performServerGet(requestSpec, responseSpec, URL, jsonAttributeToGetBack); }
public static Object createCode( final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final String codeName, final String jsonAttributeToGetback) { return Utils.performServerPost( requestSpec, responseSpec, CODE_URL + "?" + Utils.TENANT_IDENTIFIER, getTestCodeAsJSON(codeName), jsonAttributeToGetback); }
public ArrayList getLoanRepaymentSchedule( final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final Integer loanID) { final String URL = "/mifosng-provider/api/v1/loans/" + loanID + "?associations=repaymentSchedule&" + Utils.TENANT_IDENTIFIER; final HashMap response = Utils.performServerGet(requestSpec, responseSpec, URL, "repaymentSchedule"); return (ArrayList) response.get("periods"); }
public Integer deleteChargesForLoan(final Integer loanId, final Integer loanchargeId) { System.out.println( "--------------------------------- DELETE CHARGES FOR LOAN --------------------------------"); final String DELETE_CHARGES_URL = "/mifosng-provider/api/v1/loans/" + loanId + "/charges/" + loanchargeId + "?" + Utils.TENANT_IDENTIFIER; final HashMap response = Utils.performServerDelete(requestSpec, responseSpec, DELETE_CHARGES_URL, ""); return (Integer) response.get("resourceId"); }
private Object adjustLoanTransaction( final Integer loanId, final Integer tansactionId, final String jsonToBeSent, final String responseAttribute) { final String URL = "/mifosng-provider/api/v1/loans/" + loanId + "/transactions/" + tansactionId + "?" + Utils.TENANT_IDENTIFIER; return Utils.performServerPost( this.requestSpec, this.responseSpec, URL, jsonToBeSent, responseAttribute); }
public static Object createCodeValue( final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final Integer codeId, final String codeValueName, final Integer position, final String jsonAttributeToGetback) { return Utils.performServerPost( requestSpec, responseSpec, CODE_VALUE_URL.replace("[codeId]", codeId.toString()) + "?" + Utils.TENANT_IDENTIFIER, getTestCodeValueAsJSON(codeValueName, position), jsonAttributeToGetback); }
public Integer payChargesForLoan( final Integer loanId, final Integer loanchargeId, final String json) { System.out.println( "--------------------------------- WAIVE CHARGES FOR LOAN --------------------------------"); final String CHARGES_URL = "/mifosng-provider/api/v1/loans/" + loanId + "/charges/" + loanchargeId + "?command=pay&" + Utils.TENANT_IDENTIFIER; final HashMap response = Utils.performServerPost(requestSpec, responseSpec, CHARGES_URL, json, ""); return (Integer) response.get("resourceId"); }
public GLAccountBuilder withAccountTypeAsExpense() { GLAccountBuilder.accountType = EXPENSE_ACCOUNT; GLAccountBuilder.GLCode = Utils.randomStringGenerator("EXPENSE_", 2); GLAccountBuilder.GLCode += Calendar.getInstance().getTimeInMillis() + ""; return this; }
public class GLAccountBuilder { public static final String ASSET_ACCOUNT = "1"; public static final String LIABILITY_ACCOUNT = "2"; public static final String EQUITY_ACCOUNT = "3"; public static final String INCOME_ACCOUNT = "4"; public static final String EXPENSE_ACCOUNT = "5"; private static final String ACCOUNT_USAGE_DETAIL = "1"; private static final String ACCOUNT_USAGE_HEADER = "2"; private static final String MANUAL_ENTRIES_ALLOW = "true"; private static final String MANUAL_ENTRIES_NOT_ALLOW = "false"; private static String name = Utils.randomStringGenerator("ACCOUNT_NAME_", 5); private static String GLCode = ""; private static String accountType = ""; private static String accountUsage = ACCOUNT_USAGE_DETAIL; private static String manualEntriesAllowed = MANUAL_ENTRIES_ALLOW; private static String description = "DEFAULT_DESCRIPTION"; public String build() { final HashMap<String, String> map = new HashMap<>(); map.put("name", GLAccountBuilder.name); map.put("glCode", GLAccountBuilder.GLCode); map.put("manualEntriesAllowed", GLAccountBuilder.manualEntriesAllowed); map.put("type", GLAccountBuilder.accountType); map.put("usage", GLAccountBuilder.accountUsage); map.put("description", GLAccountBuilder.description); return new Gson().toJson(map); } public GLAccountBuilder withAccountTypeAsAsset() { GLAccountBuilder.accountType = ASSET_ACCOUNT; GLAccountBuilder.GLCode = Utils.randomStringGenerator("ASSET_", 2); GLAccountBuilder.GLCode += Calendar.getInstance().getTimeInMillis() + ""; // Added // unique // timestamp // for // avoiding // random // collisions return this; } public GLAccountBuilder withAccountTypeAsLiability() { GLAccountBuilder.accountType = LIABILITY_ACCOUNT; GLAccountBuilder.GLCode = Utils.randomStringGenerator("LIABILITY_", 2); GLAccountBuilder.GLCode += Calendar.getInstance().getTimeInMillis() + ""; return this; } public GLAccountBuilder withAccountTypeAsAsEquity() { GLAccountBuilder.accountType = EQUITY_ACCOUNT; GLAccountBuilder.GLCode = Utils.randomStringGenerator("EQUITY_", 2); GLAccountBuilder.GLCode += Calendar.getInstance().getTimeInMillis() + ""; return this; } public GLAccountBuilder withAccountTypeAsIncome() { GLAccountBuilder.accountType = INCOME_ACCOUNT; GLAccountBuilder.GLCode = Utils.randomStringGenerator("INCOME_", 2); GLAccountBuilder.GLCode += Calendar.getInstance().getTimeInMillis() + ""; return this; } public GLAccountBuilder withAccountTypeAsExpense() { GLAccountBuilder.accountType = EXPENSE_ACCOUNT; GLAccountBuilder.GLCode = Utils.randomStringGenerator("EXPENSE_", 2); GLAccountBuilder.GLCode += Calendar.getInstance().getTimeInMillis() + ""; return this; } public GLAccountBuilder withAccountUsageAsHeader() { GLAccountBuilder.accountUsage = ACCOUNT_USAGE_HEADER; return this; } public GLAccountBuilder withMaualEntriesNotAllowed() { GLAccountBuilder.manualEntriesAllowed = MANUAL_ENTRIES_NOT_ALLOW; return this; } }
public Integer getLoanOfficerId(final String loanId) { final String GET_LOAN_URL = "/mifosng-provider/api/v1/loans/" + loanId + "?" + Utils.TENANT_IDENTIFIER; return Utils.performServerGet( this.requestSpec, this.responseSpec, GET_LOAN_URL, "loanOfficerId"); }
public ArrayList getLoanCharges(final Integer loanId) { final String GET_LOAN_CHARGES_URL = "/mifosng-provider/api/v1/loans/" + loanId + "/charges?" + Utils.TENANT_IDENTIFIER; return Utils.performServerGet(requestSpec, responseSpec, GET_LOAN_CHARGES_URL, ""); }
public GLAccountBuilder withAccountTypeAsLiability() { GLAccountBuilder.accountType = LIABILITY_ACCOUNT; GLAccountBuilder.GLCode = Utils.randomStringGenerator("LIABILITY_", 2); GLAccountBuilder.GLCode += Calendar.getInstance().getTimeInMillis() + ""; return this; }
public static Object getAllCodes( final RequestSpecification requestSpec, final ResponseSpecification responseSpec) { return Utils.performServerGet( requestSpec, responseSpec, CODE_URL + "?" + Utils.TENANT_IDENTIFIER, ""); }
public Integer getLoanId(final String loanApplicationJSON) { return Utils.performServerPost( this.requestSpec, this.responseSpec, APPLY_LOAN_URL, loanApplicationJSON, "loanId"); }