From 49fd0a5c6533983d5aa0d1a2267727a24fd32a6f Mon Sep 17 00:00:00 2001 From: Dhruv Sonagara <78945411+dhruvsonagara@users.noreply.github.com> Date: Fri, 16 Feb 2024 19:03:34 +0530 Subject: [PATCH] [PHEE-588] Fix AMS failing test cases from AMS connector (#62) * Added logger for the balance API issue * fixed checkstyle errors * Updated the loggers * Reverted the unnscessary changes * Reverted the unnscessary changes * Checking the new log for body * Checking the new log for body * Checking the new log for body * Updated the tenant in bb property * Updated the loggers and tenants --- .circleci/config.yml | 2 +- .../connector/ams/interop/AmsCommonService.java | 2 ++ .../connector/ams/interop/AmsFinXService.java | 6 ++++++ .../ams/interop/InteroperationRouteBuilder.java | 1 + src/main/resources/application-bb.yml | 17 ++++++++++++++++- src/main/resources/application.yml | 4 +++- 6 files changed, 29 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 855d79ef..dbf05a77 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -55,7 +55,7 @@ jobs: name: Build Docker image command: | #Check for PR title Validity - + IMAGE_TAG=$CIRCLE_TAG ./gradlew checkstyleMain ./gradlew clean bootJar diff --git a/src/main/java/org/mifos/connector/ams/interop/AmsCommonService.java b/src/main/java/org/mifos/connector/ams/interop/AmsCommonService.java index 9361ee22..bd2848fa 100644 --- a/src/main/java/org/mifos/connector/ams/interop/AmsCommonService.java +++ b/src/main/java/org/mifos/connector/ams/interop/AmsCommonService.java @@ -76,6 +76,8 @@ public void getExternalAccount(Exchange e) { Map headers = new HashMap<>(); headers.put(CXF_TRACE_HEADER, true); headers.put(HTTP_METHOD, "GET"); + logger.debug(":{}", e.getProperty(PARTY_ID_TYPE, String.class)); + logger.debug(":{}", e.getProperty(PARTY_ID, String.class)); headers.put(HTTP_PATH, amsInteropPartiesPath.replace("{idType}", e.getProperty(PARTY_ID_TYPE, String.class)).replace("{idValue}", e.getProperty(PARTY_ID, String.class))); headers.putAll(tenantService.getHeaders(e.getProperty(TENANT_ID, String.class))); diff --git a/src/main/java/org/mifos/connector/ams/interop/AmsFinXService.java b/src/main/java/org/mifos/connector/ams/interop/AmsFinXService.java index ad5f6a40..57e22819 100644 --- a/src/main/java/org/mifos/connector/ams/interop/AmsFinXService.java +++ b/src/main/java/org/mifos/connector/ams/interop/AmsFinXService.java @@ -13,6 +13,8 @@ import org.apache.camel.Exchange; import org.mifos.connector.ams.camel.cxfrs.CxfrsUtil; import org.mifos.connector.ams.tenant.TenantService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; @@ -40,10 +42,14 @@ public class AmsFinXService extends AmsCommonService implements AmsService { @Autowired private CxfrsUtil cxfrsUtil; + private Logger logger = LoggerFactory.getLogger(this.getClass()); + public void getSavingsAccount(Exchange e) { Map headers = new HashMap<>(); headers.put(CXF_TRACE_HEADER, true); headers.put(HTTP_METHOD, "GET"); + logger.debug(":{}", amsInteropAccountsPath); + logger.debug(":{}", e.getProperty(EXTERNAL_ACCOUNT_ID, String.class)); headers.put(HTTP_PATH, amsInteropAccountsPath.replace("{externalAccountId}", e.getProperty(EXTERNAL_ACCOUNT_ID, String.class))); headers.putAll(tenantService.getHeaders(e.getProperty(TENANT_ID, String.class))); cxfrsUtil.sendInOut("cxfrs:bean:ams.local.interop", e, headers, null); diff --git a/src/main/java/org/mifos/connector/ams/interop/InteroperationRouteBuilder.java b/src/main/java/org/mifos/connector/ams/interop/InteroperationRouteBuilder.java index 457c6766..572a68e7 100644 --- a/src/main/java/org/mifos/connector/ams/interop/InteroperationRouteBuilder.java +++ b/src/main/java/org/mifos/connector/ams/interop/InteroperationRouteBuilder.java @@ -144,6 +144,7 @@ public void configure() { exchange.setProperty(IS_ERROR_SET_MANUALLY, true); } }).log("Response body from get-external-account").choice() + // check if http status code is <= 202 .when(e -> e.getIn().getHeader(Exchange.HTTP_RESPONSE_CODE, Integer.class) <= 202).unmarshal() .json(JsonLibrary.Jackson, PartyFspResponseDTO.class) diff --git a/src/main/resources/application-bb.yml b/src/main/resources/application-bb.yml index fb4c06b4..1592baad 100644 --- a/src/main/resources/application-bb.yml +++ b/src/main/resources/application-bb.yml @@ -14,7 +14,22 @@ ams: password: password authtype: basic fspId: payerfsp - - name: "lion" + - name: "wakanda" + user: mifos + password: password + authtype: basic + fspId: payerfsp + - name: "venus" + user: mifos + password: password + authtype: basic + fspId: payeefsp + - name: "jupiter" + user: mifos + password: password + authtype: basic + fspId: payeefsp + - name: "pluto" user: mifos password: password authtype: basic diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 49512284..90b1f643 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -50,6 +50,8 @@ server: contextPath: /fineract port: 7070 + + management: endpoint: health: @@ -58,4 +60,4 @@ management: liveness: enabled: true readiness: - enabled: true \ No newline at end of file + enabled: true