TD-325: bump protos (#43)

This commit is contained in:
Anatoly Karlov 2022-06-30 15:49:16 +07:00 committed by GitHub
parent 39c863382b
commit 35fa9e4707
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 67 additions and 119 deletions

18
pom.xml
View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>dev.vality</groupId> <groupId>dev.vality</groupId>
<artifactId>service-parent-pom</artifactId> <artifactId>service-parent-pom</artifactId>
<version>1.0.16</version> <version>1.0.17</version>
</parent> </parent>
<artifactId>anapi-v2</artifactId> <artifactId>anapi-v2</artifactId>
@ -43,7 +43,7 @@
<dependency> <dependency>
<groupId>dev.vality</groupId> <groupId>dev.vality</groupId>
<artifactId>swag-anapi-v2</artifactId> <artifactId>swag-anapi-v2</artifactId>
<version>1.71-048ff68-server</version> <version>1.76-ec7a406-server</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>dev.vality</groupId> <groupId>dev.vality</groupId>
@ -63,7 +63,7 @@
<dependency> <dependency>
<groupId>dev.vality</groupId> <groupId>dev.vality</groupId>
<artifactId>magista-proto</artifactId> <artifactId>magista-proto</artifactId>
<version>1.37-ba389d1</version> <version>1.44-5352f74</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>dev.vality</groupId> <groupId>dev.vality</groupId>
@ -80,26 +80,22 @@
<artifactId>reporter-proto</artifactId> <artifactId>reporter-proto</artifactId>
<version>1.16-cc187f5</version> <version>1.16-cc187f5</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>dev.vality.geck</groupId> <groupId>dev.vality.geck</groupId>
<artifactId>serializer</artifactId> <artifactId>serializer</artifactId>
<version>0.0.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>dev.vality</groupId> <groupId>dev.vality</groupId>
<artifactId>damsel</artifactId> <artifactId>damsel</artifactId>
<version>1.558-3efe7df</version> <version>1.566-03bbf48</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>dev.vality.woody</groupId> <groupId>dev.vality.woody</groupId>
<artifactId>woody-thrift</artifactId> <artifactId>woody-thrift</artifactId>
<version>${woody.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>dev.vality.woody</groupId> <groupId>dev.vality.woody</groupId>
<artifactId>woody-api</artifactId> <artifactId>woody-api</artifactId>
<version>${woody.version}</version>
</dependency> </dependency>
<!--spring--> <!--spring-->
@ -263,6 +259,12 @@
<version>0.9.1</version> <version>0.9.1</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8-standalone</artifactId>
<version>2.33.2</version>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-contract-wiremock</artifactId> <artifactId>spring-cloud-contract-wiremock</artifactId>

View File

@ -3,9 +3,9 @@ package dev.vality.anapi.v2.converter.magista.request;
import dev.vality.anapi.v2.exception.BadRequestException; import dev.vality.anapi.v2.exception.BadRequestException;
import dev.vality.anapi.v2.model.PaymentStatus; import dev.vality.anapi.v2.model.PaymentStatus;
import dev.vality.anapi.v2.util.ConverterUtil; import dev.vality.anapi.v2.util.ConverterUtil;
import dev.vality.damsel.domain.LegacyBankCardPaymentSystem; import dev.vality.damsel.domain.BankCardTokenServiceRef;
import dev.vality.damsel.domain.LegacyBankCardTokenProvider; import dev.vality.damsel.domain.PaymentServiceRef;
import dev.vality.damsel.domain.LegacyTerminalPaymentProvider; import dev.vality.damsel.domain.PaymentSystemRef;
import dev.vality.magista.*; import dev.vality.magista.*;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -57,9 +57,9 @@ public class ParamsToPaymentSearchQueryConverter {
.setPaymentTool(paymentMethod != null ? mapPaymentTool(paymentMethod) : null) .setPaymentTool(paymentMethod != null ? mapPaymentTool(paymentMethod) : null)
.setPaymentFlow(paymentFlow != null ? mapInvoicePaymentFlow(paymentFlow) : null) .setPaymentFlow(paymentFlow != null ? mapInvoicePaymentFlow(paymentFlow) : null)
.setPaymentTerminalProvider( .setPaymentTerminalProvider(
paymentTerminalProvider != null ? mapTerminalProvider(paymentTerminalProvider) : null) paymentTerminalProvider != null ? new PaymentServiceRef(paymentTerminalProvider) : null)
.setPaymentTokenProvider( .setPaymentTokenProvider(
bankCardTokenProvider != null ? mapTokenProvider(bankCardTokenProvider) : null) bankCardTokenProvider != null ? new BankCardTokenServiceRef(bankCardTokenProvider) : null)
.setPaymentEmail(payerEmail) .setPaymentEmail(payerEmail)
.setPaymentApprovalCode(approvalCode) .setPaymentApprovalCode(approvalCode)
.setPaymentCustomerId(customerID) .setPaymentCustomerId(customerID)
@ -70,8 +70,7 @@ public class ParamsToPaymentSearchQueryConverter {
.setPaymentIp(payerIP) .setPaymentIp(payerIP)
.setPaymentRrn(rrn) .setPaymentRrn(rrn)
.setPaymentStatus(paymentStatus != null ? mapStatus(paymentStatus) : null) .setPaymentStatus(paymentStatus != null ? mapStatus(paymentStatus) : null)
.setPaymentSystem(bankCardPaymentSystem != null .setPaymentSystem(bankCardPaymentSystem != null ? new PaymentSystemRef(bankCardPaymentSystem) : null);
? mapPaymentSystem(bankCardPaymentSystem) : null);
if (paymentAmountFrom != null) { if (paymentAmountFrom != null) {
paymentParams.setPaymentAmountFrom(paymentAmountFrom); paymentParams.setPaymentAmountFrom(paymentAmountFrom);
} }
@ -82,31 +81,6 @@ public class ParamsToPaymentSearchQueryConverter {
return query; return query;
} }
protected LegacyTerminalPaymentProvider mapTerminalProvider(String provider) {
try {
return LegacyTerminalPaymentProvider.valueOf(provider);
} catch (IllegalArgumentException e) {
throw new BadRequestException(String.format("Terminal provider %s cannot be processed", provider));
}
}
protected LegacyBankCardTokenProvider mapTokenProvider(String provider) {
try {
return LegacyBankCardTokenProvider.valueOf(provider);
} catch (IllegalArgumentException e) {
throw new BadRequestException(String.format("Token provider %s cannot be processed", provider));
}
}
protected LegacyBankCardPaymentSystem mapPaymentSystem(String system) {
try {
return LegacyBankCardPaymentSystem.valueOf(system);
} catch (IllegalArgumentException e) {
throw new BadRequestException(
String.format("Payment system %s cannot be processed", system));
}
}
protected PaymentToolType mapPaymentTool(String paymentMethod) { protected PaymentToolType mapPaymentTool(String paymentMethod) {
return switch (paymentMethod) { return switch (paymentMethod) {
case "bankCard" -> bank_card; case "bankCard" -> bank_card;

View File

@ -2,18 +2,17 @@ package dev.vality.anapi.v2.converter.magista.response;
import dev.vality.anapi.v2.model.ClientInfo; import dev.vality.anapi.v2.model.ClientInfo;
import dev.vality.anapi.v2.model.ContactInfo; import dev.vality.anapi.v2.model.ContactInfo;
import dev.vality.anapi.v2.model.CryptoCurrency;
import dev.vality.anapi.v2.model.CustomerPayer; import dev.vality.anapi.v2.model.CustomerPayer;
import dev.vality.anapi.v2.model.Payer; import dev.vality.anapi.v2.model.Payer;
import dev.vality.anapi.v2.model.PaymentResourcePayer; import dev.vality.anapi.v2.model.PaymentResourcePayer;
import dev.vality.anapi.v2.model.RecurrentPayer; import dev.vality.anapi.v2.model.RecurrentPayer;
import dev.vality.anapi.v2.model.TransactionInfo; import dev.vality.anapi.v2.model.TransactionInfo;
import dev.vality.anapi.v2.model.*;
import dev.vality.anapi.v2.util.MaskUtil; import dev.vality.anapi.v2.util.MaskUtil;
import dev.vality.damsel.domain.*; import dev.vality.damsel.domain.*;
import dev.vality.geck.common.util.TypeUtil; import dev.vality.geck.common.util.TypeUtil;
import dev.vality.magista.InvoicePaymentFlow; import dev.vality.magista.InvoicePaymentFlow;
import dev.vality.magista.StatPayment; import dev.vality.magista.StatPayment;
import dev.vality.anapi.v2.model.*;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.time.ZoneOffset; import java.time.ZoneOffset;
@ -126,42 +125,53 @@ public class StatPaymentToPaymentSearchResultConverter {
} }
protected PaymentToolDetails mapPaymentToolDetails(PaymentTool paymentTool) { protected PaymentToolDetails mapPaymentToolDetails(PaymentTool paymentTool) {
var field = dev.vality.damsel.domain.PaymentTool._Fields.findByName(paymentTool.getSetField().getFieldName()); switch (paymentTool.getSetField()) {
switch (field) {
case BANK_CARD -> { case BANK_CARD -> {
var card = paymentTool.getBankCard(); var card = paymentTool.getBankCard();
return new PaymentToolDetailsBankCard() return new PaymentToolDetailsBankCard()
.bin(card.getBin()) .bin(card.getBin())
.paymentSystem(card.isSetPaymentSystemDeprecated() .paymentSystem(getPaymentSystem(card))
? BankCardPaymentSystem.fromValue(card.getPaymentSystemDeprecated().name())
: null)
.cardNumberMask(MaskUtil.constructCardNumber(card)) .cardNumberMask(MaskUtil.constructCardNumber(card))
.lastDigits(card.getLastDigits()) .lastDigits(card.getLastDigits())
.tokenProvider(card.isSetTokenProviderDeprecated() .tokenProvider(getTokenProvider(card));
? BankCardTokenProvider.fromValue(card.getTokenProviderDeprecated().name())
: null);
} }
case PAYMENT_TERMINAL -> { case PAYMENT_TERMINAL -> {
var terminal = paymentTool.getPaymentTerminal(); var terminal = paymentTool.getPaymentTerminal();
return new PaymentToolDetailsPaymentTerminal() return new PaymentToolDetailsPaymentTerminal()
.provider(terminal.isSetTerminalTypeDeprecated() .provider(getProvider(terminal));
? PaymentTerminalProvider.fromValue(terminal.getTerminalTypeDeprecated().name())
: null);
} }
case MOBILE_COMMERCE -> { case MOBILE_COMMERCE -> {
var mobile = paymentTool.getMobileCommerce(); var mobile = paymentTool.getMobileCommerce();
return new PaymentToolDetailsMobileCommerce() return new PaymentToolDetailsMobileCommerce()
.phoneNumber(MaskUtil.constructPhoneNumber(mobile.getPhone())); .phoneNumber(MaskUtil.constructPhoneNumber(mobile.getPhone()));
} }
case CRYPTO_CURRENCY_DEPRECATED -> { case CRYPTO_CURRENCY -> {
var cryptoCurrency = paymentTool.getCryptoCurrencyDeprecated(); var cryptoCurrency = paymentTool.getCryptoCurrency();
return new PaymentToolDetailsCryptoWallet() return new PaymentToolDetailsCryptoWallet()
.cryptoCurrency(CryptoCurrency.fromValue(cryptoCurrency.name())); .cryptoCurrency(cryptoCurrency.getId());
} }
default -> throw new IllegalArgumentException(); default -> throw new IllegalArgumentException();
} }
} }
private String getProvider(PaymentTerminal terminal) {
return terminal.isSetPaymentService()
? terminal.getPaymentService().getId()
: null;
}
private String getTokenProvider(BankCard card) {
return card.isSetPaymentToken()
? card.getPaymentToken().getId()
: null;
}
private String getPaymentSystem(BankCard card) {
return card.isSetPaymentSystem()
? card.getPaymentSystem().getId()
: null;
}
protected PaymentSearchResult.StatusEnum mapStatus(InvoicePaymentStatus status) { protected PaymentSearchResult.StatusEnum mapStatus(InvoicePaymentStatus status) {
try { try {
var field = InvoicePaymentStatus._Fields.findByName(status.getSetField().getFieldName()); var field = InvoicePaymentStatus._Fields.findByName(status.getSetField().getFieldName());
@ -173,7 +183,6 @@ public class StatPaymentToPaymentSearchResultConverter {
case REFUNDED -> REFUNDED; case REFUNDED -> REFUNDED;
case FAILED -> FAILED; case FAILED -> FAILED;
case CHARGED_BACK -> CHARGEDBACK; case CHARGED_BACK -> CHARGEDBACK;
default -> throw new IllegalArgumentException();
}; };
} catch (Exception e) { } catch (Exception e) {
throw new IllegalArgumentException( throw new IllegalArgumentException(

View File

@ -34,7 +34,6 @@ import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
class SearchPaymentsTest extends AbstractKeycloakOpenIdAsWiremockConfig { class SearchPaymentsTest extends AbstractKeycloakOpenIdAsWiremockConfig {
@MockBean @MockBean

View File

@ -2,9 +2,6 @@ package dev.vality.anapi.v2.converter.magista.request;
import dev.vality.anapi.v2.exception.BadRequestException; import dev.vality.anapi.v2.exception.BadRequestException;
import dev.vality.anapi.v2.model.PaymentStatus; import dev.vality.anapi.v2.model.PaymentStatus;
import dev.vality.damsel.domain.LegacyBankCardPaymentSystem;
import dev.vality.damsel.domain.LegacyBankCardTokenProvider;
import dev.vality.damsel.domain.LegacyTerminalPaymentProvider;
import dev.vality.magista.InvoicePaymentFlowType; import dev.vality.magista.InvoicePaymentFlowType;
import dev.vality.magista.PaymentSearchQuery; import dev.vality.magista.PaymentSearchQuery;
import dev.vality.magista.PaymentToolType; import dev.vality.magista.PaymentToolType;
@ -73,28 +70,4 @@ class ParamsToPaymentSearchQueryConverterTest {
assertThrows(BadRequestException.class, () -> converter.mapStatus("unexpected")); assertThrows(BadRequestException.class, () -> converter.mapStatus("unexpected"));
} }
@Test
void mapTerminalProvider() {
for (LegacyTerminalPaymentProvider provider : LegacyTerminalPaymentProvider.values()) {
assertEquals(provider, converter.mapTerminalProvider(provider.name()));
}
assertThrows(BadRequestException.class, () -> converter.mapTerminalProvider("unexpected"));
}
@Test
void mapTokenProvider() {
for (LegacyBankCardTokenProvider provider : LegacyBankCardTokenProvider.values()) {
assertEquals(provider, converter.mapTokenProvider(provider.name()));
}
assertThrows(BadRequestException.class, () -> converter.mapTokenProvider("unexpected"));
}
@Test
void mapPaymentSystem() {
for (LegacyBankCardPaymentSystem system : LegacyBankCardPaymentSystem.values()) {
assertEquals(system, converter.mapPaymentSystem(system.name()));
}
assertThrows(BadRequestException.class, () -> converter.mapPaymentSystem("unexpected"));
}
} }

View File

@ -1,9 +1,9 @@
package dev.vality.anapi.v2.converter.magista.response; package dev.vality.anapi.v2.converter.magista.response;
import dev.vality.anapi.v2.model.*; import dev.vality.anapi.v2.model.*;
import dev.vality.anapi.v2.util.MaskUtil;
import dev.vality.anapi.v2.testutil.MagistaUtil; import dev.vality.anapi.v2.testutil.MagistaUtil;
import dev.vality.anapi.v2.testutil.RandomUtil; import dev.vality.anapi.v2.testutil.RandomUtil;
import dev.vality.anapi.v2.util.MaskUtil;
import dev.vality.damsel.domain.ClientInfo; import dev.vality.damsel.domain.ClientInfo;
import dev.vality.damsel.domain.ContactInfo; import dev.vality.damsel.domain.ContactInfo;
import dev.vality.damsel.domain.InvoicePaymentStatus; import dev.vality.damsel.domain.InvoicePaymentStatus;
@ -68,9 +68,8 @@ class StatPaymentToPaymentSearchResultConverterTest {
.setLastDigits("5678") .setLastDigits("5678")
.setBankName("Bank") .setBankName("Bank")
.setToken("1111") .setToken("1111")
.setPaymentSystemDeprecated(LegacyBankCardPaymentSystem.maestro) .setPaymentSystem(new PaymentSystemRef("maestro"))
.setTokenProviderDeprecated(LegacyBankCardTokenProvider.applepay) .setPaymentToken(new BankCardTokenServiceRef("applepay")));
);
customerPayer.setPaymentTool(tool) customerPayer.setPaymentTool(tool)
.setCustomerId("1"); .setCustomerId("1");
var openapiCustomerPayer = var openapiCustomerPayer =
@ -81,8 +80,8 @@ class StatPaymentToPaymentSearchResultConverterTest {
() -> assertEquals("1111", openapiCustomerPayer.getPaymentToolToken()), () -> assertEquals("1111", openapiCustomerPayer.getPaymentToolToken()),
() -> assertEquals("1234", paymentToolDetails.getBin()), () -> assertEquals("1234", paymentToolDetails.getBin()),
() -> assertEquals("5678", paymentToolDetails.getLastDigits()), () -> assertEquals("5678", paymentToolDetails.getLastDigits()),
() -> assertEquals("maestro", paymentToolDetails.getPaymentSystem().getValue()), () -> assertEquals("maestro", paymentToolDetails.getPaymentSystem()),
() -> assertEquals("applepay", paymentToolDetails.getTokenProvider().getValue()) () -> assertEquals("applepay", paymentToolDetails.getTokenProvider())
); );
@ -112,8 +111,8 @@ class StatPaymentToPaymentSearchResultConverterTest {
() -> assertEquals("88005553535", paymentResourcePayer.getContactInfo().getPhoneNumber()), () -> assertEquals("88005553535", paymentResourcePayer.getContactInfo().getPhoneNumber()),
() -> assertEquals("1234", resourcePayerPaymentToolDetails.getBin()), () -> assertEquals("1234", resourcePayerPaymentToolDetails.getBin()),
() -> assertEquals("5678", resourcePayerPaymentToolDetails.getLastDigits()), () -> assertEquals("5678", resourcePayerPaymentToolDetails.getLastDigits()),
() -> assertEquals("maestro", resourcePayerPaymentToolDetails.getPaymentSystem().getValue()), () -> assertEquals("maestro", resourcePayerPaymentToolDetails.getPaymentSystem()),
() -> assertEquals("applepay", resourcePayerPaymentToolDetails.getTokenProvider().getValue()) () -> assertEquals("applepay", resourcePayerPaymentToolDetails.getTokenProvider())
); );
payer = new Payer(); payer = new Payer();
@ -136,8 +135,8 @@ class StatPaymentToPaymentSearchResultConverterTest {
() -> assertEquals("88005553535", openapiRecurrentPayer.getContactInfo().getPhoneNumber()), () -> assertEquals("88005553535", openapiRecurrentPayer.getContactInfo().getPhoneNumber()),
() -> assertEquals("1234", recurrentPayerPaymentToolDetails.getBin()), () -> assertEquals("1234", recurrentPayerPaymentToolDetails.getBin()),
() -> assertEquals("5678", recurrentPayerPaymentToolDetails.getLastDigits()), () -> assertEquals("5678", recurrentPayerPaymentToolDetails.getLastDigits()),
() -> assertEquals("maestro", recurrentPayerPaymentToolDetails.getPaymentSystem().getValue()), () -> assertEquals("maestro", recurrentPayerPaymentToolDetails.getPaymentSystem()),
() -> assertEquals("applepay", recurrentPayerPaymentToolDetails.getTokenProvider().getValue()) () -> assertEquals("applepay", recurrentPayerPaymentToolDetails.getTokenProvider())
); );
} }
@ -194,7 +193,7 @@ class StatPaymentToPaymentSearchResultConverterTest {
() -> assertNull(converter.getPaymentToolToken(PaymentTool.payment_terminal(new PaymentTerminal()))), () -> assertNull(converter.getPaymentToolToken(PaymentTool.payment_terminal(new PaymentTerminal()))),
() -> assertNull(converter.getPaymentToolToken(PaymentTool.crypto_currency(new CryptoCurrencyRef()))), () -> assertNull(converter.getPaymentToolToken(PaymentTool.crypto_currency(new CryptoCurrencyRef()))),
() -> assertNull(converter.getPaymentToolToken( () -> assertNull(converter.getPaymentToolToken(
PaymentTool.crypto_currency_deprecated(LegacyCryptoCurrency.bitcoin))) PaymentTool.crypto_currency(new CryptoCurrencyRef("bitcoin"))))
); );
} }
@ -206,10 +205,10 @@ class StatPaymentToPaymentSearchResultConverterTest {
assertAll( assertAll(
() -> assertEquals(expectedCardDetails.getLastDigits(), actualCardDetails.getLastDigits()), () -> assertEquals(expectedCardDetails.getLastDigits(), actualCardDetails.getLastDigits()),
() -> assertEquals(expectedCardDetails.getBin(), actualCardDetails.getBin()), () -> assertEquals(expectedCardDetails.getBin(), actualCardDetails.getBin()),
() -> assertEquals(expectedCardDetails.getTokenProviderDeprecated().name(), () -> assertEquals(expectedCardDetails.getPaymentToken().getId(),
actualCardDetails.getTokenProvider().getValue()), actualCardDetails.getTokenProvider()),
() -> assertEquals(expectedCardDetails.getPaymentSystemDeprecated().name(), () -> assertEquals(expectedCardDetails.getPaymentSystem().getId(),
actualCardDetails.getPaymentSystem().getValue()), actualCardDetails.getPaymentSystem()),
() -> assertTrue(actualCardDetails.getCardNumberMask().startsWith(expectedCardDetails.getBin())), () -> assertTrue(actualCardDetails.getCardNumberMask().startsWith(expectedCardDetails.getBin())),
() -> assertTrue(actualCardDetails.getCardNumberMask().endsWith(expectedCardDetails.getLastDigits())) () -> assertTrue(actualCardDetails.getCardNumberMask().endsWith(expectedCardDetails.getLastDigits()))
); );
@ -217,8 +216,8 @@ class StatPaymentToPaymentSearchResultConverterTest {
tool = MagistaUtil.createPaymentTerminalPaymentTool(); tool = MagistaUtil.createPaymentTerminalPaymentTool();
var expectedTerminalDetails = tool.getPaymentTerminal(); var expectedTerminalDetails = tool.getPaymentTerminal();
var actualTerminalDetails = (PaymentToolDetailsPaymentTerminal) converter.mapPaymentToolDetails(tool); var actualTerminalDetails = (PaymentToolDetailsPaymentTerminal) converter.mapPaymentToolDetails(tool);
assertEquals(expectedTerminalDetails.getTerminalTypeDeprecated().name(), assertEquals(expectedTerminalDetails.getPaymentService().getId(),
actualTerminalDetails.getProvider().getValue()); actualTerminalDetails.getProvider());
tool = MagistaUtil.createMobileCommercePaymentTool(); tool = MagistaUtil.createMobileCommercePaymentTool();
var expectedMobileDetails = tool.getMobileCommerce(); var expectedMobileDetails = tool.getMobileCommerce();
@ -227,14 +226,9 @@ class StatPaymentToPaymentSearchResultConverterTest {
actualMobileDetails.getPhoneNumber()); actualMobileDetails.getPhoneNumber());
tool = MagistaUtil.createLegacyCryptoCurrencyPaymentTool(); tool = MagistaUtil.createLegacyCryptoCurrencyPaymentTool();
var expectedLegacyCryptoDetails = tool.getCryptoCurrencyDeprecated(); var expectedLegacyCryptoDetails = tool.getCryptoCurrency().getId();
var actualLegacyCryptoDetails = (PaymentToolDetailsCryptoWallet) converter.mapPaymentToolDetails(tool); var actualLegacyCryptoDetails = (PaymentToolDetailsCryptoWallet) converter.mapPaymentToolDetails(tool);
assertEquals(expectedLegacyCryptoDetails.name(), assertEquals(expectedLegacyCryptoDetails,
actualLegacyCryptoDetails.getCryptoCurrency().getValue()); actualLegacyCryptoDetails.getCryptoCurrency());
assertThrows(IllegalArgumentException.class,
() -> converter.mapPaymentToolDetails(MagistaUtil.createCryptoCurrencyPaymentTool()));
} }
} }

