dev.vality

This commit is contained in:
Anatoly Karlov 2022-02-23 18:18:41 +07:00
parent 01428f65ee
commit 840792443e
269 changed files with 1776 additions and 3300 deletions

15
.github/workflows/basic-linters.yml vendored Normal file
View File

@ -0,0 +1,15 @@
name: Vality basic linters
on:
pull_request:
branches:
- master
- main
push:
branches:
- master
- main
jobs:
lint:
uses: valitydev/base-workflows/.github/workflows/basic-linters.yml@v1

10
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,10 @@
name: Maven Build Artifact
on:
pull_request:
branches:
- '*'
jobs:
build:
uses: valitydev/java-workflow/.github/workflows/maven-service-build.yml@v1

18
.github/workflows/deploy.yml vendored Normal file
View File

@ -0,0 +1,18 @@
name: Maven Deploy Artifact
on:
push:
branches:
- 'master'
- 'main'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
deploy:
uses: valitydev/java-workflow/.github/workflows/maven-service-deploy.yml@v1
secrets:
github-token: ${{ secrets.GITHUB_TOKEN }}
mm-webhook-url: ${{ secrets.MATTERMOST_WEBHOOK_URL }}

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

17
Jenkinsfile vendored
View File

@ -1,17 +0,0 @@
#!groovy
build('magista', '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"'
def registry = 'dr2.rbkmoney.com'
def registryCredsId = 'jenkins_harbor'
javaServicePipeline(serviceName, mvnArgs)
}

View File

@ -173,4 +173,4 @@
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
END OF TERMS AND CONDITIONS

View File

@ -221,7 +221,8 @@
##### `shop_accounting_report`
Отчет по магазинам. Представляет из себя данные по магазинам мерчантов в разрезе за определенный период. Более подробная информация есть [здесь](https://github.com/rbkmoney/reporter/blob/master/docs/accounting_report.md).
Отчет по магазинам. Представляет из себя данные по магазинам мерчантов в разрезе за определенный период. Более подробная
информация есть reporter/blob/master/docs/accounting_report.md
Параметры:
- `from_time` - начало временного интервала выборки(inclusive).
- `to_time` - конец временного интервала выборки(exclusive).

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

View File

@ -1,10 +0,0 @@
version: '2.3'
services:
postgresql:
image: postgres:12
ports:
- 5432:5432
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: magista

View File

@ -1,70 +0,0 @@
# set env variables
# BM_POOLING_URL=http://localhost:18022/repo
# COLUMBUS_URL=http://localhost:28022/repo
# SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:35432/magista
postgres:
image: postgres:9.6
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- '35432:5432'
volumes:
- ./init-db.sh:/docker-entrypoint-initdb.d/init-db.sh
bustermaze:
image: dr.rbkmoney.com/rbkmoney/bustermaze:d4f3a74350c3fb5919036036917707cecb2bcfb0
ports:
- '18022:8022'
links:
- hgmock
- postgres
entrypoint:
- java
- -jar
- /opt/bustermaze/bustermaze.jar
- --hg.pooling.url=http://hgmock:8022/v1/processing/eventsink
- --hg.pooling.timeout=50000
- --spring.datasource.url=jdbc:postgresql://postgres:5432/bustermaze
- --flyway.url=jdbc:postgresql://postgres:5432/bustermaze
- --logging.level.ROOT=warn
- --logging.level.com.rbkmoney=warn
columbus:
image: dr.rbkmoney.com/rbkmoney/columbus:0144f469ca830eaf8353876e8cf2be9bc5cd0b84
ports:
- '28022:8022'
links:
- columbus-postgres
entrypoint:
- java
- -jar
- /opt/columbus/columbus.jar
- --spring.datasource.url=jdbc:postgresql://columbus-postgres:5432/columbus
- --geo.db.file.path=file:/maxmind.mmdb
- --logging.level.ROOT=warn
- --logging.level.com.rbkmoney=warn
columbus-postgres:
image: dr.rbkmoney.com/rbkmoney/postgres-geodata:8b8df081f3f23c10079e9a41b13ce7ca2f39cd3c
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: columbus
entrypoint:
- /docker-entrypoint.sh
- postgres
hgmock:
image: dr.rbkmoney.com/rbkmoney/hgmock:e0ac94e756523a1e6af14bf4b492261fd48acaac
entrypoint:
- java
- -jar
- /opt/hg-mock/hg-mock.jar
- --hg.event.total.amount=0
- --hg.event.include.notsent=true
- --logging.level.ROOT=warn
- --logging.level.com.rbkmoney=warn

View File

@ -1,7 +0,0 @@
#!/bin/bash
set -e
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL
CREATE DATABASE magista;
CREATE DATABASE bustermaze;
EOSQL

75
pom.xml
View File

@ -3,20 +3,23 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<description>Magista service (event statistics)</description>
<parent>
<groupId>com.rbkmoney</groupId>
<groupId>dev.vality</groupId>
<artifactId>service-parent-pom</artifactId>
<version>2.0.11</version>
<version>1.0.11</version>
</parent>
<groupId>com.rbkmoney.magista</groupId>
<artifactId>magista</artifactId>
<version>3.0.0-SNAPSHOT</version>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>newway</name>
<description>Magista service (event statistics)</description>
<properties>
<checkstyle.config.suppressions.path>./src/main/resources/checkstyle/checkstyle-suppressions.xml</checkstyle.config.suppressions.path>
<checkstyle.config.suppressions.path>./src/main/resources/checkstyle/checkstyle-suppressions.xml
</checkstyle.config.suppressions.path>
<server.port>8022</server.port>
<management.port>8023</management.port>
<exposed.ports>${server.port} ${management.port}</exposed.ports>
@ -97,63 +100,57 @@
<artifactId>caffeine</artifactId>
</dependency>
<dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
<version>5.2</version>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-core</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
<!--RBK libs-->
<!-- dev.vality libs-->
<dependency>
<groupId>com.rbkmoney</groupId>
<groupId>dev.vality</groupId>
<artifactId>damsel</artifactId>
<version>1.513-fcb8e91</version>
</dependency>
<dependency>
<groupId>com.rbkmoney</groupId>
<groupId>dev.vality</groupId>
<artifactId>payout-manager-proto</artifactId>
<version>1.21-bdd9888</version>
<version>1.26-8655fef</version>
</dependency>
<dependency>
<groupId>com.rbkmoney</groupId>
<groupId>dev.vality</groupId>
<artifactId>magista-proto</artifactId>
<version>1.20-f95c236</version>
<version>1.27-787e0a5</version>
</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>mamsel</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>filter</artifactId>
</dependency>
<dependency>
<groupId>com.rbkmoney.geck</groupId>
<groupId>dev.vality.geck</groupId>
<artifactId>serializer</artifactId>
</dependency>
<dependency>
<groupId>com.rbkmoney</groupId>
<artifactId>custom-metrics-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.rbkmoney</groupId>
<groupId>dev.vality</groupId>
<artifactId>kafka-common-lib</artifactId>
</dependency>
<dependency>
<groupId>com.rbkmoney</groupId>
<artifactId>custom-actuator-endpoints</artifactId>
</dependency>
<dependency>
<groupId>com.rbkmoney</groupId>
<groupId>dev.vality</groupId>
<artifactId>machinegun-proto</artifactId>
<version>1.18-d814d69</version>
<version>1.25-4de3f11</version>
</dependency>
<!--Test libs-->
@ -168,9 +165,9 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.rbkmoney</groupId>
<groupId>dev.vality</groupId>
<artifactId>testcontainers-annotations</artifactId>
<version>1.3.0</version>
<version>1.4.0</version>
<scope>test</scope>
</dependency>
</dependencies>
@ -206,7 +203,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-remote-resources-plugin</artifactId>
<version>1.5</version>
<version>1.7.0</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.shared</groupId>
@ -216,7 +213,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>
@ -277,7 +274,7 @@
<inputSchema>${db.schema}</inputSchema>
</database>
<target>
<packageName>com.rbkmoney.magista.domain</packageName>
<packageName>dev.vality.magista.domain</packageName>
<directory>target/generated-sources/jooq</directory>
</target>
</generator>
@ -293,9 +290,9 @@
</executions>
</plugin>
<plugin>
<groupId>com.rbkmoney.maven.plugins</groupId>
<groupId>dev.vality.maven.plugins</groupId>
<artifactId>pg-embedded-plugin</artifactId>
<version>1.7</version>
<version>1.0.1</version>
<configuration>
<port>${db.port}</port>
<dbName>${db.name}</dbName>

6
renovate.json Normal file
View File

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

View File

@ -1,27 +0,0 @@
package com.rbkmoney.magista.config;
import com.rbkmoney.damsel.geo_ip.GeoIpServiceSrv;
import com.rbkmoney.woody.thrift.impl.http.THSpawnClientBuilder;
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;
/**
* Created by tolkonepiu on 29.06.16.
*/
@Configuration
public class ColumbusConfig {
@Value("${columbus.url}")
Resource resource;
@Bean
public GeoIpServiceSrv.Iface columbusClient() throws IOException {
return new THSpawnClientBuilder()
.withAddress(resource.getURI()).build(GeoIpServiceSrv.Iface.class);
}
}

View File

@ -1,15 +0,0 @@
package com.rbkmoney.magista.dao;
import com.rbkmoney.magista.dark.messiah.EnrichedStatInvoice;
import com.rbkmoney.magista.dark.messiah.PaymentSearchQuery;
import com.rbkmoney.magista.dark.messiah.RefundSearchQuery;
import java.util.List;
public interface DarkMessiahSearchDao {
List<EnrichedStatInvoice> getEnrichedPaymentInvoices(PaymentSearchQuery paymentSearchQuery);
List<EnrichedStatInvoice> getEnrichedRefundInvoices(RefundSearchQuery refundSearchQuery);
}

View File

@ -1,46 +0,0 @@
package com.rbkmoney.magista.dao.impl.mapper;
import com.rbkmoney.damsel.merch_stat.EnrichedStatInvoice;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.util.ObjectUtils;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.AbstractMap;
import java.util.List;
import java.util.Map;
import static com.rbkmoney.magista.domain.tables.PaymentData.PAYMENT_DATA;
import static com.rbkmoney.magista.domain.tables.RefundData.REFUND_DATA;
/**
* merchant OKKO-specific, in general shouldn't be touched.
*
* @author n.pospolita
*/
@Deprecated
public class DeprecatedEnrichedStatInvoiceMapper implements RowMapper<Map.Entry<Long, EnrichedStatInvoice>> {
private final DeprecatedStatInvoiceMapper statInvoiceMapper;
private final DeprecatedStatPaymentMapper statPaymentMapper;
private final DeprecatedStatRefundMapper statRefundMapper;
public DeprecatedEnrichedStatInvoiceMapper() {
statInvoiceMapper = new DeprecatedStatInvoiceMapper();
statPaymentMapper = new DeprecatedStatPaymentMapper();
statRefundMapper = new DeprecatedStatRefundMapper();
}
@Override
public Map.Entry<Long, EnrichedStatInvoice> mapRow(ResultSet resultSet, int i) throws SQLException {
return new AbstractMap.SimpleEntry<>(resultSet.getLong(PAYMENT_DATA.ID.getName()),
new EnrichedStatInvoice(
statInvoiceMapper.mapRow(resultSet, i).getValue(),
List.of(statPaymentMapper.mapRow(resultSet, i).getValue()),
ObjectUtils.isEmpty(resultSet.getString(REFUND_DATA.REFUND_ID.getName()))
? List.of() : List.of(statRefundMapper.mapRow(resultSet, i).getValue())
));
}
}

View File

@ -1,39 +0,0 @@
package com.rbkmoney.magista.dao.impl.mapper;
import com.rbkmoney.magista.dark.messiah.EnrichedStatInvoice;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.util.ObjectUtils;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import static com.rbkmoney.magista.domain.tables.RefundData.REFUND_DATA;
/**
* merchant OKKO-specific, in general shouldn't be touched.
*
* @author n.pospolita
*/
public class EnrichedStatInvoiceMapper implements RowMapper<EnrichedStatInvoice> {
private final StatInvoiceMapper statInvoiceMapper;
private final StatPaymentMapper statPaymentMapper;
private final StatRefundMapper statRefundMapper;
public EnrichedStatInvoiceMapper() {
statInvoiceMapper = new StatInvoiceMapper();
statPaymentMapper = new StatPaymentMapper();
statRefundMapper = new StatRefundMapper();
}
@Override
public EnrichedStatInvoice mapRow(ResultSet resultSet, int i) throws SQLException {
return new EnrichedStatInvoice(
statInvoiceMapper.mapRow(resultSet, i),
List.of(statPaymentMapper.mapRow(resultSet, i)),
ObjectUtils.isEmpty(resultSet.getString(REFUND_DATA.REFUND_ID.getName()))
? List.of() : List.of(statRefundMapper.mapRow(resultSet, i))
);
}
}

View File

@ -1,30 +0,0 @@
package com.rbkmoney.magista.endpoint;
import com.rbkmoney.magista.dark.messiah.DarkMessiahMerchantStatisticsServiceSrv;
import com.rbkmoney.woody.thrift.impl.http.THServiceBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.*;
import javax.servlet.annotation.WebServlet;
import java.io.IOException;
@WebServlet("/v3/dark/stat")
public class DarkMessiahStatisticsServlet extends GenericServlet {
private Servlet thriftServlet;
@Autowired
private DarkMessiahMerchantStatisticsServiceSrv.Iface requestHandler;
@Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
thriftServlet = new THServiceBuilder()
.build(DarkMessiahMerchantStatisticsServiceSrv.Iface.class, requestHandler);
}
@Override
public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
thriftServlet.service(req, res);
}
}

View File

@ -1,7 +0,0 @@
package com.rbkmoney.magista.endpoint;
import com.rbkmoney.damsel.merch_stat.DarkMessiahStatisticsSrv;
import com.rbkmoney.damsel.merch_stat.MerchantStatisticsSrv;
public interface StatisticsServletIface extends MerchantStatisticsSrv.Iface, DarkMessiahStatisticsSrv.Iface {
}

View File

@ -1,7 +0,0 @@
package com.rbkmoney.magista.event.handler;
import com.rbkmoney.payout.manager.Event;
import com.rbkmoney.payout.manager.PayoutChange;
public interface PayoutHandler extends Handler<PayoutChange, Event> {
}

View File

@ -1,8 +0,0 @@
package com.rbkmoney.magista.event.mapper;
import com.rbkmoney.damsel.payment_processing.InvoiceChange;
import com.rbkmoney.machinegun.eventsink.MachineEvent;
import com.rbkmoney.magista.domain.tables.pojos.AdjustmentData;
public interface AdjustmentMapper extends Mapper<InvoiceChange, MachineEvent, AdjustmentData> {
}

View File

@ -1,8 +0,0 @@
package com.rbkmoney.magista.event.mapper;
import com.rbkmoney.damsel.payment_processing.InvoiceChange;
import com.rbkmoney.machinegun.eventsink.MachineEvent;
import com.rbkmoney.magista.domain.tables.pojos.ChargebackData;
public interface ChargebackMapper extends Mapper<InvoiceChange, MachineEvent, ChargebackData> {
}

View File

@ -1,8 +0,0 @@
package com.rbkmoney.magista.event.mapper;
import com.rbkmoney.damsel.payment_processing.InvoiceChange;
import com.rbkmoney.machinegun.eventsink.MachineEvent;
import com.rbkmoney.magista.domain.tables.pojos.InvoiceData;
public interface InvoiceMapper extends Mapper<InvoiceChange, MachineEvent, InvoiceData> {
}

View File

@ -1,8 +0,0 @@
package com.rbkmoney.magista.event.mapper;
import com.rbkmoney.damsel.payment_processing.InvoiceTemplateChange;
import com.rbkmoney.machinegun.eventsink.MachineEvent;
import com.rbkmoney.magista.domain.tables.pojos.InvoiceTemplate;
public interface InvoiceTemplateMapper extends Mapper<InvoiceTemplateChange, MachineEvent, InvoiceTemplate> {
}

View File

@ -1,8 +0,0 @@
package com.rbkmoney.magista.event.mapper;
import com.rbkmoney.damsel.payment_processing.InvoiceChange;
import com.rbkmoney.machinegun.eventsink.MachineEvent;
import com.rbkmoney.magista.domain.tables.pojos.PaymentData;
public interface PaymentMapper extends Mapper<InvoiceChange, MachineEvent, PaymentData> {
}

View File

@ -1,8 +0,0 @@
package com.rbkmoney.magista.event.mapper;
import com.rbkmoney.damsel.payment_processing.InvoiceChange;
import com.rbkmoney.machinegun.eventsink.MachineEvent;
import com.rbkmoney.magista.domain.tables.pojos.RefundData;
public interface RefundMapper extends Mapper<InvoiceChange, MachineEvent, RefundData> {
}

View File

