[1.0.0] Bump the lib to Spring 3 (#81)

This commit is contained in:
Baikov Dmitrii 2024-07-10 14:05:22 +03:00 committed by GitHub
parent 11fd78b6d1
commit be0261fdf0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 87 additions and 81 deletions

View File

@ -7,4 +7,4 @@ on:
jobs: jobs:
build: build:
uses: valitydev/base-workflow/.github/workflows/maven-library-build.yml@v1 uses: valitydev/base-workflow/.github/workflows/maven-library-build.yml@v3

View File

@ -8,7 +8,7 @@ on:
jobs: jobs:
deploy: deploy:
uses: valitydev/base-workflow/.github/workflows/maven-library-deploy.yml@v1 uses: valitydev/base-workflow/.github/workflows/maven-library-deploy.yml@v3
secrets: secrets:
server-username: ${{ secrets.OSSRH_USERNAME }} server-username: ${{ secrets.OSSRH_USERNAME }}
server-password: ${{ secrets.OSSRH_TOKEN }} server-password: ${{ secrets.OSSRH_TOKEN }}

27
pom.xml
View File

@ -7,12 +7,12 @@
<parent> <parent>
<groupId>dev.vality</groupId> <groupId>dev.vality</groupId>
<artifactId>library-parent-pom</artifactId> <artifactId>library-parent-pom</artifactId>
<version>1.0.2</version> <version>2.0.2</version>
<relativePath/> <relativePath/>
</parent> </parent>
<artifactId>adapter-flow-lib</artifactId> <artifactId>adapter-flow-lib</artifactId>
<version>0.2.6</version> <version>1.0.0</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>adapter-flow-lib</name> <name>adapter-flow-lib</name>
@ -44,7 +44,7 @@
<dockerfile.registry>${env.REGISTRY}</dockerfile.registry> <dockerfile.registry>${env.REGISTRY}</dockerfile.registry>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<woody.version>1.0.4</woody.version> <woody.version>2.0.0</woody.version>
<bender-proto.version>1.20-be9cdeb</bender-proto.version> <bender-proto.version>1.20-be9cdeb</bender-proto.version>
<damsel.version>1.614-3df747f</damsel.version> <damsel.version>1.614-3df747f</damsel.version>
<apache.commons.lang3.version>3.12.0</apache.commons.lang3.version> <apache.commons.lang3.version>3.12.0</apache.commons.lang3.version>
@ -54,14 +54,14 @@
<logback.version>1.2.11</logback.version> <logback.version>1.2.11</logback.version>
<logstash-logback-encoder.version>7.1.1</logstash-logback-encoder.version> <logstash-logback-encoder.version>7.1.1</logstash-logback-encoder.version>
<jackson.version>2.14.0</jackson.version> <jackson.version>2.14.0</jackson.version>
<junit-jupiter-engine.version>5.8.2</junit-jupiter-engine.version> <junit-jupiter-engine.version>5.10.3</junit-jupiter-engine.version>
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version> <maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
<javax.servlet-api.version>4.0.1</javax.servlet-api.version> <javax.servlet-api.version>4.0.1</javax.servlet-api.version>
<validation-api.version>2.0.1.Final</validation-api.version> <validation-api.version>2.0.1.Final</validation-api.version>
<spring.version>5.3.19</spring.version> <spring.version>6.1.6</spring.version>
<spring-boot-starter.version>2.6.7</spring-boot-starter.version> <spring-boot-starter.version>3.3.1</spring-boot-starter.version>
<cds-proto.version>1.66-01353ce</cds-proto.version> <cds-proto.version>1.66-01353ce</cds-proto.version>
<adapter-common-lib.version>1.1.2</adapter-common-lib.version> <adapter-common-lib.version>2.0.0</adapter-common-lib.version>
</properties> </properties>
<dependencies> <dependencies>
@ -90,12 +90,6 @@
<artifactId>validation-api</artifactId> <artifactId>validation-api</artifactId>
<version>${validation-api.version}</version> <version>${validation-api.version}</version>
</dependency> </dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>${javax.servlet-api.version}</version>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId> <artifactId>commons-lang3</artifactId>
@ -223,6 +217,13 @@
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version> <version>${maven-surefire-plugin.version}</version>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<parameters>true</parameters>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
</project> </project>

View File

@ -1,15 +1,14 @@
package dev.vality.adapter.flow.lib.controller; package dev.vality.adapter.flow.lib.controller;
import dev.vality.adapter.flow.lib.service.ThreeDsAdapterService; import dev.vality.adapter.flow.lib.service.ThreeDsAdapterService;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Slf4j @Slf4j
@RestController @RestController
@RequestMapping({"/${server.rest.endpoint}"}) @RequestMapping({"/${server.rest.endpoint}"})
@ -29,5 +28,4 @@ public class ThreeDsCallbackController {
HttpServletResponse servletResponse) { HttpServletResponse servletResponse) {
return this.threeDsAdapterService.receiveRecurrentIncomingParameters(servletRequest, servletResponse); return this.threeDsAdapterService.receiveRecurrentIncomingParameters(servletRequest, servletResponse);
} }
} }

