diff --git a/src/main/java/org/mifos/phee/kafkastreamer/importer/ElasticsearchClient.java b/src/main/java/org/mifos/phee/kafkastreamer/importer/ElasticsearchClient.java index 8f64ee6..bd4acf6 100644 --- a/src/main/java/org/mifos/phee/kafkastreamer/importer/ElasticsearchClient.java +++ b/src/main/java/org/mifos/phee/kafkastreamer/importer/ElasticsearchClient.java @@ -145,14 +145,6 @@ public void upsertToReportingIndex(JSONObject record) { } else if (valueObj.getString("name").equalsIgnoreCase("originDate")) { Instant timestamp = Instant.ofEpochMilli(valueObj.getLong("value")); newRecord.put((String) valueObj.get("name"), timestamp); - } else if (valueObj.getString("name").equalsIgnoreCase("customData")) { - JSONArray customDataArray = valueObj.getJSONArray("customData"); - for (int i = 0; i < customDataArray.length(); i++) { - JSONObject customData = customDataArray.getJSONObject(i); - newRecord.put(customData.getString("key").replaceAll("\"", ""), - customData.getString("value") - .replaceAll("\"", "")); - } } else { newRecord.put((String) valueObj.get("name"), valueObj.get("value").toString() .replaceAll("\"", "")); diff --git a/src/main/java/org/mifos/phee/kafkastreamer/importer/PaymentsIndexConfiguration.java b/src/main/java/org/mifos/phee/kafkastreamer/importer/PaymentsIndexConfiguration.java index b0e8720..9bcbaef 100644 --- a/src/main/java/org/mifos/phee/kafkastreamer/importer/PaymentsIndexConfiguration.java +++ b/src/main/java/org/mifos/phee/kafkastreamer/importer/PaymentsIndexConfiguration.java @@ -86,18 +86,27 @@ public class PaymentsIndexConfiguration { @Value("${reporting.fields.transferResponseCREATE}") private Boolean transferResponseCREATEVal; + @Value("${reporting.fields.currency}") private Boolean currencyVal; + @Value("${reporting.fields.errorInformation}") private Boolean errorInformationVal; - @Value("${reporting.fields.customData.enabled}") + + @Value("${reporting.fields.customData}") private Boolean customDataVal; - @Value("${reporting.fields.customData.enabled.reconciled}") - private Boolean reconciledVal; - @Value("${reporting.fields.customData.enabled.confirmationReceived}") + + @Value("${reporting.fields.confirmationReceived}") private Boolean confirmationReceivedVal; - public PaymentsIndexConfiguration(){} + @Value("${reporting.fields.clientCorrelationId}") + private Boolean clientCorrelationIdVal; + + @Value("${reporting.fields.ams}") + private Boolean amsVal; + + public PaymentsIndexConfiguration() { + } public List getVariables() { Boolean amount = amountVal; @@ -128,100 +137,104 @@ public List getVariables() { Boolean currency = currencyVal; Boolean errorInformation = errorInformationVal; Boolean customData = customDataVal; - Boolean reconciled = reconciledVal; Boolean confirmationReceived = confirmationReceivedVal; - - if (amount) { - variables.add("amount"); - } - if (accountId) { - variables.add("accountId"); - } - if (errorCode) { - variables.add("errorCode"); - } - if (errorDescription) { - variables.add("errorDescription"); - } - if (externalId) { - variables.add("externalId"); - } - if (initiator) { - variables.add("initiator"); - } - if (initiatorType) { - variables.add("initiatorType"); - } - if (isNotificationsFailureEnabled) { - variables.add("isNotificationsFailureEnabled"); - } - if (isNotificationsSuccessEnabled) { - variables.add("isNotificationsSuccessEnabled"); - } - if (mpesaTransactionId) { - variables.add("mpesaTransactionId"); - } - if (mpesaTransactionStatusRetryCount) { - variables.add("mpesaTransactionStatusRetryCount"); - } - if (originDate) { - variables.add("originDate"); - } - if (partyLookupFailed) { - variables.add("partyLookupFailed"); - } - if (phoneNumber) { - variables.add("phoneNumber"); - } - if (processDefinitionKey) { - variables.add("processDefinitionKey"); - } - if (processInstanceKey) { - variables.add("processInstanceKey"); - } - if (scenario) { - variables.add("scenario"); - } - if (tenantId) { - variables.add("tenantId"); - } - if (timer) { - variables.add("timer"); - } - if (timestamp) { - variables.add("timestamp"); - } - if (transactionFailed) { - variables.add("transactionFailed"); - } - if (transactionId) { - variables.add("transactionId"); - } - if (transferCreateFailed) { - variables.add("transferCreateFailed"); - } - if (transferSettlementFailed) { - variables.add("transferSettlementFailed"); - } - if (transferResponseCREATE) { - variables.add("transferResponse-CREATE"); - } - if(currency){ - variables.add("currency"); - } - if(errorInformation){ - variables.add("errorInformation"); - } - if(customData){ - if(reconciled){ - variables.add("reconciled"); - } - if(confirmationReceived){ - variables.add("confirmationReceived"); - } - } + Boolean clientCorrelationId = clientCorrelationIdVal; + Boolean ams = amsVal; + + if (amount) { + variables.add("amount"); + } + if (accountId) { + variables.add("accountId"); + } + if (errorCode) { + variables.add("errorCode"); + } + if (errorDescription) { + variables.add("errorDescription"); + } + if (externalId) { + variables.add("externalId"); + } + if (initiator) { + variables.add("initiator"); + } + if (initiatorType) { + variables.add("initiatorType"); + } + if (isNotificationsFailureEnabled) { + variables.add("isNotificationsFailureEnabled"); + } + if (isNotificationsSuccessEnabled) { + variables.add("isNotificationsSuccessEnabled"); + } + if (mpesaTransactionId) { + variables.add("mpesaTransactionId"); + } + if (mpesaTransactionStatusRetryCount) { + variables.add("mpesaTransactionStatusRetryCount"); + } + if (originDate) { + variables.add("originDate"); + } + if (partyLookupFailed) { + variables.add("partyLookupFailed"); + } + if (phoneNumber) { + variables.add("phoneNumber"); + } + if (processDefinitionKey) { + variables.add("processDefinitionKey"); + } + if (processInstanceKey) { + variables.add("processInstanceKey"); + } + if (scenario) { + variables.add("scenario"); + } + if (tenantId) { + variables.add("tenantId"); + } + if (timer) { + variables.add("timer"); + } + if (timestamp) { + variables.add("timestamp"); + } + if (transactionFailed) { + variables.add("transactionFailed"); + } + if (transactionId) { + variables.add("transactionId"); + } + if (transferCreateFailed) { + variables.add("transferCreateFailed"); + } + if (transferSettlementFailed) { + variables.add("transferSettlementFailed"); + } + if (transferResponseCREATE) { + variables.add("transferResponse-CREATE"); + } + if (currency) { + variables.add("currency"); + } + if (errorInformation) { + variables.add("errorInformation"); + } + if (customData) { + variables.add("customData"); + } + if (confirmationReceived) { + variables.add("confirmationReceived"); + } + if (clientCorrelationId) { + variables.add("clientCorrelationId"); + } + if (ams) { + variables.add("ams"); + } return variables; } - } - +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 8469109..7cad902 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -9,7 +9,6 @@ importer: bulk-size: 20 index-prefix: "zeebe-record" - elasticsearch: security: enabled: false @@ -23,7 +22,6 @@ logging: pattern: console: "%clr(%d{dd-MM-yyyy HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr([%35.35t]){faint} %clr(%-28.28logger{28}){cyan} %clr(:){faint}%X{BUSINESS-LOG} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}" - reporting: enabled: true fields: @@ -32,9 +30,8 @@ reporting: ams: true clientCorrelationId: true currency: true - customData: - enabled: true - confirmationReceived: true + customData: false + confirmationReceived: false errorCode: false errorDescription: true errorInformation: true @@ -59,6 +56,3 @@ reporting: transferCreateFailed: false transferSettlementFailed: false transferResponseCREATE: false - - -