From 9561be7f51cd844ffd46642cb1901b153e8a913c Mon Sep 17 00:00:00 2001 From: Beppe Catanese <1771700+gcatanese@users.noreply.github.com> Date: Mon, 12 Feb 2024 11:09:44 +0100 Subject: [PATCH] Upgrade to Adyen Java v23.0.1 (#196) * Upgrade Adyen Java version * Edit job names * Refactor Giving payment method --- .github/workflows/build.yml | 14 +++++++------- .../com/adyen/giving/api/CheckoutResource.java | 7 +++++-- gradle/libs.versions.toml | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index be9d633..f476912 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,7 +24,7 @@ jobs: strategy: matrix: java: [ '17' ] - name: Java ${{ matrix.Java }} sample + name: checkout-example build with Java ${{ matrix.Java }} steps: - uses: actions/checkout@v3 - name: Setup java @@ -41,7 +41,7 @@ jobs: strategy: matrix: java: [ '17' ] - name: Java ${{ matrix.Java }} sample + name: checkout-example-advanced build with Java ${{ matrix.Java }} steps: - uses: actions/checkout@v3 - name: Setup java @@ -59,7 +59,7 @@ jobs: strategy: matrix: java: [ '17' ] - name: Java ${{ matrix.Java }} sample + name: giftcard-example build with Java ${{ matrix.Java }} steps: - uses: actions/checkout@v3 - name: Setup java @@ -77,7 +77,7 @@ jobs: strategy: matrix: java: [ '17' ] - name: Java ${{ matrix.Java }} sample + name: subscription-example build with Java ${{ matrix.Java }} steps: - uses: actions/checkout@v3 - name: Setup java @@ -95,7 +95,7 @@ jobs: strategy: matrix: java: [ '17' ] - name: Java ${{ matrix.Java }} sample + name: paybylink-example build with Java ${{ matrix.Java }} steps: - uses: actions/checkout@v3 - name: Setup java @@ -113,7 +113,7 @@ jobs: strategy: matrix: java: [ '17' ] - name: Java ${{ matrix.Java }} sample + name: giving-example build with Java ${{ matrix.Java }} steps: - uses: actions/checkout@v3 - name: Setup java @@ -131,7 +131,7 @@ jobs: strategy: matrix: java: [ '17' ] - name: Java ${{ matrix.Java }} sample + name: authorisation-adjustment-example build with Java ${{ matrix.Java }} steps: - uses: actions/checkout@v3 - name: Setup java diff --git a/giving-example/src/main/java/com/adyen/giving/api/CheckoutResource.java b/giving-example/src/main/java/com/adyen/giving/api/CheckoutResource.java index 165f8c1..6e433d0 100644 --- a/giving-example/src/main/java/com/adyen/giving/api/CheckoutResource.java +++ b/giving-example/src/main/java/com/adyen/giving/api/CheckoutResource.java @@ -5,6 +5,7 @@ import com.adyen.enums.Environment; import com.adyen.giving.util.DonationUtil; import com.adyen.model.checkout.*; +import com.adyen.service.checkout.DonationsApi; import com.adyen.service.checkout.PaymentsApi; import com.adyen.service.exception.ApiException; import jakarta.servlet.http.HttpServletRequest; @@ -31,6 +32,7 @@ public class CheckoutResource { private final ApplicationProperty applicationProperty; private final PaymentsApi paymentsApi; + private final DonationsApi donationsApi; public CheckoutResource(ApplicationProperty applicationProperty) { @@ -43,6 +45,7 @@ public CheckoutResource(ApplicationProperty applicationProperty) { var client = new Client(applicationProperty.getApiKey(), Environment.TEST); this.paymentsApi = new PaymentsApi(client); + this.donationsApi = new DonationsApi(client); } @@ -63,7 +66,7 @@ public ResponseEntity donations(@RequestBody Amount bod donationRequest.amount(body); donationRequest.reference(UUID.randomUUID().toString()); - donationRequest.setPaymentMethod(new DonationPaymentMethod(new CardDetails())); + donationRequest.setPaymentMethod(new DonationPaymentMethod(new CardDonations())); donationRequest.setDonationToken(donationToken); donationRequest.donationOriginalPspReference(pspReference); donationRequest.setDonationAccount(this.applicationProperty.getDonationMerchantAccount()); @@ -71,7 +74,7 @@ public ResponseEntity donations(@RequestBody Amount bod donationRequest.setMerchantAccount(this.applicationProperty.getMerchantAccount()); donationRequest.shopperInteraction(DonationPaymentRequest.ShopperInteractionEnum.CONTAUTH); - DonationPaymentResponse result = this.paymentsApi.donations(donationRequest); + DonationPaymentResponse result = this.donationsApi.donations(donationRequest); return ResponseEntity.ok().body(result); } catch (NotFoundException e) { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 30eb8ce..ace4f93 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -adyenVersion="22.1.0" +adyenVersion="23.0.1" springVersion="3.1.4" springDependendyManagementVersion="1.1.3"