bump actions, migrate on dev.vality (#39)

* Revert "typo"

This reverts commit fc8e24ad9d.

* Revert "bump actions"

This reverts commit 2a0fa6f2c0.

* bump actions

* bump actions, migrate on vality

* bump actions, migrate on vality

* bump actions, migrate on vality

* bump actions, migrate on vality
This commit is contained in:
Anatolii Karlov 2023-10-10 19:14:18 +03:00 committed by GitHub
parent fc8e24ad9d
commit 2460d0411f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
192 changed files with 1311 additions and 1297 deletions

View File

@ -1,6 +0,0 @@
coverage:
status:
project:
default:
target: auto
threshold: 1%

View File

@ -1,4 +1,4 @@
name: Build Artifact
name: Build Maven Artifact
on:
pull_request:

View File

@ -5,10 +5,7 @@ on:
branches:
- 'master'
- 'main'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
- 'epic/**'
jobs:
build-and-deploy:

0
.gitmodules vendored
View File

View File

@ -1,4 +0,0 @@
extraction:
java:
index:
java_version: "15"

View File

@ -5,8 +5,8 @@
├── src
│   ├── main
│   │   ├── java
│   │   │   └── com
│   │   │   └── rbkmoney
│   │   │   └── dev
│   │   │   └── vality
│   │   │   └── proxy
│   │   │   └── mocketbank
│   │   │   ├── ProxyMocketBankApplication.java

134
pom.xml
View File

@ -5,9 +5,9 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.rbkmoney</groupId>
<groupId>dev.vality</groupId>
<artifactId>service-parent-pom</artifactId>
<version>2.0.15</version>
<version>2.1.5</version>
</parent>
<artifactId>proxy-mocketbank</artifactId>
@ -21,11 +21,9 @@
<server.port>8022</server.port>
<management.port>8023</management.port>
<server.rest.port>8080</server.rest.port>
<server.rest.endpoint>mocketbank</server.rest.endpoint>
<exposed.ports>${server.port} ${server.rest.port} ${management.port}</exposed.ports>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.maintainer>Anatoly Cherkasov &lt;a.cherkasov@rbkmoney.com&gt;</project.maintainer>
<dockerfile.base.service.tag>7e0c98bb</dockerfile.base.service.tag>
<shared-resources.version>1.4.0</shared-resources.version>
<cds-proto.version>1.64-74a763b</cds-proto.version>
<scrooge.proto.version>1.16-b0d5cf2</scrooge.proto.version>
</properties>
@ -36,28 +34,43 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web-services</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
<version>5.3</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.2.3.Final</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
@ -67,98 +80,43 @@
<artifactId>commons-text</artifactId>
<version>1.10.0</version>
</dependency>
<!-- vality -->
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-core</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
<!--RBK libs-->
<dependency>
<groupId>com.rbkmoney</groupId>
<artifactId>shared-resources</artifactId>
<version>${shared-resources.version}</version>
</dependency>
<dependency>
<groupId>com.rbkmoney.adapter-client-lib</groupId>
<artifactId>hellgate-adapter-client</artifactId>
</dependency>
<dependency>
<groupId>com.rbkmoney.adapter-client-lib</groupId>
<artifactId>cds-client-storage</artifactId>
</dependency>
<dependency>
<groupId>com.rbkmoney.adapter-client-lib</groupId>
<artifactId>cds-client-identity-document-storage</artifactId>
</dependency>
<dependency>
<groupId>com.rbkmoney.adapter-thrift-lib</groupId>
<artifactId>cds-utils</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>com.rbkmoney.woody</groupId>
<artifactId>woody-thrift</artifactId>
</dependency>
<dependency>
<groupId>com.rbkmoney</groupId>
<groupId>dev.vality</groupId>
<artifactId>damsel</artifactId>
<version>1.597-bfedcb9</version>
</dependency>
<dependency>
<groupId>com.rbkmoney.adapter-thrift-lib</groupId>
<artifactId>damsel-utils</artifactId>
</dependency>
<dependency>
<groupId>com.rbkmoney</groupId>
<groupId>dev.vality</groupId>
<artifactId>cds-proto</artifactId>
<version>${cds-proto.version}</version>
<version>1.66-01353ce</version>
</dependency>
<dependency>
<groupId>com.rbkmoney</groupId>
<groupId>dev.vality</groupId>
<artifactId>moneypenny-proto</artifactId>
<version>1.8-26054d1</version>
<version>1.13-dc974a6</version>
</dependency>
<dependency>
<groupId>com.rbkmoney.geck</groupId>
<groupId>dev.vality.geck</groupId>
<artifactId>serializer</artifactId>
<version>0.6.12</version>
</dependency>
<dependency>
<groupId>com.rbkmoney</groupId>
<groupId>dev.vality</groupId>
<artifactId>identdocstore-proto</artifactId>
<version>1.10-89a4cda</version>
<version>1.18-0ab676d</version>
</dependency>
<dependency>
<groupId>com.rbkmoney</groupId>
<groupId>dev.vality</groupId>
<artifactId>adapter-common-lib</artifactId>
<version>0.0.30</version>
<exclusions>
<exclusion>
<groupId>com.rbkmoney</groupId>
<artifactId>damsel-utils</artifactId>
</exclusion>
<exclusion>
<groupId>com.rbkmoney</groupId>
<artifactId>cds-utils</artifactId>
</exclusion>
</exclusions>
<version>1.2.13</version>
</dependency>
<!--dev.vality libs-->
<dependency>
<groupId>dev.vality</groupId>
<artifactId>scrooge-proto</artifactId>
<version>${scrooge.proto.version}</version>
</dependency>
<dependency>
<groupId>dev.vality</groupId>
<artifactId>adapter-common-lib</artifactId>
<version>1.1.5</version>
</dependency>
<!--Test libs-->
<dependency>
<groupId>org.jsoup</groupId>
@ -195,7 +153,6 @@
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
@ -204,17 +161,17 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-remote-resources-plugin</artifactId>
<version>1.7.0</version>
<version>3.0.0</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-filtering</artifactId>
<version>3.2.0</version>
<version>3.3.1</version>
</dependency>
</dependencies>
<configuration>
<resourceBundles>
<resourceBundle>com.rbkmoney:shared-resources:${shared-resources.version}</resourceBundle>
<resourceBundle>dev.vality:shared-resources:${shared-resources.version}</resourceBundle>
</resourceBundles>
<attachToMain>false</attachToMain>
<attachToTest>false</attachToTest>
@ -229,5 +186,4 @@
</plugin>
</plugins>
</build>
</project>

View File

@ -1,4 +1,4 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["local>valitydev/.github:renovate-config"]
}
}

View File

@ -1,30 +0,0 @@
package com.rbkmoney.proxy.mocketbank.configuration;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.rbkmoney.error.mapping.ErrorMapping;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.Resource;
import java.io.IOException;
@Configuration
public class ErrorMappingConfiguration {
@Value("${error-mapping.file}")
private Resource filePath;
@Value("${error-mapping.patternReason:\"'%s' - '%s'\"}")
private String patternReason;
@Bean
ErrorMapping errorMapping() throws IOException {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true);
return new ErrorMapping(filePath.getInputStream(), patternReason, mapper);
}
}

View File

@ -1,15 +0,0 @@
package com.rbkmoney.proxy.mocketbank.handler.digital.wallet;
import com.rbkmoney.damsel.domain.TargetInvoicePaymentStatus;
import com.rbkmoney.damsel.proxy_provider.PaymentContext;
import com.rbkmoney.damsel.proxy_provider.PaymentProxyResult;
import com.rbkmoney.damsel.proxy_provider.PaymentResource;
import org.apache.thrift.TException;
public interface CommonDigitalWalletHandler {
boolean filter(final TargetInvoicePaymentStatus targetInvoicePaymentStatus, final PaymentResource paymentResource);
PaymentProxyResult handler(PaymentContext context) throws TException;
}

View File

@ -1,15 +0,0 @@
package com.rbkmoney.proxy.mocketbank.handler.mobile;
import com.rbkmoney.damsel.domain.TargetInvoicePaymentStatus;
import com.rbkmoney.damsel.proxy_provider.PaymentContext;
import com.rbkmoney.damsel.proxy_provider.PaymentProxyResult;
import com.rbkmoney.damsel.proxy_provider.PaymentResource;
import org.apache.thrift.TException;
public interface CommonMobileHandler {
boolean filter(final TargetInvoicePaymentStatus targetInvoicePaymentStatus, final PaymentResource paymentResource);
PaymentProxyResult handler(PaymentContext context) throws TException;
}

View File

@ -1,15 +0,0 @@
package com.rbkmoney.proxy.mocketbank.handler.payment;
import com.rbkmoney.damsel.domain.TargetInvoicePaymentStatus;
import com.rbkmoney.damsel.proxy_provider.PaymentContext;
import com.rbkmoney.damsel.proxy_provider.PaymentProxyResult;
import com.rbkmoney.damsel.proxy_provider.PaymentResource;
import org.apache.thrift.TException;
public interface CommonPaymentHandler {
boolean filter(final TargetInvoicePaymentStatus targetInvoicePaymentStatus, final PaymentResource paymentResource);
PaymentProxyResult handler(PaymentContext context) throws TException;
}

View File

@ -1,15 +0,0 @@
package com.rbkmoney.proxy.mocketbank.handler.terminal;
import com.rbkmoney.damsel.domain.TargetInvoicePaymentStatus;
import com.rbkmoney.damsel.proxy_provider.PaymentContext;
import com.rbkmoney.damsel.proxy_provider.PaymentProxyResult;
import com.rbkmoney.damsel.proxy_provider.PaymentResource;
import org.apache.thrift.TException;
public interface CommonTerminalHandler {
boolean filter(final TargetInvoicePaymentStatus targetInvoicePaymentStatus, final PaymentResource paymentResource);
PaymentProxyResult handler(PaymentContext context) throws TException;
}

View File

@ -1,9 +0,0 @@
package com.rbkmoney.proxy.mocketbank.service;
import com.rbkmoney.damsel.withdrawals.provider_adapter.Withdrawal;
import com.rbkmoney.java.cds.utils.model.CardDataProxyModel;
public interface CdsService {
CardDataProxyModel getCardData(Withdrawal withdrawal);
}

View File

@ -1,4 +1,4 @@
package com.rbkmoney.proxy.mocketbank;
package dev.vality.proxy.mocketbank;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

View File

@ -1,7 +1,7 @@
package com.rbkmoney.proxy.mocketbank.configuration;
package dev.vality.proxy.mocketbank.configuration;
import com.rbkmoney.proxy.mocketbank.utils.reader.CardReader;
import com.rbkmoney.proxy.mocketbank.utils.model.Card;
import dev.vality.proxy.mocketbank.utils.model.Card;
import dev.vality.proxy.mocketbank.utils.reader.CardReader;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

View File

@ -0,0 +1,26 @@
package dev.vality.proxy.mocketbank.configuration;
import dev.vality.adapter.common.cds.CdsStorageClient;
import dev.vality.cds.storage.StorageSrv;
import dev.vality.proxy.mocketbank.configuration.properties.CdsClientStorageProperties;
import dev.vality.woody.thrift.impl.http.THSpawnClientBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.io.IOException;
@Configuration
public class CdsStorageConfig {
@Bean
public CdsStorageClient cdsStorageClient(CdsClientStorageProperties properties) throws IOException {
return new CdsStorageClient(getStorageSrv(properties));
}
private StorageSrv.Iface getStorageSrv(CdsClientStorageProperties properties) throws IOException {
return new THSpawnClientBuilder()
.withAddress(properties.getUrl().getURI())
.withNetworkTimeout(properties.getNetworkTimeout())
.build(StorageSrv.Iface.class);
}
}

View File

@ -0,0 +1,28 @@
package dev.vality.proxy.mocketbank.configuration;
import dev.vality.adapter.common.component.SimpleErrorMapping;
import dev.vality.adapter.common.mapper.ErrorMapping;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.Resource;
import java.io.IOException;
@Configuration
public class ErrorMappingConfig {
@Value("${error-mapping.file-path}")
private Resource errorMappingFilePath;
@Value("${error-mapping.pattern:\"'%s' - '%s'\"}")
private String errorMappingPattern;
@Bean
@Primary
public ErrorMapping errorMapping() throws IOException {
return new SimpleErrorMapping(errorMappingFilePath, errorMappingPattern)
.createErrorMapping();
}
}

View File

