diff --git a/src/main/java/org/mifos/connector/mpesa/camel/routes/PaybillRoute.java b/src/main/java/org/mifos/connector/mpesa/camel/routes/PaybillRoute.java index b3ea034..0732d8c 100644 --- a/src/main/java/org/mifos/connector/mpesa/camel/routes/PaybillRoute.java +++ b/src/main/java/org/mifos/connector/mpesa/camel/routes/PaybillRoute.java @@ -81,8 +81,7 @@ public void configure() { String mpesaTxnId = paybillResponseDTO.getTransactionId(); String clientCorrelationId = mpesaTxnId; reconciledStore.put(clientCorrelationId, reconciled); - - GsmaTransfer gsmaTransfer = mpesaUtils.createGsmaTransferDTO(paybillResponseDTO); + GsmaTransfer gsmaTransfer = mpesaUtils.createGsmaTransferDTO(paybillResponseDTO,clientCorrelationId); e.getIn().removeHeaders("*"); e.getIn().setHeader(ACCOUNT_HOLDING_INSTITUTION_ID, paybillResponseDTO.getAccountHoldingInstitutionId()); e.getIn().setHeader(AMS_NAME, paybillResponseDTO.getAmsName()); @@ -196,11 +195,11 @@ public void configure() { variables.put(CHANNEL_REQUEST, obj.toString()); variables.put("amount", paybillConfirmationRequestDTO.getTransactionAmount()); variables.put("accountId", paybillConfirmationRequestDTO.getBillRefNo()); - variables.put("originDate", paybillConfirmationRequestDTO.getTransactionTime()); + variables.put("originDate", Long.parseLong(paybillConfirmationRequestDTO.getTransactionTime())); variables.put("phoneNumber", paybillConfirmationRequestDTO.getMsisdn()); - logger.info("Workflow transaction id : {}", transactionId); variables.put("mpesaTransactionId", mpesaTransactionId); variables.put(TRANSACTION_ID, transactionId); + logger.info("Workflow transaction id : {}", transactionId); if (transactionId != null) { zeebeClient.newPublishMessageCommand() diff --git a/src/main/java/org/mifos/connector/mpesa/utility/MpesaUtils.java b/src/main/java/org/mifos/connector/mpesa/utility/MpesaUtils.java index 3430c91..749a01e 100644 --- a/src/main/java/org/mifos/connector/mpesa/utility/MpesaUtils.java +++ b/src/main/java/org/mifos/connector/mpesa/utility/MpesaUtils.java @@ -48,10 +48,10 @@ enum ams { roster; } - public GsmaTransfer createGsmaTransferDTO(PaybillResponseDTO paybillResponseDTO) { + public GsmaTransfer createGsmaTransferDTO(PaybillResponseDTO paybillResponseDTO, String clientCorrelationId) { GsmaTransfer gsmaTransfer = new GsmaTransfer(); - List customData = setCustomData(paybillResponseDTO); + List customData = setCustomData(paybillResponseDTO,clientCorrelationId); String currentDateTime = getCurrentDateTime(); Party payer = new Party(); @@ -80,7 +80,7 @@ public GsmaTransfer createGsmaTransferDTO(PaybillResponseDTO paybillResponseDTO) return gsmaTransfer; } - private List setCustomData(PaybillResponseDTO paybillResponseDTO) { + private List setCustomData(PaybillResponseDTO paybillResponseDTO, String clientCorrelationId) { CustomData reconciled = new CustomData(); reconciled.setKey("partyLookupFailed"); reconciled.setValue(!paybillResponseDTO.isReconciled()); @@ -90,10 +90,27 @@ private List setCustomData(PaybillResponseDTO paybillResponseDTO) { CustomData mpesaTxnId = new CustomData(); mpesaTxnId.setKey("mpesaTxnId"); mpesaTxnId.setValue(paybillResponseDTO.getTransactionId()); + CustomData ams = new CustomData(); + ams.setKey("ams"); + ams.setValue(paybillResponseDTO.getAmsName()); + CustomData tenantId=new CustomData(); + tenantId.setKey("tenantId"); + tenantId.setValue(paybillResponseDTO.getAccountHoldingInstitutionId()); + CustomData clientCorrelation=new CustomData(); + clientCorrelation.setKey("clientCorrelationId"); + clientCorrelation.setValue(clientCorrelationId); + CustomData currency = new CustomData(); + currency.setKey("currency"); + currency.setValue(paybillResponseDTO.getCurrency()); + List customData = new ArrayList<>(); customData.add(reconciled); customData.add(confirmationReceived); customData.add(mpesaTxnId); + customData.add(ams); + customData.add(tenantId); + customData.add(clientCorrelation); + customData.add(currency); return customData; }