Skip to content

Commit

Permalink
changed datetime format (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
truthfool authored Feb 23, 2023
1 parent a3641fd commit 3fe6ad8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions src/main/java/org/mifos/connector/ams/zeebe/ZeebeUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ public static <T> T zeebeVariable(Exchange exchange, String name, Class<T> clazz
}

public static String getCurrentDate(String requestedDate,String dateFormat) {
LocalDateTime datetime = LocalDateTime.parse(requestedDate, DateTimeFormatter.ofPattern(dateFormat));
return datetime.format(DateTimeFormatter.ofPattern(dateFormat));
String dateFormatGiven="yyyy-MM-dd'T'HH:mm:ss.SSSXXX";
LocalDateTime datetime = LocalDateTime.parse(requestedDate, DateTimeFormatter.ofPattern(dateFormatGiven));
String newDate= datetime.format(DateTimeFormatter.ofPattern(dateFormat));
return newDate;
}

public static LoanRepaymentDTO setLoanRepaymentBody(Exchange exchange) {
Expand All @@ -78,19 +80,21 @@ public static LoanRepaymentDTO setLoanRepaymentBody(Exchange exchange) {
loanRepaymentDTO.setDateFormat(dateFormat);
loanRepaymentDTO.setLocale("en");
loanRepaymentDTO.setTransactionAmount(exchange.getProperty("amount").toString());
String currDate = getCurrentDate(exchange.getProperty("requestedDate").toString(),dateFormat);
loanRepaymentDTO.setTransactionDate(currDate);
loanRepaymentDTO.setTransactionDate(exchange.getProperty("requestedDate").toString());
return loanRepaymentDTO;
}

public static void setZeebeVariables(Exchange e, Map<String, Object> variables, String requestDate, String accountHoldingInstitutionId, String transactionChannelRequestDTO) {
String dateFormat = "dd MMMM yyyy";
String currentDate=getCurrentDate(requestDate,dateFormat);

variables.put(ACCOUNT_IDENTIFIER,e.getProperty(ACCOUNT_IDENTIFIER));
variables.put(ACCOUNT_NUMBER,e.getProperty(ACCOUNT_NUMBER));
variables.put(TRANSACTION_ID, UUID.randomUUID().toString());
variables.put(TENANT_ID,accountHoldingInstitutionId);
variables.put(TRANSFER_ACTION,CREATE.name());
variables.put(CHANNEL_REQUEST,transactionChannelRequestDTO);
variables.put(REQUESTED_DATE,requestDate);
variables.put(REQUESTED_DATE,currentDate);
variables.put(EXTERNAL_ACCOUNT_ID,e.getProperty(ACCOUNT_NUMBER));
variables.put("payeeTenantId", accountHoldingInstitutionId);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application-fin12.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ ams:
auth:
host: https://localhost:8443
loan:
host: https://localhost:8443
host: http://localhost:8443
repayment-path: /fineract-provider/api/v1/interoperation/transactions/{accountNumber}/loanrepayment


Expand Down

0 comments on commit 3fe6ad8

Please sign in to comment.