INT-375: Fix CallbackUrlExtractor interface (add an option for processing options map) (#55)

Co-authored-by: dmitriibaikov <bdv@empayre.com>
This commit is contained in:
Baikov Dmitrii 2022-11-22 03:20:55 -08:00 committed by GitHub
parent 97d85e7ee5
commit 577d4b465d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 7 deletions

View File

@ -12,7 +12,7 @@
</parent>
<artifactId>adapter-flow-lib</artifactId>
<version>0.1.20</version>
<version>0.1.21</version>
<packaging>jar</packaging>
<name>adapter-flow-lib</name>

View File

@ -6,8 +6,11 @@ public interface CallbackUrlExtractor {
String TERMINATION_URI = "termination_uri";
@Deprecated
String extractCallbackUrl(String redirectUrl);
String extractCallbackUrl(Map<String, String> adapterConfigurations, String redirectUrl);
String getSuccessRedirectUrl(Map<String, String> adapterConfigurations, String redirectUrl);
}

View File

@ -48,9 +48,11 @@ public class IntentResultFactory {
ThreeDsData threeDsData = exitStateModel.getThreeDsData();
Map<String, String> params = ThreeDsDataInitializer.initThreeDsParameters(exitStateModel);
String redirectUrl = entryStateModel.getBaseRequestModel().getSuccessRedirectUrl();
params.put(RedirectFields.TERM_URL.getValue(), callbackUrlExtractor.extractCallbackUrl(redirectUrl));
Map<String, String> adapterConfigurations = entryStateModel.getBaseRequestModel().getAdapterConfigurations();
params.put(RedirectFields.TERM_URL.getValue(),
callbackUrlExtractor.extractCallbackUrl(adapterConfigurations, redirectUrl));
int timerRedirectTimeoutMin = extractRedirectTimeout(
entryStateModel.getBaseRequestModel().getAdapterConfigurations(),
adapterConfigurations,
timerProperties.getRedirectTimeoutMin());
return Intent.suspend(
new SuspendIntent(
@ -71,10 +73,12 @@ public class IntentResultFactory {
exitStateModel.setPollingInfo(pollingInfo);
String redirectUrl = entryStateModel.getBaseRequestModel().getSuccessRedirectUrl();
params.put(RedirectFields.TERM_URL.getValue(), callbackUrlExtractor.extractCallbackUrl(redirectUrl));
Map<String, String> adapterConfigurations = entryStateModel.getBaseRequestModel().getAdapterConfigurations();
params.put(RedirectFields.TERM_URL.getValue(),
callbackUrlExtractor.extractCallbackUrl(adapterConfigurations, redirectUrl));
ThreeDsData threeDsData = exitStateModel.getThreeDsData();
int timerRedirectTimeoutMin = extractRedirectTimeout(
entryStateModel.getBaseRequestModel().getAdapterConfigurations(),
adapterConfigurations,
timerProperties.getRedirectTimeoutMin());
return Intent.suspend(
new SuspendIntent(

View File

@ -34,9 +34,11 @@ public class RecurrentIntentResultFactory {
ThreeDsData threeDsData = exitStateModel.getThreeDsData();
Map<String, String> params = ThreeDsDataInitializer.initThreeDsParameters(exitStateModel);
String redirectUrl = entryStateModel.getBaseRequestModel().getSuccessRedirectUrl();
params.put(RedirectFields.TERM_URL.getValue(), callbackUrlExtractor.extractCallbackUrl(redirectUrl));
Map<String, String> adapterConfigurations = entryStateModel.getBaseRequestModel().getAdapterConfigurations();
params.put(RedirectFields.TERM_URL.getValue(),
callbackUrlExtractor.extractCallbackUrl(adapterConfigurations, redirectUrl));
int timerRedirectTimeoutMin = extractRedirectTimeout(
entryStateModel.getBaseRequestModel().getAdapterConfigurations(),
adapterConfigurations,
timerProperties.getRedirectTimeoutMin());
return RecurrentTokenIntent.suspend(
new SuspendIntent(

View File

@ -16,6 +16,11 @@ public class CallbackUrlExtractorImpl implements CallbackUrlExtractor {
@Override
public String extractCallbackUrl(String redirectUrl) {
return extractCallbackUrl(null, redirectUrl);
}
@Override
public String extractCallbackUrl(Map<String, String> adapterConfigurations, String redirectUrl) {
return UriComponentsBuilder.fromUriString(adapterProperties.getCallbackUrl())
.path(adapterProperties.getPathCallbackUrl())
.queryParam(TERMINATION_URI, redirectUrl).build().toUriString();