mirror of
https://github.com/valitydev/deanonimus.git
synced 2024-11-06 02:05:16 +00:00
remove payout + bump damsel (#63)
Some checks failed
Deploy Docker Image / build-and-deploy (push) Has been cancelled
Some checks failed
Deploy Docker Image / build-and-deploy (push) Has been cancelled
This commit is contained in:
parent
48a2ac7799
commit
dec4f9c078
3
pom.xml
3
pom.xml
@ -39,6 +39,7 @@
|
||||
<dependency>
|
||||
<groupId>dev.vality</groupId>
|
||||
<artifactId>damsel</artifactId>
|
||||
<version>1.646-7762f6c</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>dev.vality.geck</groupId>
|
||||
@ -55,7 +56,7 @@
|
||||
<dependency>
|
||||
<groupId>dev.vality</groupId>
|
||||
<artifactId>deanonimus-proto</artifactId>
|
||||
<version>1.40-2a02d87</version>
|
||||
<version>1.41-6605c72</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>dev.vality</groupId>
|
||||
|
@ -20,15 +20,11 @@ public class ShopDomainToShopApiConverter implements Converter<dev.vality.deanon
|
||||
.setContractId(shopDomain.getContractId())
|
||||
.setDetails(new ShopDetails()
|
||||
.setName(shopDomain.getDetailsName())
|
||||
.setDescription(shopDomain.getDetailsDescription()))
|
||||
.setPayoutToolId(shopDomain.getPayoutToolId());
|
||||
.setDescription(shopDomain.getDetailsDescription()));
|
||||
setAccount(shopDomain, shop);
|
||||
var shopLocation = new ShopLocation();
|
||||
shopLocation.setUrl(shopDomain.getLocationUrl());
|
||||
shop.setLocation(shopLocation);
|
||||
if (shopDomain.getPayoutScheduleId() != null) {
|
||||
shop.setPayoutSchedule(new BusinessScheduleRef(shopDomain.getPayoutScheduleId()));
|
||||
}
|
||||
return shop;
|
||||
}
|
||||
|
||||
|
@ -26,8 +26,7 @@ public class Shop {
|
||||
private String accountCurrencyCode;
|
||||
private Long accountSettlement;
|
||||
private Long accountGuarantee;
|
||||
// Deprecated
|
||||
private Long accountPayout;
|
||||
private String contractId;
|
||||
private String payoutToolId;
|
||||
private Integer payoutScheduleId;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public class PartyCreatedHandler implements PartyManagementHandler {
|
||||
log.info("Start party created handling, sequenceId={}, partyId={}, changeId={}", sequenceId, partyId, changeId);
|
||||
Party party = new Party();
|
||||
party.setId(partyId);
|
||||
party.setEmail(partyCreated.getContactInfo().getEmail());
|
||||
party.setEmail(partyCreated.getContactInfo().getRegistrationEmail());
|
||||
party.setBlocking(Blocking.unblocked);
|
||||
party.setSuspension(Suspension.active);
|
||||
|
||||
|
@ -49,7 +49,6 @@ public class ShopContractChangedHandler extends AbstractClaimChangedHandler {
|
||||
Shop shop = party.getShopById(shopId).orElseThrow(() -> new ShopNotFoundException(shopId));
|
||||
|
||||
shop.setContractId(contractChanged.getContractId());
|
||||
shop.setPayoutToolId(contractChanged.getPayoutToolId());
|
||||
|
||||
openSearchService.updateParty(party);
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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<ClaimEffect> 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);
|
||||
}
|
||||
}
|
@ -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<ClaimEffect> 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);
|
||||
}
|
||||
}
|
@ -341,15 +341,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"payoutToolId": {
|
||||
"type": "text",
|
||||
"fields": {
|
||||
"keyword": {
|
||||
"type": "keyword",
|
||||
"ignore_above": 256
|
||||
}
|
||||
}
|
||||
},
|
||||
"suspension": {
|
||||
"type": "text",
|
||||
"fields": {
|
||||
|
Loading…
Reference in New Issue
Block a user