TD-45: to dev.vality (#2)

This commit is contained in:
Baikov Dmitrii 2022-02-01 00:07:23 -08:00 committed by GitHub
parent a52b6b132d
commit 99c059eae2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
85 changed files with 529 additions and 492 deletions

4
.gitmodules vendored
View File

@ -1,4 +0,0 @@
[submodule "build_utils"]
path = build_utils
url = git@github.com:rbkmoney/build_utils.git
branch = master

15
Jenkinsfile vendored
View File

@ -1,15 +0,0 @@
#!groovy
build('fraudbusters-mg-connector', 'java-maven') {
checkoutRepo()
loadBuildUtils()
def javaServicePipeline
runStage('load JavaService pipeline') {
javaServicePipeline = load("build_utils/jenkins_lib/pipeJavaServiceInsideDocker.groovy")
}
def serviceName = env.REPO_NAME
def mvnArgs = '-DjvmArgs="-Xmx256m"'
javaServicePipeline(serviceName, mvnArgs)
}

View File

@ -6,13 +6,13 @@ Service for stream process mg-event-sink to local fraud model.
![alt text](images/fb_mg_connector_scheme.png)
Service read data from mg-event-sink using protocol [machinegun_proto](https://github.com/rbkmoney/machinegun_proto/blob/master/proto/event_sink.thrift).
Service read data from mg-event-sink using protocol [machinegun_proto](https://github.com/valitydev/machinegun_proto/blob/master/proto/event_sink.thrift).
Find need events:
- chargeback (with statuses - accepted, rejected, cancelled)
- refund (with statuses - succeeded, failed)
- payment (with statuses - processed, captured, cancelled, failed)
Map to local fraudbusters model [fraudbusters_proto](https://github.com/rbkmoney/fraudbusters-proto/blob/master/proto/fraudbusters.thrift) and split to topics by events type
Map to local fraudbusters model [fraudbusters_proto](https://github.com/valitydev/fraudbusters-proto/blob/master/proto/fraudbusters.thrift) and split to topics by events type
- chargeback
- refund

@ -1 +0,0 @@
Subproject commit a87ebf3ae5e56910dc6a0edcac7f90565368a3d1

59
pom.xml
View File

@ -4,9 +4,9 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.rbkmoney</groupId>
<groupId>dev.vality</groupId>
<artifactId>service-parent-pom</artifactId>
<version>2.0.11</version>
<version>1.0.8</version>
</parent>
<artifactId>fraudbusters-mg-connector</artifactId>
@ -16,7 +16,7 @@
<name>fraudbusters-mg-connector</name>
<properties>
<project.maintainer>Struzhkin Konstantin &lt;k.struzhkin@rbkmoney.com&gt;</project.maintainer>
<project.maintainer>Struzhkin Konstantin &lt;k.struzhkin@vality.dev&gt;</project.maintainer>
<server.port>8022</server.port>
<management.port>8023</management.port>
<exposed.ports>${server.port} ${management.port}</exposed.ports>
@ -24,58 +24,54 @@
<dockerfile.registry>${env.REGISTRY}</dockerfile.registry>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<machinegun-proto.version>1.18-d814d69</machinegun-proto.version>
<fraudbusters-proto.version>1.99-2a8f6ca</fraudbusters-proto.version>
<machinegun-proto.version>1.21-e4784ab</machinegun-proto.version>
<fraudbusters-proto.version>1.102-269908f</fraudbusters-proto.version>
<fistful-proto.version>1.133-c484877</fistful-proto.version>
</properties>
<dependencies>
<!--rbkmoney-->
<!--vality-->
<dependency>
<groupId>com.rbkmoney</groupId>
<artifactId>custom-metrics-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.rbkmoney</groupId>
<artifactId>custom-actuator-endpoints</artifactId>
</dependency>
<dependency>
<groupId>com.rbkmoney.woody</groupId>
<groupId>dev.vality.woody</groupId>
<artifactId>woody-thrift</artifactId>
</dependency>
<dependency>
<groupId>com.rbkmoney</groupId>
<groupId>dev.vality</groupId>
<artifactId>shared-resources</artifactId>
</dependency>
<dependency>
<groupId>com.rbkmoney.geck</groupId>
<groupId>dev.vality.geck</groupId>
<artifactId>serializer</artifactId>
</dependency>
<dependency>
<groupId>com.rbkmoney</groupId>
<groupId>dev.vality</groupId>
<artifactId>damsel</artifactId>
</dependency>
<dependency>
<groupId>com.rbkmoney</groupId>
<groupId>dev.vality</groupId>
<artifactId>mamsel</artifactId>
<version>0.1.2</version>
</dependency>
<dependency>
<groupId>com.rbkmoney</groupId>
<groupId>dev.vality</groupId>
<artifactId>machinegun-proto</artifactId>
<version>${machinegun-proto.version}</version>
</dependency>
<dependency>
<groupId>com.rbkmoney</groupId>
<groupId>dev.vality</groupId>
<artifactId>kafka-common-lib</artifactId>
</dependency>
<dependency>
<groupId>com.rbkmoney</groupId>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>dev.vality</groupId>
<artifactId>fraudbusters-proto</artifactId>
<version>${fraudbusters-proto.version}</version>
</dependency>
<dependency>
<groupId>com.rbkmoney.geck</groupId>
<groupId>dev.vality.geck</groupId>
<artifactId>filter</artifactId>
</dependency>
<dependency>
@ -120,6 +116,15 @@
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-streams</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-core</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
<!--test-->
@ -131,13 +136,13 @@
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<version>1.16.0</version>
<version>1.16.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>kafka</artifactId>
<version>1.16.0</version>
<version>1.16.3</version>
<scope>test</scope>
</dependency>
<dependency>
@ -187,7 +192,7 @@
</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>

18
renovate.json Normal file
View File

@ -0,0 +1,18 @@
{
"extends": [
"config:base"
],
"packageRules": [
{
"matchPackagePatterns": [
"*"
],
"matchUpdateTypes": [
"minor",
"patch"
],
"groupName": "all non-major dependencies",
"groupSlug": "all-minor-patch"
}
]
}

View File

@ -1,9 +0,0 @@
package com.rbkmoney.fraudbusters.mg.connector.constant;
import com.rbkmoney.geck.filter.Filter;
public interface EventType {
Filter getFilter();
}

View File

@ -1,7 +0,0 @@
package com.rbkmoney.fraudbusters.mg.connector.constant;
public enum StreamType {
INVOICE, WITHDRAWAL
}

View File

@ -1,13 +0,0 @@
package com.rbkmoney.fraudbusters.mg.connector.domain;
import com.rbkmoney.damsel.domain.Invoice;
import com.rbkmoney.damsel.payment_processing.InvoicePayment;
import lombok.Data;
@Data
public class InvoicePaymentWrapper {
private Invoice invoice;
private InvoicePayment invoicePayment;
}

View File

@ -1,15 +0,0 @@
package com.rbkmoney.fraudbusters.mg.connector.domain;
import com.rbkmoney.damsel.payment_processing.InvoiceChange;
import com.rbkmoney.machinegun.eventsink.MachineEvent;
import lombok.Builder;
import lombok.Data;
@Data
@Builder
public class MgEventWrapper {
private InvoiceChange change;
private MachineEvent event;
}

View File

@ -1,26 +0,0 @@
package com.rbkmoney.fraudbusters.mg.connector.mapper.initializer;
import com.rbkmoney.damsel.domain.Invoice;
import com.rbkmoney.damsel.domain.Payer;
import com.rbkmoney.damsel.domain.PaymentTool;
import com.rbkmoney.damsel.fraudbusters.ClientInfo;
import com.rbkmoney.damsel.fraudbusters.Error;
import com.rbkmoney.damsel.fraudbusters.ProviderInfo;
import com.rbkmoney.damsel.fraudbusters.ReferenceInfo;
import com.rbkmoney.damsel.payment_processing.InvoicePayment;
public interface InfoInitializer<T> {
Error initError(T t);
ClientInfo initClientInfo(Payer payer);
void initContactInfo(ClientInfo clientInfo, Payer payer);
ProviderInfo initProviderInfo(InvoicePayment invoicePayment);
ReferenceInfo initReferenceInfo(Invoice invoice);
PaymentTool initPaymentTool(Payer payer);
}

View File

@ -1,9 +0,0 @@
package com.rbkmoney.fraudbusters.mg.connector.parser;
import com.rbkmoney.machinegun.eventsink.MachineEvent;
public interface EventParser<T> {
T parseEvent(MachineEvent message);
}

View File

@ -1,7 +1,7 @@
package com.rbkmoney.fraudbusters.mg.connector;
package dev.vality.fraudbusters.mg.connector;
import com.rbkmoney.fraudbusters.mg.connector.listener.StreamStateManager;
import com.rbkmoney.fraudbusters.mg.connector.pool.EventSinkStreamsPool;
import dev.vality.fraudbusters.mg.connector.listener.StreamStateManager;
import dev.vality.fraudbusters.mg.connector.pool.EventSinkStreamsPool;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

View File

@ -1,8 +1,8 @@
package com.rbkmoney.fraudbusters.mg.connector.config;
package dev.vality.fraudbusters.mg.connector.config;
import com.rbkmoney.damsel.payment_processing.InvoicingSrv;
import dev.vality.damsel.payment_processing.InvoicingSrv;
import dev.vality.fistful.withdrawal.ManagementSrv;
import com.rbkmoney.woody.thrift.impl.http.THSpawnClientBuilder;
import dev.vality.woody.thrift.impl.http.THSpawnClientBuilder;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@ -19,17 +19,18 @@ public class HgConfig {
throws IOException {
return new THSpawnClientBuilder()
.withNetworkTimeout(networkTimeout)
.withAddress(resource.getURI()).build(InvoicingSrv.Iface.class);
.withAddress(resource.getURI())
.build(InvoicingSrv.Iface.class);
}
@Bean
public ManagementSrv.Iface withdrawalClient(
@Value("${service.withdrawal.url}") Resource resource,
@Value("${service.withdrawal.networkTimeout}") int networkTimeout) throws IOException {
return new THSpawnClientBuilder()
.withNetworkTimeout(networkTimeout)
.withAddress(resource.getURI()).build(ManagementSrv.Iface.class);
.withAddress(resource.getURI())
.build(ManagementSrv.Iface.class);
}
@Bean
@ -38,7 +39,8 @@ public class HgConfig {
@Value("${service.destination.networkTimeout}") int networkTimeout) throws IOException {
return new THSpawnClientBuilder()
.withNetworkTimeout(networkTimeout)
.withAddress(resource.getURI()).build(dev.vality.fistful.destination.ManagementSrv.Iface.class);
.withAddress(resource.getURI())
.build(dev.vality.fistful.destination.ManagementSrv.Iface.class);
}
@Bean
@ -47,7 +49,8 @@ public class HgConfig {
@Value("${service.wallet.networkTimeout}") int networkTimeout) throws IOException {
return new THSpawnClientBuilder()
.withNetworkTimeout(networkTimeout)
.withAddress(resource.getURI()).build(dev.vality.fistful.wallet.ManagementSrv.Iface.class);
.withAddress(resource.getURI())
.build(dev.vality.fistful.wallet.ManagementSrv.Iface.class);
}
}

View File

@ -1,6 +1,6 @@
package com.rbkmoney.fraudbusters.mg.connector.config;
package dev.vality.fraudbusters.mg.connector.config;
import com.rbkmoney.fraudbusters.mg.connector.serde.MachineEventSerde;
import dev.vality.fraudbusters.mg.connector.serde.MachineEventSerde;
import org.apache.kafka.clients.CommonClientConfigs;
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.common.config.SslConfigs;

View File

@ -1,4 +1,4 @@
package com.rbkmoney.fraudbusters.mg.connector.config;
package dev.vality.fraudbusters.mg.connector.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;

View File

@ -0,0 +1,9 @@
package dev.vality.fraudbusters.mg.connector.constant;
import dev.vality.geck.filter.Filter;
public interface EventType {
Filter getFilter();
}

View File

@ -1,10 +1,10 @@
package com.rbkmoney.fraudbusters.mg.connector.constant;
package dev.vality.fraudbusters.mg.connector.constant;
import com.rbkmoney.geck.filter.Condition;
import com.rbkmoney.geck.filter.Filter;
import com.rbkmoney.geck.filter.PathConditionFilter;
import com.rbkmoney.geck.filter.condition.IsNullCondition;
import com.rbkmoney.geck.filter.rule.PathConditionRule;
import dev.vality.geck.filter.Condition;
import dev.vality.geck.filter.Filter;
import dev.vality.geck.filter.PathConditionFilter;
import dev.vality.geck.filter.condition.IsNullCondition;
import dev.vality.geck.filter.rule.PathConditionRule;
@SuppressWarnings("LineLength")
public enum InvoiceEventType implements EventType {

View File

@ -0,0 +1,7 @@
package dev.vality.fraudbusters.mg.connector.constant;
public enum StreamType {
INVOICE, WITHDRAWAL
}

View File

@ -1,10 +1,10 @@
package com.rbkmoney.fraudbusters.mg.connector.constant;
package dev.vality.fraudbusters.mg.connector.constant;
import com.rbkmoney.geck.filter.Condition;
import com.rbkmoney.geck.filter.Filter;
import com.rbkmoney.geck.filter.PathConditionFilter;
import com.rbkmoney.geck.filter.condition.IsNullCondition;
import com.rbkmoney.geck.filter.rule.PathConditionRule;
import dev.vality.geck.filter.Condition;
import dev.vality.geck.filter.Filter;
import dev.vality.geck.filter.PathConditionFilter;
import dev.vality.geck.filter.condition.IsNullCondition;
import dev.vality.geck.filter.rule.PathConditionRule;
public enum WithdrawalEventType implements EventType {

View File

@ -1,4 +1,4 @@
package com.rbkmoney.fraudbusters.mg.connector.converter;
package dev.vality.fraudbusters.mg.connector.converter;
public interface BinaryConverter<T> {

View File

@ -1,6 +1,6 @@
package com.rbkmoney.fraudbusters.mg.connector.converter;
package dev.vality.fraudbusters.mg.connector.converter;
import com.rbkmoney.damsel.fraudbusters.Account;
import dev.vality.damsel.fraudbusters.Account;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.convert.converter.Converter;

View File

@ -1,6 +1,6 @@
package com.rbkmoney.fraudbusters.mg.connector.converter;
package dev.vality.fraudbusters.mg.connector.converter;
import com.rbkmoney.damsel.domain.Cash;
import dev.vality.damsel.domain.Cash;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.convert.converter.Converter;

View File

@ -1,6 +1,6 @@
package com.rbkmoney.fraudbusters.mg.connector.converter;
package dev.vality.fraudbusters.mg.connector.converter;
import com.rbkmoney.damsel.domain.CurrencyRef;
import dev.vality.damsel.domain.CurrencyRef;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

View File

@ -1,14 +1,13 @@
package com.rbkmoney.fraudbusters.mg.connector.converter;
package dev.vality.fraudbusters.mg.connector.converter;
import com.rbkmoney.damsel.domain.BankCard;
import com.rbkmoney.damsel.domain.CountryCode;
import com.rbkmoney.damsel.domain.LegacyBankCardPaymentSystem;
import com.rbkmoney.damsel.domain.PaymentSystemRef;
import com.rbkmoney.damsel.fraudbusters.CryptoWallet;
import com.rbkmoney.damsel.fraudbusters.DigitalWallet;
import com.rbkmoney.damsel.fraudbusters.Resource;
import com.rbkmoney.fraudbusters.mg.connector.exception.UnknownResourceException;
import com.rbkmoney.mamsel.PaymentSystemUtil;
import dev.vality.damsel.domain.BankCard;
import dev.vality.damsel.domain.CountryCode;
import dev.vality.damsel.domain.LegacyBankCardPaymentSystem;
import dev.vality.damsel.domain.PaymentSystemRef;
import dev.vality.damsel.fraudbusters.CryptoWallet;
import dev.vality.damsel.fraudbusters.DigitalWallet;
import dev.vality.damsel.fraudbusters.Resource;
import dev.vality.fraudbusters.mg.connector.exception.UnknownResourceException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

View File

@ -1,27 +1,28 @@
package com.rbkmoney.fraudbusters.mg.connector.converter;
package dev.vality.fraudbusters.mg.connector.converter;
import com.rbkmoney.damsel.payment_processing.EventPayload;
import dev.vality.damsel.payment_processing.EventPayload;
import dev.vality.fraudbusters.mg.connector.utils.DeserializerUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.thrift.TDeserializer;
import org.apache.thrift.TException;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class PaymentConverterImpl implements BinaryConverter<EventPayload> {
ThreadLocal<TDeserializer> thriftDeserializerThreadLocal =
ThreadLocal.withInitial(() -> new TDeserializer(new TBinaryProtocol.Factory()));
private ThreadLocal<TDeserializer> threadLocalDeserializer =
ThreadLocal.withInitial(DeserializerUtils::createDeserializer);
@Override
public EventPayload convert(byte[] bin, Class<EventPayload> clazz) {
EventPayload event = new EventPayload();
try {
thriftDeserializerThreadLocal.get().deserialize(event, bin);
threadLocalDeserializer.get().deserialize(event, bin);
} catch (TException e) {
log.error("BinaryConverterImpl e: ", e);
}
return event;
}
}

View File

@ -1,27 +1,37 @@
package com.rbkmoney.fraudbusters.mg.connector.converter;
package dev.vality.fraudbusters.mg.connector.converter;
import dev.vality.fistful.withdrawal.TimestampedChange;
import dev.vality.kafka.common.exception.TransportException;
import lombok.extern.slf4j.Slf4j;
import org.apache.thrift.TDeserializer;
import org.apache.thrift.TException;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.transport.TTransportException;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class WithdrawalConverterImpl implements BinaryConverter<TimestampedChange> {
ThreadLocal<TDeserializer> thriftDeserializerThreadLocal =
ThreadLocal.withInitial(() -> new TDeserializer(new TBinaryProtocol.Factory()));
private ThreadLocal<TDeserializer> threadLocalDeserializer = ThreadLocal.withInitial(this::createDeserializer);
@Override
public TimestampedChange convert(byte[] bin, Class<TimestampedChange> clazz) {
TimestampedChange event = new TimestampedChange();
try {
thriftDeserializerThreadLocal.get().deserialize(event, bin);
threadLocalDeserializer.get().deserialize(event, bin);
} catch (TException e) {
log.error("Error when convert TimestampedChange e: ", e);
}
return event;
}
private TDeserializer createDeserializer() {
try {
return new TDeserializer(new TBinaryProtocol.Factory());
} catch (TTransportException ex) {
throw new TransportException(ex);
}
}
}

View File

@ -1,4 +1,4 @@
package com.rbkmoney.fraudbusters.mg.connector.domain;
package dev.vality.fraudbusters.mg.connector.domain;
import lombok.Builder;
import lombok.Data;

View File

@ -0,0 +1,13 @@
package dev.vality.fraudbusters.mg.connector.domain;
import dev.vality.damsel.domain.Invoice;
import dev.vality.damsel.payment_processing.InvoicePayment;
import lombok.Data;
@Data
public class InvoicePaymentWrapper {
private Invoice invoice;
private InvoicePayment invoicePayment;
}

View File

@ -0,0 +1,15 @@
package dev.vality.fraudbusters.mg.connector.domain;
import dev.vality.damsel.payment_processing.InvoiceChange;
import dev.vality.machinegun.eventsink.MachineEvent;
import lombok.Builder;
import lombok.Data;
@Data
@Builder
public class MgEventWrapper {
private InvoiceChange change;
private MachineEvent event;
}

View File

@ -1,4 +1,4 @@
package com.rbkmoney.fraudbusters.mg.connector.exception;
package dev.vality.fraudbusters.mg.connector.exception;
public class PaymentInfoNotFoundException extends RuntimeException {
public PaymentInfoNotFoundException() {

View File

@ -1,4 +1,4 @@
package com.rbkmoney.fraudbusters.mg.connector.exception;
package dev.vality.fraudbusters.mg.connector.exception;
public class PaymentInfoRequestException extends RuntimeException {
public PaymentInfoRequestException() {

View File

@ -1,4 +1,4 @@
package com.rbkmoney.fraudbusters.mg.connector.exception;
package dev.vality.fraudbusters.mg.connector.exception;
public class StreamInitializationException extends RuntimeException {
public StreamInitializationException() {

View File

@ -1,4 +1,4 @@
package com.rbkmoney.fraudbusters.mg.connector.exception;
package dev.vality.fraudbusters.mg.connector.exception;
public class UnknownResourceException extends RuntimeException {
public UnknownResourceException() {

View File

@ -1,7 +1,7 @@
package com.rbkmoney.fraudbusters.mg.connector.factory;
package dev.vality.fraudbusters.mg.connector.factory;
import com.rbkmoney.damsel.payment_processing.EventRange;
import dev.vality.damsel.payment_processing.EventRange;
import org.springframework.stereotype.Service;
@Service

View File

@ -1,6 +1,6 @@
package com.rbkmoney.fraudbusters.mg.connector.factory;
package dev.vality.fraudbusters.mg.connector.factory;
import com.rbkmoney.fraudbusters.mg.connector.constant.StreamType;
import dev.vality.fraudbusters.mg.connector.constant.StreamType;
import org.apache.kafka.streams.KafkaStreams;
public interface EventSinkFactory {

View File

@ -1,4 +1,4 @@
package com.rbkmoney.fraudbusters.mg.connector.factory;
package dev.vality.fraudbusters.mg.connector.factory;
import dev.vality.fistful.base.EventRange;

View File

@ -1,19 +1,19 @@
package com.rbkmoney.fraudbusters.mg.connector.factory;
package dev.vality.fraudbusters.mg.connector.factory;
import com.rbkmoney.damsel.payment_processing.EventPayload;
import com.rbkmoney.damsel.payment_processing.InvoiceChange;
import com.rbkmoney.fraudbusters.mg.connector.constant.StreamType;
import com.rbkmoney.fraudbusters.mg.connector.domain.MgEventWrapper;
import com.rbkmoney.fraudbusters.mg.connector.exception.StreamInitializationException;
import com.rbkmoney.fraudbusters.mg.connector.mapper.impl.ChargebackPaymentMapper;
import com.rbkmoney.fraudbusters.mg.connector.mapper.impl.PaymentMapper;
import com.rbkmoney.fraudbusters.mg.connector.mapper.impl.RefundPaymentMapper;
import com.rbkmoney.fraudbusters.mg.connector.parser.EventParser;
import com.rbkmoney.fraudbusters.mg.connector.serde.ChargebackSerde;
import com.rbkmoney.fraudbusters.mg.connector.serde.MachineEventSerde;
import com.rbkmoney.fraudbusters.mg.connector.serde.PaymentSerde;
import com.rbkmoney.fraudbusters.mg.connector.serde.RefundSerde;
import com.rbkmoney.machinegun.eventsink.MachineEvent;
import dev.vality.damsel.payment_processing.EventPayload;
import dev.vality.damsel.payment_processing.InvoiceChange;
import dev.vality.fraudbusters.mg.connector.constant.StreamType;
import dev.vality.fraudbusters.mg.connector.domain.MgEventWrapper;
import dev.vality.fraudbusters.mg.connector.exception.StreamInitializationException;
import dev.vality.fraudbusters.mg.connector.mapper.impl.ChargebackPaymentMapper;
import dev.vality.fraudbusters.mg.connector.mapper.impl.PaymentMapper;
import dev.vality.fraudbusters.mg.connector.mapper.impl.RefundPaymentMapper;
import dev.vality.fraudbusters.mg.connector.parser.EventParser;
import dev.vality.fraudbusters.mg.connector.serde.ChargebackSerde;
import dev.vality.fraudbusters.mg.connector.serde.MachineEventSerde;
import dev.vality.fraudbusters.mg.connector.serde.PaymentSerde;
import dev.vality.fraudbusters.mg.connector.serde.RefundSerde;
import dev.vality.machinegun.eventsink.MachineEvent;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.common.serialization.Serde;

View File

@ -1,14 +1,14 @@
package com.rbkmoney.fraudbusters.mg.connector.factory;
package dev.vality.fraudbusters.mg.connector.factory;
import com.rbkmoney.damsel.fraudbusters.Withdrawal;
import dev.vality.damsel.fraudbusters.Withdrawal;
import dev.vality.fistful.withdrawal.TimestampedChange;
import com.rbkmoney.fraudbusters.mg.connector.constant.StreamType;
import com.rbkmoney.fraudbusters.mg.connector.exception.StreamInitializationException;
import com.rbkmoney.fraudbusters.mg.connector.mapper.Mapper;
import com.rbkmoney.fraudbusters.mg.connector.parser.EventParser;
import com.rbkmoney.fraudbusters.mg.connector.serde.MachineEventSerde;
import com.rbkmoney.fraudbusters.mg.connector.serde.WithdrawalSerde;
import com.rbkmoney.machinegun.eventsink.MachineEvent;
import dev.vality.fraudbusters.mg.connector.constant.StreamType;
import dev.vality.fraudbusters.mg.connector.exception.StreamInitializationException;
import dev.vality.fraudbusters.mg.connector.mapper.Mapper;
import dev.vality.fraudbusters.mg.connector.parser.EventParser;
import dev.vality.fraudbusters.mg.connector.serde.MachineEventSerde;
import dev.vality.fraudbusters.mg.connector.serde.WithdrawalSerde;
import dev.vality.machinegun.eventsink.MachineEvent;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.common.serialization.Serde;

View File

@ -1,7 +1,7 @@
package com.rbkmoney.fraudbusters.mg.connector.listener;
package dev.vality.fraudbusters.mg.connector.listener;
import com.rbkmoney.fraudbusters.mg.connector.factory.EventSinkFactory;
import com.rbkmoney.fraudbusters.mg.connector.pool.EventSinkStreamsPool;
import dev.vality.fraudbusters.mg.connector.factory.EventSinkFactory;
import dev.vality.fraudbusters.mg.connector.pool.EventSinkStreamsPool;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.streams.KafkaStreams;

View File

@ -1,9 +1,9 @@
package com.rbkmoney.fraudbusters.mg.connector.listener;
package dev.vality.fraudbusters.mg.connector.listener;
import com.rbkmoney.fraudbusters.mg.connector.constant.StreamType;
import com.rbkmoney.fraudbusters.mg.connector.factory.EventSinkFactory;
import com.rbkmoney.fraudbusters.mg.connector.pool.EventSinkStreamsPool;
import com.rbkmoney.fraudbusters.mg.connector.utils.ShutdownManager;
import dev.vality.fraudbusters.mg.connector.constant.StreamType;
import dev.vality.fraudbusters.mg.connector.factory.EventSinkFactory;
import dev.vality.fraudbusters.mg.connector.pool.EventSinkStreamsPool;
import dev.vality.fraudbusters.mg.connector.utils.ShutdownManager;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.streams.KafkaStreams;

View File

@ -1,7 +1,7 @@
package com.rbkmoney.fraudbusters.mg.connector.mapper;
package dev.vality.fraudbusters.mg.connector.mapper;
import com.rbkmoney.fraudbusters.mg.connector.constant.EventType;
import dev.vality.fraudbusters.mg.connector.constant.EventType;
public interface Mapper<C, P, R> {

View File

@ -1,18 +1,18 @@
package com.rbkmoney.fraudbusters.mg.connector.mapper.impl;
package dev.vality.fraudbusters.mg.connector.mapper.impl;
import com.rbkmoney.damsel.domain.Payer;
import com.rbkmoney.damsel.fraudbusters.Chargeback;
import com.rbkmoney.damsel.fraudbusters.ChargebackCategory;
import com.rbkmoney.damsel.fraudbusters.ChargebackStatus;
import com.rbkmoney.damsel.fraudbusters.PayerType;
import com.rbkmoney.damsel.payment_processing.*;
import com.rbkmoney.fraudbusters.mg.connector.constant.InvoiceEventType;
import com.rbkmoney.fraudbusters.mg.connector.domain.InvoicePaymentWrapper;
import com.rbkmoney.fraudbusters.mg.connector.mapper.Mapper;
import com.rbkmoney.fraudbusters.mg.connector.mapper.initializer.GeneralInfoInitiator;
import com.rbkmoney.fraudbusters.mg.connector.service.HgClientService;
import com.rbkmoney.geck.common.util.TBaseUtil;
import com.rbkmoney.machinegun.eventsink.MachineEvent;
import dev.vality.damsel.domain.Payer;
import dev.vality.damsel.fraudbusters.Chargeback;
import dev.vality.damsel.fraudbusters.ChargebackCategory;
import dev.vality.damsel.fraudbusters.ChargebackStatus;
import dev.vality.damsel.fraudbusters.PayerType;
import dev.vality.damsel.payment_processing.*;
import dev.vality.fraudbusters.mg.connector.constant.InvoiceEventType;
import dev.vality.fraudbusters.mg.connector.domain.InvoicePaymentWrapper;
import dev.vality.fraudbusters.mg.connector.mapper.Mapper;
import dev.vality.fraudbusters.mg.connector.mapper.initializer.GeneralInfoInitiator;
import dev.vality.fraudbusters.mg.connector.service.HgClientService;
import dev.vality.geck.common.util.TBaseUtil;
import dev.vality.machinegun.eventsink.MachineEvent;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@ -78,7 +78,7 @@ public class ChargebackPaymentMapper implements Mapper<InvoiceChange, MachineEve
.filter(chargebackVal -> chargebackVal.getChargeback().getId().equals(chargebackId))
.findFirst()
.ifPresent(paymentChargeback -> {
com.rbkmoney.damsel.domain.InvoicePaymentChargeback invoicePaymentChargeback =
dev.vality.damsel.domain.InvoicePaymentChargeback invoicePaymentChargeback =
paymentChargeback.getChargeback();
chargeback.setChargebackCode(invoicePaymentChargeback.getReason().getCode() != null
? invoicePaymentChargeback.getReason().getCode()

View File

@ -1,10 +1,10 @@
package com.rbkmoney.fraudbusters.mg.connector.mapper.impl;
package dev.vality.fraudbusters.mg.connector.mapper.impl;
import com.rbkmoney.damsel.fraudbusters.Withdrawal;
import dev.vality.damsel.fraudbusters.Withdrawal;
import dev.vality.fistful.withdrawal.TimestampedChange;
import com.rbkmoney.fraudbusters.mg.connector.constant.WithdrawalEventType;
import com.rbkmoney.fraudbusters.mg.connector.mapper.Mapper;
import com.rbkmoney.machinegun.eventsink.MachineEvent;
import dev.vality.fraudbusters.mg.connector.constant.WithdrawalEventType;
import dev.vality.fraudbusters.mg.connector.mapper.Mapper;
import dev.vality.machinegun.eventsink.MachineEvent;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

View File

@ -1,19 +1,19 @@
package com.rbkmoney.fraudbusters.mg.connector.mapper.impl;
package dev.vality.fraudbusters.mg.connector.mapper.impl;
import com.rbkmoney.damsel.domain.Payer;
import com.rbkmoney.damsel.domain.PaymentTool;
import com.rbkmoney.damsel.fraudbusters.PayerType;
import com.rbkmoney.damsel.fraudbusters.Payment;
import com.rbkmoney.damsel.fraudbusters.PaymentStatus;
import com.rbkmoney.damsel.payment_processing.*;
import com.rbkmoney.fraudbusters.mg.connector.constant.InvoiceEventType;
import com.rbkmoney.fraudbusters.mg.connector.domain.InvoicePaymentWrapper;
import com.rbkmoney.fraudbusters.mg.connector.mapper.Mapper;
import com.rbkmoney.fraudbusters.mg.connector.mapper.initializer.InfoInitializer;
import com.rbkmoney.fraudbusters.mg.connector.service.HgClientService;
import com.rbkmoney.geck.common.util.TBaseUtil;
import com.rbkmoney.machinegun.eventsink.MachineEvent;
import com.rbkmoney.mamsel.TokenProviderUtil;
import dev.vality.damsel.domain.Payer;
import dev.vality.damsel.domain.PaymentTool;
import dev.vality.damsel.fraudbusters.PayerType;
import dev.vality.damsel.fraudbusters.Payment;
import dev.vality.damsel.fraudbusters.PaymentStatus;
import dev.vality.damsel.payment_processing.*;
import dev.vality.fraudbusters.mg.connector.constant.InvoiceEventType;
import dev.vality.fraudbusters.mg.connector.domain.InvoicePaymentWrapper;
import dev.vality.fraudbusters.mg.connector.mapper.Mapper;
import dev.vality.fraudbusters.mg.connector.mapper.initializer.InfoInitializer;
import dev.vality.fraudbusters.mg.connector.service.HgClientService;
import dev.vality.geck.common.util.TBaseUtil;
import dev.vality.machinegun.eventsink.MachineEvent;
import dev.vality.mamsel.TokenProviderUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@ -60,8 +60,11 @@ public class PaymentMapper implements Mapper<InvoiceChange, MachineEvent, Paymen
return payment;
}
private Payment initPayment(MachineEvent event, InvoicePaymentStatusChanged invoicePaymentStatusChanged,
com.rbkmoney.damsel.domain.Invoice invoice, InvoicePayment invoicePayment, Payer payer,
private Payment initPayment(MachineEvent event,
InvoicePaymentStatusChanged invoicePaymentStatusChanged,
dev.vality.damsel.domain.Invoice invoice,
InvoicePayment invoicePayment,
Payer payer,
PaymentTool paymentTool) {
var payment = invoicePayment.getPayment();
return new Payment()

View File

@ -1,17 +1,17 @@
package com.rbkmoney.fraudbusters.mg.connector.mapper.impl;
package dev.vality.fraudbusters.mg.connector.mapper.impl;
import com.rbkmoney.damsel.domain.Payer;
import com.rbkmoney.damsel.fraudbusters.PayerType;
import com.rbkmoney.damsel.fraudbusters.Refund;
import com.rbkmoney.damsel.fraudbusters.RefundStatus;
import com.rbkmoney.damsel.payment_processing.*;
import com.rbkmoney.fraudbusters.mg.connector.constant.InvoiceEventType;
import com.rbkmoney.fraudbusters.mg.connector.domain.InvoicePaymentWrapper;
import com.rbkmoney.fraudbusters.mg.connector.mapper.Mapper;
import com.rbkmoney.fraudbusters.mg.connector.mapper.initializer.InfoInitializer;
import com.rbkmoney.fraudbusters.mg.connector.service.HgClientService;
import com.rbkmoney.geck.common.util.TBaseUtil;
import com.rbkmoney.machinegun.eventsink.MachineEvent;
import dev.vality.damsel.domain.Payer;
import dev.vality.damsel.fraudbusters.PayerType;
import dev.vality.damsel.fraudbusters.Refund;
import dev.vality.damsel.fraudbusters.RefundStatus;
import dev.vality.damsel.payment_processing.*;
import dev.vality.fraudbusters.mg.connector.constant.InvoiceEventType;
import dev.vality.fraudbusters.mg.connector.domain.InvoicePaymentWrapper;
import dev.vality.fraudbusters.mg.connector.mapper.Mapper;
import dev.vality.fraudbusters.mg.connector.mapper.initializer.InfoInitializer;
import dev.vality.fraudbusters.mg.connector.service.HgClientService;
import dev.vality.geck.common.util.TBaseUtil;
import dev.vality.machinegun.eventsink.MachineEvent;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

View File

@ -1,23 +1,23 @@
package com.rbkmoney.fraudbusters.mg.connector.mapper.impl;
package dev.vality.fraudbusters.mg.connector.mapper.impl;
import com.rbkmoney.damsel.fraudbusters.Resource;
import com.rbkmoney.damsel.fraudbusters.Withdrawal;
import com.rbkmoney.damsel.fraudbusters.WithdrawalStatus;
import dev.vality.damsel.fraudbusters.Resource;
import dev.vality.damsel.fraudbusters.Withdrawal;
import dev.vality.damsel.fraudbusters.WithdrawalStatus;
import dev.vality.fistful.destination.DestinationState;
import dev.vality.fistful.wallet.WalletState;
import dev.vality.fistful.withdrawal.TimestampedChange;
import dev.vality.fistful.withdrawal.WithdrawalState;
import com.rbkmoney.fraudbusters.mg.connector.constant.WithdrawalEventType;
import com.rbkmoney.fraudbusters.mg.connector.converter.FistfulAccountToDomainAccountConverter;
import com.rbkmoney.fraudbusters.mg.connector.converter.FistfulCashToDomainCashConverter;
import com.rbkmoney.fraudbusters.mg.connector.converter.FistfulResourceToDomainResourceConverter;
import com.rbkmoney.fraudbusters.mg.connector.mapper.Mapper;
import com.rbkmoney.fraudbusters.mg.connector.service.DestinationClientService;
import com.rbkmoney.fraudbusters.mg.connector.service.WalletClientService;
import com.rbkmoney.fraudbusters.mg.connector.service.WithdrawalClientService;
import com.rbkmoney.fraudbusters.mg.connector.utils.WithdrawalModelUtil;
import com.rbkmoney.geck.common.util.TBaseUtil;
import com.rbkmoney.machinegun.eventsink.MachineEvent;
import dev.vality.fraudbusters.mg.connector.constant.WithdrawalEventType;
import dev.vality.fraudbusters.mg.connector.converter.FistfulAccountToDomainAccountConverter;
import dev.vality.fraudbusters.mg.connector.converter.FistfulCashToDomainCashConverter;
import dev.vality.fraudbusters.mg.connector.converter.FistfulResourceToDomainResourceConverter;
import dev.vality.fraudbusters.mg.connector.mapper.Mapper;
import dev.vality.fraudbusters.mg.connector.service.DestinationClientService;
import dev.vality.fraudbusters.mg.connector.service.WalletClientService;
import dev.vality.fraudbusters.mg.connector.service.WithdrawalClientService;
import dev.vality.fraudbusters.mg.connector.utils.WithdrawalModelUtil;
import dev.vality.geck.common.util.TBaseUtil;
import dev.vality.machinegun.eventsink.MachineEvent;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

View File

@ -1,12 +1,12 @@
package com.rbkmoney.fraudbusters.mg.connector.mapper.initializer;
package dev.vality.fraudbusters.mg.connector.mapper.initializer;
import com.rbkmoney.damsel.domain.*;
import com.rbkmoney.damsel.fraudbusters.*;
import com.rbkmoney.damsel.fraudbusters.ClientInfo;
import com.rbkmoney.damsel.fraudbusters.Error;
import com.rbkmoney.damsel.payment_processing.InvoicePayment;
import com.rbkmoney.damsel.payment_processing.InvoicePaymentStatusChanged;
import com.rbkmoney.geck.serializer.kit.tbase.TErrorUtil;
import dev.vality.damsel.domain.*;
import dev.vality.damsel.fraudbusters.*;
import dev.vality.damsel.fraudbusters.ClientInfo;
import dev.vality.damsel.fraudbusters.Error;
import dev.vality.damsel.payment_processing.InvoicePayment;
import dev.vality.damsel.payment_processing.InvoicePaymentStatusChanged;
import dev.vality.geck.serializer.kit.tbase.TErrorUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.lang.NonNull;
import org.springframework.stereotype.Component;
@ -91,7 +91,7 @@ public class GeneralInfoInitiator implements InfoInitializer<InvoicePaymentStatu
return null;
}
public ReferenceInfo initReferenceInfo(com.rbkmoney.damsel.domain.Invoice invoice) {
public ReferenceInfo initReferenceInfo(Invoice invoice) {
return ReferenceInfo.merchant_info(new MerchantInfo()
.setPartyId(invoice.getOwnerId())
.setShopId(invoice.getShopId())

View File

@ -0,0 +1,26 @@
package dev.vality.fraudbusters.mg.connector.mapper.initializer;
import dev.vality.damsel.domain.Invoice;
import dev.vality.damsel.domain.Payer;
import dev.vality.damsel.domain.PaymentTool;
import dev.vality.damsel.fraudbusters.ClientInfo;
import dev.vality.damsel.fraudbusters.Error;
import dev.vality.damsel.fraudbusters.ProviderInfo;
import dev.vality.damsel.fraudbusters.ReferenceInfo;
import dev.vality.damsel.payment_processing.InvoicePayment;
public interface InfoInitializer<T> {
Error initError(T t);
ClientInfo initClientInfo(Payer payer);
void initContactInfo(ClientInfo clientInfo, Payer payer);
ProviderInfo initProviderInfo(InvoicePayment invoicePayment);
ReferenceInfo initReferenceInfo(Invoice invoice);
PaymentTool initPaymentTool(Payer payer);
}

View File

@ -1,13 +1,13 @@
package com.rbkmoney.fraudbusters.mg.connector.mapper.initializer;
package dev.vality.fraudbusters.mg.connector.mapper.initializer;
import com.rbkmoney.damsel.domain.*;
import com.rbkmoney.damsel.fraudbusters.ClientInfo;
import com.rbkmoney.damsel.fraudbusters.Error;
import com.rbkmoney.damsel.fraudbusters.ProviderInfo;
import com.rbkmoney.damsel.fraudbusters.ReferenceInfo;
import com.rbkmoney.damsel.payment_processing.InvoicePayment;
import com.rbkmoney.damsel.payment_processing.InvoicePaymentRefundStatusChanged;
import com.rbkmoney.geck.serializer.kit.tbase.TErrorUtil;
import dev.vality.damsel.domain.*;
import dev.vality.damsel.fraudbusters.ClientInfo;
import dev.vality.damsel.fraudbusters.Error;
import dev.vality.damsel.fraudbusters.ProviderInfo;
import dev.vality.damsel.fraudbusters.ReferenceInfo;
import dev.vality.damsel.payment_processing.InvoicePayment;
import dev.vality.damsel.payment_processing.InvoicePaymentRefundStatusChanged;
import dev.vality.geck.serializer.kit.tbase.TErrorUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.lang.NonNull;

View File

@ -0,0 +1,9 @@
package dev.vality.fraudbusters.mg.connector.parser;
import dev.vality.machinegun.eventsink.MachineEvent;
public interface EventParser<T> {
T parseEvent(MachineEvent message);
}

View File

@ -1,8 +1,8 @@
package com.rbkmoney.fraudbusters.mg.connector.parser;
package dev.vality.fraudbusters.mg.connector.parser;
import com.rbkmoney.damsel.payment_processing.EventPayload;
import com.rbkmoney.fraudbusters.mg.connector.converter.BinaryConverter;
import com.rbkmoney.machinegun.eventsink.MachineEvent;
import dev.vality.damsel.payment_processing.EventPayload;
import dev.vality.fraudbusters.mg.connector.converter.BinaryConverter;
import dev.vality.machinegun.eventsink.MachineEvent;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

View File

@ -1,8 +1,8 @@
package com.rbkmoney.fraudbusters.mg.connector.parser;
package dev.vality.fraudbusters.mg.connector.parser;
import dev.vality.fistful.withdrawal.TimestampedChange;
import com.rbkmoney.fraudbusters.mg.connector.converter.BinaryConverter;
import com.rbkmoney.machinegun.eventsink.MachineEvent;
import dev.vality.fraudbusters.mg.connector.converter.BinaryConverter;
import dev.vality.machinegun.eventsink.MachineEvent;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

View File

@ -1,6 +1,6 @@
package com.rbkmoney.fraudbusters.mg.connector.pool;
package dev.vality.fraudbusters.mg.connector.pool;
import com.rbkmoney.fraudbusters.mg.connector.constant.StreamType;
import dev.vality.fraudbusters.mg.connector.constant.StreamType;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.streams.KafkaStreams;
import org.springframework.beans.factory.annotation.Value;

View File

@ -1,9 +1,9 @@
package com.rbkmoney.fraudbusters.mg.connector.serde;
package dev.vality.fraudbusters.mg.connector.serde;
import com.rbkmoney.damsel.fraudbusters.Chargeback;
import com.rbkmoney.fraudbusters.mg.connector.serde.deserializer.ChargebackDeserializer;
import com.rbkmoney.kafka.common.serialization.ThriftSerializer;
import dev.vality.damsel.fraudbusters.Chargeback;
import dev.vality.fraudbusters.mg.connector.serde.deserializer.ChargebackDeserializer;
import dev.vality.kafka.common.serialization.ThriftSerializer;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.common.serialization.Deserializer;
import org.apache.kafka.common.serialization.Serde;

View File

@ -1,9 +1,9 @@
package com.rbkmoney.fraudbusters.mg.connector.serde;
package dev.vality.fraudbusters.mg.connector.serde;
import com.rbkmoney.fraudbusters.mg.connector.serde.deserializer.MachineEventDeserializer;
import com.rbkmoney.kafka.common.serialization.ThriftSerializer;
import com.rbkmoney.machinegun.eventsink.MachineEvent;
import dev.vality.fraudbusters.mg.connector.serde.deserializer.MachineEventDeserializer;
import dev.vality.kafka.common.serialization.ThriftSerializer;
import dev.vality.machinegun.eventsink.MachineEvent;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.common.serialization.Deserializer;
import org.apache.kafka.common.serialization.Serde;

View File

@ -1,9 +1,9 @@
package com.rbkmoney.fraudbusters.mg.connector.serde;
package dev.vality.fraudbusters.mg.connector.serde;
import com.rbkmoney.damsel.fraudbusters.Payment;
import com.rbkmoney.fraudbusters.mg.connector.serde.deserializer.PaymentDeserializer;
import com.rbkmoney.kafka.common.serialization.ThriftSerializer;
import dev.vality.damsel.fraudbusters.Payment;
import dev.vality.fraudbusters.mg.connector.serde.deserializer.PaymentDeserializer;
import dev.vality.kafka.common.serialization.ThriftSerializer;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.common.serialization.Deserializer;
import org.apache.kafka.common.serialization.Serde;

View File

@ -1,9 +1,9 @@
package com.rbkmoney.fraudbusters.mg.connector.serde;
package dev.vality.fraudbusters.mg.connector.serde;
import com.rbkmoney.damsel.fraudbusters.Refund;
import com.rbkmoney.fraudbusters.mg.connector.serde.deserializer.RefundDeserializer;
import com.rbkmoney.kafka.common.serialization.ThriftSerializer;
import dev.vality.damsel.fraudbusters.Refund;
import dev.vality.fraudbusters.mg.connector.serde.deserializer.RefundDeserializer;
import dev.vality.kafka.common.serialization.ThriftSerializer;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.common.serialization.Deserializer;
import org.apache.kafka.common.serialization.Serde;

View File

@ -1,9 +1,9 @@
package com.rbkmoney.fraudbusters.mg.connector.serde;
package dev.vality.fraudbusters.mg.connector.serde;
import com.rbkmoney.damsel.fraudbusters.Withdrawal;
import com.rbkmoney.fraudbusters.mg.connector.serde.deserializer.WithdrawalDeserializer;
import com.rbkmoney.kafka.common.serialization.ThriftSerializer;
import dev.vality.damsel.fraudbusters.Withdrawal;
import dev.vality.fraudbusters.mg.connector.serde.deserializer.WithdrawalDeserializer;
import dev.vality.kafka.common.serialization.ThriftSerializer;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.common.serialization.Deserializer;
import org.apache.kafka.common.serialization.Serde;

View File

@ -1,7 +1,7 @@
package com.rbkmoney.fraudbusters.mg.connector.serde.deserializer;
package dev.vality.fraudbusters.mg.connector.serde.deserializer;
import com.rbkmoney.damsel.fraudbusters.Chargeback;
import com.rbkmoney.kafka.common.serialization.AbstractThriftDeserializer;
import dev.vality.damsel.fraudbusters.Chargeback;
import dev.vality.kafka.common.serialization.AbstractThriftDeserializer;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.common.serialization.Deserializer;
import org.apache.thrift.TDeserializer;

View File

@ -1,23 +1,22 @@
package com.rbkmoney.fraudbusters.mg.connector.serde.deserializer;
package dev.vality.fraudbusters.mg.connector.serde.deserializer;
import com.rbkmoney.machinegun.eventsink.MachineEvent;
import com.rbkmoney.machinegun.eventsink.SinkEvent;
import dev.vality.fraudbusters.mg.connector.utils.DeserializerUtils;
import dev.vality.machinegun.eventsink.MachineEvent;
import dev.vality.machinegun.eventsink.SinkEvent;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.common.serialization.Deserializer;
import org.apache.thrift.TDeserializer;
import org.apache.thrift.protocol.TBinaryProtocol;
import java.util.Map;
@Slf4j
public class MachineEventDeserializer implements Deserializer<MachineEvent> {
ThreadLocal<TDeserializer> thriftDeserializerThreadLocal =
ThreadLocal.withInitial(() -> new TDeserializer(new TBinaryProtocol.Factory()));
private ThreadLocal<TDeserializer> threadLocalDeserializer =
ThreadLocal.withInitial(DeserializerUtils::createDeserializer);
@Override
public void configure(Map<String, ?> configs, boolean isKey) {
}
@Override
@ -25,7 +24,7 @@ public class MachineEventDeserializer implements Deserializer<MachineEvent> {
log.debug("Message, topic: {}, byteLength: {}", topic, data.length);
SinkEvent machineEvent = new SinkEvent();
try {
thriftDeserializerThreadLocal.get().deserialize(machineEvent, data);
threadLocalDeserializer.get().deserialize(machineEvent, data);
} catch (Exception e) {
log.error("Error when deserialize ruleTemplate data: {} ", data, e);
}
@ -34,7 +33,7 @@ public class MachineEventDeserializer implements Deserializer<MachineEvent> {
@Override
public void close() {
thriftDeserializerThreadLocal.remove();
threadLocalDeserializer.remove();
}
}

View File

@ -1,7 +1,7 @@
package com.rbkmoney.fraudbusters.mg.connector.serde.deserializer;
package dev.vality.fraudbusters.mg.connector.serde.deserializer;
import com.rbkmoney.damsel.fraudbusters.Payment;
import com.rbkmoney.kafka.common.serialization.AbstractThriftDeserializer;
import dev.vality.damsel.fraudbusters.Payment;
import dev.vality.kafka.common.serialization.AbstractThriftDeserializer;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.common.serialization.Deserializer;
import org.apache.thrift.TDeserializer;

View File

@ -1,7 +1,7 @@
package com.rbkmoney.fraudbusters.mg.connector.serde.deserializer;
package dev.vality.fraudbusters.mg.connector.serde.deserializer;
import com.rbkmoney.damsel.fraudbusters.Refund;
import com.rbkmoney.kafka.common.serialization.AbstractThriftDeserializer;
import dev.vality.damsel.fraudbusters.Refund;
import dev.vality.kafka.common.serialization.AbstractThriftDeserializer;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.common.serialization.Deserializer;
import org.apache.thrift.TDeserializer;

View File

@ -1,7 +1,7 @@
package com.rbkmoney.fraudbusters.mg.connector.serde.deserializer;
package dev.vality.fraudbusters.mg.connector.serde.deserializer;
import com.rbkmoney.damsel.fraudbusters.Withdrawal;
import com.rbkmoney.kafka.common.serialization.AbstractThriftDeserializer;
import dev.vality.damsel.fraudbusters.Withdrawal;
import dev.vality.kafka.common.serialization.AbstractThriftDeserializer;
import lombok.extern.slf4j.Slf4j;
@Slf4j

View File

@ -1,11 +1,11 @@
package com.rbkmoney.fraudbusters.mg.connector.service;
package dev.vality.fraudbusters.mg.connector.service;
import dev.vality.fistful.base.EventRange;
import dev.vality.fistful.destination.DestinationState;
import dev.vality.fistful.destination.ManagementSrv;
import com.rbkmoney.fraudbusters.mg.connector.exception.PaymentInfoNotFoundException;
import com.rbkmoney.fraudbusters.mg.connector.exception.PaymentInfoRequestException;
import dev.vality.fraudbusters.mg.connector.exception.PaymentInfoNotFoundException;
import dev.vality.fraudbusters.mg.connector.exception.PaymentInfoRequestException;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.thrift.TException;

View File

@ -1,15 +1,13 @@
package com.rbkmoney.fraudbusters.mg.connector.service;
package dev.vality.fraudbusters.mg.connector.service;
import com.rbkmoney.damsel.payment_processing.*;
import com.rbkmoney.fraudbusters.mg.connector.domain.InvoicePaymentWrapper;
import com.rbkmoney.fraudbusters.mg.connector.exception.PaymentInfoNotFoundException;
import com.rbkmoney.fraudbusters.mg.connector.factory.EventRangeFactory;
import com.rbkmoney.woody.api.flow.error.WUnavailableResultException;
import dev.vality.damsel.payment_processing.*;
import dev.vality.fraudbusters.mg.connector.domain.InvoicePaymentWrapper;
import dev.vality.fraudbusters.mg.connector.exception.PaymentInfoNotFoundException;
import dev.vality.fraudbusters.mg.connector.factory.EventRangeFactory;
import dev.vality.woody.api.flow.error.WUnavailableResultException;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.connect.errors.RetriableException;
import org.apache.thrift.TApplicationException;
import org.apache.kafka.common.errors.NetworkException;
import org.apache.thrift.TException;
import org.springframework.stereotype.Service;
@ -64,7 +62,7 @@ public class HgClientService {
} catch (WUnavailableResultException | TException e) {
log.error("Error when HgClientService getInvoiceInfo invoiceId: {} eventId: {} sequenceId: {} e: ",
invoiceId, eventId, sequenceId, e);
throw new RetriableException(e);
throw new NetworkException(e);
}
}
}

View File

@ -1,11 +1,11 @@
package com.rbkmoney.fraudbusters.mg.connector.service;
package dev.vality.fraudbusters.mg.connector.service;
import dev.vality.fistful.base.EventRange;
import dev.vality.fistful.wallet.ManagementSrv;
import dev.vality.fistful.wallet.WalletState;
import com.rbkmoney.fraudbusters.mg.connector.exception.PaymentInfoNotFoundException;
import com.rbkmoney.fraudbusters.mg.connector.exception.PaymentInfoRequestException;
import dev.vality.fraudbusters.mg.connector.exception.PaymentInfoNotFoundException;
import dev.vality.fraudbusters.mg.connector.exception.PaymentInfoRequestException;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.thrift.TException;

View File

@ -1,11 +1,11 @@
package com.rbkmoney.fraudbusters.mg.connector.service;
package dev.vality.fraudbusters.mg.connector.service;
import dev.vality.fistful.withdrawal.ManagementSrv;
import dev.vality.fistful.withdrawal.WithdrawalState;
import com.rbkmoney.fraudbusters.mg.connector.exception.PaymentInfoNotFoundException;
import com.rbkmoney.fraudbusters.mg.connector.exception.PaymentInfoRequestException;
import com.rbkmoney.fraudbusters.mg.connector.factory.FistfulEventRangeFactory;
import dev.vality.fraudbusters.mg.connector.exception.PaymentInfoNotFoundException;
import dev.vality.fraudbusters.mg.connector.exception.PaymentInfoRequestException;
import dev.vality.fraudbusters.mg.connector.factory.FistfulEventRangeFactory;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.thrift.TException;

View File

@ -0,0 +1,21 @@
package dev.vality.fraudbusters.mg.connector.utils;
import dev.vality.kafka.common.exception.TransportException;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.thrift.TDeserializer;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.transport.TTransportException;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class DeserializerUtils {
public static TDeserializer createDeserializer() {
try {
return new TDeserializer(new TBinaryProtocol.Factory());
} catch (TTransportException ex) {
throw new TransportException(ex);
}
}
}

View File

@ -1,4 +1,4 @@
package com.rbkmoney.fraudbusters.mg.connector.utils;
package dev.vality.fraudbusters.mg.connector.utils;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.SpringApplication;

View File

@ -1,14 +1,14 @@
package com.rbkmoney.fraudbusters.mg.connector.utils;
package dev.vality.fraudbusters.mg.connector.utils;
import com.rbkmoney.damsel.fraudbusters.Error;
import com.rbkmoney.damsel.fraudbusters.ProviderInfo;
import dev.vality.damsel.fraudbusters.Error;
import dev.vality.damsel.fraudbusters.ProviderInfo;
import dev.vality.fistful.base.Failure;
import dev.vality.fistful.destination.DestinationState;
import dev.vality.fistful.withdrawal.StatusChange;
import dev.vality.fistful.withdrawal.WithdrawalState;
import dev.vality.fistful.withdrawal.status.Failed;
import com.rbkmoney.geck.serializer.kit.tbase.TBaseProcessor;
import com.rbkmoney.geck.serializer.kit.tbase.TDomainToStringErrorHandler;
import dev.vality.geck.serializer.kit.tbase.TBaseProcessor;
import dev.vality.geck.serializer.kit.tbase.TDomainToStringErrorHandler;
import lombok.extern.slf4j.Slf4j;
import java.io.IOException;

View File

@ -17,7 +17,7 @@ management:
health:
show-details: always
metrics:
enabled: true
enabled: false
prometheus:
enabled: true
endpoints:

View File

@ -1,22 +1,22 @@
package com.rbkmoney.fraudbusters.mg.connector;
package dev.vality.fraudbusters.mg.connector;
import com.rbkmoney.damsel.domain.*;
import com.rbkmoney.damsel.fraudbusters.Payment;
import com.rbkmoney.damsel.payment_processing.Invoice;
import com.rbkmoney.damsel.payment_processing.InvoicingSrv;
import dev.vality.damsel.domain.*;
import dev.vality.damsel.fraudbusters.Payment;
import dev.vality.damsel.payment_processing.Invoice;
import dev.vality.damsel.payment_processing.InvoicingSrv;
import dev.vality.fistful.withdrawal.ManagementSrv;
import dev.vality.fistful.withdrawal.WithdrawalState;
import com.rbkmoney.fraudbusters.mg.connector.factory.EventRangeFactory;
import com.rbkmoney.fraudbusters.mg.connector.mapper.impl.WithdrawalBeanUtils;
import com.rbkmoney.fraudbusters.mg.connector.serde.deserializer.ChargebackDeserializer;
import com.rbkmoney.fraudbusters.mg.connector.serde.deserializer.PaymentDeserializer;
import com.rbkmoney.fraudbusters.mg.connector.serde.deserializer.RefundDeserializer;
import com.rbkmoney.fraudbusters.mg.connector.serde.deserializer.WithdrawalDeserializer;
import com.rbkmoney.fraudbusters.mg.connector.service.HgClientService;
import com.rbkmoney.fraudbusters.mg.connector.utils.BuildUtils;
import com.rbkmoney.fraudbusters.mg.connector.utils.MgEventSinkFlowGenerator;
import com.rbkmoney.fraudbusters.mg.connector.utils.WithdrawalFlowGenerator;
import com.rbkmoney.machinegun.eventsink.SinkEvent;
import dev.vality.fraudbusters.mg.connector.factory.EventRangeFactory;
import dev.vality.fraudbusters.mg.connector.mapper.impl.WithdrawalBeanUtils;
import dev.vality.fraudbusters.mg.connector.serde.deserializer.ChargebackDeserializer;
import dev.vality.fraudbusters.mg.connector.serde.deserializer.PaymentDeserializer;
import dev.vality.fraudbusters.mg.connector.serde.deserializer.RefundDeserializer;
import dev.vality.fraudbusters.mg.connector.serde.deserializer.WithdrawalDeserializer;
import dev.vality.fraudbusters.mg.connector.service.HgClientService;
import dev.vality.fraudbusters.mg.connector.utils.BuildUtils;
import dev.vality.fraudbusters.mg.connector.utils.MgEventSinkFlowGenerator;
import dev.vality.fraudbusters.mg.connector.utils.WithdrawalFlowGenerator;
import dev.vality.machinegun.eventsink.SinkEvent;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.Consumer;
import org.apache.kafka.clients.consumer.ConsumerRecords;
@ -139,7 +139,7 @@ public class FraudbustersMgConnectorApplicationTest extends KafkaAbstractTest {
}
private void mockPaymentWithException(String sourceId) throws TException, IOException {
when(invoicingClient.get(HgClientService.USER_INFO, sourceId, eventRangeFactory.create(4)))
when(invoicingClient.get(HgClientService.USER_INFO, sourceId, eventRangeFactory.create(6)))
.thenThrow(new RuntimeException())
.thenReturn(BuildUtils.buildInvoice(MgEventSinkFlowGenerator.PARTY_ID, MgEventSinkFlowGenerator.SHOP_ID,
sourceId, "1", "1", "1",

View File

@ -1,16 +1,16 @@
package com.rbkmoney.fraudbusters.mg.connector;
package dev.vality.fraudbusters.mg.connector;
import com.rbkmoney.damsel.domain.InvoicePaid;
import com.rbkmoney.damsel.domain.InvoicePaymentProcessed;
import com.rbkmoney.damsel.domain.InvoicePaymentStatus;
import com.rbkmoney.damsel.domain.InvoiceStatus;
import com.rbkmoney.damsel.fraudbusters.Payment;
import com.rbkmoney.damsel.payment_processing.InvoicingSrv;
import com.rbkmoney.fraudbusters.mg.connector.deserializer.SinkEventDeserializer;
import com.rbkmoney.fraudbusters.mg.connector.serde.deserializer.PaymentDeserializer;
import com.rbkmoney.fraudbusters.mg.connector.utils.BuildUtils;
import com.rbkmoney.fraudbusters.mg.connector.utils.MgEventSinkFlowGenerator;
import com.rbkmoney.machinegun.eventsink.SinkEvent;
import dev.vality.damsel.domain.InvoicePaid;
import dev.vality.damsel.domain.InvoicePaymentProcessed;
import dev.vality.damsel.domain.InvoicePaymentStatus;
import dev.vality.damsel.domain.InvoiceStatus;
import dev.vality.damsel.fraudbusters.Payment;
import dev.vality.damsel.payment_processing.InvoicingSrv;
import dev.vality.fraudbusters.mg.connector.deserializer.SinkEventDeserializer;
import dev.vality.fraudbusters.mg.connector.serde.deserializer.PaymentDeserializer;
import dev.vality.fraudbusters.mg.connector.utils.BuildUtils;
import dev.vality.fraudbusters.mg.connector.utils.MgEventSinkFlowGenerator;
import dev.vality.machinegun.eventsink.SinkEvent;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.CommonClientConfigs;
import org.apache.kafka.clients.consumer.*;

View File

@ -1,9 +1,9 @@
package com.rbkmoney.fraudbusters.mg.connector;
package dev.vality.fraudbusters.mg.connector;
import com.rbkmoney.fraudbusters.mg.connector.extension.KafkaExtension;
import com.rbkmoney.fraudbusters.mg.connector.serde.deserializer.MachineEventDeserializer;
import com.rbkmoney.kafka.common.serialization.ThriftSerializer;
import com.rbkmoney.machinegun.eventsink.SinkEvent;
import dev.vality.fraudbusters.mg.connector.extension.KafkaExtension;
import dev.vality.fraudbusters.mg.connector.serde.deserializer.MachineEventDeserializer;
import dev.vality.kafka.common.serialization.ThriftSerializer;
import dev.vality.machinegun.eventsink.SinkEvent;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.Consumer;
import org.apache.kafka.clients.consumer.ConsumerConfig;

View File

@ -1,11 +1,11 @@
package com.rbkmoney.fraudbusters.mg.connector.converter;
package dev.vality.fraudbusters.mg.connector.converter;
import com.rbkmoney.damsel.fraudbusters.Resource;
import dev.vality.damsel.fraudbusters.Resource;
import dev.vality.fistful.base.ResourceBankCard;
import dev.vality.fistful.base.ResourceCryptoWallet;
import dev.vality.fistful.base.ResourceDigitalWallet;
import com.rbkmoney.fraudbusters.mg.connector.exception.UnknownResourceException;
import com.rbkmoney.fraudbusters.mg.connector.utils.BuildUtils;
import dev.vality.fraudbusters.mg.connector.exception.UnknownResourceException;
import dev.vality.fraudbusters.mg.connector.utils.BuildUtils;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -1,22 +1,21 @@
package com.rbkmoney.fraudbusters.mg.connector.deserializer;
package dev.vality.fraudbusters.mg.connector.deserializer;
import com.rbkmoney.machinegun.eventsink.SinkEvent;
import dev.vality.fraudbusters.mg.connector.utils.DeserializerUtils;
import dev.vality.machinegun.eventsink.SinkEvent;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.common.serialization.Deserializer;
import org.apache.thrift.TDeserializer;
import org.apache.thrift.protocol.TBinaryProtocol;
import java.util.Map;
@Slf4j
public class SinkEventDeserializer implements Deserializer<SinkEvent> {
ThreadLocal<TDeserializer> thriftDeserializerThreadLocal =
ThreadLocal.withInitial(() -> new TDeserializer(new TBinaryProtocol.Factory()));
private ThreadLocal<TDeserializer> threadLocalDeserializer =
ThreadLocal.withInitial(DeserializerUtils::createDeserializer);
@Override
public void configure(Map<String, ?> configs, boolean isKey) {
}
@Override
@ -24,7 +23,7 @@ public class SinkEventDeserializer implements Deserializer<SinkEvent> {
log.debug("Message, topic: {}, byteLength: {}", topic, data.length);
SinkEvent machineEvent = new SinkEvent();
try {
thriftDeserializerThreadLocal.get().deserialize(machineEvent, data);
threadLocalDeserializer.get().deserialize(machineEvent, data);
} catch (Exception e) {
log.error("Error when deserialize ruleTemplate data: {} ", data, e);
}
@ -33,7 +32,7 @@ public class SinkEventDeserializer implements Deserializer<SinkEvent> {
@Override
public void close() {
threadLocalDeserializer.remove();
}
}

View File

@ -1,4 +1,4 @@
package com.rbkmoney.fraudbusters.mg.connector.extension;
package dev.vality.fraudbusters.mg.connector.extension;
import org.junit.jupiter.api.extension.BeforeAllCallback;
import org.junit.jupiter.api.extension.ExtensionContext;

View File

@ -1,4 +1,4 @@
package com.rbkmoney.fraudbusters.mg.connector.mapper.impl;
package dev.vality.fraudbusters.mg.connector.mapper.impl;
import dev.vality.fistful.account.Account;
import dev.vality.fistful.base.*;
@ -8,7 +8,7 @@ import dev.vality.fistful.withdrawal.Change;
import dev.vality.fistful.withdrawal.StatusChange;
import dev.vality.fistful.withdrawal.TimestampedChange;
import dev.vality.fistful.withdrawal.status.Status;
import com.rbkmoney.fraudbusters.mg.connector.utils.InvoiceTestConstant;
import dev.vality.fraudbusters.mg.connector.utils.InvoiceTestConstant;
public class WithdrawalBeanUtils {

View File

@ -1,21 +1,21 @@
package com.rbkmoney.fraudbusters.mg.connector.mapper.impl;
package dev.vality.fraudbusters.mg.connector.mapper.impl;
import com.rbkmoney.damsel.fraudbusters.Withdrawal;
import com.rbkmoney.damsel.fraudbusters.WithdrawalStatus;
import dev.vality.damsel.fraudbusters.Withdrawal;
import dev.vality.damsel.fraudbusters.WithdrawalStatus;
import dev.vality.fistful.withdrawal.TimestampedChange;
import dev.vality.fistful.withdrawal.WithdrawalState;
import dev.vality.fistful.withdrawal.status.Failed;
import dev.vality.fistful.withdrawal.status.Pending;
import dev.vality.fistful.withdrawal.status.Status;
import com.rbkmoney.fraudbusters.mg.connector.converter.FistfulAccountToDomainAccountConverter;
import com.rbkmoney.fraudbusters.mg.connector.converter.FistfulCashToDomainCashConverter;
import com.rbkmoney.fraudbusters.mg.connector.converter.FistfulCurrencyToDomainCurrencyConverter;
import com.rbkmoney.fraudbusters.mg.connector.converter.FistfulResourceToDomainResourceConverter;
import com.rbkmoney.fraudbusters.mg.connector.mapper.Mapper;
import com.rbkmoney.fraudbusters.mg.connector.service.DestinationClientService;
import com.rbkmoney.fraudbusters.mg.connector.service.WalletClientService;
import com.rbkmoney.fraudbusters.mg.connector.service.WithdrawalClientService;
import com.rbkmoney.machinegun.eventsink.MachineEvent;
import dev.vality.fraudbusters.mg.connector.converter.FistfulAccountToDomainAccountConverter;
import dev.vality.fraudbusters.mg.connector.converter.FistfulCashToDomainCashConverter;
import dev.vality.fraudbusters.mg.connector.converter.FistfulCurrencyToDomainCurrencyConverter;
import dev.vality.fraudbusters.mg.connector.converter.FistfulResourceToDomainResourceConverter;
import dev.vality.fraudbusters.mg.connector.mapper.Mapper;
import dev.vality.fraudbusters.mg.connector.service.DestinationClientService;
import dev.vality.fraudbusters.mg.connector.service.WalletClientService;
import dev.vality.fraudbusters.mg.connector.service.WithdrawalClientService;
import dev.vality.machinegun.eventsink.MachineEvent;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
@ -24,7 +24,7 @@ import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import static com.rbkmoney.fraudbusters.mg.connector.mapper.impl.WithdrawalBeanUtils.*;
import static dev.vality.fraudbusters.mg.connector.mapper.impl.WithdrawalBeanUtils.*;
import static org.junit.Assert.*;
import static org.mockito.Mockito.when;

View File

@ -1,16 +1,16 @@
package com.rbkmoney.fraudbusters.mg.connector.utils;
package dev.vality.fraudbusters.mg.connector.utils;
import com.rbkmoney.damsel.base.Content;
import com.rbkmoney.damsel.domain.*;
import com.rbkmoney.damsel.payment_processing.InvoicePayment;
import com.rbkmoney.damsel.payment_processing.InvoicePaymentChargeback;
import com.rbkmoney.damsel.payment_processing.InvoiceRefundSession;
import dev.vality.damsel.base.Content;
import dev.vality.damsel.domain.*;
import dev.vality.damsel.payment_processing.InvoicePayment;
import dev.vality.damsel.payment_processing.InvoicePaymentChargeback;
import dev.vality.damsel.payment_processing.InvoiceRefundSession;
import dev.vality.fistful.base.CardType;
import dev.vality.fistful.base.Residence;
import com.rbkmoney.geck.common.util.TypeUtil;
import com.rbkmoney.geck.serializer.kit.mock.MockMode;
import com.rbkmoney.geck.serializer.kit.mock.MockTBaseProcessor;
import com.rbkmoney.geck.serializer.kit.tbase.TBaseHandler;
import dev.vality.geck.common.util.TypeUtil;
import dev.vality.geck.serializer.kit.mock.MockMode;
import dev.vality.geck.serializer.kit.mock.MockTBaseProcessor;
import dev.vality.geck.serializer.kit.tbase.TBaseHandler;
import java.io.IOException;
import java.nio.ByteBuffer;
@ -20,7 +20,7 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import static com.rbkmoney.fraudbusters.mg.connector.utils.MgEventSinkFlowGenerator.createCash;
import static dev.vality.fraudbusters.mg.connector.utils.MgEventSinkFlowGenerator.createCash;
public class BuildUtils {
@ -52,7 +52,7 @@ public class BuildUtils {
return digitalWallet;
}
public static com.rbkmoney.damsel.payment_processing.Invoice buildInvoice(
public static dev.vality.damsel.payment_processing.Invoice buildInvoice(
String partyId,
String shopId,
String invoiceId,
@ -62,7 +62,7 @@ public class BuildUtils {
InvoiceStatus invoiceStatus,
InvoicePaymentStatus paymentStatus) throws IOException {
MockTBaseProcessor thriftBaseProcessor = new MockTBaseProcessor(MockMode.RANDOM, 15, 1);
com.rbkmoney.damsel.payment_processing.Invoice invoice = new com.rbkmoney.damsel.payment_processing.Invoice()
dev.vality.damsel.payment_processing.Invoice invoice = new dev.vality.damsel.payment_processing.Invoice()
.setInvoice(buildInvoice(partyId, shopId, invoiceId, invoiceStatus, thriftBaseProcessor))
.setPayments(buildPayments(partyId, shopId, paymentId, refundId, chargebackId, paymentStatus,
thriftBaseProcessor));
@ -336,15 +336,15 @@ public class BuildUtils {
.setAmount(amount));
}
private static com.rbkmoney.damsel.domain.InvoicePayment buildPayment(
private static dev.vality.damsel.domain.InvoicePayment buildPayment(
String partyId,
String shopId,
String paymentId,
InvoicePaymentStatus paymentStatus,
MockTBaseProcessor thriftBaseProcessor) throws IOException {
return thriftBaseProcessor.process(
new com.rbkmoney.damsel.domain.InvoicePayment(),
new TBaseHandler<>(com.rbkmoney.damsel.domain.InvoicePayment.class))
new dev.vality.damsel.domain.InvoicePayment(),
new TBaseHandler<>(dev.vality.damsel.domain.InvoicePayment.class))
.setCreatedAt("2016-03-22T06:12:27Z")
.setId(paymentId)
.setOwnerId(partyId)
@ -355,11 +355,11 @@ public class BuildUtils {
.setStatus(paymentStatus);
}
private static List<com.rbkmoney.damsel.payment_processing.InvoicePaymentRefund> buildRefunds(
private static List<dev.vality.damsel.payment_processing.InvoicePaymentRefund> buildRefunds(
String refundId,
MockTBaseProcessor thriftBaseProcessor) throws IOException {
com.rbkmoney.damsel.payment_processing.InvoicePaymentRefund invoicePaymentRefund =
new com.rbkmoney.damsel.payment_processing.InvoicePaymentRefund(
dev.vality.damsel.payment_processing.InvoicePaymentRefund invoicePaymentRefund =
new dev.vality.damsel.payment_processing.InvoicePaymentRefund(
buildRefund(refundId, thriftBaseProcessor),
Collections.singletonList(new InvoiceRefundSession().setTransactionInfo(getTransactionInfo())));
invoicePaymentRefund.setCashFlow(createCashFlow(123L, 100L));
@ -382,7 +382,7 @@ public class BuildUtils {
return thriftBaseProcessor.process(
new InvoicePaymentChargeback(),
new TBaseHandler<>(InvoicePaymentChargeback.class))
.setChargeback(new com.rbkmoney.damsel.domain.InvoicePaymentChargeback()
.setChargeback(new dev.vality.damsel.domain.InvoicePaymentChargeback()
.setCreatedAt(TypeUtil.temporalToString(Instant.now()))
.setId(chargebackId)
.setReason(new InvoicePaymentChargebackReason()

View File

@ -1,4 +1,4 @@
package com.rbkmoney.fraudbusters.mg.connector.utils;
package dev.vality.fraudbusters.mg.connector.utils;
import dev.vality.fistful.base.CardType;
import dev.vality.fistful.base.LegacyBankCardPaymentSystem;

View File

@ -1,19 +1,20 @@
package com.rbkmoney.fraudbusters.mg.connector.utils;
package dev.vality.fraudbusters.mg.connector.utils;
import com.rbkmoney.damsel.base.Content;
import com.rbkmoney.damsel.domain.*;
import com.rbkmoney.damsel.domain.InvoicePaymentChargeback;
import com.rbkmoney.damsel.domain.InvoicePaymentChargebackPending;
import com.rbkmoney.damsel.domain.InvoicePaymentPending;
import com.rbkmoney.damsel.domain.InvoicePaymentRefund;
import com.rbkmoney.damsel.domain.InvoicePaymentRefundPending;
import com.rbkmoney.damsel.payment_processing.*;
import com.rbkmoney.geck.common.util.TypeUtil;
import com.rbkmoney.kafka.common.serialization.ThriftSerializer;
import com.rbkmoney.machinegun.eventsink.MachineEvent;
import com.rbkmoney.machinegun.eventsink.SinkEvent;
import com.rbkmoney.machinegun.msgpack.Value;
import dev.vality.damsel.base.Content;
import dev.vality.damsel.domain.Invoice;
import dev.vality.damsel.domain.InvoicePayment;
import dev.vality.damsel.domain.InvoicePaymentChargeback;
import dev.vality.damsel.domain.InvoicePaymentChargebackPending;
import dev.vality.damsel.domain.InvoicePaymentPending;
import dev.vality.damsel.domain.InvoicePaymentRefund;
import dev.vality.damsel.domain.InvoicePaymentRefundPending;
import dev.vality.damsel.domain.*;
import dev.vality.damsel.payment_processing.*;
import dev.vality.geck.common.util.TypeUtil;
import dev.vality.kafka.common.serialization.ThriftSerializer;
import dev.vality.machinegun.eventsink.MachineEvent;
import dev.vality.machinegun.eventsink.SinkEvent;
import dev.vality.machinegun.msgpack.Value;
import java.time.Instant;
import java.util.ArrayList;
@ -248,7 +249,7 @@ public class MgEventSinkFlowGenerator {
private static InvoiceCreated createInvoiceCreate(String sourceId) {
return new InvoiceCreated()
.setInvoice(new com.rbkmoney.damsel.domain.Invoice()
.setInvoice(new Invoice()
.setId(sourceId)
.setOwnerId(PARTY_ID)
.setShopId(SHOP_ID)
@ -338,7 +339,7 @@ public class MgEventSinkFlowGenerator {
);
invoicePaymentChangePayload.setInvoicePaymentStarted(
new InvoicePaymentStarted()
.setPayment(new com.rbkmoney.damsel.domain.InvoicePayment()
.setPayment(new InvoicePayment()
.setCost(
new Cash()
.setAmount(123L)

View File

@ -1,4 +1,4 @@
package com.rbkmoney.fraudbusters.mg.connector.utils;
package dev.vality.fraudbusters.mg.connector.utils;
import dev.vality.fistful.base.Failure;
import dev.vality.fistful.withdrawal.Change;
@ -8,11 +8,11 @@ import dev.vality.fistful.withdrawal.status.Failed;
import dev.vality.fistful.withdrawal.status.Pending;
import dev.vality.fistful.withdrawal.status.Status;
import dev.vality.fistful.withdrawal.status.Succeeded;
import com.rbkmoney.geck.common.util.TypeUtil;
import com.rbkmoney.kafka.common.serialization.ThriftSerializer;
import com.rbkmoney.machinegun.eventsink.MachineEvent;
import com.rbkmoney.machinegun.eventsink.SinkEvent;
import com.rbkmoney.machinegun.msgpack.Value;
import dev.vality.geck.common.util.TypeUtil;
import dev.vality.kafka.common.serialization.ThriftSerializer;
import dev.vality.machinegun.eventsink.MachineEvent;
import dev.vality.machinegun.eventsink.SinkEvent;
import dev.vality.machinegun.msgpack.Value;
import java.time.Instant;
import java.util.ArrayList;

View File

@ -6,5 +6,5 @@
<root level="warn">
<appender-ref ref="CONSOLE"/>
</root>
<logger name="com.rbkmoney" level="ALL"/>
<logger name="dev.vality" level="ALL"/>
</configuration>