diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 7863e73..da8b984 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,25 @@ 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 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 + 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 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/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; + } } 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..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 @@ -22,6 +22,12 @@ public TerminalCloudApiService(ApplicationProperty applicationProperty) { } client = new Client(applicationProperty.getApiKey(), Environment.TEST); + if(applicationProperty.getAdyenTerminalApiCloudEndpoint() != null) { + /// 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); } 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