-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade & Add 3ds2 redirect/native (#192)
* Upgrade & add 3ds2 redirect/native * Upgrade Adyen Drop-in to 5.53.2 * Fix Giving integration-example * Use util class to set session
- Loading branch information
1 parent
6927a5f
commit ea74a69
Showing
7 changed files
with
152 additions
and
99 deletions.
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
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
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
35 changes: 35 additions & 0 deletions
35
giving-example/src/main/java/com/adyen/giving/util/DonationUtil.java
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,35 @@ | ||
package com.adyen.giving.util; | ||
|
||
import jakarta.servlet.http.HttpSession; | ||
import jakarta.ws.rs.NotFoundException; | ||
|
||
public final class DonationUtil { | ||
private static final String DONATION_TOKEN = "DonationToken"; | ||
|
||
private static final String PAYMENT_ORIGINAL_PSPREFERENCE = "PaymentOriginalPspReference"; | ||
|
||
public static void setDonationTokenAndOriginalPspReference(HttpSession session, String donationToken, String originalPspReference) throws NullPointerException { | ||
if (donationToken == null) { | ||
throw new NullPointerException("No donationToken is found. The payments endpoint did not return a donationToken, please enable this in your Customer Area. See README."); | ||
} | ||
|
||
session.setAttribute(PAYMENT_ORIGINAL_PSPREFERENCE, originalPspReference); | ||
session.setAttribute(DONATION_TOKEN, donationToken); | ||
} | ||
|
||
public static String getDonationToken(HttpSession session) throws NotFoundException { | ||
var donationToken = session.getAttribute(DONATION_TOKEN); | ||
if (donationToken == null) { | ||
throw new NotFoundException("Could not find donationToken in the sessions"); | ||
} | ||
return (String) donationToken; | ||
} | ||
|
||
public static String getPaymentOriginalPspReference(HttpSession session) throws NotFoundException { | ||
var pspReference = session.getAttribute(PAYMENT_ORIGINAL_PSPREFERENCE); | ||
if (pspReference == null) { | ||
throw new NotFoundException("Could not find originalPspReference in the sessions"); | ||
} | ||
return (String) pspReference; | ||
} | ||
} |
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