diff --git a/.circleci/config.yml b/.circleci/config.yml index b079b6f..32bd0ae 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -23,18 +23,18 @@ jobs: IMAGE_TAG=$CIRCLE_TAG # Check if the Docker image with the same tag already exists in Docker Hub - if curl -s -f -u "$DOCKERHUB_USERNAME":"$DOCKERHUB_PASSWORD" "https://hub.docker.com/v2/repositories/openmf/ph-ee-connector-mojaloop/tags/$IMAGE_TAG" > /dev/null; then + if curl -s -f -u "$DOCKERHUB_USERNAME":"$DOCKERHUB_PASSWORD" "https://hub.docker.com/v2/repositories/fynarfin/ph-ee-connector-mojaloop/tags/$IMAGE_TAG" > /dev/null; then echo "Skipping the build and push as the tag $IMAGE_TAG already exists in Docker Hub." exit 0 fi # Build and tag the Docker image ./gradlew bootJar - docker build -t "openmf/ph-ee-connector-mojaloop:$IMAGE_TAG" . + docker build -t "fynarfin/ph-ee-connector-mojaloop:$IMAGE_TAG" . # Push the Docker image to Docker Hub docker login -u "$DOCKERHUB_USERNAME" -p "$DOCKERHUB_PASSWORD" - docker push "openmf/ph-ee-connector-mojaloop:$IMAGE_TAG" + docker push "fynarfin/ph-ee-connector-mojaloop:$IMAGE_TAG" # when: always # The job will be executed even if there's no match for the tag filter @@ -55,13 +55,13 @@ jobs: name: Build Docker image command: | ./gradlew bootJar - docker build -t openmf/ph-ee-connector-mojaloop:latest . - if [ "$CIRCLE_BRANCH" != "master" ]; then + docker build -t fynarfin/ph-ee-connector-mojaloop:latest . + if [ "$CIRCLE_BRANCH" != "develop" ]; then PR_NUMBER=$(basename $CIRCLE_PULL_REQUEST) - PR_TITLE=$(curl -sSL "https://api.github.com/repos/openmf/$CIRCLE_PR_REPONAME/pulls/$PR_NUMBER" | jq -r '.title') + PR_TITLE=$(curl -sSL "https://api.github.com/repos/fynarfin/$CIRCLE_PR_REPONAME/pulls/$PR_NUMBER" | jq -r '.title') JIRA_STORY=$(echo $PR_TITLE | cut -d "[" -f2 | cut -d "]" -f1 | tr '[A-Z]' '[a-z]') if [ -z "$JIRA_STORY" ]; then echo "Invalid PR title" && exit 1; else echo "Ticket NO: $JIRA_STORY"; fi - docker image tag openmf/ph-ee-connector-mojaloop:latest openmf/ph-ee-connector-mojaloop:$JIRA_STORY + docker image tag fynarfin/ph-ee-connector-mojaloop:latest fynarfin/ph-ee-connector-mojaloop:$JIRA_STORY fi # Log in to DockerHub using environment variables @@ -73,14 +73,14 @@ jobs: - run: name: Push Docker image to DockerHub command: | - if [ "$CIRCLE_BRANCH" = "master" ]; then - docker push openmf/ph-ee-connector-mojaloop:latest + if [ "$CIRCLE_BRANCH" = "develop" ]; then + docker push fynarfin/ph-ee-connector-mojaloop:latest fi - if [ "$CIRCLE_BRANCH" != "master" ]; then + if [ "$CIRCLE_BRANCH" != "develop" ]; then PR_NUMBER=$(basename $CIRCLE_PULL_REQUEST) - PR_TITLE=$(curl -sSL "https://api.github.com/repos/openmf/$CIRCLE_PR_REPONAME/pulls/$PR_NUMBER" | jq -r '.title') + PR_TITLE=$(curl -sSL "https://api.github.com/repos/fynarfin/$CIRCLE_PR_REPONAME/pulls/$PR_NUMBER" | jq -r '.title') JIRA_STORY=$(echo $PR_TITLE | cut -d "[" -f2 | cut -d "]" -f1 | tr '[A-Z]' '[a-z]') - docker push openmf/ph-ee-connector-mojaloop:${JIRA_STORY} + docker push fynarfin/ph-ee-connector-mojaloop:${JIRA_STORY} fi workflows: diff --git a/src/main/java/org/mifos/connector/mojaloop/camel/UnmarshlingRoute.java b/src/main/java/org/mifos/connector/mojaloop/camel/UnmarshlingRoute.java index c5a2250..da3c44a 100644 --- a/src/main/java/org/mifos/connector/mojaloop/camel/UnmarshlingRoute.java +++ b/src/main/java/org/mifos/connector/mojaloop/camel/UnmarshlingRoute.java @@ -27,7 +27,7 @@ public void configure() { Class type = (Class) exchange.getProperty(CLASS_TYPE); String bdy = exchange.getIn().getBody(String.class); exchange.getIn().setBody(objectMapper.readValue(bdy, type)); - logger.debug("Converted dto: {}", exchange.getIn().getBody()); + logger.info("Converted dto: {}", exchange.getIn().getBody()); } catch (Exception e) { logger.error("Error while unmarshling body: {}", e.getMessage()); } diff --git a/src/main/java/org/mifos/connector/mojaloop/camel/trace/GetCachedTransactionIdProcessor.java b/src/main/java/org/mifos/connector/mojaloop/camel/trace/GetCachedTransactionIdProcessor.java index 7f9f01f..e983c46 100644 --- a/src/main/java/org/mifos/connector/mojaloop/camel/trace/GetCachedTransactionIdProcessor.java +++ b/src/main/java/org/mifos/connector/mojaloop/camel/trace/GetCachedTransactionIdProcessor.java @@ -21,11 +21,11 @@ public class GetCachedTransactionIdProcessor implements Processor { public void process(Exchange exchange) { String transactionIdKey = null; String traceparent = exchange.getIn().getHeader(HEADER_TRACEPARENT, String.class); - logger.debug("trace parent header: {}", traceparent); + logger.info("trace parent header: {}", traceparent); String transactionId = resolveTransactionIdFromTraceparent(traceparent); - logger.debug("resolved parent {} to transactionId {}", traceparent, transactionId); + logger.info("resolved parent {} to transactionId {}", traceparent, transactionId); exchange.setProperty(CamelProperties.CACHED_TRANSACTION_ID, transactionId); if (transactionId == null) { diff --git a/src/main/java/org/mifos/connector/mojaloop/party/PartyLookupRoutes.java b/src/main/java/org/mifos/connector/mojaloop/party/PartyLookupRoutes.java index 4654dee..0120dbf 100644 --- a/src/main/java/org/mifos/connector/mojaloop/party/PartyLookupRoutes.java +++ b/src/main/java/org/mifos/connector/mojaloop/party/PartyLookupRoutes.java @@ -80,20 +80,24 @@ public void configure() { .otherwise() .process(e -> { String host = e.getIn().getHeader("Host", String.class).split(":")[0]; - log.debug("HOST: {}", host); - String tenantId = partyProperties.getPartyByDomain(host).getTenantId(); - log.debug("TENANT ID: {}", tenantId); - log.debug("Headers: {}", e.getIn().getHeaders()); + log.info("HOST: {}", host); String payeeFsp = e.getIn().getHeader(FSPIOP_DESTINATION.headerName(), String.class); - log.debug("Payeefsp: {}", payeeFsp); - log.debug("PARTIES: {}", objectMapper.writeValueAsString(partyProperties.getParties())); - log.debug("PAYEE TENANT: {}", partyProperties.getPartyByDfsp(payeeFsp).getTenantId()); + log.info("FSPIOP DESTINATION: {}", payeeFsp); + String tenantId = partyProperties.getPartyByDomain(host, payeeFsp).getTenantId(); + + log.info("Tenant ID: {}", tenantId); + log.info("Headers: {}", e.getIn().getHeaders()); + log.info("Payeefsp: {}", payeeFsp); + log.info("PARTIES: {}", objectMapper.writeValueAsString(partyProperties.getParties())); + log.info("PAYEE TENANT: {}", partyProperties.getPartyByDfsp(payeeFsp).getTenantId()); zeebeProcessStarter.startZeebeWorkflow(partyLookupFlow.replace("{tenant}", tenantId), variables -> { variables.put(HEADER_DATE, e.getIn().getHeader(HEADER_DATE)); variables.put(HEADER_TRACEPARENT, e.getIn().getHeader(HEADER_TRACEPARENT)); variables.put(FSPIOP_SOURCE.headerName(), e.getIn().getHeader(FSPIOP_SOURCE.headerName())); + log.info("FSPIOP_SOURCE.headerName() {}", variables.get(FSPIOP_SOURCE.headerName())); variables.put(PAYEE_TENANT_ID, partyProperties.getPartyByDfsp(payeeFsp).getTenantId()); + log.info("PAYEE_TENANT_ID {}", partyProperties.getPartyByDfsp(payeeFsp).getTenantId()); variables.put(PARTY_ID_TYPE, e.getIn().getHeader(PARTY_ID_TYPE)); variables.put(PARTY_ID, e.getIn().getHeader(PARTY_ID)); variables.put(TENANT_ID, tenantId); @@ -141,7 +145,7 @@ public void configure() { new PartyIdInfo(IdentifierType.valueOf(e.getIn().getHeader(PARTY_ID_TYPE, String.class)), e.getIn().getHeader(PARTY_ID, String.class), null, - partyProperties.getPartyByDomain(host).getFspId()), + partyProperties.getPartyByDomain(host, null).getFspId()), null, null, null); @@ -186,13 +190,17 @@ public void configure() { PartyIdInfo requestedParty = e.getProperty(IS_RTP_REQUEST, Boolean.class) ? channelRequest.getPayer().getPartyIdInfo() : channelRequest.getPayee().getPartyIdInfo(); e.setProperty(PARTY_ID_TYPE, requestedParty.getPartyIdType()); e.setProperty(PARTY_ID, requestedParty.getPartyIdentifier()); + e.setProperty(PAYEE_DFSP_ID, e.getProperty(PAYEE_DFSP_ID, String.class)); + log.info("PAYEE_DFSP_ID {}", e.getProperty(PAYEE_DFSP_ID, String.class)); + if(e.getProperty(PAYEE_DFSP_ID, String.class) != null) { + e.getIn().setHeader(FSPIOP_DESTINATION.headerName(), e.getProperty(PAYEE_DFSP_ID, String.class)); + } e.getIn().setHeader(FSPIOP_SOURCE.headerName(), partyProperties.getPartyByTenant(e.getProperty(TENANT_ID, String.class)).getFspId()); - mojaloopUtil.setPartyHeadersRequest(e); }) .process(addTraceHeaderProcessor) .setHeader(Exchange.HTTP_METHOD, constant("GET")) - .process(e -> log.info("Mojaloop headers : {}", e.getIn().getHeaders())) + .process(e -> log.info("Mojaloop send-party-lookup headers : {}", e.getIn().getHeaders())) .setProperty(HOST, simple("{{switch.als-host}}")) .setProperty(ENDPOINT, simple("/parties/${exchangeProperty." + PARTY_ID_TYPE + "}/${exchangeProperty." + PARTY_ID + "}")) .to("direct:external-api-call") diff --git a/src/main/java/org/mifos/connector/mojaloop/party/PartyLookupWorkers.java b/src/main/java/org/mifos/connector/mojaloop/party/PartyLookupWorkers.java index a1f2aa9..ff536cf 100644 --- a/src/main/java/org/mifos/connector/mojaloop/party/PartyLookupWorkers.java +++ b/src/main/java/org/mifos/connector/mojaloop/party/PartyLookupWorkers.java @@ -23,18 +23,7 @@ import static org.mifos.connector.common.mojaloop.type.MojaloopHeaders.FSPIOP_SOURCE; import static org.mifos.connector.mojaloop.camel.config.CamelProperties.*; import static org.mifos.connector.mojaloop.zeebe.ZeebeProcessStarter.zeebeVariablesToCamelHeaders; -import static org.mifos.connector.mojaloop.zeebe.ZeebeVariables.ACCOUNT_CURRENCY; -import static org.mifos.connector.mojaloop.zeebe.ZeebeVariables.CHANNEL_REQUEST; -import static org.mifos.connector.mojaloop.zeebe.ZeebeVariables.ERROR_INFORMATION; -import static org.mifos.connector.mojaloop.zeebe.ZeebeVariables.INITIATOR_FSP_ID; -import static org.mifos.connector.mojaloop.zeebe.ZeebeVariables.IS_RTP_REQUEST; -import static org.mifos.connector.mojaloop.zeebe.ZeebeVariables.ORIGIN_DATE; -import static org.mifos.connector.mojaloop.zeebe.ZeebeVariables.PARTY_ID; -import static org.mifos.connector.mojaloop.zeebe.ZeebeVariables.PARTY_ID_TYPE; -import static org.mifos.connector.mojaloop.zeebe.ZeebeVariables.PARTY_LOOKUP_RETRY_COUNT; -import static org.mifos.connector.mojaloop.zeebe.ZeebeVariables.PAYEE_PARTY_RESPONSE; -import static org.mifos.connector.mojaloop.zeebe.ZeebeVariables.TENANT_ID; -import static org.mifos.connector.mojaloop.zeebe.ZeebeVariables.TRANSACTION_ID; +import static org.mifos.connector.mojaloop.zeebe.ZeebeVariables.*; import static org.mifos.connector.mojaloop.zeebe.ZeebeeWorkers.WORKER_PARTY_LOOKUP_LOCAL_RESPONSE; import static org.mifos.connector.mojaloop.zeebe.ZeebeeWorkers.WORKER_PARTY_LOOKUP_REQUEST; import static org.mifos.connector.mojaloop.zeebe.ZeebeeWorkers.WORKER_PARTY_REGISTRATION_ORACLE; @@ -82,6 +71,8 @@ public void setupWorkers() { boolean isTransactionRequest = (boolean) existingVariables.get(IS_RTP_REQUEST); String tenantId = (String) existingVariables.get(TENANT_ID); + String payeeFspId = (String) existingVariables.get(PAYEE_DFSP_ID); + logger.info("Payee fsp id is {}", payeeFspId); Object channelRequest = existingVariables.get(CHANNEL_REQUEST); // only saved for operations to identify workflow if (existingVariables.get(INITIATOR_FSP_ID) == null) { @@ -98,6 +89,7 @@ public void setupWorkers() { exchange.setProperty(ORIGIN_DATE, existingVariables.get(ORIGIN_DATE)); exchange.setProperty(IS_RTP_REQUEST, isTransactionRequest); exchange.setProperty(TENANT_ID, tenantId); + exchange.setProperty(PAYEE_DFSP_ID, payeeFspId); producerTemplate.send("direct:send-party-lookup", exchange); } else { PartyIdInfo partyIdInfo = new PartyIdInfo(MSISDN, "27710305999", null, "in03tn05"); @@ -139,8 +131,8 @@ public void setupWorkers() { exchange.setProperty(PARTY_ID_TYPE, existingVariables.get(PARTY_ID_TYPE)); exchange.setProperty(PARTY_ID, existingVariables.get(PARTY_ID)); - logger.debug("Error info: {}", objectMapper.writeValueAsString(errorInformation)); - logger.debug("Zeebe variables: {}", existingVariables); + logger.info("Error info: {}", objectMapper.writeValueAsString(errorInformation)); + logger.info("Zeebe variables: {}", existingVariables); producerTemplate.send("direct:send-parties-error-response", exchange); } else { diff --git a/src/main/java/org/mifos/connector/mojaloop/properties/PartyProperties.java b/src/main/java/org/mifos/connector/mojaloop/properties/PartyProperties.java index f226841..f691b4e 100644 --- a/src/main/java/org/mifos/connector/mojaloop/properties/PartyProperties.java +++ b/src/main/java/org/mifos/connector/mojaloop/properties/PartyProperties.java @@ -1,15 +1,19 @@ package org.mifos.connector.mojaloop.properties; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; @Component @ConfigurationProperties public class PartyProperties { + private static final Logger log = LoggerFactory.getLogger(PartyProperties.class); private List parties = new ArrayList<>(); public PartyProperties() { @@ -37,10 +41,20 @@ public Party getPartyByTenant(String tenant) { .orElseThrow(() -> new RuntimeException("Party with tenant: " + tenant + ", not configured!")); } - public Party getPartyByDomain(String domain) { - return getParties().stream() + public Party getPartyByDomain(String domain, String payeeFsp) { + List filteredParties = getParties().stream() .filter(t -> t.getDomain().equals(domain)) + .toList(); + log.info("Filtered party: " + filteredParties.toString()); + if (payeeFsp == null || payeeFsp.isEmpty() || filteredParties.size() == 1) { + return filteredParties.stream() + .findFirst() + .orElseThrow(() -> new RuntimeException("Party with domain: " + domain + ", not configured!")); + } + + return filteredParties.stream() + .filter(t -> t.getFspId().equals(payeeFsp)) .findFirst() - .orElseThrow(() -> new RuntimeException("Party with domain: " + domain + ", not configured!")); + .orElseThrow(() -> new RuntimeException("Party with domain: " + domain + " and payeeFsp: " + payeeFsp + ", not configured!")); } } diff --git a/src/main/java/org/mifos/connector/mojaloop/quote/QuoteResponseProcessor.java b/src/main/java/org/mifos/connector/mojaloop/quote/QuoteResponseProcessor.java index dd0fe93..19fc88b 100644 --- a/src/main/java/org/mifos/connector/mojaloop/quote/QuoteResponseProcessor.java +++ b/src/main/java/org/mifos/connector/mojaloop/quote/QuoteResponseProcessor.java @@ -51,8 +51,8 @@ public void process(Exchange exchange) throws JsonProcessingException { variables.put(QUOTE_FAILED, true); } else { QuoteCallbackDTO response = exchange.getIn().getBody(QuoteCallbackDTO.class); - logger.debug("ILP PACKET: {}", response.getIlpPacket()); - logger.debug("CONDITION: {}", response.getCondition()); + logger.info("ILP PACKET: {}", response.getIlpPacket()); + logger.info("CONDITION: {}", response.getCondition()); messageName = QUOTE_CALLBACK; variables.put(PAYEE_QUOTE_RESPONSE, objectMapper.writeValueAsString(response)); if (isMojaloopEnabled && !ilpBuilder.isValidPacketAgainstCondition(response.getIlpPacket(), response.getCondition())) { diff --git a/src/main/java/org/mifos/connector/mojaloop/quote/QuoteRoutes.java b/src/main/java/org/mifos/connector/mojaloop/quote/QuoteRoutes.java index cff5bfd..67f3854 100644 --- a/src/main/java/org/mifos/connector/mojaloop/quote/QuoteRoutes.java +++ b/src/main/java/org/mifos/connector/mojaloop/quote/QuoteRoutes.java @@ -96,9 +96,13 @@ public void configure() { .to("direct:body-unmarshling") .process(exchange -> { // @formatter:on QuoteSwitchRequestDTO request = exchange.getIn().getBody(QuoteSwitchRequestDTO.class); + log.info("Received quote switch request: {}", request); PartyIdInfo payee = request.getPayee().getPartyIdInfo(); + log.info("Payee: {}", payee); String tenantId = partyProperties.getPartyByDfsp(payee.getFspId()).getTenantId(); - + log.info("Tenant ID: {}", tenantId); + log.info("exchange.getIn().getBody(): {}", exchange.getIn().getBody()); + log.info("exchange.getIn().getHeaders(): {}", exchange.getIn().getHeaders()); zeebeProcessStarter.startZeebeWorkflow(quoteFlow.replace("{tenant}", tenantId), variables -> { variables.put("initiator", request.getTransactionType().getInitiator()); @@ -106,7 +110,7 @@ public void configure() { variables.put("scenario", request.getTransactionType().getScenario()); variables.put("amount", new FspMoneyData(request.getAmount().getAmountDecimal(), request.getAmount().getCurrency())); variables.put("transactionId", request.getTransactionId()); - variables.put("transferCode", request.getTransactionRequestId()); // TODO is that right? + variables.put("transferCode", request.getTransactionRequestId()); ExtensionList extensionList = request.getExtensionList(); String note = extensionList == null ? "" : extensionList.getExtension().stream() @@ -119,6 +123,7 @@ public void configure() { variables.put(QUOTE_ID, request.getQuoteId()); variables.put(FSPIOP_SOURCE.headerName(), payee.getFspId()); variables.put(FSPIOP_DESTINATION.headerName(), request.getPayer().getPartyIdInfo().getFspId()); + log.info("FSPIOP_DESTINATION {} {}",FSPIOP_DESTINATION.headerName(), request.getPayer().getPartyIdInfo().getFspId()); variables.put(TRANSACTION_ID, request.getTransactionId()); variables.put(QUOTE_SWITCH_REQUEST, exchange.getProperty(QUOTE_SWITCH_REQUEST)); variables.put(QUOTE_SWITCH_REQUEST_AMOUNT, request.getAmount()); @@ -161,7 +166,7 @@ public void configure() { from("rest:PUT:/switch/quotes/{" + QUOTE_ID + "}") .setProperty(CLASS_TYPE, constant(QuoteCallbackDTO.class)) .to("direct:body-unmarshling") - .process(exchange -> logger.debug("Received callback: {}", objectMapper.writeValueAsString(exchange.getIn().getBody(QuoteCallbackDTO.class)))) + .process(exchange -> logger.info("Received callback: {}", objectMapper.writeValueAsString(exchange.getIn().getBody(QuoteCallbackDTO.class)))) .to("direct:quotes-step4"); from("direct:quotes-step4") @@ -213,8 +218,8 @@ public void configure() { requestAmount.getAmountDecimal()); String localQuoteResponseString = exchange.getIn().getHeader(LOCAL_QUOTE_RESPONSE, String.class); - logger.debug("## parsing local quote response string: {}", localQuoteResponseString); - logger.debug("ILP object: {}", objectMapper.writeValueAsString(ilp)); + logger.info("## parsing local quote response string: {}", localQuoteResponseString); + logger.info("ILP object: {}", objectMapper.writeValueAsString(ilp)); QuoteFspResponseDTO localQuoteResponse = objectMapper.readValue(localQuoteResponseString, QuoteFspResponseDTO.class); FspMoneyData fspFee = localQuoteResponse.getFspFee(); FspMoneyData fspCommission = localQuoteResponse.getFspCommission(); @@ -253,7 +258,7 @@ public void configure() { .log(LoggingLevel.DEBUG, "######## PAYER -> SWITCH - quote request - STEP 1") .process(exchange -> { TransactionChannelRequestDTO channelRequest = objectMapper.readValue(exchange.getProperty(CHANNEL_REQUEST, String.class), TransactionChannelRequestDTO.class); - logger.debug("Channel request: {}", channelRequest); + logger.info("Channel request: {}", channelRequest); TransactionType transactionType = new TransactionType(); transactionType.setInitiator(channelRequest.getTransactionType().getInitiator()); transactionType.setInitiatorType(channelRequest.getTransactionType().getInitiatorType()); @@ -281,7 +286,7 @@ public void configure() { null); MoneyData requestAmount = channelRequest.getAmount(); - logger.debug("Amount decimal: {}", channelRequest.getAmount().getAmountDecimal()); + logger.info("Amount decimal: {}", channelRequest.getAmount().getAmountDecimal()); stripAmount(requestAmount); QuoteSwitchRequestDTO quoteRequest = new QuoteSwitchRequestDTO( exchange.getProperty(TRANSACTION_ID, String.class), diff --git a/src/main/java/org/mifos/connector/mojaloop/transfer/TransferWorkers.java b/src/main/java/org/mifos/connector/mojaloop/transfer/TransferWorkers.java index 53ea790..633eda5 100644 --- a/src/main/java/org/mifos/connector/mojaloop/transfer/TransferWorkers.java +++ b/src/main/java/org/mifos/connector/mojaloop/transfer/TransferWorkers.java @@ -107,7 +107,7 @@ public void setupWorkers() { exchange.setProperty(ORIGIN_DATE, variables.get(ORIGIN_DATE)); exchange.setProperty(CHANNEL_REQUEST, variables.get(CHANNEL_REQUEST)); exchange.getIn().setBody(variables.get(PAYEE_QUOTE_RESPONSE)); - logger.debug("PAYEE QUOTE RESPONSE ZEEBE VARIABLE: {}", variables.get(PAYEE_QUOTE_RESPONSE)); + logger.info("PAYEE QUOTE RESPONSE ZEEBE VARIABLE: {}", variables.get(PAYEE_QUOTE_RESPONSE)); producerTemplate.send("direct:send-transfer", exchange); } else { TransferSwitchResponseDTO response = new TransferSwitchResponseDTO(); diff --git a/src/main/java/org/mifos/connector/mojaloop/util/MojaloopUtil.java b/src/main/java/org/mifos/connector/mojaloop/util/MojaloopUtil.java index e04a860..34bdbbb 100644 --- a/src/main/java/org/mifos/connector/mojaloop/util/MojaloopUtil.java +++ b/src/main/java/org/mifos/connector/mojaloop/util/MojaloopUtil.java @@ -48,6 +48,7 @@ public void setPartyHeadersResponse(Exchange exchange) { public void setPartyHeadersRequest(Exchange exchange) { Map headers = new HashMap<>(); headers.put(FSPIOP_SOURCE.headerName(), exchange.getIn().getHeader(FSPIOP_SOURCE.headerName())); + headers.put(FSPIOP_DESTINATION.headerName(), exchange.getIn().getHeader(FSPIOP_DESTINATION.headerName())); headers.put(HEADER_CONTENT_TYPE, PARTIES_CONTENT_TYPE.headerValue()); headers.put(HEADER_ACCEPT, PARTIES_ACCEPT_TYPE.headerValue()); headers.put(HEADER_HOST, accountLookupService); diff --git a/src/main/java/org/mifos/connector/mojaloop/zeebe/ZeebeVariables.java b/src/main/java/org/mifos/connector/mojaloop/zeebe/ZeebeVariables.java index 358c4a5..af27f4f 100644 --- a/src/main/java/org/mifos/connector/mojaloop/zeebe/ZeebeVariables.java +++ b/src/main/java/org/mifos/connector/mojaloop/zeebe/ZeebeVariables.java @@ -20,6 +20,7 @@ private ZeebeVariables() {} public static final String PARTY_LOOKUP_FSP_ID = "partyLookupFspId"; public static final String PARTY_LOOKUP_RETRY_COUNT = "partyLookupRetryCount"; public static final String PAYEE_PARTY_RESPONSE = "payeePartyResponse"; + public static final String PAYEE_DFSP_ID = "X-PayeeDFSP-ID"; public static final String PAYEE_QUOTE_RESPONSE = "payeeQuoteResponse"; public static final String PAYER_AUTHORISATION_RETRY_COUNT = "payerAuthorisationRetryCount"; public static final String PAYER_CONFIRMATION_RETRY_COUNT = "payerConfirmationRetryCount"; diff --git a/src/main/resources/application-bb.yml b/src/main/resources/application-bb.yml index 55fc2bd..73c4b4a 100644 --- a/src/main/resources/application-bb.yml +++ b/src/main/resources/application-bb.yml @@ -5,3 +5,16 @@ parties: - tenantId: lion fspId: payeefsp domain: "" + +parties_0_domain : https://fynams.sandbox.fynarfin.io/ +parties_0_fspId : payerfsp +parties_0_tenantId : wakanda +parties_1_domain : mojaloop.sandbox.fynarfin.io +parties_1_fspId : payeefsp +parties_1_tenantId : jupiter +parties_2_domain : mojaloop.sandbox.fynarfin.io +parties_2_fspId : payeefsp2 +parties_2_tenantId : pluto +parties_3_domain : mojaloop.sandbox.fynarfin.io +parties_3_fspId : payeefsp3 +parties_3_tenantId : venus diff --git a/src/test/java/org/mifos/connector/mojaloop/IlpTestCase.java b/src/test/java/org/mifos/connector/mojaloop/IlpTestCase.java index 63892d1..28cfc4a 100644 --- a/src/test/java/org/mifos/connector/mojaloop/IlpTestCase.java +++ b/src/test/java/org/mifos/connector/mojaloop/IlpTestCase.java @@ -88,7 +88,7 @@ public void mockTransaction() { // generate ILP @Test public void checkIfIlpPacketIsNotNull() { - logger.debug("ILP Packet: {}", this.ilpPacket); + logger.info("ILP Packet: {}", this.ilpPacket); assert !ilpPacket.isEmpty(); } @@ -96,7 +96,7 @@ public void checkIfIlpPacketIsNotNull() { @Test public void secretNotNull() { assert ilpSecret != null; - logger.debug("Secret: {}", ilpSecret); + logger.info("Secret: {}", ilpSecret); } // get condition from ILP packet @@ -104,7 +104,7 @@ public void secretNotNull() { public void getConditionFromIlpPacket() throws IOException { String condition = ilpConditionHandler.generateCondition( this.ilpPacket, ilpSecret.getBytes()); - logger.debug("Condition is {}", condition); + logger.info("Condition is {}", condition); this.condition = condition; assert !condition.isEmpty(); } @@ -114,7 +114,7 @@ public void getConditionFromIlpPacket() throws IOException { public void getFulfillmentFromIlpPacket() throws IOException { String fulfillment = ilpConditionHandler.generateFulfillment( this.ilpPacket, ilpSecret.getBytes()); - logger.debug("Fulfillment is {}", condition); + logger.info("Fulfillment is {}", condition); this.fulfillment = fulfillment; assert !this.fulfillment.isEmpty(); } @@ -122,10 +122,10 @@ public void getFulfillmentFromIlpPacket() throws IOException { // extract transaction from ilpPacket @Test public void extractTxnFromIlpPacket() throws IOException { - logger.debug("Using ilppacket: {}", this.ilpPacket); + logger.info("Using ilppacket: {}", this.ilpPacket); Transaction transaction = ilpConditionHandler.getTransactionFromIlpPacket(this.ilpPacket); assert transaction != null; - logger.debug("Transaction extracted: {}", objectMapper.writeValueAsString(transaction)); + logger.info("Transaction extracted: {}", objectMapper.writeValueAsString(transaction)); } diff --git a/src/test/java/org/mifos/connector/mojaloop/QuoteTest.java b/src/test/java/org/mifos/connector/mojaloop/QuoteTest.java index 5503726..81375ef 100644 --- a/src/test/java/org/mifos/connector/mojaloop/QuoteTest.java +++ b/src/test/java/org/mifos/connector/mojaloop/QuoteTest.java @@ -23,7 +23,7 @@ public void testLocalQuoteDeserialization() throws IOException { String localQuoteResponseString = "{\"transactionCode\":\"cf1f9731-d248-4cc9-be4c-7937f2ed6c18\",\"quoteCode\":\"4c94ba50-3c6e-46b6-b1ae-1b89baa2b126\",\"state\":\"ACCEPTED\",\"fspFee\":{\"amount\":0,\"currency\":\"USD\"}}"; QuoteFspResponseDTO localQuoteResponse = objectMapper.readValue(localQuoteResponseString, QuoteFspResponseDTO.class); - logger.debug("local quote dto: {}", objectMapper.writeValueAsString(localQuoteResponse)); + logger.info("local quote dto: {}", objectMapper.writeValueAsString(localQuoteResponse)); } @Test @@ -31,6 +31,6 @@ public void testDateDeser() throws IOException { String json = "{}"; QuoteFspResponseDTO testDto = objectMapper.readValue(json, QuoteFspResponseDTO.class); - logger.debug("Test dto: {}", testDto); + logger.info("Test dto: {}", testDto); } }