View File

@ -192,19 +192,17 @@ public class MagistaUtil {
.setLastDigits(RandomUtil.randomString(4)) .setLastDigits(RandomUtil.randomString(4))
.setBankName(RandomUtil.randomString(4)) .setBankName(RandomUtil.randomString(4))
.setToken(RandomUtil.randomString(4)) .setToken(RandomUtil.randomString(4))
.setPaymentSystemDeprecated(LegacyBankCardPaymentSystem.maestro) .setPaymentSystem(new PaymentSystemRef("maestro"))
.setTokenProviderDeprecated(LegacyBankCardTokenProvider.applepay) .setPaymentToken(new BankCardTokenServiceRef("applepay")));
);
} }
public static PaymentTool createPaymentTerminalPaymentTool() { public static PaymentTool createPaymentTerminalPaymentTool() {
return PaymentTool.payment_terminal(new PaymentTerminal() return PaymentTool.payment_terminal(new PaymentTerminal()
.setTerminalTypeDeprecated(LegacyTerminalPaymentProvider.alipay)); .setPaymentService(new PaymentServiceRef("alipay")));
} }
public static PaymentTool createMobileCommercePaymentTool() { public static PaymentTool createMobileCommercePaymentTool() {
return PaymentTool.mobile_commerce(new MobileCommerce() return PaymentTool.mobile_commerce(new MobileCommerce().setOperator(new MobileOperatorRef("mts"))
.setOperatorDeprecated(LegacyMobileOperator.mts)
.setPhone(new MobilePhone() .setPhone(new MobilePhone()
.setCc("7") .setCc("7")
.setCtn("1234567890"))); .setCtn("1234567890")));
@ -216,7 +214,7 @@ public class MagistaUtil {
} }
public static PaymentTool createLegacyCryptoCurrencyPaymentTool() { public static PaymentTool createLegacyCryptoCurrencyPaymentTool() {
return PaymentTool.crypto_currency_deprecated(LegacyCryptoCurrency.bitcoin); return PaymentTool.crypto_currency(new CryptoCurrencyRef("bitcoin"));
} }
} }