@ -1,33 +0,0 @@
package com.rbkmoney.magista.geo;
import com.rbkmoney.damsel.geo_ip.GeoIpServiceSrv;
import com.rbkmoney.damsel.geo_ip.LocationInfo;
import com.rbkmoney.magista.provider.GeoProvider;
import com.rbkmoney.magista.provider.ProviderException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class GeoProviderImpl implements GeoProvider {
private final Logger log = LoggerFactory.getLogger(this.getClass());
private final GeoIpServiceSrv.Iface columbusClient;
@Autowired
public GeoProviderImpl(GeoIpServiceSrv.Iface columbusClient) {
this.columbusClient = columbusClient;
}
@Override
public LocationInfo getLocationInfo(String ip) throws ProviderException {
try {
return columbusClient.getLocation(ip);
} catch (Exception ex) {
log.warn("Failed to get location info, ip='{}'", ip, ex);
throw new ProviderException(ex);
}
}
}

View File

@ -1,10 +0,0 @@
package com.rbkmoney.magista.provider;
import com.rbkmoney.damsel.geo_ip.LocationInfo;
/**
* Created by tolkonepiu on 08.08.16.
*/
public interface GeoProvider {
LocationInfo getLocationInfo(String ip) throws ProviderException;
}

View File

@ -1,24 +0,0 @@
package com.rbkmoney.magista.provider;
/**
* Created by tolkonepiu on 08.08.16.
*/
public class ProviderException extends RuntimeException {
public ProviderException() {
super();
}
public ProviderException(Throwable cause) {
super(cause);
}
public ProviderException(String message) {
super(message);
}
public ProviderException(String message, Throwable cause) {
super(message, cause);
}
}

View File

@ -1,238 +0,0 @@
package com.rbkmoney.magista.query.impl;
import com.rbkmoney.damsel.merch_stat.*;
import com.rbkmoney.geck.common.util.TypeUtil;
import com.rbkmoney.magista.exception.DaoException;
import com.rbkmoney.magista.query.*;
import com.rbkmoney.magista.query.builder.QueryBuilder;
import com.rbkmoney.magista.query.builder.QueryBuilderException;
import com.rbkmoney.magista.query.impl.builder.AbstractQueryBuilder;
import com.rbkmoney.magista.query.impl.parser.AbstractQueryParser;
import com.rbkmoney.magista.query.parser.QueryParserException;
import com.rbkmoney.magista.query.parser.QueryPart;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static org.apache.http.util.TextUtils.isBlank;
/**
* merchant OKKO-specific, in general shouldn't be touched.
*
* @author n.pospolita
*/
public class EnrichedPaymentsFunction extends PagedBaseFunction<Map.Entry<Long, EnrichedStatInvoice>, StatResponse>
implements CompositeQuery<Map.Entry<Long, EnrichedStatInvoice>, StatResponse> {
public static final String FUNC_NAME = "enriched_payments";
private final CompositeQuery<QueryResult, List<QueryResult>> subquery;
private EnrichedPaymentsFunction(Object descriptor, QueryParameters params, String continuationToken,
CompositeQuery<QueryResult, List<QueryResult>> subquery) {
super(descriptor, params, FUNC_NAME, continuationToken);
this.subquery = subquery;
}
private static EnrichedPaymentsFunction createEnrichedPaymentsFunction(
Object descriptor,
QueryParameters queryParameters,
String continuationToken,
CompositeQuery<QueryResult, List<QueryResult>> subquery
) {
EnrichedPaymentsFunction paymentsFunction =
new EnrichedPaymentsFunction(descriptor, queryParameters, continuationToken, subquery);
subquery.setParentQuery(paymentsFunction);
return paymentsFunction;
}
@Override
public QueryResult<Map.Entry<Long, EnrichedStatInvoice>, StatResponse> execute(QueryContext context)
throws QueryExecutionException {
QueryResult<QueryResult, List<QueryResult>> collectedResults = subquery.execute(context);
return execute(context, collectedResults.getCollectedStream());
}
@Override
public QueryResult<Map.Entry<Long, EnrichedStatInvoice>, StatResponse> execute(
QueryContext context,
List<QueryResult> collectedResults
) throws QueryExecutionException {
QueryResult<Map.Entry<Long, EnrichedStatInvoice>, List<Map.Entry<Long, EnrichedStatInvoice>>>
enrichedInvoicesResult =
(QueryResult<Map.Entry<Long, EnrichedStatInvoice>, List<Map.Entry<Long, EnrichedStatInvoice>>>)
collectedResults.get(0);
return new BaseQueryResult<>(
enrichedInvoicesResult::getDataStream,
() -> {
StatResponseData statResponseData = StatResponseData.enriched_invoices(
enrichedInvoicesResult.getDataStream()
.map(Map.Entry::getValue)
.collect(Collectors.toList())
);
StatResponse statResponse = new StatResponse(statResponseData);
List<Map.Entry<Long, EnrichedStatInvoice>> enrichedInvoicesStats =
enrichedInvoicesResult.getCollectedStream();
if (!enrichedInvoicesResult.getCollectedStream().isEmpty()
&& getQueryParameters().getSize() == enrichedInvoicesStats.size()) {
String eventStatusChangeAt = enrichedInvoicesStats
.stream()
.map(Map.Entry::getValue)
.flatMap(enrichedStatInvoice -> enrichedStatInvoice.getPayments().stream())
.map(o -> Map.entry(this.extractEventOccuredAtTime(o), o))
.min(Map.Entry.comparingByKey())
.get()
.getKey();
String token = getContext(context)
.getTokenGenService()
.generateToken(getQueryParameters(),
TypeUtil.stringToLocalDateTime(eventStatusChangeAt));
statResponse.setContinuationToken(token);
}
return statResponse;
});
}
private String extractEventOccuredAtTime(StatPayment o) {
InvoicePaymentStatus status = o.getStatus();
String eventOccuredAt = null;
if (status.isSetFailed()) {
eventOccuredAt = status.getFailed().getAt();
} else if (status.isSetCancelled()) {
eventOccuredAt = status.getCancelled().getAt();
} else if (status.isSetCaptured()) {
eventOccuredAt = status.getCaptured().getAt();
} else if (status.isSetPending()) {
// no eventOccuredAt field
} else if (status.isSetProcessed()) {
eventOccuredAt = status.getProcessed().getAt();
} else if (status.isSetRefunded()) {
eventOccuredAt = status.getRefunded().getAt();
} else if (status.isSetChargedBack()) {
eventOccuredAt = status.getChargedBack().getAt();
}
if (!isBlank(eventOccuredAt)) {
return eventOccuredAt;
} else {
return o.getCreatedAt(); //we can't return null, return CreatedAt instead
}
}
@Override
public PaymentsFunction.PaymentsParameters getQueryParameters() {
return (PaymentsFunction.PaymentsParameters) super.getQueryParameters();
}
@Override
protected PaymentsFunction.PaymentsParameters createQueryParameters(QueryParameters parameters,
QueryParameters derivedParameters) {
return new PaymentsFunction.PaymentsParameters(parameters, derivedParameters);
}
@Override
public List<Query> getChildQueries() {
return subquery.getChildQueries();
}
@Override
public boolean isParallel() {
return subquery.isParallel();
}
public static class EnrichedPaymentsBuilder extends AbstractQueryBuilder {
private final PaymentsFunction.PaymentsValidator validator = new PaymentsFunction.PaymentsValidator();
@Override
public Query buildQuery(QueryContext queryContext, List<QueryPart> queryParts, String continuationToken,
QueryPart parentQueryPart, QueryBuilder baseBuilder) throws QueryBuilderException {
Query resultQuery = buildSingleQuery(EnrichedPaymentsParser.getMainDescriptor(), queryParts,
queryPart -> createQuery(queryPart, continuationToken));
validator.validateQuery(resultQuery, queryContext);
return resultQuery;
}
private CompositeQuery createQuery(QueryPart queryPart, String continuationToken) {
List<Query> queries = List.of(
new GetDataFunction(queryPart.getDescriptor() + ":" + GetDataFunction.FUNC_NAME,
queryPart.getParameters(), continuationToken)
);
CompositeQuery<QueryResult, List<QueryResult>> compositeQuery = createCompositeQuery(
queryPart.getDescriptor(),
getParameters(queryPart.getParent()),
queries
);
return createEnrichedPaymentsFunction(queryPart.getDescriptor(), queryPart.getParameters(),
continuationToken, compositeQuery);
}
@Override
public boolean apply(List<QueryPart> queryParts, QueryPart parent) {
return getMatchedPartsStream(EnrichedPaymentsParser.getMainDescriptor(), queryParts).findFirst()
.isPresent();
}
}
public static class EnrichedPaymentsParser extends AbstractQueryParser {
private final PaymentsFunction.PaymentsValidator validator = new PaymentsFunction.PaymentsValidator();
public static String getMainDescriptor() {
return FUNC_NAME;
}
@Override
public List<QueryPart> parseQuery(Map<String, Object> source, QueryPart parent) throws QueryParserException {
Map<String, Object> funcSource = (Map) source.get(FUNC_NAME);
PaymentsFunction.PaymentsParameters parameters =
getValidatedParameters(funcSource, parent, PaymentsFunction.PaymentsParameters::new, validator);
return Stream
.of(new QueryPart(FUNC_NAME, parameters, parent))
.collect(Collectors.toList());
}
@Override
public boolean apply(Map source, QueryPart parent) {
return parent != null
&& RootQuery.RootParser.getMainDescriptor().equals(parent.getDescriptor())
&& (source.get(FUNC_NAME) instanceof Map);
}
}
private static class GetDataFunction extends
PagedBaseFunction<Map.Entry<Long, EnrichedStatInvoice>, Collection<Map.Entry<Long, EnrichedStatInvoice>>> {
private static final String FUNC_NAME = EnrichedPaymentsFunction.FUNC_NAME + "_data";
public GetDataFunction(Object descriptor, QueryParameters params, String continuationToken) {
super(descriptor, params, FUNC_NAME, continuationToken);
}
@Override
public QueryResult<Map.Entry<Long, EnrichedStatInvoice>, Collection<Map.Entry<Long, EnrichedStatInvoice>>>
execute(QueryContext context) throws QueryExecutionException {
FunctionQueryContext functionContext = getContext(context);
PaymentsFunction.PaymentsParameters parameters =
new PaymentsFunction.PaymentsParameters(getQueryParameters(),
getQueryParameters().getDerivedParameters());
try {
Collection<Map.Entry<Long, EnrichedStatInvoice>> result =
functionContext.getSearchDao().getEnrichedInvoices(
parameters,
TypeUtil.toLocalDateTime(parameters.getFromTime()),
TypeUtil.toLocalDateTime(parameters.getToTime()),
getTime(functionContext),
parameters.getSize()
);
return new BaseQueryResult<>(result::stream, () -> result);
} catch (DaoException e) {
throw new QueryExecutionException(e);
}
}
}
}

View File

@ -1,226 +0,0 @@
package com.rbkmoney.magista.query.impl;
import com.rbkmoney.damsel.merch_stat.*;
import com.rbkmoney.geck.common.util.TypeUtil;
import com.rbkmoney.magista.exception.DaoException;
import com.rbkmoney.magista.query.*;
import com.rbkmoney.magista.query.builder.QueryBuilder;
import com.rbkmoney.magista.query.builder.QueryBuilderException;
import com.rbkmoney.magista.query.impl.builder.AbstractQueryBuilder;
import com.rbkmoney.magista.query.impl.parser.AbstractQueryParser;
import com.rbkmoney.magista.query.parser.QueryParserException;
import com.rbkmoney.magista.query.parser.QueryPart;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static org.apache.http.util.TextUtils.isBlank;
/**
* merchant OKKO-specific, in general shouldn't be touched.
*
* @author n.pospolita
*/
public class EnrichedRefundsFunction extends PagedBaseFunction<Map.Entry<Long, EnrichedStatInvoice>, StatResponse>
implements CompositeQuery<Map.Entry<Long, EnrichedStatInvoice>, StatResponse> {
public static final String FUNC_NAME = "enriched_refunds";
private final CompositeQuery<QueryResult, List<QueryResult>> subquery;
private EnrichedRefundsFunction(Object descriptor, QueryParameters params, String continuationToken,
CompositeQuery<QueryResult, List<QueryResult>> subquery) {
super(descriptor, params, FUNC_NAME, continuationToken);
this.subquery = subquery;
}
private static EnrichedRefundsFunction createEnrichedRefundsFunction(
Object descriptor,
QueryParameters queryParameters,
String continuationToken,
CompositeQuery<QueryResult, List<QueryResult>> subquery
) {
EnrichedRefundsFunction refundsFunction =
new EnrichedRefundsFunction(descriptor, queryParameters, continuationToken, subquery);
subquery.setParentQuery(refundsFunction);
return refundsFunction;
}
@Override
public QueryResult<Map.Entry<Long, EnrichedStatInvoice>, StatResponse> execute(QueryContext context)
throws QueryExecutionException {
QueryResult<QueryResult, List<QueryResult>> collectedResults = subquery.execute(context);
return execute(context, collectedResults.getCollectedStream());
}
@Override
public QueryResult<Map.Entry<Long, EnrichedStatInvoice>, StatResponse> execute(QueryContext context,
List<QueryResult> collectedResults)
throws QueryExecutionException {
QueryResult<Map.Entry<Long, EnrichedStatInvoice>, List<Map.Entry<Long, EnrichedStatInvoice>>>
enrichedInvoicesResult =
(QueryResult<Map.Entry<Long, EnrichedStatInvoice>, List<Map.Entry<Long, EnrichedStatInvoice>>>)
collectedResults.get(0);
return new BaseQueryResult<>(
enrichedInvoicesResult::getDataStream,
() -> {
StatResponseData statResponseData = StatResponseData.enriched_invoices(
enrichedInvoicesResult.getDataStream()
.map(Map.Entry::getValue)
.collect(Collectors.toList())
);
StatResponse statResponse = new StatResponse(statResponseData);
List<Map.Entry<Long, EnrichedStatInvoice>> enrichedInvoicesStats =
enrichedInvoicesResult.getCollectedStream();
if (!enrichedInvoicesResult.getCollectedStream().isEmpty()
&& getQueryParameters().getSize() == enrichedInvoicesStats.size()) {
final String eventOccuredAt = enrichedInvoicesStats
.stream()
.map(Map.Entry::getValue)
.flatMap(enrichedStatInvoice -> enrichedStatInvoice.getRefunds().stream())
.map(o -> Map.entry(this.extractEventOccuredAtTime(o), o))
.min(Map.Entry.comparingByKey())
.get()
.getKey();
final String token = getContext(context)
.getTokenGenService()
.generateToken(getQueryParameters(), TypeUtil.stringToLocalDateTime(eventOccuredAt));
statResponse.setContinuationToken(token);
}
return statResponse;
});
}
private String extractEventOccuredAtTime(StatRefund o) {
InvoicePaymentRefundStatus status = o.getStatus();
String eventOccuredAt = null;
if (status.isSetFailed()) {
eventOccuredAt = status.getFailed().getAt();
} else if (status.isSetPending()) {
// no eventOccuredAt field
} else if (status.isSetSucceeded()) {
eventOccuredAt = status.getSucceeded().getAt();
}
if (!isBlank(eventOccuredAt)) {
return eventOccuredAt;
} else {
return o.getCreatedAt(); //we can't return null, return CreatedAt instead
}
}
@Override
public RefundsFunction.RefundsParameters getQueryParameters() {
return (RefundsFunction.RefundsParameters) super.getQueryParameters();
}
@Override
protected RefundsFunction.RefundsParameters createQueryParameters(QueryParameters parameters,
QueryParameters derivedParameters) {
return new RefundsFunction.RefundsParameters(parameters, derivedParameters);
}
@Override
public List<Query> getChildQueries() {
return subquery.getChildQueries();
}
@Override
public boolean isParallel() {
return subquery.isParallel();
}
public static class EnrichedRefundsParser extends AbstractQueryParser {
private final RefundsFunction.RefundsValidator validator = new RefundsFunction.RefundsValidator();
public static String getMainDescriptor() {
return FUNC_NAME;
}
@Override
public List<QueryPart> parseQuery(Map<String, Object> source, QueryPart parent) throws QueryParserException {
Map<String, Object> funcSource = (Map) source.get(FUNC_NAME);
RefundsFunction.RefundsParameters parameters =
getValidatedParameters(funcSource, parent, RefundsFunction.RefundsParameters::new, validator);
return Stream
.of(new QueryPart(FUNC_NAME, parameters, parent))
.collect(Collectors.toList());
}
@Override
public boolean apply(Map source, QueryPart parent) {
return parent != null
&& RootQuery.RootParser.getMainDescriptor().equals(parent.getDescriptor())
&& (source.get(FUNC_NAME) instanceof Map);
}
}
public static class EnrichedRefundsBuilder extends AbstractQueryBuilder {
private final RefundsFunction.RefundsValidator validator = new RefundsFunction.RefundsValidator();
@Override
public Query buildQuery(QueryContext queryContext, List<QueryPart> queryParts, String continuationToken,
QueryPart parentQueryPart, QueryBuilder baseBuilder) throws QueryBuilderException {
Query resultQuery = buildSingleQuery(EnrichedRefundsParser.getMainDescriptor(), queryParts,
queryPart -> createQuery(queryPart, continuationToken));
validator.validateQuery(resultQuery, queryContext);
return resultQuery;
}
private CompositeQuery createQuery(QueryPart queryPart, String continuationToken) {
List<Query> queries = List.of(
new GetDataFunction(queryPart.getDescriptor() + ":" + GetDataFunction.FUNC_NAME,
queryPart.getParameters(), continuationToken)
);
CompositeQuery<QueryResult, List<QueryResult>> compositeQuery = createCompositeQuery(
queryPart.getDescriptor(),
getParameters(queryPart.getParent()),
queries
);
return createEnrichedRefundsFunction(queryPart.getDescriptor(), queryPart.getParameters(),
continuationToken, compositeQuery);
}
@Override
public boolean apply(List<QueryPart> queryParts, QueryPart parent) {
return getMatchedPartsStream(EnrichedRefundsParser.getMainDescriptor(), queryParts).findFirst().isPresent();
}
}
private static class GetDataFunction extends
PagedBaseFunction<Map.Entry<Long, EnrichedStatInvoice>, Collection<Map.Entry<Long, EnrichedStatInvoice>>> {
private static final String FUNC_NAME = EnrichedRefundsFunction.FUNC_NAME + "_data";
public GetDataFunction(Object descriptor, QueryParameters params, String continuationToken) {
super(descriptor, params, FUNC_NAME, continuationToken);
}
@Override
public QueryResult<Map.Entry<Long, EnrichedStatInvoice>, Collection<Map.Entry<Long, EnrichedStatInvoice>>>
execute(QueryContext context) throws QueryExecutionException {
FunctionQueryContext functionContext = getContext(context);
RefundsFunction.RefundsParameters parameters = new RefundsFunction.RefundsParameters(getQueryParameters(),
getQueryParameters().getDerivedParameters());
try {
Collection<Map.Entry<Long, EnrichedStatInvoice>> result =
functionContext.getSearchDao().getEnrichedInvoices(
parameters,
TypeUtil.toLocalDateTime(parameters.getFromTime()),
TypeUtil.toLocalDateTime(parameters.getToTime()),
getTime(functionContext),
parameters.getSize()
);
return new BaseQueryResult<>(result::stream, () -> result);
} catch (DaoException e) {
throw new QueryExecutionException(e);
}
}
}
}

