-
Notifications
You must be signed in to change notification settings - Fork 43
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
Upgrade to Adyen.Web Dropin/Components V6 #352
Open
Kwok-he-Chu
wants to merge
2
commits into
main
Choose a base branch
from
feat/upgrade-dropin-v6
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
FROM amazoncorretto:17-alpine-jdk | ||
MAINTAINER jlengrand | ||
COPY build/libs/adyen-java-spring-online-payments-checkout-advanced-0.0.1-SNAPSHOT.jar adyen-java-spring-online-payments-checkout-advanced-0.0.1-SNAPSHOT.jar | ||
Kwok-he-Chu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
ENTRYPOINT ["java","-jar","/adyen-java-spring-online-payments-checkout-advanced-0.0.1-SNAPSHOT.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
.gradle | ||
build/ | ||
!gradle/wrapper/gradle-wrapper.jar | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### IntelliJ IDEA ### | ||
.idea/modules.xml | ||
.idea/jarRepositories.xml | ||
.idea/compiler.xml | ||
.idea/libraries/ | ||
*.iws | ||
*.iml | ||
*.ipr | ||
out/ | ||
!**/src/main/**/out/ | ||
!**/src/test/**/out/ | ||
|
||
### Eclipse ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
bin/ | ||
!**/src/main/**/bin/ | ||
!**/src/test/**/bin/ | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
|
||
### VS Code ### | ||
.vscode/ | ||
|
||
### Mac OS ### | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM amazoncorretto:17-alpine-jdk | ||
COPY build/libs/adyen-java-spring-online-payments-checkout-advanced-0.0.1-SNAPSHOT.jar adyen-java-spring-online-payments-checkout-advanced-0.0.1-SNAPSHOT.jar | ||
ENTRYPOINT ["java","-jar","/adyen-java-spring-online-payments-checkout-advanced-0.0.1-SNAPSHOT.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
# Sample app with Adyen Adyen Web 5.68.0. | ||
|
||
This folder contains the **previous version** of the sample application that uses **Adyen Web 5.68.x**. | ||
|
||
**Check the root folder of the repository to use the latest version of Adyen Web/Components 6.x.x** | ||
|
||
# Adyen [Online Payments](https://docs.adyen.com/online-payments) Integration Demo - Advanced Flow | ||
|
||
[![Java CI with Gradle](https://github.com/adyen-examples/adyen-java-spring-online-payments/actions/workflows/build-checkout-advanced.yml/badge.svg)](https://github.com/adyen-examples/adyen-java-spring-online-payments/actions/workflows/build-checkout-advanced.yml) | ||
[![E2E (Playwright)](https://github.com/adyen-examples/adyen-java-spring-online-payments/actions/workflows/e2e-checkout-advanced.yml/badge.svg)](https://github.com/adyen-examples/adyen-java-spring-online-payments/actions/workflows/e2e-checkout-advanced.yml) | ||
|
||
## Run demo in one-click | ||
|
||
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/adyen-examples/adyen-java-spring-online-payments/tree/main/checkout-example-advanced) | ||
[First time with Gitpod?](https://github.com/adyen-examples/.github/blob/main/pages/gitpod-get-started.md) | ||
|
||
## Description | ||
This repository showcases a PCI-compliant integration of the **Advanced Flow**. Explore this simplified e-commerce demo to discover the code, libraries and configuration you need to enable various payment options in your checkout experience. | ||
|
||
It includes a **Java + Spring Boot + Thymeleaf** application that supports [Adyen Drop-in and Components](https://docs.adyen.com/online-payments/build-your-integration) | ||
(ACH, Alipay, Cards, Dotpay, iDEAL, Klarna, PayPal, etc..) using the Adyen's API Library for Java ([GitHub](https://github.com/Adyen/adyen-java-api-library)). | ||
|
||
|
||
> **Note:** | ||
For a simpler flow using `/sessions`, check out the demo in the [`checkout-example`](../checkout-example) folder. | ||
|
||
![Card checkout demo](src/main/resources/static/images/cardcheckout.gif) | ||
|
||
|
||
## Requirements | ||
|
||
- [Adyen API Credentials](https://docs.adyen.com/development-resources/api-credentials/) | ||
- Java 17 | ||
- Network access to Maven central | ||
|
||
## 1. Installation | ||
|
||
``` | ||
git clone https://github.com/adyen-examples/adyen-java-spring-online-payments.git | ||
``` | ||
|
||
## 2. Set the environment variables | ||
* [API key](https://docs.adyen.com/user-management/how-to-get-the-api-key) | ||
* [Client Key](https://docs.adyen.com/user-management/client-side-authentication) | ||
* [Merchant Account](https://docs.adyen.com/account/account-structure) | ||
* [HMAC Key](https://docs.adyen.com/development-resources/webhooks/verify-hmac-signatures) | ||
|
||
On Linux/Mac/Windows export/set the environment variables. | ||
```shell | ||
export ADYEN_API_KEY=yourAdyenApiKey | ||
export ADYEN_MERCHANT_ACCOUNT=yourAdyenMerchantAccount | ||
export ADYEN_CLIENT_KEY=yourAdyenClientKey | ||
export ADYEN_HMAC_KEY=yourHmacKey | ||
``` | ||
|
||
Alternatively, it's possible to define the variables in the `application.properties`. | ||
```txt | ||
ADYEN_API_KEY=yourAdyenApiKey | ||
ADYEN_MERCHANT_ACCOUNT=yourAdyenMerchantAccount | ||
ADYEN_CLIENT_KEY=yourAdyenClientKey | ||
ADYEN_HMAC_KEY=yourHmacKey | ||
``` | ||
|
||
## 3. Configure allowed origins (CORS) | ||
|
||
It is required to specify the domain or URL of the web applications that will make requests to Adyen. | ||
|
||
In the Customer Area add `http://localhost:8080` in the list of Allowed Origins associated with the Client Key. | ||
|
||
## 4. Run the application | ||
|
||
``` | ||
cd checkout-example | ||
|
||
./gradlew bootRun | ||
``` | ||
|
||
Visit [http://localhost:8080/](http://localhost:8080/) to choose an integration type. | ||
|
||
Try out the different payment methods with our [test card numbers](https://docs.adyen.com/development-resources/test-cards/test-card-numbers) and other payment method details. | ||
|
||
# Webhooks | ||
|
||
Webhooks deliver asynchronous notifications about the payment status and other events that are important to receive and process. | ||
You can find more information about webhooks in [this blog post](https://www.adyen.com/knowledge-hub/consuming-webhooks). | ||
|
||
### Webhook setup | ||
|
||
In the Customer Area under the `Developers → Webhooks` section, [create](https://docs.adyen.com/development-resources/webhooks/#set-up-webhooks-in-your-customer-area) a new `Standard webhook`. | ||
|
||
A good practice is to set up basic authentication, copy the generated HMAC Key and set it as an environment variable. The application will use this to verify the [HMAC signatures](https://docs.adyen.com/development-resources/webhooks/verify-hmac-signatures/). | ||
|
||
Make sure the webhook is **enabled**, so it can receive notifications. | ||
|
||
### Expose an endpoint | ||
|
||
This demo provides a simple webhook implementation exposed at `/api/webhooks/notifications` that shows you how to receive, validate and consume the webhook payload. | ||
|
||
### Test your webhook | ||
|
||
The following webhooks `events` should be enabled: | ||
* **AUTHORISATION** | ||
|
||
|
||
To make sure that the Adyen platform can reach your application, we have written a [Webhooks Testing Guide](https://github.com/adyen-examples/.github/blob/main/pages/webhooks-testing.md) | ||
that explores several options on how you can easily achieve this (e.g. running on localhost or cloud). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
plugins { | ||
id 'org.springframework.boot' version '3.3.4' | ||
id 'io.spring.dependency-management' version '1.1.6' | ||
|
||
id 'java' | ||
} | ||
|
||
group = 'com.adyen' | ||
version = '0.0.1-SNAPSHOT' | ||
|
||
sourceCompatibility = 17 | ||
targetCompatibility = 17 | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' | ||
implementation 'org.springframework.boot:spring-boot-starter-web' | ||
implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect' | ||
implementation 'com.adyen:adyen-java-api-library:32.0.0' | ||
|
||
developmentOnly 'org.springframework.boot:spring-boot-devtools' | ||
|
||
testImplementation('org.springframework.boot:spring-boot-starter-test') { | ||
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine' | ||
} | ||
|
||
} | ||
|
||
test { | ||
useJUnitPlatform() | ||
} |
Binary file added
BIN
+59.3 KB
checkout-example-advanced/_archive/v5/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions
6
checkout-example-advanced/_archive/v5/gradle/wrapper/gradle-wrapper.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#Mon May 22 09:48:27 CEST 2023 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting
PLAYWRIGHT_FOLDERNAME=advanced-checkout/v5
is correct, but the E2E testing for Advanced Flow needs to be updated.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one has been updated, I've added the v6 e2e tests in the same
e2e-checkout-advanced.yml
-file