mirror of
https://github.com/valitydev/adapter-flow-lib.git
synced 2024-11-06 00:05:22 +00:00
parent
4bb2d34201
commit
35685ba833
88
pom.xml
88
pom.xml
@ -2,7 +2,6 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
@ -13,7 +12,7 @@
|
|||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>adapter-flow-lib</artifactId>
|
<artifactId>adapter-flow-lib</artifactId>
|
||||||
<version>0.1.4</version>
|
<version>0.1.5</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>adapter-flow-lib</name>
|
<name>adapter-flow-lib</name>
|
||||||
@ -45,54 +44,29 @@
|
|||||||
<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>
|
||||||
<java.version>15</java.version>
|
<woody.version>1.0.4</woody.version>
|
||||||
<shared.resources.version>0.3.6</shared.resources.version>
|
|
||||||
|
|
||||||
<bender-proto.version>1.20-be9cdeb</bender-proto.version>
|
<bender-proto.version>1.20-be9cdeb</bender-proto.version>
|
||||||
|
<damsel.version>1.563-d384c12</damsel.version>
|
||||||
<apache.commons.lang3.version>3.10</apache.commons.lang3.version>
|
<apache.commons.lang3.version>3.12.0</apache.commons.lang3.version>
|
||||||
<apache.commons.codec.version>1.15</apache.commons.codec.version>
|
<apache.commons.codec.version>1.15</apache.commons.codec.version>
|
||||||
|
<slf4j.version>1.7.36</slf4j.version>
|
||||||
<slf4j.version>1.7.33</slf4j.version>
|
<lombok.version>1.18.24</lombok.version>
|
||||||
<lombok.version>1.18.22</lombok.version>
|
<logback.version>1.2.11</logback.version>
|
||||||
<logback.version>1.2.10</logback.version>
|
<logstash-logback-encoder.version>7.1.1</logstash-logback-encoder.version>
|
||||||
<logstash-logback-encoder.version>7.0.1</logstash-logback-encoder.version>
|
<jackson.version>2.13.2</jackson.version>
|
||||||
|
|
||||||
<jackson.version>2.11.2</jackson.version>
|
|
||||||
<woody.version>[1.0.4,)</woody.version>
|
|
||||||
|
|
||||||
<damsel.version>1.544-dcd92dd</damsel.version>
|
|
||||||
<cds-proto.version>1.62-07f2b0f</cds-proto.version>
|
|
||||||
|
|
||||||
<error-mapping-java.version>1.0.6</error-mapping-java.version>
|
|
||||||
<adapter-client-lib.version>1.0.1</adapter-client-lib.version>
|
|
||||||
<adapter-common-lib.version>1.0.0</adapter-common-lib.version>
|
|
||||||
<junit-jupiter-engine.version>5.8.2</junit-jupiter-engine.version>
|
<junit-jupiter-engine.version>5.8.2</junit-jupiter-engine.version>
|
||||||
<nop-rolling.version>0.0.1</nop-rolling.version>
|
|
||||||
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
|
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
|
||||||
<spring.version>5.3.14</spring.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>
|
||||||
<error-mapping-java.version>1.0.0</error-mapping-java.version>
|
|
||||||
<jackson.version>2.11.2</jackson.version>
|
<jackson.version>2.11.2</jackson.version>
|
||||||
|
<spring.version>5.3.19</spring.version>
|
||||||
<spring-boot-starter.version>2.6.3</spring-boot-starter.version>
|
<spring-boot-starter.version>2.6.7</spring-boot-starter.version>
|
||||||
|
<cds-proto.version>1.66-01353ce</cds-proto.version>
|
||||||
|
<adapter-common-lib.version>1.1.1</adapter-common-lib.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<!-- springframework -->
|
||||||
<!-- Third party libs -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>javax.validation</groupId>
|
|
||||||
<artifactId>validation-api</artifactId>
|
|
||||||
<version>${validation-api.version}</version>
|
|
||||||
</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.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-validation</artifactId>
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
@ -111,6 +85,18 @@
|
|||||||
<version>${spring.version}</version>
|
<version>${spring.version}</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- Third party libs -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.validation</groupId>
|
||||||
|
<artifactId>validation-api</artifactId>
|
||||||
|
<version>${validation-api.version}</version>
|
||||||
|
</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>
|
||||||
@ -174,16 +160,6 @@
|
|||||||
<version>${woody.version}</version>
|
<version>${woody.version}</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>dev.vality.adapter-client-lib</groupId>
|
|
||||||
<artifactId>cds-client-storage</artifactId>
|
|
||||||
<version>${adapter-client-lib.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>dev.vality.adapter-client-lib</groupId>
|
|
||||||
<artifactId>hellgate-adapter-client</artifactId>
|
|
||||||
<version>${adapter-client-lib.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>dev.vality</groupId>
|
<groupId>dev.vality</groupId>
|
||||||
<artifactId>bender-proto</artifactId>
|
<artifactId>bender-proto</artifactId>
|
||||||
@ -192,8 +168,14 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>dev.vality</groupId>
|
<groupId>dev.vality</groupId>
|
||||||
<artifactId>error-mapping-java</artifactId>
|
<artifactId>cds-proto</artifactId>
|
||||||
<version>${error-mapping-java.version}</version>
|
<version>${cds-proto.version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>dev.vality</groupId>
|
||||||
|
<artifactId>adapter-common-lib</artifactId>
|
||||||
|
<version>${adapter-common-lib.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Test -->
|
<!-- Test -->
|
||||||
@ -231,7 +213,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>dev.vality.logback</groupId>
|
<groupId>dev.vality.logback</groupId>
|
||||||
<artifactId>nop-rolling</artifactId>
|
<artifactId>nop-rolling</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.1</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
package dev.vality.adapter.flow.lib.converter.entry;
|
package dev.vality.adapter.flow.lib.converter.entry;
|
||||||
|
|
||||||
|
import dev.vality.adapter.common.cds.BankCardExtractor;
|
||||||
|
import dev.vality.adapter.common.cds.CdsStorageClient;
|
||||||
|
import dev.vality.adapter.common.cds.model.CardDataProxyModel;
|
||||||
|
import dev.vality.adapter.common.damsel.ProxyProviderPackageCreators;
|
||||||
|
import dev.vality.adapter.common.damsel.ProxyProviderPackageExtractors;
|
||||||
import dev.vality.adapter.flow.lib.constant.MetaData;
|
import dev.vality.adapter.flow.lib.constant.MetaData;
|
||||||
import dev.vality.adapter.flow.lib.constant.Step;
|
import dev.vality.adapter.flow.lib.constant.Step;
|
||||||
import dev.vality.adapter.flow.lib.constant.TargetStatus;
|
import dev.vality.adapter.flow.lib.constant.TargetStatus;
|
||||||
@ -10,17 +15,12 @@ import dev.vality.adapter.flow.lib.service.TemporaryContextService;
|
|||||||
import dev.vality.adapter.flow.lib.utils.CallbackUrlExtractor;
|
import dev.vality.adapter.flow.lib.utils.CallbackUrlExtractor;
|
||||||
import dev.vality.adapter.flow.lib.utils.CardDataUtils;
|
import dev.vality.adapter.flow.lib.utils.CardDataUtils;
|
||||||
import dev.vality.adapter.flow.lib.utils.TargetStatusResolver;
|
import dev.vality.adapter.flow.lib.utils.TargetStatusResolver;
|
||||||
import dev.vality.cds.client.storage.CdsClientStorage;
|
|
||||||
import dev.vality.cds.client.storage.utils.BankCardExtractor;
|
|
||||||
import dev.vality.cds.storage.Auth3DS;
|
import dev.vality.cds.storage.Auth3DS;
|
||||||
import dev.vality.cds.storage.CardData;
|
import dev.vality.cds.storage.CardData;
|
||||||
import dev.vality.cds.storage.SessionData;
|
import dev.vality.cds.storage.SessionData;
|
||||||
import dev.vality.damsel.domain.BankCard;
|
import dev.vality.damsel.domain.BankCard;
|
||||||
import dev.vality.damsel.domain.TransactionInfo;
|
import dev.vality.damsel.domain.TransactionInfo;
|
||||||
import dev.vality.damsel.proxy_provider.*;
|
import dev.vality.damsel.proxy_provider.*;
|
||||||
import dev.vality.java.cds.utils.model.CardDataProxyModel;
|
|
||||||
import dev.vality.java.damsel.utils.creators.ProxyProviderPackageCreators;
|
|
||||||
import dev.vality.java.damsel.utils.extractors.ProxyProviderPackageExtractors;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.core.convert.converter.Converter;
|
import org.springframework.core.convert.converter.Converter;
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ import java.util.Map;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class CtxToEntryModelConverter implements Converter<PaymentContext, EntryStateModel> {
|
public class CtxToEntryModelConverter implements Converter<PaymentContext, EntryStateModel> {
|
||||||
|
|
||||||
private final CdsClientStorage cdsStorage;
|
private final CdsStorageClient cdsStorageClient;
|
||||||
private final TemporaryContextDeserializer temporaryContextDeserializer;
|
private final TemporaryContextDeserializer temporaryContextDeserializer;
|
||||||
private final IdGenerator idGenerator;
|
private final IdGenerator idGenerator;
|
||||||
private final TemporaryContextService temporaryContextService;
|
private final TemporaryContextService temporaryContextService;
|
||||||
@ -51,7 +51,7 @@ public class CtxToEntryModelConverter implements Converter<PaymentContext, Entry
|
|||||||
if (paymentResource.isSetDisposablePaymentResource()
|
if (paymentResource.isSetDisposablePaymentResource()
|
||||||
&& currentStep == null
|
&& currentStep == null
|
||||||
&& targetStatus == TargetStatus.PROCESSED) {
|
&& targetStatus == TargetStatus.PROCESSED) {
|
||||||
SessionData sessionData = cdsStorage.getSessionData(context);
|
SessionData sessionData = cdsStorageClient.getSessionData(context);
|
||||||
cardData = initCardData(context, paymentResource, sessionData);
|
cardData = initCardData(context, paymentResource, sessionData);
|
||||||
mobilePaymentData = initMobilePaymentData(sessionData);
|
mobilePaymentData = initMobilePaymentData(sessionData);
|
||||||
}
|
}
|
||||||
@ -153,11 +153,11 @@ public class CtxToEntryModelConverter implements Converter<PaymentContext, Entry
|
|||||||
private CardDataProxyModel getCardData(PaymentContext context, PaymentResource paymentResource) {
|
private CardDataProxyModel getCardData(PaymentContext context, PaymentResource paymentResource) {
|
||||||
if (paymentResource.isSetDisposablePaymentResource()) {
|
if (paymentResource.isSetDisposablePaymentResource()) {
|
||||||
String cardToken = ProxyProviderPackageExtractors.extractBankCardToken(paymentResource);
|
String cardToken = ProxyProviderPackageExtractors.extractBankCardToken(paymentResource);
|
||||||
CardData cardData = cdsStorage.getCardData(cardToken);
|
CardData cardData = cdsStorageClient.getCardData(cardToken);
|
||||||
BankCard bankCard = ProxyProviderPackageExtractors.extractBankCard(context);
|
BankCard bankCard = ProxyProviderPackageExtractors.extractBankCard(context);
|
||||||
return BankCardExtractor.initCardDataProxyModel(bankCard, cardData);
|
return BankCardExtractor.initCardDataProxyModel(bankCard, cardData);
|
||||||
}
|
}
|
||||||
return cdsStorage.getCardData(context);
|
return cdsStorageClient.getCardData(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,13 +1,16 @@
|
|||||||
package dev.vality.adapter.flow.lib.converter.entry;
|
package dev.vality.adapter.flow.lib.converter.entry;
|
||||||
|
|
||||||
|
import dev.vality.adapter.common.cds.BankCardExtractor;
|
||||||
|
import dev.vality.adapter.common.cds.CdsStorageClient;
|
||||||
|
import dev.vality.adapter.common.cds.model.CardDataProxyModel;
|
||||||
|
import dev.vality.adapter.common.damsel.ProxyProviderPackageCreators;
|
||||||
|
import dev.vality.adapter.common.damsel.ProxyProviderPackageExtractors;
|
||||||
import dev.vality.adapter.flow.lib.constant.MetaData;
|
import dev.vality.adapter.flow.lib.constant.MetaData;
|
||||||
import dev.vality.adapter.flow.lib.model.*;
|
import dev.vality.adapter.flow.lib.model.*;
|
||||||
import dev.vality.adapter.flow.lib.serde.TemporaryContextDeserializer;
|
import dev.vality.adapter.flow.lib.serde.TemporaryContextDeserializer;
|
||||||
import dev.vality.adapter.flow.lib.service.IdGenerator;
|
import dev.vality.adapter.flow.lib.service.IdGenerator;
|
||||||
import dev.vality.adapter.flow.lib.service.TemporaryContextService;
|
import dev.vality.adapter.flow.lib.service.TemporaryContextService;
|
||||||
import dev.vality.adapter.flow.lib.utils.CardDataUtils;
|
import dev.vality.adapter.flow.lib.utils.CardDataUtils;
|
||||||
import dev.vality.cds.client.storage.CdsClientStorage;
|
|
||||||
import dev.vality.cds.client.storage.utils.BankCardExtractor;
|
|
||||||
import dev.vality.cds.storage.Auth3DS;
|
import dev.vality.cds.storage.Auth3DS;
|
||||||
import dev.vality.cds.storage.CardData;
|
import dev.vality.cds.storage.CardData;
|
||||||
import dev.vality.cds.storage.SessionData;
|
import dev.vality.cds.storage.SessionData;
|
||||||
@ -17,9 +20,6 @@ import dev.vality.damsel.domain.PaymentTool;
|
|||||||
import dev.vality.damsel.domain.TransactionInfo;
|
import dev.vality.damsel.domain.TransactionInfo;
|
||||||
import dev.vality.damsel.proxy_provider.RecurrentPaymentTool;
|
import dev.vality.damsel.proxy_provider.RecurrentPaymentTool;
|
||||||
import dev.vality.damsel.proxy_provider.RecurrentTokenContext;
|
import dev.vality.damsel.proxy_provider.RecurrentTokenContext;
|
||||||
import dev.vality.java.cds.utils.model.CardDataProxyModel;
|
|
||||||
import dev.vality.java.damsel.utils.creators.ProxyProviderPackageCreators;
|
|
||||||
import dev.vality.java.damsel.utils.extractors.ProxyProviderPackageExtractors;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.core.convert.converter.Converter;
|
import org.springframework.core.convert.converter.Converter;
|
||||||
@ -31,7 +31,7 @@ import java.util.HashMap;
|
|||||||
public class RecCtxToEntryModelConverter implements Converter<RecurrentTokenContext, EntryStateModel> {
|
public class RecCtxToEntryModelConverter implements Converter<RecurrentTokenContext, EntryStateModel> {
|
||||||
|
|
||||||
private final TemporaryContextDeserializer temporaryContextDeserializer;
|
private final TemporaryContextDeserializer temporaryContextDeserializer;
|
||||||
private final CdsClientStorage cdsStorage;
|
private final CdsStorageClient cdsStorageClient;
|
||||||
private final IdGenerator idGenerator;
|
private final IdGenerator idGenerator;
|
||||||
private final TemporaryContextService temporaryContextService;
|
private final TemporaryContextService temporaryContextService;
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ public class RecCtxToEntryModelConverter implements Converter<RecurrentTokenCont
|
|||||||
DisposablePaymentResource paymentResource) {
|
DisposablePaymentResource paymentResource) {
|
||||||
var cardDataBuilder = dev.vality.adapter.flow.lib.model.CardData.builder();
|
var cardDataBuilder = dev.vality.adapter.flow.lib.model.CardData.builder();
|
||||||
if (generalExitStateModel == null || generalExitStateModel.getNextStep() == null) {
|
if (generalExitStateModel == null || generalExitStateModel.getNextStep() == null) {
|
||||||
SessionData sessionData = cdsStorage.getSessionData(context);
|
SessionData sessionData = cdsStorageClient.getSessionData(context);
|
||||||
if (!sessionData.getAuthData().isSetAuth3ds()) {
|
if (!sessionData.getAuthData().isSetAuth3ds()) {
|
||||||
CardDataProxyModel cardData = getCardData(context, paymentResource);
|
CardDataProxyModel cardData = getCardData(context, paymentResource);
|
||||||
cardDataBuilder.cardHolder(cardData.getCardholderName())
|
cardDataBuilder.cardHolder(cardData.getCardholderName())
|
||||||
@ -111,7 +111,7 @@ public class RecCtxToEntryModelConverter implements Converter<RecurrentTokenCont
|
|||||||
TemporaryContext generalExitStateModel) {
|
TemporaryContext generalExitStateModel) {
|
||||||
MobilePaymentData.MobilePaymentDataBuilder<?, ?> mobilePaymentDataBuilder = MobilePaymentData.builder();
|
MobilePaymentData.MobilePaymentDataBuilder<?, ?> mobilePaymentDataBuilder = MobilePaymentData.builder();
|
||||||
if (generalExitStateModel == null || generalExitStateModel.getNextStep() == null) {
|
if (generalExitStateModel == null || generalExitStateModel.getNextStep() == null) {
|
||||||
SessionData sessionData = cdsStorage.getSessionData(context);
|
SessionData sessionData = cdsStorageClient.getSessionData(context);
|
||||||
if (sessionData.getAuthData().isSetAuth3ds()) {
|
if (sessionData.getAuthData().isSetAuth3ds()) {
|
||||||
Auth3DS auth3ds = sessionData.getAuthData().getAuth3ds();
|
Auth3DS auth3ds = sessionData.getAuthData().getAuth3ds();
|
||||||
mobilePaymentDataBuilder.cryptogram(auth3ds.getCryptogram())
|
mobilePaymentDataBuilder.cryptogram(auth3ds.getCryptogram())
|
||||||
@ -136,7 +136,7 @@ public class RecCtxToEntryModelConverter implements Converter<RecurrentTokenCont
|
|||||||
|
|
||||||
private CardDataProxyModel getCardData(RecurrentTokenContext context, DisposablePaymentResource paymentResource) {
|
private CardDataProxyModel getCardData(RecurrentTokenContext context, DisposablePaymentResource paymentResource) {
|
||||||
String cardToken = ProxyProviderPackageExtractors.extractBankCardToken(paymentResource);
|
String cardToken = ProxyProviderPackageExtractors.extractBankCardToken(paymentResource);
|
||||||
CardData cardData = cdsStorage.getCardData(cardToken);
|
CardData cardData = cdsStorageClient.getCardData(cardToken);
|
||||||
BankCard bankCard = ProxyProviderPackageExtractors.extractBankCard(context);
|
BankCard bankCard = ProxyProviderPackageExtractors.extractBankCard(context);
|
||||||
return BankCardExtractor.initCardDataProxyModel(bankCard, cardData);
|
return BankCardExtractor.initCardDataProxyModel(bankCard, cardData);
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import dev.vality.adapter.flow.lib.service.IntentResultFactory;
|
|||||||
import dev.vality.damsel.proxy_provider.Intent;
|
import dev.vality.damsel.proxy_provider.Intent;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
import static dev.vality.java.damsel.utils.creators.ProxyProviderPackageCreators.createFinishIntentSuccess;
|
import static dev.vality.adapter.common.damsel.ProxyProviderPackageCreators.createFinishIntentSuccess;
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class ResultIntentResolverImpl implements ResultIntentResolver {
|
public class ResultIntentResolverImpl implements ResultIntentResolver {
|
||||||
|
@ -2,14 +2,14 @@ package dev.vality.adapter.flow.lib.handler;
|
|||||||
|
|
||||||
import dev.vality.adapter.flow.lib.utils.PaymentResourceTypeResolver;
|
import dev.vality.adapter.flow.lib.utils.PaymentResourceTypeResolver;
|
||||||
import dev.vality.damsel.proxy_provider.*;
|
import dev.vality.damsel.proxy_provider.*;
|
||||||
import dev.vality.java.damsel.utils.extractors.ProxyProviderPackageExtractors;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.thrift.TException;
|
import org.apache.thrift.TException;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
import static dev.vality.java.damsel.utils.verification.ProxyProviderVerification.isUndefinedResultOrUnavailable;
|
import static dev.vality.adapter.common.damsel.ProxyProviderPackageExtractors.*;
|
||||||
|
import static dev.vality.adapter.common.damsel.ProxyProviderVerification.isUndefinedResultOrUnavailable;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@ -19,7 +19,7 @@ public class ServerHandlerLogDecorator implements ProviderProxySrv.Iface {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RecurrentTokenProxyResult generateToken(RecurrentTokenContext context) throws TException {
|
public RecurrentTokenProxyResult generateToken(RecurrentTokenContext context) throws TException {
|
||||||
String recurrentId = ProxyProviderPackageExtractors.extractRecurrentId(context);
|
String recurrentId = extractRecurrentId(context);
|
||||||
log.info("Generate token started with recurrentId {}", recurrentId);
|
log.info("Generate token started with recurrentId {}", recurrentId);
|
||||||
try {
|
try {
|
||||||
RecurrentTokenProxyResult proxyResult = handler.generateToken(context);
|
RecurrentTokenProxyResult proxyResult = handler.generateToken(context);
|
||||||
@ -35,7 +35,7 @@ public class ServerHandlerLogDecorator implements ProviderProxySrv.Iface {
|
|||||||
@Override
|
@Override
|
||||||
public RecurrentTokenCallbackResult handleRecurrentTokenCallback(ByteBuffer byteBuffer,
|
public RecurrentTokenCallbackResult handleRecurrentTokenCallback(ByteBuffer byteBuffer,
|
||||||
RecurrentTokenContext context) throws TException {
|
RecurrentTokenContext context) throws TException {
|
||||||
String recurrentId = ProxyProviderPackageExtractors.extractRecurrentId(context);
|
String recurrentId = extractRecurrentId(context);
|
||||||
log.info("handleRecurrentTokenCallback: start with recurrentId {}", recurrentId);
|
log.info("handleRecurrentTokenCallback: start with recurrentId {}", recurrentId);
|
||||||
RecurrentTokenCallbackResult result = handler.handleRecurrentTokenCallback(byteBuffer, context);
|
RecurrentTokenCallbackResult result = handler.handleRecurrentTokenCallback(byteBuffer, context);
|
||||||
log.info("handleRecurrentTokenCallback end {} with recurrentId {}", result, recurrentId);
|
log.info("handleRecurrentTokenCallback end {} with recurrentId {}", result, recurrentId);
|
||||||
@ -44,8 +44,8 @@ public class ServerHandlerLogDecorator implements ProviderProxySrv.Iface {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PaymentProxyResult processPayment(PaymentContext context) throws TException {
|
public PaymentProxyResult processPayment(PaymentContext context) throws TException {
|
||||||
String invoiceId = ProxyProviderPackageExtractors.extractInvoiceId(context);
|
String invoiceId = extractInvoiceId(context);
|
||||||
String invoicePaymentStatus = ProxyProviderPackageExtractors.extractTargetInvoicePaymentStatus(context);
|
String invoicePaymentStatus = extractTargetInvoicePaymentStatus(context);
|
||||||
String paymentResourceType = PaymentResourceTypeResolver.extractPaymentResourceType(context);
|
String paymentResourceType = PaymentResourceTypeResolver.extractPaymentResourceType(context);
|
||||||
log.info("Process payment handle resource='{}', status='{}' start with invoiceId {}", paymentResourceType,
|
log.info("Process payment handle resource='{}', status='{}' start with invoiceId {}", paymentResourceType,
|
||||||
invoicePaymentStatus, invoiceId);
|
invoicePaymentStatus, invoiceId);
|
||||||
@ -66,7 +66,7 @@ public class ServerHandlerLogDecorator implements ProviderProxySrv.Iface {
|
|||||||
@Override
|
@Override
|
||||||
public PaymentCallbackResult handlePaymentCallback(ByteBuffer byteBuffer,
|
public PaymentCallbackResult handlePaymentCallback(ByteBuffer byteBuffer,
|
||||||
PaymentContext context) throws TException {
|
PaymentContext context) throws TException {
|
||||||
String invoiceId = ProxyProviderPackageExtractors.extractInvoiceId(context);
|
String invoiceId = extractInvoiceId(context);
|
||||||
log.info("handlePaymentCallback start with invoiceId {}", invoiceId);
|
log.info("handlePaymentCallback start with invoiceId {}", invoiceId);
|
||||||
PaymentCallbackResult result = handler.handlePaymentCallback(byteBuffer, context);
|
PaymentCallbackResult result = handler.handlePaymentCallback(byteBuffer, context);
|
||||||
log.info("handlePaymentCallback finish {} with invoiceId {}", result, invoiceId);
|
log.info("handlePaymentCallback finish {} with invoiceId {}", result, invoiceId);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package dev.vality.adapter.flow.lib.handler.callback;
|
package dev.vality.adapter.flow.lib.handler.callback;
|
||||||
|
|
||||||
|
import dev.vality.adapter.common.damsel.ProxyProviderPackageCreators;
|
||||||
import dev.vality.adapter.flow.lib.model.TemporaryContext;
|
import dev.vality.adapter.flow.lib.model.TemporaryContext;
|
||||||
import dev.vality.adapter.flow.lib.serde.Deserializer;
|
import dev.vality.adapter.flow.lib.serde.Deserializer;
|
||||||
import dev.vality.adapter.flow.lib.serde.StateSerializer;
|
import dev.vality.adapter.flow.lib.serde.StateSerializer;
|
||||||
@ -7,7 +8,6 @@ import dev.vality.adapter.flow.lib.service.TemporaryContextService;
|
|||||||
import dev.vality.damsel.proxy_provider.PaymentCallbackProxyResult;
|
import dev.vality.damsel.proxy_provider.PaymentCallbackProxyResult;
|
||||||
import dev.vality.damsel.proxy_provider.PaymentCallbackResult;
|
import dev.vality.damsel.proxy_provider.PaymentCallbackResult;
|
||||||
import dev.vality.damsel.proxy_provider.PaymentContext;
|
import dev.vality.damsel.proxy_provider.PaymentContext;
|
||||||
import dev.vality.java.damsel.utils.creators.ProxyProviderPackageCreators;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package dev.vality.adapter.flow.lib.handler.callback;
|
package dev.vality.adapter.flow.lib.handler.callback;
|
||||||
|
|
||||||
|
import dev.vality.adapter.common.damsel.BasePackageCreators;
|
||||||
|
import dev.vality.adapter.common.damsel.ProxyProviderPackageCreators;
|
||||||
import dev.vality.adapter.flow.lib.model.TemporaryContext;
|
import dev.vality.adapter.flow.lib.model.TemporaryContext;
|
||||||
import dev.vality.adapter.flow.lib.serde.Deserializer;
|
import dev.vality.adapter.flow.lib.serde.Deserializer;
|
||||||
import dev.vality.adapter.flow.lib.serde.StateSerializer;
|
import dev.vality.adapter.flow.lib.serde.StateSerializer;
|
||||||
@ -8,8 +10,6 @@ import dev.vality.damsel.proxy_provider.RecurrentTokenCallbackResult;
|
|||||||
import dev.vality.damsel.proxy_provider.RecurrentTokenContext;
|
import dev.vality.damsel.proxy_provider.RecurrentTokenContext;
|
||||||
import dev.vality.damsel.proxy_provider.RecurrentTokenIntent;
|
import dev.vality.damsel.proxy_provider.RecurrentTokenIntent;
|
||||||
import dev.vality.damsel.proxy_provider.RecurrentTokenProxyResult;
|
import dev.vality.damsel.proxy_provider.RecurrentTokenProxyResult;
|
||||||
import dev.vality.java.damsel.utils.creators.BasePackageCreators;
|
|
||||||
import dev.vality.java.damsel.utils.creators.ProxyProviderPackageCreators;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package dev.vality.adapter.flow.lib.service;
|
package dev.vality.adapter.flow.lib.service;
|
||||||
|
|
||||||
|
import dev.vality.adapter.common.mapper.ErrorMapping;
|
||||||
import dev.vality.adapter.flow.lib.constant.HttpMethod;
|
import dev.vality.adapter.flow.lib.constant.HttpMethod;
|
||||||
import dev.vality.adapter.flow.lib.constant.RedirectFields;
|
import dev.vality.adapter.flow.lib.constant.RedirectFields;
|
||||||
import dev.vality.adapter.flow.lib.model.EntryStateModel;
|
import dev.vality.adapter.flow.lib.model.EntryStateModel;
|
||||||
@ -15,14 +16,13 @@ import dev.vality.damsel.base.Timer;
|
|||||||
import dev.vality.damsel.proxy_provider.*;
|
import dev.vality.damsel.proxy_provider.*;
|
||||||
import dev.vality.damsel.timeout_behaviour.TimeoutBehaviour;
|
import dev.vality.damsel.timeout_behaviour.TimeoutBehaviour;
|
||||||
import dev.vality.damsel.user_interaction.UserInteraction;
|
import dev.vality.damsel.user_interaction.UserInteraction;
|
||||||
import dev.vality.error.mapping.ErrorMapping;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static dev.vality.java.damsel.utils.creators.ProxyProviderPackageCreators.*;
|
import static dev.vality.adapter.common.damsel.OptionsExtractors.extractRedirectTimeout;
|
||||||
import static dev.vality.java.damsel.utils.extractors.OptionsExtractors.extractRedirectTimeout;
|
import static dev.vality.adapter.common.damsel.ProxyProviderPackageCreators.*;
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class IntentResultFactory {
|
public class IntentResultFactory {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package dev.vality.adapter.flow.lib.service;
|
package dev.vality.adapter.flow.lib.service;
|
||||||
|
|
||||||
|
import dev.vality.adapter.common.damsel.OptionsExtractors;
|
||||||
import dev.vality.adapter.flow.lib.model.EntryStateModel;
|
import dev.vality.adapter.flow.lib.model.EntryStateModel;
|
||||||
import dev.vality.adapter.flow.lib.model.PollingInfo;
|
import dev.vality.adapter.flow.lib.model.PollingInfo;
|
||||||
import dev.vality.adapter.flow.lib.utils.TimerProperties;
|
import dev.vality.adapter.flow.lib.utils.TimerProperties;
|
||||||
import dev.vality.java.damsel.utils.extractors.OptionsExtractors;
|
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package dev.vality.adapter.flow.lib.service;
|
package dev.vality.adapter.flow.lib.service;
|
||||||
|
|
||||||
|
import dev.vality.adapter.common.mapper.ErrorMapping;
|
||||||
import dev.vality.adapter.flow.lib.constant.RedirectFields;
|
import dev.vality.adapter.flow.lib.constant.RedirectFields;
|
||||||
import dev.vality.adapter.flow.lib.model.EntryStateModel;
|
import dev.vality.adapter.flow.lib.model.EntryStateModel;
|
||||||
import dev.vality.adapter.flow.lib.model.ExitStateModel;
|
import dev.vality.adapter.flow.lib.model.ExitStateModel;
|
||||||
@ -11,14 +12,13 @@ import dev.vality.adapter.flow.lib.utils.TimeoutUtils;
|
|||||||
import dev.vality.adapter.flow.lib.utils.TimerProperties;
|
import dev.vality.adapter.flow.lib.utils.TimerProperties;
|
||||||
import dev.vality.damsel.base.Timer;
|
import dev.vality.damsel.base.Timer;
|
||||||
import dev.vality.damsel.proxy_provider.*;
|
import dev.vality.damsel.proxy_provider.*;
|
||||||
import dev.vality.error.mapping.ErrorMapping;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static dev.vality.java.damsel.utils.creators.ProxyProviderPackageCreators.createPostUserInteraction;
|
import static dev.vality.adapter.common.damsel.OptionsExtractors.extractRedirectTimeout;
|
||||||
import static dev.vality.java.damsel.utils.creators.ProxyProviderPackageCreators.createRecurrentTokenStatusSuccess;
|
import static dev.vality.adapter.common.damsel.ProxyProviderPackageCreators.createPostUserInteraction;
|
||||||
import static dev.vality.java.damsel.utils.extractors.OptionsExtractors.extractRedirectTimeout;
|
import static dev.vality.adapter.common.damsel.ProxyProviderPackageCreators.createRecurrentTokenStatusSuccess;
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class RecurrentIntentResultFactory {
|
public class RecurrentIntentResultFactory {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package dev.vality.adapter.flow.lib.service;
|
package dev.vality.adapter.flow.lib.service;
|
||||||
|
|
||||||
|
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.ParametersDeserializer;
|
||||||
import dev.vality.adapter.flow.lib.serde.ParametersSerializer;
|
import dev.vality.adapter.flow.lib.serde.ParametersSerializer;
|
||||||
import dev.vality.adapter.flow.lib.utils.CallbackUrlExtractor;
|
import dev.vality.adapter.flow.lib.utils.CallbackUrlExtractor;
|
||||||
import dev.vality.adapter.helpers.hellgate.HellgateAdapterClient;
|
|
||||||
import dev.vality.adapter.helpers.hellgate.exception.HellgateException;
|
|
||||||
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;
|
||||||
@ -20,19 +20,19 @@ import java.util.function.BiFunction;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class ThreeDsAdapterService {
|
public class ThreeDsAdapterService {
|
||||||
|
|
||||||
private final HellgateAdapterClient hgClient;
|
private final HellgateClient hellgateClient;
|
||||||
private final ParametersSerializer parametersSerializer;
|
private final ParametersSerializer parametersSerializer;
|
||||||
private final ParametersDeserializer parametersDeserializer;
|
private final ParametersDeserializer parametersDeserializer;
|
||||||
private final TagManagementService tagManagementService;
|
private final TagManagementService tagManagementService;
|
||||||
|
|
||||||
public String receivePaymentIncomingParameters(HttpServletRequest servletRequest,
|
public String receivePaymentIncomingParameters(HttpServletRequest servletRequest,
|
||||||
HttpServletResponse servletResponse) {
|
HttpServletResponse servletResponse) {
|
||||||
return this.processCallback(servletRequest, servletResponse, hgClient::processPaymentCallback);
|
return this.processCallback(servletRequest, servletResponse, hellgateClient::processPaymentCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String receiveRecurrentIncomingParameters(HttpServletRequest servletRequest,
|
public String receiveRecurrentIncomingParameters(HttpServletRequest servletRequest,
|
||||||
HttpServletResponse servletResponse) {
|
HttpServletResponse servletResponse) {
|
||||||
return this.processCallback(servletRequest, servletResponse, hgClient::processRecurrentTokenCallback);
|
return this.processCallback(servletRequest, servletResponse, hellgateClient::processRecurrentTokenCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String processCallback(HttpServletRequest servletRequest,
|
private String processCallback(HttpServletRequest servletRequest,
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package dev.vality.adapter.flow.lib.utils;
|
package dev.vality.adapter.flow.lib.utils;
|
||||||
|
|
||||||
|
import dev.vality.adapter.common.damsel.model.PaymentResourceType;
|
||||||
import dev.vality.damsel.proxy_provider.PaymentContext;
|
import dev.vality.damsel.proxy_provider.PaymentContext;
|
||||||
import dev.vality.damsel.proxy_provider.PaymentResource;
|
import dev.vality.damsel.proxy_provider.PaymentResource;
|
||||||
import dev.vality.java.damsel.constant.PaymentResourceType;
|
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
package dev.vality.adapter.flow.lib.utils;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonParser;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import dev.vality.error.mapping.ErrorMapping;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.core.io.Resource;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class SimpleErrorMapping {
|
|
||||||
|
|
||||||
private final Resource filePath;
|
|
||||||
private final String patternReason;
|
|
||||||
|
|
||||||
public ErrorMapping createErrorMapping() throws IOException {
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
|
||||||
mapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true);
|
|
||||||
|
|
||||||
ErrorMapping errorMapping = new ErrorMapping(filePath.getInputStream(), patternReason, mapper);
|
|
||||||
errorMapping.validateMapping();
|
|
||||||
return errorMapping;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,5 +1,8 @@
|
|||||||
package dev.vality.adapter.flow.lib.flow;
|
package dev.vality.adapter.flow.lib.flow;
|
||||||
|
|
||||||
|
import dev.vality.adapter.common.cds.CdsStorageClient;
|
||||||
|
import dev.vality.adapter.common.damsel.ProxyProviderVerification;
|
||||||
|
import dev.vality.adapter.common.hellgate.HellgateClient;
|
||||||
import dev.vality.adapter.flow.lib.client.RemoteClient;
|
import dev.vality.adapter.flow.lib.client.RemoteClient;
|
||||||
import dev.vality.adapter.flow.lib.constant.Step;
|
import dev.vality.adapter.flow.lib.constant.Step;
|
||||||
import dev.vality.adapter.flow.lib.controller.ThreeDsCallbackController;
|
import dev.vality.adapter.flow.lib.controller.ThreeDsCallbackController;
|
||||||
@ -10,19 +13,16 @@ import dev.vality.adapter.flow.lib.serde.TemporaryContextDeserializer;
|
|||||||
import dev.vality.adapter.flow.lib.service.TagManagementService;
|
import dev.vality.adapter.flow.lib.service.TagManagementService;
|
||||||
import dev.vality.adapter.flow.lib.utils.CallbackUrlExtractor;
|
import dev.vality.adapter.flow.lib.utils.CallbackUrlExtractor;
|
||||||
import dev.vality.adapter.flow.lib.validator.AdapterConfigurationValidator;
|
import dev.vality.adapter.flow.lib.validator.AdapterConfigurationValidator;
|
||||||
import dev.vality.adapter.helpers.hellgate.HellgateAdapterClient;
|
|
||||||
import dev.vality.bender.BenderSrv;
|
import dev.vality.bender.BenderSrv;
|
||||||
import dev.vality.cds.client.storage.CdsClientStorage;
|
|
||||||
import dev.vality.damsel.proxy_provider.*;
|
import dev.vality.damsel.proxy_provider.*;
|
||||||
import dev.vality.java.damsel.utils.verification.ProxyProviderVerification;
|
|
||||||
import org.apache.thrift.TException;
|
import org.apache.thrift.TException;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||||
import org.springframework.context.annotation.PropertySource;
|
import org.springframework.context.annotation.PropertySource;
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
|
|
||||||
|
import static dev.vality.adapter.common.damsel.DomainPackageCreators.createTargetProcessed;
|
||||||
import static dev.vality.adapter.flow.lib.flow.full.three.ds.ForwardRecurrentPaymentNon3dsTest.RECURRENT_TOKEN;
|
import static dev.vality.adapter.flow.lib.flow.full.three.ds.ForwardRecurrentPaymentNon3dsTest.RECURRENT_TOKEN;
|
||||||
import static dev.vality.java.damsel.utils.creators.DomainPackageCreators.createTargetProcessed;
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ import static org.junit.jupiter.api.Assertions.*;
|
|||||||
public class AbstractGenerateTokenTest {
|
public class AbstractGenerateTokenTest {
|
||||||
|
|
||||||
@MockBean
|
@MockBean
|
||||||
protected CdsClientStorage cdsClientStorage;
|
protected CdsStorageClient cdsStorageClient;
|
||||||
@MockBean
|
@MockBean
|
||||||
protected AdapterConfigurationValidator paymentContextValidator;
|
protected AdapterConfigurationValidator paymentContextValidator;
|
||||||
@MockBean
|
@MockBean
|
||||||
@ -42,7 +42,7 @@ public class AbstractGenerateTokenTest {
|
|||||||
@MockBean
|
@MockBean
|
||||||
protected RemoteClient client;
|
protected RemoteClient client;
|
||||||
@MockBean
|
@MockBean
|
||||||
protected HellgateAdapterClient hellgateAdapterClient;
|
protected HellgateClient hellgateClient;
|
||||||
@Autowired
|
@Autowired
|
||||||
public TemporaryContextDeserializer temporaryContextDeserializer;
|
public TemporaryContextDeserializer temporaryContextDeserializer;
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package dev.vality.adapter.flow.lib.flow;
|
package dev.vality.adapter.flow.lib.flow;
|
||||||
|
|
||||||
|
import dev.vality.adapter.common.cds.CdsStorageClient;
|
||||||
|
import dev.vality.adapter.common.damsel.ProxyProviderVerification;
|
||||||
|
import dev.vality.adapter.common.hellgate.HellgateClient;
|
||||||
import dev.vality.adapter.flow.lib.client.RemoteClient;
|
import dev.vality.adapter.flow.lib.client.RemoteClient;
|
||||||
import dev.vality.adapter.flow.lib.constant.Step;
|
import dev.vality.adapter.flow.lib.constant.Step;
|
||||||
import dev.vality.adapter.flow.lib.controller.ThreeDsCallbackController;
|
import dev.vality.adapter.flow.lib.controller.ThreeDsCallbackController;
|
||||||
@ -10,21 +13,18 @@ import dev.vality.adapter.flow.lib.serde.TemporaryContextDeserializer;
|
|||||||
import dev.vality.adapter.flow.lib.service.TagManagementService;
|
import dev.vality.adapter.flow.lib.service.TagManagementService;
|
||||||
import dev.vality.adapter.flow.lib.utils.CallbackUrlExtractor;
|
import dev.vality.adapter.flow.lib.utils.CallbackUrlExtractor;
|
||||||
import dev.vality.adapter.flow.lib.validator.AdapterConfigurationValidator;
|
import dev.vality.adapter.flow.lib.validator.AdapterConfigurationValidator;
|
||||||
import dev.vality.adapter.helpers.hellgate.HellgateAdapterClient;
|
|
||||||
import dev.vality.bender.BenderSrv;
|
import dev.vality.bender.BenderSrv;
|
||||||
import dev.vality.cds.client.storage.CdsClientStorage;
|
|
||||||
import dev.vality.damsel.domain.InvoicePaymentCaptured;
|
import dev.vality.damsel.domain.InvoicePaymentCaptured;
|
||||||
import dev.vality.damsel.domain.InvoicePaymentRefunded;
|
import dev.vality.damsel.domain.InvoicePaymentRefunded;
|
||||||
import dev.vality.damsel.domain.TargetInvoicePaymentStatus;
|
import dev.vality.damsel.domain.TargetInvoicePaymentStatus;
|
||||||
import dev.vality.damsel.proxy_provider.*;
|
import dev.vality.damsel.proxy_provider.*;
|
||||||
import dev.vality.java.damsel.utils.verification.ProxyProviderVerification;
|
|
||||||
import org.apache.thrift.TException;
|
import org.apache.thrift.TException;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||||
import org.springframework.context.annotation.PropertySource;
|
import org.springframework.context.annotation.PropertySource;
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
|
|
||||||
import static dev.vality.java.damsel.utils.creators.DomainPackageCreators.createTargetProcessed;
|
import static dev.vality.adapter.common.damsel.DomainPackageCreators.createTargetProcessed;
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
|
||||||
@ -36,13 +36,13 @@ import static org.junit.jupiter.api.Assertions.*;
|
|||||||
public class AbstractPaymentTest {
|
public class AbstractPaymentTest {
|
||||||
|
|
||||||
@MockBean
|
@MockBean
|
||||||
protected CdsClientStorage cdsClientStorage;
|
protected CdsStorageClient cdsStorageClient;
|
||||||
@MockBean
|
@MockBean
|
||||||
protected BenderSrv.Iface benderClient;
|
protected BenderSrv.Iface benderClient;
|
||||||
@MockBean
|
@MockBean
|
||||||
protected RemoteClient client;
|
protected RemoteClient client;
|
||||||
@MockBean
|
@MockBean
|
||||||
protected HellgateAdapterClient hellgateAdapterClient;
|
protected HellgateClient hellgateClient;
|
||||||
@MockBean
|
@MockBean
|
||||||
protected AdapterConfigurationValidator paymentContextValidator;
|
protected AdapterConfigurationValidator paymentContextValidator;
|
||||||
|
|
||||||
|
@ -3,8 +3,8 @@ package dev.vality.adapter.flow.lib.flow.config;
|
|||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||||
import dev.vality.adapter.flow.lib.utils.SimpleErrorMapping;
|
import dev.vality.adapter.common.component.SimpleErrorMapping;
|
||||||
import dev.vality.error.mapping.ErrorMapping;
|
import dev.vality.adapter.common.mapper.ErrorMapping;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package dev.vality.adapter.flow.lib.flow.config;
|
package dev.vality.adapter.flow.lib.flow.config;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import dev.vality.adapter.common.cds.CdsStorageClient;
|
||||||
|
import dev.vality.adapter.common.hellgate.HellgateClient;
|
||||||
|
import dev.vality.adapter.common.mapper.ErrorMapping;
|
||||||
import dev.vality.adapter.flow.lib.converter.ExitStateModelToTemporaryContextConverter;
|
import dev.vality.adapter.flow.lib.converter.ExitStateModelToTemporaryContextConverter;
|
||||||
import dev.vality.adapter.flow.lib.converter.base.EntryModelToBaseRequestModelConverter;
|
import dev.vality.adapter.flow.lib.converter.base.EntryModelToBaseRequestModelConverter;
|
||||||
import dev.vality.adapter.flow.lib.converter.entry.CtxToEntryModelConverter;
|
import dev.vality.adapter.flow.lib.converter.entry.CtxToEntryModelConverter;
|
||||||
@ -23,11 +26,8 @@ import dev.vality.adapter.flow.lib.utils.AdapterProperties;
|
|||||||
import dev.vality.adapter.flow.lib.utils.CallbackUrlExtractor;
|
import dev.vality.adapter.flow.lib.utils.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.adapter.helpers.hellgate.HellgateAdapterClient;
|
|
||||||
import dev.vality.bender.BenderSrv;
|
import dev.vality.bender.BenderSrv;
|
||||||
import dev.vality.cds.client.storage.CdsClientStorage;
|
|
||||||
import dev.vality.damsel.proxy_provider.ProviderProxySrv;
|
import dev.vality.damsel.proxy_provider.ProviderProxySrv;
|
||||||
import dev.vality.error.mapping.ErrorMapping;
|
|
||||||
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;
|
||||||
@ -83,12 +83,12 @@ public class HandlerConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public CtxToEntryModelConverter ctxToEntryModelConverter(CdsClientStorage cdsClientStorage,
|
public CtxToEntryModelConverter ctxToEntryModelConverter(CdsStorageClient cdsStorageClient,
|
||||||
TemporaryContextDeserializer adapterDeserializer,
|
TemporaryContextDeserializer adapterDeserializer,
|
||||||
IdGenerator idGenerator,
|
IdGenerator idGenerator,
|
||||||
TemporaryContextService temporaryContextService,
|
TemporaryContextService temporaryContextService,
|
||||||
CallbackUrlExtractor callbackUrlExtractor) {
|
CallbackUrlExtractor callbackUrlExtractor) {
|
||||||
return new CtxToEntryModelConverter(cdsClientStorage,
|
return new CtxToEntryModelConverter(cdsStorageClient,
|
||||||
adapterDeserializer,
|
adapterDeserializer,
|
||||||
idGenerator,
|
idGenerator,
|
||||||
temporaryContextService,
|
temporaryContextService,
|
||||||
@ -104,12 +104,12 @@ public class HandlerConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public RecCtxToEntryModelConverter recCtxToEntryModelConverter(CdsClientStorage cdsClientStorage,
|
public RecCtxToEntryModelConverter recCtxToEntryModelConverter(CdsStorageClient cdsStorageClient,
|
||||||
TemporaryContextDeserializer adapterDeserializer,
|
TemporaryContextDeserializer adapterDeserializer,
|
||||||
IdGenerator idGenerator,
|
IdGenerator idGenerator,
|
||||||
TemporaryContextService temporaryContextService) {
|
TemporaryContextService temporaryContextService) {
|
||||||
return new RecCtxToEntryModelConverter(adapterDeserializer,
|
return new RecCtxToEntryModelConverter(adapterDeserializer,
|
||||||
cdsClientStorage,
|
cdsStorageClient,
|
||||||
idGenerator,
|
idGenerator,
|
||||||
temporaryContextService);
|
temporaryContextService);
|
||||||
}
|
}
|
||||||
@ -154,12 +154,13 @@ public class HandlerConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public ThreeDsAdapterService threeDsAdapterService(HellgateAdapterClient hgClient,
|
public ThreeDsAdapterService threeDsAdapterService(HellgateClient hellgateClient,
|
||||||
ParametersSerializer parametersSerializer,
|
ParametersSerializer parametersSerializer,
|
||||||
ParametersDeserializer parametersDeserializer,
|
ParametersDeserializer parametersDeserializer,
|
||||||
TagManagementService tagManagementService
|
TagManagementService tagManagementService
|
||||||
) {
|
) {
|
||||||
return new ThreeDsAdapterService(hgClient, parametersSerializer, parametersDeserializer, tagManagementService);
|
return new ThreeDsAdapterService(
|
||||||
|
hellgateClient, parametersSerializer, parametersDeserializer, tagManagementService);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
@ -31,7 +31,7 @@ public class ErrorPaymentNon3dsTest extends AbstractPaymentTest {
|
|||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() throws TException {
|
public void setUp() throws TException {
|
||||||
MockitoAnnotations.openMocks(this);
|
MockitoAnnotations.openMocks(this);
|
||||||
MockUtil.mockAllWithout3Ds(cdsClientStorage, benderClient);
|
MockUtil.mockAllWithout3Ds(cdsStorageClient, benderClient);
|
||||||
|
|
||||||
BaseResponseModel baseResponseModel = BeanUtils.createBaseResponseModel();
|
BaseResponseModel baseResponseModel = BeanUtils.createBaseResponseModel();
|
||||||
baseResponseModel.setErrorCode("rem_error_21");
|
baseResponseModel.setErrorCode("rem_error_21");
|
||||||
|
@ -37,7 +37,7 @@ public class ForwardRecurrentPaymentNon3dsTest extends AbstractPaymentTest {
|
|||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() throws TException {
|
public void setUp() throws TException {
|
||||||
MockitoAnnotations.openMocks(this);
|
MockitoAnnotations.openMocks(this);
|
||||||
MockUtil.mockAllWithout3Ds(cdsClientStorage, benderClient);
|
MockUtil.mockAllWithout3Ds(cdsStorageClient, benderClient);
|
||||||
|
|
||||||
BaseResponseModel baseResponseModel = BeanUtils.createBaseResponseModel();
|
BaseResponseModel baseResponseModel = BeanUtils.createBaseResponseModel();
|
||||||
baseResponseModel.setRecurrentToken(RECURRENT_TOKEN);
|
baseResponseModel.setRecurrentToken(RECURRENT_TOKEN);
|
||||||
|
@ -40,7 +40,7 @@ public class GenerateToken3ds1Test extends AbstractGenerateTokenTest {
|
|||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() throws TException {
|
public void setUp() throws TException {
|
||||||
MockitoAnnotations.openMocks(this);
|
MockitoAnnotations.openMocks(this);
|
||||||
MockUtil.mockAllWithout3Ds(cdsClientStorage, benderClient);
|
MockUtil.mockAllWithout3Ds(cdsStorageClient, benderClient);
|
||||||
|
|
||||||
BaseResponseModel baseResponseModel = BeanUtils.createBaseResponseModel();
|
BaseResponseModel baseResponseModel = BeanUtils.createBaseResponseModel();
|
||||||
baseResponseModel.setThreeDsData(BeanUtils.create3Ds1(baseResponseModel));
|
baseResponseModel.setThreeDsData(BeanUtils.create3Ds1(baseResponseModel));
|
||||||
|
@ -34,7 +34,7 @@ public class GenerateTokenNon3dsTest extends AbstractGenerateTokenTest {
|
|||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() throws TException {
|
public void setUp() throws TException {
|
||||||
MockitoAnnotations.openMocks(this);
|
MockitoAnnotations.openMocks(this);
|
||||||
MockUtil.mockAllWithout3Ds(cdsClientStorage, benderClient);
|
MockUtil.mockAllWithout3Ds(cdsStorageClient, benderClient);
|
||||||
|
|
||||||
BaseResponseModel baseResponseModel = BeanUtils.createBaseResponseModel();
|
BaseResponseModel baseResponseModel = BeanUtils.createBaseResponseModel();
|
||||||
baseResponseModel.setRecurrentToken(RECURRENT_TOKEN);
|
baseResponseModel.setRecurrentToken(RECURRENT_TOKEN);
|
||||||
|
@ -32,7 +32,7 @@ public class PaymentNon3dsTest extends AbstractPaymentTest {
|
|||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() throws TException {
|
public void setUp() throws TException {
|
||||||
MockitoAnnotations.openMocks(this);
|
MockitoAnnotations.openMocks(this);
|
||||||
MockUtil.mockAllWithout3Ds(cdsClientStorage, benderClient);
|
MockUtil.mockAllWithout3Ds(cdsStorageClient, benderClient);
|
||||||
|
|
||||||
BaseResponseModel baseResponseModel = BeanUtils.createBaseResponseModel();
|
BaseResponseModel baseResponseModel = BeanUtils.createBaseResponseModel();
|
||||||
Mockito.when(client.auth(any())).thenReturn(baseResponseModel);
|
Mockito.when(client.auth(any())).thenReturn(baseResponseModel);
|
||||||
|
@ -44,8 +44,8 @@ public class PaymentSuccess3ds1Test extends AbstractPaymentTest {
|
|||||||
public void setUp() throws TException {
|
public void setUp() throws TException {
|
||||||
MockitoAnnotations.openMocks(this);
|
MockitoAnnotations.openMocks(this);
|
||||||
|
|
||||||
MockUtil.mock3ds1CardData(cdsClientStorage);
|
MockUtil.mock3ds1CardData(cdsStorageClient);
|
||||||
MockUtil.mock3ds1SessionData(cdsClientStorage);
|
MockUtil.mock3ds1SessionData(cdsStorageClient);
|
||||||
MockUtil.mockIdGenerator(benderClient);
|
MockUtil.mockIdGenerator(benderClient);
|
||||||
|
|
||||||
BaseResponseModel baseResponseModel = BeanUtils.createBaseResponseModel();
|
BaseResponseModel baseResponseModel = BeanUtils.createBaseResponseModel();
|
||||||
|
@ -43,8 +43,8 @@ public class PaymentSuccess3ds2FullTest extends AbstractPaymentTest {
|
|||||||
public void setUp() throws TException {
|
public void setUp() throws TException {
|
||||||
MockitoAnnotations.openMocks(this);
|
MockitoAnnotations.openMocks(this);
|
||||||
|
|
||||||
MockUtil.mock3ds1CardData(cdsClientStorage);
|
MockUtil.mock3ds1CardData(cdsStorageClient);
|
||||||
MockUtil.mock3ds1SessionData(cdsClientStorage);
|
MockUtil.mock3ds1SessionData(cdsStorageClient);
|
||||||
MockUtil.mockIdGenerator(benderClient);
|
MockUtil.mockIdGenerator(benderClient);
|
||||||
|
|
||||||
BaseResponseModel baseResponseModelCheck = BeanUtils.createBaseResponseModel();
|
BaseResponseModel baseResponseModelCheck = BeanUtils.createBaseResponseModel();
|
||||||
|
@ -43,8 +43,8 @@ public class PaymentSuccess3ds2SimpleTest extends AbstractPaymentTest {
|
|||||||
public void setUp() throws TException {
|
public void setUp() throws TException {
|
||||||
MockitoAnnotations.openMocks(this);
|
MockitoAnnotations.openMocks(this);
|
||||||
|
|
||||||
MockUtil.mock3ds1CardData(cdsClientStorage);
|
MockUtil.mock3ds1CardData(cdsStorageClient);
|
||||||
MockUtil.mock3ds1SessionData(cdsClientStorage);
|
MockUtil.mock3ds1SessionData(cdsStorageClient);
|
||||||
MockUtil.mockIdGenerator(benderClient);
|
MockUtil.mockIdGenerator(benderClient);
|
||||||
|
|
||||||
BaseResponseModel baseResponseModelCheck = BeanUtils.createBaseResponseModel();
|
BaseResponseModel baseResponseModelCheck = BeanUtils.createBaseResponseModel();
|
||||||
|
@ -32,7 +32,7 @@ public class RefundPaymentNon3dsTest extends AbstractPaymentTest {
|
|||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() throws TException {
|
public void setUp() throws TException {
|
||||||
MockitoAnnotations.openMocks(this);
|
MockitoAnnotations.openMocks(this);
|
||||||
MockUtil.mockAllWithout3Ds(cdsClientStorage, benderClient);
|
MockUtil.mockAllWithout3Ds(cdsStorageClient, benderClient);
|
||||||
|
|
||||||
BaseResponseModel baseResponseModel = BeanUtils.createBaseResponseModel();
|
BaseResponseModel baseResponseModel = BeanUtils.createBaseResponseModel();
|
||||||
Mockito.when(client.auth(any())).thenReturn(baseResponseModel);
|
Mockito.when(client.auth(any())).thenReturn(baseResponseModel);
|
||||||
|
@ -31,7 +31,7 @@ public class ErrorPaymentNon3dsTest extends AbstractPaymentTest {
|
|||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() throws TException {
|
public void setUp() throws TException {
|
||||||
MockitoAnnotations.openMocks(this);
|
MockitoAnnotations.openMocks(this);
|
||||||
MockUtil.mockAllWithout3Ds(cdsClientStorage, benderClient);
|
MockUtil.mockAllWithout3Ds(cdsStorageClient, benderClient);
|
||||||
|
|
||||||
BaseResponseModel baseResponseModel = BeanUtils.createBaseResponseModel();
|
BaseResponseModel baseResponseModel = BeanUtils.createBaseResponseModel();
|
||||||
baseResponseModel.setErrorCode("rem_error_21");
|
baseResponseModel.setErrorCode("rem_error_21");
|
||||||
|
@ -41,7 +41,7 @@ public class ForwardRecurrentPaymentNon3dsTest extends AbstractPaymentTest {
|
|||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() throws TException {
|
public void setUp() throws TException {
|
||||||
MockitoAnnotations.openMocks(this);
|
MockitoAnnotations.openMocks(this);
|
||||||
MockUtil.mockAllWithout3Ds(cdsClientStorage, benderClient);
|
MockUtil.mockAllWithout3Ds(cdsStorageClient, benderClient);
|
||||||
|
|
||||||
BaseResponseModel baseResponseModel = BeanUtils.createBaseResponseModel();
|
BaseResponseModel baseResponseModel = BeanUtils.createBaseResponseModel();
|
||||||
baseResponseModel.setRecurrentToken(RECURRENT_TOKEN);
|
baseResponseModel.setRecurrentToken(RECURRENT_TOKEN);
|
||||||
|
@ -38,7 +38,7 @@ public class GenerateToken3ds1Test extends AbstractGenerateTokenTest {
|
|||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() throws TException {
|
public void setUp() throws TException {
|
||||||
MockitoAnnotations.openMocks(this);
|
MockitoAnnotations.openMocks(this);
|
||||||
MockUtil.mockAllWithout3Ds(cdsClientStorage, benderClient);
|
MockUtil.mockAllWithout3Ds(cdsStorageClient, benderClient);
|
||||||
|
|
||||||
BaseResponseModel baseResponseModel = BeanUtils.createBaseResponseModel();
|
BaseResponseModel baseResponseModel = BeanUtils.createBaseResponseModel();
|
||||||
baseResponseModel.setThreeDsData(BeanUtils.create3Ds1(baseResponseModel));
|
baseResponseModel.setThreeDsData(BeanUtils.create3Ds1(baseResponseModel));
|
||||||
|
@ -36,7 +36,7 @@ public class PaymentNon3dsTest extends AbstractPaymentTest {
|
|||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() throws TException {
|
public void setUp() throws TException {
|
||||||
MockitoAnnotations.openMocks(this);
|
MockitoAnnotations.openMocks(this);
|
||||||
MockUtil.mockAllWithout3Ds(cdsClientStorage, benderClient);
|
MockUtil.mockAllWithout3Ds(cdsStorageClient, benderClient);
|
||||||
|
|
||||||
BaseResponseModel baseResponseModel = BeanUtils.createBaseResponseModel();
|
BaseResponseModel baseResponseModel = BeanUtils.createBaseResponseModel();
|
||||||
Mockito.when(client.auth(any())).thenReturn(baseResponseModel);
|
Mockito.when(client.auth(any())).thenReturn(baseResponseModel);
|
||||||
|
@ -43,8 +43,8 @@ public class PaymentSuccess3dsTest extends AbstractPaymentTest {
|
|||||||
public void setUp() throws TException {
|
public void setUp() throws TException {
|
||||||
MockitoAnnotations.openMocks(this);
|
MockitoAnnotations.openMocks(this);
|
||||||
|
|
||||||
MockUtil.mock3ds1CardData(cdsClientStorage);
|
MockUtil.mock3ds1CardData(cdsStorageClient);
|
||||||
MockUtil.mock3ds1SessionData(cdsClientStorage);
|
MockUtil.mock3ds1SessionData(cdsStorageClient);
|
||||||
MockUtil.mockIdGenerator(benderClient);
|
MockUtil.mockIdGenerator(benderClient);
|
||||||
|
|
||||||
BaseResponseModel baseResponseModel = BeanUtils.createBaseResponseModel();
|
BaseResponseModel baseResponseModel = BeanUtils.createBaseResponseModel();
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package dev.vality.adapter.flow.lib.flow.utils;
|
package dev.vality.adapter.flow.lib.flow.utils;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import dev.vality.adapter.common.utils.CommonConverter;
|
||||||
import dev.vality.adapter.flow.lib.constant.Status;
|
import dev.vality.adapter.flow.lib.constant.Status;
|
||||||
import dev.vality.adapter.flow.lib.constant.ThreeDsType;
|
import dev.vality.adapter.flow.lib.constant.ThreeDsType;
|
||||||
import dev.vality.adapter.flow.lib.model.BaseResponseModel;
|
import dev.vality.adapter.flow.lib.model.BaseResponseModel;
|
||||||
import dev.vality.adapter.flow.lib.model.ThreeDsData;
|
import dev.vality.adapter.flow.lib.model.ThreeDsData;
|
||||||
import dev.vality.java.damsel.converter.CommonConverter;
|
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
package dev.vality.adapter.flow.lib.flow.utils;
|
package dev.vality.adapter.flow.lib.flow.utils;
|
||||||
|
|
||||||
|
import dev.vality.adapter.common.cds.CdsStorageClient;
|
||||||
|
import dev.vality.adapter.common.cds.model.CardDataProxyModel;
|
||||||
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.bender.BenderSrv;
|
import dev.vality.bender.BenderSrv;
|
||||||
import dev.vality.bender.GenerationResult;
|
import dev.vality.bender.GenerationResult;
|
||||||
import dev.vality.cds.client.storage.CdsClientStorage;
|
|
||||||
import dev.vality.cds.storage.*;
|
import dev.vality.cds.storage.*;
|
||||||
import dev.vality.damsel.domain.*;
|
import dev.vality.damsel.domain.*;
|
||||||
import dev.vality.damsel.proxy_provider.Cash;
|
import dev.vality.damsel.proxy_provider.Cash;
|
||||||
import dev.vality.damsel.proxy_provider.Invoice;
|
import dev.vality.damsel.proxy_provider.Invoice;
|
||||||
import dev.vality.damsel.proxy_provider.InvoicePayment;
|
import dev.vality.damsel.proxy_provider.InvoicePayment;
|
||||||
import dev.vality.damsel.proxy_provider.*;
|
import dev.vality.damsel.proxy_provider.*;
|
||||||
import dev.vality.java.cds.utils.model.CardDataProxyModel;
|
|
||||||
import org.apache.thrift.TException;
|
import org.apache.thrift.TException;
|
||||||
import org.mockito.stubbing.Answer;
|
import org.mockito.stubbing.Answer;
|
||||||
|
|
||||||
@ -41,56 +41,56 @@ public class MockUtil {
|
|||||||
public static final String CVV_3DS_2 = "584";
|
public static final String CVV_3DS_2 = "584";
|
||||||
public static final String CVV_3DS_2_SIMPLE_FLOW = "590";
|
public static final String CVV_3DS_2_SIMPLE_FLOW = "590";
|
||||||
|
|
||||||
public static void mockAllWithout3Ds(CdsClientStorage cdsClientStorage, BenderSrv.Iface benderClient)
|
public static void mockAllWithout3Ds(CdsStorageClient cdsStorageClient, BenderSrv.Iface benderClient)
|
||||||
throws TException {
|
throws TException {
|
||||||
MockUtil.mockCardDataWithout3ds(cdsClientStorage);
|
MockUtil.mockCardDataWithout3ds(cdsStorageClient);
|
||||||
MockUtil.mockSessionData(cdsClientStorage);
|
MockUtil.mockSessionData(cdsStorageClient);
|
||||||
MockUtil.mockIdGenerator(benderClient);
|
MockUtil.mockIdGenerator(benderClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void mockCardDataWithout3ds(CdsClientStorage cdsClientStorage) {
|
public static void mockCardDataWithout3ds(CdsStorageClient cdsStorageClient) {
|
||||||
mockCardData(EXP_MONTH_NON3DS,
|
mockCardData(EXP_MONTH_NON3DS,
|
||||||
EXP_YEAR_NON3DS,
|
EXP_YEAR_NON3DS,
|
||||||
CARDHOLDER_NAME,
|
CARDHOLDER_NAME,
|
||||||
PAN_SUCCESS_NON3DS,
|
PAN_SUCCESS_NON3DS,
|
||||||
cdsClientStorage);
|
cdsStorageClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void mock3ds1CardData(CdsClientStorage cdsClientStorage) {
|
public static void mock3ds1CardData(CdsStorageClient cdsStorageClient) {
|
||||||
mockCardData(EXP_MONTH_NON3DS,
|
mockCardData(EXP_MONTH_NON3DS,
|
||||||
EXP_YEAR_NON3DS,
|
EXP_YEAR_NON3DS,
|
||||||
CARDHOLDER_NAME,
|
CARDHOLDER_NAME,
|
||||||
PAN_SUCCESS_3DS_1,
|
PAN_SUCCESS_3DS_1,
|
||||||
cdsClientStorage);
|
cdsStorageClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void mock3ds2FullFlowCardData(CdsClientStorage cdsClientStorage) {
|
public static void mock3ds2FullFlowCardData(CdsStorageClient cdsStorageClient) {
|
||||||
mockCardData(EXP_MONTH_3DS_2,
|
mockCardData(EXP_MONTH_3DS_2,
|
||||||
EXP_YEAR_3DS_2,
|
EXP_YEAR_3DS_2,
|
||||||
CARDHOLDER_NAME,
|
CARDHOLDER_NAME,
|
||||||
PAN_SUCCESS_3DS_2,
|
PAN_SUCCESS_3DS_2,
|
||||||
cdsClientStorage);
|
cdsStorageClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void mock3ds2SimpleFlowCardData(CdsClientStorage cdsClientStorage) {
|
public static void mock3ds2SimpleFlowCardData(CdsStorageClient cdsStorageClient) {
|
||||||
mockCardData(EXP_MONTH_3DS_2,
|
mockCardData(EXP_MONTH_3DS_2,
|
||||||
EXP_YEAR_3DS_2,
|
EXP_YEAR_3DS_2,
|
||||||
CARDHOLDER_NAME,
|
CARDHOLDER_NAME,
|
||||||
PAN_SUCCESS_3DS_2_SIMPLE_FLOW,
|
PAN_SUCCESS_3DS_2_SIMPLE_FLOW,
|
||||||
cdsClientStorage);
|
cdsStorageClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void mockCardData(int expMonthNon3ds,
|
private static void mockCardData(int expMonthNon3ds,
|
||||||
int expYearNon3ds,
|
int expYearNon3ds,
|
||||||
String cardholderName,
|
String cardholderName,
|
||||||
String panSuccessNon3ds,
|
String panSuccessNon3ds,
|
||||||
CdsClientStorage cdsClientStorage) {
|
CdsStorageClient cdsStorageClient) {
|
||||||
doAnswer((Answer<CardDataProxyModel>) invocationOnMock -> CardDataProxyModel.builder()
|
doAnswer((Answer<CardDataProxyModel>) invocationOnMock -> CardDataProxyModel.builder()
|
||||||
.expMonth((byte) expMonthNon3ds)
|
.expMonth((byte) expMonthNon3ds)
|
||||||
.expYear((short) expYearNon3ds)
|
.expYear((short) expYearNon3ds)
|
||||||
.cardholderName(cardholderName)
|
.cardholderName(cardholderName)
|
||||||
.pan(panSuccessNon3ds)
|
.pan(panSuccessNon3ds)
|
||||||
.build()).when(cdsClientStorage).getCardData(any(RecurrentTokenContext.class));
|
.build()).when(cdsStorageClient).getCardData(any(RecurrentTokenContext.class));
|
||||||
doAnswer((Answer<CardData>) invocation ->
|
doAnswer((Answer<CardData>) invocation ->
|
||||||
new CardData()
|
new CardData()
|
||||||
.setExpDate(new ExpDate()
|
.setExpDate(new ExpDate()
|
||||||
@ -98,7 +98,7 @@ public class MockUtil {
|
|||||||
.setYear((short) expYearNon3ds))
|
.setYear((short) expYearNon3ds))
|
||||||
.setPan(panSuccessNon3ds)
|
.setPan(panSuccessNon3ds)
|
||||||
.setCardholderName(cardholderName))
|
.setCardholderName(cardholderName))
|
||||||
.when(cdsClientStorage).getCardData(any(PaymentContext.class));
|
.when(cdsStorageClient).getCardData(any(PaymentContext.class));
|
||||||
doAnswer((Answer<CardData>) invocation ->
|
doAnswer((Answer<CardData>) invocation ->
|
||||||
new CardData()
|
new CardData()
|
||||||
.setExpDate(new ExpDate()
|
.setExpDate(new ExpDate()
|
||||||
@ -106,32 +106,32 @@ public class MockUtil {
|
|||||||
.setYear((short) expYearNon3ds))
|
.setYear((short) expYearNon3ds))
|
||||||
.setPan(panSuccessNon3ds)
|
.setPan(panSuccessNon3ds)
|
||||||
.setCardholderName(cardholderName))
|
.setCardholderName(cardholderName))
|
||||||
.when(cdsClientStorage).getCardData(any(String.class));
|
.when(cdsStorageClient).getCardData(any(String.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void mockSessionData(CdsClientStorage cdsClientStorage) {
|
public static void mockSessionData(CdsStorageClient cdsStorageClient) {
|
||||||
mockCvv(CVV_NON3DS, cdsClientStorage);
|
mockCvv(CVV_NON3DS, cdsStorageClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void mock3ds1SessionData(CdsClientStorage cdsClientStorage) {
|
public static void mock3ds1SessionData(CdsStorageClient cdsStorageClient) {
|
||||||
mockCvv(CVV_3DS_1, cdsClientStorage);
|
mockCvv(CVV_3DS_1, cdsStorageClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void mock3ds2FullFlowSessionData(CdsClientStorage cdsClientStorage) {
|
public static void mock3ds2FullFlowSessionData(CdsStorageClient cdsStorageClient) {
|
||||||
mockCvv(CVV_3DS_2, cdsClientStorage);
|
mockCvv(CVV_3DS_2, cdsStorageClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void mock3ds2SimpleFlowSessionData(CdsClientStorage cdsClientStorage) {
|
public static void mock3ds2SimpleFlowSessionData(CdsStorageClient cdsStorageClient) {
|
||||||
mockCvv(CVV_3DS_2_SIMPLE_FLOW, cdsClientStorage);
|
mockCvv(CVV_3DS_2_SIMPLE_FLOW, cdsStorageClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void mockCvv(String cvvNon3ds, CdsClientStorage cdsClientStorage) {
|
private static void mockCvv(String cvvNon3ds, CdsStorageClient cdsStorageClient) {
|
||||||
doAnswer((Answer<SessionData>) invocation ->
|
doAnswer((Answer<SessionData>) invocation ->
|
||||||
new SessionData(AuthData.card_security_code(new CardSecurityCode(cvvNon3ds))))
|
new SessionData(AuthData.card_security_code(new CardSecurityCode(cvvNon3ds))))
|
||||||
.when(cdsClientStorage).getSessionData(any(RecurrentTokenContext.class));
|
.when(cdsStorageClient).getSessionData(any(RecurrentTokenContext.class));
|
||||||
doAnswer((Answer<SessionData>) invocation ->
|
doAnswer((Answer<SessionData>) invocation ->
|
||||||
new SessionData(AuthData.card_security_code(new CardSecurityCode(cvvNon3ds))))
|
new SessionData(AuthData.card_security_code(new CardSecurityCode(cvvNon3ds))))
|
||||||
.when(cdsClientStorage).getSessionData(any(PaymentContext.class));
|
.when(cdsStorageClient).getSessionData(any(PaymentContext.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void mockIdGenerator(BenderSrv.Iface benderClient) throws TException {
|
public static void mockIdGenerator(BenderSrv.Iface benderClient) throws TException {
|
||||||
|
@ -0,0 +1,139 @@
|
|||||||
|
package dev.vality.adapter.flow.lib.logback.mask;
|
||||||
|
|
||||||
|
import ch.qos.logback.classic.Level;
|
||||||
|
import ch.qos.logback.classic.LoggerContext;
|
||||||
|
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||||
|
import ch.qos.logback.classic.spi.IThrowableProxy;
|
||||||
|
import ch.qos.logback.classic.spi.LoggerContextVO;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.slf4j.Marker;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.GregorianCalendar;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
public class PatternMaskingLayoutTest {
|
||||||
|
|
||||||
|
private PatternMaskingLayout patternMaskingLayout = new PatternMaskingLayout();
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
public void init() {
|
||||||
|
patternMaskingLayout.setPattern("%-5p [%d{ISO8601}] %m%n");
|
||||||
|
|
||||||
|
String[] maskPatterns = {"\\b\\d{6}([\\d\\s]{2,9})\\d{4}\\b", "(\\b\\d{3}\\b)"};
|
||||||
|
for (String maskPattern : maskPatterns) {
|
||||||
|
patternMaskingLayout.addMaskPattern(maskPattern);
|
||||||
|
}
|
||||||
|
|
||||||
|
LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
|
||||||
|
loggerContext.reset();
|
||||||
|
patternMaskingLayout.setContext(loggerContext);
|
||||||
|
patternMaskingLayout.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testPatternMaskingLayout() {
|
||||||
|
Calendar calendar = new GregorianCalendar(2019, Calendar.APRIL, 15, 14, 15, 16);
|
||||||
|
|
||||||
|
String msg =
|
||||||
|
"http://localhost/?COMMAND=PREAUTH&VERSION=1.0&PAN=3412345678909876&PAN2=9876543219987654&EXPDATE" +
|
||||||
|
"=2012&TERMID=1235111&AMOUNT=1000&CURRENCY=643&INVOICE=invoice_id.1&CVV2=123" +
|
||||||
|
"&RRN=904792140574&CONDITION=3&TDSDATA=";
|
||||||
|
|
||||||
|
ILoggingEvent loggingEvent = createLoggingEvent(Level.DEBUG, calendar.getTime(), msg);
|
||||||
|
|
||||||
|
assertEquals(
|
||||||
|
"DEBUG [2019-04-15 14:15:16,000] http://localhost/?COMMAND=PREAUTH&VERSION=1.0" +
|
||||||
|
"&PAN=341234******9876&PAN2=987654******7654&EXPDATE=2012&TERMID=1235111&AMOUNT=1000" +
|
||||||
|
"&CURRENCY=***&INVOICE=invoice_id.1&CVV2=***&RRN=904792**0574&CONDITION=3&TDSDATA=" +
|
||||||
|
System.lineSeparator(),
|
||||||
|
patternMaskingLayout.doLayout(loggingEvent));
|
||||||
|
}
|
||||||
|
|
||||||
|
ILoggingEvent createLoggingEvent(Level logLevel, Date date, String msg) {
|
||||||
|
|
||||||
|
return new ILoggingEvent() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getThreadName() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Level getLevel() {
|
||||||
|
return logLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMessage() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object[] getArgumentArray() {
|
||||||
|
return new Object[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getFormattedMessage() {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getLoggerName() {
|
||||||
|
return "loggerName";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LoggerContextVO getLoggerContextVO() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IThrowableProxy getThrowableProxy() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StackTraceElement[] getCallerData() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasCallerData() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Marker getMarker() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, String> getMDCPropertyMap() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, String> getMdc() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getTimeStamp() {
|
||||||
|
return date.getTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void prepareForDeferredProcessing() {
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user