View File

@ -1,28 +0,0 @@
package com.rbkmoney.magista.service;
import com.rbkmoney.damsel.base.InvalidRequest;
import com.rbkmoney.magista.dark.messiah.*;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.thrift.TException;
import org.springframework.stereotype.Component;
@Slf4j
@Component
@RequiredArgsConstructor
public class DarkMessiahMerchantStatisticsHandler implements DarkMessiahMerchantStatisticsServiceSrv.Iface {
private final MerchantStatisticsService merchantStatisticsService;
@Override
public StatEnrichedStatInvoiceResponse searchInvoicesByPaymentSearchQuery(PaymentSearchQuery paymentSearchQuery)
throws BadContinuationToken, LimitExceeded, InvalidRequest, TException {
return merchantStatisticsService.getEnrichedPaymentInvoices(paymentSearchQuery);
}
@Override
public StatEnrichedStatInvoiceResponse searchInvoicesByRefundSearchQuery(RefundSearchQuery refundSearchQuery)
throws BadContinuationToken, LimitExceeded, InvalidRequest, TException {
return merchantStatisticsService.getEnrichedRefundInvoices(refundSearchQuery);
}
}

View File

@ -1,31 +0,0 @@
package com.rbkmoney.magista.util;
import com.rbkmoney.magista.StatPayment;
import com.rbkmoney.magista.StatRefund;
import com.rbkmoney.magista.dark.messiah.EnrichedStatInvoice;
import java.util.List;
public class TokenUtil {
public static <T> T getLastElement(List<T> objects) {
return objects.get(objects.size() - 1);
}
public static String getEnrichedPaymentsDateTime(List<EnrichedStatInvoice> invoices) {
return invoices
.stream()
.flatMap(enrichedStatInvoice -> enrichedStatInvoice.getPayments().stream())
.map(StatPayment::getStatusChangedAt)
.min(String::compareTo)
.orElse(null);
}
public static String getEnrichedRefundsDateTime(List<EnrichedStatInvoice> invoices) {
return invoices
.stream()
.flatMap(enrichedStatInvoice -> enrichedStatInvoice.getRefunds().stream())
.map(StatRefund::getStatusChangedAt)
.min(String::compareTo)
.orElse(null);
}
}

View File

