Exemplo n.º 1
0
 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");
 }
Exemplo n.º 2
0
 public Integer getLoanProductId(final String loanProductJSON) {
   return Utils.performServerPost(
       this.requestSpec,
       this.responseSpec,
       CREATE_LOAN_PRODUCT_URL,
       loanProductJSON,
       "resourceId");
 }
Exemplo n.º 3
0
 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;
 }
Exemplo n.º 4
0
 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");
 }
Exemplo n.º 6
0
 public Object createLoanAccount(
     final String loanApplicationJSON, final String responseAttribute) {
   return Utils.performServerPost(
       this.requestSpec,
       this.responseSpec,
       APPLY_LOAN_URL,
       loanApplicationJSON,
       responseAttribute);
 }
Exemplo n.º 7
0
 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 9
0
 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;
 }
Exemplo n.º 10
0
 private Object performLoanTransaction(
     final String postURLForLoanTransaction,
     final String jsonToBeSent,
     final String responseAttribute) {
   return Utils.performServerPost(
       this.requestSpec,
       this.responseSpec,
       postURLForLoanTransaction,
       jsonToBeSent,
       responseAttribute);
 }
Exemplo n.º 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");
  }
Exemplo n.º 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);
  }
Exemplo n.º 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;
 }
Exemplo n.º 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;
 }
Exemplo n.º 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);
  }
Exemplo n.º 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);
 }
Exemplo n.º 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);
  }
Exemplo n.º 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");
 }
Exemplo n.º 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");
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
  }
Exemplo n.º 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");
 }
Exemplo n.º 23
0
 public GLAccountBuilder withAccountTypeAsExpense() {
   GLAccountBuilder.accountType = EXPENSE_ACCOUNT;
   GLAccountBuilder.GLCode = Utils.randomStringGenerator("EXPENSE_", 2);
   GLAccountBuilder.GLCode += Calendar.getInstance().getTimeInMillis() + "";
   return this;
 }
Exemplo n.º 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;
  }
}
Exemplo n.º 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");
 }
Exemplo n.º 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, "");
 }
Exemplo n.º 27
0
 public GLAccountBuilder withAccountTypeAsLiability() {
   GLAccountBuilder.accountType = LIABILITY_ACCOUNT;
   GLAccountBuilder.GLCode = Utils.randomStringGenerator("LIABILITY_", 2);
   GLAccountBuilder.GLCode += Calendar.getInstance().getTimeInMillis() + "";
   return this;
 }
Exemplo n.º 28
0
  public static Object getAllCodes(
      final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {

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