diff --git a/.circleci/config.yml b/.circleci/config.yml index aa89477fd..a09eea486 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,7 +5,7 @@ orbs: helm: circleci/helm@2.0.1 aws-eks: circleci/aws-eks@2.2.0 kubernetes: circleci/kubernetes@1.3 - mifos-orb: mifos/docker-image-availability-check-and-upgrade@1.0.2 + fynarfin-orb: fynarfin/docker-image-availability-check-and-upgrade@1.0.2 executors: docker-executor: docker: @@ -51,18 +51,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-integration-test/tags/$IMAGE_TAG" > /dev/null; then + if curl -s -f -u "$DOCKERHUB_USERNAME":"$DOCKERHUB_PASSWORD" "https://hub.docker.com/v2/repositories/fynarfin/ph-ee-integration-test/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-integration-test:$IMAGE_TAG" . + docker build -t "fynarfin/ph-ee-integration-test:$IMAGE_TAG" . # Push the Docker image to Docker Hub docker login -u "$DOCKERHUB_USERNAME" -p "$DOCKERHUB_PASSWORD" - docker push "openmf/ph-ee-integration-test:$IMAGE_TAG" + docker push "fynarfin/ph-ee-integration-test:$IMAGE_TAG" # when: always # The job will be executed even if there's no match for the tag filter @@ -84,13 +84,13 @@ jobs: ./gradlew checkstyleMain ./gradlew checkstyleTest ./gradlew bootJar - docker build -t openmf/ph-ee-integration-test:latest . - if [ "$CIRCLE_BRANCH" != "master" ]; then + docker build -t fynarfin/ph-ee-integration-test: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_PROJECT_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-integration-test:latest openmf/ph-ee-integration-test:$JIRA_STORY + docker image tag fynarfin/ph-ee-integration-test:latest fynarfin/ph-ee-integration-test:$JIRA_STORY fi # Log in to DockerHub using environment variables @@ -102,28 +102,28 @@ jobs: - run: name: Push Docker image to DockerHub command: | - if [ "$CIRCLE_BRANCH" = "master" ]; then - docker push openmf/ph-ee-integration-test:latest + if [ "$CIRCLE_BRANCH" = "develop" ]; then + docker push fynarfin/ph-ee-integration-test: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_PROJECT_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-integration-test:${JIRA_STORY} + docker push fynarfin/ph-ee-integration-test:${JIRA_STORY} fi docker-image-availability-check-and-upgrade: docker: - image: 'cimg/python:3.10' steps: - - mifos-orb/docker-image-availability-check-and-upgrade: + - fynarfin-orb/docker-image-availability-check-and-upgrade: namespace: paymenthub - chart-base-url: https://fynarfin.io/images + chart-base-url: https://fynarfin.io/images/fynarfin chart-name: ph-ee-g2psandbox-fynarfin chart-version: 0.2.0 release-name: g2p-sandbox cluster-name: "sit" aws-region: "$REGION" - service-file-path: https://raw.githubusercontent.com/openMF/ph-ee-env-labs/master/.circleci/services.txt + service-file-path: https://raw.githubusercontent.com/fynarfin/ph-ee-env-labs/develop/.circleci/services.txt create-tls-secret-paymenthub-namespace: docker: @@ -158,7 +158,7 @@ jobs: - setup_remote_docker: version: 20.10.14 - kubernetes/install-kubectl - - run: git clone https://github.com/openmf/ph-ee-env-labs + - run: git clone https://github.com/fynarfin/ph-ee-env-labs - aws-eks/update-kubeconfig-with-authenticator: cluster-name: "sit" aws-region: "$REGION" @@ -187,7 +187,7 @@ jobs: docker: - image: 'cimg/base:2022.06' steps: - - run: git clone https://github.com/openmf/ph-ee-env-labs + - run: git clone https://github.com/fynarfin/ph-ee-env-labs - run: echo $AWS_PROFILE - run: echo $AWS_DEFAULT_PROFILE - run: | @@ -202,7 +202,7 @@ jobs: - image: cimg/openjdk:17.0.0-node steps: - checkout - #- run: git clone https://github.com/openmf/ph-ee-integration-test + #- run: git clone https://github.com/fynarfin/ph-ee-integration-test - run: name: Ngrok setup command: curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null && echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | sudo tee /etc/apt/sources.list.d/ngrok.list && sudo apt update && sudo apt install ngrok @@ -231,15 +231,54 @@ jobs: echo -n "Test execution is completed, kill ngrok" pkill ngrok - store_test_results: - path: build/test-results/test/TEST-org.mifos.integrationtest.TestRunner.xml + path: build/test-results/test/TEST-org.fynarfin.integrationtest.TestRunner.xml - store_artifacts: path: build/test-results + + test-chart-e2e: + docker: + - image: cimg/openjdk:17.0.0-node + steps: + - checkout + #- run: git clone https://github.com/fynarfin/ph-ee-integration-test + - run: + name: Ngrok setup + command: curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null && echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | sudo tee /etc/apt/sources.list.d/ngrok.list && sudo apt update && sudo apt install ngrok + - run: + name: Test execution + no_output_timeout: 30m + command: | + ngrok config add-authtoken $AUTH_TOKEN + echo "web_addr: $LOCAL_PORT" >> /home/circleci/.config/ngrok/ngrok.yml + ngrok http 53013 > /dev/null & + echo -n "Extracting ngrok public url ." + NGROK_PUBLIC_URL="" + while [ -z "$NGROK_PUBLIC_URL" ]; do + # Run 'curl' against ngrok API and extract public (using 'sed' command) + export NGROK_PUBLIC_URL=$(curl --silent --max-time 10 --connect-timeout 5 \ + --show-error http://127.0.0.1:$LOCAL_PORT/api/tunnels | \ + sed -nE 's/.*public_url":"https:..([^"]*).*/\1/p') + sleep 1 + echo -n "." + done + + export CALLBACK_URL="https://$NGROK_PUBLIC_URL" + echo -n "Public url ." + echo $CALLBACK_URL + ./gradlew test -Dcucumber.filter.tags="@e2e" + echo -n "Test execution is completed, kill ngrok" + pkill ngrok + - store_test_results: + path: build/test-results/test/TEST-org.fynarfin.integrationtest.TestRunner.xml + - store_artifacts: + path: build/test-results + test-chart-ams: docker: - image: cimg/openjdk:17.0.0 steps: - checkout - #- run: git clone https://github.com/openmf/ph-ee-integration-test + #- run: git clone https://github.com/fynarfin/ph-ee-integration-test - run: name: Ngrok setup command: curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null && echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | sudo tee /etc/apt/sources.list.d/ngrok.list && sudo apt update && sudo apt install ngrok @@ -268,7 +307,7 @@ jobs: echo -n "Test execution is completed, kill ngrok" pkill ngrok - store_test_results: - path: build/test-results/test/TEST-org.mifos.integrationtest.TestRunner.xml + path: build/test-results/test/TEST-org.fynarfin.integrationtest.TestRunner.xml - store_artifacts: path: build/test-results workflows: @@ -317,7 +356,7 @@ workflows: - AWS - Helm - slack - - test-chart-ams: + - test-chart-e2e: requires: - deploying-bpmns context: @@ -325,6 +364,14 @@ workflows: - Helm - slack - Ngrok + - test-chart-ams: + requires: + - test-chart-e2e + context: + - AWS + - Helm + - slack + - Ngrok - test-chart-gov: requires: - test-chart-ams diff --git a/.github/workflows/jit-security.yml b/.github/workflows/jit-security.yml index d3babba2a..35081f292 100644 --- a/.github/workflows/jit-security.yml +++ b/.github/workflows/jit-security.yml @@ -21,7 +21,7 @@ jobs: uses: jitsecurity-controls/jit-github-action@v4.2.2 with: security_control: registry.jit.io/control-trivy-alpine:latest - + enrich: if: fromJSON(github.event.inputs.client_payload).payload.workflow_job_name == 'enrich' && fromJSON(github.event.inputs.client_payload).payload.workflow_slug == 'workflow-enrichment-code' runs-on: ubuntu-22.04 @@ -31,7 +31,7 @@ jobs: uses: jitsecurity-controls/jit-github-action@v4.2.2 with: security_control: registry.jit.io/control-enrichment-slim:latest - + iac-misconfig-detection-kubernetes: if: fromJSON(github.event.inputs.client_payload).payload.workflow_job_name == 'iac-misconfig-detection-kubernetes' && fromJSON(github.event.inputs.client_payload).payload.workflow_slug == 'workflow-kubernetes-iac-misconfiguration-detection' runs-on: ubuntu-22.04 @@ -41,7 +41,7 @@ jobs: uses: jitsecurity-controls/jit-github-action@v4.2.2 with: security_control: registry.jit.io/control-kubescape-slim:latest - + remediation-pr: if: fromJSON(github.event.inputs.client_payload).payload.workflow_job_name == 'remediation-pr' && fromJSON(github.event.inputs.client_payload).payload.workflow_slug == 'workflow-remediation-pr' runs-on: ubuntu-22.04 @@ -51,7 +51,7 @@ jobs: uses: jitsecurity-controls/jit-github-action@v4.2.2 with: security_control: registry.jit.io/open-remediation-pr-alpine:latest - + secret-detection: if: fromJSON(github.event.inputs.client_payload).payload.workflow_job_name == 'secret-detection' && fromJSON(github.event.inputs.client_payload).payload.workflow_slug == 'workflow-secret-detection' runs-on: ubuntu-22.04 @@ -61,7 +61,7 @@ jobs: uses: jitsecurity-controls/jit-github-action@v4.2.2 with: security_control: registry.jit.io/control-gitleaks-alpine:latest - + software-bill-of-materials: if: fromJSON(github.event.inputs.client_payload).payload.workflow_job_name == 'software-bill-of-materials' && fromJSON(github.event.inputs.client_payload).payload.workflow_slug == 'workflow-sbom' runs-on: ubuntu-22.04 @@ -72,7 +72,7 @@ jobs: with: security_control: registry.jit.io/control-syft-alpine:latest fail_if_cannot_checkout: false - + software-component-analysis-elixir: if: fromJSON(github.event.inputs.client_payload).payload.workflow_job_name == 'software-component-analysis-elixir' && fromJSON(github.event.inputs.client_payload).payload.workflow_slug == 'workflow-sca' runs-on: ubuntu-22.04 @@ -82,7 +82,7 @@ jobs: uses: jitsecurity-controls/jit-github-action@v4.2.2 with: security_control: registry.jit.io/control-osv-scanner-alpine:latest - + software-component-analysis-go: if: fromJSON(github.event.inputs.client_payload).payload.workflow_job_name == 'software-component-analysis-go' && fromJSON(github.event.inputs.client_payload).payload.workflow_slug == 'workflow-sca' runs-on: ubuntu-22.04 @@ -92,7 +92,7 @@ jobs: uses: jitsecurity-controls/jit-github-action@v4.2.2 with: security_control: registry.jit.io/control-nancy-alpine:latest - + software-component-analysis-gradle: if: fromJSON(github.event.inputs.client_payload).payload.workflow_job_name == 'software-component-analysis-gradle' && fromJSON(github.event.inputs.client_payload).payload.workflow_slug == 'workflow-sca' runs-on: ubuntu-22.04 @@ -102,7 +102,7 @@ jobs: uses: jitsecurity-controls/jit-github-action@v4.2.2 with: security_control: registry.jit.io/control-jit-gradle-scanner:latest - + software-component-analysis-java: if: fromJSON(github.event.inputs.client_payload).payload.workflow_job_name == 'software-component-analysis-java' && fromJSON(github.event.inputs.client_payload).payload.workflow_slug == 'workflow-sca' runs-on: ubuntu-22.04 @@ -112,7 +112,7 @@ jobs: uses: jitsecurity-controls/jit-github-action@v4.2.2 with: security_control: registry.jit.io/control-osv-scanner-alpine:latest - + software-component-analysis-js: if: fromJSON(github.event.inputs.client_payload).payload.workflow_job_name == 'software-component-analysis-js' && fromJSON(github.event.inputs.client_payload).payload.workflow_slug == 'workflow-sca' runs-on: ubuntu-22.04 @@ -122,7 +122,7 @@ jobs: uses: jitsecurity-controls/jit-github-action@v4.2.2 with: security_control: registry.jit.io/control-npm-audit-slim:latest - + software-component-analysis-php: if: fromJSON(github.event.inputs.client_payload).payload.workflow_job_name == 'software-component-analysis-php' && fromJSON(github.event.inputs.client_payload).payload.workflow_slug == 'workflow-sca' runs-on: ubuntu-22.04 @@ -132,7 +132,7 @@ jobs: uses: jitsecurity-controls/jit-github-action@v4.2.2 with: security_control: registry.jit.io/control-osv-scanner-alpine:latest - + software-component-analysis-poetry: if: fromJSON(github.event.inputs.client_payload).payload.workflow_job_name == 'software-component-analysis-poetry' && fromJSON(github.event.inputs.client_payload).payload.workflow_slug == 'workflow-sca' runs-on: ubuntu-22.04 @@ -142,7 +142,7 @@ jobs: uses: jitsecurity-controls/jit-github-action@v4.2.2 with: security_control: registry.jit.io/control-osv-scanner-alpine:latest - + software-component-analysis-python: if: fromJSON(github.event.inputs.client_payload).payload.workflow_job_name == 'software-component-analysis-python' && fromJSON(github.event.inputs.client_payload).payload.workflow_slug == 'workflow-sca' runs-on: ubuntu-22.04 @@ -152,7 +152,7 @@ jobs: uses: jitsecurity-controls/jit-github-action@v4.2.2 with: security_control: registry.jit.io/control-osv-scanner-alpine:latest - + software-component-analysis-trivy-csharp: if: fromJSON(github.event.inputs.client_payload).payload.workflow_job_name == 'software-component-analysis-trivy-csharp' && fromJSON(github.event.inputs.client_payload).payload.workflow_slug == 'workflow-sca' runs-on: ubuntu-22.04 @@ -162,7 +162,7 @@ jobs: uses: jitsecurity-controls/jit-github-action@v4.2.2 with: security_control: registry.jit.io/control-trivy-dotnet-slim:latest - + static-code-analysis-c-cpp: if: fromJSON(github.event.inputs.client_payload).payload.workflow_job_name == 'static-code-analysis-c-cpp' && fromJSON(github.event.inputs.client_payload).payload.workflow_slug == 'workflow-sast' runs-on: ubuntu-22.04 @@ -172,7 +172,7 @@ jobs: uses: jitsecurity-controls/jit-github-action@v4.2.2 with: security_control: registry.jit.io/control-semgrep-alpine:latest - + static-code-analysis-csharp: if: fromJSON(github.event.inputs.client_payload).payload.workflow_job_name == 'static-code-analysis-csharp' && fromJSON(github.event.inputs.client_payload).payload.workflow_slug == 'workflow-sast' runs-on: ubuntu-22.04 @@ -182,7 +182,7 @@ jobs: uses: jitsecurity-controls/jit-github-action@v4.2.2 with: security_control: registry.jit.io/control-semgrep-alpine:latest - + static-code-analysis-go: if: fromJSON(github.event.inputs.client_payload).payload.workflow_job_name == 'static-code-analysis-go' && fromJSON(github.event.inputs.client_payload).payload.workflow_slug == 'workflow-sast' runs-on: ubuntu-22.04 @@ -192,7 +192,7 @@ jobs: uses: jitsecurity-controls/jit-github-action@v4.2.2 with: security_control: registry.jit.io/control-gosec-alpine:latest - + static-code-analysis-java: if: fromJSON(github.event.inputs.client_payload).payload.workflow_job_name == 'static-code-analysis-java' && fromJSON(github.event.inputs.client_payload).payload.workflow_slug == 'workflow-sast' runs-on: ubuntu-22.04 @@ -202,7 +202,7 @@ jobs: uses: jitsecurity-controls/jit-github-action@v4.2.2 with: security_control: registry.jit.io/control-semgrep-alpine:latest - + static-code-analysis-js: if: fromJSON(github.event.inputs.client_payload).payload.workflow_job_name == 'static-code-analysis-js' && fromJSON(github.event.inputs.client_payload).payload.workflow_slug == 'workflow-sast' runs-on: ubuntu-22.04 @@ -212,7 +212,7 @@ jobs: uses: jitsecurity-controls/jit-github-action@v4.2.2 with: security_control: registry.jit.io/control-semgrep-alpine:latest - + static-code-analysis-kotlin: if: fromJSON(github.event.inputs.client_payload).payload.workflow_job_name == 'static-code-analysis-kotlin' && fromJSON(github.event.inputs.client_payload).payload.workflow_slug == 'workflow-sast' runs-on: ubuntu-22.04 @@ -222,7 +222,7 @@ jobs: uses: jitsecurity-controls/jit-github-action@v4.2.2 with: security_control: registry.jit.io/control-semgrep-alpine:latest - + static-code-analysis-php: if: fromJSON(github.event.inputs.client_payload).payload.workflow_job_name == 'static-code-analysis-php' && fromJSON(github.event.inputs.client_payload).payload.workflow_slug == 'workflow-sast' runs-on: ubuntu-22.04 @@ -232,7 +232,7 @@ jobs: uses: jitsecurity-controls/jit-github-action@v4.2.2 with: security_control: registry.jit.io/control-semgrep-alpine:latest - + static-code-analysis-python-semgrep: if: fromJSON(github.event.inputs.client_payload).payload.workflow_job_name == 'static-code-analysis-python-semgrep' && fromJSON(github.event.inputs.client_payload).payload.workflow_slug == 'workflow-sast' runs-on: ubuntu-22.04 @@ -242,7 +242,7 @@ jobs: uses: jitsecurity-controls/jit-github-action@v4.2.2 with: security_control: registry.jit.io/control-semgrep-alpine:latest - + static-code-analysis-ruby: if: fromJSON(github.event.inputs.client_payload).payload.workflow_job_name == 'static-code-analysis-ruby' && fromJSON(github.event.inputs.client_payload).payload.workflow_slug == 'workflow-sast' runs-on: ubuntu-22.04 @@ -252,7 +252,7 @@ jobs: uses: jitsecurity-controls/jit-github-action@v4.2.2 with: security_control: registry.jit.io/control-semgrep-alpine:latest - + static-code-analysis-rust: if: fromJSON(github.event.inputs.client_payload).payload.workflow_job_name == 'static-code-analysis-rust' && fromJSON(github.event.inputs.client_payload).payload.workflow_slug == 'workflow-sast' runs-on: ubuntu-22.04 @@ -262,7 +262,7 @@ jobs: uses: jitsecurity-controls/jit-github-action@v4.2.2 with: security_control: registry.jit.io/control-semgrep-alpine:latest - + static-code-analysis-scala: if: fromJSON(github.event.inputs.client_payload).payload.workflow_job_name == 'static-code-analysis-scala' && fromJSON(github.event.inputs.client_payload).payload.workflow_slug == 'workflow-sast' runs-on: ubuntu-22.04 @@ -272,7 +272,7 @@ jobs: uses: jitsecurity-controls/jit-github-action@v4.2.2 with: security_control: registry.jit.io/control-semgrep-alpine:latest - + static-code-analysis-swift: if: fromJSON(github.event.inputs.client_payload).payload.workflow_job_name == 'static-code-analysis-swift' && fromJSON(github.event.inputs.client_payload).payload.workflow_slug == 'workflow-sast' runs-on: ubuntu-22.04 @@ -282,4 +282,3 @@ jobs: uses: jitsecurity-controls/jit-github-action@v4.2.2 with: security_control: registry.jit.io/control-semgrep-alpine:latest - \ No newline at end of file diff --git a/.jit/jit-integration.yml b/.jit/jit-integration.yml index e69de29bb..8b1378917 100644 --- a/.jit/jit-integration.yml +++ b/.jit/jit-integration.yml @@ -0,0 +1 @@ + diff --git a/build.gradle b/build.gradle index dfdc50234..953ade48b 100644 --- a/build.gradle +++ b/build.gradle @@ -166,7 +166,7 @@ dependencies { checkstyle 'com.github.sevntu-checkstyle:sevntu-checks:1.44.1' implementation 'com.diffplug.gradle.spotless:spotless:2.4.1' implementation 'com.diffplug.spotless:spotless-plugin-gradle:6.17.0' - implementation 'org.mifos:openapi-java-client:2.0.3-SNAPSHOT' + implementation 'org.mifos:openapi-java-client:2.0.4-SNAPSHOT' testImplementation 'org.hamcrest:hamcrest:2.2' implementation 'com.opencsv:opencsv:5.5.2' testImplementation 'org.apache.commons:commons-csv:1.5' diff --git a/src/main/java/org/mifos/integrationtest/config/MojaloopConfig.java b/src/main/java/org/mifos/integrationtest/config/MojaloopConfig.java index 129912a84..61dd4b77a 100644 --- a/src/main/java/org/mifos/integrationtest/config/MojaloopConfig.java +++ b/src/main/java/org/mifos/integrationtest/config/MojaloopConfig.java @@ -42,9 +42,15 @@ public class MojaloopConfig { @Value("${mojaloop.fspid.payer}") public String payerFspId; - @Value("${mojaloop.fspid.payee}") + @Value("${mojaloop.fspid.payee1}") public String payeeFspId; + @Value("${mojaloop.fspid.payee2}") + public String payeeFspId2; + + @Value("${mojaloop.fspid.payee3}") + public String payeeFspId3; + @Value("${ml-connector.host}") public String mlConnectorHost; diff --git a/src/main/java/org/mifos/integrationtest/config/PayerFundTransferConfig.java b/src/main/java/org/mifos/integrationtest/config/PayerFundTransferConfig.java index 353670ce6..f8965c5de 100644 --- a/src/main/java/org/mifos/integrationtest/config/PayerFundTransferConfig.java +++ b/src/main/java/org/mifos/integrationtest/config/PayerFundTransferConfig.java @@ -9,9 +9,15 @@ public class PayerFundTransferConfig { @Value("${payerFundTransfer.tenant.payer}") public String payerTenant; - @Value("${payerFundTransfer.tenant.payee}") + @Value("${payerFundTransfer.tenant.payee1}") public String payeeTenant; + @Value("${payerFundTransfer.tenant.payee2}") + public String payeeTenant2; + + @Value("${payerFundTransfer.tenant.payee3}") + public String payeeTenant3; + @Value("${savings.base-url}") public String clientBaseUrl; @Value("${savings.endpoints.client-endpoint}") diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index cb7987fb7..75fa22ab5 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -186,12 +186,16 @@ config: payerFundTransfer: tenant: payer: "wakanda" - payee: "jupiter" + payee1: "jupiter" + payee2: "pluto" + payee3: "venus" mojaloop: fspid: payer: "payerfsp" - payee: "payeefsp" + payee1: "payeefsp" + payee2: "payeefsp2" + payee3: "payeefsp3" contactpoint: http://account-lookup-service.sandbox.fynarfin.io central-ledger-contactpoint: http://central-ledger.sandbox.fynarfin.io account-lookup-admin-contactpoint: http://account-lookup-service-admin.sandbox.fynarfin.io @@ -263,9 +267,9 @@ tenantconfig: fspconfig: payeefsp: - payeefsp1: "pluto" - payeefsp2: "venus" - payeefsp3: "jupiter" + payeefsp1: "jupiter" + payeefsp2: "pluto" + payeefsp3: "venus" payerfsp: payerfsp1: "wakanda" payerfsp2: "gorilla" diff --git a/src/test/java/org/mifos/integrationtest/common/CollectionHelper.java b/src/test/java/org/mifos/integrationtest/common/CollectionHelper.java index 6da79a960..f24674752 100644 --- a/src/test/java/org/mifos/integrationtest/common/CollectionHelper.java +++ b/src/test/java/org/mifos/integrationtest/common/CollectionHelper.java @@ -8,7 +8,7 @@ /** * { "payer": [ { "key": "MSISDN", "value": "254708374149" }, { "key": "ACCOUNTID", "value": "24450523" } ], "amount": { - * "amount": "1", "currency": "USD" }, "transactionType": { "scenario": "MPESA", "subScenario": "BUYGOODS", "initiator": + * "amount": "1", "currency": "TZS" }, "transactionType": { "scenario": "MPESA", "subScenario": "BUYGOODS", "initiator": * "PAYEE", "initiatorType": "BUSINESS" } } */ public final class CollectionHelper { @@ -60,7 +60,7 @@ private static JSONObject getPayerObject(String key, String value) throws JSONEx private static JSONObject getAmountObject(String amount) throws JSONException { JSONObject amountObject = new JSONObject(); - amountObject.put("currency", "USD"); + amountObject.put("currency", "TZS"); amountObject.put("amount", amount); return amountObject; } diff --git a/src/test/java/org/mifos/integrationtest/common/TransferHelper.java b/src/test/java/org/mifos/integrationtest/common/TransferHelper.java index 30d9211bd..d340e387a 100644 --- a/src/test/java/org/mifos/integrationtest/common/TransferHelper.java +++ b/src/test/java/org/mifos/integrationtest/common/TransferHelper.java @@ -47,7 +47,7 @@ private static JSONObject getPartyObject(String value) throws JSONException { private static JSONObject getAmountObject(String amount) throws JSONException { JSONObject amountObject = new JSONObject(); - amountObject.put("currency", "USD"); + amountObject.put("currency", "TZS"); amountObject.put("amount", amount); return amountObject; } diff --git a/src/test/java/org/mifos/integrationtest/cucumber/stepdef/BaseStepDef.java b/src/test/java/org/mifos/integrationtest/cucumber/stepdef/BaseStepDef.java index c00b55eb1..d2e6923f6 100644 --- a/src/test/java/org/mifos/integrationtest/cucumber/stepdef/BaseStepDef.java +++ b/src/test/java/org/mifos/integrationtest/cucumber/stepdef/BaseStepDef.java @@ -4,6 +4,9 @@ import io.cucumber.core.internal.com.fasterxml.jackson.databind.ObjectMapper; import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.security.cert.X509Certificate; @@ -103,9 +106,25 @@ protected String generateSignature(String clientCorrelationId, String tenant, St throws IOException, NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, BadPaddingException, InvalidKeySpecException, InvalidKeyException { + String filePathOrData = isDataAFile ? Utils.getAbsoluteFilePathToResource(scenarioScopeState.filename) : data; + + // Debug statements to check the values + System.out.println("Client Correlation ID: " + clientCorrelationId); + System.out.println("Tenant: " + tenant); + System.out.println("Is Data A File: " + isDataAFile); + System.out.println("Data or File Path: " + filePathOrData); + + // Read file content if it's a file + if (isDataAFile) { + String fileContent = new String(Files.readAllBytes(Paths.get(filePathOrData)), StandardCharsets.UTF_8); + System.out.println("File Content: " + fileContent); + } + JsonWebSignature jsonWebSignature = new JsonWebSignature.JsonWebSignatureBuilder().setClientCorrelationId(clientCorrelationId) - .setTenantId(tenant).setIsDataAsFile(isDataAFile) - .setData(isDataAFile ? Utils.getAbsoluteFilePathToResource(scenarioScopeState.filename) : data).build(); + .setTenantId(tenant).setIsDataAsFile(isDataAFile).setData(filePathOrData).build(); + + // More debug statements + System.out.println("Generated JsonWebSignature Object: " + jsonWebSignature); return jsonWebSignature.getSignature(scenarioScopeState.privateKeyString); } diff --git a/src/test/java/org/mifos/integrationtest/cucumber/stepdef/BatchApiStepDef.java b/src/test/java/org/mifos/integrationtest/cucumber/stepdef/BatchApiStepDef.java index 5b6296d53..c5ffce079 100644 --- a/src/test/java/org/mifos/integrationtest/cucumber/stepdef/BatchApiStepDef.java +++ b/src/test/java/org/mifos/integrationtest/cucumber/stepdef/BatchApiStepDef.java @@ -311,7 +311,6 @@ public void callBatchTransactionsEndpoint(int expectedStatus) { RequestSpecification requestSpec = Utils.getDefaultSpec(scenarioScopeState.tenant, scenarioScopeState.clientCorrelationId); requestSpec.header(HEADER_PURPOSE, "Integartion test"); requestSpec.header(HEADER_FILENAME, scenarioScopeState.filename); - requestSpec.header(HEADER_REGISTERING_INSTITUTE_ID, "SocialWelfare"); requestSpec.queryParam(QUERY_PARAM_TYPE, "CSV"); requestSpec.header(QUERY_PARAM_TYPE, "CSV"); if (scenarioScopeState.signature != null && !scenarioScopeState.signature.isEmpty()) { @@ -554,7 +553,7 @@ public void batchTearDown() { public BatchRequestDTO mockBatchTransactionRequestDTO(String paymentMode) { BatchRequestDTO batchRequestDTO = new BatchRequestDTO(); batchRequestDTO.setAmount("100"); - batchRequestDTO.setCurrency("USD"); + batchRequestDTO.setCurrency("TZS"); batchRequestDTO.setPaymentMode(paymentMode); batchRequestDTO.setDescriptionText("Integration test"); batchRequestDTO.setRequestId(UUID.randomUUID().toString()); diff --git a/src/test/java/org/mifos/integrationtest/cucumber/stepdef/ErrorCodeStepDef.java b/src/test/java/org/mifos/integrationtest/cucumber/stepdef/ErrorCodeStepDef.java index b33f8d4c6..53db33988 100644 --- a/src/test/java/org/mifos/integrationtest/cucumber/stepdef/ErrorCodeStepDef.java +++ b/src/test/java/org/mifos/integrationtest/cucumber/stepdef/ErrorCodeStepDef.java @@ -176,20 +176,20 @@ public void iShouldBeAbleToParseErrorCodeFromGSMATransferResponse(String errorCo @Given("I can create GSMATransferDTO with missing currency details") public void iCanCreateGSMATransactionDTOWithMissingCurrency() { GSMATransferHelper gsmaTransferHelper = new GSMATransferHelper(); - Fee fee = gsmaTransferHelper.feeHelper("11", "USD", "string"); + Fee fee = gsmaTransferHelper.feeHelper("11", "TZS", "string"); GsmaParty debitParty = gsmaTransferHelper.gsmaPartyHelper("msisdn", "449999999"); GsmaParty creditParty = gsmaTransferHelper.gsmaPartyHelper("msisdn", "+449999112"); - InternationalTransferInformation internationalTransferInformation = gsmaTransferHelper - .internationalTransferInformationHelper("string", "string", "directtoaccount", "USA", "USA", "USA", "USA"); - IdDocument idDocument = gsmaTransferHelper.idDocumentHelper("passport", "string", "USA", "2022-09-28T12:51:19.260+00:00", + InternationalTransferInformation internationalTransferInformation = gsmaTransferHelper.internationalTransferInformationHelper( + "string", "string", "directtoaccount", "Tanzania", "Tanzania", "Tanzania", "Tanzania"); + IdDocument idDocument = gsmaTransferHelper.idDocumentHelper("passport", "string", "Tanzania", "2022-09-28T12:51:19.260+00:00", "2022-09-28T12:51:19.260+00:00", "string", "string"); - PostalAddress postalAddress = gsmaTransferHelper.postalAddressHelper("string", "string", "string", "string", "USA", "string", + PostalAddress postalAddress = gsmaTransferHelper.postalAddressHelper("string", "string", "string", "string", "Tanzania", "string", "string"); SubjectName subjectName = gsmaTransferHelper.subjectNameHelper("string", "string", "string", "string", "string"); - Kyc senderKyc = gsmaTransferHelper.kycHelper("USA", "2000-11-20", "string", "string", "string", 'm', idDocument, "USA", "string", - postalAddress, subjectName); - Kyc receiverKyc = gsmaTransferHelper.kycHelper("USA", "2000-11-20", "string", "string", "string", 'm', idDocument, "USA", "string", - postalAddress, subjectName); + Kyc senderKyc = gsmaTransferHelper.kycHelper("Tanzania", "2000-11-20", "string", "string", "string", 'm', idDocument, "Tanzania", + "string", postalAddress, subjectName); + Kyc receiverKyc = gsmaTransferHelper.kycHelper("Tanzania", "2000-11-20", "string", "string", "string", 'm', idDocument, "Tanzania", + "string", postalAddress, subjectName); try { gsmaTransaction = gsmaTransferHelper.gsmaTransactionRequestBodyHelper("11", debitParty, creditParty, "", "string", "string", "string", "transfer", "string", fee, "37.423825,-122.082900", internationalTransferInformation, "string", receiverKyc, @@ -202,22 +202,22 @@ public void iCanCreateGSMATransactionDTOWithMissingCurrency() { @Given("I can create GSMATransferDTO with same payer and payee") public void iCanCreateGSMATransactionDTOWithSamePayerAndPayee() { GSMATransferHelper gsmaTransferHelper = new GSMATransferHelper(); - Fee fee = gsmaTransferHelper.feeHelper("11", "USD", "string"); + Fee fee = gsmaTransferHelper.feeHelper("11", "TZS", "string"); GsmaParty debitParty = gsmaTransferHelper.gsmaPartyHelper("msisdn", "+449999112"); GsmaParty creditParty = gsmaTransferHelper.gsmaPartyHelper("msisdn", "+449999112"); - InternationalTransferInformation internationalTransferInformation = gsmaTransferHelper - .internationalTransferInformationHelper("string", "string", "directtoaccount", "USA", "USA", "USA", "USA"); - IdDocument idDocument = gsmaTransferHelper.idDocumentHelper("passport", "string", "USA", "2022-09-28T12:51:19.260+00:00", + InternationalTransferInformation internationalTransferInformation = gsmaTransferHelper.internationalTransferInformationHelper( + "string", "string", "directtoaccount", "Tanzania", "Tanzania", "Tanzania", "Tanzania"); + IdDocument idDocument = gsmaTransferHelper.idDocumentHelper("passport", "string", "Tanzania", "2022-09-28T12:51:19.260+00:00", "2022-09-28T12:51:19.260+00:00", "string", "string"); - PostalAddress postalAddress = gsmaTransferHelper.postalAddressHelper("string", "string", "string", "string", "USA", "string", + PostalAddress postalAddress = gsmaTransferHelper.postalAddressHelper("string", "string", "string", "string", "Tanzania", "string", "string"); SubjectName subjectName = gsmaTransferHelper.subjectNameHelper("string", "string", "string", "string", "string"); - Kyc senderKyc = gsmaTransferHelper.kycHelper("USA", "2000-11-20", "string", "string", "string", 'm', idDocument, "USA", "string", - postalAddress, subjectName); - Kyc receiverKyc = gsmaTransferHelper.kycHelper("USA", "2000-11-20", "string", "string", "string", 'm', idDocument, "USA", "string", - postalAddress, subjectName); + Kyc senderKyc = gsmaTransferHelper.kycHelper("Tanzania", "2000-11-20", "string", "string", "string", 'm', idDocument, "Tanzania", + "string", postalAddress, subjectName); + Kyc receiverKyc = gsmaTransferHelper.kycHelper("Tanzania", "2000-11-20", "string", "string", "string", 'm', idDocument, "Tanzania", + "string", postalAddress, subjectName); try { - gsmaTransaction = gsmaTransferHelper.gsmaTransactionRequestBodyHelper("11", debitParty, creditParty, "USD", "string", "string", + gsmaTransaction = gsmaTransferHelper.gsmaTransactionRequestBodyHelper("11", debitParty, creditParty, "TZS", "string", "string", "string", "transfer", "string", fee, "37.423825,-122.082900", internationalTransferInformation, "string", receiverKyc, senderKyc, "string", "2023-01-12T12:51:19.260+00:00"); } catch (JSONException e) { @@ -228,22 +228,22 @@ public void iCanCreateGSMATransactionDTOWithSamePayerAndPayee() { @Given("I can create GSMATransferDTO with Negative Amount") public void iCanCreateGSMATransactionDTOWithNegativeAmount() { GSMATransferHelper gsmaTransferHelper = new GSMATransferHelper(); - Fee fee = gsmaTransferHelper.feeHelper("11", "USD", "string"); + Fee fee = gsmaTransferHelper.feeHelper("11", "TZS", "string"); GsmaParty debitParty = gsmaTransferHelper.gsmaPartyHelper("msisdn", "+449999999"); GsmaParty creditParty = gsmaTransferHelper.gsmaPartyHelper("msisdn", "+449999112"); - InternationalTransferInformation internationalTransferInformation = gsmaTransferHelper - .internationalTransferInformationHelper("string", "string", "directtoaccount", "USA", "USA", "USA", "USA"); - IdDocument idDocument = gsmaTransferHelper.idDocumentHelper("passport", "string", "USA", "2022-09-28T12:51:19.260+00:00", + InternationalTransferInformation internationalTransferInformation = gsmaTransferHelper.internationalTransferInformationHelper( + "string", "string", "directtoaccount", "Tanzania", "Tanzania", "Tanzania", "Tanzania"); + IdDocument idDocument = gsmaTransferHelper.idDocumentHelper("passport", "string", "Tanzania", "2022-09-28T12:51:19.260+00:00", "2022-09-28T12:51:19.260+00:00", "string", "string"); - PostalAddress postalAddress = gsmaTransferHelper.postalAddressHelper("string", "string", "string", "string", "USA", "string", + PostalAddress postalAddress = gsmaTransferHelper.postalAddressHelper("string", "string", "string", "string", "Tanzania", "string", "string"); SubjectName subjectName = gsmaTransferHelper.subjectNameHelper("string", "string", "string", "string", "string"); - Kyc senderKyc = gsmaTransferHelper.kycHelper("USA", "2000-11-20", "string", "string", "string", 'm', idDocument, "USA", "string", - postalAddress, subjectName); - Kyc receiverKyc = gsmaTransferHelper.kycHelper("USA", "2000-11-20", "string", "string", "string", 'm', idDocument, "USA", "string", - postalAddress, subjectName); + Kyc senderKyc = gsmaTransferHelper.kycHelper("Tanzania", "2000-11-20", "string", "string", "string", 'm', idDocument, "Tanzania", + "string", postalAddress, subjectName); + Kyc receiverKyc = gsmaTransferHelper.kycHelper("Tanzania", "2000-11-20", "string", "string", "string", 'm', idDocument, "Tanzania", + "string", postalAddress, subjectName); try { - gsmaTransaction = gsmaTransferHelper.gsmaTransactionRequestBodyHelper("-11", debitParty, creditParty, "USD", "string", "string", + gsmaTransaction = gsmaTransferHelper.gsmaTransactionRequestBodyHelper("-11", debitParty, creditParty, "TZS", "string", "string", "string", "transfer", "string", fee, "37.423825,-122.082900", internationalTransferInformation, "string", receiverKyc, senderKyc, "string", "2023-01-12T12:51:19.260+00:00"); } catch (JSONException e) { @@ -255,22 +255,22 @@ public void iCanCreateGSMATransactionDTOWithNegativeAmount() { @Given("I can create GSMATransferDTO with invalid amount format") public void iCanCreateGSMATransactionDTOWithInvalidAmountFormat() { GSMATransferHelper gsmaTransferHelper = new GSMATransferHelper(); - Fee fee = gsmaTransferHelper.feeHelper("11", "USD", "string"); + Fee fee = gsmaTransferHelper.feeHelper("11", "TZS", "string"); GsmaParty debitParty = gsmaTransferHelper.gsmaPartyHelper("msisdn", "449999999"); GsmaParty creditParty = gsmaTransferHelper.gsmaPartyHelper("msisdn", "+449999112"); - InternationalTransferInformation internationalTransferInformation = gsmaTransferHelper - .internationalTransferInformationHelper("string", "string", "directtoaccount", "USA", "USA", "USA", "USA"); - IdDocument idDocument = gsmaTransferHelper.idDocumentHelper("passport", "string", "USA", "2022-09-28T12:51:19.260+00:00", + InternationalTransferInformation internationalTransferInformation = gsmaTransferHelper.internationalTransferInformationHelper( + "string", "string", "directtoaccount", "Tanzania", "Tanzania", "Tanzania", "Tanzania"); + IdDocument idDocument = gsmaTransferHelper.idDocumentHelper("passport", "string", "Tanzania", "2022-09-28T12:51:19.260+00:00", "2022-09-28T12:51:19.260+00:00", "string", "string"); - PostalAddress postalAddress = gsmaTransferHelper.postalAddressHelper("string", "string", "string", "string", "USA", "string", + PostalAddress postalAddress = gsmaTransferHelper.postalAddressHelper("string", "string", "string", "string", "Tanzania", "string", "string"); SubjectName subjectName = gsmaTransferHelper.subjectNameHelper("string", "string", "string", "string", "string"); - Kyc senderKyc = gsmaTransferHelper.kycHelper("USA", "2000-11-20", "string", "string", "string", 'm', idDocument, "USA", "string", - postalAddress, subjectName); - Kyc receiverKyc = gsmaTransferHelper.kycHelper("USA", "2000-11-20", "string", "string", "string", 'm', idDocument, "USA", "string", - postalAddress, subjectName); + Kyc senderKyc = gsmaTransferHelper.kycHelper("Tanzania", "2000-11-20", "string", "string", "string", 'm', idDocument, "Tanzania", + "string", postalAddress, subjectName); + Kyc receiverKyc = gsmaTransferHelper.kycHelper("Tanzania", "2000-11-20", "string", "string", "string", 'm', idDocument, "Tanzania", + "string", postalAddress, subjectName); try { - gsmaTransaction = gsmaTransferHelper.gsmaTransactionRequestBodyHelper("ab", debitParty, creditParty, "USD", "string", "string", + gsmaTransaction = gsmaTransferHelper.gsmaTransactionRequestBodyHelper("ab", debitParty, creditParty, "TZS", "string", "string", "string", "transfer", "string", fee, "37.423825,-122.082900", internationalTransferInformation, "string", receiverKyc, senderKyc, "string", "2023-01-12T12:51:19.260+00:00"); } catch (JSONException e) { @@ -281,22 +281,22 @@ public void iCanCreateGSMATransactionDTOWithInvalidAmountFormat() { @Given("I can create GSMATransferDTO with incorrect Payer") public void iCanCreateGSMATransferDTOWithIncorrectPayerHelper() { GSMATransferHelper gsmaTransferHelper = new GSMATransferHelper(); - Fee fee = gsmaTransferHelper.feeHelper("11", "USD", "string"); + Fee fee = gsmaTransferHelper.feeHelper("11", "TZS", "string"); GsmaParty debitParty = gsmaTransferHelper.gsmaPartyHelper("msisdn", "449999"); GsmaParty creditParty = gsmaTransferHelper.gsmaPartyHelper("msisdn", "835322416"); - InternationalTransferInformation internationalTransferInformation = gsmaTransferHelper - .internationalTransferInformationHelper("string", "string", "directtoaccount", "USA", "USA", "USA", "USA"); - IdDocument idDocument = gsmaTransferHelper.idDocumentHelper("passport", "string", "USA", "2022-09-28T12:51:19.260+00:00", + InternationalTransferInformation internationalTransferInformation = gsmaTransferHelper.internationalTransferInformationHelper( + "string", "string", "directtoaccount", "Tanzania", "Tanzania", "Tanzania", "Tanzania"); + IdDocument idDocument = gsmaTransferHelper.idDocumentHelper("passport", "string", "Tanzania", "2022-09-28T12:51:19.260+00:00", "2022-09-28T12:51:19.260+00:00", "string", "string"); - PostalAddress postalAddress = gsmaTransferHelper.postalAddressHelper("string", "string", "string", "string", "USA", "string", + PostalAddress postalAddress = gsmaTransferHelper.postalAddressHelper("string", "string", "string", "string", "Tanzania", "string", "string"); SubjectName subjectName = gsmaTransferHelper.subjectNameHelper("string", "string", "string", "string", "string"); - Kyc senderKyc = gsmaTransferHelper.kycHelper("USA", "2000-11-20", "string", "string", "string", 'm', idDocument, "USA", "string", - postalAddress, subjectName); - Kyc receiverKyc = gsmaTransferHelper.kycHelper("USA", "2000-11-20", "string", "string", "string", 'm', idDocument, "USA", "string", - postalAddress, subjectName); + Kyc senderKyc = gsmaTransferHelper.kycHelper("Tanzania", "2000-11-20", "string", "string", "string", 'm', idDocument, "Tanzania", + "string", postalAddress, subjectName); + Kyc receiverKyc = gsmaTransferHelper.kycHelper("Tanzania", "2000-11-20", "string", "string", "string", 'm', idDocument, "Tanzania", + "string", postalAddress, subjectName); try { - gsmaTransaction = gsmaTransferHelper.gsmaTransactionRequestBodyHelper("11", debitParty, creditParty, "USD", "string", "string", + gsmaTransaction = gsmaTransferHelper.gsmaTransactionRequestBodyHelper("11", debitParty, creditParty, "TZS", "string", "string", "string", "transfer", "string", fee, "37.423825,-122.082900", internationalTransferInformation, "string", receiverKyc, senderKyc, "string", "2023-01-12T12:51:19.260+00:00"); } catch (JSONException e) { @@ -307,22 +307,22 @@ public void iCanCreateGSMATransferDTOWithIncorrectPayerHelper() { @Given("I can create GSMATransferDTO with Payer Insufficient Balance") public void iCanCreateGSMATransferDTOWithPayerInsufficientBalance() { GSMATransferHelper gsmaTransferHelper = new GSMATransferHelper(); - Fee fee = gsmaTransferHelper.feeHelper("110", "USD", "string"); + Fee fee = gsmaTransferHelper.feeHelper("110", "TZS", "string"); GsmaParty debitParty = gsmaTransferHelper.gsmaPartyHelper("msisdn", "835322416"); GsmaParty creditParty = gsmaTransferHelper.gsmaPartyHelper("msisdn", "398714218"); - InternationalTransferInformation internationalTransferInformation = gsmaTransferHelper - .internationalTransferInformationHelper("string", "string", "directtoaccount", "USA", "USA", "USA", "USA"); - IdDocument idDocument = gsmaTransferHelper.idDocumentHelper("passport", "string", "USA", "2022-09-28T12:51:19.260+00:00", + InternationalTransferInformation internationalTransferInformation = gsmaTransferHelper.internationalTransferInformationHelper( + "string", "string", "directtoaccount", "Tanzania", "Tanzania", "Tanzania", "Tanzania"); + IdDocument idDocument = gsmaTransferHelper.idDocumentHelper("passport", "string", "Tanzania", "2022-09-28T12:51:19.260+00:00", "2022-09-28T12:51:19.260+00:00", "string", "string"); - PostalAddress postalAddress = gsmaTransferHelper.postalAddressHelper("string", "string", "string", "string", "USA", "string", + PostalAddress postalAddress = gsmaTransferHelper.postalAddressHelper("string", "string", "string", "string", "Tanzania", "string", "string"); SubjectName subjectName = gsmaTransferHelper.subjectNameHelper("string", "string", "string", "string", "string"); - Kyc senderKyc = gsmaTransferHelper.kycHelper("USA", "2000-11-20", "string", "string", "string", 'm', idDocument, "USA", "string", - postalAddress, subjectName); - Kyc receiverKyc = gsmaTransferHelper.kycHelper("USA", "2000-11-20", "string", "string", "string", 'm', idDocument, "USA", "string", - postalAddress, subjectName); + Kyc senderKyc = gsmaTransferHelper.kycHelper("Tanzania", "2000-11-20", "string", "string", "string", 'm', idDocument, "Tanzania", + "string", postalAddress, subjectName); + Kyc receiverKyc = gsmaTransferHelper.kycHelper("Tanzania", "2000-11-20", "string", "string", "string", 'm', idDocument, "Tanzania", + "string", postalAddress, subjectName); try { - gsmaTransaction = gsmaTransferHelper.gsmaTransactionRequestBodyHelper("11000", debitParty, creditParty, "USD", "string", + gsmaTransaction = gsmaTransferHelper.gsmaTransactionRequestBodyHelper("11000", debitParty, creditParty, "TZS", "string", "string", "string", "transfer", "string", fee, "37.423825,-122.082900", internationalTransferInformation, "string", receiverKyc, senderKyc, "string", "2023-01-12T12:51:19.260+00:00"); } catch (JSONException e) { @@ -333,22 +333,22 @@ public void iCanCreateGSMATransferDTOWithPayerInsufficientBalance() { @Given("I can create GSMATransferDTO with invalid payer information") public void iCanCreateGSMATransferDTOWithInvalidData() { GSMATransferHelper gsmaTransferHelper = new GSMATransferHelper(); - Fee fee = gsmaTransferHelper.feeHelper("11", "USD", "string"); + Fee fee = gsmaTransferHelper.feeHelper("11", "TZS", "string"); GsmaParty debitParty = gsmaTransferHelper.gsmaPartyHelper("msisdn", "449999hhhhdsda"); GsmaParty creditParty = gsmaTransferHelper.gsmaPartyHelper("msisdn", "835322416ffgg"); - InternationalTransferInformation internationalTransferInformation = gsmaTransferHelper - .internationalTransferInformationHelper("string", "string", "directtoaccount", "USA", "USA", "USA", "USA"); - IdDocument idDocument = gsmaTransferHelper.idDocumentHelper("passport", "string", "USA", "2022-09-28T12:51:19.260+00:00", + InternationalTransferInformation internationalTransferInformation = gsmaTransferHelper.internationalTransferInformationHelper( + "string", "string", "directtoaccount", "Tanzania", "Tanzania", "Tanzania", "Tanzania"); + IdDocument idDocument = gsmaTransferHelper.idDocumentHelper("passport", "string", "Tanzania", "2022-09-28T12:51:19.260+00:00", "2022-09-28T12:51:19.260+00:00", "string", "string"); - PostalAddress postalAddress = gsmaTransferHelper.postalAddressHelper("string", "string", "string", "string", "USA", "string", + PostalAddress postalAddress = gsmaTransferHelper.postalAddressHelper("string", "string", "string", "string", "Tanzania", "string", "string"); SubjectName subjectName = gsmaTransferHelper.subjectNameHelper("string", "string", "string", "string", "string"); - Kyc senderKyc = gsmaTransferHelper.kycHelper("USA", "2000-11-20", "string", "string", "string", 'm', idDocument, "USA", "string", - postalAddress, subjectName); - Kyc receiverKyc = gsmaTransferHelper.kycHelper("USA", "2000-11-20", "string", "string", "string", 'm', idDocument, "USA", "string", - postalAddress, subjectName); + Kyc senderKyc = gsmaTransferHelper.kycHelper("Tanzania", "2000-11-20", "string", "string", "string", 'm', idDocument, "Tanzania", + "string", postalAddress, subjectName); + Kyc receiverKyc = gsmaTransferHelper.kycHelper("Tanzania", "2000-11-20", "string", "string", "string", 'm', idDocument, "Tanzania", + "string", postalAddress, subjectName); try { - gsmaTransaction = gsmaTransferHelper.gsmaTransactionRequestBodyHelper("11", debitParty, creditParty, "USD", "string", "string", + gsmaTransaction = gsmaTransferHelper.gsmaTransactionRequestBodyHelper("11", debitParty, creditParty, "TZS", "string", "string", "string", "transfer", "string", fee, "37.423825,-122.082900", internationalTransferInformation, "string", receiverKyc, senderKyc, "string", "2023-01-12T12:51:19.260+00:00"); } catch (JSONException e) { @@ -381,23 +381,23 @@ public void iShouldPollTheTransferQueryEndpointWithTransactionIdUntilStatusIsPop @When("I can create GSMATransferDTO with different payer and payee") public void iCanCreateGSMATransactionDTOWithDifferentPayerAndPayee() { GSMATransferHelper gsmaTransferHelper = new GSMATransferHelper(); - Fee fee = gsmaTransferHelper.feeHelper("11", "USD", "string"); + Fee fee = gsmaTransferHelper.feeHelper("11", "TZS", "string"); GsmaParty debit = gsmaTransferHelper.gsmaPartyHelper("msisdn", scenarioScopeState.debitParty); GsmaParty credit = gsmaTransferHelper.gsmaPartyHelper("msisdn", scenarioScopeState.creditParty); - InternationalTransferInformation internationalTransferInformation = gsmaTransferHelper - .internationalTransferInformationHelper("string", "string", "directtoaccount", "USA", "USA", "USA", "USA"); - IdDocument idDocument = gsmaTransferHelper.idDocumentHelper("passport", "string", "USA", "2022-09-28T12:51:19.260+00:00", + InternationalTransferInformation internationalTransferInformation = gsmaTransferHelper.internationalTransferInformationHelper( + "string", "string", "directtoaccount", "Tanzania", "Tanzania", "Tanzania", "Tanzania"); + IdDocument idDocument = gsmaTransferHelper.idDocumentHelper("passport", "string", "Tanzania", "2022-09-28T12:51:19.260+00:00", "2022-09-28T12:51:19.260+00:00", "string", "string"); - PostalAddress postalAddress = gsmaTransferHelper.postalAddressHelper("string", "string", "string", "string", "USA", "string", + PostalAddress postalAddress = gsmaTransferHelper.postalAddressHelper("string", "string", "string", "string", "Tanzania", "string", "string"); SubjectName subjectName = gsmaTransferHelper.subjectNameHelper("string", "string", "string", "string", "string"); - Kyc senderKyc = gsmaTransferHelper.kycHelper("USA", "2000-11-20", "string", "string", "string", 'm', idDocument, "USA", "string", - postalAddress, subjectName); - Kyc receiverKyc = gsmaTransferHelper.kycHelper("USA", "2000-11-20", "string", "string", "string", 'm', idDocument, "USA", "string", - postalAddress, subjectName); + Kyc senderKyc = gsmaTransferHelper.kycHelper("Tanzania", "2000-11-20", "string", "string", "string", 'm', idDocument, "Tanzania", + "string", postalAddress, subjectName); + Kyc receiverKyc = gsmaTransferHelper.kycHelper("Tanzania", "2000-11-20", "string", "string", "string", 'm', idDocument, "Tanzania", + "string", postalAddress, subjectName); scenarioScopeState.gsmaP2PAmtDebit = 11; try { - ErrorCodeStepDef.gsmaTransaction = gsmaTransferHelper.gsmaTransactionRequestBodyHelper("11", debit, credit, "USD", "string", + ErrorCodeStepDef.gsmaTransaction = gsmaTransferHelper.gsmaTransactionRequestBodyHelper("11", debit, credit, "TZS", "string", "string", "string", "transfer", "string", fee, "37.423825,-122.082900", internationalTransferInformation, "string", receiverKyc, senderKyc, "string", "2023-01-12T12:51:19.260+00:00"); } catch (JSONException e) { diff --git a/src/test/java/org/mifos/integrationtest/cucumber/stepdef/GSMATransferDef.java b/src/test/java/org/mifos/integrationtest/cucumber/stepdef/GSMATransferDef.java index 84a0f4e32..2f10040a3 100644 --- a/src/test/java/org/mifos/integrationtest/cucumber/stepdef/GSMATransferDef.java +++ b/src/test/java/org/mifos/integrationtest/cucumber/stepdef/GSMATransferDef.java @@ -113,7 +113,7 @@ protected String setBodyLoanProduct() throws JsonProcessingException { String name = new StringBuilder().append(getAlphaNumericString(4)).append(tenant).toString(); String shortName = getAlphaNumericString(4); PostLoanProductsRequest loanProductsRequest = new PostLoanProductsRequest(); - loanProductsRequest.setCurrencyCode("USD"); + loanProductsRequest.setCurrencyCode("TZS"); loanProductsRequest.setInMultiplesOf(2); loanProductsRequest.setDigitsAfterDecimal(2); loanProductsRequest.setDaysInYearType(1); @@ -128,7 +128,7 @@ protected String setBodyLoanProduct() throws JsonProcessingException { loanProductsRequest.setInterestType(1); loanProductsRequest.setInterestRatePerPeriod(19.0); loanProductsRequest.setRepaymentEvery(1); - loanProductsRequest.setTransactionProcessingStrategyId(1); + loanProductsRequest.setTransactionProcessingStrategyCode("mifos-standard-strategy"); loanProductsRequest.setAmortizationType(1); loanProductsRequest.setAccountingRule(1); loanProductsRequest.setInterestRateFrequencyType(2); @@ -162,7 +162,7 @@ protected String setBodyLoanAccount() throws JsonProcessingException { loanAccountData.setAmortizationType(1); loanAccountData.setInterestType(0); loanAccountData.setInterestCalculationPeriodType(0); - loanAccountData.setTransactionProcessingStrategyId(1); + loanAccountData.setTransactionProcessingStrategyCode("mifos-standard-strategy"); loanAccountData.setLocale("en"); loanAccountData.setDateFormat("dd MMMM yyyy"); loanAccountData.setLoanType("individual"); @@ -211,7 +211,7 @@ protected String setBodySavingsProduct() throws JsonProcessingException { String shortName = getAlphaNumericString(4); PostSavingsProductsRequest savingsProductsRequest = new PostSavingsProductsRequest(); - savingsProductsRequest.setCurrencyCode("USD"); + savingsProductsRequest.setCurrencyCode("TZS"); savingsProductsRequest.setDigitsAfterDecimal(2); savingsProductsRequest.setInterestCompoundingPeriodType(1); savingsProductsRequest.setInterestPostingPeriodType(4); @@ -335,7 +335,7 @@ protected String setGsmaTransactionBody(String prefix) throws JsonProcessingExce String dateFormatGiven = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX"; String currentDate = new SimpleDateFormat(dateFormatGiven).format(new Date()); - GsmaTransfer gsmaTransfer = new GsmaTransfer("RKTQDM7W6S", "inbound", "transfer", Integer.toString(amount), "USD", "note", + GsmaTransfer gsmaTransfer = new GsmaTransfer("RKTQDM7W6S", "inbound", "transfer", Integer.toString(amount), "TZS", "note", currentDate, customData, payer, payee); return objectMapper.writeValueAsString(gsmaTransfer); } diff --git a/src/test/java/org/mifos/integrationtest/cucumber/stepdef/GSMATransferStepDef.java b/src/test/java/org/mifos/integrationtest/cucumber/stepdef/GSMATransferStepDef.java index dad45a985..3b0c2a380 100644 --- a/src/test/java/org/mifos/integrationtest/cucumber/stepdef/GSMATransferStepDef.java +++ b/src/test/java/org/mifos/integrationtest/cucumber/stepdef/GSMATransferStepDef.java @@ -35,6 +35,7 @@ import org.mifos.connector.common.identityaccountmapper.dto.BeneficiaryDTO; import org.mifos.integrationtest.common.Utils; import org.mifos.integrationtest.config.GsmaConfig; +import org.mifos.integrationtest.util.Util; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -431,10 +432,10 @@ public void iCallTheBalanceApiForPayerBalance() throws JsonProcessingException { finalEndpoint = finalEndpoint.replace("{IdentifierType}", "MSISDN"); finalEndpoint = finalEndpoint.replace("{IdentifierId}", scenarioScopeState.debitParty.isEmpty() ? scenarioScopeState.payerIdentifier : scenarioScopeState.debitParty); - logger.info("Endpoint: " + finalEndpoint); + logger.info("Endpoint: {}", finalEndpoint); scenarioScopeState.response = RestAssured.given(requestSpec).baseUri(amsBaseUrl).body("").expect() .spec(new ResponseSpecBuilder().expectStatusCode(200).build()).when().get(finalEndpoint).andReturn().asString(); - logger.info("Balance Response: " + scenarioScopeState.response); + logger.info("Balance Response: {}", scenarioScopeState.response); InteropAccountDTO interopAccountDTO = objectMapper.readValue(scenarioScopeState.response, InteropAccountDTO.class); assertThat(interopAccountDTO.getAvailableBalance().intValue() <= scenarioScopeState.initialBalForPayer).isTrue(); scenarioScopeState.gsmaP2PAmtDebit = 0; @@ -448,10 +449,10 @@ public void iCallTheBalanceApiForPayeeBalance() throws JsonProcessingException { finalEndpoint = finalEndpoint.replace("{IdentifierType}", "MSISDN"); finalEndpoint = finalEndpoint.replace("{IdentifierId}", scenarioScopeState.creditParty.isEmpty() ? scenarioScopeState.payeeIdentifier : scenarioScopeState.creditParty); - logger.info("Endpoint: " + finalEndpoint); + logger.info("Endpoint: {}", finalEndpoint); scenarioScopeState.response = RestAssured.given(requestSpec).baseUri(amsBaseUrl).body("").expect() .spec(new ResponseSpecBuilder().expectStatusCode(200).build()).when().get(finalEndpoint).andReturn().asString(); - logger.info("Balance Response: " + scenarioScopeState.response); + logger.info("Balance Response: {}", scenarioScopeState.response); InteropAccountDTO interopAccountDTO = objectMapper.readValue(scenarioScopeState.response, InteropAccountDTO.class); assertThat(interopAccountDTO.getAvailableBalance().intValue() >= scenarioScopeState.initialBalForPayee).isTrue(); @@ -468,7 +469,7 @@ public void iCallTheBalanceApiForPayerBalanceAfterDebit() throws JsonProcessingE logger.info("Endpoint: " + finalEndpoint); scenarioScopeState.response = RestAssured.given(requestSpec).baseUri(amsBaseUrl).body("").expect() .spec(new ResponseSpecBuilder().expectStatusCode(200).build()).when().get(finalEndpoint).andReturn().asString(); - logger.info("Balance Response: " + scenarioScopeState.response); + logger.info("Balance Response: {}", scenarioScopeState.response); InteropAccountDTO interopAccountDTO = objectMapper.readValue(scenarioScopeState.response, InteropAccountDTO.class); assertThat(interopAccountDTO.getAvailableBalance().intValue() == scenarioScopeState.initialBalForPayer - scenarioScopeState.gsmaP2PAmtDebit).isTrue(); @@ -484,10 +485,10 @@ public void iCallTheBalanceApiForPayeeBalanceAfterCredit() throws JsonProcessing finalEndpoint = finalEndpoint.replace("{IdentifierType}", "MSISDN"); finalEndpoint = finalEndpoint.replace("{IdentifierId}", scenarioScopeState.creditParty.isEmpty() ? scenarioScopeState.payeeIdentifier : scenarioScopeState.creditParty); - logger.info("Endpoint: " + finalEndpoint); + logger.info("Endpoint: {}", finalEndpoint); scenarioScopeState.response = RestAssured.given(requestSpec).baseUri(amsBaseUrl).body("").expect() .spec(new ResponseSpecBuilder().expectStatusCode(200).build()).when().get(finalEndpoint).andReturn().asString(); - logger.info("Balance Response: " + scenarioScopeState.response); + logger.info("Balance Response: {}", scenarioScopeState.response); InteropAccountDTO interopAccountDTO = objectMapper.readValue(scenarioScopeState.response, InteropAccountDTO.class); assertThat(interopAccountDTO.getAvailableBalance().intValue() == scenarioScopeState.initialBalForPayee + scenarioScopeState.gsmaP2PAmtDebit).isTrue(); @@ -690,7 +691,7 @@ public void iCallTheBalanceApiForPayeeBalance(String id) throws JsonProcessingEx logger.info("Endpoint: " + finalEndpoint); scenarioScopeState.response = RestAssured.given(requestSpec).baseUri(amsBaseUrl).body("").expect() .spec(new ResponseSpecBuilder().expectStatusCode(200).build()).when().get(finalEndpoint).andReturn().asString(); - logger.info("Balance Response: " + scenarioScopeState.response); + logger.info("Balance Response: {}", scenarioScopeState.response); InteropAccountDTO interopAccountDTO = objectMapper.readValue(scenarioScopeState.response, InteropAccountDTO.class); assertThat( interopAccountDTO.getAvailableBalance().intValue() >= scenarioScopeState.initialBalForPayeeForBatch[Integer.parseInt(id)]) @@ -712,7 +713,71 @@ public void iCallTheBalanceApiForPayeeBalanceForCombinedTestsCases(String id) th logger.info("Endpoint: " + finalEndpoint); scenarioScopeState.response = RestAssured.given(requestSpec).baseUri(amsBaseUrl).body("").expect() .spec(new ResponseSpecBuilder().expectStatusCode(200).build()).when().get(finalEndpoint).andReturn().asString(); - logger.info("Balance Response: " + scenarioScopeState.response); + logger.info("Balance Response: {}", scenarioScopeState.response); + InteropAccountDTO interopAccountDTO = objectMapper.readValue(scenarioScopeState.response, InteropAccountDTO.class); + assertThat( + interopAccountDTO.getAvailableBalance().intValue() >= scenarioScopeState.initialBalForPayeeForBatch[Integer.parseInt(id)]) + .isTrue(); + + } + + @Then("I call the balance api for payer {string} balance for all combine test cases") + public void iCallTheBalanceApiForAllPayerBalanceForCombinedTestCases(String id) throws JsonProcessingException { + RequestSpecification requestSpec = Utils.getDefaultSpec(scenarioScopeState.tenant); + String finalEndpoint = amsBalanceEndpoint; + // Check whether a new batch been initialized + initializeIfNotInitialized(id); + scenarioScopeState.payerIdentifierforBatch[Integer.parseInt(id)] = scenarioScopeState.payerIdentifier; + String accountId = (scenarioScopeState.debitParty == null) ? scenarioScopeState.payerIdentifier : scenarioScopeState.debitParty; + String identifierType = "MSISDN"; + finalEndpoint = Util.getFormattedEndpoint(finalEndpoint, "{IdentifierType}", identifierType); + finalEndpoint = Util.getFormattedEndpoint(finalEndpoint, "{IdentifierId}", accountId); + logger.info("Endpoint: {} ", finalEndpoint); + scenarioScopeState.response = RestAssured.given(requestSpec).baseUri(amsBaseUrl).body("").expect() + .spec(new ResponseSpecBuilder().expectStatusCode(200).build()).when().get(finalEndpoint).andReturn().asString(); + logger.info("Balance Response: {}", scenarioScopeState.response); + InteropAccountDTO interopAccountDTO = objectMapper.readValue(scenarioScopeState.response, InteropAccountDTO.class); + assertThat( + interopAccountDTO.getAvailableBalance().intValue() >= scenarioScopeState.initialBalForPayerForBatch[Integer.parseInt(id)]) + .isTrue(); + } + + public void initializeIfNotInitialized(String id) { + if (shouldInitializeArray(id)) { + scenarioScopeState.payerIdentifierforBatch = new String[15]; + } + } + + private boolean shouldInitializeArray(String id) { + return scenarioScopeState.payerIdentifierforBatch == null || id.equals("1"); + } + + public void initializeIfNotInitializedForPayee(String id) { + if (shouldInitializeArrayForPayee(id)) { + scenarioScopeState.payeeIdentifierforBatch = new String[15]; + } + } + + private boolean shouldInitializeArrayForPayee(String id) { + return scenarioScopeState.payeeIdentifierforBatch == null || id.equals("1"); + } + + @Then("I call the balance api for payee {string} balance for all combine test cases") + public void iCallTheBalanceApiForPayeeBalanceForAllCombinedTestsCases(String id) throws JsonProcessingException { + RequestSpecification requestSpec = Utils.getDefaultSpec(scenarioScopeState.tenant); + String finalEndpoint = amsBalanceEndpoint; + + initializeIfNotInitializedForPayee(id); + scenarioScopeState.payeeIdentifierforBatch[Integer.parseInt(id)] = scenarioScopeState.payeeIdentifier; + String identifierId = (scenarioScopeState.creditParty == null) ? scenarioScopeState.payeeIdentifier + : scenarioScopeState.creditParty; + String identifierType = "MSISDN"; + finalEndpoint = Util.getFormattedEndpoint(finalEndpoint, "{IdentifierType}", identifierType); + finalEndpoint = Util.getFormattedEndpoint(finalEndpoint, "{IdentifierId}", identifierId); + logger.info("Endpoint: {}", finalEndpoint); + scenarioScopeState.response = RestAssured.given(requestSpec).baseUri(amsBaseUrl).body("").expect() + .spec(new ResponseSpecBuilder().expectStatusCode(200).build()).when().get(finalEndpoint).andReturn().asString(); + logger.info("Balance Response: {}", scenarioScopeState.response); InteropAccountDTO interopAccountDTO = objectMapper.readValue(scenarioScopeState.response, InteropAccountDTO.class); assertThat( interopAccountDTO.getAvailableBalance().intValue() >= scenarioScopeState.initialBalForPayeeForBatch[Integer.parseInt(id)]) @@ -724,16 +789,18 @@ public void iCallTheBalanceApiForPayeeBalanceForCombinedTestsCases(String id) th public void iCallTheBalanceApiForPayeeBalanceAfterCredit(String id) throws JsonProcessingException { RequestSpecification requestSpec = Utils.getDefaultSpec(scenarioScopeState.tenant); String finalEndpoint = amsBalanceEndpoint; - finalEndpoint = finalEndpoint.replace("{IdentifierType}", "MSISDN"); - finalEndpoint = finalEndpoint.replace("{IdentifierId}", scenarioScopeState.payeeIdentifierforBatch[Integer.parseInt(id)]); - logger.info("Endpoint: " + finalEndpoint); + String identifierId = (scenarioScopeState.creditParty == null) ? scenarioScopeState.payeeIdentifier + : scenarioScopeState.creditParty; + String identifierType = "MSISDN"; + finalEndpoint = Util.getFormattedEndpoint(finalEndpoint, "{IdentifierType}", identifierType); + finalEndpoint = Util.getFormattedEndpoint(finalEndpoint, "{IdentifierId}", identifierId); + logger.info("Endpoint: {}", finalEndpoint); scenarioScopeState.response = RestAssured.given(requestSpec).baseUri(amsBaseUrl).body("").expect() .spec(new ResponseSpecBuilder().expectStatusCode(200).build()).when().get(finalEndpoint).andReturn().asString(); - logger.info("Balance Response: " + scenarioScopeState.response); + logger.info("Balance Response: {}", scenarioScopeState.response); InteropAccountDTO interopAccountDTO = objectMapper.readValue(scenarioScopeState.response, InteropAccountDTO.class); assertThat(interopAccountDTO.getAvailableBalance().intValue() == scenarioScopeState.initialBalForPayeeForBatch[Integer.parseInt(id)] + scenarioScopeState.gsmaP2PAmtDebitForBatch[Integer.parseInt(id)]).isTrue(); - } @Then("I call the balance api for payer {string} balance") @@ -749,7 +816,7 @@ public void iCallTheBalanceApiForPayerBalance(String id) throws JsonProcessingEx logger.info("Endpoint: " + finalEndpoint); scenarioScopeState.response = RestAssured.given(requestSpec).baseUri(amsBaseUrl).body("").expect() .spec(new ResponseSpecBuilder().expectStatusCode(200).build()).when().get(finalEndpoint).andReturn().asString(); - logger.info("Balance Response: " + scenarioScopeState.response); + logger.info("Balance Response: {}", scenarioScopeState.response); InteropAccountDTO interopAccountDTO = objectMapper.readValue(scenarioScopeState.response, InteropAccountDTO.class); assertThat( interopAccountDTO.getAvailableBalance().intValue() >= scenarioScopeState.initialBalForPayerForBatch[Integer.parseInt(id)]) @@ -771,7 +838,7 @@ public void iCallTheBalanceApiForPayerBalanceForCombinedTestCases(String id) thr logger.info("Endpoint: " + finalEndpoint); scenarioScopeState.response = RestAssured.given(requestSpec).baseUri(amsBaseUrl).body("").expect() .spec(new ResponseSpecBuilder().expectStatusCode(200).build()).when().get(finalEndpoint).andReturn().asString(); - logger.info("Balance Response: " + scenarioScopeState.response); + logger.info("Balance Response: {}", scenarioScopeState.response); InteropAccountDTO interopAccountDTO = objectMapper.readValue(scenarioScopeState.response, InteropAccountDTO.class); assertThat( interopAccountDTO.getAvailableBalance().intValue() >= scenarioScopeState.initialBalForPayerForBatch[Integer.parseInt(id)]) @@ -788,7 +855,7 @@ public void iCallTheBalanceApiForPayerBalanceAfterDebit(String id) throws JsonPr logger.info("Endpoint: " + finalEndpoint); scenarioScopeState.response = RestAssured.given(requestSpec).baseUri(amsBaseUrl).body("").expect() .spec(new ResponseSpecBuilder().expectStatusCode(200).build()).when().get(finalEndpoint).andReturn().asString(); - logger.info("Balance Response: " + scenarioScopeState.response); + logger.info("Balance Response: {}", scenarioScopeState.response); InteropAccountDTO interopAccountDTO = objectMapper.readValue(scenarioScopeState.response, InteropAccountDTO.class); int originBal = scenarioScopeState.initialBalForPayerForBatch[Integer.parseInt(id)]; int debitAmt = scenarioScopeState.gsmaP2PAmtDebitForBatch[Integer.parseInt(id)]; diff --git a/src/test/java/org/mifos/integrationtest/cucumber/stepdef/IdentityMapperStepDef.java b/src/test/java/org/mifos/integrationtest/cucumber/stepdef/IdentityMapperStepDef.java index 862071084..a8dce42ad 100644 --- a/src/test/java/org/mifos/integrationtest/cucumber/stepdef/IdentityMapperStepDef.java +++ b/src/test/java/org/mifos/integrationtest/cucumber/stepdef/IdentityMapperStepDef.java @@ -74,9 +74,9 @@ public class IdentityMapperStepDef extends BaseStepDef { public void iCallTheRegisterBeneficiaryAPIWithExpectedStatusOf(int expectedStatus, String stub) { RequestSpecification requestSpec = Utils.getDefaultSpec(); scenarioScopeState.response = RestAssured.given(requestSpec).header("Content-Type", "application/json") - .header("X-Registering-Institution-ID", sourceBBID).header("X-CallbackURL", identityMapperConfig.callbackURL + stub) - .baseUri(identityMapperConfig.identityMapperContactPoint).body(registerBeneficiaryBody).expect() - .spec(new ResponseSpecBuilder().expectStatusCode(expectedStatus).build()).when() + .header("X-Registering-Institution-ID", scenarioScopeState.registeringInstituteId) + .header("X-CallbackURL", identityMapperConfig.callbackURL + stub).baseUri(identityMapperConfig.identityMapperContactPoint) + .body(registerBeneficiaryBody).expect().spec(new ResponseSpecBuilder().expectStatusCode(expectedStatus).build()).when() .post(identityMapperConfig.registerBeneficiaryEndpoint).andReturn().asString(); logger.info("Identity Mapper Response: {}", scenarioScopeState.response); @@ -526,6 +526,23 @@ public void iCreateAIdentityMapperDTOForRegisteringBeneficiary() { registerBeneficiaryBody = new AccountMapperRequestDTO(requestId, sourceBBID, beneficiaryDTOList); } + @And("I create a IdentityMapperDTO for registering payee with IAM") + public void iCreateAIdentityMapperDTOForRegisteringPayee() { + List beneficiaryDTOList = new ArrayList<>(); + String[] payeeFsps = { "payeefsp1", "payeefsp2", "payeefsp3" }; + String[] payeeIdentifiers = { "400173110196", "400174120160", "400173110195" }; + String[] financialAddressArray = { "1234", "2235", "3235" }; + int fspIndex = 0; + for (String payeeIdentifier : payeeIdentifiers) { + BeneficiaryDTO beneficiaryDTO = new BeneficiaryDTO(payeeIdentifier, "00", financialAddressArray[fspIndex], + payeeFspConfig.getPayeeFsp(payeeFsps[fspIndex])); + beneficiaryDTOList.add(beneficiaryDTO); + fspIndex++; + } + requestId = generateUniqueNumber(12); + registerBeneficiaryBody = new AccountMapperRequestDTO(requestId, sourceBBID, beneficiaryDTOList); + } + @And("I should be able to verify that the {string} method to {string} endpoint received a request with successfull registration") public void iShouldBeAbleToVerifyThatTheMethodToEndpointReceivedARequestWithSuccessfullRegistration(String httpMethod, String stub) { await().atMost(awaitMost, SECONDS).untilAsserted(() -> { diff --git a/src/test/java/org/mifos/integrationtest/cucumber/stepdef/MojaloopDef.java b/src/test/java/org/mifos/integrationtest/cucumber/stepdef/MojaloopDef.java index f0e02d30e..53b15cdaa 100644 --- a/src/test/java/org/mifos/integrationtest/cucumber/stepdef/MojaloopDef.java +++ b/src/test/java/org/mifos/integrationtest/cucumber/stepdef/MojaloopDef.java @@ -42,7 +42,7 @@ public class MojaloopDef { Logger logger = LoggerFactory.getLogger(this.getClass()); - private static final String CURRENCY = "USD"; + private static final String CURRENCY = "TZS"; protected String setBodyAddAlsUser(String fspId) throws JsonProcessingException { AddUserAlsRequest addUserAlsRequest = new AddUserAlsRequest(); @@ -116,7 +116,7 @@ protected void createSettlementModelDeferredNetUSD() { RequestSpecification requestSpec = Utils.getDefaultSpec(); requestSpec.header("Content-Type", "application/json"); String endpoint = mojaloopConfig.settlementModel; - SettlementModelRequestBody requestBody = settlementModelRequestBody("DEFERREDNETUSD"); + SettlementModelRequestBody requestBody = settlementModelRequestBody("DEFERREDNETTZS"); requestBody.setCurrency(CURRENCY); Response response = RestAssured.given(requestSpec).baseUri(mojaloopConfig.mojaloopCentralLedgerBaseurl).body(requestBody).when() @@ -195,11 +195,15 @@ protected void setCallbackEndpoints() { String payerFsp = mojaloopConfig.payerFspId; String payeeFsp = mojaloopConfig.payeeFspId; + String payeeFsp2 = mojaloopConfig.payeeFspId2; + String payeeFsp3 = mojaloopConfig.payeeFspId3; callbackEndpoints.getCallbackEndpoints().forEach(callback -> { String value = callback.getValue().replaceAll("\\{\\{CALLBACK_HOST\\}\\}", "http://" + mojaloopConfig.mlConnectorHost); try { addCallbackEndpoint(payerFsp, callback.getType(), value); addCallbackEndpoint(payeeFsp, callback.getType(), value); + addCallbackEndpoint(payeeFsp2, callback.getType(), value); + addCallbackEndpoint(payeeFsp3, callback.getType(), value); } catch (JsonProcessingException e) { throw new RuntimeException(e); } @@ -211,7 +215,7 @@ protected void recordFunds(String fsp) throws JsonProcessingException { RequestSpecification requestSpec = Utils.getDefaultSpec(); requestSpec.header("Content-Type", "application/json"); String endpoint = mojaloopConfig.recordFundsEndpoint.replaceAll("\\{\\{fsp\\}\\}", fsp) - .replaceAll("\\{\\{payerfspSettlementAccountId\\}\\}", "4"); + .replaceAll("\\{\\{payerfspSettlementAccountId\\}\\}", "16"); String requestBody = objectMapper.writeValueAsString(getRecordFundsRequestBody()); Response responseBody = RestAssured.given(requestSpec).baseUri(mojaloopConfig.mojaloopCentralLedgerBaseurl).body(requestBody) diff --git a/src/test/java/org/mifos/integrationtest/cucumber/stepdef/MojaloopStepDef.java b/src/test/java/org/mifos/integrationtest/cucumber/stepdef/MojaloopStepDef.java index 32dbf07d6..3f839c578 100644 --- a/src/test/java/org/mifos/integrationtest/cucumber/stepdef/MojaloopStepDef.java +++ b/src/test/java/org/mifos/integrationtest/cucumber/stepdef/MojaloopStepDef.java @@ -11,6 +11,7 @@ import io.restassured.specification.RequestSpecification; import org.mifos.integrationtest.common.Utils; import org.mifos.integrationtest.config.MojaloopConfig; +import org.mifos.integrationtest.util.Util; import org.springframework.beans.factory.annotation.Autowired; public class MojaloopStepDef extends BaseStepDef { @@ -24,23 +25,36 @@ public class MojaloopStepDef extends BaseStepDef { @Autowired ScenarioScopeState scenarioScopeState; + private static final String CONTENT_TYPE = "application/vnd.interoperability.participants+json;version=1.0"; + @Then("I add {string} to als") public void addUsersToALS(String client) throws JsonProcessingException { String clientIdentifierId; String fspId; - if (client.equals("payer")) { - clientIdentifierId = scenarioScopeState.payerIdentifier; - fspId = mojaloopConfig.payerFspId; - } else { - clientIdentifierId = scenarioScopeState.payeeIdentifier; - fspId = mojaloopConfig.payeeFspId; + switch (client) { + case "payer" -> { + clientIdentifierId = scenarioScopeState.payerIdentifier; + fspId = mojaloopConfig.payerFspId; + } + case "payee2" -> { + clientIdentifierId = scenarioScopeState.payeeIdentifier; + fspId = mojaloopConfig.payeeFspId2; + } + case "payee3" -> { + clientIdentifierId = scenarioScopeState.payeeIdentifier; + fspId = mojaloopConfig.payeeFspId3; + } + default -> { + clientIdentifierId = scenarioScopeState.payeeIdentifier; + fspId = mojaloopConfig.payeeFspId; + } } RequestSpecification requestSpec = Utils.getDefaultSpec(); requestSpec.header("FSPIOP-Source", fspId); requestSpec.header("Date", getCurrentDateInFormat()); - requestSpec.header("Accept", "application/vnd.interoperability.participants+json;version=1"); + requestSpec.header("Accept", CONTENT_TYPE); // requestSpec.header("Content-Type", "application/vnd.interoperability.participants+json;version=1.0"); String endpoint = mojaloopConfig.addUserToAlsEndpoint; @@ -55,8 +69,59 @@ public void addUsersToALS(String client) throws JsonProcessingException { String response = RestAssured.given(requestSpec).baseUri(mojaloopConfig.mojaloopBaseurl) .config(RestAssured.config().encoderConfig(encoderConfig().appendDefaultContentCharsetToContentTypeIfUndefined(false))) - .body(requestBody).contentType("application/vnd.interoperability.participants+json;version=1.0").expect() - .spec(new ResponseSpecBuilder().expectStatusCode(202).build()).when().post(endpoint).andReturn().asString(); + .body(requestBody).contentType(CONTENT_TYPE).expect().spec(new ResponseSpecBuilder().expectStatusCode(202).build()).when() + .post(endpoint).andReturn().asString(); + + logger.info(response); + assertThat(response).isNotNull(); + } + + @Then("I add {string} with account id {string} to als") + public void addBudgetAccountToALS(String client, String accountId) throws JsonProcessingException { + + String clientIdentifierId; + String fspId; + switch (client) { + case "payer" -> { + clientIdentifierId = scenarioScopeState.payerIdentifier; + fspId = mojaloopConfig.payerFspId; + } + case "payee2" -> { + clientIdentifierId = scenarioScopeState.payeeIdentifier; + fspId = mojaloopConfig.payeeFspId2; + } + case "payee3" -> { + clientIdentifierId = scenarioScopeState.payeeIdentifier; + fspId = mojaloopConfig.payeeFspId3; + } + default -> { + clientIdentifierId = scenarioScopeState.payeeIdentifier; + fspId = mojaloopConfig.payeeFspId; + } + } + + RequestSpecification requestSpec = Utils.getDefaultSpec(); + requestSpec.header("FSPIOP-Source", fspId); + requestSpec.header("Date", getCurrentDateInFormat()); + requestSpec.header("Accept", CONTENT_TYPE); + + String endpoint = mojaloopConfig.addUserToAlsEndpoint; + String identifierType = "MSISDN"; + endpoint = Util.getFormattedEndpoint(endpoint, "{{identifierType}}", identifierType); + endpoint = Util.getFormattedEndpoint(endpoint, "{{identifier}}", accountId); + String identifierId = (scenarioScopeState.creditParty == null) ? scenarioScopeState.payeeIdentifier + : scenarioScopeState.creditParty; + endpoint = String.format(endpoint, identifierType, identifierId); + String requestBody = mojaloopDef.setBodyAddAlsUser(fspId); + + logger.info(mojaloopConfig.mojaloopBaseurl); + logger.info(requestBody); + logger.info(endpoint); + + String response = RestAssured.given(requestSpec).baseUri(mojaloopConfig.mojaloopBaseurl) + .config(RestAssured.config().encoderConfig(encoderConfig().appendDefaultContentCharsetToContentTypeIfUndefined(false))) + .body(requestBody).contentType(CONTENT_TYPE).expect().spec(new ResponseSpecBuilder().expectStatusCode(202).build()).when() + .post(endpoint).andReturn().asString(); logger.info(response); assertThat(response).isNotNull(); @@ -67,6 +132,8 @@ public void mojaloopSetup() throws JsonProcessingException { String payerFsp = mojaloopConfig.payerFspId; String payeeFsp = mojaloopConfig.payeeFspId; + String payeeFsp2 = mojaloopConfig.payeeFspId2; + String payeeFsp3 = mojaloopConfig.payeeFspId3; if (!mojaloopDef.isHubAccountTypesAdded()) { @@ -86,10 +153,15 @@ public void mojaloopSetup() throws JsonProcessingException { mojaloopDef.addFsp(payerFsp); mojaloopDef.addFsp(payeeFsp); + mojaloopDef.addFsp(payeeFsp2); + mojaloopDef.addFsp(payeeFsp3); mojaloopDef.addInitialPositionAndLimit(payerFsp); mojaloopDef.addInitialPositionAndLimit(payeeFsp); + mojaloopDef.addInitialPositionAndLimit(payeeFsp2); + mojaloopDef.addInitialPositionAndLimit(payeeFsp3); - if (!mojaloopDef.getCallbackEndpoints(payerFsp) || !mojaloopDef.getCallbackEndpoints(payeeFsp)) { + if (!mojaloopDef.getCallbackEndpoints(payerFsp) || !mojaloopDef.getCallbackEndpoints(payeeFsp) + || !mojaloopDef.getCallbackEndpoints(payeeFsp2) || !mojaloopDef.getCallbackEndpoints(payeeFsp3)) { mojaloopDef.setCallbackEndpoints(); } diff --git a/src/test/java/org/mifos/integrationtest/cucumber/stepdef/PayerFundTransferDef.java b/src/test/java/org/mifos/integrationtest/cucumber/stepdef/PayerFundTransferDef.java index 5a4c04263..ee8a71f11 100644 --- a/src/test/java/org/mifos/integrationtest/cucumber/stepdef/PayerFundTransferDef.java +++ b/src/test/java/org/mifos/integrationtest/cucumber/stepdef/PayerFundTransferDef.java @@ -127,7 +127,7 @@ protected String setBodySavingsProduct() throws JsonProcessingException { String shortName = getAlphaNumericString(4); PostSavingsProductsRequest savingsProductsRequest = new PostSavingsProductsRequest(); - savingsProductsRequest.setCurrencyCode("USD"); + savingsProductsRequest.setCurrencyCode("TZS"); savingsProductsRequest.setDigitsAfterDecimal(2); savingsProductsRequest.setInterestCompoundingPeriodType(1); savingsProductsRequest.setInterestPostingPeriodType(4); @@ -151,11 +151,11 @@ protected String setBodySavingsApprove() throws JsonProcessingException { return objectMapper.writeValueAsString(savingsApprove); } - protected String setBodySavingsAccount(String client) throws JsonProcessingException { + protected String setBodySavingsAccount(String client, String interopId) throws JsonProcessingException { // Getting resourceId and clientId PostClientsResponse createPayerClientResponse; - if (client.equals("payer")) { + if (("payer").equals(client)) { createPayerClientResponse = objectMapper.readValue(responsePayerClient, PostClientsResponse.class); } else { createPayerClientResponse = objectMapper.readValue(responsePayeeClient, PostClientsResponse.class); @@ -165,7 +165,7 @@ protected String setBodySavingsAccount(String client) throws JsonProcessingExcep PostSavingsProductsResponse.class); String date = getCurrentDate(); setcurrentDate(date); - externalId = UUID.randomUUID().toString(); + externalId = interopId; PostSavingsAccountsRequest savingsAccountsRequest = new PostSavingsAccountsRequest(); savingsAccountsRequest.setClientId(createPayerClientResponse.getClientId()); savingsAccountsRequest.setProductId(savingsProductResponse.getResourceId()); @@ -208,13 +208,13 @@ protected String setSavingsDepositAccount(int amount) throws JsonProcessingExcep return objectMapper.writeValueAsString(savingsAccountDeposit); } - protected String setBodyPayerClient() throws JsonProcessingException { + protected String setBodyPayerClient(String firstName, String lastName) throws JsonProcessingException { String date = getCurrentDate(); PostClientsRequest postClientsRequest = new PostClientsRequest(); postClientsRequest.setOfficeId(1); postClientsRequest.setLegalFormId(1); - postClientsRequest.setFirstname("John"); - postClientsRequest.setLastname("Wick"); + postClientsRequest.setFirstname(firstName); + postClientsRequest.setLastname(lastName); postClientsRequest.setActive(true); postClientsRequest.setLocale("en"); postClientsRequest.setDateFormat("dd MMMM yyyy"); @@ -223,13 +223,13 @@ protected String setBodyPayerClient() throws JsonProcessingException { return objectMapper.writeValueAsString(postClientsRequest); } - protected String setBodyPayeeClient() throws JsonProcessingException { + protected String setBodyPayeeClient(String firstName, String lastName) throws JsonProcessingException { String date = getCurrentDate(); PostClientsRequest postClientsRequest = new PostClientsRequest(); postClientsRequest.setOfficeId(1); postClientsRequest.setLegalFormId(1); - postClientsRequest.setFirstname("John"); - postClientsRequest.setLastname("Wick"); + postClientsRequest.setFirstname(firstName); + postClientsRequest.setLastname(lastName); postClientsRequest.setActive(true); postClientsRequest.setLocale("en"); postClientsRequest.setDateFormat("dd MMMM yyyy"); @@ -238,11 +238,11 @@ protected String setBodyPayeeClient() throws JsonProcessingException { return objectMapper.writeValueAsString(postClientsRequest); } - protected String setBodyClient(String client) throws JsonProcessingException { + protected String setBodyClient(String client, String firstName, String lastName) throws JsonProcessingException { if (client.equals("payer")) { - return setBodyPayerClient(); + return setBodyPayerClient(firstName, lastName); } else if (client.equals("payee")) { - return setBodyPayeeClient(); + return setBodyPayeeClient(firstName, lastName); } return client; } @@ -254,7 +254,7 @@ protected String setBodyPayeeQuoteRequest(String payerIdentifier, String payeeId requestDTO.setPayer(getParty(payerIdentifier, mojaloopConfig.payerFspId)); requestDTO.setPayee(getParty(payeeIdentifier, mojaloopConfig.payeeFspId)); requestDTO.setAmountType(AmountType.RECEIVE); - requestDTO.setAmount(new MoneyData(amount, "USD")); + requestDTO.setAmount(new MoneyData(amount, "TZS")); requestDTO.setTransactionId(UUID.randomUUID().toString()); requestDTO.setQuoteId(quoteId); TransactionType transactionType = new TransactionType(); @@ -277,7 +277,7 @@ protected String setBodyPayeeTransferRequest(String amount, String ilpPacket, St requestDTO.setTransferId(UUID.randomUUID().toString()); requestDTO.setPayeeFsp(mojaloopConfig.payerFspId); requestDTO.setPayeeFsp(mojaloopConfig.payeeFspId); - requestDTO.setAmount(new MoneyData(amount, "USD")); + requestDTO.setAmount(new MoneyData(amount, "TZS")); requestDTO.setIlpPacket(ilpPacket); requestDTO.setCondition(condition); return objectMapper.writeValueAsString(requestDTO); diff --git a/src/test/java/org/mifos/integrationtest/cucumber/stepdef/PayerFundTransferStepDef.java b/src/test/java/org/mifos/integrationtest/cucumber/stepdef/PayerFundTransferStepDef.java index 3da9ae9f7..8f6761119 100644 --- a/src/test/java/org/mifos/integrationtest/cucumber/stepdef/PayerFundTransferStepDef.java +++ b/src/test/java/org/mifos/integrationtest/cucumber/stepdef/PayerFundTransferStepDef.java @@ -33,6 +33,7 @@ import org.mifos.integrationtest.common.Utils; import org.mifos.integrationtest.config.MojaloopConfig; import org.mifos.integrationtest.config.PayerFundTransferConfig; +import org.mifos.integrationtest.util.Util; import org.springframework.beans.factory.annotation.Autowired; public class PayerFundTransferStepDef extends BaseStepDef { @@ -42,6 +43,8 @@ public class PayerFundTransferStepDef extends BaseStepDef { private static String payer_identifier; + private static String savings_account_id; + private static String payee_identifier; private static String quoteId; @@ -66,34 +69,46 @@ public class PayerFundTransferStepDef extends BaseStepDef { public void setTenantForPayer(String client) { String tenant; logger.info(client); - if (client.equals("payer")) { - tenant = transferConfig.payerTenant; - fundTransferDef.setPayerTenant(tenant); - scenarioScopeState.tenant = tenant; - } else { - tenant = transferConfig.payeeTenant; - fundTransferDef.setPayeeTenant(tenant); - scenarioScopeState.tenant = tenant; + switch (client) { + case "payer" -> { + tenant = transferConfig.payerTenant; + fundTransferDef.setPayerTenant(tenant); + } + case "payee2" -> { + tenant = transferConfig.payeeTenant2; + fundTransferDef.setPayeeTenant(tenant); + } + case "payee3" -> { + tenant = transferConfig.payeeTenant3; + fundTransferDef.setPayeeTenant(tenant); + } + default -> { + tenant = transferConfig.payeeTenant; + fundTransferDef.setPayeeTenant(tenant); + } } + scenarioScopeState.tenant = tenant; assertThat(tenant).isNotEmpty(); fundTransferDef.setTenant(tenant); logger.info(tenant); } - @When("I call the create client endpoint for {string}") - public void callCreateClientEndpoint(String client) throws JsonProcessingException { + @When("I call the create client endpoint for {string} with account holder name as {string} {string}") + public void callCreateClientEndpoint(String client, String firstName, String lastName) throws JsonProcessingException { RequestSpecification requestSpec = Utils.getDefaultSpec(); requestSpec = fundTransferDef.setHeaders(requestSpec); - logger.info(client); - - fundTransferDef.createClientBody = fundTransferDef.setBodyClient(client); + if (firstName == null) { + firstName = "Claudia"; + lastName = "Cardinale"; + } + fundTransferDef.createClientBody = fundTransferDef.setBodyClient(client, firstName, lastName); // Calling savings product endpoint String clientResponse = RestAssured.given(requestSpec).baseUri(transferConfig.clientBaseUrl).body(fundTransferDef.createClientBody) .expect().spec(new ResponseSpecBuilder().expectStatusCode(200).build()).when().post(transferConfig.clientEndpoint) .andReturn().asString(); - if (client.equals("payer")) { + if ("payer".equals(client)) { fundTransferDef.responsePayerClient = clientResponse; assertThat(fundTransferDef.responsePayerClient).isNotEmpty(); } else { @@ -118,12 +133,14 @@ public void callCreateSavingsProductEndpoint(String client) throws JsonProcessin assertThat(fundTransferDef.responseSavingsProduct).isNotEmpty(); } - @When("I call the create savings account endpoint for {string}") - public void callCreateSavingsAccountEndpoint(String client) throws JsonProcessingException { + @When("I call the create savings account endpoint for {string} with accountId {string}") + public void callCreateSavingsAccountEndpoint(String client, String interopId) throws JsonProcessingException { // Setting headers and body RequestSpecification requestSpec = Utils.getDefaultSpec(); requestSpec = fundTransferDef.setHeaders(requestSpec); - fundTransferDef.savingsAccountBody = fundTransferDef.setBodySavingsAccount(client); + interopId = UUID.randomUUID().toString(); + + fundTransferDef.savingsAccountBody = fundTransferDef.setBodySavingsAccount(client, interopId); // Calling savings product endpoint String responseSavingsAccount = RestAssured.given(requestSpec).baseUri(transferConfig.savingsBaseUrl) .body(fundTransferDef.savingsAccountBody).expect().spec(new ResponseSpecBuilder().expectStatusCode(200).build()).when() @@ -148,7 +165,7 @@ public void callCreateInteropIdentifierEndpoint(String client) throws JsonProces fundTransferDef.interopIdentifierBody = fundTransferDef.setBodyInteropIdentifier(); // Setting account ID in path - String responseSavingsAccount = client.equals("payer") ? fundTransferDef.responseSavingsAccountPayer + String responseSavingsAccount = ("payer").equals(client) ? fundTransferDef.responseSavingsAccountPayer : fundTransferDef.responseSavingsAccountPayee; PostSavingsAccountsResponse savingsAccountResponse = objectMapper.readValue(responseSavingsAccount, @@ -172,7 +189,44 @@ public void callCreateInteropIdentifierEndpoint(String client) throws JsonProces .body(fundTransferDef.interopIdentifierBody).expect().spec(new ResponseSpecBuilder().expectStatusCode(200).build()).when() .post(endpoint).andReturn().asString(); - logger.info("Interop Identifier Response: " + fundTransferDef.responseInteropIdentifier); + logger.info("Interop Identifier Response: {}", fundTransferDef.responseInteropIdentifier); + assertThat(fundTransferDef.responseInteropIdentifier).isNotEmpty(); + } + + @Then("I call the interop identifier endpoint for {string} and accountId {string}") + public void callCreateInteropBudgetIdentifierEndpoint(String client, String accountId) throws JsonProcessingException { + // Setting headers and body + RequestSpecification requestSpec = Utils.getDefaultSpec(); + requestSpec = fundTransferDef.setHeaders(requestSpec); + fundTransferDef.interopIdentifierBody = fundTransferDef.setBodyInteropIdentifier(); + // Setting account ID in path + + String responseSavingsAccount = ("payer").equals(client) ? fundTransferDef.responseSavingsAccountPayer + : fundTransferDef.responseSavingsAccountPayee; + + PostSavingsAccountsResponse savingsAccountResponse = objectMapper.readValue(responseSavingsAccount, + PostSavingsAccountsResponse.class); + savings_account_id = savingsAccountResponse.getSavingsId().toString(); + + if (client.equals("payer")) { + payer_identifier = accountId; + scenarioScopeState.payerIdentifier = accountId; + } else { + payee_identifier = accountId; + scenarioScopeState.payeeIdentifier = accountId; + } + + String endpoint = transferConfig.interopIdentifierEndpoint; + String identifierType = "MSISDN"; + endpoint = Util.getFormattedEndpoint(endpoint, "{{identifierType}}", identifierType); + endpoint = Util.getFormattedEndpoint(endpoint, "{{identifier}}", accountId); + + // Calling Interop Identifier endpoint + fundTransferDef.responseInteropIdentifier = RestAssured.given(requestSpec).baseUri(transferConfig.savingsBaseUrl) + .body(fundTransferDef.interopIdentifierBody).expect().spec(new ResponseSpecBuilder().expectStatusCode(200).build()).when() + .post(endpoint).andReturn().asString(); + + logger.info("Interop Identifier Response: {}", fundTransferDef.responseInteropIdentifier); assertThat(fundTransferDef.responseInteropIdentifier).isNotEmpty(); } @@ -196,7 +250,31 @@ public void callApproveSavingsEndpoint(String command, String client) throws Jso .body(fundTransferDef.savingsApproveBody).expect().spec(new ResponseSpecBuilder().expectStatusCode(200).build()).when() .post(endpoint).andReturn().asString(); - logger.info("Savings Approve Response: " + fundTransferDef.responseSavingsApprove); + logger.info("Savings Approve Response: {}", fundTransferDef.responseSavingsApprove); + assertThat(fundTransferDef.responseSavingsApprove).isNotEmpty(); + } + + @Then("I approve the deposit for Budget Account with command {string} for {string}") + public void callApproveBudgetAccountEndpoint(String command, String client) throws JsonProcessingException { + // Setting headers and body + RequestSpecification requestSpec = Utils.getDefaultSpec(); + requestSpec = fundTransferDef.setHeaders(requestSpec); + requestSpec.queryParam("command", command); + fundTransferDef.savingsApproveBody = fundTransferDef.setBodySavingsApprove(); + String endpoint = transferConfig.savingsApproveEndpoint; + + if (client.equals("payer")) { + endpoint = Util.getFormattedEndpoint(endpoint, "{{savingsAccId}}", savings_account_id); + } else { + endpoint = Util.getFormattedEndpoint(endpoint, "{{savingsAccId}}", savings_account_id); + } + + // Calling create loan account endpoint + fundTransferDef.responseSavingsApprove = RestAssured.given(requestSpec).baseUri(transferConfig.savingsBaseUrl) + .body(fundTransferDef.savingsApproveBody).expect().spec(new ResponseSpecBuilder().expectStatusCode(200).build()).when() + .post(endpoint).andReturn().asString(); + + logger.info("Savings Approve Response: {}", fundTransferDef.responseSavingsApprove); assertThat(fundTransferDef.responseSavingsApprove).isNotEmpty(); } @@ -219,7 +297,30 @@ public void callSavingsActivateEndpoint(String command, String client) throws Js .body(fundTransferDef.savingsActivateBody).expect().spec(new ResponseSpecBuilder().expectStatusCode(200).build()).when() .post(endpoint).andReturn().asString(); - logger.info("Savings Activate Response: " + fundTransferDef.responseSavingsActivate); + logger.info("Savings Activate Response: {}", fundTransferDef.responseSavingsActivate); + assertThat(fundTransferDef.responseSavingsActivate).isNotEmpty(); + } + + @When("I activate the budget account with command {string} for {string}") + public void callBudgetAccountActivateEndpoint(String command, String client) throws JsonProcessingException { + // Setting headers and body + RequestSpecification requestSpec = Utils.getDefaultSpec(); + requestSpec = fundTransferDef.setHeaders(requestSpec); + requestSpec.queryParam("command", command); + fundTransferDef.savingsActivateBody = fundTransferDef.setBodySavingsActivate(); + + String endpoint = transferConfig.savingsActivateEndpoint; + if (client.equals("payer")) { + endpoint = Util.getFormattedEndpoint(endpoint, "{{savingsAccId}}", savings_account_id); + } else { + endpoint = Util.getFormattedEndpoint(endpoint, "{{savingsAccId}}", savings_account_id); + } + // Calling create loan account endpoint + fundTransferDef.responseSavingsActivate = RestAssured.given(requestSpec).baseUri(transferConfig.savingsBaseUrl) + .body(fundTransferDef.savingsActivateBody).expect().spec(new ResponseSpecBuilder().expectStatusCode(200).build()).when() + .post(endpoint).andReturn().asString(); + + logger.info("Savings Activate Response: {}", fundTransferDef.responseSavingsActivate); assertThat(fundTransferDef.responseSavingsActivate).isNotEmpty(); } @@ -396,6 +497,7 @@ public void payerFundTransfer(String amount) throws JSONException { RequestSpecification requestSpec = Utils.getDefaultSpec(transferConfig.payerTenant); requestSpec.header(Utils.X_CORRELATIONID, UUID.randomUUID()); + requestSpec.header("X-PayeeDFSP-ID", fundTransferDef.payeeTenant); // requestSpec.header("Platform-TenantId", transferConfig.payerTenant); String requestBody = TransferHelper @@ -488,9 +590,9 @@ public void getCurrentBalance(String client, Long amount) throws JsonProcessingE @When("I create and setup a {string} with account balance of {int}") public void consolidatedPayerCreationSteps(String client, int amount) throws JsonProcessingException { setTenantForPayer(client); - callCreateClientEndpoint(client); + callCreateClientEndpoint(client, null, null); callCreateSavingsProductEndpoint(client); - callCreateSavingsAccountEndpoint(client); + callCreateSavingsAccountEndpoint(client, null); callCreateInteropIdentifierEndpoint(client); callApproveSavingsEndpoint("approve", client); callSavingsActivateEndpoint("activate", client); @@ -517,7 +619,7 @@ public void createCsvWithHeaders(String fileName) throws IOException { public void addRowToCsvFile(String paymentMode, int transferAmount, int id) throws IOException { String[] row = { String.valueOf(id), UUID.randomUUID().toString(), paymentMode, "msisdn", scenarioScopeState.payerIdentifier, - "msisdn", scenarioScopeState.payeeIdentifier, String.valueOf(transferAmount), "USD", "Test Payee Payment" }; + "msisdn", scenarioScopeState.payeeIdentifier, String.valueOf(transferAmount), "TZS", "Test Payee Payment" }; String filePath = Utils.getAbsoluteFilePathToResource(scenarioScopeState.filename); csvHelper.addRow(filePath, row); scenarioScopeState.gsmaP2PAmtDebit = scenarioScopeState.gsmaP2PAmtDebit + transferAmount; @@ -534,7 +636,7 @@ public void addRowToCsvFileForCombinedTestCases(String paymentMode, int transfer } String[] row = { String.valueOf(id), UUID.randomUUID().toString(), paymentMode, "msisdn", scenarioScopeState.payerIdentifier, - "msisdn", scenarioScopeState.payeeIdentifier, String.valueOf(transferAmount), "USD", "Test Payee Payment" }; + "msisdn", scenarioScopeState.payeeIdentifier, String.valueOf(transferAmount), "TZS", "Test Payee Payment" }; String filePath = Utils.getAbsoluteFilePathToResource(scenarioScopeState.filename); csvHelper.addRow(filePath, row); scenarioScopeState.gsmaP2PAmtDebit = scenarioScopeState.gsmaP2PAmtDebit + transferAmount; @@ -544,11 +646,52 @@ public void addRowToCsvFileForCombinedTestCases(String paymentMode, int transfer scenarioScopeState.gsmaP2PAmtDebitForBatch[id + 1] = transferAmount; } + @When("I create and setup a {string} with id {string} and account balance of {int} for all combine test cases") + public void consolidatedPayeeCreationStepsForAllCombinedTestsCases(String client, String id, int amount) + throws JsonProcessingException { + setTenantForPayer(client); + callCreateClientEndpoint(client, null, null); + callCreateSavingsProductEndpoint(client); + callCreateSavingsAccountEndpoint(client, null); + callCreateInteropIdentifierEndpoint(client); + callApproveSavingsEndpoint("approve", client); + callSavingsActivateEndpoint("activate", client); + callDepositAccountEndpoint("deposit", amount, client); + if (client.equals("payer")) { + if (scenarioScopeState.initialBalForPayerForBatch == null || id.equals("1")) { + scenarioScopeState.initialBalForPayerForBatch = new int[14]; + } + scenarioScopeState.initialBalForPayerForBatch[Integer.parseInt(id)] = amount; + assertThat(scenarioScopeState.initialBalForPayerForBatch[Integer.parseInt(id)]).isNotNull(); + + } else if (("payee").equals(client)) { + if (scenarioScopeState.initialBalForPayeeForBatch == null || id.equals("1")) { + scenarioScopeState.initialBalForPayeeForBatch = new int[14]; + } + scenarioScopeState.initialBalForPayeeForBatch[Integer.parseInt(id)] = amount; + assertThat(scenarioScopeState.initialBalForPayeeForBatch[Integer.parseInt(id)]).isNotNull(); + } + } + + @Then("add row to csv with current payer and payee, payment mode as {string} and transfer amount {int} and id {int} for all combine test cases") + public void addRowToCsvFileForAllCombinedTestCases(String paymentMode, int transferAmount, int id) throws IOException { + + String[] row = { String.valueOf(id), UUID.randomUUID().toString(), paymentMode, "msisdn", scenarioScopeState.payerIdentifier, + "msisdn", scenarioScopeState.payeeIdentifier, String.valueOf(transferAmount), "TZS", "Test Payee Payment" }; + String filePath = Utils.getAbsoluteFilePathToResource(scenarioScopeState.filename); + csvHelper.addRow(filePath, row); + scenarioScopeState.gsmaP2PAmtDebit = scenarioScopeState.gsmaP2PAmtDebit + transferAmount; + if (scenarioScopeState.gsmaP2PAmtDebitForBatch == null || id == 1) { + scenarioScopeState.gsmaP2PAmtDebitForBatch = new int[14]; + } + scenarioScopeState.gsmaP2PAmtDebitForBatch[id + 1] = transferAmount; + } + @Then("add last row to csv with current payer and payee, payment mode as {string} and transfer amount {int} and id {int}") public void addLastRowToCsvFile(String paymentMode, int transferAmount, int id) throws IOException { String[] row = { String.valueOf(id), UUID.randomUUID().toString(), paymentMode, "msisdn", scenarioScopeState.payerIdentifier, - "msisdn", scenarioScopeState.payeeIdentifier, String.valueOf(transferAmount), "USD", "Test Payee Payment" }; + "msisdn", scenarioScopeState.payeeIdentifier, String.valueOf(transferAmount), "TZS", "Test Payee Payment" }; String filePath = Utils.getAbsoluteFilePathToResource(scenarioScopeState.filename); csvHelper.addLastRow(filePath, row); scenarioScopeState.gsmaP2PAmtDebit = scenarioScopeState.gsmaP2PAmtDebit + transferAmount; @@ -559,21 +702,21 @@ public void addLastRowToCsvFile(String paymentMode, int transferAmount, int id) @When("I create and setup a {string} with id {string} and account balance of {int}") public void consolidatedPayeeCreationSteps(String client, String id, int amount) throws JsonProcessingException { setTenantForPayer(client); - callCreateClientEndpoint(client); + callCreateClientEndpoint(client, null, null); callCreateSavingsProductEndpoint(client); - callCreateSavingsAccountEndpoint(client); + callCreateSavingsAccountEndpoint(client, null); callCreateInteropIdentifierEndpoint(client); callApproveSavingsEndpoint("approve", client); callSavingsActivateEndpoint("activate", client); callDepositAccountEndpoint("deposit", amount, client); - if (client.equals("payer")) { + if (("payer").equals(client)) { if (scenarioScopeState.initialBalForPayerForBatch == null) { scenarioScopeState.initialBalForPayerForBatch = new int[4]; } scenarioScopeState.initialBalForPayerForBatch[Integer.parseInt(id)] = amount; assertThat(scenarioScopeState.initialBalForPayerForBatch[Integer.parseInt(id)]).isNotNull(); - } else if (client.equals("payee")) { + } else if (("payee").equals(client)) { if (scenarioScopeState.initialBalForPayeeForBatch == null) { scenarioScopeState.initialBalForPayeeForBatch = new int[4]; } @@ -585,9 +728,9 @@ public void consolidatedPayeeCreationSteps(String client, String id, int amount) @When("I create and setup a {string} with id {string} and account balance of {int} for combine test cases") public void consolidatedPayeeCreationStepsForCombinedTestsCases(String client, String id, int amount) throws JsonProcessingException { setTenantForPayer(client); - callCreateClientEndpoint(client); + callCreateClientEndpoint(client, null, null); callCreateSavingsProductEndpoint(client); - callCreateSavingsAccountEndpoint(client); + callCreateSavingsAccountEndpoint(client, null); callCreateInteropIdentifierEndpoint(client); callApproveSavingsEndpoint("approve", client); callSavingsActivateEndpoint("activate", client); @@ -608,4 +751,50 @@ public void consolidatedPayeeCreationStepsForCombinedTestsCases(String client, S } } + @Then("I check whether budget account exists with accoundId {string}") + public void budgetAccountExistsWithAccoundId(String accountId) throws JsonProcessingException { + RequestSpecification requestSpec = Utils.getDefaultSpec(); + requestSpec = fundTransferDef.setHeaders(requestSpec); + // Setting account ID in path + + String endpoint = transferConfig.interopIdentifierEndpoint; + String identifierType = "MSISDN"; + endpoint = Util.getFormattedEndpoint(endpoint, "{{identifierType}}", identifierType); + endpoint = Util.getFormattedEndpoint(endpoint, "{{identifier}}", accountId); + try { + // Calling Interop Identifier endpoint + fundTransferDef.responseInteropIdentifier = RestAssured.given(requestSpec).baseUri(transferConfig.savingsBaseUrl).expect() + .spec(new ResponseSpecBuilder().build()).when().delete(endpoint).andReturn().asString(); + } catch (Exception e) { + logger.error("Error checking account existence: ", e); + throw new RuntimeException("Failed to check account existence", e); + } + logger.info("Interop Identifier Response: {}", fundTransferDef.responseInteropIdentifier); + assertThat(fundTransferDef.responseInteropIdentifier).isNotEmpty(); + } + + @Then("add row to csv with current ministry and payee {string}, payment mode as {string} and transfer amount {int} and id {int}") + public void addRowToCsvWithCurrentMinistryAndPayeePaymentModeAsAndTransferAmountAndId(String payee_identifier, String paymentMode, + int transferAmount, int id) throws IOException { + String[] row = { String.valueOf(id), UUID.randomUUID().toString(), paymentMode, "msisdn", "N/A", "msisdn", payee_identifier, + String.valueOf(transferAmount), "TZS", "Test Payee Payment" }; + String filePath = Utils.getAbsoluteFilePathToResource(scenarioScopeState.filename); + scenarioScopeState.batchDebitAmt = scenarioScopeState.batchDebitAmt + transferAmount; + if (scenarioScopeState.bulkTransactionList == null) { + scenarioScopeState.bulkTransactionList = new int[9]; + } + scenarioScopeState.bulkTransactionList[id + 1] = transferAmount; + csvHelper.addRow(filePath, row); + } + + @Then("add last row to csv with current ministry and payee {string}, payment mode as {string} and transfer amount {int} and id {int}") + public void addLastRowToCsvWithCurrentMinistryAndPayeePaymentModeAsAndTransferAmountAndId(String payee_identifier, String paymentMode, + int transferAmount, int id) throws IOException { + String[] row = { String.valueOf(id), UUID.randomUUID().toString(), paymentMode, "msisdn", "N/A", "msisdn", payee_identifier, + String.valueOf(transferAmount), "TZS", "Test Payee Payment" }; + String filePath = Utils.getAbsoluteFilePathToResource(scenarioScopeState.filename); + csvHelper.addLastRow(filePath, row); + scenarioScopeState.batchDebitAmt = scenarioScopeState.batchDebitAmt + transferAmount; + scenarioScopeState.bulkTransactionList[id + 1] = transferAmount; + } } diff --git a/src/test/java/org/mifos/integrationtest/cucumber/stepdef/ScenarioScopeState.java b/src/test/java/org/mifos/integrationtest/cucumber/stepdef/ScenarioScopeState.java index a0dde5444..7317c9443 100644 --- a/src/test/java/org/mifos/integrationtest/cucumber/stepdef/ScenarioScopeState.java +++ b/src/test/java/org/mifos/integrationtest/cucumber/stepdef/ScenarioScopeState.java @@ -103,6 +103,8 @@ public class ScenarioScopeState { protected int[] initialBalForPayeeForBatch; protected int[] initialBalForPayerForBatch; protected int[] gsmaP2PAmtDebitForBatch; + protected int[] bulkTransactionList; + protected int batchDebitAmt; protected List registeredBeneficiary = new ArrayList<>(); protected String serialNumber; diff --git a/src/test/java/org/mifos/integrationtest/util/Util.java b/src/test/java/org/mifos/integrationtest/util/Util.java new file mode 100644 index 000000000..f1507e39e --- /dev/null +++ b/src/test/java/org/mifos/integrationtest/util/Util.java @@ -0,0 +1,12 @@ +package org.mifos.integrationtest.util; + +public final class Util { + + private Util() { + throw new UnsupportedOperationException("Utility class"); + } + + public static String getFormattedEndpoint(String formattedTemplate, String tobeReplaced, String replacedWith) { + return formattedTemplate.replace(tobeReplaced, replacedWith); + } +} diff --git a/src/test/java/resources/batch.feature b/src/test/java/resources/batch.feature index 7405897c2..2007e8930 100644 --- a/src/test/java/resources/batch.feature +++ b/src/test/java/resources/batch.feature @@ -149,8 +149,8 @@ Feature: Batch Details API test Scenario: BD-011 Batch test for payerIdentifier resolution using budgetAccount info Given I have tenant as "paymentBB2" And I have the demo csv file "payerIdentifier-resolution-using-budgetAccount.csv" - And I have the registeringInstituteId "123" - And I have the programId "SocialWelfare" + And I have the registeringInstituteId "SocialWelfare" + And I have the programId "Education" And I generate clientCorrelationId And I have private key And I generate signature @@ -269,7 +269,7 @@ Feature: Batch Details API test Given I will start the mock server And I can register the stub with "/authorization/callback" endpoint for "POST" request with status of 200 Then I will update the mock server and register stub as done - When I create an AuthorizationRequest for Batch Authorization with batch ID as "1234", payerIdentifier as "5678", currency as "USD" and amount as "30" + When I create an AuthorizationRequest for Batch Authorization with batch ID as "1234", payerIdentifier as "5678", currency as "TZS" and amount as "30" And I call the Authorization API with batchId as "1234" and expected status of 202 and stub "/authorization/callback" # And I will sleep for 5000 millisecond Then I should be able to verify that the "POST" method to "/authorization/callback" endpoint received a request with authorization status diff --git a/src/test/java/resources/batch_demo_csv/batchTransactioClosedLoopMojaloopFundTransfer.csv b/src/test/java/resources/batch_demo_csv/batchTransactioClosedLoopMojaloopFundTransfer.csv new file mode 100644 index 000000000..7a18c876b --- /dev/null +++ b/src/test/java/resources/batch_demo_csv/batchTransactioClosedLoopMojaloopFundTransfer.csv @@ -0,0 +1,9 @@ +id,request_id,payment_mode,payer_identifier_type,payer_identifier,payee_identifier_type,payee_identifier,amount,currency,note +0,dbe1d284-1bea-4f03-bc0f-8faece9f5da2,closedloop,msisdn,2300,msisdn,1759,10,TZS,Test Payee Payment +1,696a9340-adc2-48e3-a1d1-10a239bc412b,closedloop,msisdn,2301,msisdn,1760,5,TZS,Test Payee Payment +2,8e2eaf78-4566-438e-9183-ec02288fd16b,closedloop,msisdn,2302,msisdn,1761,5,TZS,Test Payee Payment +3,b9bc0bc8-cf25-417a-adbc-97345330737a,closedloop,msisdn,2303,msisdn,1762,5,TZS,Test Payee Payment +4,a59acbe1-4ebb-4618-bda3-630f2c306e09,closedloop,msisdn,2304,msisdn,1763,5,TZS,Test Payee Payment +5,d79a4bc6-f9ec-4eba-beb7-96277bd832b3,mojaloop,msisdn,2305,msisdn,1764,3,TZS,Test Payee Payment +6,1f838585-5091-44ef-9432-77d13b9c4583,mojaloop,msisdn,2306,msisdn,1764,2,TZS,Test Payee Payment +7,94fd7bd1-7482-4f4f-bf12-a21ab4b550a8,mojaloop,msisdn,2307,msisdn,1765,1,TZS,Test Payee Payment diff --git a/src/test/java/resources/batch_demo_csv/batchTransaction.csv b/src/test/java/resources/batch_demo_csv/batchTransaction.csv new file mode 100644 index 000000000..78309bd05 --- /dev/null +++ b/src/test/java/resources/batch_demo_csv/batchTransaction.csv @@ -0,0 +1,4 @@ +id,request_id,payment_mode,payer_identifier_type,payer_identifier,payee_identifier_type,payee_identifier,amount,currency,note +0,ed6bf87e-4bda-44dc-be52-004e71438f0f,mojaloop,msisdn,345,msisdn,363,3,TZS,Test Payee Payment +1,25ddc445-069a-417b-b62a-f5b952ac313e,mojaloop,msisdn,346,msisdn,363,2,TZS,Test Payee Payment +2,0842d2df-0aec-4312-ada4-c3dd2be1ed80,mojaloop,msisdn,347,msisdn,364,1,TZS,Test Payee Payment diff --git a/src/test/java/resources/batch_demo_csv/batchTransactionGsma.csv b/src/test/java/resources/batch_demo_csv/batchTransactionGsma.csv index e8e8fcd26..23a8ad31f 100644 --- a/src/test/java/resources/batch_demo_csv/batchTransactionGsma.csv +++ b/src/test/java/resources/batch_demo_csv/batchTransactionGsma.csv @@ -1,4 +1,4 @@ id,request_id,payment_mode,payer_identifier_type,payer_identifier,payee_identifier_type,payee_identifier,amount,currency,note -0,1fe8af66-9a34-4b92-bbd5-1a116b635bb5,gsma,msisdn,4004,msisdn,3815,10,USD,Test Payee Payment -1,dbbe52aa-20a0-4eb9-80a0-ad6df8068e40,gsma,msisdn,4005,msisdn,3816,5,USD,Test Payee Payment -2,021955bc-8a96-45d3-bec0-69e365d5369c,gsma,msisdn,4006,msisdn,3817,1,USD,Test Payee Payment \ No newline at end of file +0,1fe8af66-9a34-4b92-bbd5-1a116b635bb5,gsma,msisdn,4004,msisdn,3815,10,TZS,Test Payee Payment +1,dbbe52aa-20a0-4eb9-80a0-ad6df8068e40,gsma,msisdn,4005,msisdn,3816,5,TZS,Test Payee Payment +2,021955bc-8a96-45d3-bec0-69e365d5369c,gsma,msisdn,4006,msisdn,3817,1,TZS,Test Payee Payment diff --git a/src/test/java/resources/batch_demo_csv/batchTransactionGsmaClosedLoop.csv b/src/test/java/resources/batch_demo_csv/batchTransactionGsmaClosedLoop.csv index f03d5970e..ad1b9b78f 100644 --- a/src/test/java/resources/batch_demo_csv/batchTransactionGsmaClosedLoop.csv +++ b/src/test/java/resources/batch_demo_csv/batchTransactionGsmaClosedLoop.csv @@ -1,9 +1,9 @@ id,request_id,payment_mode,payer_identifier_type,payer_identifier,payee_identifier_type,payee_identifier,amount,currency,note -0,3e2dcaf6-7f66-4460-aa03-2be3a12222eb,closedloop,msisdn,5397,msisdn,5141,10,USD,Test Payee Payment -1,b9760d58-676a-4353-a555-3a3b63f1760a,closedloop,msisdn,5398,msisdn,5142,5,USD,Test Payee Payment -2,00ffd1a8-c7a7-4943-b68f-11df7c2763a5,closedloop,msisdn,5399,msisdn,5143,5,USD,Test Payee Payment -3,74a81c70-0335-45b9-877b-43b3b6ec2f16,closedloop,msisdn,5400,msisdn,5144,5,USD,Test Payee Payment -4,777035ca-a4d9-4725-b905-0c840b567c51,closedloop,msisdn,5401,msisdn,5145,5,USD,Test Payee Payment -5,f50f0d85-7fec-44ad-8a3f-0811b4926db6,gsma,msisdn,5402,msisdn,5146,6,USD,Test Payee Payment -6,9c780986-28a9-45eb-896e-1139ef2a15c2,gsma,msisdn,5403,msisdn,5147,7,USD,Test Payee Payment -7,09abfde9-73c8-45d9-a89c-9623eacddcd3,gsma,msisdn,5404,msisdn,5148,8,USD,Test Payee Payment \ No newline at end of file +0,25a92f3d-c4e6-4332-876b-3fc2f09ef272,closedloop,msisdn,3508,msisdn,2662,10,TZS,Test Payee Payment +1,fde43673-b28e-466a-80d2-4afbf13f2e58,closedloop,msisdn,3509,msisdn,2663,5,TZS,Test Payee Payment +2,57f478a0-b302-4c11-b92a-5079505dacba,closedloop,msisdn,3510,msisdn,2664,5,TZS,Test Payee Payment +3,ea15d689-432d-4a83-af20-5e1e749226a2,closedloop,msisdn,3511,msisdn,2665,5,TZS,Test Payee Payment +4,2957cd32-2818-4236-b41b-bd731c192e89,closedloop,msisdn,3512,msisdn,2666,5,TZS,Test Payee Payment +5,77335aec-69eb-4535-b7ca-ac71de2eed23,gsma,msisdn,3513,msisdn,2667,6,TZS,Test Payee Payment +6,96184a44-0b27-496c-9e73-ce4511ab4dc4,gsma,msisdn,3514,msisdn,2668,7,TZS,Test Payee Payment +7,69b31b9d-926b-4613-aa23-e96fad7fbf90,gsma,msisdn,3515,msisdn,2669,8,TZS,Test Payee Payment \ No newline at end of file diff --git a/src/test/java/resources/batch_demo_csv/bulk_payment.csv b/src/test/java/resources/batch_demo_csv/bulk_payment.csv index 31c9cee76..832bb028e 100644 --- a/src/test/java/resources/batch_demo_csv/bulk_payment.csv +++ b/src/test/java/resources/batch_demo_csv/bulk_payment.csv @@ -1,7 +1,7 @@ id,request_id,payment_mode,payer_identifier_type,payer_identifier,payee_identifier_type,payee_identifier,amount,currency,note -0,g1e22fe3-9740-4fba-97b6-78f43bfa7f2f,closedloop,accountNumber,003001003879112168,accountNumber,400173110196,850,USD,Test Payee Payment -1,72aa3ea4-e6f6-4880-877f-39f6ac4d052e,closedloop,accountNumber,003001003879112168,accountNumber,400174120160,222,USD,Test Payee Payment -2,f1e22fe3-9740-4fba-97b6-78f43bfa7f0f,closedloop,accountNumber,003001003879112168,accountNumber,400173110195,840,USD,Test Payee Payment -3,q1e22fe3-9740-4fba-97b6-78f43bfa7f2f,closedloop,accountNumber,003001003879112168,accountNumber,400173110196,750,USD,Test Payee Payment -4,a2aa3ea4-e6f6-4880-877f-39f6ac4d052e,closedloop,accountNumber,003001003879112168,accountNumber,400174120160,122,USD,Test Payee Payment -5,z1e22fe3-9740-4fba-97b6-78f43bfa7f0f,closedloop,accountNumber,003001003879112168,accountNumber,400173110195,740,USD,Test Payee Payment \ No newline at end of file +0,9b7d4130-1fbb-4ac9-819b-44c0224c0784,closedloop,msisdn,N/A,msisdn,400173110196,100,TZS,Test Payee Payment +1,7348da1e-0576-424f-b41b-9bd01ba26fe7,closedloop,msisdn,N/A,msisdn,400173110196,200,TZS,Test Payee Payment +2,3d16c00d-8b06-4876-af94-717487eecd88,closedloop,msisdn,N/A,msisdn,400174120160,300,TZS,Test Payee Payment +3,de45e6f9-6d19-488d-b5aa-e97099ea0a31,closedloop,msisdn,N/A,msisdn,400174120160,400,TZS,Test Payee Payment +4,7c3f66f2-35c1-41bf-8cc5-5a2807486fc4,closedloop,msisdn,N/A,msisdn,400173110195,700,TZS,Test Payee Payment +5,1b34dcee-a319-422b-9564-a890fa520fd3,closedloop,msisdn,N/A,msisdn,400173110195,800,TZS,Test Payee Payment \ No newline at end of file diff --git a/src/test/java/resources/batch_demo_csv/bulk_payment_closedl_mock_mojaloop.csv b/src/test/java/resources/batch_demo_csv/bulk_payment_closedl_mock_mojaloop.csv index fd9923ee8..b38c30813 100644 --- a/src/test/java/resources/batch_demo_csv/bulk_payment_closedl_mock_mojaloop.csv +++ b/src/test/java/resources/batch_demo_csv/bulk_payment_closedl_mock_mojaloop.csv @@ -1,9 +1,9 @@ id,request_id,payment_mode,payer_identifier_type,payer_identifier,payee_identifier_type,payee_identifier,amount,currency,note -0,g2e22fe3-9740-4fba-97b6-78f43bfa7f2f,closedloop,accountNumber,003001003879112168,accountNumber,400173110196,150,USD,Test Payee Payment -1,71aa3ea4-e6f6-4880-877f-39f6ac4d052e,closedloop,accountNumber,003001003879112168,accountNumber,400174120160,222,USD,Test Payee Payment -2,f4e22fe3-9740-4fba-97b6-78f43bfa7f0f,closedloop,accountNumber,003001003879112168,accountNumber,400173110195,140,USD,Test Payee Payment -3,72aa3ea4-e6f6-4880-877f-39f6ac4d052e,closedloop,accountNumber,003001003879112168,accountNumber,400174120160,220,USD,Test Payee Payment -4,77za3ea4-e6f6-4880-877f-39f6ac4d052e,closedloop,accountNumber,003001003879112168,accountNumber,400174120160,122,USD,Test Payee Payment -5,q0e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,accountNumber,003001003879112168,accountNumber,400173110196,750,USD,Test Payee Payment -6,a4aa3ea4-e6f6-4880-877f-39f6ac4d052e,mojaloop,accountNumber,003001003879112168,accountNumber,400174120160,722,USD,Test Payee Payment -7,z4e22fe3-9740-4fba-97b6-78f43bfa7f0f,mojaloop,accountNumber,003001003879112168,accountNumber,400173110195,740,USD,Test Payee Payment \ No newline at end of file +0,g2e22fe3-9740-4fba-97b6-78f43bfa7f2f,closedloop,accountNumber,003001003879112168,accountNumber,400173110196,150,TZS,Test Payee Payment +1,71aa3ea4-e6f6-4880-877f-39f6ac4d052e,closedloop,accountNumber,003001003879112168,accountNumber,400174120160,222,TZS,Test Payee Payment +2,f4e22fe3-9740-4fba-97b6-78f43bfa7f0f,closedloop,accountNumber,003001003879112168,accountNumber,400173110195,140,TZS,Test Payee Payment +3,72aa3ea4-e6f6-4880-877f-39f6ac4d052e,closedloop,accountNumber,003001003879112168,accountNumber,400174120160,220,TZS,Test Payee Payment +4,77za3ea4-e6f6-4880-877f-39f6ac4d052e,closedloop,accountNumber,003001003879112168,accountNumber,400174120160,122,TZS,Test Payee Payment +5,q0e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,accountNumber,003001003879112168,accountNumber,400173110196,750,TZS,Test Payee Payment +6,a4aa3ea4-e6f6-4880-877f-39f6ac4d052e,mojaloop,accountNumber,003001003879112168,accountNumber,400174120160,722,TZS,Test Payee Payment +7,z4e22fe3-9740-4fba-97b6-78f43bfa7f0f,mojaloop,accountNumber,003001003879112168,accountNumber,400173110195,740,TZS,Test Payee Payment diff --git a/src/test/java/resources/batch_demo_csv/deduplication-test.csv b/src/test/java/resources/batch_demo_csv/deduplication-test.csv index 6a855cff8..0cc948894 100644 --- a/src/test/java/resources/batch_demo_csv/deduplication-test.csv +++ b/src/test/java/resources/batch_demo_csv/deduplication-test.csv @@ -1,4 +1,4 @@ id,request_id,payment_mode,payer_identifier_type,payer_identifier,payee_identifier_type,payee_identifier,amount,currency,note -0,k1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,msisdn,835322416,msisdn,27713803912,10,USD,Moja bulk test -1,l9f6ac4d052e-72aa3ea4-e6f6-4880-877f,mojaloop,msisdn,835322416,msisdn,27713803912,10,USD,Moja bulk test -2,m27631f6-6dd4-4d69-b4fc-8932bd721913,mojaloop,msisdn,835322416,msisdn,27713803913,10,USD,Moja bulk test \ No newline at end of file +0,k1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,msisdn,835322416,msisdn,27713803912,10,TZS,Moja bulk test +1,l9f6ac4d052e-72aa3ea4-e6f6-4880-877f,mojaloop,msisdn,835322416,msisdn,27713803912,10,TZS,Moja bulk test +2,m27631f6-6dd4-4d69-b4fc-8932bd721913,mojaloop,msisdn,835322416,msisdn,27713803913,10,TZS,Moja bulk test diff --git a/src/test/java/resources/batch_demo_csv/payerIdentifier-resolution-using-budgetAccount.csv b/src/test/java/resources/batch_demo_csv/payerIdentifier-resolution-using-budgetAccount.csv index 879d73de3..887afb106 100644 --- a/src/test/java/resources/batch_demo_csv/payerIdentifier-resolution-using-budgetAccount.csv +++ b/src/test/java/resources/batch_demo_csv/payerIdentifier-resolution-using-budgetAccount.csv @@ -1,11 +1,11 @@ id,request_id,payment_mode,payer_identifier_type,payer_identifier,payee_identifier_type,payee_identifier,amount,currency,note -0,f1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,,,msisdn,27713803912,10,USD,Moja bulk test 1 -1,39f6ac4d052e-72aa3ea4-e6f6-4880-877f,mojaloop,,,msisdn,27713803913,20,USD,Moja bulk test 2 -2,a27631f6-6dd4-4d69-b4fc-8932bd721913,mojaloop,,,msisdn,27713803914,30,USD,Moja bulk test 3 -3,3d21e6ea-c583-44ed-b94f-af909fa7616e,mojaloop,,,msisdn,27713803915,40,USD,Moja bulk test 4 -4,15f9a0b0-2299-436d-8433-da564140ba66,mojaloop,,,msisdn,27713803916,50,USD,Moja bulk test 5 -5,f1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,,,msisdn,27713803917,60,USD,Moja bulk test 1 -6,39f6ac4d052e-72aa3ea4-e6f6-4880-877f,mojaloop,,,msisdn,27713803918,70,USD,Moja bulk test 2 -7,a27631f6-6dd4-4d69-b4fc-8932bd721913,mojaloop,,,msisdn,27713803919,80,USD,Moja bulk test 3 -8,3d21e6ea-c583-44ed-b94f-af909fa7616e,mojaloop,,,msisdn,27713803910,90,USD,Moja bulk test 4 -9,15f9a0b0-2299-436d-8433-da564140ba66,mojaloop,,,msisdn,27713803911,100,USD,Moja bulk test 5 \ No newline at end of file +0,f1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,,,msisdn,27713803912,10,TZS,Moja bulk test 1 +1,39f6ac4d052e-72aa3ea4-e6f6-4880-877f,mojaloop,,,msisdn,27713803913,20,TZS,Moja bulk test 2 +2,a27631f6-6dd4-4d69-b4fc-8932bd721913,mojaloop,,,msisdn,27713803914,30,TZS,Moja bulk test 3 +3,3d21e6ea-c583-44ed-b94f-af909fa7616e,mojaloop,,,msisdn,27713803915,40,TZS,Moja bulk test 4 +4,15f9a0b0-2299-436d-8433-da564140ba66,mojaloop,,,msisdn,27713803916,50,TZS,Moja bulk test 5 +5,f1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,,,msisdn,27713803917,60,TZS,Moja bulk test 1 +6,39f6ac4d052e-72aa3ea4-e6f6-4880-877f,mojaloop,,,msisdn,27713803918,70,TZS,Moja bulk test 2 +7,a27631f6-6dd4-4d69-b4fc-8932bd721913,mojaloop,,,msisdn,27713803919,80,TZS,Moja bulk test 3 +8,3d21e6ea-c583-44ed-b94f-af909fa7616e,mojaloop,,,msisdn,27713803910,90,TZS,Moja bulk test 4 +9,15f9a0b0-2299-436d-8433-da564140ba66,mojaloop,,,msisdn,27713803911,100,TZS,Moja bulk test 5 diff --git a/src/test/java/resources/batch_demo_csv/ph-ee-bulk-demo-6.csv b/src/test/java/resources/batch_demo_csv/ph-ee-bulk-demo-6.csv index 9e7158ee3..990eb0d09 100644 --- a/src/test/java/resources/batch_demo_csv/ph-ee-bulk-demo-6.csv +++ b/src/test/java/resources/batch_demo_csv/ph-ee-bulk-demo-6.csv @@ -1,11 +1,11 @@ id,request_id,payment_mode,payer_identifier_type,payer_identifier,payee_identifier_type,payee_identifier,amount,currency,note -0,f1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,accountNumber,0030010038791121681,accountNumber,0030010038731101961,850,USD,Test Payee Payment -1,72aa3ea4-e6f6-4880-877f-39f6ac4d052e,mojaloop,accountNumber,0030010038791121682,accountNumber,0030010038741201602,222,USD,Test Payee Payment -2,f1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,accountNumber,0030010038791121683,accountNumber,0030010038731101963,850,USD,Test Payee Payment -3,72aa3ea4-e6f6-4880-877f-39f6ac4d052e,mojaloop,accountNumber,0030010038791121684,accountNumber,0030010038741201604,222,USD,Test Payee Payment -4,f1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,accountNumber,0030010038791121685,accountNumber,0030010038731101965,850,USD,Test Payee Payment -5,72aa3ea4-e6f6-4880-877f-39f6ac4d052e,mojaloop,accountNumber,0030010038791121686,accountNumber,0030010038741201606,222,USD,Test Payee Payment -6,f1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,accountNumber,0030010038791121687,accountNumber,0030010038731101967,850,USD,Test Payee Payment -7,72aa3ea4-e6f6-4880-877f-39f6ac4d052e,mojaloop,accountNumber,0030010038791121688,accountNumber,0030010038741201608,222,USD,Test Payee Payment -8,f1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,accountNumber,0030010038791121689,accountNumber,0030010038731101969,850,USD,Test Payee Payment -9,72aa3ea4-e6f6-4880-877f-39f6ac4d052e,mojaloop,accountNumber,0030010038791121680,accountNumber,0030010038741201600,222,USD,Test Payee Payment \ No newline at end of file +0,f1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,accountNumber,0030010038791121681,accountNumber,0030010038731101961,850,TZS,Test Payee Payment +1,72aa3ea4-e6f6-4880-877f-39f6ac4d052e,mojaloop,accountNumber,0030010038791121682,accountNumber,0030010038741201602,222,TZS,Test Payee Payment +2,f1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,accountNumber,0030010038791121683,accountNumber,0030010038731101963,850,TZS,Test Payee Payment +3,72aa3ea4-e6f6-4880-877f-39f6ac4d052e,mojaloop,accountNumber,0030010038791121684,accountNumber,0030010038741201604,222,TZS,Test Payee Payment +4,f1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,accountNumber,0030010038791121685,accountNumber,0030010038731101965,850,TZS,Test Payee Payment +5,72aa3ea4-e6f6-4880-877f-39f6ac4d052e,mojaloop,accountNumber,0030010038791121686,accountNumber,0030010038741201606,222,TZS,Test Payee Payment +6,f1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,accountNumber,0030010038791121687,accountNumber,0030010038731101967,850,TZS,Test Payee Payment +7,72aa3ea4-e6f6-4880-877f-39f6ac4d052e,mojaloop,accountNumber,0030010038791121688,accountNumber,0030010038741201608,222,TZS,Test Payee Payment +8,f1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,accountNumber,0030010038791121689,accountNumber,0030010038731101969,850,TZS,Test Payee Payment +9,72aa3ea4-e6f6-4880-877f-39f6ac4d052e,mojaloop,accountNumber,0030010038791121680,accountNumber,0030010038741201600,222,TZS,Test Payee Payment diff --git a/src/test/java/resources/batch_demo_csv/ph-ee-bulk-demo-7.csv b/src/test/java/resources/batch_demo_csv/ph-ee-bulk-demo-7.csv index f3bcd6327..e4b8edd76 100644 --- a/src/test/java/resources/batch_demo_csv/ph-ee-bulk-demo-7.csv +++ b/src/test/java/resources/batch_demo_csv/ph-ee-bulk-demo-7.csv @@ -1,4 +1,4 @@ id,request_id,payment_mode,payer_identifier_type,payer_identifier,payee_identifier_type,payee_identifier,amount,currency,note -0,f1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,accountNumber,003001003879112168,accountNumber,103873110196,850,USD,Test Payee Payment -1,72aa3ea4-e6f6-4880-877f-39f6ac4d052e,mojaloop,accountNumber,003001003879112168,accountNumber,103874120160,222,USD,Test Payee Payment -2,f1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,accountNumber,003001003879112168,accountNumber,103873110195,840,USD,Test Payee Payment \ No newline at end of file +0,f1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,accountNumber,003001003879112168,accountNumber,103873110196,850,TZS,Test Payee Payment +1,72aa3ea4-e6f6-4880-877f-39f6ac4d052e,mojaloop,accountNumber,003001003879112168,accountNumber,103874120160,222,TZS,Test Payee Payment +2,f1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,accountNumber,003001003879112168,accountNumber,103873110195,840,TZS,Test Payee Payment diff --git a/src/test/java/resources/batch_demo_csv/ph-ee-bulk-demoErrorAsync-6.csv b/src/test/java/resources/batch_demo_csv/ph-ee-bulk-demoErrorAsync-6.csv index 3572bb070..4d6bb4fc0 100644 --- a/src/test/java/resources/batch_demo_csv/ph-ee-bulk-demoErrorAsync-6.csv +++ b/src/test/java/resources/batch_demo_csv/ph-ee-bulk-demoErrorAsync-6.csv @@ -1,6 +1,6 @@ id,request_id,payment_mode,payer_identifier_type,payer_identifier,payee_identifier_type,payee_identifier,amount,currency,note -0,f1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,msisdn,8353224161,msisdn,277138039121,10,USD,Moja bulk test 1 -1,39f6ac4d052e-72aa3ea4-e6f6-4880-877f,mojaloop,msisdn,8353224162,msisdn,277138039122,10,USD,Moja bulk test 2 -2,a27631f6-6dd4-4d69-b4fc-8932bd721913,mojaloop,msisdn,8353224163,msisdn,277138039124,10,USD,Moja bulk test 3 -3,3d21e6ea-c583-44ed-b94f-af909fa7616e,mojaloop,msisdn,8353224164,msisdn,277138039125,10,USD,Moja bulk test 4 -4,15f9a0b0-2299-436d-8433-da564140ba66,mojaloop,msisdn,55dghsdg667,msisdn,27713803912,10,USD,Moja bulk test 5 \ No newline at end of file +0,f1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,msisdn,8353224161,msisdn,277138039121,10,TZS,Moja bulk test 1 +1,39f6ac4d052e-72aa3ea4-e6f6-4880-877f,mojaloop,msisdn,8353224162,msisdn,277138039122,10,TZS,Moja bulk test 2 +2,a27631f6-6dd4-4d69-b4fc-8932bd721913,mojaloop,msisdn,8353224163,msisdn,277138039124,10,TZS,Moja bulk test 3 +3,3d21e6ea-c583-44ed-b94f-af909fa7616e,mojaloop,msisdn,8353224164,msisdn,277138039125,10,TZS,Moja bulk test 4 +4,15f9a0b0-2299-436d-8433-da564140ba66,mojaloop,msisdn,55dghsdg667,msisdn,27713803912,10,TZS,Moja bulk test 5 diff --git a/src/test/java/resources/batch_demo_csv/ph-ee-bulk-demoErrorSync-6.csv b/src/test/java/resources/batch_demo_csv/ph-ee-bulk-demoErrorSync-6.csv index 13736b594..e1cb4ca46 100644 --- a/src/test/java/resources/batch_demo_csv/ph-ee-bulk-demoErrorSync-6.csv +++ b/src/test/java/resources/batch_demo_csv/ph-ee-bulk-demoErrorSync-6.csv @@ -1,6 +1,6 @@ id,request_id,paymentmode,payer_identifier_type,payer_identifier,payee_identifier_type,payee_identifier,amount,currency,note -0,f1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,msisdn,835322416,msisdn,27713803912,10,USD,Moja bulk test 1 -1,39f6ac4d052e-72aa3ea4-e6f6-4880-877f,mojaloop,msisdn,835322416,msisdn,27713803912,10,USD,Moja bulk test 2 -2,a27631f6-6dd4-4d69-b4fc-8932bd721913,mojaloop,msisdn,835322416,msisdn,27713803912,10,USD,Moja bulk test 3 -3,3d21e6ea-c583-44ed-b94f-af909fa7616e,mojaloop,msisdn,835322416,msisdn,27713803912,10,USD,Moja bulk test 4 -4,15f9a0b0-2299-436d-8433-da564140ba66,mojaloop,msisdn,835322416,msisdn,27713803912,10,USD,Moja bulk test 5 \ No newline at end of file +0,f1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,msisdn,835322416,msisdn,27713803912,10,TZS,Moja bulk test 1 +1,39f6ac4d052e-72aa3ea4-e6f6-4880-877f,mojaloop,msisdn,835322416,msisdn,27713803912,10,TZS,Moja bulk test 2 +2,a27631f6-6dd4-4d69-b4fc-8932bd721913,mojaloop,msisdn,835322416,msisdn,27713803912,10,TZS,Moja bulk test 3 +3,3d21e6ea-c583-44ed-b94f-af909fa7616e,mojaloop,msisdn,835322416,msisdn,27713803912,10,TZS,Moja bulk test 4 +4,15f9a0b0-2299-436d-8433-da564140ba66,mojaloop,msisdn,835322416,msisdn,27713803912,10,TZS,Moja bulk test 5 diff --git a/src/test/java/resources/batch_demo_csv/ph-ee-bulk-splitting.csv b/src/test/java/resources/batch_demo_csv/ph-ee-bulk-splitting.csv index 1a2bd83ec..abc4f0ae0 100644 --- a/src/test/java/resources/batch_demo_csv/ph-ee-bulk-splitting.csv +++ b/src/test/java/resources/batch_demo_csv/ph-ee-bulk-splitting.csv @@ -1,13 +1,13 @@ id,request_id,payment_mode,payer_identifier_type,payer_identifier,payee_identifier_type,payee_identifier,amount,currency,note -0,f1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,accountNumber,003001003879112168,accountNumber,003001003873110196,850,USD,Test Payee Payment -1,72aa3ea4-e6f6-4880-877f-39f6ac4d052e,mojaloop,accountNumber,003001003879112168,accountNumber,003001003874120160,222,USD,Test Payee Payment -2,a1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,accountNumber,003001003879112168,accountNumber,003001003873110196,840,USD,Test Payee Payment -3,l1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,accountNumber,003001003879112168,accountNumber,003001003873110196,830,USD,Test Payee Payment -4,k2aa3ea4-e6f6-4880-877f-39f6ac4d052e,mojaloop,accountNumber,003001003879112168,accountNumber,003001003874120160,333,USD,Test Payee Payment -5,c1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,accountNumber,003001003879112168,accountNumber,003001003873110196,820,USD,Test Payee Payment -6,x1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,accountNumber,003001003879112168,accountNumber,003001003873110196,810,USD,Test Payee Payment -7,m2aa3ea4-e6f6-4880-877f-39f6ac4d052e,mojaloop,accountNumber,003001003879112168,accountNumber,003001003874120160,444,USD,Test Payee Payment -8,p1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,accountNumber,003001003879112168,accountNumber,003001003873110196,800,USD,Test Payee Payment -9,q1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,accountNumber,003001003879112168,accountNumber,003001003873110196,860,USD,Test Payee Payment -10,e2aa3ea4-e6f6-4880-877f-39f6ac4d052e,mojaloop,accountNumber,003001003879112168,accountNumber,003001003874120160,555,USD,Test Payee Payment -11,t1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,accountNumber,003001003879112168,accountNumber,003001003873110196,870,USD,Test Payee Payment \ No newline at end of file +0,f1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,accountNumber,003001003879112168,accountNumber,003001003873110196,850,TZS,Test Payee Payment +1,72aa3ea4-e6f6-4880-877f-39f6ac4d052e,mojaloop,accountNumber,003001003879112168,accountNumber,003001003874120160,222,TZS,Test Payee Payment +2,a1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,accountNumber,003001003879112168,accountNumber,003001003873110196,840,TZS,Test Payee Payment +3,l1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,accountNumber,003001003879112168,accountNumber,003001003873110196,830,TZS,Test Payee Payment +4,k2aa3ea4-e6f6-4880-877f-39f6ac4d052e,mojaloop,accountNumber,003001003879112168,accountNumber,003001003874120160,333,TZS,Test Payee Payment +5,c1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,accountNumber,003001003879112168,accountNumber,003001003873110196,820,TZS,Test Payee Payment +6,x1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,accountNumber,003001003879112168,accountNumber,003001003873110196,810,TZS,Test Payee Payment +7,m2aa3ea4-e6f6-4880-877f-39f6ac4d052e,mojaloop,accountNumber,003001003879112168,accountNumber,003001003874120160,444,TZS,Test Payee Payment +8,p1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,accountNumber,003001003879112168,accountNumber,003001003873110196,800,TZS,Test Payee Payment +9,q1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,accountNumber,003001003879112168,accountNumber,003001003873110196,860,TZS,Test Payee Payment +10,e2aa3ea4-e6f6-4880-877f-39f6ac4d052e,mojaloop,accountNumber,003001003879112168,accountNumber,003001003874120160,555,TZS,Test Payee Payment +11,t1e22fe3-9740-4fba-97b6-78f43bfa7f2f,mojaloop,accountNumber,003001003879112168,accountNumber,003001003873110196,870,TZS,Test Payee Payment diff --git a/src/test/java/resources/bulkPayment.feature b/src/test/java/resources/bulkPayment.feature index e137bb633..5836d00d2 100644 --- a/src/test/java/resources/bulkPayment.feature +++ b/src/test/java/resources/bulkPayment.feature @@ -1,14 +1,104 @@ -@gov @ext +@e2e Feature: Test ability to make payment to individual with bank account - Scenario: Input CSV file using the batch transaction API and poll batch summary API till we get completed status + @commonExtended + Scenario: BB-FSP 001 Create Budget Account and Register Payee + Given I am setting up Mojaloop + And I have the registeringInstituteId "SocialWelfare" + And I have the programId "Education" + Given I have Fineract-Platform-TenantId for "payer" + When I call the create client endpoint for "payer" with account holder name as "Ministry of SocialWelfare" "Education" + Then I call the create savings product endpoint for "payer" + When I call the create savings account endpoint for "payer" with accountId "123456789" + Then I check whether budget account exists with accoundId "123456789" + Then I call the interop identifier endpoint for "payer" and accountId "123456789" + Then I approve the deposit for Budget Account with command "approve" for "payer" + When I activate the budget account with command "activate" for "payer" + Then I call the deposit account endpoint with command "deposit" for amount 7000 for "payer" + #Registring account lookup + Then I add "payer" with account id "123456789" to als + + + When I call the create client endpoint for "payer" with account holder name as "Ministry of SocialWelfare" "Cash Transfer" + Then I call the create savings product endpoint for "payer" + When I call the create savings account endpoint for "payer" with accountId "223456789" + Then I check whether budget account exists with accoundId "223456789" + Then I call the interop identifier endpoint for "payer" and accountId "223456789" + Then I approve the deposit for Budget Account with command "approve" for "payer" + When I activate the budget account with command "activate" for "payer" + Then I call the deposit account endpoint with command "deposit" for amount 9000 for "payer" + Then I add "payer" with account id "223456789" to als + + + When I call the create client endpoint for "payer" with account holder name as "Ministry of Health" "Maternity" + Then I call the create savings product endpoint for "payer" + When I call the create savings account endpoint for "payer" with accountId "323456789" + Then I check whether budget account exists with accoundId "323456789" + Then I call the interop identifier endpoint for "payer" and accountId "323456789" + Then I approve the deposit for Budget Account with command "approve" for "payer" + When I activate the budget account with command "activate" for "payer" + Then I call the deposit account endpoint with command "deposit" for amount 9000 for "payer" + Then I add "payer" with account id "323456789" to als + + Given I have Fineract-Platform-TenantId for "payee1" + When I call the create client endpoint for "payee" with account holder name as "Maria" "Borges" + Then I call the create savings product endpoint for "payee" + When I call the create savings account endpoint for "payee" with accountId "1234" + Then I check whether budget account exists with accoundId "1234" + Then I call the interop identifier endpoint for "payee" and accountId "1234" + Then I approve the deposit for Budget Account with command "approve" for "payee" + When I activate the budget account with command "activate" for "payee" + Then I call the deposit account endpoint with command "deposit" for amount 1000 for "payee" + Then I add "payee1" with account id "1234" to als + + Given I have Fineract-Platform-TenantId for "payee2" + When I call the create client endpoint for "payee" with account holder name as "Claudia" "Benezeth Lubao" + Then I call the create savings product endpoint for "payee" + When I call the create savings account endpoint for "payee" with accountId "2235" + Then I check whether budget account exists with accoundId "2235" + Then I call the interop identifier endpoint for "payee" and accountId "2235" + Then I approve the deposit for Budget Account with command "approve" for "payee" + When I activate the budget account with command "activate" for "payee" + Then I call the deposit account endpoint with command "deposit" for amount 2000 for "payee" + Then I add "payee2" with account id "2235" to als + + Given I have Fineract-Platform-TenantId for "payee3" + When I call the create client endpoint for "payee" with account holder name as "Flaviana" "Matata" + Then I call the create savings product endpoint for "payee" + When I call the create savings account endpoint for "payee" with accountId "3235" + Then I check whether budget account exists with accoundId "3235" + Then I call the interop identifier endpoint for "payee" and accountId "3235" + Then I approve the deposit for Budget Account with command "approve" for "payee" + When I activate the budget account with command "activate" for "payee" + Then I call the deposit account endpoint with command "deposit" for amount 3000 for "payee" + Then I add "payee3" with account id "3235" to als + + And I have the demo csv file "bulk_payment.csv" + When I can inject MockServer + Then I can start mock server + And I can register the stub with "/registerBeneficiary" endpoint for "PUT" request with status of 200 + And I create a list of payee identifiers from csv file + And I create a IdentityMapperDTO for registering payee with IAM + Then I call the register beneficiary API with expected status of 202 and stub "/registerBeneficiary" + And I should be able to verify that the "PUT" method to "/registerBeneficiary" endpoint received a request with successfull registration + + Scenario Outline: Input CSV file using the batch transaction API and poll batch summary API till we get completed status Given I have tenant as "paymentbb1" + Then Create a csv file with file name "bulk_payment.csv" + Then add row to csv with current ministry and payee "400173110196", payment mode as "closedloop" and transfer amount 100 and id 0 + Then add row to csv with current ministry and payee "400173110196", payment mode as "closedloop" and transfer amount 200 and id 1 + Then add row to csv with current ministry and payee "400174120160", payment mode as "closedloop" and transfer amount 300 and id 2 + Then add row to csv with current ministry and payee "400174120160", payment mode as "closedloop" and transfer amount 400 and id 3 + Then add row to csv with current ministry and payee "400173110195", payment mode as "closedloop" and transfer amount 700 and id 4 + Then add last row to csv with current ministry and payee "400173110195", payment mode as "closedloop" and transfer amount 800 and id 5 And I have the demo csv file "bulk_payment.csv" And I create a list of payee identifiers from csv file When I can inject MockServer Then I can start mock server + And I have the registeringInstituteId "" + And I have the programId "" And I can register the stub with "/registerBeneficiary" endpoint for "PUT" request with status of 200 - And I create a IdentityMapperDTO for registering beneficiary + And I create a IdentityMapperDTO for registering payee with IAM Then I call the register beneficiary API with expected status of 202 and stub "/registerBeneficiary" And I should be able to verify that the "PUT" method to "/registerBeneficiary" endpoint received a request with successfull registration And I create a new clientCorrelationId @@ -18,19 +108,28 @@ Feature: Test ability to make payment to individual with bank account Then I should get non empty response And I am able to parse batch transactions response And I fetch batch ID from batch transaction API's response -# Then I will sleep for 10000 millisecond Given I have tenant as "paymentbb1" When I call the batch summary API with expected status of 200 with total 6 txns Then I am able to parse batch summary response And Status of transaction is "COMPLETED" And I should have matching total txn count and successful txn count in response - Scenario: Bulk Transfer with ClosedLoop and Mojaloop - Given I have tenant as "paymentbb2" + Examples: + | registeringInstituteId | programId | + | SocialWelfare | Education | + | SocialWelfare | UnconditionalCashTransfer | + | Health | Maternity | + + + + Scenario:BB-FSP 006 Bulk Transfer with ClosedLoop and Mojaloop + Given I have tenant as "payerfsp" And I have the demo csv file "bulk_payment_closedl_mock_mojaloop.csv" And I create a list of payee identifiers from csv file When I can inject MockServer Then I can start mock server + And I have the registeringInstituteId "SocialWelfare" + And I have the programId "Education" And I can register the stub with "/registerBeneficiary" endpoint for "PUT" request with status of 200 And I create a IdentityMapperDTO for registering beneficiary Then I call the register beneficiary API with expected status of 202 and stub "/registerBeneficiary" @@ -42,14 +141,14 @@ Feature: Test ability to make payment to individual with bank account Then I should get non empty response And I am able to parse batch transactions response And I fetch batch ID from batch transaction API's response -# Then I will sleep for 10000 millisecond - Given I have tenant as "paymentbb2" + Then I will sleep for 10000 millisecond + Given I have tenant as "payerfsp" When I call the batch summary API with expected status of 200 with total successfull 8 txns Then I am able to parse batch summary response And Status of transaction is "COMPLETED" And My total txns 8 and successful txn count in response should Match - Scenario: Bulk Transfer with ClosedLoop and GSMA + Scenario:BB-FSP 007 Bulk Transfer with ClosedLoop and GSMA #payer 1 creation Given I have Fineract-Platform-TenantId as "payerfsp2" And I initialize the payee list @@ -148,6 +247,9 @@ Feature: Test ability to make payment to individual with bank account When I can inject MockServer Then I can start mock server + And I have the registeringInstituteId "SocialWelfare" + And I have the programId "Education" + And I can register the stub with "/registerBeneficiary" endpoint for "PUT" request with status of 200 And I create a IdentityMapperDTO for registering beneficiary Then I call the register beneficiary API with expected status of 202 and stub "/registerBeneficiary" @@ -168,3 +270,258 @@ Feature: Test ability to make payment to individual with bank account And Status of transaction is "COMPLETED" And My total txns 8 and successful txn count in response should Match + + Scenario:BB-FSP 008 Bulk Transfer with Closedloop and Real Mojaloop + #payer 1 creation + Given I have Fineract-Platform-TenantId as "payerfsp2" + And I initialize the payee list + When I create and setup a "payer" with id "1" and account balance of 100 for combine test cases + Given I have tenant as "payerfsp" + Then I call the balance api for payer "1" balance for combine test cases + #payee 1 creation + When I create and setup a "payee" with id "1" and account balance of 10 for combine test cases + Given I have tenant as "payeefsp3" + Then I call the balance api for payee "1" balance for combine test cases + + Then Create a csv file with file name "batchTransactioClosedLoopMojaloopFundTransfer.csv" + Then add row to csv with current payer and payee, payment mode as "closedloop" and transfer amount 10 and id 0 for combine test cases + + #payer 2 creation + Given I have Fineract-Platform-TenantId as "payerfsp2" + When I create and setup a "payer" with id "2" and account balance of 50 for combine test cases + Given I have tenant as "payerfsp" + Then I call the balance api for payer "2" balance for combine test cases + #payee 2 creation + When I create and setup a "payee" with id "2" and account balance of 20 for combine test cases + Given I have tenant as "payeefsp3" + Then I call the balance api for payee "2" balance for combine test cases + + Then add row to csv with current payer and payee, payment mode as "closedloop" and transfer amount 5 and id 1 for combine test cases + + #payer 3 creation + Given I have Fineract-Platform-TenantId as "payerfsp2" + When I create and setup a "payer" with id "3" and account balance of 50 for combine test cases + Given I have tenant as "payerfsp" + Then I call the balance api for payer "3" balance + #payee 3 creation + When I create and setup a "payee" with id "3" and account balance of 20 for combine test cases + Given I have tenant as "payeefsp3" + Then I call the balance api for payee "3" balance for combine test cases + + Then add row to csv with current payer and payee, payment mode as "closedloop" and transfer amount 5 and id 2 for combine test cases + + #payer 4 creation + Given I have Fineract-Platform-TenantId as "payerfsp2" + When I create and setup a "payer" with id "4" and account balance of 50 for combine test cases + Given I have tenant as "payerfsp" + Then I call the balance api for payer "4" balance for combine test cases + #payee 4 creation + When I create and setup a "payee" with id "4" and account balance of 20 for combine test cases + Given I have tenant as "payeefsp3" + Then I call the balance api for payee "4" balance for combine test cases + + Then add row to csv with current payer and payee, payment mode as "closedloop" and transfer amount 5 and id 3 for combine test cases + #payer 5 creation + Given I have Fineract-Platform-TenantId as "payerfsp2" + When I create and setup a "payer" with id "5" and account balance of 50 for combine test cases + Given I have tenant as "payerfsp" + Then I call the balance api for payer "5" balance for combine test cases + #payee 5 creation + When I create and setup a "payee" with id "5" and account balance of 20 for combine test cases + Given I have tenant as "payeefsp3" + Then I call the balance api for payee "5" balance for combine test cases + + Then add row to csv with current payer and payee, payment mode as "closedloop" and transfer amount 5 and id 4 for combine test cases + #Mojaloop + Given I am setting up Mojaloop + #payer and payee 6 for mojaloop [1] + When I create and setup a "payer" with account balance of 12 + When I create and setup a "payee" with account balance of 10 + Then I add "payer" to als + Then I add "payee" to als + Then add row to csv with current payer and payee, payment mode as "mojaloop" and transfer amount 3 and id 5 for combine test cases + + #payer and payee 7 for mojaloop [2] + Then I add "payer" to als + When I create and setup a "payer" with account balance of 120 + Then add row to csv with current payer and payee, payment mode as "mojaloop" and transfer amount 2 and id 6 for combine test cases + + When I create and setup a "payer" with account balance of 66 + When I create and setup a "payee" with account balance of 10 + Then I add "payer" to als + Then I add "payee" to als + Then add last row to csv with current payer and payee, payment mode as "mojaloop" and transfer amount 1 and id 7 + + Given I have Fineract-Platform-TenantId for "payer" + And I create a new clientCorrelationId + And I have private key + And I generate signature + + When I call the batch transactions endpoint with expected status of 202 + Then I should get non empty response + And I am able to parse batch transactions response + And I fetch batch ID from batch transaction API's response + Then I will sleep for 10000 millisecond + Given I have tenant as "payerfsp" + When I call the batch summary API with expected status of 200 with total successfull 8 txns + Then I am able to parse batch summary response + And Status of transaction is "COMPLETED" + And My total txns 8 and successful txn count in response should Match + + + Scenario:BB-FSP 009 Bulk Transfer with ClosedLoop, Real mojaloop and Real GSMA + #payer 1 creation + Given I have Fineract-Platform-TenantId as "payerfsp2" + And I initialize the payee list + When I create and setup a "payer" with id "1" and account balance of 100 for all combine test cases + Given I have tenant as "payerfsp" + Then I call the balance api for payer "1" balance for all combine test cases + #payee 1 creation + When I create and setup a "payee" with id "1" and account balance of 10 for all combine test cases + Given I have tenant as "payeefsp3" + Then I call the balance api for payee "1" balance for all combine test cases + + Then Create a csv file with file name "batchTransactionGsmaClosedLoopMojaloop.csv" + Then add row to csv with current payer and payee, payment mode as "closedloop" and transfer amount 10 and id 0 for all combine test cases + + #payer 2 creation + Given I have Fineract-Platform-TenantId as "payerfsp2" + When I create and setup a "payer" with id "2" and account balance of 50 for all combine test cases + Given I have tenant as "payerfsp" + Then I call the balance api for payer "2" balance for all combine test cases + #payee 2 creation + When I create and setup a "payee" with id "2" and account balance of 20 for all combine test cases + Given I have tenant as "payeefsp3" + Then I call the balance api for payee "2" balance for all combine test cases + + Then add row to csv with current payer and payee, payment mode as "closedloop" and transfer amount 5 and id 1 for all combine test cases + + #payer 3 creation + Given I have Fineract-Platform-TenantId as "payerfsp2" + When I create and setup a "payer" with id "3" and account balance of 50 for all combine test cases + Given I have tenant as "payerfsp" + Then I call the balance api for payer "3" balance for all combine test cases + #payee 3 creation + When I create and setup a "payee" with id "3" and account balance of 20 for all combine test cases + Given I have tenant as "payeefsp3" + Then I call the balance api for payee "3" balance for all combine test cases + + Then add row to csv with current payer and payee, payment mode as "closedloop" and transfer amount 5 and id 2 for all combine test cases + + #payer 4 creation + Given I have Fineract-Platform-TenantId as "payerfsp2" + When I create and setup a "payer" with id "4" and account balance of 50 + Given I have tenant as "payerfsp" + Then I call the balance api for payer "4" balance for all combine test cases + #payee 4 creation + When I create and setup a "payee" with id "4" and account balance of 20 for all combine test cases + Given I have tenant as "payeefsp3" + Then I call the balance api for payee "4" balance for all combine test cases + + Then add row to csv with current payer and payee, payment mode as "closedloop" and transfer amount 5 and id 3 for all combine test cases + #payer 5 creation + Given I have Fineract-Platform-TenantId as "payerfsp2" + When I create and setup a "payer" with id "5" and account balance of 50 for all combine test cases + Given I have tenant as "payerfsp" + Then I call the balance api for payer "5" balance for all combine test cases + #payee 5 creation + When I create and setup a "payee" with id "5" and account balance of 20 for all combine test cases + Given I have tenant as "payeefsp3" + Then I call the balance api for payee "5" balance for all combine test cases + + Then add row to csv with current payer and payee, payment mode as "closedloop" and transfer amount 5 and id 4 for all combine test cases + + #payer 6 creation + Given I have Fineract-Platform-TenantId as "payerfsp2" + When I create and setup a "payer" with id "6" and account balance of 50 for all combine test cases + Given I have tenant as "payerfsp" + Then I call the balance api for payer "6" balance for all combine test cases + #payee 6 creation + When I create and setup a "payee" with id "6" and account balance of 20 for all combine test cases + Given I have tenant as "payeefsp3" + Then I call the balance api for payee "6" balance for all combine test cases + + Then add row to csv with current payer and payee, payment mode as "gsma" and transfer amount 6 and id 5 for all combine test cases + + #payer 7 creation + Given I have Fineract-Platform-TenantId as "payerfsp2" + When I create and setup a "payer" with id "7" and account balance of 50 for all combine test cases + Given I have tenant as "payerfsp" + Then I call the balance api for payer "7" balance for all combine test cases + #payee 7 creation + When I create and setup a "payee" with id "7" and account balance of 20 for all combine test cases + Given I have tenant as "payeefsp3" + Then I call the balance api for payee "7" balance for all combine test cases + + Then add row to csv with current payer and payee, payment mode as "gsma" and transfer amount 7 and id 6 for all combine test cases + #payer 8 creation + Given I have Fineract-Platform-TenantId as "payerfsp2" + When I create and setup a "payer" with id "8" and account balance of 30 for all combine test cases + Given I have tenant as "payerfsp" + Then I call the balance api for payer "8" balance for all combine test cases + #payee 8 creation + When I create and setup a "payee" with id "8" and account balance of 30 for all combine test cases + Given I have tenant as "payeefsp3" + Then I call the balance api for payee "8" balance for all combine test cases + + Then add row to csv with current payer and payee, payment mode as "gsma" and transfer amount 8 and id 7 for all combine test cases + + #payer 9 creation + Given I have Fineract-Platform-TenantId as "payerfsp2" + When I create and setup a "payer" with id "9" and account balance of 50 for all combine test cases + Given I have tenant as "payerfsp" + Then I call the balance api for payer "9" balance for all combine test cases + #payee 9 creation + When I create and setup a "payee" with id "9" and account balance of 20 for all combine test cases + Given I have tenant as "payeefsp3" + Then I call the balance api for payee "9" balance for all combine test cases + + Then add row to csv with current payer and payee, payment mode as "gsma" and transfer amount 9 and id 8 for all combine test cases + #payer 10 creation + Given I have Fineract-Platform-TenantId as "payerfsp2" + When I create and setup a "payer" with id "10" and account balance of 30 for all combine test cases + Given I have tenant as "payerfsp" + Then I call the balance api for payer "10" balance for all combine test cases + #payee 10 creation + When I create and setup a "payee" with id "10" and account balance of 30 for all combine test cases + Given I have tenant as "payeefsp3" + Then I call the balance api for payee "10" balance for all combine test cases + + Then add row to csv with current payer and payee, payment mode as "gsma" and transfer amount 10 and id 9 for all combine test cases + + #Mojaloop batch setup + Given I am setting up Mojaloop + #payer and payee 10 for mojaloop [1] + When I create and setup a "payer" with account balance of 12 + When I create and setup a "payee" with account balance of 10 + Then I add "payer" to als + Then I add "payee" to als + Then add row to csv with current payer and payee, payment mode as "mojaloop" and transfer amount 3 and id 10 for all combine test cases + + #payer and payee 11 for mojaloop [2] + Then I add "payer" to als + When I create and setup a "payer" with account balance of 120 + Then add row to csv with current payer and payee, payment mode as "mojaloop" and transfer amount 2 and id 11 for all combine test cases + + #payer and payee 12 for mojaloop [3] + When I create and setup a "payer" with account balance of 66 + When I create and setup a "payee" with account balance of 10 + Then I add "payer" to als + Then I add "payee" to als + Then add last row to csv with current payer and payee, payment mode as "mojaloop" and transfer amount 1 and id 12 + + #batch process + Given I have tenant as "payerfsp" + And I have the demo csv file "batchTransactionGsmaClosedLoopMojaloop.csv" + And I generate clientCorrelationId + And I have private key + And I generate signature + When I call the batch transactions endpoint with expected status of 202 + And I am able to parse batch transactions response + And I fetch batch ID from batch transaction API's response + Then I will sleep for 10000 millisecond + When I call the batch summary API with expected status of 200 with total successfull 13 txns + Then I should get non empty response + Then I am able to parse batch summary response + And Status of transaction is "COMPLETED" + And My total txns 13 and successful txn count in response should Match diff --git a/src/test/java/resources/mojaloop.feature b/src/test/java/resources/mojaloop.feature index 3cae45cf8..7aff2f7ae 100644 --- a/src/test/java/resources/mojaloop.feature +++ b/src/test/java/resources/mojaloop.feature @@ -6,7 +6,7 @@ Feature: Mojaloop test Given I have Fineract-Platform-TenantId for "payee" When I call the create client endpoint for "payee" Then I call the create savings product endpoint for "payee" - When I call the create savings account endpoint for "payee" + When I call the create savings account endpoint for "payee" with accountId "null" Then I call the interop identifier endpoint for "payee" Then I approve the deposit with command "approve" for "payee" When I activate the account with command "activate" for "payee" @@ -23,7 +23,7 @@ Feature: Mojaloop test Given I have Fineract-Platform-TenantId for "payee" When I call the create client endpoint for "payee" Then I call the create savings product endpoint for "payee" - When I call the create savings account endpoint for "payee" + When I call the create savings account endpoint for "payee" with accountId "null" Then I call the interop identifier endpoint for "payee" Then I approve the deposit with command "approve" for "payee" When I activate the account with command "activate" for "payee" @@ -40,7 +40,7 @@ Feature: Mojaloop test Given I have Fineract-Platform-TenantId for "payee" When I call the create client endpoint for "payee" Then I call the create savings product endpoint for "payee" - When I call the create savings account endpoint for "payee" + When I call the create savings account endpoint for "payee" with accountId "null" Then I call the interop identifier endpoint for "payee" Then I approve the deposit with command "approve" for "payee" When I activate the account with command "activate" for "payee" @@ -56,7 +56,7 @@ Feature: Mojaloop test Then I should be able to verify the callback for transfer Then I can stop mock server - Scenario: Payer Fund Transfer Flow test + Scenario Outline: Payer Fund Transfer Flow test Given I am setting up Mojaloop Given I have Fineract-Platform-TenantId for "payer" When I call the create client endpoint for "payer" @@ -67,17 +67,19 @@ Feature: Mojaloop test When I activate the account with command "activate" for "payer" Then I call the deposit account endpoint with command "deposit" for amount 12 for "payer" - Given I have Fineract-Platform-TenantId for "payee" +# payee1/payee2/payee3 + Given I have Fineract-Platform-TenantId for "" When I call the create client endpoint for "payee" Then I call the create savings product endpoint for "payee" - When I call the create savings account endpoint for "payee" + When I call the create savings account endpoint for "payee" with accountId "null" Then I call the interop identifier endpoint for "payee" Then I approve the deposit with command "approve" for "payee" When I activate the account with command "activate" for "payee" Then I call the deposit account endpoint with command "deposit" for amount 10 for "payee" Then I add "payer" to als - Then I add "payee" to als +# payee1/payee2/payee3 + Then I add "" to als Then I call the payer fund transfer api to transfer amount "1" from payer to payee Then I should get transaction id in response @@ -100,6 +102,11 @@ Feature: Mojaloop test Then I assert "payer" balance to be 11 Then I assert "payee" balance to be 11 + Examples: + | payee | + | payee1 | + | payee2 | + | payee3 | Scenario: Bulk Transfer with Mojaloop Given I am setting up Mojaloop