From 2a2acef46b349159595ce7934330c10e973f3639 Mon Sep 17 00:00:00 2001 From: gcatanese Date: Thu, 11 Jan 2024 13:28:05 +0100 Subject: [PATCH 1/6] Add adyenTerminalApiCloudEndpoint property, correct POS_SALE_ID --- .../java/com/adyen/ipp/ApplicationProperty.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/in-person-payments-example/src/main/java/com/adyen/ipp/ApplicationProperty.java b/in-person-payments-example/src/main/java/com/adyen/ipp/ApplicationProperty.java index a49bf05..527efc5 100644 --- a/in-person-payments-example/src/main/java/com/adyen/ipp/ApplicationProperty.java +++ b/in-person-payments-example/src/main/java/com/adyen/ipp/ApplicationProperty.java @@ -18,9 +18,12 @@ public class ApplicationProperty { @Value("${ADYEN_POS_POI_ID:#{null}}") private String poiId; - @Value("${saleId:POS_SALE_ID_42}") + @Value("${saleId:POS_SALE_ID}") private String saleId; + @Value("${ADYEN_TERMINAL_API_CLOUD_ENDPOINT:#{null}}") + private String adyenTerminalApiCloudEndpoint; + public int getServerPort() { return serverPort; } @@ -52,4 +55,12 @@ public void setHmacKey(String hmacKey) { public String getSaleId() { return saleId; } public void setSaleId(String saleId) { this.saleId = saleId ; } + + public String getAdyenTerminalApiCloudEndpoint() { + return this.adyenTerminalApiCloudEndpoint; + } + + public void setAdyenTerminalApiCloudEndpoint(String adyenTerminalApiCloudEndpoint) { + this.adyenTerminalApiCloudEndpoint = adyenTerminalApiCloudEndpoint; + } } From 6be84fae112a0b6ad339791663b58b524b541e86 Mon Sep 17 00:00:00 2001 From: gcatanese Date: Thu, 11 Jan 2024 13:28:38 +0100 Subject: [PATCH 2/6] Override TerminalAPICloud url --- .../java/com/adyen/ipp/service/TerminalCloudApiService.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/in-person-payments-example/src/main/java/com/adyen/ipp/service/TerminalCloudApiService.java b/in-person-payments-example/src/main/java/com/adyen/ipp/service/TerminalCloudApiService.java index bef2e27..26effdc 100644 --- a/in-person-payments-example/src/main/java/com/adyen/ipp/service/TerminalCloudApiService.java +++ b/in-person-payments-example/src/main/java/com/adyen/ipp/service/TerminalCloudApiService.java @@ -22,6 +22,10 @@ public TerminalCloudApiService(ApplicationProperty applicationProperty) { } client = new Client(applicationProperty.getApiKey(), Environment.TEST); + if(applicationProperty.getAdyenTerminalApiCloudEndpoint() != null) { + // override AdyenTerminalApiCloudEndpoint TEST URL (for example using Mock Terminal app) + client.getConfig().setTerminalApiCloudEndpoint(applicationProperty.getAdyenTerminalApiCloudEndpoint()); + } terminalCloudAPI = new TerminalCloudAPI(client); } From 4811864bd9b64d367c01d2bbfa7ef69f74ac3b07 Mon Sep 17 00:00:00 2001 From: gcatanese Date: Wed, 17 Jan 2024 15:45:28 +0100 Subject: [PATCH 3/6] Edit comment --- .../java/com/adyen/ipp/service/TerminalCloudApiService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/in-person-payments-example/src/main/java/com/adyen/ipp/service/TerminalCloudApiService.java b/in-person-payments-example/src/main/java/com/adyen/ipp/service/TerminalCloudApiService.java index 26effdc..1c257a2 100644 --- a/in-person-payments-example/src/main/java/com/adyen/ipp/service/TerminalCloudApiService.java +++ b/in-person-payments-example/src/main/java/com/adyen/ipp/service/TerminalCloudApiService.java @@ -23,7 +23,9 @@ public TerminalCloudApiService(ApplicationProperty applicationProperty) { client = new Client(applicationProperty.getApiKey(), Environment.TEST); if(applicationProperty.getAdyenTerminalApiCloudEndpoint() != null) { - // override AdyenTerminalApiCloudEndpoint TEST URL (for example using Mock Terminal app) + /// Default: null, unless you want to override this to point to a different endpoint based on your region. + /// See https://docs.adyen.com/point-of-sale/design-your-integration/terminal-api/#cloud. + /// Optionally, if you do not own an Adyen Terminal/POS (yet), you can test this application using Adyen's Mock Terminal-API Application on GitHub: https://github.com/adyen-examples/adyen-mock-terminal-api (see README). client.getConfig().setTerminalApiCloudEndpoint(applicationProperty.getAdyenTerminalApiCloudEndpoint()); } terminalCloudAPI = new TerminalCloudAPI(client); From 95ff2314b95dcf59066a98d0974f68e243844ea8 Mon Sep 17 00:00:00 2001 From: Kwok He Chu <105217051+Kwok-he-Chu@users.noreply.github.com> Date: Mon, 29 Jan 2024 20:20:43 +0100 Subject: [PATCH 4/6] Add In-Person Payments workflow E2E --- .github/workflows/e2e.yml | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 7863e73..382a16c 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -21,7 +21,6 @@ on: jobs: checkout: - runs-on: ubuntu-latest steps: - name: Checkout project @@ -43,7 +42,6 @@ jobs: run: docker run --rm --name adyen-testing-suite -e PLAYWRIGHT_FOLDERNAME=checkout -e ADYEN_HMAC_KEY=${{ secrets.ADYEN_HMAC_KEY }} --network host ghcr.io/adyen-examples/adyen-testing-suite:main checkout-advanced: - runs-on: ubuntu-latest steps: - name: Checkout project @@ -65,7 +63,6 @@ jobs: run: docker run --rm --name adyen-testing-suite -e PLAYWRIGHT_FOLDERNAME=advanced-checkout -e ADYEN_HMAC_KEY=${{ secrets.ADYEN_HMAC_KEY }} --network host ghcr.io/adyen-examples/adyen-testing-suite:main giftcard: - runs-on: ubuntu-latest steps: - name: Checkout project @@ -87,7 +84,6 @@ jobs: run: docker run --rm --name adyen-testing-suite -e PLAYWRIGHT_FOLDERNAME=giftcard -e ADYEN_HMAC_KEY=${{ secrets.ADYEN_HMAC_KEY }} --network host ghcr.io/adyen-examples/adyen-testing-suite:main subscription: - runs-on: ubuntu-latest steps: - name: Subscription project @@ -109,7 +105,6 @@ jobs: run: docker run --rm --name adyen-testing-suite -e PLAYWRIGHT_FOLDERNAME=subscription -e ADYEN_HMAC_KEY=${{ secrets.ADYEN_HMAC_KEY }} --network host ghcr.io/adyen-examples/adyen-testing-suite:main giving: - runs-on: ubuntu-latest steps: - name: Giving project @@ -132,7 +127,6 @@ jobs: authorisation-adjustment: - runs-on: ubuntu-latest steps: - name: Authorisation Adjustment project @@ -154,3 +148,23 @@ jobs: run: docker run --rm --name adyen-testing-suite -e PLAYWRIGHT_FOLDERNAME=authorisation-adjustment -e ADYEN_HMAC_KEY=${{ secrets.ADYEN_HMAC_KEY }} --network host ghcr.io/adyen-examples/adyen-testing-suite:main + in-person-payments: + runs-on: ubuntu-latest + steps: + - name: In-person Payments project + uses: actions/checkout@v3 + - name: Setup java + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: 17 + - name: Grant execute permission for gradlew + run: chmod +x authorisation-adjustment-example/gradlew + - name: Build in-person-payments-example image + run: docker build -t in-person-payments-example-image:latest in-person-payments-example + - name: Start in-person-payments-example container, set ADYEN_TERMINAL_API_CLOUD_ENDPOINT to default docker bridge and port 3000 + run: docker run --rm -d --name in-person-payments-example-image -p 8080:8080 -e ADYEN_API_KEY="${{ secrets.ADYEN_API_KEY }}" -e ADYEN_HMAC_KEY=${{ secrets.ADYEN_HMAC_KEY }} -e ADYEN_TERMINAL_API_CLOUD_ENDPOINT=http://172.17.0.1:3000 -e ADYEN_POS_POI_ID=V400m-123456789 in-person-payments-example-image:latest + - name: Start the Adyen Mock Terminal API Application on port 3000 + run: docker run --rm -d --name adyen-mock-terminal-api -p 3000:3000 -e PORT=3000 ghcr.io/adyen-examples/adyen-mock-terminal-api:main + - name: Run testing suite against in-person-payments-example-image + run: docker run --rm --name adyen-testing-suite -e ADYEN_HMAC_KEY=${{ secrets.ADYEN_HMAC_KEY }} -e PLAYWRIGHT_FOLDERNAME=in-person-payments --network host ghcr.io/adyen-examples/adyen-testing-suite:main From 676ae71bd00e6ffb91ef7e4bb0a10a4630b904aa Mon Sep 17 00:00:00 2001 From: Kwok He Chu <105217051+Kwok-he-Chu@users.noreply.github.com> Date: Mon, 29 Jan 2024 20:29:09 +0100 Subject: [PATCH 5/6] Fix docker file --- in-person-payments-example/Dockerfile | 4 ++-- in-person-payments-example/startDocker.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/in-person-payments-example/Dockerfile b/in-person-payments-example/Dockerfile index 1ded3f3..80161f1 100644 --- a/in-person-payments-example/Dockerfile +++ b/in-person-payments-example/Dockerfile @@ -1,3 +1,3 @@ FROM amazoncorretto:17-alpine-jdk -COPY build/libs/in-person-payments-example-0.0.1-SNAPSHOT.jar adyen-java-spring-in-person-payments-example-0.0.1-SNAPSHOT.jar -ENTRYPOINT ["java","-jar","/adyen-java-spring-in-person-payments-example-0.0.1-SNAPSHOT.jar"] +COPY build/libs/adyen-java-spring-in-person-payments-0.0.1-SNAPSHOT.jar adyen-java-spring-in-person-payments-0.0.1-SNAPSHOT.jar +ENTRYPOINT ["java","-jar","/adyen-java-spring-in-person-payments-0.0.1-SNAPSHOT.jar"] \ No newline at end of file diff --git a/in-person-payments-example/startDocker.sh b/in-person-payments-example/startDocker.sh index d5b22c6..eb978be 100755 --- a/in-person-payments-example/startDocker.sh +++ b/in-person-payments-example/startDocker.sh @@ -1,4 +1,4 @@ docker run \ -e ADYEN_HMAC_KEY \ -e ADYEN_API_KEY \ --p8080:8080 adyen-java-spring-in-person-payments-example:latest +-p 8080:8080 adyen-java-spring-in-person-payments-example:latest From 9550cede049f90fd14b91da6c127b331ee4ff9e5 Mon Sep 17 00:00:00 2001 From: Kwok He Chu <105217051+Kwok-he-Chu@users.noreply.github.com> Date: Tue, 30 Jan 2024 13:53:07 +0100 Subject: [PATCH 6/6] Added chmod permissions and cd to correct folder --- .github/workflows/e2e.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 382a16c..da8b984 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -159,7 +159,9 @@ jobs: distribution: 'temurin' java-version: 17 - name: Grant execute permission for gradlew - run: chmod +x authorisation-adjustment-example/gradlew + run: chmod +x in-person-payments-example/gradlew + - name: Build in-person-payments-example with Gradle + run: cd in-person-payments-example; ./gradlew build - name: Build in-person-payments-example image run: docker build -t in-person-payments-example-image:latest in-person-payments-example - name: Start in-person-payments-example container, set ADYEN_TERMINAL_API_CLOUD_ENDPOINT to default docker bridge and port 3000