View File

@ -3,9 +3,9 @@ package dev.vality.adapter.flow.lib.serde;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import dev.vality.adapter.flow.lib.exception.DeserializationException; import dev.vality.adapter.flow.lib.exception.DeserializationException;
import jakarta.servlet.http.HttpServletRequest;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -24,8 +24,8 @@ public class ParametersDeserializer implements Deserializer<Map<String, String>>
try { try {
return mapper.readValue(data, new TypeReference<HashMap<String, String>>() { return mapper.readValue(data, new TypeReference<HashMap<String, String>>() {
}); });
} catch (IOException var3) { } catch (IOException ex) {
throw new IllegalArgumentException(var3); throw new IllegalArgumentException(ex);
} }
} }
} }
@ -41,5 +41,4 @@ public class ParametersDeserializer implements Deserializer<Map<String, String>>
.collect(Collectors.toMap(k -> k.getKey().trim(), .collect(Collectors.toMap(k -> k.getKey().trim(),
v -> v.getValue()[0])); v -> v.getValue()[0]));
} }
} }

View File

@ -1,29 +1,10 @@
package dev.vality.adapter.flow.lib.service; package dev.vality.adapter.flow.lib.service;
import dev.vality.adapter.flow.lib.utils.AdapterProperties;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.util.StringUtils;
import java.util.Map; import java.util.Map;
import java.util.Optional;
@RequiredArgsConstructor public interface TagManagementService {
public class TagManagementService {
private final AdapterProperties adapterProperties; String findTag(Map<String, String> parameters);
@SneakyThrows
public String findTag(Map<String, String> parameters) {
Optional<String> first = adapterProperties.getTagGeneratorFieldNames().stream()
.filter(s -> StringUtils.hasText(parameters.get(s)))
.findFirst();
String tagId = parameters.get(first.get());
return initTag(tagId);
}
public String initTag(String tagId) {
return adapterProperties.getTagPrefix() + tagId;
}
String initTag(String tagId);
} }

View File

@ -0,0 +1,30 @@
package dev.vality.adapter.flow.lib.service;
import dev.vality.adapter.flow.lib.utils.AdapterProperties;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.util.StringUtils;
import java.util.Map;
import java.util.Optional;
@RequiredArgsConstructor
public class TagManagementServiceImpl implements TagManagementService {
private final AdapterProperties adapterProperties;
@SneakyThrows
@Override
public String findTag(Map<String, String> parameters) {
Optional<String> first = adapterProperties.getTagGeneratorFieldNames().stream()
.filter(s -> StringUtils.hasText(parameters.get(s)))
.findFirst();
String tagId = parameters.get(first.get());
return initTag(tagId);
}
@Override
public String initTag(String tagId) {
return adapterProperties.getTagPrefix() + tagId;
}
}

View File

@ -4,12 +4,12 @@ import dev.vality.adapter.common.exception.HellgateException;
import dev.vality.adapter.common.hellgate.HellgateClient; import dev.vality.adapter.common.hellgate.HellgateClient;
import dev.vality.adapter.flow.lib.serde.ParametersDeserializer; import dev.vality.adapter.flow.lib.serde.ParametersDeserializer;
import dev.vality.adapter.flow.lib.serde.ParametersSerializer; import dev.vality.adapter.flow.lib.serde.ParametersSerializer;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.Map; import java.util.Map;
@ -57,5 +57,4 @@ public class ThreeDsAdapterService {
log.info("<- callback 3ds {}", resp); log.info("<- callback 3ds {}", resp);
return resp; return resp;
} }
} }

