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);
 }
示例#8
0
 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;
 }
示例#10
0
 private Object performLoanTransaction(
     final String postURLForLoanTransaction,
     final String jsonToBeSent,
     final String responseAttribute) {
   return Utils.performServerPost(
       this.requestSpec,
       this.responseSpec,
       postURLForLoanTransaction,
       jsonToBeSent,
       responseAttribute);
 }
示例#11
0
  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");
  }
示例#12
0
  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);
  }
示例#13
0
 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;
 }
示例#14
0
 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;
 }
示例#15
0
  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);
  }
示例#16
0
 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);
 }
示例#17
0
  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);
  }
示例#18
0
 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");
 }
示例#19
0
 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");
 }
示例#20
0
 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);
 }
示例#21
0
  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);
  }
示例#22
0
 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");
 }
示例#23
0
 public GLAccountBuilder withAccountTypeAsExpense() {
   GLAccountBuilder.accountType = EXPENSE_ACCOUNT;
   GLAccountBuilder.GLCode = Utils.randomStringGenerator("EXPENSE_", 2);
   GLAccountBuilder.GLCode += Calendar.getInstance().getTimeInMillis() + "";
   return this;
 }
示例#24
0
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;
  }
}
示例#25
0
 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");
 }
示例#26
0
 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, "");
 }
示例#27
0
 public GLAccountBuilder withAccountTypeAsLiability() {
   GLAccountBuilder.accountType = LIABILITY_ACCOUNT;
   GLAccountBuilder.GLCode = Utils.randomStringGenerator("LIABILITY_", 2);
   GLAccountBuilder.GLCode += Calendar.getInstance().getTimeInMillis() + "";
   return this;
 }
示例#28
0
  public static Object getAllCodes(
      final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {

    return Utils.performServerGet(
        requestSpec, responseSpec, CODE_URL + "?" + Utils.TENANT_IDENTIFIER, "");
  }
示例#29
0
 public Integer getLoanId(final String loanApplicationJSON) {
   return Utils.performServerPost(
       this.requestSpec, this.responseSpec, APPLY_LOAN_URL, loanApplicationJSON, "loanId");
 }