From ad9a772d2f3b87addb18e69a4c4259596caefe8b Mon Sep 17 00:00:00 2001 From: Anatoly Karlov Date: Fri, 8 Apr 2022 13:28:44 +0700 Subject: [PATCH] OPS-77: bump ff proto (#42) --- pom.xml | 7 +++---- .../impl/destination/DestinationCreatedHandler.java | 9 +++------ .../session/WithdrawalSessionCreatedHandler.java | 12 +++++------- .../DestinationCreatedCryptoWalletHandlerTest.java | 2 +- ...hdrawalSessionCreatedCryptoWalletHandlerTest.java | 2 +- .../newway/utils/DestinationHandlerTestUtils.java | 3 +-- .../utils/WithdrawalSessionCreatedHandlerUtils.java | 3 +-- 7 files changed, 15 insertions(+), 23 deletions(-) diff --git a/pom.xml b/pom.xml index 3dc4406..1cec92e 100644 --- a/pom.xml +++ b/pom.xml @@ -127,7 +127,7 @@ dev.vality payout-manager-proto - 1.35-dbed280 + 1.36-063163d dev.vality @@ -154,12 +154,12 @@ dev.vality fistful-proto - 1.144-ea0fe7a + 1.145-c45166d dev.vality xrates-proto - 1.22-4adcd9c + 1.23-bf0d62d dev.vality @@ -176,7 +176,6 @@ dev.vality mamsel - 0.2.1 diff --git a/src/main/java/dev/vality/newway/handler/event/stock/impl/destination/DestinationCreatedHandler.java b/src/main/java/dev/vality/newway/handler/event/stock/impl/destination/DestinationCreatedHandler.java index bb3f7ab..afcdccb 100644 --- a/src/main/java/dev/vality/newway/handler/event/stock/impl/destination/DestinationCreatedHandler.java +++ b/src/main/java/dev/vality/newway/handler/event/stock/impl/destination/DestinationCreatedHandler.java @@ -81,12 +81,9 @@ public class DestinationCreatedHandler implements DestinationHandler { } } else if (resource.isSetCryptoWallet()) { ResourceCryptoWallet resourceCryptoWallet = resource.getCryptoWallet(); - CryptoWallet wallet = resourceCryptoWallet.getCryptoWallet(); - destination.setResourceCryptoWalletId(wallet.getId()); - destination.setResourceCryptoWalletType(wallet.getCurrency().name()); - if (wallet.isSetData()) { - destination.setResourceCryptoWalletData(wallet.getData().getSetField().getFieldName()); - } + var cryptoWallet = resourceCryptoWallet.getCryptoWallet(); + destination.setResourceCryptoWalletId(cryptoWallet.getId()); + destination.setResourceCryptoWalletType(cryptoWallet.getCurrency().getId()); } else if (resource.isSetDigitalWallet()) { ResourceDigitalWallet resourceDigitalWallet = resource.getDigitalWallet(); DigitalWallet digitalWallet = resourceDigitalWallet.getDigitalWallet(); diff --git a/src/main/java/dev/vality/newway/handler/event/stock/impl/withdrawal/session/WithdrawalSessionCreatedHandler.java b/src/main/java/dev/vality/newway/handler/event/stock/impl/withdrawal/session/WithdrawalSessionCreatedHandler.java index 4f21002..f04e1aa 100644 --- a/src/main/java/dev/vality/newway/handler/event/stock/impl/withdrawal/session/WithdrawalSessionCreatedHandler.java +++ b/src/main/java/dev/vality/newway/handler/event/stock/impl/withdrawal/session/WithdrawalSessionCreatedHandler.java @@ -11,7 +11,6 @@ import dev.vality.geck.filter.PathConditionFilter; import dev.vality.geck.filter.condition.IsNullCondition; import dev.vality.geck.filter.rule.PathConditionRule; import dev.vality.machinegun.eventsink.MachineEvent; -import dev.vality.mamsel.PaymentSystemUtil; import dev.vality.newway.dao.withdrawal.session.iface.WithdrawalSessionDao; import dev.vality.newway.domain.enums.BankCardPaymentSystem; import dev.vality.newway.domain.enums.DestinationResourceType; @@ -23,6 +22,8 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; +import java.util.Locale; + @Slf4j @Component @RequiredArgsConstructor @@ -65,7 +66,7 @@ public class WithdrawalSessionCreatedHandler implements WithdrawalSessionHandler withdrawalSession.setDestinationCardMaskedPan(bankCard.getMaskedPan()); if (bankCard.isSetPaymentSystem()) { withdrawalSession.setDestinationCardPaymentSystem( - BankCardPaymentSystem.valueOf(PaymentSystemUtil.getFistfulPaymentSystemName(bankCard))); + BankCardPaymentSystem.valueOf(bankCard.getPaymentSystem().getId().toLowerCase(Locale.ROOT))); } withdrawalSession.setResourceBankCardBankName(bankCard.getBankName()); if (bankCard.isSetIssuerCountry()) { @@ -76,12 +77,9 @@ public class WithdrawalSessionCreatedHandler implements WithdrawalSessionHandler } } else if (resource.isSetCryptoWallet()) { ResourceCryptoWallet resourceCryptoWallet = resource.getCryptoWallet(); - CryptoWallet cryptoWallet = resourceCryptoWallet.getCryptoWallet(); + var cryptoWallet = resourceCryptoWallet.getCryptoWallet(); withdrawalSession.setResourceCryptoWalletId(cryptoWallet.getId()); - withdrawalSession.setResourceCryptoWalletType(cryptoWallet.getCurrency().toString()); - if (cryptoWallet.isSetData()) { - withdrawalSession.setResourceCryptoWalletData(cryptoWallet.getData().getSetField().getFieldName()); - } + withdrawalSession.setResourceCryptoWalletType(cryptoWallet.getCurrency().getId()); } else if (resource.isSetDigitalWallet()) { ResourceDigitalWallet resourceDigitalWallet = resource.getDigitalWallet(); DigitalWallet digitalWallet = resourceDigitalWallet.getDigitalWallet(); diff --git a/src/test/java/dev/vality/newway/handler/event/stock/impl/destination/DestinationCreatedCryptoWalletHandlerTest.java b/src/test/java/dev/vality/newway/handler/event/stock/impl/destination/DestinationCreatedCryptoWalletHandlerTest.java index 4c6d306..8d6ce0b 100644 --- a/src/test/java/dev/vality/newway/handler/event/stock/impl/destination/DestinationCreatedCryptoWalletHandlerTest.java +++ b/src/test/java/dev/vality/newway/handler/event/stock/impl/destination/DestinationCreatedCryptoWalletHandlerTest.java @@ -49,7 +49,7 @@ public class DestinationCreatedCryptoWalletHandlerTest { new RecordRowMapper<>(DESTINATION, Destination.class)); Assertions.assertNotNull(Objects.requireNonNull(destinationResult).getResourceCryptoWalletId()); - Assertions.assertNotNull(destinationResult.getResourceCryptoWalletData()); + Assertions.assertNotNull(destinationResult.getResourceCryptoWalletType()); } } \ No newline at end of file diff --git a/src/test/java/dev/vality/newway/handler/event/stock/impl/withdrawal/session/WithdrawalSessionCreatedCryptoWalletHandlerTest.java b/src/test/java/dev/vality/newway/handler/event/stock/impl/withdrawal/session/WithdrawalSessionCreatedCryptoWalletHandlerTest.java index 3cc0e77..952207c 100644 --- a/src/test/java/dev/vality/newway/handler/event/stock/impl/withdrawal/session/WithdrawalSessionCreatedCryptoWalletHandlerTest.java +++ b/src/test/java/dev/vality/newway/handler/event/stock/impl/withdrawal/session/WithdrawalSessionCreatedCryptoWalletHandlerTest.java @@ -48,7 +48,7 @@ public class WithdrawalSessionCreatedCryptoWalletHandlerTest { new RecordRowMapper<>(WITHDRAWAL_SESSION, WithdrawalSession.class)); Assertions.assertNotNull(Objects.requireNonNull(result).getResourceCryptoWalletId()); - Assertions.assertNotNull(result.getResourceCryptoWalletData()); + Assertions.assertNotNull(result.getResourceCryptoWalletType()); } } \ No newline at end of file diff --git a/src/test/java/dev/vality/newway/utils/DestinationHandlerTestUtils.java b/src/test/java/dev/vality/newway/utils/DestinationHandlerTestUtils.java index b6786b8..5acb83a 100644 --- a/src/test/java/dev/vality/newway/utils/DestinationHandlerTestUtils.java +++ b/src/test/java/dev/vality/newway/utils/DestinationHandlerTestUtils.java @@ -44,8 +44,7 @@ public class DestinationHandlerTestUtils { public static CryptoWallet createFistfulCryptoWallet() { CryptoWallet cryptoWallet = new CryptoWallet(); cryptoWallet.setId(CRYPTO_WALLET_ID); - cryptoWallet.setData(CryptoData.bitcoin(new CryptoDataBitcoin())); - cryptoWallet.setCurrency(CryptoCurrency.bitcoin); + cryptoWallet.setCurrency(new CryptoCurrencyRef("bitcoin")); return cryptoWallet; } diff --git a/src/test/java/dev/vality/newway/utils/WithdrawalSessionCreatedHandlerUtils.java b/src/test/java/dev/vality/newway/utils/WithdrawalSessionCreatedHandlerUtils.java index 15fbdba..a3b6ae4 100644 --- a/src/test/java/dev/vality/newway/utils/WithdrawalSessionCreatedHandlerUtils.java +++ b/src/test/java/dev/vality/newway/utils/WithdrawalSessionCreatedHandlerUtils.java @@ -47,8 +47,7 @@ public class WithdrawalSessionCreatedHandlerUtils { public static CryptoWallet createFistfulCryptoWallet() { CryptoWallet cryptoWallet = new CryptoWallet(); cryptoWallet.setId(CRYPTO_WALLET_ID); - cryptoWallet.setData(CryptoData.bitcoin(new CryptoDataBitcoin())); - cryptoWallet.setCurrency(CryptoCurrency.bitcoin); + cryptoWallet.setCurrency(new CryptoCurrencyRef("bitcoin")); return cryptoWallet; }