View File

@ -1,7 +1,10 @@
package dev.vality.adapter.flow.lib.service.factory; package dev.vality.adapter.flow.lib.service.factory;
import dev.vality.adapter.common.mapper.ErrorMapping; import dev.vality.adapter.common.mapper.ErrorMapping;
import dev.vality.adapter.flow.lib.model.*; 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.QrDisplayData;
import dev.vality.adapter.flow.lib.serde.ParametersSerializer; import dev.vality.adapter.flow.lib.serde.ParametersSerializer;
import dev.vality.adapter.flow.lib.service.ExponentialBackOffPollingService; import dev.vality.adapter.flow.lib.service.ExponentialBackOffPollingService;
import dev.vality.adapter.flow.lib.service.PollingInfoService; import dev.vality.adapter.flow.lib.service.PollingInfoService;
@ -21,7 +24,7 @@ import java.nio.ByteBuffer;
import java.util.Map; import java.util.Map;
import static dev.vality.adapter.common.damsel.OptionsExtractors.extractRedirectTimeout; import static dev.vality.adapter.common.damsel.OptionsExtractors.extractRedirectTimeout;
import static dev.vality.adapter.common.damsel.ProxyProviderPackageCreators.*; import static dev.vality.adapter.common.damsel.ProxyProviderPackageCreators.createFinishIntentSuccessWithToken;
import static dev.vality.adapter.flow.lib.utils.ThreeDsDataInitializer.TAG; import static dev.vality.adapter.flow.lib.utils.ThreeDsDataInitializer.TAG;
@RequiredArgsConstructor @RequiredArgsConstructor

View File

@ -2,10 +2,11 @@ package dev.vality.adapter.flow.lib.servlet;
import dev.vality.damsel.proxy_provider.ProviderProxySrv; import dev.vality.damsel.proxy_provider.ProviderProxySrv;
import dev.vality.woody.thrift.impl.http.THServiceBuilder; import dev.vality.woody.thrift.impl.http.THServiceBuilder;
import jakarta.servlet.*;
import jakarta.servlet.annotation.WebServlet;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.*;
import javax.servlet.annotation.WebServlet;
import java.io.IOException; import java.io.IOException;
@WebServlet("/adapter/${service.name}") @WebServlet("/adapter/${service.name}")
@ -23,9 +24,9 @@ public class AdapterServlet extends GenericServlet {
} }
@Override @Override
public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException { public void service(ServletRequest request,
ServletResponse response) throws ServletException, IOException {
servlet.service(request, response); servlet.service(request, response);
} }
} }

View File

