diff --git a/pom.xml b/pom.xml index 380ba01..c3719f8 100644 --- a/pom.xml +++ b/pom.xml @@ -39,6 +39,7 @@ dev.vality damsel + 1.646-7762f6c dev.vality.geck @@ -55,7 +56,7 @@ dev.vality deanonimus-proto - 1.40-2a02d87 + 1.41-6605c72 dev.vality diff --git a/src/main/java/dev/vality/deanonimus/converter/ShopDomainToShopApiConverter.java b/src/main/java/dev/vality/deanonimus/converter/ShopDomainToShopApiConverter.java index 7d528c2..887a94a 100644 --- a/src/main/java/dev/vality/deanonimus/converter/ShopDomainToShopApiConverter.java +++ b/src/main/java/dev/vality/deanonimus/converter/ShopDomainToShopApiConverter.java @@ -20,15 +20,11 @@ public class ShopDomainToShopApiConverter implements Converter new ShopNotFoundException(shopId)); shop.setContractId(contractChanged.getContractId()); - shop.setPayoutToolId(contractChanged.getPayoutToolId()); openSearchService.updateParty(party); diff --git a/src/main/java/dev/vality/deanonimus/kafka/handler/party/management/shop/ShopCreatedHandler.java b/src/main/java/dev/vality/deanonimus/kafka/handler/party/management/shop/ShopCreatedHandler.java index ec77eac..e50182f 100644 --- a/src/main/java/dev/vality/deanonimus/kafka/handler/party/management/shop/ShopCreatedHandler.java +++ b/src/main/java/dev/vality/deanonimus/kafka/handler/party/management/shop/ShopCreatedHandler.java @@ -86,10 +86,6 @@ public class ShopCreatedHandler extends AbstractClaimChangedHandler { ShopUtil.fillShopAccount(shop, shopCreated.getAccount()); } shop.setContractId(shopCreated.getContractId()); - shop.setPayoutToolId(shopCreated.getPayoutToolId()); - if (shopCreated.isSetPayoutSchedule()) { - shop.setPayoutScheduleId(shopCreated.getPayoutSchedule().getId()); - } return shop; } } diff --git a/src/main/java/dev/vality/deanonimus/kafka/handler/party/management/shop/ShopPayoutScheduleChangedHandler.java b/src/main/java/dev/vality/deanonimus/kafka/handler/party/management/shop/ShopPayoutScheduleChangedHandler.java deleted file mode 100644 index c696acc..0000000 --- a/src/main/java/dev/vality/deanonimus/kafka/handler/party/management/shop/ShopPayoutScheduleChangedHandler.java +++ /dev/null @@ -1,62 +0,0 @@ -package dev.vality.deanonimus.kafka.handler.party.management.shop; - -import dev.vality.damsel.payment_processing.ClaimEffect; -import dev.vality.damsel.payment_processing.PartyChange; -import dev.vality.damsel.payment_processing.ScheduleChanged; -import dev.vality.damsel.payment_processing.ShopEffectUnit; -import dev.vality.deanonimus.db.exception.ShopNotFoundException; -import dev.vality.deanonimus.domain.Party; -import dev.vality.deanonimus.domain.Shop; -import dev.vality.deanonimus.kafka.handler.party.management.AbstractClaimChangedHandler; -import dev.vality.deanonimus.service.OpenSearchService; -import dev.vality.machinegun.eventsink.MachineEvent; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Propagation; -import org.springframework.transaction.annotation.Transactional; - -import java.util.List; - -@Slf4j -@Component -@RequiredArgsConstructor -public class ShopPayoutScheduleChangedHandler extends AbstractClaimChangedHandler { - - private final OpenSearchService openSearchService; - - @Override - @Transactional(propagation = Propagation.REQUIRED) - public void handle(PartyChange change, MachineEvent event, Integer changeId) { - long sequenceId = event.getEventId(); - List claimEffects = getClaimStatus(change).getAccepted().getEffects(); - for (ClaimEffect claimEffect : claimEffects) { - if (claimEffect.isSetShopEffect() && claimEffect.getShopEffect().getEffect().isSetPayoutScheduleChanged()) { - handleEvent(event, changeId, sequenceId, claimEffect); - } - } - } - - private void handleEvent(MachineEvent event, Integer changeId, long sequenceId, ClaimEffect e) { - ShopEffectUnit shopEffect = e.getShopEffect(); - ScheduleChanged payoutScheduleChanged = shopEffect.getEffect().getPayoutScheduleChanged(); - String shopId = shopEffect.getShopId(); - String partyId = event.getSourceId(); - log.info("Start shop payoutScheduleChanged handling, sequenceId={}, partyId={}, shopId={}, changeId={}", - sequenceId, partyId, shopId, changeId); - - Party party = openSearchService.findPartyById(partyId); - Shop shop = party.getShopById(shopId).orElseThrow(() -> new ShopNotFoundException(shopId)); - - if (payoutScheduleChanged.isSetSchedule()) { - shop.setPayoutScheduleId(payoutScheduleChanged.getSchedule().getId()); - } else { - shop.setPayoutScheduleId(null); - } - - openSearchService.updateParty(party); - - log.info("End shop payoutScheduleChanged handling, sequenceId={}, partyId={}, shopId={}, changeId={}", - sequenceId, partyId, shopId, changeId); - } -} diff --git a/src/main/java/dev/vality/deanonimus/kafka/handler/party/management/shop/ShopPayoutToolChangedHandler.java b/src/main/java/dev/vality/deanonimus/kafka/handler/party/management/shop/ShopPayoutToolChangedHandler.java deleted file mode 100644 index e7d7c37..0000000 --- a/src/main/java/dev/vality/deanonimus/kafka/handler/party/management/shop/ShopPayoutToolChangedHandler.java +++ /dev/null @@ -1,57 +0,0 @@ -package dev.vality.deanonimus.kafka.handler.party.management.shop; - -import dev.vality.damsel.payment_processing.ClaimEffect; -import dev.vality.damsel.payment_processing.PartyChange; -import dev.vality.damsel.payment_processing.ShopEffectUnit; -import dev.vality.deanonimus.db.exception.ShopNotFoundException; -import dev.vality.deanonimus.domain.Party; -import dev.vality.deanonimus.domain.Shop; -import dev.vality.deanonimus.kafka.handler.party.management.AbstractClaimChangedHandler; -import dev.vality.deanonimus.service.OpenSearchService; -import dev.vality.machinegun.eventsink.MachineEvent; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Propagation; -import org.springframework.transaction.annotation.Transactional; - -import java.util.List; - -@Slf4j -@Component -@RequiredArgsConstructor -public class ShopPayoutToolChangedHandler extends AbstractClaimChangedHandler { - - private final OpenSearchService openSearchService; - - @Override - @Transactional(propagation = Propagation.REQUIRED) - public void handle(PartyChange change, MachineEvent event, Integer changeId) { - long sequenceId = event.getEventId(); - List claimEffects = getClaimStatus(change).getAccepted().getEffects(); - for (ClaimEffect claimEffect : claimEffects) { - if (claimEffect.isSetShopEffect() && claimEffect.getShopEffect().getEffect().isSetPayoutToolChanged()) { - handleEvent(event, changeId, sequenceId, claimEffect); - } - } - } - - private void handleEvent(MachineEvent event, Integer changeId, long sequenceId, ClaimEffect e) { - ShopEffectUnit shopEffect = e.getShopEffect(); - String payoutToolChanged = shopEffect.getEffect().getPayoutToolChanged(); - String shopId = shopEffect.getShopId(); - String partyId = event.getSourceId(); - log.info("Start shop payoutToolChanged handling, sequenceId={}, partyId={}, shopId={}, changeId={}", - sequenceId, partyId, shopId, changeId); - - Party party = openSearchService.findPartyById(partyId); - Shop shop = party.getShopById(shopId).orElseThrow(() -> new ShopNotFoundException(shopId)); - - shop.setPayoutToolId(payoutToolChanged); - - openSearchService.updateParty(party); - - log.info("End shop payoutToolChanged handling, sequenceId={}, partyId={}, shopId={}, changeId={}", - sequenceId, partyId, shopId, changeId); - } -} diff --git a/src/test/resources/index_request.json b/src/test/resources/index_request.json index 437c7f7..12aaad5 100644 --- a/src/test/resources/index_request.json +++ b/src/test/resources/index_request.json @@ -341,15 +341,6 @@ } } }, - "payoutToolId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, "suspension": { "type": "text", "fields": {