mirror of
https://github.com/valitydev/adapter-flow-lib.git
synced 2024-11-06 00:05:22 +00:00
INT-375: Redecorate CallbackUrlExtractor (add interface and implementation) (#54)
This commit is contained in:
parent
ed09f7e71f
commit
97d85e7ee5
2
pom.xml
2
pom.xml
@ -12,7 +12,7 @@
|
||||
</parent>
|
||||
|
||||
<artifactId>adapter-flow-lib</artifactId>
|
||||
<version>0.1.19</version>
|
||||
<version>0.1.20</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>adapter-flow-lib</name>
|
||||
|
@ -11,7 +11,7 @@ import dev.vality.adapter.flow.lib.service.CardDataService;
|
||||
import dev.vality.adapter.flow.lib.service.IdGenerator;
|
||||
import dev.vality.adapter.flow.lib.service.TemporaryContextService;
|
||||
import dev.vality.adapter.flow.lib.utils.AdapterProperties;
|
||||
import dev.vality.adapter.flow.lib.utils.CallbackUrlExtractor;
|
||||
import dev.vality.adapter.flow.lib.service.CallbackUrlExtractor;
|
||||
import dev.vality.adapter.flow.lib.utils.CardDataUtils;
|
||||
import dev.vality.adapter.flow.lib.utils.TargetStatusResolver;
|
||||
import dev.vality.cds.storage.Auth3DS;
|
||||
|
@ -0,0 +1,13 @@
|
||||
package dev.vality.adapter.flow.lib.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface CallbackUrlExtractor {
|
||||
|
||||
String TERMINATION_URI = "termination_uri";
|
||||
|
||||
String extractCallbackUrl(String redirectUrl);
|
||||
|
||||
String getSuccessRedirectUrl(Map<String, String> adapterConfigurations, String redirectUrl);
|
||||
|
||||
}
|
@ -8,7 +8,6 @@ import dev.vality.adapter.flow.lib.model.ExitStateModel;
|
||||
import dev.vality.adapter.flow.lib.model.PollingInfo;
|
||||
import dev.vality.adapter.flow.lib.model.ThreeDsData;
|
||||
import dev.vality.adapter.flow.lib.serde.ParametersSerializer;
|
||||
import dev.vality.adapter.flow.lib.utils.CallbackUrlExtractor;
|
||||
import dev.vality.adapter.flow.lib.utils.ThreeDsDataInitializer;
|
||||
import dev.vality.adapter.flow.lib.utils.TimeoutUtils;
|
||||
import dev.vality.adapter.flow.lib.utils.TimerProperties;
|
||||
|
@ -6,7 +6,6 @@ import dev.vality.adapter.flow.lib.model.EntryStateModel;
|
||||
import dev.vality.adapter.flow.lib.model.ExitStateModel;
|
||||
import dev.vality.adapter.flow.lib.model.PollingInfo;
|
||||
import dev.vality.adapter.flow.lib.model.ThreeDsData;
|
||||
import dev.vality.adapter.flow.lib.utils.CallbackUrlExtractor;
|
||||
import dev.vality.adapter.flow.lib.utils.ThreeDsDataInitializer;
|
||||
import dev.vality.adapter.flow.lib.utils.TimeoutUtils;
|
||||
import dev.vality.adapter.flow.lib.utils.TimerProperties;
|
||||
|
@ -4,7 +4,6 @@ import dev.vality.adapter.common.exception.HellgateException;
|
||||
import dev.vality.adapter.common.hellgate.HellgateClient;
|
||||
import dev.vality.adapter.flow.lib.serde.ParametersDeserializer;
|
||||
import dev.vality.adapter.flow.lib.serde.ParametersSerializer;
|
||||
import dev.vality.adapter.flow.lib.utils.CallbackUrlExtractor;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
@ -1,6 +1,8 @@
|
||||
package dev.vality.adapter.flow.lib.utils;
|
||||
package dev.vality.adapter.flow.lib.service.impl;
|
||||
|
||||
import dev.vality.adapter.flow.lib.constant.RedirectFields;
|
||||
import dev.vality.adapter.flow.lib.service.CallbackUrlExtractor;
|
||||
import dev.vality.adapter.flow.lib.utils.AdapterProperties;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
@ -8,18 +10,18 @@ import org.springframework.web.util.UriComponentsBuilder;
|
||||
import java.util.Map;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public class CallbackUrlExtractor {
|
||||
|
||||
public static final String TERMINATION_URI = "termination_uri";
|
||||
public class CallbackUrlExtractorImpl implements CallbackUrlExtractor {
|
||||
|
||||
private final AdapterProperties adapterProperties;
|
||||
|
||||
@Override
|
||||
public String extractCallbackUrl(String redirectUrl) {
|
||||
return UriComponentsBuilder.fromUriString(adapterProperties.getCallbackUrl())
|
||||
.path(adapterProperties.getPathCallbackUrl())
|
||||
.queryParam(TERMINATION_URI, redirectUrl).build().toUriString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSuccessRedirectUrl(Map<String, String> adapterConfigurations, String redirectUrl) {
|
||||
if (StringUtils.hasText(redirectUrl)) {
|
||||
return redirectUrl;
|
@ -11,7 +11,7 @@ import dev.vality.adapter.flow.lib.flow.full.FullThreeDsAllVersionsStepResolverI
|
||||
import dev.vality.adapter.flow.lib.flow.full.GenerateTokenFullThreeDsAllVersionsStepResolverImpl;
|
||||
import dev.vality.adapter.flow.lib.serde.TemporaryContextDeserializer;
|
||||
import dev.vality.adapter.flow.lib.service.TagManagementService;
|
||||
import dev.vality.adapter.flow.lib.utils.CallbackUrlExtractor;
|
||||
import dev.vality.adapter.flow.lib.service.impl.CallbackUrlExtractorImpl;
|
||||
import dev.vality.adapter.flow.lib.validator.AdapterConfigurationValidator;
|
||||
import dev.vality.bender.BenderSrv;
|
||||
import dev.vality.damsel.proxy_provider.*;
|
||||
@ -25,11 +25,10 @@ import static dev.vality.adapter.common.damsel.DomainPackageCreators.createTarge
|
||||
import static dev.vality.adapter.flow.lib.flow.full.three.ds.ForwardRecurrentPaymentNon3dsTest.RECURRENT_TOKEN;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
|
||||
@PropertySource("classpath:application.yaml")
|
||||
@ContextConfiguration(classes = {HandlerConfig.class, AppConfig.class, ProcessorConfig.class, SerdeConfig.class,
|
||||
ThreeDsCallbackController.class, TomcatEmbeddedConfiguration.class, TagManagementService.class,
|
||||
CallbackUrlExtractor.class, FullThreeDsAllVersionsStepResolverImpl.class,
|
||||
CallbackUrlExtractorImpl.class, FullThreeDsAllVersionsStepResolverImpl.class,
|
||||
GenerateTokenFullThreeDsAllVersionsStepResolverImpl.class})
|
||||
public class AbstractGenerateTokenTest {
|
||||
|
||||
|
@ -11,7 +11,7 @@ import dev.vality.adapter.flow.lib.flow.full.FullThreeDsAllVersionsStepResolverI
|
||||
import dev.vality.adapter.flow.lib.flow.full.GenerateTokenFullThreeDsAllVersionsStepResolverImpl;
|
||||
import dev.vality.adapter.flow.lib.serde.TemporaryContextDeserializer;
|
||||
import dev.vality.adapter.flow.lib.service.TagManagementService;
|
||||
import dev.vality.adapter.flow.lib.utils.CallbackUrlExtractor;
|
||||
import dev.vality.adapter.flow.lib.service.impl.CallbackUrlExtractorImpl;
|
||||
import dev.vality.adapter.flow.lib.validator.AdapterConfigurationValidator;
|
||||
import dev.vality.bender.BenderSrv;
|
||||
import dev.vality.damsel.domain.InvoicePaymentCaptured;
|
||||
@ -27,11 +27,10 @@ import org.springframework.test.context.ContextConfiguration;
|
||||
import static dev.vality.adapter.common.damsel.DomainPackageCreators.createTargetProcessed;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
|
||||
@PropertySource("classpath:application.yaml")
|
||||
@ContextConfiguration(classes = {HandlerConfig.class, AppConfig.class, ProcessorConfig.class, SerdeConfig.class,
|
||||
ThreeDsCallbackController.class, TomcatEmbeddedConfiguration.class, TagManagementService.class,
|
||||
CallbackUrlExtractor.class, FullThreeDsAllVersionsStepResolverImpl.class,
|
||||
CallbackUrlExtractorImpl.class, FullThreeDsAllVersionsStepResolverImpl.class,
|
||||
GenerateTokenFullThreeDsAllVersionsStepResolverImpl.class})
|
||||
public class AbstractPaymentTest {
|
||||
|
||||
|
@ -23,7 +23,7 @@ import dev.vality.adapter.flow.lib.serde.TemporaryContextDeserializer;
|
||||
import dev.vality.adapter.flow.lib.serde.TemporaryContextSerializer;
|
||||
import dev.vality.adapter.flow.lib.service.*;
|
||||
import dev.vality.adapter.flow.lib.utils.AdapterProperties;
|
||||
import dev.vality.adapter.flow.lib.utils.CallbackUrlExtractor;
|
||||
import dev.vality.adapter.flow.lib.service.CallbackUrlExtractor;
|
||||
import dev.vality.adapter.flow.lib.utils.TimerProperties;
|
||||
import dev.vality.adapter.flow.lib.validator.AdapterConfigurationValidator;
|
||||
import dev.vality.bender.BenderSrv;
|
||||
|
Loading…
Reference in New Issue
Block a user