@ -1,11 +1,11 @@
package com.rbkmoney.magista;
package dev.vality.magista;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
@ServletComponentScan
@SpringBootApplication(scanBasePackages = {"com.rbkmoney.magista"})
@SpringBootApplication(scanBasePackages = {"dev.vality.magista"})
public class MagistaApplication {
public static void main(String[] args) {

View File

@ -1,8 +1,8 @@
package com.rbkmoney.magista.config;
package dev.vality.magista.config;
import com.rbkmoney.damsel.payment_processing.InvoiceTemplatingSrv;
import com.rbkmoney.damsel.payment_processing.PartyManagementSrv;
import com.rbkmoney.woody.thrift.impl.http.THSpawnClientBuilder;
import dev.vality.damsel.payment_processing.InvoiceTemplatingSrv;
import dev.vality.damsel.payment_processing.PartyManagementSrv;
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;

View File

@ -1,9 +1,9 @@
package com.rbkmoney.magista.config;
package dev.vality.magista.config;
import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;
import com.rbkmoney.magista.domain.tables.pojos.InvoiceData;
import com.rbkmoney.magista.domain.tables.pojos.PaymentData;
import dev.vality.magista.domain.tables.pojos.InvoiceData;
import dev.vality.magista.domain.tables.pojos.PaymentData;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

View File

@ -1,16 +1,16 @@
package com.rbkmoney.magista.config;
package dev.vality.magista.config;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.rbkmoney.magista.dao.DeprecatedSearchDao;
import com.rbkmoney.magista.dao.StatisticsDao;
import com.rbkmoney.magista.endpoint.StatisticsServletIface;
import com.rbkmoney.magista.query.impl.QueryContextFactoryImpl;
import com.rbkmoney.magista.query.impl.QueryProcessorImpl;
import com.rbkmoney.magista.query.impl.builder.QueryBuilderImpl;
import com.rbkmoney.magista.query.impl.parser.JsonQueryParser;
import com.rbkmoney.magista.service.DeprecatedMerchantStatisticsHandler;
import com.rbkmoney.magista.service.DeprecatedTokenGenService;
import dev.vality.magista.dao.DeprecatedSearchDao;
import dev.vality.magista.dao.StatisticsDao;
import dev.vality.magista.endpoint.StatisticsServletIface;
import dev.vality.magista.query.impl.QueryContextFactoryImpl;
import dev.vality.magista.query.impl.QueryProcessorImpl;
import dev.vality.magista.query.impl.builder.QueryBuilderImpl;
import dev.vality.magista.query.impl.parser.JsonQueryParser;
import dev.vality.magista.service.DeprecatedMerchantStatisticsHandler;
import dev.vality.magista.service.DeprecatedTokenGenService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

View File

@ -1,10 +1,10 @@
package com.rbkmoney.magista.config;
package dev.vality.magista.config;
import com.rbkmoney.machinegun.eventsink.SinkEvent;
import com.rbkmoney.magista.config.properties.KafkaSslProperties;
import com.rbkmoney.magista.serde.PayoutEventDeserializer;
import com.rbkmoney.magista.serde.SinkEventDeserializer;
import com.rbkmoney.payout.manager.Event;
import dev.vality.machinegun.eventsink.SinkEvent;
import dev.vality.magista.config.properties.KafkaSslProperties;
import dev.vality.magista.serde.PayoutEventDeserializer;
import dev.vality.magista.serde.SinkEventDeserializer;
import dev.vality.payout.manager.Event;
import org.apache.kafka.clients.CommonClientConfigs;
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.common.config.SslConfigs;

View File

@ -1,6 +1,6 @@
package com.rbkmoney.magista.config;
package dev.vality.magista.config;
import com.rbkmoney.kafka.common.retry.ConfigurableRetryPolicy;
import dev.vality.kafka.common.retry.ConfigurableRetryPolicy;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

View File

@ -1,4 +1,4 @@
package com.rbkmoney.magista.config.properties;
package dev.vality.magista.config.properties;
import lombok.Getter;
import lombok.Setter;

View File

@ -1,4 +1,4 @@
package com.rbkmoney.magista.config.properties;
package dev.vality.magista.config.properties;
import lombok.Getter;
import lombok.Setter;

View File

@ -1,4 +1,4 @@
package com.rbkmoney.magista.constant;
package dev.vality.magista.constant;
public class SearchConstant {
public static final int LIMIT = 1000;

View File

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

View File

@ -1,6 +1,7 @@
package com.rbkmoney.magista.converter;
package dev.vality.magista.converter;
import com.rbkmoney.damsel.payment_processing.EventPayload;
import dev.vality.damsel.payment_processing.EventPayload;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.thrift.TDeserializer;
import org.apache.thrift.TException;
@ -11,17 +12,21 @@ import org.springframework.stereotype.Component;
@Component
public class BinaryConverterImpl implements BinaryConverter<EventPayload> {
ThreadLocal<TDeserializer> deserializerLocal =
ThreadLocal.withInitial(() -> new TDeserializer(new TBinaryProtocol.Factory()));
ThreadLocal<TDeserializer> thriftDeserializerThreadLocal = ThreadLocal.withInitial(this::getTDeserializer);
@Override
public EventPayload convert(byte[] bin, Class<EventPayload> clazz) {
EventPayload event = new EventPayload();
try {
deserializerLocal.get().deserialize(event, bin);
thriftDeserializerThreadLocal.get().deserialize(event, bin);
} catch (TException e) {
log.error("BinaryConverterImpl e: ", e);
}
return event;
}
@SneakyThrows
private TDeserializer getTDeserializer() {
return new TDeserializer(new TBinaryProtocol.Factory());
}
}

View File

@ -1,8 +1,8 @@
package com.rbkmoney.magista.converter;
package dev.vality.magista.converter;
import com.rbkmoney.damsel.payment_processing.EventPayload;
import com.rbkmoney.machinegun.eventsink.MachineEvent;
import com.rbkmoney.magista.exception.ParseException;
import dev.vality.damsel.payment_processing.EventPayload;
import dev.vality.machinegun.eventsink.MachineEvent;
import dev.vality.magista.exception.ParseException;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

View File

@ -1,10 +1,10 @@
package com.rbkmoney.magista.converter;
package dev.vality.magista.converter;
import com.rbkmoney.damsel.domain.InvoiceTemplate;
import com.rbkmoney.damsel.payment_processing.*;
import com.rbkmoney.machinegun.eventsink.MachineEvent;
import com.rbkmoney.machinegun.msgpack.Value;
import com.rbkmoney.magista.exception.ParseException;
import dev.vality.damsel.domain.InvoiceTemplate;
import dev.vality.damsel.payment_processing.*;
import dev.vality.machinegun.eventsink.MachineEvent;
import dev.vality.machinegun.msgpack.Value;
import dev.vality.magista.exception.ParseException;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;

View File

@ -1,6 +1,6 @@
package com.rbkmoney.magista.dao;
package dev.vality.magista.dao;
import com.rbkmoney.magista.domain.tables.pojos.AdjustmentData;
import dev.vality.magista.domain.tables.pojos.AdjustmentData;
import java.util.List;

View File

@ -1,6 +1,6 @@
package com.rbkmoney.magista.dao;
package dev.vality.magista.dao;
import com.rbkmoney.magista.domain.tables.pojos.ChargebackData;
import dev.vality.magista.domain.tables.pojos.ChargebackData;
import java.util.List;

View File

@ -1,7 +1,7 @@
package com.rbkmoney.magista.dao;
package dev.vality.magista.dao;
import com.rbkmoney.damsel.merch_stat.*;
import com.rbkmoney.magista.query.impl.*;
import dev.vality.damsel.merch_stat.*;
import dev.vality.magista.query.impl.*;
import java.time.LocalDateTime;
import java.util.Collection;
@ -50,20 +50,4 @@ public interface DeprecatedSearchDao {
int limit
);
Collection<Map.Entry<Long, EnrichedStatInvoice>> getEnrichedInvoices(
RefundsFunction.RefundsParameters parameters,
LocalDateTime fromTime,
LocalDateTime toTime,
LocalDateTime whereTime,
int limit
);
Collection<Map.Entry<Long, EnrichedStatInvoice>> getEnrichedInvoices(
PaymentsFunction.PaymentsParameters parameters,
LocalDateTime fromTime,
LocalDateTime toTime,
LocalDateTime whereTime,
int limit
);
}

View File

@ -1,4 +1,4 @@
package com.rbkmoney.magista.dao;
package dev.vality.magista.dao;
import java.util.Optional;

View File

@ -1,6 +1,6 @@
package com.rbkmoney.magista.dao;
package dev.vality.magista.dao;
import com.rbkmoney.magista.domain.tables.pojos.InvoiceData;
import dev.vality.magista.domain.tables.pojos.InvoiceData;
import java.util.List;

View File

@ -1,7 +1,7 @@
package com.rbkmoney.magista.dao;
package dev.vality.magista.dao;
import com.rbkmoney.magista.domain.tables.pojos.InvoiceTemplate;
import com.rbkmoney.magista.exception.DaoException;
import dev.vality.magista.domain.tables.pojos.InvoiceTemplate;
import dev.vality.magista.exception.DaoException;
import java.util.List;

View File

@ -1,6 +1,6 @@
package com.rbkmoney.magista.dao;
package dev.vality.magista.dao;
import com.rbkmoney.magista.domain.tables.pojos.PaymentData;
import dev.vality.magista.domain.tables.pojos.PaymentData;
import java.util.List;

View File

@ -1,6 +1,6 @@
package com.rbkmoney.magista.dao;
package dev.vality.magista.dao;
import com.rbkmoney.magista.domain.tables.pojos.Payout;
import dev.vality.magista.domain.tables.pojos.Payout;
public interface PayoutDao {

View File

@ -1,6 +1,6 @@
package com.rbkmoney.magista.dao;
package dev.vality.magista.dao;
import com.rbkmoney.magista.domain.tables.pojos.RefundData;
import dev.vality.magista.domain.tables.pojos.RefundData;
import java.util.List;

View File

@ -1,10 +1,10 @@
package com.rbkmoney.magista.dao;
package dev.vality.magista.dao;
import com.rbkmoney.magista.*;
import dev.vality.magista.*;
import java.util.List;
public interface SearchDao extends DarkMessiahSearchDao {
public interface SearchDao {
List<StatInvoice> getInvoices(InvoiceSearchQuery invoiceSearchQuery);

View File

@ -1,4 +1,4 @@
package com.rbkmoney.magista.dao;
package dev.vality.magista.dao;
import java.time.LocalDateTime;
import java.util.Collection;

View File

@ -1,9 +1,9 @@
package com.rbkmoney.magista.dao.impl;
package dev.vality.magista.dao.impl;
import com.rbkmoney.magista.dao.impl.field.CollectionConditionField;
import com.rbkmoney.magista.dao.impl.field.ConditionField;
import com.rbkmoney.magista.dao.impl.field.ConditionParameterSource;
import com.rbkmoney.magista.exception.DaoException;
import dev.vality.magista.dao.impl.field.CollectionConditionField;
import dev.vality.magista.dao.impl.field.ConditionField;
import dev.vality.magista.dao.impl.field.ConditionParameterSource;
import dev.vality.magista.exception.DaoException;
import org.jooq.*;
import org.jooq.conf.ParamType;
import org.jooq.impl.DSL;

View File

@ -1,10 +1,10 @@
package com.rbkmoney.magista.dao.impl;
package dev.vality.magista.dao.impl;
import com.rbkmoney.magista.dao.AdjustmentDao;
import com.rbkmoney.magista.dao.impl.mapper.RecordRowMapper;
import com.rbkmoney.magista.domain.tables.pojos.AdjustmentData;
import com.rbkmoney.magista.domain.tables.records.AdjustmentDataRecord;
import com.rbkmoney.magista.exception.DaoException;
import dev.vality.magista.dao.AdjustmentDao;
import dev.vality.magista.dao.impl.mapper.RecordRowMapper;
import dev.vality.magista.domain.tables.pojos.AdjustmentData;
import dev.vality.magista.domain.tables.records.AdjustmentDataRecord;
import dev.vality.magista.exception.DaoException;
import org.jooq.Query;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Component;
@ -13,7 +13,7 @@ import javax.sql.DataSource;
import java.util.List;
import java.util.stream.Collectors;
import static com.rbkmoney.magista.domain.Tables.ADJUSTMENT_DATA;
import static dev.vality.magista.domain.Tables.ADJUSTMENT_DATA;
@Component
public class AdjustmentDaoImpl extends AbstractDao implements AdjustmentDao {

View File

@ -1,9 +1,9 @@
package com.rbkmoney.magista.dao.impl;
package dev.vality.magista.dao.impl;
import com.rbkmoney.magista.dao.ChargebackDao;
import com.rbkmoney.magista.dao.impl.mapper.RecordRowMapper;
import com.rbkmoney.magista.domain.tables.pojos.ChargebackData;
import com.rbkmoney.magista.domain.tables.records.ChargebackDataRecord;
import dev.vality.magista.dao.ChargebackDao;
import dev.vality.magista.dao.impl.mapper.RecordRowMapper;
import dev.vality.magista.domain.tables.pojos.ChargebackData;
import dev.vality.magista.domain.tables.records.ChargebackDataRecord;
import org.jooq.Query;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Component;
@ -12,7 +12,7 @@ import javax.sql.DataSource;
import java.util.List;
import java.util.stream.Collectors;
import static com.rbkmoney.magista.domain.tables.ChargebackData.CHARGEBACK_DATA;
import static dev.vality.magista.domain.tables.ChargebackData.CHARGEBACK_DATA;
@Component
public class ChargebackDaoImpl extends AbstractDao implements ChargebackDao {

View File

@ -1,12 +1,12 @@
package com.rbkmoney.magista.dao.impl;
package dev.vality.magista.dao.impl;
import com.rbkmoney.damsel.merch_stat.*;
import com.rbkmoney.magista.dao.DeprecatedSearchDao;
import com.rbkmoney.magista.dao.impl.field.ConditionParameterSource;
import com.rbkmoney.magista.dao.impl.mapper.*;
import com.rbkmoney.magista.domain.enums.PayoutStatus;
import com.rbkmoney.magista.domain.enums.*;
import com.rbkmoney.magista.query.impl.*;
import dev.vality.damsel.merch_stat.*;
import dev.vality.magista.dao.DeprecatedSearchDao;
import dev.vality.magista.dao.impl.field.ConditionParameterSource;
import dev.vality.magista.dao.impl.mapper.*;
import dev.vality.magista.domain.enums.PayoutStatus;
import dev.vality.magista.domain.enums.*;
import dev.vality.magista.query.impl.*;
import org.jooq.Condition;
import org.jooq.Operator;
import org.jooq.Query;
@ -19,14 +19,14 @@ import javax.sql.DataSource;
import java.time.LocalDateTime;
import java.util.*;
import static com.rbkmoney.geck.common.util.TypeUtil.toEnumField;
import static com.rbkmoney.geck.common.util.TypeUtil.toEnumFields;
import static com.rbkmoney.magista.domain.tables.ChargebackData.CHARGEBACK_DATA;
import static com.rbkmoney.magista.domain.tables.InvoiceData.INVOICE_DATA;
import static com.rbkmoney.magista.domain.tables.PaymentData.PAYMENT_DATA;
import static com.rbkmoney.magista.domain.tables.Payout.PAYOUT;
import static com.rbkmoney.magista.domain.tables.RefundData.REFUND_DATA;
import static com.rbkmoney.magista.query.impl.Parameters.SHOP_ID_PARAM;
import static dev.vality.geck.common.util.TypeUtil.toEnumField;
import static dev.vality.geck.common.util.TypeUtil.toEnumFields;
import static dev.vality.magista.domain.tables.ChargebackData.CHARGEBACK_DATA;
import static dev.vality.magista.domain.tables.InvoiceData.INVOICE_DATA;
import static dev.vality.magista.domain.tables.PaymentData.PAYMENT_DATA;
import static dev.vality.magista.domain.tables.Payout.PAYOUT;
import static dev.vality.magista.domain.tables.RefundData.REFUND_DATA;
import static dev.vality.magista.query.impl.Parameters.SHOP_ID_PARAM;
import static org.jooq.Comparator.*;
@Deprecated
@ -38,7 +38,6 @@ public class DeprecatedSearchDaoImpl extends AbstractDao implements DeprecatedSe
private final DeprecatedStatRefundMapper statRefundMapper;
private final DeprecatedStatPayoutMapper statPayoutMapper;
private final DeprecatedStatChargebackMapper statChargebackMapper;
private final DeprecatedEnrichedStatInvoiceMapper enrichedStatInvoiceMapper;
public DeprecatedSearchDaoImpl(DataSource ds) {
super(ds);
@ -47,7 +46,6 @@ public class DeprecatedSearchDaoImpl extends AbstractDao implements DeprecatedSe
statRefundMapper = new DeprecatedStatRefundMapper();
statPayoutMapper = new DeprecatedStatPayoutMapper();
statChargebackMapper = new DeprecatedStatChargebackMapper();
enrichedStatInvoiceMapper = new DeprecatedEnrichedStatInvoiceMapper();
}
@Override
@ -78,7 +76,7 @@ public class DeprecatedSearchDaoImpl extends AbstractDao implements DeprecatedSe
INVOICE_DATA.INVOICE_STATUS,
toEnumField(
parameters.getInvoiceStatus(),
com.rbkmoney.magista.domain.enums.InvoiceStatus.class),
dev.vality.magista.domain.enums.InvoiceStatus.class),
EQUALS)
.addValue(INVOICE_DATA.INVOICE_AMOUNT, parameters.getInvoiceAmount(), EQUALS)),
INVOICE_DATA.INVOICE_CREATED_AT,
@ -290,77 +288,6 @@ public class DeprecatedSearchDaoImpl extends AbstractDao implements DeprecatedSe
return fetch(query, statChargebackMapper);
}
/**
* merchant OKKO-specific, in general shouldn't be touched.
*
* @author n.pospolita
*/
@Override
public Collection<Map.Entry<Long, EnrichedStatInvoice>> getEnrichedInvoices(
RefundsFunction.RefundsParameters parameters,
LocalDateTime fromTime,
LocalDateTime toTime,
LocalDateTime whereTime,
int limit
) {
ConditionParameterSource refundParameterSource = prepareEnrichedRefundCondition(parameters, whereTime);
Query query = getDslContext()
.selectFrom(REFUND_DATA
.join(PAYMENT_DATA).on(PAYMENT_DATA.INVOICE_ID.eq(REFUND_DATA.INVOICE_ID),
PAYMENT_DATA.PAYMENT_ID.eq(REFUND_DATA.PAYMENT_ID))
.join(INVOICE_DATA).on(INVOICE_DATA.INVOICE_ID.eq(REFUND_DATA.INVOICE_ID))
)
.where(
appendDateTimeRangeConditions(
appendConditions(DSL.trueCondition(), Operator.AND, refundParameterSource),
REFUND_DATA.EVENT_CREATED_AT,
fromTime,
toTime
)
)
.orderBy(REFUND_DATA.EVENT_CREATED_AT.desc())
.limit(limit);
return fetch(query, enrichedStatInvoiceMapper);
}
/**
* merchant OKKO-specific, in general shouldn't be touched.
*
* @author n.pospolita
*/
@Override
public Collection<Map.Entry<Long, EnrichedStatInvoice>> getEnrichedInvoices(
PaymentsFunction.PaymentsParameters parameters,
LocalDateTime fromTime,
LocalDateTime toTime,
LocalDateTime whereTime,
int limit
) {
ConditionParameterSource conditionParameterSource = prepareEnrichedPaymentsCondition(parameters, whereTime);
Query query = getDslContext()
.select()
.from(PAYMENT_DATA
.leftJoin(REFUND_DATA).on(REFUND_DATA.INVOICE_ID.eq(PAYMENT_DATA.INVOICE_ID),
REFUND_DATA.PAYMENT_ID.eq(PAYMENT_DATA.PAYMENT_ID))
.join(INVOICE_DATA).on(INVOICE_DATA.INVOICE_ID.eq(PAYMENT_DATA.INVOICE_ID))
)
.where(
appendDateTimeRangeConditions(
appendConditions(DSL.trueCondition(), Operator.AND, conditionParameterSource),
PAYMENT_DATA.EVENT_CREATED_AT,
fromTime,
toTime
)
)
.orderBy(PAYMENT_DATA.EVENT_CREATED_AT.desc())
.limit(limit);
return fetch(query, enrichedStatInvoiceMapper);
}
private ConditionParameterSource preparePaymentsCondition(
ConditionParameterSource conditionParameterSource,
PaymentsFunction.PaymentsParameters parameters) {
@ -368,7 +295,7 @@ public class DeprecatedSearchDaoImpl extends AbstractDao implements DeprecatedSe
.addValue(PAYMENT_DATA.PAYMENT_ID, parameters.getPaymentId(), EQUALS)
.addValue(PAYMENT_DATA.PAYMENT_STATUS,
toEnumField(parameters.getPaymentStatus(),
com.rbkmoney.magista.domain.enums.InvoicePaymentStatus.class),
dev.vality.magista.domain.enums.InvoicePaymentStatus.class),
EQUALS)
.addValue(PAYMENT_DATA.PAYMENT_FLOW,
toEnumField(parameters.getPaymentFlow(), PaymentFlow.class),
@ -400,7 +327,7 @@ public class DeprecatedSearchDaoImpl extends AbstractDao implements DeprecatedSe
.eq(parameters.getPaymentBankCardTokenProvider()),
PAYMENT_DATA.PAYMENT_BANK_CARD_TOKEN_PROVIDER_LEGACY.eq(
toEnumField(parameters.getPaymentBankCardTokenProvider(),
com.rbkmoney.magista.domain.enums.BankCardTokenProvider.class)));
dev.vality.magista.domain.enums.BankCardTokenProvider.class)));
}
return conditionParameterSource;
}
@ -423,81 +350,6 @@ public class DeprecatedSearchDaoImpl extends AbstractDao implements DeprecatedSe
return conditionParameterSource;
}
/**
* merchant OKKO-specific, in general shouldn't be touched.
*
* @author n.pospolita
*/
private ConditionParameterSource prepareEnrichedPaymentsCondition(PaymentsFunction.PaymentsParameters parameters,
LocalDateTime whereTime) {
ConditionParameterSource conditionParameterSource = new ConditionParameterSource()
.addValue(
PAYMENT_DATA.PARTY_ID,
Optional.ofNullable(parameters.getMerchantId())
.map(UUID::fromString)
.orElse(null),
EQUALS
)
.addValue(PAYMENT_DATA.PARTY_SHOP_ID, parameters.getShopId(), EQUALS)
.addValue(PAYMENT_DATA.INVOICE_ID, parameters.getInvoiceId(), EQUALS)
.addValue(PAYMENT_DATA.PAYMENT_ID, parameters.getPaymentId(), EQUALS)
.addValue(PAYMENT_DATA.PAYMENT_STATUS,
toEnumField(parameters.getPaymentStatus(),
com.rbkmoney.magista.domain.enums.InvoicePaymentStatus.class),
EQUALS)
.addValue(PAYMENT_DATA.PAYMENT_FLOW,
toEnumField(parameters.getPaymentFlow(), PaymentFlow.class),
EQUALS)
.addValue(PAYMENT_DATA.PAYMENT_TOOL, parameters.getPaymentMethod(), EQUALS)
.addValue(PAYMENT_DATA.PAYMENT_TERMINAL_PROVIDER, parameters.getPaymentTerminalProvider(), EQUALS)
.addValue(PAYMENT_DATA.PAYMENT_EMAIL, parameters.getPaymentEmail(), EQUALS)
.addValue(PAYMENT_DATA.PAYMENT_IP, parameters.getPaymentIp(), EQUALS)
.addValue(PAYMENT_DATA.PAYMENT_FINGERPRINT, parameters.getPaymentFingerprint(), EQUALS)
.addValue(PAYMENT_DATA.PAYMENT_BANK_CARD_FIRST6, parameters.getPaymentBankCardFirst6(), EQUALS)
.addValue(PAYMENT_DATA.PAYMENT_BANK_CARD_SYSTEM, parameters.getPaymentBankCardSystem(), EQUALS)
.addValue(PAYMENT_DATA.PAYMENT_BANK_CARD_LAST4, parameters.getPaymentBankCardLast4(), EQUALS)
.addValue(PAYMENT_DATA.PAYMENT_CUSTOMER_ID, parameters.getPaymentCustomerId(), EQUALS)
.addValue(PAYMENT_DATA.PAYMENT_AMOUNT, parameters.getPaymentAmount(), EQUALS)
.addValue(PAYMENT_DATA.PAYMENT_DOMAIN_REVISION, parameters.getPaymentDomainRevision(), EQUALS)
.addValue(PAYMENT_DATA.PAYMENT_DOMAIN_REVISION, parameters.getFromPaymentDomainRevision(),
GREATER_OR_EQUAL)
.addValue(PAYMENT_DATA.PAYMENT_DOMAIN_REVISION, parameters.getToPaymentDomainRevision(), LESS_OR_EQUAL)
.addValue(PAYMENT_DATA.EVENT_CREATED_AT, whereTime, LESS)
.addValue(PAYMENT_DATA.PAYMENT_RRN, parameters.getPaymentRrn(), EQUALS)
.addValue(PAYMENT_DATA.PAYMENT_APPROVAL_CODE, parameters.getPaymentApproveCode(), EQUALS)
.addValue(PAYMENT_DATA.EXTERNAL_ID, parameters.getExternalId(), EQUALS);
if (!ObjectUtils.isEmpty(parameters.getPaymentBankCardTokenProvider())) {
conditionParameterSource.addOrCondition(
PAYMENT_DATA.PAYMENT_BANK_CARD_TOKEN_PROVIDER
.eq(parameters.getPaymentBankCardTokenProvider()),
PAYMENT_DATA.PAYMENT_BANK_CARD_TOKEN_PROVIDER_LEGACY.eq(
toEnumField(parameters.getPaymentBankCardTokenProvider(),
com.rbkmoney.magista.domain.enums.BankCardTokenProvider.class)));
}
return conditionParameterSource;
}
/**
* merchant OKKO-specific, in general shouldn't be touched
*
* @author n.pospolita
*/
private ConditionParameterSource prepareEnrichedRefundCondition(RefundsFunction.RefundsParameters parameters,
LocalDateTime whereTime) {
return new ConditionParameterSource()
.addValue(REFUND_DATA.PARTY_ID, parameters.getMerchantId(), EQUALS)
.addValue(REFUND_DATA.PARTY_SHOP_ID, parameters.getShopId(), EQUALS)
.addValue(REFUND_DATA.INVOICE_ID, parameters.getInvoiceId(), EQUALS)
.addValue(REFUND_DATA.PAYMENT_ID, parameters.getPaymentId(), EQUALS)
.addValue(REFUND_DATA.REFUND_ID, parameters.getRefundId(), EQUALS)
.addValue(REFUND_DATA.EXTERNAL_ID, parameters.getExternalId(), EQUALS)
.addValue(REFUND_DATA.EVENT_CREATED_AT, whereTime, LESS)
.addValue(REFUND_DATA.REFUND_STATUS,
toEnumField(parameters.getRefundStatus(), RefundStatus.class),
EQUALS);
}
private Condition prepareExcludeCondition(PaymentsFunction.PaymentsParameters parameters) {
Object paramObject = parameters.getExclude();
Map excludeParam = paramObject instanceof Map ? ((Map) paramObject) : null;

View File

@ -1,7 +1,7 @@
package com.rbkmoney.magista.dao.impl;
package dev.vality.magista.dao.impl;
import com.rbkmoney.magista.dao.EventDao;
import com.rbkmoney.magista.exception.DaoException;
import dev.vality.magista.dao.EventDao;
import dev.vality.magista.exception.DaoException;
import org.jooq.Query;
import org.jooq.impl.DSL;
import org.springframework.stereotype.Component;
@ -9,7 +9,7 @@ import org.springframework.stereotype.Component;
import javax.sql.DataSource;
import java.util.Optional;
import static com.rbkmoney.magista.domain.tables.PayoutData.PAYOUT_DATA;
import static dev.vality.magista.domain.tables.PayoutData.PAYOUT_DATA;
@Component
public class EventDaoImpl extends AbstractDao implements EventDao {

View File

@ -1,10 +1,10 @@
package com.rbkmoney.magista.dao.impl;
package dev.vality.magista.dao.impl;
import com.rbkmoney.magista.dao.InvoiceDao;
import com.rbkmoney.magista.dao.impl.mapper.RecordRowMapper;
import com.rbkmoney.magista.domain.tables.pojos.InvoiceData;
import com.rbkmoney.magista.domain.tables.records.InvoiceDataRecord;
import com.rbkmoney.magista.exception.DaoException;
import dev.vality.magista.dao.InvoiceDao;
import dev.vality.magista.dao.impl.mapper.RecordRowMapper;
import dev.vality.magista.domain.tables.pojos.InvoiceData;
import dev.vality.magista.domain.tables.records.InvoiceDataRecord;
import dev.vality.magista.exception.DaoException;
import org.jooq.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.RowMapper;
@ -14,7 +14,7 @@ import javax.sql.DataSource;
import java.util.List;
import java.util.stream.Collectors;
import static com.rbkmoney.magista.domain.Tables.INVOICE_DATA;
import static dev.vality.magista.domain.Tables.INVOICE_DATA;
@Component
public class InvoiceDaoImpl extends AbstractDao implements InvoiceDao {

View File

@ -1,10 +1,10 @@
package com.rbkmoney.magista.dao.impl;
package dev.vality.magista.dao.impl;
import com.rbkmoney.magista.dao.InvoiceTemplateDao;
import com.rbkmoney.magista.dao.impl.mapper.RecordRowMapper;
import com.rbkmoney.magista.domain.tables.pojos.InvoiceTemplate;
import com.rbkmoney.magista.domain.tables.records.InvoiceTemplateRecord;
import com.rbkmoney.magista.exception.DaoException;
import dev.vality.magista.dao.InvoiceTemplateDao;
import dev.vality.magista.dao.impl.mapper.RecordRowMapper;
import dev.vality.magista.domain.tables.pojos.InvoiceTemplate;
import dev.vality.magista.domain.tables.records.InvoiceTemplateRecord;
import dev.vality.magista.exception.DaoException;
import org.jooq.Query;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Component;
@ -13,7 +13,7 @@ import javax.sql.DataSource;
import java.util.List;
import java.util.stream.Collectors;
import static com.rbkmoney.magista.domain.tables.InvoiceTemplate.INVOICE_TEMPLATE;
import static dev.vality.magista.domain.tables.InvoiceTemplate.INVOICE_TEMPLATE;
@Component
public class InvoiceTemplateDaoImpl extends AbstractDao implements InvoiceTemplateDao {

View File

@ -1,9 +1,9 @@
package com.rbkmoney.magista.dao.impl;
package dev.vality.magista.dao.impl;
import com.rbkmoney.magista.dao.PaymentDao;
import com.rbkmoney.magista.dao.impl.mapper.RecordRowMapper;
import com.rbkmoney.magista.domain.tables.pojos.PaymentData;
import com.rbkmoney.magista.domain.tables.records.PaymentDataRecord;
import dev.vality.magista.dao.PaymentDao;
import dev.vality.magista.dao.impl.mapper.RecordRowMapper;
import dev.vality.magista.domain.tables.pojos.PaymentData;
import dev.vality.magista.domain.tables.records.PaymentDataRecord;
import org.jooq.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.RowMapper;
@ -13,7 +13,7 @@ import javax.sql.DataSource;
import java.util.List;
import java.util.stream.Collectors;
import static com.rbkmoney.magista.domain.Tables.PAYMENT_DATA;
import static dev.vality.magista.domain.Tables.PAYMENT_DATA;
@Component
public class PaymentDaoImpl extends AbstractDao implements PaymentDao {

View File

@ -1,16 +1,16 @@
package com.rbkmoney.magista.dao.impl;
package dev.vality.magista.dao.impl;
import com.rbkmoney.magista.dao.PayoutDao;
import com.rbkmoney.magista.dao.impl.mapper.RecordRowMapper;
import com.rbkmoney.magista.domain.tables.pojos.Payout;
import com.rbkmoney.magista.domain.tables.records.PayoutRecord;
import dev.vality.magista.dao.PayoutDao;
import dev.vality.magista.dao.impl.mapper.RecordRowMapper;
import dev.vality.magista.domain.tables.pojos.Payout;
import dev.vality.magista.domain.tables.records.PayoutRecord;
import org.jooq.Query;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Component;
import javax.sql.DataSource;
import static com.rbkmoney.magista.domain.tables.Payout.PAYOUT;
import static dev.vality.magista.domain.tables.Payout.PAYOUT;
@Component
public class PayoutDaoImpl extends AbstractDao implements PayoutDao {

View File

@ -1,9 +1,9 @@
package com.rbkmoney.magista.dao.impl;
package dev.vality.magista.dao.impl;
import com.rbkmoney.magista.dao.RefundDao;
import com.rbkmoney.magista.dao.impl.mapper.RecordRowMapper;
import com.rbkmoney.magista.domain.tables.pojos.RefundData;
import com.rbkmoney.magista.domain.tables.records.RefundDataRecord;
import dev.vality.magista.dao.RefundDao;
import dev.vality.magista.dao.impl.mapper.RecordRowMapper;
import dev.vality.magista.domain.tables.pojos.RefundData;
import dev.vality.magista.domain.tables.records.RefundDataRecord;
import org.jooq.Query;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Component;
@ -12,7 +12,7 @@ import javax.sql.DataSource;
import java.util.List;
import java.util.stream.Collectors;
import static com.rbkmoney.magista.domain.tables.RefundData.REFUND_DATA;
import static dev.vality.magista.domain.tables.RefundData.REFUND_DATA;
@Component
public class RefundDaoImpl extends AbstractDao implements RefundDao {

View File

@ -1,27 +1,23 @@
package com.rbkmoney.magista.dao.impl;
package dev.vality.magista.dao.impl;
import com.rbkmoney.geck.common.util.TBaseUtil;
import com.rbkmoney.geck.common.util.TypeUtil;
import com.rbkmoney.magista.*;
import com.rbkmoney.magista.constant.SearchConstant;
import com.rbkmoney.magista.dao.SearchDao;
import com.rbkmoney.magista.dao.impl.field.ConditionParameterSource;
import com.rbkmoney.magista.dao.impl.mapper.*;
import com.rbkmoney.magista.dark.messiah.EnrichedStatInvoice;
import com.rbkmoney.magista.domain.enums.InvoicePaymentStatus;
import com.rbkmoney.magista.domain.enums.PaymentTool;
import com.rbkmoney.magista.domain.enums.PayoutStatus;
import com.rbkmoney.magista.domain.enums.*;
import com.rbkmoney.magista.domain.enums.PayoutToolType;
import com.rbkmoney.magista.service.TimeHolder;
import com.rbkmoney.magista.service.TokenGenService;
import dev.vality.geck.common.util.TypeUtil;
import dev.vality.magista.*;
import dev.vality.magista.constant.SearchConstant;
import dev.vality.magista.dao.SearchDao;
import dev.vality.magista.dao.impl.field.ConditionParameterSource;
import dev.vality.magista.dao.impl.mapper.*;
import dev.vality.magista.domain.enums.InvoicePaymentStatus;
import dev.vality.magista.domain.enums.PayoutStatus;
import dev.vality.magista.domain.enums.PayoutToolType;
import dev.vality.magista.domain.enums.*;
import dev.vality.magista.service.TimeHolder;
import dev.vality.magista.service.TokenGenService;
import org.jooq.Condition;
import org.jooq.Operator;
import org.jooq.Query;
import org.jooq.SelectConditionStep;
import org.jooq.impl.DSL;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import javax.sql.DataSource;
import java.util.List;
@ -29,14 +25,14 @@ import java.util.Optional;
import java.util.UUID;
import java.util.stream.Collectors;
import static com.rbkmoney.geck.common.util.TypeUtil.toEnumField;
import static com.rbkmoney.geck.common.util.TypeUtil.toEnumFields;
import static com.rbkmoney.magista.domain.tables.ChargebackData.CHARGEBACK_DATA;
import static com.rbkmoney.magista.domain.tables.InvoiceData.INVOICE_DATA;
import static com.rbkmoney.magista.domain.tables.InvoiceTemplate.INVOICE_TEMPLATE;
import static com.rbkmoney.magista.domain.tables.PaymentData.PAYMENT_DATA;
import static com.rbkmoney.magista.domain.tables.Payout.PAYOUT;
import static com.rbkmoney.magista.domain.tables.RefundData.REFUND_DATA;
import static dev.vality.geck.common.util.TypeUtil.toEnumField;
import static dev.vality.geck.common.util.TypeUtil.toEnumFields;
import static dev.vality.magista.domain.tables.ChargebackData.CHARGEBACK_DATA;
import static dev.vality.magista.domain.tables.InvoiceData.INVOICE_DATA;
import static dev.vality.magista.domain.tables.InvoiceTemplate.INVOICE_TEMPLATE;
import static dev.vality.magista.domain.tables.PaymentData.PAYMENT_DATA;
import static dev.vality.magista.domain.tables.Payout.PAYOUT;
import static dev.vality.magista.domain.tables.RefundData.REFUND_DATA;
import static org.jooq.Comparator.*;
@Component
@ -47,7 +43,6 @@ public class SearchDaoImpl extends AbstractDao implements SearchDao {
private final StatRefundMapper statRefundMapper;
private final StatPayoutMapper statPayoutMapper;
private final StatChargebackMapper statChargebackMapper;
private final EnrichedStatInvoiceMapper enrichedStatInvoiceMapper;
private final StatInvoiceTemplateMapper statInvoiceTemplateMapper;
private final TokenGenService tokenGenService;
@ -59,7 +54,6 @@ public class SearchDaoImpl extends AbstractDao implements SearchDao {
statRefundMapper = new StatRefundMapper();
statPayoutMapper = new StatPayoutMapper();
statChargebackMapper = new StatChargebackMapper();
enrichedStatInvoiceMapper = new EnrichedStatInvoiceMapper();
statInvoiceTemplateMapper = new StatInvoiceTemplateMapper();
}
@ -85,7 +79,7 @@ public class SearchDaoImpl extends AbstractDao implements SearchDao {
searchQuery.isSetInvoiceStatus()
? TypeUtil.toEnumField(
searchQuery.getInvoiceStatus().name(),
com.rbkmoney.magista.domain.enums.InvoiceStatus.class)
dev.vality.magista.domain.enums.InvoiceStatus.class)
: null,
EQUALS)
.addValue(INVOICE_DATA.INVOICE_AMOUNT,
@ -200,53 +194,56 @@ public class SearchDaoImpl extends AbstractDao implements SearchDao {
CommonSearchQueryParams commonParams = chargebackSearchQuery.getCommonSearchQueryParams();
TimeHolder timeHolder = buildTimeHolder(commonParams);
Query query = getDslContext().selectFrom(CHARGEBACK_DATA).where(
appendDateTimeRangeConditions(appendConditions(
DSL.trueCondition(),
Operator.AND,
new ConditionParameterSource()
.addValue(CHARGEBACK_DATA.PARTY_ID, commonParams.getPartyId(), EQUALS)
.addInConditionValue(CHARGEBACK_DATA.PARTY_SHOP_ID,
commonParams.getShopIds())
.addInConditionValue(
CHARGEBACK_DATA.INVOICE_ID,
chargebackSearchQuery.getInvoiceIds())
.addValue(CHARGEBACK_DATA.PAYMENT_ID,
chargebackSearchQuery.getPaymentId(), EQUALS)
.addValue(CHARGEBACK_DATA.CHARGEBACK_ID,
chargebackSearchQuery.getChargebackId(),
EQUALS)
.addInConditionValue(CHARGEBACK_DATA.CHARGEBACK_STATUS,
chargebackSearchQuery.isSetChargebackStatuses()
? toEnumFields(
chargebackSearchQuery.getChargebackStatuses()
.stream()
.map(cs -> cs.getSetField().getFieldName())
.collect(Collectors.toList()),
ChargebackStatus.class)
: null)
.addInConditionValue(CHARGEBACK_DATA.CHARGEBACK_STAGE,
chargebackSearchQuery.isSetChargebackStages()
? toEnumFields(chargebackSearchQuery.getChargebackStages()
.stream()
.map(cs -> cs.getSetField().getFieldName())
.collect(Collectors.toList()),
ChargebackStage.class)
: null)
.addInConditionValue(CHARGEBACK_DATA.CHARGEBACK_REASON_CATEGORY,
chargebackSearchQuery.isSetChargebackCategories()
? toEnumFields(chargebackSearchQuery.getChargebackCategories()
.stream()
.map(cc -> cc.getSetField().getFieldName())
.collect(Collectors.toList()),
ChargebackCategory.class)
: null)
.addValue(CHARGEBACK_DATA.CHARGEBACK_CREATED_AT, timeHolder.getWhereTime(), LESS)
),
CHARGEBACK_DATA.CHARGEBACK_CREATED_AT,
timeHolder.getFromTime(),
timeHolder.getToTime()
)
).orderBy(CHARGEBACK_DATA.CHARGEBACK_CREATED_AT.desc())
appendDateTimeRangeConditions(appendConditions(
DSL.trueCondition(),
Operator.AND,
new ConditionParameterSource()
.addValue(CHARGEBACK_DATA.PARTY_ID, commonParams.getPartyId(), EQUALS)
.addInConditionValue(CHARGEBACK_DATA.PARTY_SHOP_ID,
commonParams.getShopIds())
.addInConditionValue(
CHARGEBACK_DATA.INVOICE_ID,
chargebackSearchQuery.getInvoiceIds())
.addValue(CHARGEBACK_DATA.PAYMENT_ID,
chargebackSearchQuery.getPaymentId(), EQUALS)
.addValue(CHARGEBACK_DATA.CHARGEBACK_ID,
chargebackSearchQuery.getChargebackId(),
EQUALS)
.addInConditionValue(CHARGEBACK_DATA.CHARGEBACK_STATUS,
chargebackSearchQuery.isSetChargebackStatuses()
? toEnumFields(
chargebackSearchQuery.getChargebackStatuses()
.stream()
.map(cs -> cs.getSetField().getFieldName())
.collect(Collectors.toList()),
ChargebackStatus.class)
: null)
.addInConditionValue(CHARGEBACK_DATA.CHARGEBACK_STAGE,
chargebackSearchQuery.isSetChargebackStages()
? toEnumFields(
chargebackSearchQuery.getChargebackStages()
.stream()
.map(cs -> cs.getSetField().getFieldName())
.collect(Collectors.toList()),
ChargebackStage.class)
: null)
.addInConditionValue(CHARGEBACK_DATA.CHARGEBACK_REASON_CATEGORY,
chargebackSearchQuery.isSetChargebackCategories()
? toEnumFields(
chargebackSearchQuery.getChargebackCategories()
.stream()
.map(cc -> cc.getSetField().getFieldName())
.collect(Collectors.toList()),
ChargebackCategory.class)
: null)
.addValue(CHARGEBACK_DATA.CHARGEBACK_CREATED_AT,
timeHolder.getWhereTime(), LESS)
),
CHARGEBACK_DATA.CHARGEBACK_CREATED_AT,
timeHolder.getFromTime(),
timeHolder.getToTime()
)
).orderBy(CHARGEBACK_DATA.CHARGEBACK_CREATED_AT.desc())
.limit(commonParams.isSetLimit() ? commonParams.getLimit() : SearchConstant.LIMIT);
return fetch(query, statChargebackMapper);
@ -291,69 +288,6 @@ public class SearchDaoImpl extends AbstractDao implements SearchDao {
return fetch(query, statInvoiceTemplateMapper);
}
/**
* merchant OKKO-specific, in general shouldn't be touched.
*
* @author n.pospolitych
*/
@Override
public List<EnrichedStatInvoice> getEnrichedRefundInvoices(
com.rbkmoney.magista.dark.messiah.RefundSearchQuery refundSearchQuery) {
CommonSearchQueryParams commonParams = refundSearchQuery.getCommonSearchQueryParams();
TimeHolder timeHolder = buildTimeHolder(commonParams);
ConditionParameterSource refundParameterSource = prepareEnrichedRefundCondition(refundSearchQuery, timeHolder);
Query query = getDslContext()
.selectFrom(REFUND_DATA
.join(PAYMENT_DATA).on(PAYMENT_DATA.INVOICE_ID.eq(REFUND_DATA.INVOICE_ID),
PAYMENT_DATA.PAYMENT_ID.eq(REFUND_DATA.PAYMENT_ID))
.join(INVOICE_DATA).on(INVOICE_DATA.INVOICE_ID.eq(REFUND_DATA.INVOICE_ID))
)
.where(
appendDateTimeRangeConditions(
appendConditions(DSL.trueCondition(), Operator.AND, refundParameterSource),
REFUND_DATA.EVENT_CREATED_AT,
timeHolder.getFromTime(),
timeHolder.getToTime()
)
)
.orderBy(REFUND_DATA.EVENT_CREATED_AT.desc())
.limit(commonParams.isSetLimit() ? commonParams.getLimit() : SearchConstant.LIMIT);
return fetch(query, enrichedStatInvoiceMapper);
}
/**
* merchant OKKO-specific, in general shouldn't be touched.
*
* @author n.pospolita
*/
@Override
public List<EnrichedStatInvoice> getEnrichedPaymentInvoices(
com.rbkmoney.magista.dark.messiah.PaymentSearchQuery paymentSearchQuery) {
CommonSearchQueryParams commonParams = paymentSearchQuery.getCommonSearchQueryParams();
TimeHolder timeHolder = buildTimeHolder(commonParams);
var conditionParameterSource = prepareEnrichedPaymentsCondition(paymentSearchQuery, timeHolder);
Query query = getDslContext()
.select()
.from(PAYMENT_DATA
.leftJoin(REFUND_DATA).on(REFUND_DATA.INVOICE_ID.eq(PAYMENT_DATA.INVOICE_ID),
REFUND_DATA.PAYMENT_ID.eq(PAYMENT_DATA.PAYMENT_ID))
.join(INVOICE_DATA).on(INVOICE_DATA.INVOICE_ID.eq(PAYMENT_DATA.INVOICE_ID))
)
.where(
appendDateTimeRangeConditions(
appendConditions(DSL.trueCondition(), Operator.AND, conditionParameterSource),
PAYMENT_DATA.EVENT_CREATED_AT,
timeHolder.getFromTime(),
timeHolder.getToTime()
)
)
.orderBy(PAYMENT_DATA.EVENT_CREATED_AT.desc())
.limit(commonParams.isSetLimit() ? commonParams.getLimit() : SearchConstant.LIMIT);
return fetch(query, enrichedStatInvoiceMapper);
}
private ConditionParameterSource prepareRefundCondition(RefundSearchQuery searchQuery, TimeHolder timeHolder) {
CommonSearchQueryParams commonParams = searchQuery.getCommonSearchQueryParams();
return new ConditionParameterSource()
@ -487,7 +421,7 @@ public class SearchDaoImpl extends AbstractDao implements SearchDao {
.eq(paymentParams.getPaymentTokenProvider().name()),
PAYMENT_DATA.PAYMENT_BANK_CARD_TOKEN_PROVIDER_LEGACY.eq(
toEnumField(paymentParams.getPaymentTokenProvider().name(),
com.rbkmoney.magista.domain.enums.BankCardTokenProvider.class)));
dev.vality.magista.domain.enums.BankCardTokenProvider.class)));
}
return conditionParameterSource;
}
@ -518,118 +452,6 @@ public class SearchDaoImpl extends AbstractDao implements SearchDao {
return invoiceTemplateStatus;
}
/**
* merchant OKKO-specific, in general shouldn't be touched.
*
* @author n.pospolita
*/
private ConditionParameterSource prepareEnrichedPaymentsCondition(
com.rbkmoney.magista.dark.messiah.PaymentSearchQuery paymentSearchQuery,
TimeHolder timeHolder) {
CommonSearchQueryParams commonParams = paymentSearchQuery.getCommonSearchQueryParams();
ConditionParameterSource conditionParameterSource = new ConditionParameterSource()
.addValue(
PAYMENT_DATA.PARTY_ID,
Optional.ofNullable(commonParams.getPartyId())
.map(UUID::fromString)
.orElse(null),
EQUALS
)
.addInConditionValue(PAYMENT_DATA.PARTY_SHOP_ID, commonParams.getShopIds())
.addValue(PAYMENT_DATA.INVOICE_ID, paymentSearchQuery.getInvoiceId(), EQUALS)
.addValue(PAYMENT_DATA.PAYMENT_ID, paymentSearchQuery.getPaymentId(), EQUALS)
.addValue(PAYMENT_DATA.PAYMENT_STATUS,
paymentSearchQuery.isSetPaymentStatus()
? TBaseUtil.unionFieldToEnum(paymentSearchQuery.getPaymentStatus(),
com.rbkmoney.magista.domain.enums.InvoicePaymentStatus.class)
: null,
EQUALS)
.addValue(PAYMENT_DATA.PAYMENT_FLOW,
paymentSearchQuery.isSetPaymentFlow()
? TBaseUtil.unionFieldToEnum(paymentSearchQuery.getPaymentFlow(), PaymentFlow.class)
: null,
EQUALS)
.addValue(PAYMENT_DATA.PAYMENT_TOOL,
paymentSearchQuery.isSetPaymentTool()
? TBaseUtil.unionFieldToEnum(paymentSearchQuery.getPaymentTool(), PaymentTool.class)
: null,
EQUALS)
.addValue(PAYMENT_DATA.PAYMENT_TERMINAL_PROVIDER,
paymentSearchQuery.isSetPaymentTerminalProvider()
? paymentSearchQuery.getPaymentTerminalProvider().name()
: null,
EQUALS)
.addValue(PAYMENT_DATA.PAYMENT_EMAIL, paymentSearchQuery.getPaymentEmail(), EQUALS)
.addValue(PAYMENT_DATA.PAYMENT_IP, paymentSearchQuery.getPaymentIp(), EQUALS)
.addValue(PAYMENT_DATA.PAYMENT_FINGERPRINT, paymentSearchQuery.getPaymentFingerprint(), EQUALS)
.addValue(PAYMENT_DATA.PAYMENT_BANK_CARD_FIRST6, paymentSearchQuery.getPaymentFirst6(), EQUALS)
.addValue(PAYMENT_DATA.PAYMENT_BANK_CARD_SYSTEM,
paymentSearchQuery.isSetPaymentSystem()
? paymentSearchQuery.getPaymentSystem().name()
: null,
EQUALS)
.addValue(PAYMENT_DATA.PAYMENT_BANK_CARD_LAST4, paymentSearchQuery.getPaymentLast4(), EQUALS)
.addValue(PAYMENT_DATA.PAYMENT_CUSTOMER_ID, paymentSearchQuery.getPaymentCustomerId(), EQUALS)
.addValue(PAYMENT_DATA.PAYMENT_AMOUNT,
paymentSearchQuery.isSetPaymentAmount()
? paymentSearchQuery.getPaymentAmount()
: null,
EQUALS)
.addValue(PAYMENT_DATA.PAYMENT_DOMAIN_REVISION,
paymentSearchQuery.isSetPaymentDomainRevision()
? paymentSearchQuery.getPaymentDomainRevision()
: null,
EQUALS)
.addValue(PAYMENT_DATA.PAYMENT_DOMAIN_REVISION,
paymentSearchQuery.isSetFromPaymentDomainRevision()
? paymentSearchQuery.getFromPaymentDomainRevision()
: null,
GREATER_OR_EQUAL)
.addValue(PAYMENT_DATA.PAYMENT_DOMAIN_REVISION,
paymentSearchQuery.isSetToPaymentDomainRevision()
? paymentSearchQuery.getToPaymentDomainRevision()
: null,
LESS_OR_EQUAL)
.addValue(PAYMENT_DATA.EVENT_CREATED_AT, timeHolder.getWhereTime(), LESS)
.addValue(PAYMENT_DATA.PAYMENT_RRN, paymentSearchQuery.getPaymentRrn(), EQUALS)
.addValue(PAYMENT_DATA.PAYMENT_APPROVAL_CODE, paymentSearchQuery.getPaymentApprovalCode(), EQUALS)
.addValue(PAYMENT_DATA.EXTERNAL_ID, paymentSearchQuery.getExternalId(), EQUALS);
if (!ObjectUtils.isEmpty(paymentSearchQuery.getPaymentTokenProvider())) {
conditionParameterSource.addOrCondition(
PAYMENT_DATA.PAYMENT_BANK_CARD_TOKEN_PROVIDER
.eq(paymentSearchQuery.getPaymentTokenProvider().name()),
PAYMENT_DATA.PAYMENT_BANK_CARD_TOKEN_PROVIDER_LEGACY.eq(
toEnumField(paymentSearchQuery.getPaymentTokenProvider().name(),
com.rbkmoney.magista.domain.enums.BankCardTokenProvider.class)));
}
return conditionParameterSource;
}
/**
* merchant OKKO-specific, in general shouldn't be touched
*
* @author n.pospolita
*/
private ConditionParameterSource prepareEnrichedRefundCondition(
com.rbkmoney.magista.dark.messiah.RefundSearchQuery refundSearchQuery,
TimeHolder timeHolder) {
CommonSearchQueryParams commonParams = refundSearchQuery.getCommonSearchQueryParams();
return new ConditionParameterSource()
.addValue(REFUND_DATA.PARTY_ID, commonParams.getPartyId(), EQUALS)
.addInConditionValue(REFUND_DATA.PARTY_SHOP_ID, commonParams.getShopIds())
.addValue(REFUND_DATA.INVOICE_ID, refundSearchQuery.getInvoiceId(), EQUALS)
.addValue(REFUND_DATA.PAYMENT_ID, refundSearchQuery.getPaymentId(), EQUALS)
.addValue(REFUND_DATA.REFUND_ID, refundSearchQuery.getRefundId(), EQUALS)
.addValue(REFUND_DATA.EXTERNAL_ID, refundSearchQuery.getExternalId(), EQUALS)
.addValue(REFUND_DATA.EVENT_CREATED_AT, timeHolder.getWhereTime(), LESS)
.addValue(REFUND_DATA.REFUND_STATUS,
refundSearchQuery.isSetRefundStatus()
? TBaseUtil.unionFieldToEnum(refundSearchQuery.getRefundStatus(), RefundStatus.class)
: null,
EQUALS);
}
private TimeHolder buildTimeHolder(CommonSearchQueryParams commonParams) {
return TimeHolder.builder()
.fromTime(TypeUtil.stringToLocalDateTime(commonParams.getFromTime()))

View File

@ -1,8 +1,8 @@
package com.rbkmoney.magista.dao.impl;
package dev.vality.magista.dao.impl;
import com.rbkmoney.magista.dao.StatisticsDao;
import com.rbkmoney.magista.domain.enums.InvoiceEventType;
import com.rbkmoney.magista.domain.enums.InvoicePaymentStatus;
import dev.vality.magista.dao.StatisticsDao;
import dev.vality.magista.domain.enums.InvoiceEventType;
import dev.vality.magista.domain.enums.InvoicePaymentStatus;
import org.jooq.DatePart;
import org.jooq.Field;
import org.jooq.Query;
@ -18,7 +18,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import static com.rbkmoney.magista.domain.tables.PaymentData.PAYMENT_DATA;
import static dev.vality.magista.domain.tables.PaymentData.PAYMENT_DATA;
/**
* Created by vpankrashkin on 10.08.16.

View File

@ -1,4 +1,4 @@
package com.rbkmoney.magista.dao.impl.field;
package dev.vality.magista.dao.impl.field;
import org.jooq.Comparator;
import org.jooq.Field;

View File

@ -1,4 +1,4 @@
package com.rbkmoney.magista.dao.impl.field;
package dev.vality.magista.dao.impl.field;
import org.jooq.Comparator;
import org.jooq.Field;

View File

@ -1,4 +1,4 @@
package com.rbkmoney.magista.dao.impl.field;
package dev.vality.magista.dao.impl.field;
import org.jooq.Comparator;
import org.jooq.Condition;

View File

@ -1,4 +1,4 @@
package com.rbkmoney.magista.dao.impl.field;
package dev.vality.magista.dao.impl.field;
import org.jooq.Comparator;
import org.jooq.Field;

View File

@ -1,47 +1,47 @@
package com.rbkmoney.magista.dao.impl.mapper;
package dev.vality.magista.dao.impl.mapper;
import com.rbkmoney.damsel.domain.*;
import com.rbkmoney.damsel.merch_stat.BankCard;
import com.rbkmoney.damsel.merch_stat.CryptoCurrency;
import com.rbkmoney.damsel.merch_stat.CustomerPayer;
import com.rbkmoney.damsel.merch_stat.DigitalWallet;
import com.rbkmoney.damsel.merch_stat.InvoiceCancelled;
import com.rbkmoney.damsel.merch_stat.InvoiceFulfilled;
import com.rbkmoney.damsel.merch_stat.InvoicePaid;
import com.rbkmoney.damsel.merch_stat.InvoicePaymentCancelled;
import com.rbkmoney.damsel.merch_stat.InvoicePaymentCaptured;
import com.rbkmoney.damsel.merch_stat.InvoicePaymentChargedBack;
import com.rbkmoney.damsel.merch_stat.InvoicePaymentFailed;
import com.rbkmoney.damsel.merch_stat.InvoicePaymentFlow;
import com.rbkmoney.damsel.merch_stat.InvoicePaymentFlowHold;
import com.rbkmoney.damsel.merch_stat.InvoicePaymentFlowInstant;
import com.rbkmoney.damsel.merch_stat.InvoicePaymentPending;
import com.rbkmoney.damsel.merch_stat.InvoicePaymentProcessed;
import com.rbkmoney.damsel.merch_stat.InvoicePaymentRefundFailed;
import com.rbkmoney.damsel.merch_stat.InvoicePaymentRefundPending;
import com.rbkmoney.damsel.merch_stat.InvoicePaymentRefundStatus;
import com.rbkmoney.damsel.merch_stat.InvoicePaymentRefundSucceeded;
import com.rbkmoney.damsel.merch_stat.InvoicePaymentRefunded;
import com.rbkmoney.damsel.merch_stat.InvoicePaymentStatus;
import com.rbkmoney.damsel.merch_stat.InvoiceStatus;
import com.rbkmoney.damsel.merch_stat.InvoiceUnpaid;
import com.rbkmoney.damsel.merch_stat.MobileCommerce;
import com.rbkmoney.damsel.merch_stat.MobileOperator;
import com.rbkmoney.damsel.merch_stat.MobilePhone;
import com.rbkmoney.damsel.merch_stat.OnHoldExpiration;
import com.rbkmoney.damsel.merch_stat.OperationFailure;
import com.rbkmoney.damsel.merch_stat.Payer;
import com.rbkmoney.damsel.merch_stat.PaymentResourcePayer;
import com.rbkmoney.damsel.merch_stat.PaymentTerminal;
import com.rbkmoney.damsel.merch_stat.PaymentTool;
import com.rbkmoney.damsel.merch_stat.PayoutStatus;
import com.rbkmoney.damsel.merch_stat.RecurrentParentPayment;
import com.rbkmoney.damsel.merch_stat.RecurrentPayer;
import com.rbkmoney.damsel.merch_stat.*;
import com.rbkmoney.geck.common.util.TypeUtil;
import com.rbkmoney.magista.domain.enums.*;
import com.rbkmoney.magista.exception.NotFoundException;
import com.rbkmoney.magista.util.DamselUtil;
import dev.vality.damsel.domain.*;
import dev.vality.damsel.merch_stat.BankCard;
import dev.vality.damsel.merch_stat.CryptoCurrency;
import dev.vality.damsel.merch_stat.CustomerPayer;
import dev.vality.damsel.merch_stat.DigitalWallet;
import dev.vality.damsel.merch_stat.InvoiceCancelled;
import dev.vality.damsel.merch_stat.InvoiceFulfilled;
import dev.vality.damsel.merch_stat.InvoicePaid;
import dev.vality.damsel.merch_stat.InvoicePaymentCancelled;
import dev.vality.damsel.merch_stat.InvoicePaymentCaptured;
import dev.vality.damsel.merch_stat.InvoicePaymentChargedBack;
import dev.vality.damsel.merch_stat.InvoicePaymentFailed;
import dev.vality.damsel.merch_stat.InvoicePaymentFlow;
import dev.vality.damsel.merch_stat.InvoicePaymentFlowHold;
import dev.vality.damsel.merch_stat.InvoicePaymentFlowInstant;
import dev.vality.damsel.merch_stat.InvoicePaymentPending;
import dev.vality.damsel.merch_stat.InvoicePaymentProcessed;
import dev.vality.damsel.merch_stat.InvoicePaymentRefundFailed;
import dev.vality.damsel.merch_stat.InvoicePaymentRefundPending;
import dev.vality.damsel.merch_stat.InvoicePaymentRefundStatus;
import dev.vality.damsel.merch_stat.InvoicePaymentRefundSucceeded;
import dev.vality.damsel.merch_stat.InvoicePaymentRefunded;
import dev.vality.damsel.merch_stat.InvoicePaymentStatus;
import dev.vality.damsel.merch_stat.InvoiceStatus;
import dev.vality.damsel.merch_stat.InvoiceUnpaid;
import dev.vality.damsel.merch_stat.MobileCommerce;
import dev.vality.damsel.merch_stat.MobileOperator;
import dev.vality.damsel.merch_stat.MobilePhone;
import dev.vality.damsel.merch_stat.OnHoldExpiration;
import dev.vality.damsel.merch_stat.OperationFailure;
import dev.vality.damsel.merch_stat.Payer;
import dev.vality.damsel.merch_stat.PaymentResourcePayer;
import dev.vality.damsel.merch_stat.PaymentTerminal;
import dev.vality.damsel.merch_stat.PaymentTool;
import dev.vality.damsel.merch_stat.PayoutStatus;
import dev.vality.damsel.merch_stat.RecurrentParentPayment;
import dev.vality.damsel.merch_stat.RecurrentPayer;
import dev.vality.damsel.merch_stat.*;
import dev.vality.geck.common.util.TypeUtil;
import dev.vality.magista.domain.enums.*;
import dev.vality.magista.exception.NotFoundException;
import dev.vality.magista.util.DamselUtil;
import io.micrometer.core.instrument.util.StringUtils;
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;
@ -51,11 +51,11 @@ import java.sql.SQLException;
import java.time.LocalDateTime;
import java.util.Optional;
import static com.rbkmoney.magista.domain.Tables.CHARGEBACK_DATA;
import static com.rbkmoney.magista.domain.tables.InvoiceData.INVOICE_DATA;
import static com.rbkmoney.magista.domain.tables.PaymentData.PAYMENT_DATA;
import static com.rbkmoney.magista.domain.tables.Payout.PAYOUT;
import static com.rbkmoney.magista.domain.tables.RefundData.REFUND_DATA;
import static dev.vality.magista.domain.Tables.CHARGEBACK_DATA;
import static dev.vality.magista.domain.tables.InvoiceData.INVOICE_DATA;
import static dev.vality.magista.domain.tables.PaymentData.PAYMENT_DATA;
import static dev.vality.magista.domain.tables.Payout.PAYOUT;
import static dev.vality.magista.domain.tables.RefundData.REFUND_DATA;
@SuppressWarnings("DuplicatedCode")
@Deprecated
@ -63,7 +63,7 @@ import static com.rbkmoney.magista.domain.tables.RefundData.REFUND_DATA;
public class DeprecatedMapperHelper {
static InvoiceStatus mapInvoiceStatus(ResultSet rs,
com.rbkmoney.magista.domain.enums.InvoiceStatus invoiceStatusType,
dev.vality.magista.domain.enums.InvoiceStatus invoiceStatusType,
String eventCreatedAtString) throws SQLException {
InvoiceStatus invoiceStatus;
switch (invoiceStatusType) {
@ -92,9 +92,9 @@ public class DeprecatedMapperHelper {
}
static PaymentTool buildPaymentTool(ResultSet rs) throws SQLException {
com.rbkmoney.magista.domain.enums.PaymentTool paymentToolType = TypeUtil.toEnumField(
dev.vality.magista.domain.enums.PaymentTool paymentToolType = TypeUtil.toEnumField(
rs.getString(PAYMENT_DATA.PAYMENT_TOOL.getName()),
com.rbkmoney.magista.domain.enums.PaymentTool.class
dev.vality.magista.domain.enums.PaymentTool.class
);
switch (paymentToolType) {
@ -215,7 +215,7 @@ public class DeprecatedMapperHelper {
static InvoicePaymentStatus buildInvoicePaymentStatus(
ResultSet rs,
String eventCreatedAtString,
com.rbkmoney.magista.domain.enums.InvoicePaymentStatus invoicePaymentStatus) throws SQLException {
dev.vality.magista.domain.enums.InvoicePaymentStatus invoicePaymentStatus) throws SQLException {
InvoicePaymentStatus paymentStatus;
switch (invoicePaymentStatus) {
case pending -> paymentStatus = InvoicePaymentStatus.pending(new InvoicePaymentPending());
@ -264,7 +264,7 @@ public class DeprecatedMapperHelper {
static PayoutToolInfo toPayoutToolInfo(ResultSet rs) throws SQLException {
var payoutType = TypeUtil.toEnumField(rs.getString(PAYOUT.PAYOUT_TOOL_TYPE.getName()),
com.rbkmoney.magista.domain.enums.PayoutToolType.class);
dev.vality.magista.domain.enums.PayoutToolType.class);
return switch (payoutType) {
case russian_bank_account -> PayoutToolInfo.russian_bank_account(new RussianBankAccount()
.setAccount(rs.getString(PAYOUT.PAYOUT_TOOL_RUSSIAN_BANK_ACCOUNT_ACCOUNT.getName()))
@ -303,7 +303,7 @@ public class DeprecatedMapperHelper {
static PayoutStatus toPayoutStatus(ResultSet rs) throws SQLException {
var payoutStatus = TypeUtil.toEnumField(rs.getString(PAYOUT.STATUS.getName()),
com.rbkmoney.magista.domain.enums.PayoutStatus.class);
dev.vality.magista.domain.enums.PayoutStatus.class);
return switch (payoutStatus) {
case unpaid -> PayoutStatus.unpaid(new PayoutUnpaid());
case paid -> PayoutStatus.paid(new PayoutPaid());

View File

@ -1,8 +1,8 @@
package com.rbkmoney.magista.dao.impl.mapper;
package dev.vality.magista.dao.impl.mapper;
import com.rbkmoney.damsel.base.Content;
import com.rbkmoney.damsel.merch_stat.StatChargeback;
import com.rbkmoney.geck.common.util.TypeUtil;
import dev.vality.damsel.base.Content;
import dev.vality.damsel.merch_stat.StatChargeback;
import dev.vality.geck.common.util.TypeUtil;
import org.springframework.jdbc.core.RowMapper;
import java.sql.ResultSet;
@ -11,7 +11,7 @@ import java.time.LocalDateTime;
import java.util.AbstractMap;
import java.util.Map;
import static com.rbkmoney.magista.domain.Tables.CHARGEBACK_DATA;
import static dev.vality.magista.domain.Tables.CHARGEBACK_DATA;
@Deprecated
public class DeprecatedStatChargebackMapper implements RowMapper<Map.Entry<Long, StatChargeback>> {
@ -31,13 +31,13 @@ public class DeprecatedStatChargebackMapper implements RowMapper<Map.Entry<Long,
)
.setChargebackReason(DeprecatedMapperHelper.toInvoicePaymentChargebackReason(rs))
.setLevyAmount(rs.getLong(CHARGEBACK_DATA.CHARGEBACK_LEVY_AMOUNT.getName()))
.setLevyCurrencyCode(new com.rbkmoney.damsel.domain.Currency()
.setLevyCurrencyCode(new dev.vality.damsel.domain.Currency()
.setName(rs.getString(CHARGEBACK_DATA.CHARGEBACK_LEVY_CURRENCY_CODE.getName()))
.setNumericCode((short) 0)
.setExponent((short) 0)
.setSymbolicCode(rs.getString(CHARGEBACK_DATA.CHARGEBACK_LEVY_CURRENCY_CODE.getName())))
.setAmount(rs.getLong(CHARGEBACK_DATA.CHARGEBACK_AMOUNT.getName()))
.setCurrencyCode(new com.rbkmoney.damsel.domain.Currency()
.setCurrencyCode(new dev.vality.damsel.domain.Currency()
.setName(rs.getString(CHARGEBACK_DATA.CHARGEBACK_CURRENCY_CODE.getName()))
.setNumericCode((short) 0)
.setExponent((short) 0)

View File

@ -1,11 +1,11 @@
package com.rbkmoney.magista.dao.impl.mapper;
package dev.vality.magista.dao.impl.mapper;
import com.rbkmoney.damsel.base.Content;
import com.rbkmoney.damsel.domain.InvoiceCart;
import com.rbkmoney.damsel.merch_stat.InvoiceStatus;
import com.rbkmoney.damsel.merch_stat.StatInvoice;
import com.rbkmoney.geck.common.util.TypeUtil;
import com.rbkmoney.magista.util.DamselUtil;
import dev.vality.damsel.base.Content;
import dev.vality.damsel.domain.InvoiceCart;
import dev.vality.damsel.merch_stat.InvoiceStatus;
import dev.vality.damsel.merch_stat.StatInvoice;
import dev.vality.geck.common.util.TypeUtil;
import dev.vality.magista.util.DamselUtil;
import org.springframework.jdbc.core.RowMapper;
import java.nio.ByteBuffer;
@ -15,7 +15,7 @@ import java.time.LocalDateTime;
import java.util.AbstractMap;
import java.util.Map;
import static com.rbkmoney.magista.domain.tables.InvoiceData.INVOICE_DATA;
import static dev.vality.magista.domain.tables.InvoiceData.INVOICE_DATA;
@Deprecated
public class DeprecatedStatInvoiceMapper implements RowMapper<Map.Entry<Long, StatInvoice>> {
@ -42,9 +42,9 @@ public class DeprecatedStatInvoiceMapper implements RowMapper<Map.Entry<Long, St
)
);
com.rbkmoney.magista.domain.enums.InvoiceStatus invoiceStatusType = TypeUtil.toEnumField(
dev.vality.magista.domain.enums.InvoiceStatus invoiceStatusType = TypeUtil.toEnumField(
rs.getString(INVOICE_DATA.INVOICE_STATUS.getName()),
com.rbkmoney.magista.domain.enums.InvoiceStatus.class
dev.vality.magista.domain.enums.InvoiceStatus.class
);
String eventCreatedAtString = TypeUtil.temporalToString(

View File

@ -1,14 +1,14 @@
package com.rbkmoney.magista.dao.impl.mapper;
package dev.vality.magista.dao.impl.mapper;
import com.rbkmoney.damsel.base.Content;
import com.rbkmoney.damsel.domain.AdditionalTransactionInfo;
import com.rbkmoney.damsel.domain.ProviderRef;
import com.rbkmoney.damsel.domain.TerminalRef;
import com.rbkmoney.damsel.merch_stat.InvoicePaymentStatus;
import com.rbkmoney.damsel.merch_stat.StatPayment;
import com.rbkmoney.geck.common.util.TBaseUtil;
import com.rbkmoney.geck.common.util.TypeUtil;
import com.rbkmoney.magista.domain.enums.PaymentFlow;
import dev.vality.damsel.base.Content;
import dev.vality.damsel.domain.AdditionalTransactionInfo;
import dev.vality.damsel.domain.ProviderRef;
import dev.vality.damsel.domain.TerminalRef;
import dev.vality.damsel.merch_stat.InvoicePaymentStatus;
import dev.vality.damsel.merch_stat.StatPayment;
import dev.vality.geck.common.util.TBaseUtil;
import dev.vality.geck.common.util.TypeUtil;
import dev.vality.magista.domain.enums.PaymentFlow;
import org.springframework.jdbc.core.RowMapper;
import java.nio.ByteBuffer;
@ -18,7 +18,7 @@ import java.time.LocalDateTime;
import java.util.AbstractMap;
import java.util.Map;
import static com.rbkmoney.magista.domain.tables.PaymentData.PAYMENT_DATA;
import static dev.vality.magista.domain.tables.PaymentData.PAYMENT_DATA;
@Deprecated
public class DeprecatedStatPaymentMapper implements RowMapper<Map.Entry<Long, StatPayment>> {
@ -43,9 +43,9 @@ public class DeprecatedStatPaymentMapper implements RowMapper<Map.Entry<Long, St
String eventCreatedAtString = TypeUtil.temporalToString(
rs.getObject(PAYMENT_DATA.EVENT_CREATED_AT.getName(), LocalDateTime.class)
);
com.rbkmoney.magista.domain.enums.InvoicePaymentStatus invoicePaymentStatus = TypeUtil.toEnumField(
dev.vality.magista.domain.enums.InvoicePaymentStatus invoicePaymentStatus = TypeUtil.toEnumField(
rs.getString(PAYMENT_DATA.PAYMENT_STATUS.getName()),
com.rbkmoney.magista.domain.enums.InvoicePaymentStatus.class
dev.vality.magista.domain.enums.InvoicePaymentStatus.class
);
InvoicePaymentStatus paymentStatus;

View File

@ -1,7 +1,7 @@
package com.rbkmoney.magista.dao.impl.mapper;
package dev.vality.magista.dao.impl.mapper;
import com.rbkmoney.damsel.merch_stat.StatPayout;
import com.rbkmoney.geck.common.util.TypeUtil;
import dev.vality.damsel.merch_stat.StatPayout;
import dev.vality.geck.common.util.TypeUtil;
import org.springframework.jdbc.core.RowMapper;
import java.sql.ResultSet;
@ -10,7 +10,7 @@ import java.time.LocalDateTime;
import java.util.AbstractMap;
import java.util.Map;
import static com.rbkmoney.magista.domain.tables.Payout.PAYOUT;
import static dev.vality.magista.domain.tables.Payout.PAYOUT;
@Deprecated
public class DeprecatedStatPayoutMapper implements RowMapper<Map.Entry<Long, StatPayout>> {

View File

@ -1,7 +1,7 @@
package com.rbkmoney.magista.dao.impl.mapper;
package dev.vality.magista.dao.impl.mapper;
import com.rbkmoney.damsel.merch_stat.StatRefund;
import com.rbkmoney.geck.common.util.TypeUtil;
import dev.vality.damsel.merch_stat.StatRefund;
import dev.vality.geck.common.util.TypeUtil;
import org.springframework.jdbc.core.RowMapper;
import java.sql.ResultSet;
@ -10,7 +10,7 @@ import java.time.LocalDateTime;
import java.util.AbstractMap;
import java.util.Map;
import static com.rbkmoney.magista.domain.tables.RefundData.REFUND_DATA;
import static dev.vality.magista.domain.tables.RefundData.REFUND_DATA;
@Deprecated
public class DeprecatedStatRefundMapper implements RowMapper<Map.Entry<Long, StatRefund>> {

View File

@ -1,22 +1,21 @@
package com.rbkmoney.magista.dao.impl.mapper;
package dev.vality.magista.dao.impl.mapper;
import com.rbkmoney.damsel.domain.*;
import com.rbkmoney.damsel.domain.InvoicePaymentRefundStatus;
import com.rbkmoney.damsel.domain.InvoicePaymentStatus;
import com.rbkmoney.damsel.domain.PaymentTool;
import com.rbkmoney.geck.common.util.TypeUtil;
import com.rbkmoney.magista.CustomerPayer;
import com.rbkmoney.magista.InvoicePaymentFlow;
import com.rbkmoney.magista.InvoicePaymentFlowHold;
import com.rbkmoney.magista.InvoicePaymentFlowInstant;
import com.rbkmoney.magista.OnHoldExpiration;
import com.rbkmoney.magista.Payer;
import com.rbkmoney.magista.PayoutStatus;
import com.rbkmoney.magista.*;
import com.rbkmoney.magista.domain.enums.*;
import com.rbkmoney.magista.exception.NotFoundException;
import com.rbkmoney.magista.util.DamselUtil;
import io.micrometer.core.instrument.util.StringUtils;
import dev.vality.damsel.domain.InvoicePaymentRefundStatus;
import dev.vality.damsel.domain.InvoicePaymentStatus;
import dev.vality.damsel.domain.PaymentTool;
import dev.vality.damsel.domain.*;
import dev.vality.geck.common.util.TypeUtil;
import dev.vality.magista.CustomerPayer;
import dev.vality.magista.InvoicePaymentFlow;
import dev.vality.magista.InvoicePaymentFlowHold;
import dev.vality.magista.InvoicePaymentFlowInstant;
import dev.vality.magista.OnHoldExpiration;
import dev.vality.magista.Payer;
import dev.vality.magista.PayoutStatus;
import dev.vality.magista.*;
import dev.vality.magista.domain.enums.*;
import dev.vality.magista.exception.NotFoundException;
import dev.vality.magista.util.DamselUtil;
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;
@ -25,24 +24,24 @@ import java.sql.SQLException;
import java.time.LocalDateTime;
import java.util.Optional;
import static com.rbkmoney.magista.domain.Tables.CHARGEBACK_DATA;
import static com.rbkmoney.magista.domain.tables.InvoiceData.INVOICE_DATA;
import static com.rbkmoney.magista.domain.tables.PaymentData.PAYMENT_DATA;
import static com.rbkmoney.magista.domain.tables.Payout.PAYOUT;
import static com.rbkmoney.magista.domain.tables.RefundData.REFUND_DATA;
import static dev.vality.magista.domain.Tables.CHARGEBACK_DATA;
import static dev.vality.magista.domain.tables.InvoiceData.INVOICE_DATA;
import static dev.vality.magista.domain.tables.PaymentData.PAYMENT_DATA;
import static dev.vality.magista.domain.tables.Payout.PAYOUT;
import static dev.vality.magista.domain.tables.RefundData.REFUND_DATA;
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public class MapperHelper {
static com.rbkmoney.damsel.domain.InvoiceStatus mapInvoiceStatus(
static dev.vality.damsel.domain.InvoiceStatus mapInvoiceStatus(
ResultSet rs,
com.rbkmoney.magista.domain.enums.InvoiceStatus invoiceStatusType) throws SQLException {
dev.vality.magista.domain.enums.InvoiceStatus invoiceStatusType) throws SQLException {
return switch (invoiceStatusType) {
case cancelled -> com.rbkmoney.damsel.domain.InvoiceStatus.cancelled(new InvoiceCancelled()
case cancelled -> dev.vality.damsel.domain.InvoiceStatus.cancelled(new InvoiceCancelled()
.setDetails(rs.getString(INVOICE_DATA.INVOICE_STATUS_DETAILS.getName())));
case unpaid -> com.rbkmoney.damsel.domain.InvoiceStatus.unpaid(new InvoiceUnpaid());
case paid -> com.rbkmoney.damsel.domain.InvoiceStatus.paid(new InvoicePaid());
case fulfilled -> com.rbkmoney.damsel.domain.InvoiceStatus.fulfilled(new InvoiceFulfilled()
case unpaid -> dev.vality.damsel.domain.InvoiceStatus.unpaid(new InvoiceUnpaid());
case paid -> dev.vality.damsel.domain.InvoiceStatus.paid(new InvoicePaid());
case fulfilled -> dev.vality.damsel.domain.InvoiceStatus.fulfilled(new InvoiceFulfilled()
.setDetails(rs.getString(INVOICE_DATA.INVOICE_STATUS_DETAILS.getName())));
default -> throw new NotFoundException(
String.format("Invoice status '%s' not found", invoiceStatusType.getLiteral()));
@ -52,7 +51,7 @@ public class MapperHelper {
static PaymentTool buildPaymentTool(ResultSet rs) throws SQLException {
var paymentToolType = TypeUtil.toEnumField(
rs.getString(PAYMENT_DATA.PAYMENT_TOOL.getName()),
com.rbkmoney.magista.domain.enums.PaymentTool.class
dev.vality.magista.domain.enums.PaymentTool.class
);
return switch (paymentToolType) {
@ -179,7 +178,7 @@ public class MapperHelper {
static InvoicePaymentStatus buildInvoicePaymentStatus(
ResultSet rs,
com.rbkmoney.magista.domain.enums.InvoicePaymentStatus invoicePaymentStatus) throws SQLException {
dev.vality.magista.domain.enums.InvoicePaymentStatus invoicePaymentStatus) throws SQLException {
return switch (invoicePaymentStatus) {
case pending -> InvoicePaymentStatus.pending(new InvoicePaymentPending());
case cancelled -> InvoicePaymentStatus.cancelled(new InvoicePaymentCancelled());
@ -201,7 +200,7 @@ public class MapperHelper {
static PayoutToolInfo toPayoutToolInfo(ResultSet rs) throws SQLException {
var payoutType = TypeUtil.toEnumField(rs.getString(PAYOUT.PAYOUT_TOOL_TYPE.getName()),
com.rbkmoney.magista.domain.enums.PayoutToolType.class);
dev.vality.magista.domain.enums.PayoutToolType.class);
return switch (payoutType) {
case russian_bank_account -> PayoutToolInfo.russian_bank_account(new RussianBankAccount()
.setAccount(rs.getString(PAYOUT.PAYOUT_TOOL_RUSSIAN_BANK_ACCOUNT_ACCOUNT.getName()))
@ -242,7 +241,7 @@ public class MapperHelper {
static PayoutStatus toPayoutStatus(ResultSet rs) throws SQLException {
var payoutStatus = TypeUtil.toEnumField(rs.getString(PAYOUT.STATUS.getName()),
com.rbkmoney.magista.domain.enums.PayoutStatus.class);
dev.vality.magista.domain.enums.PayoutStatus.class);
return switch (payoutStatus) {
case unpaid -> PayoutStatus.unpaid(new PayoutUnpaid());
case paid -> PayoutStatus.paid(new PayoutPaid());

View File

@ -1,6 +1,6 @@
package com.rbkmoney.magista.dao.impl.mapper;
package dev.vality.magista.dao.impl.mapper;
import com.rbkmoney.geck.common.util.TypeUtil;
import dev.vality.geck.common.util.TypeUtil;
import org.jooq.Field;
import org.jooq.Table;
import org.jooq.TableRecord;

View File

@ -1,15 +1,15 @@
package com.rbkmoney.magista.dao.impl.mapper;
package dev.vality.magista.dao.impl.mapper;
import com.rbkmoney.damsel.base.Content;
import com.rbkmoney.geck.common.util.TypeUtil;
import com.rbkmoney.magista.StatChargeback;
import dev.vality.damsel.base.Content;
import dev.vality.geck.common.util.TypeUtil;
import dev.vality.magista.StatChargeback;
import org.springframework.jdbc.core.RowMapper;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDateTime;
import static com.rbkmoney.magista.domain.Tables.CHARGEBACK_DATA;
import static dev.vality.magista.domain.Tables.CHARGEBACK_DATA;
public class StatChargebackMapper implements RowMapper<StatChargeback> {
@ -28,13 +28,13 @@ public class StatChargebackMapper implements RowMapper<StatChargeback> {
)
.setChargebackReason(MapperHelper.toInvoicePaymentChargebackReason(rs))
.setLevyAmount(rs.getLong(CHARGEBACK_DATA.CHARGEBACK_LEVY_AMOUNT.getName()))
.setLevyCurrencyCode(new com.rbkmoney.damsel.domain.Currency()
.setLevyCurrencyCode(new dev.vality.damsel.domain.Currency()
.setName(rs.getString(CHARGEBACK_DATA.CHARGEBACK_LEVY_CURRENCY_CODE.getName()))
.setNumericCode((short) 0)
.setExponent((short) 0)
.setSymbolicCode(rs.getString(CHARGEBACK_DATA.CHARGEBACK_LEVY_CURRENCY_CODE.getName())))
.setAmount(rs.getLong(CHARGEBACK_DATA.CHARGEBACK_AMOUNT.getName()))
.setCurrencyCode(new com.rbkmoney.damsel.domain.Currency()
.setCurrencyCode(new dev.vality.damsel.domain.Currency()
.setName(rs.getString(CHARGEBACK_DATA.CHARGEBACK_CURRENCY_CODE.getName()))
.setNumericCode((short) 0)
.setExponent((short) 0)

View File

@ -1,11 +1,10 @@
package com.rbkmoney.magista.dao.impl.mapper;
package dev.vality.magista.dao.impl.mapper;
import com.rbkmoney.damsel.base.Content;
import com.rbkmoney.damsel.domain.InvoiceCart;
import com.rbkmoney.geck.common.util.TypeUtil;
import com.rbkmoney.magista.InvoiceStatus;
import com.rbkmoney.magista.StatInvoice;
import com.rbkmoney.magista.util.DamselUtil;
import dev.vality.damsel.base.Content;
import dev.vality.damsel.domain.InvoiceCart;
import dev.vality.geck.common.util.TypeUtil;
import dev.vality.magista.StatInvoice;
import dev.vality.magista.util.DamselUtil;
import org.springframework.jdbc.core.RowMapper;
import java.nio.ByteBuffer;
@ -13,7 +12,7 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDateTime;
import static com.rbkmoney.magista.domain.tables.InvoiceData.INVOICE_DATA;
import static dev.vality.magista.domain.tables.InvoiceData.INVOICE_DATA;
public class StatInvoiceMapper implements RowMapper<StatInvoice> {
@ -39,9 +38,9 @@ public class StatInvoiceMapper implements RowMapper<StatInvoice> {
)
);
com.rbkmoney.magista.domain.enums.InvoiceStatus invoiceStatusType = TypeUtil.toEnumField(
dev.vality.magista.domain.enums.InvoiceStatus invoiceStatusType = TypeUtil.toEnumField(
rs.getString(INVOICE_DATA.INVOICE_STATUS.getName()),
com.rbkmoney.magista.domain.enums.InvoiceStatus.class
dev.vality.magista.domain.enums.InvoiceStatus.class
);
statInvoice.setStatusChangedAt(

View File

@ -1,21 +1,21 @@
package com.rbkmoney.magista.dao.impl.mapper;
package dev.vality.magista.dao.impl.mapper;
import com.rbkmoney.damsel.base.Content;
import com.rbkmoney.damsel.domain.InvoiceCart;
import com.rbkmoney.damsel.domain.InvoiceTemplateDetails;
import com.rbkmoney.damsel.domain.InvoiceTemplateProduct;
import com.rbkmoney.geck.common.util.TypeUtil;
import com.rbkmoney.magista.InvoiceTemplateStatus;
import com.rbkmoney.magista.StatInvoiceTemplate;
import com.rbkmoney.magista.domain.enums.InvoiceTemplateEventType;
import com.rbkmoney.magista.util.DamselUtil;
import dev.vality.damsel.base.Content;
import dev.vality.damsel.domain.InvoiceCart;
import dev.vality.damsel.domain.InvoiceTemplateDetails;
import dev.vality.damsel.domain.InvoiceTemplateProduct;
import dev.vality.geck.common.util.TypeUtil;
import dev.vality.magista.InvoiceTemplateStatus;
import dev.vality.magista.StatInvoiceTemplate;
import dev.vality.magista.domain.enums.InvoiceTemplateEventType;
import dev.vality.magista.util.DamselUtil;
import org.springframework.jdbc.core.RowMapper;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDateTime;
import static com.rbkmoney.magista.domain.tables.InvoiceTemplate.INVOICE_TEMPLATE;
import static dev.vality.magista.domain.tables.InvoiceTemplate.INVOICE_TEMPLATE;
public class StatInvoiceTemplateMapper implements RowMapper<StatInvoiceTemplate> {

View File

@ -1,14 +1,13 @@
package com.rbkmoney.magista.dao.impl.mapper;
package dev.vality.magista.dao.impl.mapper;
import com.rbkmoney.damsel.base.Content;
import com.rbkmoney.damsel.domain.AdditionalTransactionInfo;
import com.rbkmoney.damsel.domain.ProviderRef;
import com.rbkmoney.damsel.domain.TerminalRef;
import com.rbkmoney.geck.common.util.TBaseUtil;
import com.rbkmoney.geck.common.util.TypeUtil;
import com.rbkmoney.magista.InvoicePaymentStatus;
import com.rbkmoney.magista.StatPayment;
import com.rbkmoney.magista.domain.enums.PaymentFlow;
import dev.vality.damsel.base.Content;
import dev.vality.damsel.domain.AdditionalTransactionInfo;
import dev.vality.damsel.domain.ProviderRef;
import dev.vality.damsel.domain.TerminalRef;
import dev.vality.geck.common.util.TBaseUtil;
import dev.vality.geck.common.util.TypeUtil;
import dev.vality.magista.StatPayment;
import dev.vality.magista.domain.enums.PaymentFlow;
import org.springframework.jdbc.core.RowMapper;
import java.nio.ByteBuffer;
@ -16,7 +15,7 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDateTime;
import static com.rbkmoney.magista.domain.tables.PaymentData.PAYMENT_DATA;
import static dev.vality.magista.domain.tables.PaymentData.PAYMENT_DATA;
public class StatPaymentMapper implements RowMapper<StatPayment> {
@ -40,9 +39,9 @@ public class StatPaymentMapper implements RowMapper<StatPayment> {
statPayment.setStatusChangedAt(
TypeUtil.temporalToString(rs.getObject(PAYMENT_DATA.EVENT_CREATED_AT.getName(), LocalDateTime.class))
);
com.rbkmoney.magista.domain.enums.InvoicePaymentStatus invoicePaymentStatus = TypeUtil.toEnumField(
dev.vality.magista.domain.enums.InvoicePaymentStatus invoicePaymentStatus = TypeUtil.toEnumField(
rs.getString(PAYMENT_DATA.PAYMENT_STATUS.getName()),
com.rbkmoney.magista.domain.enums.InvoicePaymentStatus.class
dev.vality.magista.domain.enums.InvoicePaymentStatus.class
);
statPayment.setStatus(MapperHelper.buildInvoicePaymentStatus(rs, invoicePaymentStatus));

View File

@ -1,14 +1,14 @@
package com.rbkmoney.magista.dao.impl.mapper;
package dev.vality.magista.dao.impl.mapper;
import com.rbkmoney.geck.common.util.TypeUtil;
import com.rbkmoney.magista.StatPayout;
import dev.vality.geck.common.util.TypeUtil;
import dev.vality.magista.StatPayout;
import org.springframework.jdbc.core.RowMapper;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDateTime;
import static com.rbkmoney.magista.domain.tables.Payout.PAYOUT;
import static dev.vality.magista.domain.tables.Payout.PAYOUT;
public class StatPayoutMapper implements RowMapper<StatPayout> {

View File

@ -1,14 +1,14 @@
package com.rbkmoney.magista.dao.impl.mapper;
package dev.vality.magista.dao.impl.mapper;
import com.rbkmoney.geck.common.util.TypeUtil;
import com.rbkmoney.magista.StatRefund;
import dev.vality.geck.common.util.TypeUtil;
import dev.vality.magista.StatRefund;
import org.springframework.jdbc.core.RowMapper;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDateTime;
import static com.rbkmoney.magista.domain.tables.RefundData.REFUND_DATA;
import static dev.vality.magista.domain.tables.RefundData.REFUND_DATA;
public class StatRefundMapper implements RowMapper<StatRefund> {

View File

@ -1,7 +1,7 @@
package com.rbkmoney.magista.endpoint;
package dev.vality.magista.endpoint;
import com.rbkmoney.damsel.merch_stat.DarkMessiahStatisticsSrv;
import com.rbkmoney.woody.thrift.impl.http.THServiceBuilder;
import dev.vality.damsel.merch_stat.DarkMessiahStatisticsSrv;
import dev.vality.woody.thrift.impl.http.THServiceBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.*;

View File

@ -1,7 +1,7 @@
package com.rbkmoney.magista.endpoint;
package dev.vality.magista.endpoint;
import com.rbkmoney.damsel.merch_stat.MerchantStatisticsSrv;
import com.rbkmoney.woody.thrift.impl.http.THServiceBuilder;
import dev.vality.damsel.merch_stat.MerchantStatisticsSrv;
import dev.vality.woody.thrift.impl.http.THServiceBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.*;

View File

@ -1,7 +1,7 @@
package com.rbkmoney.magista.endpoint;
package dev.vality.magista.endpoint;
import com.rbkmoney.magista.MerchantStatisticsServiceSrv;
import com.rbkmoney.woody.thrift.impl.http.THServiceBuilder;
import dev.vality.magista.MerchantStatisticsServiceSrv;
import dev.vality.woody.thrift.impl.http.THServiceBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.*;

View File

@ -0,0 +1,7 @@
package dev.vality.magista.endpoint;
import dev.vality.damsel.merch_stat.DarkMessiahStatisticsSrv;
import dev.vality.damsel.merch_stat.MerchantStatisticsSrv;
public interface StatisticsServletIface extends MerchantStatisticsSrv.Iface, DarkMessiahStatisticsSrv.Iface {
}

View File

@ -1,10 +1,10 @@
package com.rbkmoney.magista.event;
package dev.vality.magista.event;
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;
/**
* Created by tolkonepiu on 10/11/2016.

View File

@ -1,4 +1,4 @@
package com.rbkmoney.magista.event;
package dev.vality.magista.event;
/**
* Created by tolkonepiu on 10/11/2016.

View File

@ -1,7 +1,7 @@
package com.rbkmoney.magista.event;
package dev.vality.magista.event;
import com.rbkmoney.magista.exception.NotFoundException;
import com.rbkmoney.magista.exception.StorageException;
import dev.vality.magista.exception.NotFoundException;
import dev.vality.magista.exception.StorageException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -1,4 +1,4 @@
package com.rbkmoney.magista.event;
package dev.vality.magista.event;
/**
* Created by tolkonepiu on 17/11/2016.

View File

@ -1,7 +1,7 @@
package com.rbkmoney.magista.event.handler;
package dev.vality.magista.event.handler;
import com.rbkmoney.magista.event.Processor;
import com.rbkmoney.magista.event.mapper.Mapper;
import dev.vality.magista.event.Processor;
import dev.vality.magista.event.mapper.Mapper;
import java.util.List;
import java.util.Map;

View File

@ -1,4 +1,4 @@
package com.rbkmoney.magista.event.handler;
package dev.vality.magista.event.handler;
public interface Handler<T, E> {

View File

@ -0,0 +1,7 @@
package dev.vality.magista.event.handler;
import dev.vality.payout.manager.Event;
import dev.vality.payout.manager.PayoutChange;
public interface PayoutHandler extends Handler<PayoutChange, Event> {
}

View File

@ -1,12 +1,12 @@
package com.rbkmoney.magista.event.handler.impl;
package dev.vality.magista.event.handler.impl;
import com.rbkmoney.damsel.payment_processing.InvoiceChange;
import com.rbkmoney.machinegun.eventsink.MachineEvent;
import com.rbkmoney.magista.domain.tables.pojos.AdjustmentData;
import com.rbkmoney.magista.event.Processor;
import com.rbkmoney.magista.event.handler.BatchHandler;
import com.rbkmoney.magista.event.mapper.AdjustmentMapper;
import com.rbkmoney.magista.service.PaymentAdjustmentService;
import dev.vality.damsel.payment_processing.InvoiceChange;
import dev.vality.machinegun.eventsink.MachineEvent;
import dev.vality.magista.domain.tables.pojos.AdjustmentData;
import dev.vality.magista.event.Processor;
import dev.vality.magista.event.handler.BatchHandler;
import dev.vality.magista.event.mapper.AdjustmentMapper;
import dev.vality.magista.service.PaymentAdjustmentService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

View File

@ -1,12 +1,12 @@
package com.rbkmoney.magista.event.handler.impl;
package dev.vality.magista.event.handler.impl;
import com.rbkmoney.damsel.payment_processing.InvoiceChange;
import com.rbkmoney.machinegun.eventsink.MachineEvent;
import com.rbkmoney.magista.domain.tables.pojos.ChargebackData;
import com.rbkmoney.magista.event.Processor;
import com.rbkmoney.magista.event.handler.BatchHandler;
import com.rbkmoney.magista.event.mapper.ChargebackMapper;
import com.rbkmoney.magista.service.PaymentChargebackService;
import dev.vality.damsel.payment_processing.InvoiceChange;
import dev.vality.machinegun.eventsink.MachineEvent;
import dev.vality.magista.domain.tables.pojos.ChargebackData;
import dev.vality.magista.event.Processor;
import dev.vality.magista.event.handler.BatchHandler;
import dev.vality.magista.event.mapper.ChargebackMapper;
import dev.vality.magista.service.PaymentChargebackService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

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