Skip to content

Commit

Permalink
Upgrade to Adyen Java v23.0.1 (#196)
Browse files Browse the repository at this point in the history
* Upgrade Adyen Java version
* Edit job names

* Refactor Giving payment method
  • Loading branch information
gcatanese authored Feb 12, 2024
1 parent d09630d commit 9561be7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -31,6 +32,7 @@ public class CheckoutResource {
private final ApplicationProperty applicationProperty;

private final PaymentsApi paymentsApi;
private final DonationsApi donationsApi;

public CheckoutResource(ApplicationProperty applicationProperty) {

Expand All @@ -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);
}


Expand All @@ -63,15 +66,15 @@ public ResponseEntity<DonationPaymentResponse> 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());
donationRequest.returnUrl(request.getScheme() + "://" + host);
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) {
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
adyenVersion="22.1.0"
adyenVersion="23.0.1"
springVersion="3.1.4"
springDependendyManagementVersion="1.1.3"

Expand Down

0 comments on commit 9561be7

Please sign in to comment.