@ -1,13 +1,15 @@
package com.rbkmoney.proxy.mocketbank.configuration;
package dev.vality.proxy.mocketbank.configuration;
import com.rbkmoney.proxy.mocketbank.decorator.*;
import com.rbkmoney.proxy.mocketbank.handler.digital.wallet.DigitalWalletServerHandler;
import com.rbkmoney.proxy.mocketbank.handler.mobile.MobileServerHandler;
import com.rbkmoney.proxy.mocketbank.handler.mobile.operator.MobileOperatorServerHandler;
import com.rbkmoney.proxy.mocketbank.handler.oct.OctServerHandler;
import com.rbkmoney.proxy.mocketbank.handler.payment.PaymentServerHandler;
import com.rbkmoney.proxy.mocketbank.handler.terminal.TerminalServerHandler;
import org.springframework.context.annotation.*;
import dev.vality.proxy.mocketbank.decorator.*;
import dev.vality.proxy.mocketbank.handler.digital.wallet.DigitalWalletServerHandler;
import dev.vality.proxy.mocketbank.handler.mobile.MobileServerHandler;
import dev.vality.proxy.mocketbank.handler.mobile.operator.MobileOperatorServerHandler;
import dev.vality.proxy.mocketbank.handler.oct.OctServerHandler;
import dev.vality.proxy.mocketbank.handler.payment.PaymentServerHandler;
import dev.vality.proxy.mocketbank.handler.terminal.TerminalServerHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
@Configuration
public class HandlerConfiguration {

View File

@ -0,0 +1,27 @@
package dev.vality.proxy.mocketbank.configuration;
import dev.vality.adapter.common.hellgate.HellgateClient;
import dev.vality.damsel.proxy_provider.ProviderProxyHostSrv;
import dev.vality.proxy.mocketbank.configuration.properties.HellgateClientStorageProperties;
import dev.vality.woody.thrift.impl.http.THSpawnClientBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.io.IOException;
@Configuration
public class HellgateClientConfig {
@Bean
public HellgateClient hellgateClient(HellgateClientStorageProperties properties) throws IOException {
return new HellgateClient(getProviderProxyHostSrv(properties));
}
private ProviderProxyHostSrv.Iface getProviderProxyHostSrv(HellgateClientStorageProperties properties)
throws IOException {
return new THSpawnClientBuilder()
.withAddress(properties.getUrl().getURI())
.withNetworkTimeout(properties.getNetworkTimeout())
.build(ProviderProxyHostSrv.Iface.class);
}
}

View File

@ -1,7 +1,7 @@
package com.rbkmoney.proxy.mocketbank.configuration;
package dev.vality.proxy.mocketbank.configuration;
import com.rbkmoney.proxy.mocketbank.utils.reader.MobilePhoneReader;
import com.rbkmoney.proxy.mocketbank.utils.mobilephone.MobilePhone;
import dev.vality.proxy.mocketbank.utils.mobilephone.MobilePhone;
import dev.vality.proxy.mocketbank.utils.reader.MobilePhoneReader;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

View File

@ -1,7 +1,7 @@
package com.rbkmoney.proxy.mocketbank.configuration;
package dev.vality.proxy.mocketbank.configuration;
import com.rbkmoney.proxy.mocketbank.utils.payout.CardPayout;
import com.rbkmoney.proxy.mocketbank.utils.reader.CardPayoutReader;
import dev.vality.proxy.mocketbank.utils.payout.CardPayout;
import dev.vality.proxy.mocketbank.utils.reader.CardPayoutReader;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

View File

@ -1,6 +1,6 @@
package com.rbkmoney.proxy.mocketbank.configuration;
package dev.vality.proxy.mocketbank.configuration;
import com.rbkmoney.proxy.mocketbank.configuration.properties.RestTemplateProperties;
import dev.vality.proxy.mocketbank.configuration.properties.RestTemplateProperties;
import lombok.RequiredArgsConstructor;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.conn.ssl.NoopHostnameVerifier;

View File

@ -1,6 +1,6 @@
package com.rbkmoney.proxy.mocketbank.configuration;
package dev.vality.proxy.mocketbank.configuration;
import com.rbkmoney.woody.api.flow.WFlow;
import dev.vality.woody.api.flow.WFlow;
import org.apache.catalina.connector.Connector;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;

View File

@ -1,4 +1,4 @@
package com.rbkmoney.proxy.mocketbank.configuration.properties;
package dev.vality.proxy.mocketbank.configuration.properties;
import lombok.Getter;
import lombok.Setter;

View File

@ -1,17 +1,24 @@
package com.rbkmoney.proxy.mocketbank.configuration.properties;
package dev.vality.proxy.mocketbank.configuration.properties;
import com.rbkmoney.adapter.common.properties.CommonAdapterProperties;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.validation.annotation.Validated;
import javax.validation.constraints.NotEmpty;
@Getter
@Setter
@Validated
@Configuration
@ConfigurationProperties("adapter-mock-mpi")
public class AdapterMockMpiProperties extends CommonAdapterProperties {
public class AdapterMockMpiProperties {
private @NotEmpty String url;
private String callbackUrl;
private String pathCallbackUrl;
private String pathRecurrentCallbackUrl;
private String tagPrefix;
}

View File

@ -0,0 +1,24 @@
package dev.vality.proxy.mocketbank.configuration.properties;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.Resource;
import org.springframework.validation.annotation.Validated;
import javax.validation.constraints.NotNull;
@Configuration
@ConfigurationProperties(prefix = "cds.client.storage")
@Validated
@Getter
@Setter
public class CdsClientStorageProperties {
@NotNull
private Resource url;
@NotNull
private int networkTimeout = 5000;
}

View File

@ -0,0 +1,24 @@
package dev.vality.proxy.mocketbank.configuration.properties;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.Resource;
import org.springframework.validation.annotation.Validated;
import javax.validation.constraints.NotNull;
@Configuration
@ConfigurationProperties(prefix = "hellgate.client.storage")
@Validated
@Getter
@Setter
public class HellgateClientStorageProperties {
@NotNull
private Resource url;
@NotNull
private int networkTimeout = 5000;
}

View File

@ -1,4 +1,4 @@
package com.rbkmoney.proxy.mocketbank.configuration.properties;
package dev.vality.proxy.mocketbank.configuration.properties;
import lombok.Getter;
import lombok.Setter;

View File

@ -1,4 +1,4 @@
package com.rbkmoney.proxy.mocketbank.configuration.properties;
package dev.vality.proxy.mocketbank.configuration.properties;
import lombok.Getter;
import lombok.Setter;

View File

@ -1,4 +1,4 @@
package com.rbkmoney.proxy.mocketbank.configuration.properties;
package dev.vality.proxy.mocketbank.configuration.properties;
import lombok.Getter;
import lombok.Setter;

View File

@ -0,0 +1,20 @@
package dev.vality.proxy.mocketbank.constant;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class PaymentState {
public static final String INIT = "init";
public static final String PAY = "block";
public static final String SLEEP = "sleep";
public static final String CAPTURED = "captured";
public static final String REDIRECT = "redirect";
public static final String PENDING = "pending";
public static final String CANCELLED = "cancelled";
public static final String REFUNDED = "refunded";
public static final String CONFIRM = "confirm";
public static final String RECURRENT_INIT = "recurrent_init";
}

View File

@ -1,20 +1,22 @@
package com.rbkmoney.proxy.mocketbank.controller;
package dev.vality.proxy.mocketbank.controller;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.rbkmoney.adapter.helpers.hellgate.HellgateAdapterClient;
import com.rbkmoney.adapter.helpers.hellgate.exception.HellgateException;
import com.rbkmoney.java.damsel.converter.CommonConverter;
import com.rbkmoney.proxy.mocketbank.configuration.properties.AdapterMockBankProperties;
import com.rbkmoney.proxy.mocketbank.service.mpi20.constant.CallbackResponseFields;
import com.rbkmoney.proxy.mocketbank.service.mpi20.model.CRes;
import com.rbkmoney.proxy.mocketbank.service.mpi20.model.ThreeDSMethodData;
import com.rbkmoney.proxy.mocketbank.utils.UrlUtils;
import com.rbkmoney.proxy.mocketbank.utils.state.constant.SuspendPrefix;
import dev.vality.adapter.common.exception.HellgateException;
import dev.vality.adapter.common.hellgate.HellgateClient;
import dev.vality.adapter.common.utils.CommonConverter;
import dev.vality.proxy.mocketbank.configuration.properties.AdapterMockBankProperties;
import dev.vality.proxy.mocketbank.service.mpi20.constant.CallbackResponseFields;
import dev.vality.proxy.mocketbank.service.mpi20.model.CRes;
import dev.vality.proxy.mocketbank.service.mpi20.model.ThreeDSMethodData;
import dev.vality.proxy.mocketbank.utils.UrlUtils;
import dev.vality.proxy.mocketbank.utils.state.constant.SuspendPrefix;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@ -22,7 +24,9 @@ import java.io.IOException;
import java.net.URLDecoder;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.Arrays;
import java.util.Collections;
import java.util.Map;
import java.util.stream.Collectors;
@Slf4j
@ -32,7 +36,8 @@ import java.util.stream.Collectors;
public class MocketBankController {
private static final String EMPTY_STRING = "";
private final HellgateAdapterClient hellgateClient;
private final HellgateClient hellgateClient;
private final AdapterMockBankProperties mockBankProperties;
private final ObjectMapper objectMapper;

View File

@ -1,8 +1,8 @@
package com.rbkmoney.proxy.mocketbank.decorator;
package dev.vality.proxy.mocketbank.decorator;
import com.rbkmoney.damsel.proxy_provider.*;
import com.rbkmoney.java.damsel.utils.extractors.PaymentResourceTypeExtractors;
import com.rbkmoney.java.damsel.utils.extractors.ProxyProviderPackageExtractors;
import dev.vality.adapter.common.damsel.PaymentResourceTypeExtractors;
import dev.vality.adapter.common.damsel.ProxyProviderPackageExtractors;
import dev.vality.damsel.proxy_provider.*;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.thrift.TException;

View File

@ -1,6 +1,6 @@
package com.rbkmoney.proxy.mocketbank.decorator;
package dev.vality.proxy.mocketbank.decorator;
import com.rbkmoney.mnp.*;
import dev.vality.mnp.*;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.thrift.TException;

View File

@ -1,8 +1,8 @@
package com.rbkmoney.proxy.mocketbank.decorator;
package dev.vality.proxy.mocketbank.decorator;
import com.rbkmoney.damsel.proxy_provider.*;
import com.rbkmoney.java.damsel.utils.extractors.PaymentResourceTypeExtractors;
import com.rbkmoney.java.damsel.utils.extractors.ProxyProviderPackageExtractors;
import dev.vality.adapter.common.damsel.PaymentResourceTypeExtractors;
import dev.vality.adapter.common.damsel.ProxyProviderPackageExtractors;
import dev.vality.damsel.proxy_provider.*;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.thrift.TException;

View File

@ -1,8 +1,8 @@
package com.rbkmoney.proxy.mocketbank.decorator;
package dev.vality.proxy.mocketbank.decorator;
import com.rbkmoney.damsel.proxy_provider.*;
import com.rbkmoney.java.damsel.utils.extractors.PaymentResourceTypeExtractors;
import com.rbkmoney.java.damsel.utils.extractors.ProxyProviderPackageExtractors;
import dev.vality.adapter.common.damsel.PaymentResourceTypeExtractors;
import dev.vality.adapter.common.damsel.ProxyProviderPackageExtractors;
import dev.vality.damsel.proxy_provider.*;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.thrift.TException;

View File

@ -1,14 +1,14 @@
package com.rbkmoney.proxy.mocketbank.decorator;
package dev.vality.proxy.mocketbank.decorator;
import com.rbkmoney.damsel.proxy_provider.*;
import dev.vality.damsel.proxy_provider.*;
import lombok.RequiredArgsConstructor;
import org.apache.thrift.TException;
import org.slf4j.MDC;
import java.nio.ByteBuffer;
import static com.rbkmoney.java.damsel.utils.extractors.ProxyProviderPackageExtractors.extractInvoiceId;
import static com.rbkmoney.java.damsel.utils.extractors.ProxyProviderPackageExtractors.extractPaymentId;
import static dev.vality.adapter.common.damsel.ProxyProviderPackageExtractors.extractInvoiceId;
import static dev.vality.adapter.common.damsel.ProxyProviderPackageExtractors.extractPaymentId;
@RequiredArgsConstructor
public class PaymentServerHandlerMdcLog implements ProviderProxySrv.Iface {

View File

@ -1,6 +1,6 @@
package com.rbkmoney.proxy.mocketbank.decorator;
package dev.vality.proxy.mocketbank.decorator;
import com.rbkmoney.java.damsel.utils.verification.ProxyProviderVerification;
import dev.vality.adapter.common.damsel.ProxyProviderVerification;
import lombok.extern.slf4j.Slf4j;
@Slf4j

View File

@ -1,8 +1,8 @@
package com.rbkmoney.proxy.mocketbank.decorator;
package dev.vality.proxy.mocketbank.decorator;
import com.rbkmoney.damsel.proxy_provider.*;
import com.rbkmoney.java.damsel.utils.extractors.PaymentResourceTypeExtractors;
import com.rbkmoney.java.damsel.utils.extractors.ProxyProviderPackageExtractors;
import dev.vality.adapter.common.damsel.PaymentResourceTypeExtractors;
import dev.vality.adapter.common.damsel.ProxyProviderPackageExtractors;
import dev.vality.damsel.proxy_provider.*;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.thrift.TException;

View File

@ -1,7 +1,7 @@
package com.rbkmoney.proxy.mocketbank.decorator;
package dev.vality.proxy.mocketbank.decorator;
import com.rbkmoney.damsel.msgpack.Value;
import com.rbkmoney.damsel.withdrawals.provider_adapter.*;
import dev.vality.damsel.msgpack.Value;
import dev.vality.damsel.withdrawals.provider_adapter.*;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.thrift.TException;

View File

@ -1,4 +1,4 @@
package com.rbkmoney.proxy.mocketbank.exception;
package dev.vality.proxy.mocketbank.exception;
public class CardException extends RuntimeException {

View File

@ -1,4 +1,4 @@
package com.rbkmoney.proxy.mocketbank.exception;
package dev.vality.proxy.mocketbank.exception;
public class DigitalWalletException extends RuntimeException {

View File

@ -1,4 +1,4 @@
package com.rbkmoney.proxy.mocketbank.exception;
package dev.vality.proxy.mocketbank.exception;
public class MobileException extends RuntimeException {

View File

@ -1,4 +1,4 @@
package com.rbkmoney.proxy.mocketbank.exception;
package dev.vality.proxy.mocketbank.exception;
public class MobileOperatorException extends RuntimeException {

View File

@ -1,4 +1,4 @@
package com.rbkmoney.proxy.mocketbank.exception;
package dev.vality.proxy.mocketbank.exception;
public class PaymentException extends RuntimeException {

View File

@ -1,4 +1,4 @@
package com.rbkmoney.proxy.mocketbank.exception;
package dev.vality.proxy.mocketbank.exception;
public class RedirectTemplateException extends RuntimeException {

View File

@ -1,4 +1,4 @@
package com.rbkmoney.proxy.mocketbank.exception;
package dev.vality.proxy.mocketbank.exception;
public class TerminalException extends RuntimeException {

View File

@ -1,4 +1,4 @@
package com.rbkmoney.proxy.mocketbank.exception;
package dev.vality.proxy.mocketbank.exception;
public class UnsupportedOperationException extends RuntimeException {

View File

@ -1,4 +1,4 @@
package com.rbkmoney.proxy.mocketbank.exception;
package dev.vality.proxy.mocketbank.exception;
public class WithdrawalException extends RuntimeException {

View File

@ -1,4 +1,4 @@
package com.rbkmoney.proxy.mocketbank.handler.balance;
package dev.vality.proxy.mocketbank.handler.balance;
import dev.vality.scrooge.*;
import lombok.extern.slf4j.Slf4j;

View File

@ -0,0 +1,15 @@
package dev.vality.proxy.mocketbank.handler.digital.wallet;
import dev.vality.damsel.domain.TargetInvoicePaymentStatus;
import dev.vality.damsel.proxy_provider.PaymentContext;
import dev.vality.damsel.proxy_provider.PaymentProxyResult;
import dev.vality.damsel.proxy_provider.PaymentResource;
import org.apache.thrift.TException;
public interface CommonDigitalWalletHandler {
boolean filter(final TargetInvoicePaymentStatus targetInvoicePaymentStatus, final PaymentResource paymentResource);
PaymentProxyResult handler(PaymentContext context) throws TException;
}

View File

@ -1,8 +1,8 @@
package com.rbkmoney.proxy.mocketbank.handler.digital.wallet;
package dev.vality.proxy.mocketbank.handler.digital.wallet;
import com.rbkmoney.damsel.proxy_provider.*;
import com.rbkmoney.proxy.mocketbank.handler.digital.wallet.callback.DigitalWalletCallbackHandler;
import com.rbkmoney.proxy.mocketbank.validator.DigitalWalletValidator;
import dev.vality.damsel.proxy_provider.*;
import dev.vality.proxy.mocketbank.handler.digital.wallet.callback.DigitalWalletCallbackHandler;
import dev.vality.proxy.mocketbank.validator.DigitalWalletValidator;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.thrift.TException;

View File

@ -1,9 +1,9 @@
package com.rbkmoney.proxy.mocketbank.handler.digital.wallet;
package dev.vality.proxy.mocketbank.handler.digital.wallet;
import com.rbkmoney.damsel.domain.TargetInvoicePaymentStatus;
import com.rbkmoney.damsel.proxy_provider.PaymentContext;
import com.rbkmoney.damsel.proxy_provider.PaymentProxyResult;
import com.rbkmoney.damsel.proxy_provider.PaymentResource;
import dev.vality.damsel.domain.TargetInvoicePaymentStatus;
import dev.vality.damsel.proxy_provider.PaymentContext;
import dev.vality.damsel.proxy_provider.PaymentProxyResult;
import dev.vality.damsel.proxy_provider.PaymentResource;
import org.apache.thrift.TException;
public class UnsupportedDigitalWalletHandler implements CommonDigitalWalletHandler {

View File

@ -1,16 +1,16 @@
package com.rbkmoney.proxy.mocketbank.handler.digital.wallet.callback;
package dev.vality.proxy.mocketbank.handler.digital.wallet.callback;
import com.rbkmoney.damsel.proxy_provider.PaymentCallbackResult;
import com.rbkmoney.damsel.proxy_provider.PaymentContext;
import com.rbkmoney.java.damsel.constant.PaymentState;
import com.rbkmoney.proxy.mocketbank.utils.CreatorUtils;
import dev.vality.damsel.proxy_provider.PaymentCallbackResult;
import dev.vality.damsel.proxy_provider.PaymentContext;
import dev.vality.proxy.mocketbank.constant.PaymentState;
import dev.vality.proxy.mocketbank.utils.CreatorUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.nio.ByteBuffer;
import static com.rbkmoney.java.damsel.utils.creators.ProxyProviderPackageCreators.*;
import static dev.vality.adapter.common.damsel.ProxyProviderPackageCreators.*;
@Slf4j
@Component

View File

@ -1,18 +1,18 @@
package com.rbkmoney.proxy.mocketbank.handler.digital.wallet.payment;
package dev.vality.proxy.mocketbank.handler.digital.wallet.payment;
import com.rbkmoney.damsel.domain.TargetInvoicePaymentStatus;
import com.rbkmoney.damsel.proxy_provider.PaymentContext;
import com.rbkmoney.damsel.proxy_provider.PaymentProxyResult;
import com.rbkmoney.damsel.proxy_provider.PaymentResource;
import com.rbkmoney.java.damsel.constant.PaymentState;
import com.rbkmoney.proxy.mocketbank.handler.digital.wallet.CommonDigitalWalletHandler;
import dev.vality.damsel.domain.TargetInvoicePaymentStatus;
import dev.vality.damsel.proxy_provider.PaymentContext;
import dev.vality.damsel.proxy_provider.PaymentProxyResult;
import dev.vality.damsel.proxy_provider.PaymentResource;
import dev.vality.proxy.mocketbank.constant.PaymentState;
import dev.vality.proxy.mocketbank.handler.digital.wallet.CommonDigitalWalletHandler;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.thrift.TException;
import org.springframework.stereotype.Component;
import static com.rbkmoney.java.damsel.utils.creators.ProxyProviderPackageCreators.createFinishIntentSuccess;
import static com.rbkmoney.java.damsel.utils.creators.ProxyProviderPackageCreators.createPaymentProxyResult;
import static dev.vality.adapter.common.damsel.ProxyProviderPackageCreators.createFinishIntentSuccess;
import static dev.vality.adapter.common.damsel.ProxyProviderPackageCreators.createPaymentProxyResult;
@Slf4j
@Component

View File

@ -1,19 +1,19 @@
package com.rbkmoney.proxy.mocketbank.handler.digital.wallet.payment;
package dev.vality.proxy.mocketbank.handler.digital.wallet.payment;
import com.rbkmoney.damsel.domain.TargetInvoicePaymentStatus;
import com.rbkmoney.damsel.domain.TransactionInfo;
import com.rbkmoney.damsel.proxy_provider.Intent;
import com.rbkmoney.damsel.proxy_provider.PaymentContext;
import com.rbkmoney.damsel.proxy_provider.PaymentProxyResult;
import com.rbkmoney.damsel.proxy_provider.PaymentResource;
import com.rbkmoney.proxy.mocketbank.handler.digital.wallet.CommonDigitalWalletHandler;
import com.rbkmoney.proxy.mocketbank.validator.DigitalWalletCapturedValidator;
import dev.vality.damsel.domain.TargetInvoicePaymentStatus;
import dev.vality.damsel.domain.TransactionInfo;
import dev.vality.damsel.proxy_provider.Intent;
import dev.vality.damsel.proxy_provider.PaymentContext;
import dev.vality.damsel.proxy_provider.PaymentProxyResult;
import dev.vality.damsel.proxy_provider.PaymentResource;
import dev.vality.proxy.mocketbank.handler.digital.wallet.CommonDigitalWalletHandler;
import dev.vality.proxy.mocketbank.validator.DigitalWalletCapturedValidator;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.thrift.TException;
import org.springframework.stereotype.Component;
import static com.rbkmoney.java.damsel.utils.creators.ProxyProviderPackageCreators.*;
import static dev.vality.adapter.common.damsel.ProxyProviderPackageCreators.*;
@Slf4j
@Component

View File

@ -1,32 +1,31 @@
package com.rbkmoney.proxy.mocketbank.handler.digital.wallet.payment;
package dev.vality.proxy.mocketbank.handler.digital.wallet.payment;
import com.rbkmoney.damsel.domain.DigitalWallet;
import com.rbkmoney.damsel.domain.TargetInvoicePaymentStatus;
import com.rbkmoney.damsel.domain.TransactionInfo;
import com.rbkmoney.damsel.proxy_provider.Cash;
import com.rbkmoney.damsel.proxy_provider.PaymentContext;
import com.rbkmoney.damsel.proxy_provider.PaymentProxyResult;
import com.rbkmoney.damsel.proxy_provider.PaymentResource;
import com.rbkmoney.java.damsel.constant.PaymentState;
import com.rbkmoney.proxy.mocketbank.configuration.properties.AdapterMockBankProperties;
import com.rbkmoney.proxy.mocketbank.configuration.properties.TimerProperties;
import com.rbkmoney.proxy.mocketbank.handler.digital.wallet.CommonDigitalWalletHandler;
import com.rbkmoney.proxy.mocketbank.utils.CreatorUtils;
import com.rbkmoney.proxy.mocketbank.utils.UrlUtils;
import com.rbkmoney.proxy.mocketbank.utils.dw.DwCreators;
import com.rbkmoney.proxy.mocketbank.utils.dw.DwExtractors;
import com.rbkmoney.proxy.mocketbank.utils.dw.DwOptions;
import dev.vality.damsel.domain.DigitalWallet;
import dev.vality.damsel.domain.TargetInvoicePaymentStatus;
import dev.vality.damsel.domain.TransactionInfo;
import dev.vality.damsel.proxy_provider.Cash;
import dev.vality.damsel.proxy_provider.PaymentContext;
import dev.vality.damsel.proxy_provider.PaymentProxyResult;
import dev.vality.damsel.proxy_provider.PaymentResource;
import dev.vality.proxy.mocketbank.configuration.properties.AdapterMockBankProperties;
import dev.vality.proxy.mocketbank.configuration.properties.TimerProperties;
import dev.vality.proxy.mocketbank.constant.PaymentState;
import dev.vality.proxy.mocketbank.handler.digital.wallet.CommonDigitalWalletHandler;
import dev.vality.proxy.mocketbank.utils.CreatorUtils;
import dev.vality.proxy.mocketbank.utils.UrlUtils;
import dev.vality.proxy.mocketbank.utils.dw.DwCreators;
import dev.vality.proxy.mocketbank.utils.dw.DwExtractors;
import dev.vality.proxy.mocketbank.utils.dw.DwOptions;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.thrift.TException;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.HashMap;
import static com.rbkmoney.java.damsel.utils.creators.ProxyProviderPackageCreators.*;
import static com.rbkmoney.java.damsel.utils.extractors.ProxyProviderPackageExtractors.extractCashPayment;
import static com.rbkmoney.java.damsel.utils.extractors.ProxyProviderPackageExtractors.extractInvoiceId;
import static dev.vality.adapter.common.damsel.ProxyProviderPackageCreators.*;
import static dev.vality.adapter.common.damsel.ProxyProviderPackageExtractors.extractCashPayment;
import static dev.vality.adapter.common.damsel.ProxyProviderPackageExtractors.extractInvoiceId;
@Slf4j
@Component

View File

@ -1,19 +1,19 @@
package com.rbkmoney.proxy.mocketbank.handler.digital.wallet.payment;
package dev.vality.proxy.mocketbank.handler.digital.wallet.payment;
import com.rbkmoney.damsel.domain.TargetInvoicePaymentStatus;
import com.rbkmoney.damsel.proxy_provider.PaymentContext;
import com.rbkmoney.damsel.proxy_provider.PaymentProxyResult;
import com.rbkmoney.damsel.proxy_provider.PaymentResource;
import com.rbkmoney.java.damsel.constant.PaymentState;
import com.rbkmoney.proxy.mocketbank.handler.digital.wallet.CommonDigitalWalletHandler;
import com.rbkmoney.proxy.mocketbank.validator.DigitalWalletRefundedValidator;
import dev.vality.damsel.domain.TargetInvoicePaymentStatus;
import dev.vality.damsel.proxy_provider.PaymentContext;
import dev.vality.damsel.proxy_provider.PaymentProxyResult;
import dev.vality.damsel.proxy_provider.PaymentResource;
import dev.vality.proxy.mocketbank.constant.PaymentState;
import dev.vality.proxy.mocketbank.handler.digital.wallet.CommonDigitalWalletHandler;
import dev.vality.proxy.mocketbank.validator.DigitalWalletRefundedValidator;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.thrift.TException;
import org.springframework.stereotype.Component;
import static com.rbkmoney.java.damsel.utils.creators.ProxyProviderPackageCreators.createFinishIntentSuccess;
import static com.rbkmoney.java.damsel.utils.creators.ProxyProviderPackageCreators.createPaymentProxyResult;
import static dev.vality.adapter.common.damsel.ProxyProviderPackageCreators.createFinishIntentSuccess;
import static dev.vality.adapter.common.damsel.ProxyProviderPackageCreators.createPaymentProxyResult;
@Slf4j
@Component

View File

@ -0,0 +1,15 @@
package dev.vality.proxy.mocketbank.handler.mobile;
import dev.vality.damsel.domain.TargetInvoicePaymentStatus;
import dev.vality.damsel.proxy_provider.PaymentContext;
import dev.vality.damsel.proxy_provider.PaymentProxyResult;
import dev.vality.damsel.proxy_provider.PaymentResource;
import org.apache.thrift.TException;
public interface CommonMobileHandler {
boolean filter(final TargetInvoicePaymentStatus targetInvoicePaymentStatus, final PaymentResource paymentResource);
PaymentProxyResult handler(PaymentContext context) throws TException;
}

View File

@ -1,8 +1,8 @@
package com.rbkmoney.proxy.mocketbank.handler.mobile;
package dev.vality.proxy.mocketbank.handler.mobile;
import com.rbkmoney.damsel.proxy_provider.*;
import com.rbkmoney.proxy.mocketbank.handler.mobile.payment.UnsupportedMobileHandler;
import com.rbkmoney.proxy.mocketbank.validator.MobileValidator;
import dev.vality.damsel.proxy_provider.*;
import dev.vality.proxy.mocketbank.handler.mobile.payment.UnsupportedMobileHandler;
import dev.vality.proxy.mocketbank.validator.MobileValidator;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.thrift.TException;

View File

@ -1,12 +1,14 @@
package com.rbkmoney.proxy.mocketbank.handler.mobile.operator;
package dev.vality.proxy.mocketbank.handler.mobile.operator;
import com.rbkmoney.mnp.*;
import com.rbkmoney.proxy.mocketbank.exception.MobileOperatorException;
import com.rbkmoney.proxy.mocketbank.utils.mobilephone.MobilePhone;
import com.rbkmoney.proxy.mocketbank.utils.mobilephone.MobilePhoneUtils;
import dev.vality.mnp.MnpSrv;
import dev.vality.mnp.Operator;
import dev.vality.mnp.RequestParams;
import dev.vality.mnp.ResponseData;
import dev.vality.proxy.mocketbank.exception.MobileOperatorException;
import dev.vality.proxy.mocketbank.utils.mobilephone.MobilePhone;
import dev.vality.proxy.mocketbank.utils.mobilephone.MobilePhoneUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.thrift.TException;
import org.springframework.stereotype.Component;
import java.util.List;

View File

@ -1,17 +1,17 @@
package com.rbkmoney.proxy.mocketbank.handler.mobile.payment;
package dev.vality.proxy.mocketbank.handler.mobile.payment;
import com.rbkmoney.damsel.domain.TargetInvoicePaymentStatus;
import com.rbkmoney.damsel.domain.TransactionInfo;
import com.rbkmoney.damsel.proxy_provider.Intent;
import com.rbkmoney.damsel.proxy_provider.PaymentContext;
import com.rbkmoney.damsel.proxy_provider.PaymentProxyResult;
import com.rbkmoney.damsel.proxy_provider.PaymentResource;
import com.rbkmoney.proxy.mocketbank.handler.mobile.CommonMobileHandler;
import dev.vality.damsel.domain.TargetInvoicePaymentStatus;
import dev.vality.damsel.domain.TransactionInfo;
import dev.vality.damsel.proxy_provider.Intent;
import dev.vality.damsel.proxy_provider.PaymentContext;
import dev.vality.damsel.proxy_provider.PaymentProxyResult;
import dev.vality.damsel.proxy_provider.PaymentResource;
import dev.vality.proxy.mocketbank.handler.mobile.CommonMobileHandler;
import lombok.RequiredArgsConstructor;
import org.apache.thrift.TException;
import org.springframework.stereotype.Component;
import static com.rbkmoney.java.damsel.utils.creators.ProxyProviderPackageCreators.*;
import static dev.vality.adapter.common.damsel.ProxyProviderPackageCreators.*;
@Component
@RequiredArgsConstructor

View File

@ -1,19 +1,19 @@
package com.rbkmoney.proxy.mocketbank.handler.mobile.payment;
package dev.vality.proxy.mocketbank.handler.mobile.payment;
import com.rbkmoney.damsel.domain.PaymentTool;
import com.rbkmoney.damsel.domain.TargetInvoicePaymentStatus;
import com.rbkmoney.damsel.domain.TransactionInfo;
import com.rbkmoney.damsel.proxy_provider.PaymentContext;
import com.rbkmoney.damsel.proxy_provider.PaymentProxyResult;
import com.rbkmoney.damsel.proxy_provider.PaymentResource;
import com.rbkmoney.error.mapping.ErrorMapping;
import com.rbkmoney.java.damsel.constant.PaymentState;
import com.rbkmoney.java.damsel.utils.extractors.ProxyProviderPackageExtractors;
import com.rbkmoney.proxy.mocketbank.handler.mobile.CommonMobileHandler;
import com.rbkmoney.proxy.mocketbank.utils.CreatorUtils;
import com.rbkmoney.proxy.mocketbank.utils.mobilephone.MobilePhone;
import com.rbkmoney.proxy.mocketbank.utils.mobilephone.MobilePhoneAction;
import com.rbkmoney.proxy.mocketbank.utils.mobilephone.MobilePhoneUtils;
import dev.vality.adapter.common.damsel.ProxyProviderPackageExtractors;
import dev.vality.adapter.common.mapper.ErrorMapping;
import dev.vality.damsel.domain.PaymentTool;
import dev.vality.damsel.domain.TargetInvoicePaymentStatus;
import dev.vality.damsel.domain.TransactionInfo;
import dev.vality.damsel.proxy_provider.PaymentContext;
import dev.vality.damsel.proxy_provider.PaymentProxyResult;
import dev.vality.damsel.proxy_provider.PaymentResource;
import dev.vality.proxy.mocketbank.constant.PaymentState;
import dev.vality.proxy.mocketbank.handler.mobile.CommonMobileHandler;
import dev.vality.proxy.mocketbank.utils.CreatorUtils;
import dev.vality.proxy.mocketbank.utils.mobilephone.MobilePhone;
import dev.vality.proxy.mocketbank.utils.mobilephone.MobilePhoneAction;
import dev.vality.proxy.mocketbank.utils.mobilephone.MobilePhoneUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.thrift.TException;
@ -22,7 +22,7 @@ import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Optional;
import static com.rbkmoney.java.damsel.utils.creators.ProxyProviderPackageCreators.*;
import static dev.vality.adapter.common.damsel.ProxyProviderPackageCreators.*;
@Slf4j
@Component
@ -40,7 +40,7 @@ public class ProcessedMobileCommonHandler implements CommonMobileHandler {
@Override
public PaymentProxyResult handler(PaymentContext context) throws TException {
PaymentResource paymentResource =
com.rbkmoney.java.damsel.utils.extractors.ProxyProviderPackageExtractors
dev.vality.adapter.common.damsel.ProxyProviderPackageExtractors
.extractPaymentResource(context);
PaymentTool paymentTool = ProxyProviderPackageExtractors.extractPaymentTool(paymentResource);
String phoneNumber = MobilePhoneUtils.preparePhoneNumber(paymentTool.getMobileCommerce().getPhone());

View File

@ -1,10 +1,10 @@
package com.rbkmoney.proxy.mocketbank.handler.mobile.payment;
package dev.vality.proxy.mocketbank.handler.mobile.payment;
import com.rbkmoney.damsel.domain.TargetInvoicePaymentStatus;
import com.rbkmoney.damsel.proxy_provider.PaymentContext;
import com.rbkmoney.damsel.proxy_provider.PaymentProxyResult;
import com.rbkmoney.damsel.proxy_provider.PaymentResource;
import com.rbkmoney.proxy.mocketbank.handler.mobile.CommonMobileHandler;
import dev.vality.damsel.domain.TargetInvoicePaymentStatus;
import dev.vality.damsel.proxy_provider.PaymentContext;
import dev.vality.damsel.proxy_provider.PaymentProxyResult;
import dev.vality.damsel.proxy_provider.PaymentResource;
import dev.vality.proxy.mocketbank.handler.mobile.CommonMobileHandler;
import org.apache.thrift.TException;
public class UnsupportedMobileHandler implements CommonMobileHandler {

View File

@ -1,19 +1,19 @@
package com.rbkmoney.proxy.mocketbank.handler.oct;
package dev.vality.proxy.mocketbank.handler.oct;
import com.rbkmoney.damsel.domain.TransactionInfo;
import com.rbkmoney.damsel.msgpack.Value;
import com.rbkmoney.damsel.withdrawals.provider_adapter.*;
import com.rbkmoney.error.mapping.ErrorMapping;
import com.rbkmoney.java.cds.utils.model.CardDataProxyModel;
import com.rbkmoney.java.damsel.utils.creators.DomainPackageCreators;
import com.rbkmoney.java.damsel.utils.creators.WithdrawalsProviderAdapterPackageCreators;
import com.rbkmoney.proxy.mocketbank.service.CdsService;
import com.rbkmoney.proxy.mocketbank.service.oct.verification.CurrencyVerification;
import com.rbkmoney.proxy.mocketbank.utils.ErrorBuilder;
import com.rbkmoney.proxy.mocketbank.utils.payout.CardPayout;
import com.rbkmoney.proxy.mocketbank.utils.payout.CardPayoutAction;
import com.rbkmoney.proxy.mocketbank.utils.payout.PayoutUtils;
import com.rbkmoney.proxy.mocketbank.validator.WithdrawalValidator;
import dev.vality.adapter.common.cds.model.CardDataProxyModel;
import dev.vality.adapter.common.damsel.DomainPackageCreators;
import dev.vality.adapter.common.damsel.WithdrawalsProviderAdapterPackageCreators;
import dev.vality.adapter.common.mapper.ErrorMapping;
import dev.vality.damsel.domain.TransactionInfo;
import dev.vality.damsel.msgpack.Value;
import dev.vality.damsel.withdrawals.provider_adapter.*;
import dev.vality.proxy.mocketbank.service.CdsService;
import dev.vality.proxy.mocketbank.service.oct.verification.CurrencyVerification;
import dev.vality.proxy.mocketbank.utils.ErrorBuilder;
import dev.vality.proxy.mocketbank.utils.payout.CardPayout;
import dev.vality.proxy.mocketbank.utils.payout.CardPayoutAction;
import dev.vality.proxy.mocketbank.utils.payout.PayoutUtils;
import dev.vality.proxy.mocketbank.validator.WithdrawalValidator;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.thrift.TException;

View File

@ -0,0 +1,15 @@
package dev.vality.proxy.mocketbank.handler.payment;
import dev.vality.damsel.domain.TargetInvoicePaymentStatus;
import dev.vality.damsel.proxy_provider.PaymentContext;
import dev.vality.damsel.proxy_provider.PaymentProxyResult;
import dev.vality.damsel.proxy_provider.PaymentResource;
import org.apache.thrift.TException;
public interface CommonPaymentHandler {
boolean filter(final TargetInvoicePaymentStatus targetInvoicePaymentStatus, final PaymentResource paymentResource);
PaymentProxyResult handler(PaymentContext context) throws TException;
}

View File

@ -1,9 +1,9 @@
package com.rbkmoney.proxy.mocketbank.handler.payment;
package dev.vality.proxy.mocketbank.handler.payment;
import com.rbkmoney.damsel.domain.TargetInvoicePaymentStatus;
import com.rbkmoney.damsel.proxy_provider.PaymentContext;
import com.rbkmoney.damsel.proxy_provider.PaymentProxyResult;
import com.rbkmoney.damsel.proxy_provider.PaymentResource;
import dev.vality.damsel.domain.TargetInvoicePaymentStatus;
import dev.vality.damsel.proxy_provider.PaymentContext;
import dev.vality.damsel.proxy_provider.PaymentProxyResult;
import dev.vality.damsel.proxy_provider.PaymentResource;
import org.apache.thrift.TException;
public class FallbackPaymentHandler implements CommonPaymentHandler {

View File

@ -1,10 +1,10 @@
package com.rbkmoney.proxy.mocketbank.handler.payment;
package dev.vality.proxy.mocketbank.handler.payment;
import com.rbkmoney.damsel.proxy_provider.*;
import com.rbkmoney.proxy.mocketbank.handler.payment.callback.PaymentCallbackHandler;
import com.rbkmoney.proxy.mocketbank.handler.payment.callback.RecurrentTokenCallbackHandler;
import com.rbkmoney.proxy.mocketbank.handler.payment.recurrent.GenerateTokenHandler;
import com.rbkmoney.proxy.mocketbank.validator.PaymentValidator;
import dev.vality.damsel.proxy_provider.*;
import dev.vality.proxy.mocketbank.handler.payment.callback.PaymentCallbackHandler;
import dev.vality.proxy.mocketbank.handler.payment.callback.RecurrentTokenCallbackHandler;
import dev.vality.proxy.mocketbank.handler.payment.recurrent.GenerateTokenHandler;
import dev.vality.proxy.mocketbank.validator.PaymentValidator;
import lombok.RequiredArgsConstructor;
import org.apache.thrift.TException;
import org.springframework.stereotype.Component;

View File

@ -1,37 +1,45 @@
package com.rbkmoney.proxy.mocketbank.handler.payment.callback;
package dev.vality.proxy.mocketbank.handler.payment.callback;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.rbkmoney.cds.client.storage.CdsClientStorage;
import com.rbkmoney.cds.client.storage.exception.CdsStorageExpDateException;
import com.rbkmoney.damsel.domain.TransactionInfo;
import com.rbkmoney.damsel.proxy_provider.*;
import com.rbkmoney.error.mapping.ErrorMapping;
import com.rbkmoney.java.cds.utils.model.CardDataProxyModel;
import com.rbkmoney.java.damsel.constant.Error;
import com.rbkmoney.java.damsel.constant.PaymentState;
import com.rbkmoney.proxy.mocketbank.service.mpi.MpiApi;
import com.rbkmoney.proxy.mocketbank.service.mpi.model.ValidatePaResResponse;
import com.rbkmoney.proxy.mocketbank.service.mpi20.model.SessionState;
import com.rbkmoney.proxy.mocketbank.service.mpi20.processor.Mpi20Processor;
import com.rbkmoney.proxy.mocketbank.utils.*;
import com.rbkmoney.proxy.mocketbank.utils.model.*;
import dev.vality.adapter.common.cds.CdsStorageClient;
import dev.vality.adapter.common.cds.model.CardDataProxyModel;
import dev.vality.adapter.common.damsel.model.Error;
import dev.vality.adapter.common.exception.CdsStorageExpDateException;
import dev.vality.adapter.common.mapper.ErrorMapping;
import dev.vality.damsel.domain.TransactionInfo;
import dev.vality.damsel.proxy_provider.PaymentCallbackProxyResult;
import dev.vality.damsel.proxy_provider.PaymentCallbackResult;
import dev.vality.damsel.proxy_provider.PaymentContext;
import dev.vality.proxy.mocketbank.constant.PaymentState;
import dev.vality.proxy.mocketbank.service.mpi.MpiApi;
import dev.vality.proxy.mocketbank.service.mpi.constant.TransactionStatus;
import dev.vality.proxy.mocketbank.service.mpi.model.ValidatePaResResponse;
import dev.vality.proxy.mocketbank.service.mpi20.model.SessionState;
import dev.vality.proxy.mocketbank.service.mpi20.processor.Mpi20Processor;
import dev.vality.proxy.mocketbank.utils.CallbackResponseWithTemplateCreator;
import dev.vality.proxy.mocketbank.utils.Converter;
import dev.vality.proxy.mocketbank.utils.CreatorUtils;
import dev.vality.proxy.mocketbank.utils.ErrorBuilder;
import dev.vality.proxy.mocketbank.utils.model.Card;
import dev.vality.proxy.mocketbank.utils.model.CardAction;
import dev.vality.proxy.mocketbank.utils.model.CardUtils;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.nio.ByteBuffer;
import java.util.*;
import java.util.HashMap;
import java.util.List;
import static com.rbkmoney.java.damsel.utils.creators.ProxyProviderPackageCreators.*;
import static com.rbkmoney.proxy.mocketbank.service.mpi.constant.TransactionStatus.isAuthenticationSuccessful;
import static dev.vality.adapter.common.damsel.ProxyProviderPackageCreators.*;
@Slf4j
@Component
@RequiredArgsConstructor
public class PaymentCallbackHandler {
private final CdsClientStorage cds;
private final CdsStorageClient cds;
private final MpiApi mpiApi;
private final ErrorMapping errorMapping;
private final List<Card> cardList;
@ -90,7 +98,7 @@ public class PaymentCallbackHandler {
CardDataProxyModel cardData) {
HashMap<String, String> parameters = Converter.mergeParams(byteBuffer, context.getSession().getState());
ValidatePaResResponse validatePaResResponse = mpiApi.validatePaRes(cardData, parameters);
if (isAuthenticationSuccessful(validatePaResResponse.getTransactionStatus())) {
if (TransactionStatus.isAuthenticationSuccessful(validatePaResResponse.getTransactionStatus())) {
TransactionInfo transactionInfo = CreatorUtils.createDefaultTransactionInfo(context);
PaymentCallbackProxyResult proxyResult = createCallbackProxyResult(
createFinishIntentSuccess(), PaymentState.CAPTURED.getBytes(), transactionInfo

View File

@ -1,22 +1,23 @@
package com.rbkmoney.proxy.mocketbank.handler.payment.callback;
package dev.vality.proxy.mocketbank.handler.payment.callback;
import com.rbkmoney.cds.client.storage.CdsClientStorage;
import com.rbkmoney.cds.client.storage.exception.CdsStorageExpDateException;
import com.rbkmoney.damsel.proxy_provider.RecurrentTokenCallbackResult;
import com.rbkmoney.damsel.proxy_provider.RecurrentTokenContext;
import com.rbkmoney.damsel.proxy_provider.RecurrentTokenIntent;
import com.rbkmoney.damsel.proxy_provider.RecurrentTokenProxyResult;
import com.rbkmoney.error.mapping.ErrorMapping;
import com.rbkmoney.java.cds.utils.model.CardDataProxyModel;
import com.rbkmoney.java.damsel.constant.Error;
import com.rbkmoney.java.damsel.constant.PaymentState;
import com.rbkmoney.proxy.mocketbank.service.mpi.MpiApi;
import com.rbkmoney.proxy.mocketbank.service.mpi.model.ValidatePaResResponse;
import com.rbkmoney.proxy.mocketbank.utils.Converter;
import com.rbkmoney.proxy.mocketbank.utils.ErrorBuilder;
import com.rbkmoney.proxy.mocketbank.utils.model.Card;
import com.rbkmoney.proxy.mocketbank.utils.model.CardAction;
import com.rbkmoney.proxy.mocketbank.utils.model.CardUtils;
import dev.vality.adapter.common.cds.CdsStorageClient;
import dev.vality.adapter.common.cds.model.CardDataProxyModel;
import dev.vality.adapter.common.damsel.model.Error;
import dev.vality.adapter.common.exception.CdsStorageExpDateException;
import dev.vality.adapter.common.mapper.ErrorMapping;
import dev.vality.damsel.proxy_provider.RecurrentTokenCallbackResult;
import dev.vality.damsel.proxy_provider.RecurrentTokenContext;
import dev.vality.damsel.proxy_provider.RecurrentTokenIntent;
import dev.vality.damsel.proxy_provider.RecurrentTokenProxyResult;
import dev.vality.proxy.mocketbank.constant.PaymentState;
import dev.vality.proxy.mocketbank.service.mpi.MpiApi;
import dev.vality.proxy.mocketbank.service.mpi.constant.TransactionStatus;
import dev.vality.proxy.mocketbank.service.mpi.model.ValidatePaResResponse;
import dev.vality.proxy.mocketbank.utils.Converter;
import dev.vality.proxy.mocketbank.utils.ErrorBuilder;
import dev.vality.proxy.mocketbank.utils.model.Card;
import dev.vality.proxy.mocketbank.utils.model.CardAction;
import dev.vality.proxy.mocketbank.utils.model.CardUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@ -25,16 +26,15 @@ import java.nio.ByteBuffer;
import java.util.HashMap;
import java.util.List;
import static com.rbkmoney.java.damsel.utils.creators.ProxyProviderPackageCreators.*;
import static com.rbkmoney.java.damsel.utils.extractors.ProxyProviderPackageExtractors.extractRecurrentId;
import static com.rbkmoney.proxy.mocketbank.service.mpi.constant.TransactionStatus.isAuthenticationSuccessful;
import static dev.vality.adapter.common.damsel.ProxyProviderPackageCreators.*;
import static dev.vality.adapter.common.damsel.ProxyProviderPackageExtractors.extractRecurrentId;
@Slf4j
@Component
@RequiredArgsConstructor
public class RecurrentTokenCallbackHandler {
private final CdsClientStorage cds;
private final CdsStorageClient cds;
private final MpiApi mpiApi;
private final ErrorMapping errorMapping;
private final List<Card> cardList;
@ -51,7 +51,7 @@ public class RecurrentTokenCallbackHandler {
}
ValidatePaResResponse validatePaResResponse = mpiApi.validatePaRes(cardData, parameters);
if (isAuthenticationSuccessful(validatePaResResponse.getTransactionStatus())) {
if (TransactionStatus.isAuthenticationSuccessful(validatePaResResponse.getTransactionStatus())) {
RecurrentTokenIntent intent = createRecurrentTokenFinishIntentSuccess(recurrentId);
RecurrentTokenProxyResult proxyResult =
createRecurrentTokenProxyResult(intent, PaymentState.PENDING.getBytes());

View File

@ -1,18 +1,18 @@
package com.rbkmoney.proxy.mocketbank.handler.payment.common;
package dev.vality.proxy.mocketbank.handler.payment.common;
import com.rbkmoney.damsel.domain.TargetInvoicePaymentStatus;
import com.rbkmoney.damsel.proxy_provider.PaymentContext;
import com.rbkmoney.damsel.proxy_provider.PaymentProxyResult;
import com.rbkmoney.damsel.proxy_provider.PaymentResource;
import com.rbkmoney.java.damsel.constant.PaymentState;
import com.rbkmoney.proxy.mocketbank.handler.payment.CommonPaymentHandler;
import dev.vality.damsel.domain.TargetInvoicePaymentStatus;
import dev.vality.damsel.proxy_provider.PaymentContext;
import dev.vality.damsel.proxy_provider.PaymentProxyResult;
import dev.vality.damsel.proxy_provider.PaymentResource;
import dev.vality.proxy.mocketbank.constant.PaymentState;
import dev.vality.proxy.mocketbank.handler.payment.CommonPaymentHandler;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.thrift.TException;
import org.springframework.stereotype.Component;
import static com.rbkmoney.java.damsel.utils.creators.ProxyProviderPackageCreators.createFinishIntentSuccess;
import static com.rbkmoney.java.damsel.utils.creators.ProxyProviderPackageCreators.createPaymentProxyResult;
import static dev.vality.adapter.common.damsel.ProxyProviderPackageCreators.createFinishIntentSuccess;
import static dev.vality.adapter.common.damsel.ProxyProviderPackageCreators.createPaymentProxyResult;
@Slf4j
@Component

View File

@ -1,18 +1,18 @@
package com.rbkmoney.proxy.mocketbank.handler.payment.common;
package dev.vality.proxy.mocketbank.handler.payment.common;
import com.rbkmoney.damsel.domain.TargetInvoicePaymentStatus;
import com.rbkmoney.damsel.proxy_provider.*;
import com.rbkmoney.java.damsel.constant.PaymentState;
import com.rbkmoney.proxy.mocketbank.handler.payment.CommonPaymentHandler;
import com.rbkmoney.proxy.mocketbank.validator.PaymentCapturedValidator;
import dev.vality.damsel.domain.TargetInvoicePaymentStatus;
import dev.vality.damsel.proxy_provider.*;
import dev.vality.proxy.mocketbank.constant.PaymentState;
import dev.vality.proxy.mocketbank.handler.payment.CommonPaymentHandler;
import dev.vality.proxy.mocketbank.validator.PaymentCapturedValidator;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.thrift.TException;
import org.springframework.stereotype.Component;
import static com.rbkmoney.java.damsel.utils.creators.ProxyProviderPackageCreators.*;
import static com.rbkmoney.java.damsel.utils.extractors.ProxyProviderPackageExtractors.extractInvoiceId;
import static com.rbkmoney.java.damsel.utils.verification.ProxyProviderVerification.isMakeRecurrent;
import static dev.vality.adapter.common.damsel.ProxyProviderPackageCreators.*;
import static dev.vality.adapter.common.damsel.ProxyProviderPackageExtractors.extractInvoiceId;
import static dev.vality.adapter.common.damsel.ProxyProviderVerification.isMakeRecurrent;
@Slf4j
@Component

View File

@ -1,30 +1,35 @@
package com.rbkmoney.proxy.mocketbank.handler.payment.common;
package dev.vality.proxy.mocketbank.handler.payment.common;
import com.rbkmoney.cds.client.storage.CdsClientStorage;
import com.rbkmoney.cds.client.storage.exception.CdsStorageExpDateException;
import com.rbkmoney.damsel.domain.*;
import com.rbkmoney.damsel.proxy_provider.*;
import com.rbkmoney.damsel.timeout_behaviour.TimeoutBehaviour;
import com.rbkmoney.error.mapping.ErrorMapping;
import com.rbkmoney.java.cds.utils.model.CardDataProxyModel;
import com.rbkmoney.java.damsel.constant.Error;
import com.rbkmoney.java.damsel.constant.PaymentState;
import com.rbkmoney.java.damsel.utils.creators.ProxyProviderPackageCreators;
import com.rbkmoney.proxy.mocketbank.configuration.properties.AdapterMockBankProperties;
import com.rbkmoney.proxy.mocketbank.configuration.properties.TimerProperties;
import com.rbkmoney.proxy.mocketbank.handler.payment.CommonPaymentHandler;
import com.rbkmoney.proxy.mocketbank.service.mpi.MpiApi;
import com.rbkmoney.proxy.mocketbank.service.mpi.model.VerifyEnrollmentResponse;
import com.rbkmoney.proxy.mocketbank.service.mpi20.processor.Mpi20Processor;
import com.rbkmoney.proxy.mocketbank.utils.CreatorUtils;
import com.rbkmoney.proxy.mocketbank.utils.ErrorBuilder;
import com.rbkmoney.proxy.mocketbank.utils.UrlUtils;
import com.rbkmoney.proxy.mocketbank.utils.UserInteractionUtils;
import com.rbkmoney.proxy.mocketbank.utils.model.Card;
import com.rbkmoney.proxy.mocketbank.utils.model.CardAction;
import com.rbkmoney.proxy.mocketbank.utils.model.CardUtils;
import com.rbkmoney.proxy.mocketbank.utils.state.StateUtils;
import com.rbkmoney.proxy.mocketbank.utils.state.constant.SuspendPrefix;
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.exception.CdsStorageExpDateException;
import dev.vality.adapter.common.mapper.ErrorMapping;
import dev.vality.damsel.domain.Failure;
import dev.vality.damsel.domain.OperationFailure;
import dev.vality.damsel.domain.TargetInvoicePaymentStatus;
import dev.vality.damsel.domain.TransactionInfo;
import dev.vality.damsel.proxy_provider.Intent;
import dev.vality.damsel.proxy_provider.PaymentContext;
import dev.vality.damsel.proxy_provider.PaymentProxyResult;
import dev.vality.damsel.proxy_provider.PaymentResource;
import dev.vality.damsel.timeout_behaviour.TimeoutBehaviour;
import dev.vality.proxy.mocketbank.configuration.properties.AdapterMockBankProperties;
import dev.vality.proxy.mocketbank.configuration.properties.TimerProperties;
import dev.vality.proxy.mocketbank.constant.PaymentState;
import dev.vality.proxy.mocketbank.handler.payment.CommonPaymentHandler;
import dev.vality.proxy.mocketbank.service.mpi.MpiApi;
import dev.vality.proxy.mocketbank.service.mpi.model.VerifyEnrollmentResponse;
import dev.vality.proxy.mocketbank.service.mpi20.processor.Mpi20Processor;
import dev.vality.proxy.mocketbank.utils.CreatorUtils;
import dev.vality.proxy.mocketbank.utils.ErrorBuilder;
import dev.vality.proxy.mocketbank.utils.UrlUtils;
import dev.vality.proxy.mocketbank.utils.UserInteractionUtils;
import dev.vality.proxy.mocketbank.utils.model.Card;
import dev.vality.proxy.mocketbank.utils.model.CardAction;
import dev.vality.proxy.mocketbank.utils.model.CardUtils;
import dev.vality.proxy.mocketbank.utils.state.StateUtils;
import dev.vality.proxy.mocketbank.utils.state.constant.SuspendPrefix;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.thrift.TException;
@ -35,23 +40,23 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
import static com.rbkmoney.java.damsel.constant.Error.DEFAULT_ERROR_CODE;
import static com.rbkmoney.java.damsel.constant.Error.THREE_DS_NOT_FINISHED;
import static com.rbkmoney.java.damsel.utils.creators.ProxyProviderPackageCreators.*;
import static com.rbkmoney.java.damsel.utils.extractors.OptionsExtractors.extractRedirectTimeout;
import static com.rbkmoney.java.damsel.utils.extractors.ProxyProviderPackageExtractors.extractInvoiceId;
import static com.rbkmoney.java.damsel.utils.verification.ProxyProviderVerification.isMakeRecurrent;
import static com.rbkmoney.proxy.mocketbank.service.mpi.constant.EnrollmentStatus.isAuthenticationAvailable;
import static com.rbkmoney.proxy.mocketbank.utils.UrlUtils.prepareRedirectParams;
import static com.rbkmoney.proxy.mocketbank.utils.TokenProviderVerification.hasBankCardTokenProvider;
import static com.rbkmoney.proxy.mocketbank.utils.model.CardAction.*;
import static dev.vality.adapter.common.damsel.OptionsExtractors.extractRedirectTimeout;
import static dev.vality.adapter.common.damsel.ProxyProviderPackageCreators.*;
import static dev.vality.adapter.common.damsel.ProxyProviderPackageExtractors.extractInvoiceId;
import static dev.vality.adapter.common.damsel.ProxyProviderVerification.isMakeRecurrent;
import static dev.vality.adapter.common.damsel.model.Error.DEFAULT_ERROR_CODE;
import static dev.vality.adapter.common.damsel.model.Error.THREE_DS_NOT_FINISHED;
import static dev.vality.proxy.mocketbank.service.mpi.constant.EnrollmentStatus.isAuthenticationAvailable;
import static dev.vality.proxy.mocketbank.utils.TokenProviderVerification.hasBankCardTokenProvider;
import static dev.vality.proxy.mocketbank.utils.UrlUtils.prepareRedirectParams;
import static dev.vality.proxy.mocketbank.utils.model.CardAction.*;
@Slf4j
@Component
@RequiredArgsConstructor
public class ProcessedCommonPaymentHandler implements CommonPaymentHandler {
private final CdsClientStorage cds;
private final CdsStorageClient cds;
private final MpiApi mpiApi;
private final ErrorMapping errorMapping;
private final List<Card> cardList;
@ -82,7 +87,7 @@ public class ProcessedCommonPaymentHandler implements CommonPaymentHandler {
try {
cardData = cds.getCardData(context);
} catch (CdsStorageExpDateException ex) {
return ErrorBuilder.prepareError(errorMapping, Error.DEFAULT_ERROR_CODE, ex.getMessage());
return ErrorBuilder.prepareError(errorMapping, DEFAULT_ERROR_CODE, ex.getMessage());
}
Optional<Card> card = CardUtils.extractCardByPan(cardList, cardData.getPan());

View File

@ -1,19 +1,19 @@
package com.rbkmoney.proxy.mocketbank.handler.payment.common;
package dev.vality.proxy.mocketbank.handler.payment.common;
import com.rbkmoney.damsel.domain.TargetInvoicePaymentStatus;
import com.rbkmoney.damsel.proxy_provider.PaymentContext;
import com.rbkmoney.damsel.proxy_provider.PaymentProxyResult;
import com.rbkmoney.damsel.proxy_provider.PaymentResource;
import com.rbkmoney.java.damsel.constant.PaymentState;
import com.rbkmoney.proxy.mocketbank.handler.payment.CommonPaymentHandler;
import com.rbkmoney.proxy.mocketbank.validator.PaymentRefundedValidator;
import dev.vality.damsel.domain.TargetInvoicePaymentStatus;
import dev.vality.damsel.proxy_provider.PaymentContext;
import dev.vality.damsel.proxy_provider.PaymentProxyResult;
import dev.vality.damsel.proxy_provider.PaymentResource;
import dev.vality.proxy.mocketbank.constant.PaymentState;
import dev.vality.proxy.mocketbank.handler.payment.CommonPaymentHandler;
import dev.vality.proxy.mocketbank.validator.PaymentRefundedValidator;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.thrift.TException;
import org.springframework.stereotype.Component;
import static com.rbkmoney.java.damsel.utils.creators.ProxyProviderPackageCreators.createFinishIntentSuccess;
import static com.rbkmoney.java.damsel.utils.creators.ProxyProviderPackageCreators.createPaymentProxyResult;
import static dev.vality.adapter.common.damsel.ProxyProviderPackageCreators.createFinishIntentSuccess;
import static dev.vality.adapter.common.damsel.ProxyProviderPackageCreators.createPaymentProxyResult;
@Slf4j
@Component

View File

@ -1,28 +1,29 @@
package com.rbkmoney.proxy.mocketbank.handler.payment.recurrent;
package dev.vality.proxy.mocketbank.handler.payment.recurrent;
import com.rbkmoney.cds.client.storage.CdsClientStorage;
import com.rbkmoney.cds.client.storage.exception.CdsStorageExpDateException;
import com.rbkmoney.damsel.domain.Failure;
import com.rbkmoney.damsel.domain.OperationFailure;
import com.rbkmoney.damsel.proxy_provider.RecurrentTokenContext;
import com.rbkmoney.damsel.proxy_provider.RecurrentTokenIntent;
import com.rbkmoney.damsel.proxy_provider.RecurrentTokenProxyResult;
import com.rbkmoney.damsel.timeout_behaviour.TimeoutBehaviour;
import com.rbkmoney.error.mapping.ErrorMapping;
import com.rbkmoney.java.cds.utils.model.CardDataProxyModel;
import com.rbkmoney.java.damsel.constant.Error;
import com.rbkmoney.java.damsel.constant.PaymentState;
import com.rbkmoney.proxy.mocketbank.configuration.properties.AdapterMockBankProperties;
import com.rbkmoney.proxy.mocketbank.configuration.properties.TimerProperties;
import com.rbkmoney.proxy.mocketbank.service.mpi.MpiApi;
import com.rbkmoney.proxy.mocketbank.service.mpi.model.VerifyEnrollmentResponse;
import com.rbkmoney.proxy.mocketbank.utils.ErrorBuilder;
import com.rbkmoney.proxy.mocketbank.utils.UrlUtils;
import com.rbkmoney.proxy.mocketbank.utils.model.Card;
import com.rbkmoney.proxy.mocketbank.utils.model.CardAction;
import com.rbkmoney.proxy.mocketbank.utils.model.CardUtils;
import com.rbkmoney.proxy.mocketbank.utils.state.StateUtils;
import com.rbkmoney.proxy.mocketbank.utils.state.constant.SuspendPrefix;
import dev.vality.adapter.common.cds.CdsStorageClient;
import dev.vality.adapter.common.cds.model.CardDataProxyModel;
import dev.vality.adapter.common.exception.CdsStorageExpDateException;
import dev.vality.adapter.common.mapper.ErrorMapping;
import dev.vality.damsel.domain.Failure;
import dev.vality.damsel.domain.OperationFailure;
import dev.vality.damsel.proxy_provider.RecurrentTokenContext;
import dev.vality.damsel.proxy_provider.RecurrentTokenIntent;
import dev.vality.damsel.proxy_provider.RecurrentTokenProxyResult;
import dev.vality.damsel.timeout_behaviour.TimeoutBehaviour;
import dev.vality.proxy.mocketbank.configuration.properties.AdapterMockBankProperties;
import dev.vality.proxy.mocketbank.configuration.properties.TimerProperties;
import dev.vality.proxy.mocketbank.constant.PaymentState;
import dev.vality.proxy.mocketbank.service.mpi.MpiApi;
import dev.vality.proxy.mocketbank.service.mpi.constant.EnrollmentStatus;
import dev.vality.proxy.mocketbank.service.mpi.model.VerifyEnrollmentResponse;
import dev.vality.proxy.mocketbank.utils.ErrorBuilder;
import dev.vality.proxy.mocketbank.utils.TokenProviderVerification;
import dev.vality.proxy.mocketbank.utils.UrlUtils;
import dev.vality.proxy.mocketbank.utils.model.Card;
import dev.vality.proxy.mocketbank.utils.model.CardAction;
import dev.vality.proxy.mocketbank.utils.model.CardUtils;
import dev.vality.proxy.mocketbank.utils.state.StateUtils;
import dev.vality.proxy.mocketbank.utils.state.constant.SuspendPrefix;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@ -31,22 +32,18 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
import static com.rbkmoney.java.damsel.constant.Error.DEFAULT_ERROR_CODE;
import static com.rbkmoney.java.damsel.constant.Error.THREE_DS_NOT_FINISHED;
import static com.rbkmoney.java.damsel.utils.creators.ProxyProviderPackageCreators.*;
import static com.rbkmoney.java.damsel.utils.extractors.OptionsExtractors.extractRedirectTimeout;
import static com.rbkmoney.java.damsel.utils.extractors.ProxyProviderPackageExtractors.extractRecurrentId;
import static com.rbkmoney.proxy.mocketbank.service.mpi.constant.EnrollmentStatus.isAuthenticationAvailable;
import static com.rbkmoney.proxy.mocketbank.utils.UrlUtils.prepareRedirectParams;
import static com.rbkmoney.proxy.mocketbank.utils.TokenProviderVerification.hasBankCardTokenProvider;
import static com.rbkmoney.proxy.mocketbank.utils.model.CardAction.*;
import static dev.vality.adapter.common.damsel.OptionsExtractors.extractRedirectTimeout;
import static dev.vality.adapter.common.damsel.ProxyProviderPackageCreators.*;
import static dev.vality.adapter.common.damsel.ProxyProviderPackageExtractors.extractRecurrentId;
import static dev.vality.adapter.common.damsel.model.Error.DEFAULT_ERROR_CODE;
import static dev.vality.adapter.common.damsel.model.Error.THREE_DS_NOT_FINISHED;
@Slf4j
@Component
@RequiredArgsConstructor
public class GenerateTokenHandler {
private final CdsClientStorage cds;
private final CdsStorageClient cds;
private final MpiApi mpiApi;
private final ErrorMapping errorMapping;
private final List<Card> cardList;
@ -58,7 +55,7 @@ public class GenerateTokenHandler {
RecurrentTokenIntent intent = createRecurrentTokenFinishIntentSuccess(recurrentId);
// Applepay, Samsungpay, Googlepay - always successful and does not depends on card
if (hasBankCardTokenProvider(context)) {
if (TokenProviderVerification.hasBankCardTokenProvider(context)) {
return createRecurrentTokenProxyResult(intent);
}
@ -66,7 +63,7 @@ public class GenerateTokenHandler {
try {
cardData = cds.getCardData(context);
} catch (CdsStorageExpDateException ex) {
return ErrorBuilder.prepareRecurrentTokenError(errorMapping, Error.DEFAULT_ERROR_CODE, ex.getMessage());
return ErrorBuilder.prepareRecurrentTokenError(errorMapping, DEFAULT_ERROR_CODE, ex.getMessage());
}
Optional<Card> card = CardUtils.extractCardByPan(cardList, cardData.getPan());
@ -77,17 +74,17 @@ public class GenerateTokenHandler {
}
return prepareNotEnrolledRecurrentTokenProxyResult(intent, action);
}
return ErrorBuilder.prepareRecurrentTokenError(errorMapping, UNSUPPORTED_CARD);
return ErrorBuilder.prepareRecurrentTokenError(errorMapping, CardAction.UNSUPPORTED_CARD);
}
private RecurrentTokenProxyResult prepareNotEnrolledRecurrentTokenProxyResult(
RecurrentTokenIntent intent,
CardAction action) {
if (isCardSuccess(action)) {
if (CardAction.isCardSuccess(action)) {
return createRecurrentTokenProxyResult(intent, PaymentState.CAPTURED.getBytes());
}
CardAction currentAction = isCardFailed(action) ? action : UNKNOWN_FAILURE;
CardAction currentAction = CardAction.isCardFailed(action) ? action : CardAction.UNKNOWN_FAILURE;
return ErrorBuilder.prepareRecurrentTokenError(errorMapping, currentAction);
}
@ -97,7 +94,7 @@ public class GenerateTokenHandler {
CardDataProxyModel cardData) {
RecurrentTokenIntent recurrentTokenIntent = intent;
VerifyEnrollmentResponse verifyEnrollmentResponse = mpiApi.verifyEnrollment(cardData);
if (isAuthenticationAvailable(verifyEnrollmentResponse.getEnrolled())) {
if (EnrollmentStatus.isAuthenticationAvailable(verifyEnrollmentResponse.getEnrolled())) {
String tag = SuspendPrefix.RECURRENT.getPrefix() + context.getTokenInfo().getPaymentTool().getId();
String termUrl = UrlUtils.getCallbackUrl(
mockBankProperties.getCallbackUrl(),
@ -114,7 +111,7 @@ public class GenerateTokenHandler {
String tag,
String termUrl) {
String url = verifyEnrollmentResponse.getAcsUrl();
Map<String, String> params = prepareRedirectParams(verifyEnrollmentResponse, tag, termUrl);
Map<String, String> params = UrlUtils.prepareRedirectParams(verifyEnrollmentResponse, tag, termUrl);
Map<String, String> options = context.getOptions();
int timerRedirectTimeout = extractRedirectTimeout(options, timerProperties.getRedirectTimeout());

View File

@ -1,22 +1,22 @@
package com.rbkmoney.proxy.mocketbank.handler.payment.recurrent;
package dev.vality.proxy.mocketbank.handler.payment.recurrent;
import com.rbkmoney.damsel.domain.TargetInvoicePaymentStatus;
import com.rbkmoney.damsel.domain.TransactionInfo;
import com.rbkmoney.damsel.proxy_provider.Intent;
import com.rbkmoney.damsel.proxy_provider.PaymentContext;
import com.rbkmoney.damsel.proxy_provider.PaymentProxyResult;
import com.rbkmoney.damsel.proxy_provider.PaymentResource;
import com.rbkmoney.java.damsel.constant.PaymentState;
import com.rbkmoney.proxy.mocketbank.handler.payment.CommonPaymentHandler;
import com.rbkmoney.proxy.mocketbank.utils.CreatorUtils;
import dev.vality.damsel.domain.TargetInvoicePaymentStatus;
import dev.vality.damsel.domain.TransactionInfo;
import dev.vality.damsel.proxy_provider.Intent;
import dev.vality.damsel.proxy_provider.PaymentContext;
import dev.vality.damsel.proxy_provider.PaymentProxyResult;
import dev.vality.damsel.proxy_provider.PaymentResource;
import dev.vality.proxy.mocketbank.constant.PaymentState;
import dev.vality.proxy.mocketbank.handler.payment.CommonPaymentHandler;
import dev.vality.proxy.mocketbank.utils.CreatorUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.thrift.TException;
import org.springframework.stereotype.Component;
import static com.rbkmoney.java.damsel.utils.creators.ProxyProviderPackageCreators.*;
import static com.rbkmoney.java.damsel.utils.extractors.ProxyProviderPackageExtractors.extractInvoiceId;
import static com.rbkmoney.java.damsel.utils.verification.ProxyProviderVerification.isMakeRecurrent;
import static dev.vality.adapter.common.damsel.ProxyProviderPackageCreators.*;
import static dev.vality.adapter.common.damsel.ProxyProviderPackageExtractors.extractInvoiceId;
import static dev.vality.adapter.common.damsel.ProxyProviderVerification.isMakeRecurrent;
@Slf4j
@Component

View File

@ -0,0 +1,15 @@
package dev.vality.proxy.mocketbank.handler.terminal;
import dev.vality.damsel.domain.TargetInvoicePaymentStatus;
import dev.vality.damsel.proxy_provider.PaymentContext;
import dev.vality.damsel.proxy_provider.PaymentProxyResult;
import dev.vality.damsel.proxy_provider.PaymentResource;
import org.apache.thrift.TException;
public interface CommonTerminalHandler {
boolean filter(final TargetInvoicePaymentStatus targetInvoicePaymentStatus, final PaymentResource paymentResource);
PaymentProxyResult handler(PaymentContext context) throws TException;
}

View File

@ -1,4 +1,4 @@
package com.rbkmoney.proxy.mocketbank.handler.terminal;
package dev.vality.proxy.mocketbank.handler.terminal;
public class TerminalConstant {

View File

@ -1,8 +1,8 @@
package com.rbkmoney.proxy.mocketbank.handler.terminal;
package dev.vality.proxy.mocketbank.handler.terminal;
import com.rbkmoney.damsel.proxy_provider.*;
import com.rbkmoney.proxy.mocketbank.handler.terminal.payment.UnsupportedTerminalHandler;
import com.rbkmoney.proxy.mocketbank.validator.TerminalValidator;
import dev.vality.damsel.proxy_provider.*;
import dev.vality.proxy.mocketbank.handler.terminal.payment.UnsupportedTerminalHandler;
import dev.vality.proxy.mocketbank.validator.TerminalValidator;
import lombok.RequiredArgsConstructor;
import org.apache.thrift.TException;
import org.springframework.stereotype.Component;

View File

@ -1,17 +1,17 @@
package com.rbkmoney.proxy.mocketbank.handler.terminal.payment;
package dev.vality.proxy.mocketbank.handler.terminal.payment;
import com.rbkmoney.damsel.domain.TargetInvoicePaymentStatus;
import com.rbkmoney.damsel.domain.TransactionInfo;
import com.rbkmoney.damsel.proxy_provider.Intent;
import com.rbkmoney.damsel.proxy_provider.PaymentContext;
import com.rbkmoney.damsel.proxy_provider.PaymentProxyResult;
import com.rbkmoney.damsel.proxy_provider.PaymentResource;
import com.rbkmoney.proxy.mocketbank.handler.terminal.CommonTerminalHandler;
import dev.vality.damsel.domain.TargetInvoicePaymentStatus;
import dev.vality.damsel.domain.TransactionInfo;
import dev.vality.damsel.proxy_provider.Intent;
import dev.vality.damsel.proxy_provider.PaymentContext;
import dev.vality.damsel.proxy_provider.PaymentProxyResult;
import dev.vality.damsel.proxy_provider.PaymentResource;
import dev.vality.proxy.mocketbank.handler.terminal.CommonTerminalHandler;
import lombok.RequiredArgsConstructor;
import org.apache.thrift.TException;
import org.springframework.stereotype.Component;
import static com.rbkmoney.java.damsel.utils.creators.ProxyProviderPackageCreators.*;
import static dev.vality.adapter.common.damsel.ProxyProviderPackageCreators.*;
@Component
@RequiredArgsConstructor

View File

@ -1,19 +1,19 @@
package com.rbkmoney.proxy.mocketbank.handler.terminal.payment;
package dev.vality.proxy.mocketbank.handler.terminal.payment;
import com.rbkmoney.damsel.domain.*;
import com.rbkmoney.damsel.proxy_provider.*;
import com.rbkmoney.damsel.proxy_provider.Cash;
import com.rbkmoney.damsel.user_interaction.UserInteraction;
import com.rbkmoney.java.damsel.constant.PaymentState;
import com.rbkmoney.proxy.mocketbank.configuration.properties.AdapterMockBankProperties;
import com.rbkmoney.proxy.mocketbank.configuration.properties.TimerProperties;
import com.rbkmoney.proxy.mocketbank.handler.terminal.CommonTerminalHandler;
import com.rbkmoney.proxy.mocketbank.handler.terminal.TerminalConstant;
import com.rbkmoney.proxy.mocketbank.utils.CreatorUtils;
import com.rbkmoney.proxy.mocketbank.utils.UrlUtils;
import com.rbkmoney.proxy.mocketbank.utils.qps.QpsCreators;
import com.rbkmoney.proxy.mocketbank.utils.qps.QpsExtractors;
import com.rbkmoney.proxy.mocketbank.utils.qps.QpsOptions;
import dev.vality.damsel.domain.TargetInvoicePaymentStatus;
import dev.vality.damsel.domain.TransactionInfo;
import dev.vality.damsel.proxy_provider.*;
import dev.vality.damsel.user_interaction.UserInteraction;
import dev.vality.proxy.mocketbank.configuration.properties.AdapterMockBankProperties;
import dev.vality.proxy.mocketbank.configuration.properties.TimerProperties;
import dev.vality.proxy.mocketbank.constant.PaymentState;
import dev.vality.proxy.mocketbank.handler.terminal.CommonTerminalHandler;
import dev.vality.proxy.mocketbank.handler.terminal.TerminalConstant;
import dev.vality.proxy.mocketbank.utils.CreatorUtils;
import dev.vality.proxy.mocketbank.utils.UrlUtils;
import dev.vality.proxy.mocketbank.utils.qps.QpsCreators;
import dev.vality.proxy.mocketbank.utils.qps.QpsExtractors;
import dev.vality.proxy.mocketbank.utils.qps.QpsOptions;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.thrift.TException;
@ -22,8 +22,8 @@ import org.springframework.util.MultiValueMap;
import java.util.Arrays;
import static com.rbkmoney.java.damsel.utils.creators.ProxyProviderPackageCreators.*;
import static com.rbkmoney.java.damsel.utils.extractors.ProxyProviderPackageExtractors.extractInvoiceId;
import static dev.vality.adapter.common.damsel.ProxyProviderPackageCreators.*;
import static dev.vality.adapter.common.damsel.ProxyProviderPackageExtractors.extractInvoiceId;
@Slf4j
@Component

View File

@ -1,10 +1,10 @@
package com.rbkmoney.proxy.mocketbank.handler.terminal.payment;
package dev.vality.proxy.mocketbank.handler.terminal.payment;
import com.rbkmoney.damsel.domain.TargetInvoicePaymentStatus;
import com.rbkmoney.damsel.proxy_provider.PaymentContext;
import com.rbkmoney.damsel.proxy_provider.PaymentProxyResult;
import com.rbkmoney.damsel.proxy_provider.PaymentResource;
import com.rbkmoney.proxy.mocketbank.handler.terminal.CommonTerminalHandler;
import dev.vality.damsel.domain.TargetInvoicePaymentStatus;
import dev.vality.damsel.proxy_provider.PaymentContext;
import dev.vality.damsel.proxy_provider.PaymentProxyResult;
import dev.vality.damsel.proxy_provider.PaymentResource;
import dev.vality.proxy.mocketbank.handler.terminal.CommonTerminalHandler;
import org.apache.thrift.TException;
public class UnsupportedTerminalHandler implements CommonTerminalHandler {

View File

@ -0,0 +1,9 @@
package dev.vality.proxy.mocketbank.service;
import dev.vality.adapter.common.cds.model.CardDataProxyModel;
import dev.vality.damsel.withdrawals.provider_adapter.Withdrawal;
public interface CdsService {
CardDataProxyModel getCardData(Withdrawal withdrawal);
}

View File

@ -1,18 +1,17 @@
package com.rbkmoney.proxy.mocketbank.service;
package dev.vality.proxy.mocketbank.service;
import com.github.javafaker.Faker;
import com.github.javafaker.Name;
import com.rbkmoney.cds.client.storage.exception.CdsStorageException;
import com.rbkmoney.cds.storage.CardData;
import com.rbkmoney.cds.storage.StorageSrv;
import com.rbkmoney.damsel.domain.BankCard;
import com.rbkmoney.damsel.withdrawals.domain.Destination;
import com.rbkmoney.damsel.withdrawals.provider_adapter.Withdrawal;
import com.rbkmoney.java.cds.utils.model.CardDataProxyModel;
import dev.vality.adapter.common.cds.CdsStorageClient;
import dev.vality.adapter.common.cds.model.CardDataProxyModel;
import dev.vality.adapter.common.exception.CdsStorageException;
import dev.vality.cds.storage.CardData;
import dev.vality.damsel.domain.BankCard;
import dev.vality.damsel.withdrawals.domain.Destination;
import dev.vality.damsel.withdrawals.provider_adapter.Withdrawal;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.thrift.TException;
import org.springframework.stereotype.Service;
import java.util.Locale;
@ -25,7 +24,7 @@ public class CdsServiceImpl implements CdsService {
private static final Name FAKER_NAME = new Faker(Locale.ENGLISH).name();
private static final String NAME_REGEXP = "[^a-zA-Z +]";
private final StorageSrv.Iface storageSrv;
private final CdsStorageClient cds;
@Override
public CardDataProxyModel getCardData(Withdrawal withdrawal) {
@ -34,7 +33,7 @@ public class CdsServiceImpl implements CdsService {
throw new CdsStorageException("Token must be set for card data, withdrawalId " + withdrawal.getId());
}
BankCard bankCard = destination.getBankCard();
CardData cardData = callCds(bankCard.getToken());
CardData cardData = cds.getCardData(bankCard.getToken());
return initCardDataProxyModel(bankCard, cardData);
}
@ -73,14 +72,4 @@ public class CdsServiceImpl implements CdsService {
}
return cardData.isSetExpDate() ? cardData.getExpDate().getYear() : 0;
}
private CardData callCds(String token) {
log.info("Get card data by token: {}", token);
try {
return storageSrv.getCardData(token);
} catch (TException ex) {
throw new CdsStorageException(String.format("Can't get card data with token: %s", token), ex);
}
}
}

View File

@ -1,8 +1,8 @@
package com.rbkmoney.proxy.mocketbank.service.mpi;
package dev.vality.proxy.mocketbank.service.mpi;
import com.rbkmoney.java.cds.utils.model.CardDataProxyModel;
import com.rbkmoney.proxy.mocketbank.configuration.properties.AdapterMockMpiProperties;
import com.rbkmoney.proxy.mocketbank.service.mpi.model.*;
import dev.vality.adapter.common.cds.model.CardDataProxyModel;
import dev.vality.proxy.mocketbank.configuration.properties.AdapterMockMpiProperties;
import dev.vality.proxy.mocketbank.service.mpi.model.*;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

View File

@ -1,4 +1,4 @@
package com.rbkmoney.proxy.mocketbank.service.mpi.constant;
package dev.vality.proxy.mocketbank.service.mpi.constant;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

View File

@ -1,4 +1,4 @@
package com.rbkmoney.proxy.mocketbank.service.mpi.constant;
package dev.vality.proxy.mocketbank.service.mpi.constant;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

View File

@ -1,4 +1,4 @@
package com.rbkmoney.proxy.mocketbank.service.mpi.constant;
package dev.vality.proxy.mocketbank.service.mpi.constant;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

View File

@ -1,4 +1,4 @@
package com.rbkmoney.proxy.mocketbank.service.mpi.constant;
package dev.vality.proxy.mocketbank.service.mpi.constant;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

View File

@ -1,4 +1,4 @@
package com.rbkmoney.proxy.mocketbank.service.mpi.model;
package dev.vality.proxy.mocketbank.service.mpi.model;
import org.springframework.util.MultiValueMap;

View File

@ -1,7 +1,7 @@
package com.rbkmoney.proxy.mocketbank.service.mpi.model;
package dev.vality.proxy.mocketbank.service.mpi.model;
import com.rbkmoney.proxy.mocketbank.service.mpi.constant.MpiField;
import com.rbkmoney.proxy.mocketbank.utils.model.CreditCardUtils;
import dev.vality.proxy.mocketbank.service.mpi.constant.MpiField;
import dev.vality.proxy.mocketbank.utils.model.CreditCardUtils;
import lombok.Builder;
import lombok.Data;
import lombok.RequiredArgsConstructor;

View File

@ -1,4 +1,4 @@
package com.rbkmoney.proxy.mocketbank.service.mpi.model;
package dev.vality.proxy.mocketbank.service.mpi.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

View File

@ -1,7 +1,7 @@
package com.rbkmoney.proxy.mocketbank.service.mpi.model;
package dev.vality.proxy.mocketbank.service.mpi.model;
import com.rbkmoney.proxy.mocketbank.service.mpi.constant.MpiField;
import com.rbkmoney.proxy.mocketbank.utils.model.CreditCardUtils;
import dev.vality.proxy.mocketbank.service.mpi.constant.MpiField;
import dev.vality.proxy.mocketbank.utils.model.CreditCardUtils;
import lombok.Builder;
import lombok.Data;
import lombok.RequiredArgsConstructor;

View File

@ -1,4 +1,4 @@
package com.rbkmoney.proxy.mocketbank.service.mpi.model;
package dev.vality.proxy.mocketbank.service.mpi.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

View File

@ -1,7 +1,7 @@
package com.rbkmoney.proxy.mocketbank.service.mpi20;
package dev.vality.proxy.mocketbank.service.mpi20;
import com.rbkmoney.proxy.mocketbank.configuration.properties.Mpi20Properties;
import com.rbkmoney.proxy.mocketbank.service.mpi20.model.*;
import dev.vality.proxy.mocketbank.configuration.properties.Mpi20Properties;
import dev.vality.proxy.mocketbank.service.mpi20.model.*;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

View File

@ -1,4 +1,4 @@
package com.rbkmoney.proxy.mocketbank.service.mpi20.constant;
package dev.vality.proxy.mocketbank.service.mpi20.constant;
public class CallbackResponseFields {
public static final String THREE_DS_METHOD_DATA = "threeDSMethodData";

View File

@ -1,14 +1,14 @@
package com.rbkmoney.proxy.mocketbank.service.mpi20.converter;
package dev.vality.proxy.mocketbank.service.mpi20.converter;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.rbkmoney.cds.client.storage.CdsClientStorage;
import com.rbkmoney.damsel.proxy_provider.Cash;
import com.rbkmoney.damsel.proxy_provider.PaymentContext;
import com.rbkmoney.java.cds.utils.model.CardDataProxyModel;
import com.rbkmoney.proxy.mocketbank.configuration.properties.Mpi20Properties;
import com.rbkmoney.proxy.mocketbank.service.mpi20.model.AuthenticationRequest;
import com.rbkmoney.proxy.mocketbank.service.mpi20.model.SessionState;
import com.rbkmoney.proxy.mocketbank.utils.UrlUtils;
import dev.vality.adapter.common.cds.CdsStorageClient;
import dev.vality.adapter.common.cds.model.CardDataProxyModel;
import dev.vality.damsel.proxy_provider.Cash;
import dev.vality.damsel.proxy_provider.PaymentContext;
import dev.vality.proxy.mocketbank.configuration.properties.Mpi20Properties;
import dev.vality.proxy.mocketbank.service.mpi20.model.AuthenticationRequest;
import dev.vality.proxy.mocketbank.service.mpi20.model.SessionState;
import dev.vality.proxy.mocketbank.utils.UrlUtils;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.core.convert.converter.Converter;
@ -18,7 +18,7 @@ import org.springframework.stereotype.Component;
@RequiredArgsConstructor
public class CtxToAuthConverter implements Converter<PaymentContext, AuthenticationRequest> {
private final CdsClientStorage cds;
private final CdsStorageClient cds;
private final ObjectMapper objectMapper;
private final Mpi20Properties mpi20Properties;

View File

@ -1,11 +1,12 @@
package com.rbkmoney.proxy.mocketbank.service.mpi20.converter;
package dev.vality.proxy.mocketbank.service.mpi20.converter;
import com.rbkmoney.cds.client.storage.CdsClientStorage;
import com.rbkmoney.damsel.proxy_provider.PaymentContext;
import com.rbkmoney.java.cds.utils.model.CardDataProxyModel;
import com.rbkmoney.proxy.mocketbank.configuration.properties.Mpi20Properties;
import com.rbkmoney.proxy.mocketbank.service.mpi20.model.PreparationRequest;
import com.rbkmoney.proxy.mocketbank.utils.UrlUtils;
import dev.vality.adapter.common.cds.CdsStorageClient;
import dev.vality.adapter.common.cds.model.CardDataProxyModel;
import dev.vality.damsel.proxy_provider.PaymentContext;
import dev.vality.proxy.mocketbank.configuration.properties.Mpi20Properties;
import dev.vality.proxy.mocketbank.service.mpi20.constant.CallbackResponseFields;
import dev.vality.proxy.mocketbank.service.mpi20.model.PreparationRequest;
import dev.vality.proxy.mocketbank.utils.UrlUtils;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.core.convert.converter.Converter;
@ -14,13 +15,11 @@ import org.springframework.stereotype.Component;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import static com.rbkmoney.proxy.mocketbank.service.mpi20.constant.CallbackResponseFields.TERMINATION_URI;
@Component
@RequiredArgsConstructor
public class CtxToPreparationConverter implements Converter<PaymentContext, PreparationRequest> {
private final CdsClientStorage cds;
private final CdsStorageClient cds;
private final Mpi20Properties mpi20Properties;
@Override
@ -43,7 +42,7 @@ public class CtxToPreparationConverter implements Converter<PaymentContext, Prep
return UrlUtils.getCallbackUrl(
mpi20Properties.getCallbackUrl(),
mpi20Properties.getThreeDsMethodNotificationPath(),
TERMINATION_URI,
CallbackResponseFields.TERMINATION_URI,
terminationUri
);
}

View File

@ -1,9 +1,9 @@
package com.rbkmoney.proxy.mocketbank.service.mpi20.converter;
package dev.vality.proxy.mocketbank.service.mpi20.converter;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.rbkmoney.damsel.proxy_provider.PaymentContext;
import com.rbkmoney.proxy.mocketbank.service.mpi20.model.SessionState;
import com.rbkmoney.proxy.mocketbank.service.mpi20.model.ResultRequest;
import dev.vality.damsel.proxy_provider.PaymentContext;
import dev.vality.proxy.mocketbank.service.mpi20.model.ResultRequest;
import dev.vality.proxy.mocketbank.service.mpi20.model.SessionState;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.core.convert.converter.Converter;

Some files were not shown because too many files have changed in this diff Show More