View File

@ -5,7 +5,6 @@ import dev.vality.anapi.v2.model.ChargebackStage;
import dev.vality.anapi.v2.model.ChargebackStatus; import dev.vality.anapi.v2.model.ChargebackStatus;
import dev.vality.anapi.v2.model.PaymentStatus; import dev.vality.anapi.v2.model.PaymentStatus;
import dev.vality.damsel.domain.PaymentInstitutionRealm; import dev.vality.damsel.domain.PaymentInstitutionRealm;
import dev.vality.damsel.merch_stat.TerminalPaymentProvider;
import lombok.experimental.UtilityClass; import lombok.experimental.UtilityClass;
import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap; import org.springframework.util.MultiValueMap;
@ -35,7 +34,7 @@ public class OpenApiUtil {
params.add("paymentStatus", PaymentStatus.StatusEnum.PENDING.getValue()); params.add("paymentStatus", PaymentStatus.StatusEnum.PENDING.getValue());
params.add("paymentFlow", "instant"); params.add("paymentFlow", "instant");
params.add("paymentMethod", "paymentTerminal"); params.add("paymentMethod", "paymentTerminal");
params.add("paymentTerminalProvider", TerminalPaymentProvider.alipay.name()); params.add("paymentTerminalProvider", "alipay");
params.add("invoiceID", randomIntegerAsString(1, 1000)); params.add("invoiceID", randomIntegerAsString(1, 1000));
params.add("paymentID", randomIntegerAsString(1, 1000)); params.add("paymentID", randomIntegerAsString(1, 1000));
params.add("externalID", randomIntegerAsString(1, 1000)); params.add("externalID", randomIntegerAsString(1, 1000));