Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom terminal api cloud url #195

Merged
merged 6 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 22 additions & 6 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ on:

jobs:
checkout:

runs-on: ubuntu-latest
steps:
- name: Checkout project
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -132,7 +127,6 @@ jobs:


authorisation-adjustment:

runs-on: ubuntu-latest
steps:
- name: Authorisation Adjustment project
Expand All @@ -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
4 changes: 2 additions & 2 deletions in-person-payments-example/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion in-person-payments-example/startDocker.sh
Original file line number Diff line number Diff line change
@@ -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
Loading