From c8da821bb6e3bc41cff106ab393c668db38471c2 Mon Sep 17 00:00:00 2001 From: logoutdhaval Date: Wed, 14 Aug 2024 22:00:00 +0530 Subject: [PATCH 1/3] [PHEE-721] Fix /gsma/transcation API to work with different dfspids. --- .../channel/api/definition/GSMATransactionApi.java | 3 ++- .../GSMATransactionApiController.java | 5 +++-- .../channel/camel/routes/ChannelRouteBuilder.java | 13 ++++++++++--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/mifos/connector/channel/api/definition/GSMATransactionApi.java b/src/main/java/org/mifos/connector/channel/api/definition/GSMATransactionApi.java index 66d1e913..2cca72d8 100644 --- a/src/main/java/org/mifos/connector/channel/api/definition/GSMATransactionApi.java +++ b/src/main/java/org/mifos/connector/channel/api/definition/GSMATransactionApi.java @@ -15,5 +15,6 @@ public interface GSMATransactionApi { GsmaP2PResponseDto gsmatransaction(@RequestBody GsmaTransfer requestBody, @RequestHeader(value = CLIENTCORRELATIONID, required = false) String correlationId, @RequestHeader(value = "amsName") String amsName, @RequestHeader(value = "accountHoldingInstitutionId") String accountHoldId, - @RequestHeader(value = "X-CallbackURL") String callbackURL) throws JsonProcessingException; + @RequestHeader(value = "X-CallbackURL") String callbackURL, + @RequestHeader(value = "Platform-TenantId", required = false) String tenantId) throws JsonProcessingException; } diff --git a/src/main/java/org/mifos/connector/channel/api/implementation/GSMATransactionApiController.java b/src/main/java/org/mifos/connector/channel/api/implementation/GSMATransactionApiController.java index d072a31b..9fe75b32 100644 --- a/src/main/java/org/mifos/connector/channel/api/implementation/GSMATransactionApiController.java +++ b/src/main/java/org/mifos/connector/channel/api/implementation/GSMATransactionApiController.java @@ -28,9 +28,10 @@ public class GSMATransactionApiController implements GSMATransactionApi { @Override public GsmaP2PResponseDto gsmatransaction(GsmaTransfer requestBody, String correlationId, String amsName, String accountHoldId, - String callbackURL) throws JsonProcessingException { + String callbackURL, String tenantId) throws JsonProcessingException { Headers headers = new Headers.HeaderBuilder().addHeader("X-CorrelationID", correlationId).addHeader("amsName", amsName) - .addHeader("accountHoldingInstitutionId", accountHoldId).addHeader("X-CallbackURL", callbackURL).build(); + .addHeader("accountHoldingInstitutionId", accountHoldId).addHeader("X-CallbackURL", callbackURL) + .addHeader("Platform-TenantId", tenantId).build(); Exchange exchange = SpringWrapperUtil.getDefaultWrappedExchange(producerTemplate.getCamelContext(), headers, objectMapper.writeValueAsString(requestBody)); producerTemplate.send("direct:post-gsma-transaction", exchange); diff --git a/src/main/java/org/mifos/connector/channel/camel/routes/ChannelRouteBuilder.java b/src/main/java/org/mifos/connector/channel/camel/routes/ChannelRouteBuilder.java index dd583f24..a80e702b 100644 --- a/src/main/java/org/mifos/connector/channel/camel/routes/ChannelRouteBuilder.java +++ b/src/main/java/org/mifos/connector/channel/camel/routes/ChannelRouteBuilder.java @@ -682,14 +682,21 @@ private void inboundTransferC2bImplementationRoutes() { String accountHoldingInstitutionId = e.getIn().getHeader("accountHoldingInstitutionId").toString(); String clientCorrelationId = e.getIn().getHeader("X-CorrelationID", String.class); String callbackURL = e.getIn().getHeader("X-CallbackURL").toString(); - // inbound-transfer-mifos-lion + String tenantId = (String) e.getIn().getHeader("Platform-TenantId"); Map variables = amsUtils.setZeebeVariables(gsmaTranfer.getCustomData(), timer); - variables.put(TENANT_ID, accountHoldingInstitutionId); + if (tenantId != null) { + variables.put(TENANT_ID, tenantId); + } else { + variables.put(TENANT_ID, accountHoldingInstitutionId); + tenantId = accountHoldingInstitutionId; + } + variables.put("accountHoldingInstitutionId", accountHoldingInstitutionId); variables.put(CHANNEL_REQUEST, objectMapper.writeValueAsString(gsmaTranfer)); variables.put("clientCorrelationId", clientCorrelationId); variables.put("X-CallbackURL", callbackURL); + // tenantId in workflowName should be changed to accountHoldingInstitutionId; String workflowName = new StringBuilder().append(subtype).append("_").append(type).append("_").append(amsName) - .append("-").append(accountHoldingInstitutionId).toString(); + .append("-").append(tenantId).toString(); logger.info("Workflow Name:{}", workflowName); String transactionId = zeebeProcessStarter.startZeebeWorkflowC2B(workflowName, variables); GsmaP2PResponseDto responseDto = new GsmaP2PResponseDto(); From 92f783d9d2339350af8b2c366ef19064131f5a0f Mon Sep 17 00:00:00 2001 From: logoutdhaval Date: Wed, 14 Aug 2024 22:03:37 +0530 Subject: [PATCH 2/3] fix circleci --- .circleci/config.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 40ab5cc6..72a15248 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -59,11 +59,7 @@ jobs: # Install Docker to build and push the image - setup_remote_docker: version: 20.10.24 - - kubernetes/install-kubectl - checkout - - aws-eks/update-kubeconfig-with-authenticator: - cluster-name: "sit" - aws-region: "$REGION" # Build the Docker image - run: name: Build Docker image From 719f473eb057eceb0b41303166245ef3727dfdfa Mon Sep 17 00:00:00 2001 From: logoutdhaval Date: Wed, 14 Aug 2024 23:13:26 +0530 Subject: [PATCH 3/3] updated changes --- .../connector/channel/camel/routes/ChannelRouteBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/mifos/connector/channel/camel/routes/ChannelRouteBuilder.java b/src/main/java/org/mifos/connector/channel/camel/routes/ChannelRouteBuilder.java index a80e702b..ef4b4b51 100644 --- a/src/main/java/org/mifos/connector/channel/camel/routes/ChannelRouteBuilder.java +++ b/src/main/java/org/mifos/connector/channel/camel/routes/ChannelRouteBuilder.java @@ -684,7 +684,7 @@ private void inboundTransferC2bImplementationRoutes() { String callbackURL = e.getIn().getHeader("X-CallbackURL").toString(); String tenantId = (String) e.getIn().getHeader("Platform-TenantId"); Map variables = amsUtils.setZeebeVariables(gsmaTranfer.getCustomData(), timer); - if (tenantId != null) { + if (tenantId != null && !tenantId.isEmpty()) { variables.put(TENANT_ID, tenantId); } else { variables.put(TENANT_ID, accountHoldingInstitutionId);