Skip to content

Commit 3fe6ad8

Browse files
authored
changed datetime format (#21)
1 parent a3641fd commit 3fe6ad8

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/main/java/org/mifos/connector/ams/zeebe/ZeebeUtil.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,10 @@ public static <T> T zeebeVariable(Exchange exchange, String name, Class<T> clazz
6868
}
6969

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

7577
public static LoanRepaymentDTO setLoanRepaymentBody(Exchange exchange) {
@@ -78,19 +80,21 @@ public static LoanRepaymentDTO setLoanRepaymentBody(Exchange exchange) {
7880
loanRepaymentDTO.setDateFormat(dateFormat);
7981
loanRepaymentDTO.setLocale("en");
8082
loanRepaymentDTO.setTransactionAmount(exchange.getProperty("amount").toString());
81-
String currDate = getCurrentDate(exchange.getProperty("requestedDate").toString(),dateFormat);
82-
loanRepaymentDTO.setTransactionDate(currDate);
83+
loanRepaymentDTO.setTransactionDate(exchange.getProperty("requestedDate").toString());
8384
return loanRepaymentDTO;
8485
}
8586

8687
public static void setZeebeVariables(Exchange e, Map<String, Object> variables, String requestDate, String accountHoldingInstitutionId, String transactionChannelRequestDTO) {
88+
String dateFormat = "dd MMMM yyyy";
89+
String currentDate=getCurrentDate(requestDate,dateFormat);
90+
8791
variables.put(ACCOUNT_IDENTIFIER,e.getProperty(ACCOUNT_IDENTIFIER));
8892
variables.put(ACCOUNT_NUMBER,e.getProperty(ACCOUNT_NUMBER));
8993
variables.put(TRANSACTION_ID, UUID.randomUUID().toString());
9094
variables.put(TENANT_ID,accountHoldingInstitutionId);
9195
variables.put(TRANSFER_ACTION,CREATE.name());
9296
variables.put(CHANNEL_REQUEST,transactionChannelRequestDTO);
93-
variables.put(REQUESTED_DATE,requestDate);
97+
variables.put(REQUESTED_DATE,currentDate);
9498
variables.put(EXTERNAL_ACCOUNT_ID,e.getProperty(ACCOUNT_NUMBER));
9599
variables.put("payeeTenantId", accountHoldingInstitutionId);
96100
}

src/main/resources/application-fin12.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ ams:
3737
auth:
3838
host: https://localhost:8443
3939
loan:
40-
host: https://localhost:8443
40+
host: http://localhost:8443
4141
repayment-path: /fineract-provider/api/v1/interoperation/transactions/{accountNumber}/loanrepayment
4242

4343

0 commit comments

Comments
 (0)