diff --git a/pom.xml b/pom.xml index 949ad62..0b25ba4 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ adapter-flow-lib - 0.1.20 + 0.1.21 jar adapter-flow-lib diff --git a/src/main/java/dev/vality/adapter/flow/lib/service/CallbackUrlExtractor.java b/src/main/java/dev/vality/adapter/flow/lib/service/CallbackUrlExtractor.java index b33a421..4adf117 100644 --- a/src/main/java/dev/vality/adapter/flow/lib/service/CallbackUrlExtractor.java +++ b/src/main/java/dev/vality/adapter/flow/lib/service/CallbackUrlExtractor.java @@ -6,8 +6,11 @@ public interface CallbackUrlExtractor { String TERMINATION_URI = "termination_uri"; + @Deprecated String extractCallbackUrl(String redirectUrl); + String extractCallbackUrl(Map adapterConfigurations, String redirectUrl); + String getSuccessRedirectUrl(Map adapterConfigurations, String redirectUrl); } diff --git a/src/main/java/dev/vality/adapter/flow/lib/service/IntentResultFactory.java b/src/main/java/dev/vality/adapter/flow/lib/service/IntentResultFactory.java index 53102f9..674334f 100644 --- a/src/main/java/dev/vality/adapter/flow/lib/service/IntentResultFactory.java +++ b/src/main/java/dev/vality/adapter/flow/lib/service/IntentResultFactory.java @@ -48,9 +48,11 @@ public class IntentResultFactory { ThreeDsData threeDsData = exitStateModel.getThreeDsData(); Map params = ThreeDsDataInitializer.initThreeDsParameters(exitStateModel); String redirectUrl = entryStateModel.getBaseRequestModel().getSuccessRedirectUrl(); - params.put(RedirectFields.TERM_URL.getValue(), callbackUrlExtractor.extractCallbackUrl(redirectUrl)); + Map 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 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( diff --git a/src/main/java/dev/vality/adapter/flow/lib/service/RecurrentIntentResultFactory.java b/src/main/java/dev/vality/adapter/flow/lib/service/RecurrentIntentResultFactory.java index 3c70234..e499c38 100644 --- a/src/main/java/dev/vality/adapter/flow/lib/service/RecurrentIntentResultFactory.java +++ b/src/main/java/dev/vality/adapter/flow/lib/service/RecurrentIntentResultFactory.java @@ -34,9 +34,11 @@ public class RecurrentIntentResultFactory { ThreeDsData threeDsData = exitStateModel.getThreeDsData(); Map params = ThreeDsDataInitializer.initThreeDsParameters(exitStateModel); String redirectUrl = entryStateModel.getBaseRequestModel().getSuccessRedirectUrl(); - params.put(RedirectFields.TERM_URL.getValue(), callbackUrlExtractor.extractCallbackUrl(redirectUrl)); + Map 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( diff --git a/src/main/java/dev/vality/adapter/flow/lib/service/impl/CallbackUrlExtractorImpl.java b/src/main/java/dev/vality/adapter/flow/lib/service/impl/CallbackUrlExtractorImpl.java index 4f7d5fa..4a6be8d 100644 --- a/src/main/java/dev/vality/adapter/flow/lib/service/impl/CallbackUrlExtractorImpl.java +++ b/src/main/java/dev/vality/adapter/flow/lib/service/impl/CallbackUrlExtractorImpl.java @@ -16,6 +16,11 @@ public class CallbackUrlExtractorImpl implements CallbackUrlExtractor { @Override public String extractCallbackUrl(String redirectUrl) { + return extractCallbackUrl(null, redirectUrl); + } + + @Override + public String extractCallbackUrl(Map adapterConfigurations, String redirectUrl) { return UriComponentsBuilder.fromUriString(adapterProperties.getCallbackUrl()) .path(adapterProperties.getPathCallbackUrl()) .queryParam(TERMINATION_URI, redirectUrl).build().toUriString();