@ -10,7 +10,7 @@ import dev.vality.adapter.flow.lib.flow.config.*;
import dev.vality.adapter.flow.lib.flow.full.FullThreeDsAllVersionsStepResolverImpl; import dev.vality.adapter.flow.lib.flow.full.FullThreeDsAllVersionsStepResolverImpl;
import dev.vality.adapter.flow.lib.flow.full.GenerateTokenFullThreeDsAllVersionsStepResolverImpl; import dev.vality.adapter.flow.lib.flow.full.GenerateTokenFullThreeDsAllVersionsStepResolverImpl;
import dev.vality.adapter.flow.lib.serde.TemporaryContextDeserializer; import dev.vality.adapter.flow.lib.serde.TemporaryContextDeserializer;
import dev.vality.adapter.flow.lib.service.TagManagementService; import dev.vality.adapter.flow.lib.service.TagManagementServiceImpl;
import dev.vality.adapter.flow.lib.service.impl.CallbackUrlExtractorImpl; import dev.vality.adapter.flow.lib.service.impl.CallbackUrlExtractorImpl;
import dev.vality.adapter.flow.lib.validator.AdapterConfigurationValidator; import dev.vality.adapter.flow.lib.validator.AdapterConfigurationValidator;
import dev.vality.bender.BenderSrv; import dev.vality.bender.BenderSrv;
@ -27,7 +27,7 @@ import static org.junit.jupiter.api.Assertions.*;
@PropertySource("classpath:application.yaml") @PropertySource("classpath:application.yaml")
@ContextConfiguration(classes = {HandlerConfig.class, AppConfig.class, ProcessorConfig.class, SerdeConfig.class, @ContextConfiguration(classes = {HandlerConfig.class, AppConfig.class, ProcessorConfig.class, SerdeConfig.class,
ThreeDsCallbackController.class, TomcatEmbeddedConfiguration.class, TagManagementService.class, ThreeDsCallbackController.class, TomcatEmbeddedConfiguration.class, TagManagementServiceImpl.class,
CallbackUrlExtractorImpl.class, FullThreeDsAllVersionsStepResolverImpl.class, CallbackUrlExtractorImpl.class, FullThreeDsAllVersionsStepResolverImpl.class,
GenerateTokenFullThreeDsAllVersionsStepResolverImpl.class}) GenerateTokenFullThreeDsAllVersionsStepResolverImpl.class})
public class AbstractGenerateTokenTest { public class AbstractGenerateTokenTest {

View File

@ -10,7 +10,7 @@ import dev.vality.adapter.flow.lib.flow.config.*;
import dev.vality.adapter.flow.lib.flow.full.FullThreeDsAllVersionsStepResolverImpl; import dev.vality.adapter.flow.lib.flow.full.FullThreeDsAllVersionsStepResolverImpl;
import dev.vality.adapter.flow.lib.flow.full.GenerateTokenFullThreeDsAllVersionsStepResolverImpl; import dev.vality.adapter.flow.lib.flow.full.GenerateTokenFullThreeDsAllVersionsStepResolverImpl;
import dev.vality.adapter.flow.lib.serde.TemporaryContextDeserializer; import dev.vality.adapter.flow.lib.serde.TemporaryContextDeserializer;
import dev.vality.adapter.flow.lib.service.TagManagementService; import dev.vality.adapter.flow.lib.service.TagManagementServiceImpl;
import dev.vality.adapter.flow.lib.service.impl.CallbackUrlExtractorImpl; import dev.vality.adapter.flow.lib.service.impl.CallbackUrlExtractorImpl;
import dev.vality.adapter.flow.lib.validator.AdapterConfigurationValidator; import dev.vality.adapter.flow.lib.validator.AdapterConfigurationValidator;
import dev.vality.bender.BenderSrv; import dev.vality.bender.BenderSrv;
@ -29,7 +29,7 @@ import static org.junit.jupiter.api.Assertions.*;
@PropertySource("classpath:application.yaml") @PropertySource("classpath:application.yaml")
@ContextConfiguration(classes = {HandlerConfig.class, AppConfig.class, ProcessorConfig.class, SerdeConfig.class, @ContextConfiguration(classes = {HandlerConfig.class, AppConfig.class, ProcessorConfig.class, SerdeConfig.class,
ThreeDsCallbackController.class, TomcatEmbeddedConfiguration.class, TagManagementService.class, ThreeDsCallbackController.class, TomcatEmbeddedConfiguration.class, TagManagementServiceImpl.class,
CallbackUrlExtractorImpl.class, FullThreeDsAllVersionsStepResolverImpl.class, CallbackUrlExtractorImpl.class, FullThreeDsAllVersionsStepResolverImpl.class,
GenerateTokenFullThreeDsAllVersionsStepResolverImpl.class}) GenerateTokenFullThreeDsAllVersionsStepResolverImpl.class})
public class AbstractPaymentTest { public class AbstractPaymentTest {

View File

@ -30,7 +30,7 @@ import dev.vality.adapter.flow.lib.service.CallbackUrlExtractor;
import dev.vality.adapter.flow.lib.utils.TimerProperties; import dev.vality.adapter.flow.lib.utils.TimerProperties;
import dev.vality.adapter.flow.lib.validator.AdapterConfigurationValidator; import dev.vality.adapter.flow.lib.validator.AdapterConfigurationValidator;
import dev.vality.bender.BenderSrv; import dev.vality.bender.BenderSrv;
import dev.vality.damsel.proxy_provider.ProviderProxySrv; import dev.vality.damsel.proxy_provider.*;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@ -163,7 +163,7 @@ public class HandlerConfig {
@Bean @Bean
public TagManagementService tagManagementService(AdapterProperties adapterProperties) { public TagManagementService tagManagementService(AdapterProperties adapterProperties) {
return new TagManagementService(adapterProperties); return new TagManagementServiceImpl(adapterProperties);
} }
@Bean @Bean
@ -207,8 +207,8 @@ public class HandlerConfig {
public ProviderProxySrv.Iface serverHandlerLogDecorator( public ProviderProxySrv.Iface serverHandlerLogDecorator(
PaymentCallbackHandler paymentCallbackHandler, PaymentCallbackHandler paymentCallbackHandler,
RecurrentTokenCallbackHandler recurrentTokenCallbackHandler, RecurrentTokenCallbackHandler recurrentTokenCallbackHandler,
ServerFlowHandler serverFlowHandler, ServerFlowHandler<PaymentContext, PaymentProxyResult> serverFlowHandler,
ServerFlowHandler generateTokenFlowHandler, ServerFlowHandler<RecurrentTokenContext, RecurrentTokenProxyResult> generateTokenFlowHandler,
AdapterConfigurationValidator paymentContextValidator) { AdapterConfigurationValidator paymentContextValidator) {
return new ServerHandlerLogDecorator(new ProxyProviderServiceImpl( return new ServerHandlerLogDecorator(new ProxyProviderServiceImpl(
paymentCallbackHandler, paymentCallbackHandler,

View File

@ -10,11 +10,11 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.filter.OncePerRequestFilter; import org.springframework.web.filter.OncePerRequestFilter;
import javax.servlet.Filter; import jakarta.servlet.Filter;
import javax.servlet.FilterChain; import jakarta.servlet.FilterChain;
import javax.servlet.ServletException; import jakarta.servlet.ServletException;
import javax.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
@Configuration @Configuration

View File

@ -39,11 +39,6 @@ import java.util.List;
@Configuration @Configuration
public class QrRedirectWithPollingDsFlowConfig { public class QrRedirectWithPollingDsFlowConfig {
@Bean
public StepResolver<EntryStateModel, ExitStateModel> stepResolverImpl() {
return new SimpleRedirectWithPollingStepResolverImpl();
}
@Bean @Bean
public StepResolver<EntryStateModel, ExitStateModel> generateTokenStepResolverImpl() { public StepResolver<EntryStateModel, ExitStateModel> generateTokenStepResolverImpl() {
return new UnsupportedGenerateTokenStepResolverImpl(); return new UnsupportedGenerateTokenStepResolverImpl();
@ -54,12 +49,11 @@ public class QrRedirectWithPollingDsFlowConfig {
RemoteClient client, RemoteClient client,
EntryModelToBaseRequestModelConverter entryModelToBaseRequestModelConverter, EntryModelToBaseRequestModelConverter entryModelToBaseRequestModelConverter,
Processor<ExitStateModel, BaseResponseModel, EntryStateModel> baseProcessor, Processor<ExitStateModel, BaseResponseModel, EntryStateModel> baseProcessor,
StepResolver<EntryStateModel, ExitStateModel> stepResolverImpl,
CtxToEntryModelConverter ctxToEntryModelConverter, CtxToEntryModelConverter ctxToEntryModelConverter,
ExitModelToProxyResultConverter exitModelToProxyResultConverter) { ExitModelToProxyResultConverter exitModelToProxyResultConverter) {
return new ServerFlowHandlerImpl<>( return new ServerFlowHandlerImpl<>(
getHandlers(client, entryModelToBaseRequestModelConverter, baseProcessor), getHandlers(client, entryModelToBaseRequestModelConverter, baseProcessor),
stepResolverImpl, new SimpleRedirectWithPollingStepResolverImpl(),
ctxToEntryModelConverter, ctxToEntryModelConverter,
exitModelToProxyResultConverter); exitModelToProxyResultConverter);
} }

View File

@ -1,6 +1,7 @@
package dev.vality.adapter.flow.lib.flow.simple.redirect; package dev.vality.adapter.flow.lib.flow.simple.redirect;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import dev.vality.adapter.flow.lib.client.RemoteClient;
import dev.vality.adapter.flow.lib.constant.OptionFields; import dev.vality.adapter.flow.lib.constant.OptionFields;
import dev.vality.adapter.flow.lib.constant.Stage; import dev.vality.adapter.flow.lib.constant.Stage;
import dev.vality.adapter.flow.lib.constant.Status; import dev.vality.adapter.flow.lib.constant.Status;
@ -9,6 +10,7 @@ import dev.vality.adapter.flow.lib.flow.AbstractPaymentTest;
import dev.vality.adapter.flow.lib.flow.simple.redirect.config.SimpleRedirectWithPollingDsFlowConfig; import dev.vality.adapter.flow.lib.flow.simple.redirect.config.SimpleRedirectWithPollingDsFlowConfig;
import dev.vality.adapter.flow.lib.flow.utils.BeanUtils; import dev.vality.adapter.flow.lib.flow.utils.BeanUtils;
import dev.vality.adapter.flow.lib.flow.utils.MockUtil; import dev.vality.adapter.flow.lib.flow.utils.MockUtil;
import dev.vality.adapter.flow.lib.handler.ServerFlowHandler;
import dev.vality.adapter.flow.lib.model.BaseResponseModel; import dev.vality.adapter.flow.lib.model.BaseResponseModel;
import dev.vality.damsel.proxy_provider.PaymentContext; import dev.vality.damsel.proxy_provider.PaymentContext;
import dev.vality.damsel.proxy_provider.PaymentProxyResult; import dev.vality.damsel.proxy_provider.PaymentProxyResult;
@ -19,6 +21,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mockito; import org.mockito.Mockito;
import org.mockito.MockitoAnnotations; import org.mockito.MockitoAnnotations;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.junit.jupiter.SpringExtension;
@ -39,6 +42,9 @@ import static org.mockito.ArgumentMatchers.any;
"server.rest.port=8083"}) "server.rest.port=8083"})
public class PaymentSuccess3dsTest extends AbstractPaymentTest { public class PaymentSuccess3dsTest extends AbstractPaymentTest {
// @MockBean
// private ServerFlowHandler serverFlowHandler;
@BeforeEach @BeforeEach
public void setUp() throws TException { public void setUp() throws TException {
MockitoAnnotations.openMocks(this); MockitoAnnotations.openMocks(this);

View File

@ -35,11 +35,6 @@ import java.util.List;
@Configuration @Configuration
public class SimpleRedirectWithPollingDsFlowConfig { public class SimpleRedirectWithPollingDsFlowConfig {
@Bean
public StepResolver<EntryStateModel, ExitStateModel> stepResolverImpl() {
return new SimpleRedirectWithPollingStepResolverImpl();
}
@Bean @Bean
public StepResolver<EntryStateModel, ExitStateModel> generateTokenStepResolverImpl() { public StepResolver<EntryStateModel, ExitStateModel> generateTokenStepResolverImpl() {
return new GenerateTokenSimpleRedirectWithPollingStepResolverImpl(); return new GenerateTokenSimpleRedirectWithPollingStepResolverImpl();
@ -50,12 +45,11 @@ public class SimpleRedirectWithPollingDsFlowConfig {
RemoteClient client, RemoteClient client,
EntryModelToBaseRequestModelConverter entryModelToBaseRequestModelConverter, EntryModelToBaseRequestModelConverter entryModelToBaseRequestModelConverter,
Processor<ExitStateModel, BaseResponseModel, EntryStateModel> baseProcessor, Processor<ExitStateModel, BaseResponseModel, EntryStateModel> baseProcessor,
StepResolver<EntryStateModel, ExitStateModel> stepResolverImpl,
CtxToEntryModelConverter ctxToEntryModelConverter, CtxToEntryModelConverter ctxToEntryModelConverter,
ExitModelToProxyResultConverter exitModelToProxyResultConverter) { ExitModelToProxyResultConverter exitModelToProxyResultConverter) {
return new ServerFlowHandlerImpl<>( return new ServerFlowHandlerImpl<>(
getHandlers(client, entryModelToBaseRequestModelConverter, baseProcessor), getHandlers(client, entryModelToBaseRequestModelConverter, baseProcessor),
stepResolverImpl, new SimpleRedirectWithPollingStepResolverImpl(),
ctxToEntryModelConverter, ctxToEntryModelConverter,
exitModelToProxyResultConverter); exitModelToProxyResultConverter);
} }