diff --git a/src/main/java/org/mifos/connector/channel/api/definition/TransferApi.java b/src/main/java/org/mifos/connector/channel/api/definition/TransferApi.java index befdfb31..f01040ca 100644 --- a/src/main/java/org/mifos/connector/channel/api/definition/TransferApi.java +++ b/src/main/java/org/mifos/connector/channel/api/definition/TransferApi.java @@ -2,6 +2,7 @@ import static org.mifos.connector.channel.camel.config.CamelProperties.BATCH_ID_HEADER; import static org.mifos.connector.channel.camel.config.CamelProperties.CLIENTCORRELATIONID; +import static org.mifos.connector.channel.camel.config.CamelProperties.REGISTERING_INSTITUTION_ID; import com.fasterxml.jackson.core.JsonProcessingException; import org.mifos.connector.channel.gsma_api.GsmaP2PResponseDto; @@ -19,6 +20,7 @@ public interface TransferApi { GsmaP2PResponseDto transfer(@RequestHeader(value = "Platform-TenantId") String tenant, @RequestHeader(value = BATCH_ID_HEADER, required = false) String batchId, @RequestHeader(value = CLIENTCORRELATIONID, required = false) String correlationId, + @RequestHeader(value = REGISTERING_INSTITUTION_ID, required = false) String registeringInstitutionId, @RequestBody TransactionChannelRequestDTO requestBody) throws JsonProcessingException; @GetMapping("/channel/transfer/{transactionId}") diff --git a/src/main/java/org/mifos/connector/channel/api/implementation/TransferApiController.java b/src/main/java/org/mifos/connector/channel/api/implementation/TransferApiController.java index 86c5f171..ae3c7ce1 100644 --- a/src/main/java/org/mifos/connector/channel/api/implementation/TransferApiController.java +++ b/src/main/java/org/mifos/connector/channel/api/implementation/TransferApiController.java @@ -2,6 +2,7 @@ import static org.mifos.connector.channel.camel.config.CamelProperties.BATCH_ID; import static org.mifos.connector.channel.camel.config.CamelProperties.CLIENTCORRELATIONID; +import static org.mifos.connector.channel.camel.config.CamelProperties.REGISTERING_INSTITUTION_ID; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; @@ -30,10 +31,10 @@ public class TransferApiController implements TransferApi { private Logger logger = LoggerFactory.getLogger(this.getClass()); @Override - public GsmaP2PResponseDto transfer(String tenant, String batchId, String correlationId, TransactionChannelRequestDTO requestBody) - throws JsonProcessingException { + public GsmaP2PResponseDto transfer(String tenant, String batchId, String correlationId, String registeringInstitutionId, + TransactionChannelRequestDTO requestBody) throws JsonProcessingException { Headers headers = new Headers.HeaderBuilder().addHeader("Platform-TenantId", tenant).addHeader(BATCH_ID, batchId) - .addHeader(CLIENTCORRELATIONID, correlationId).build(); + .addHeader(CLIENTCORRELATIONID, correlationId).addHeader(REGISTERING_INSTITUTION_ID, registeringInstitutionId).build(); Exchange exchange = SpringWrapperUtil.getDefaultWrappedExchange(producerTemplate.getCamelContext(), headers, objectMapper.writeValueAsString(requestBody)); logger.info("Client correlation id: " + correlationId); diff --git a/src/main/java/org/mifos/connector/channel/camel/config/CamelProperties.java b/src/main/java/org/mifos/connector/channel/camel/config/CamelProperties.java index 7711ea2b..6c6435a3 100644 --- a/src/main/java/org/mifos/connector/channel/camel/config/CamelProperties.java +++ b/src/main/java/org/mifos/connector/channel/camel/config/CamelProperties.java @@ -11,5 +11,6 @@ private CamelProperties() {} public static final String BATCH_ID_HEADER = "X-BatchID"; public static final String PLATFORM_TENANT_ID = "Platform-TenantId"; public static final String PAYMENT_SCHEME_HEADER = "X-Payment-Scheme"; + public static final String REGISTERING_INSTITUTION_ID = "X-Registering-Institution-ID"; } 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 a5727175..2bbb371f 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 @@ -7,6 +7,7 @@ import static org.mifos.connector.channel.camel.config.CamelProperties.BATCH_ID; import static org.mifos.connector.channel.camel.config.CamelProperties.CLIENTCORRELATIONID; import static org.mifos.connector.channel.camel.config.CamelProperties.PAYMENT_SCHEME_HEADER; +import static org.mifos.connector.channel.camel.config.CamelProperties.REGISTERING_INSTITUTION_ID; import static org.mifos.connector.channel.zeebe.ZeebeMessages.OPERATOR_MANUAL_RECOVERY; import static org.mifos.connector.channel.zeebe.ZeebeVariables.ACCOUNT; import static org.mifos.connector.channel.zeebe.ZeebeVariables.AMS; @@ -306,12 +307,14 @@ private void transferRoutes() { extraVariables.put(BATCH_ID, batchIdHeader); String tenantId = exchange.getIn().getHeader("Platform-TenantId", String.class); + String registeringInstitutionId = exchange.getIn().getHeader("X-Registering-Institution-ID", String.class); String clientCorrelationId = exchange.getIn().getHeader("X-CorrelationID", String.class); logger.info("## CHANNEL Client Correlation Id: " + clientCorrelationId); if (tenantId == null || !dfspIds.contains(tenantId)) { throw new RuntimeException("Requested tenant " + tenantId + " not configured in the connector!"); } extraVariables.put(TENANT_ID, tenantId); + extraVariables.put(REGISTERING_INSTITUTION_ID, registeringInstitutionId); TransactionChannelRequestDTO channelRequest = exchange.getIn().getBody(TransactionChannelRequestDTO.class); TransactionType transactionType = new TransactionType();