mirror of
https://github.com/valitydev/anapi-v2.git
synced 2024-11-06 00:25:17 +00:00
Upd swagger lib + rollback context building (#30)
This commit is contained in:
parent
78b4dac4f1
commit
e64a2d8d72
2
pom.xml
2
pom.xml
@ -43,7 +43,7 @@
|
||||
<dependency>
|
||||
<groupId>dev.vality</groupId>
|
||||
<artifactId>swag-anapi-v2</artifactId>
|
||||
<version>1.66-f571365-server</version>
|
||||
<version>1.68-bb14531-server</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>dev.vality</groupId>
|
||||
|
@ -10,7 +10,6 @@ import dev.vality.bouncer.decisions.Context;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.thrift.TDeserializer;
|
||||
import org.apache.thrift.TSerializer;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -28,29 +27,26 @@ public class BouncerContextFactory {
|
||||
|
||||
@SneakyThrows
|
||||
public Context buildContext(AnapiBouncerContext bouncerContext) {
|
||||
var contextFragment = orgManagerService.getUserAuthContext(
|
||||
keycloakService.getAccessToken().getSubject());
|
||||
var fragment = new ContextFragment();
|
||||
var deserializer = new TDeserializer();
|
||||
deserializer.deserialize(fragment, contextFragment.getContent());
|
||||
enrichContextFragment(bouncerContext, fragment);
|
||||
log.debug("Received user fragment from orgManager: {}", fragment.getUser());
|
||||
|
||||
var contextFragment = buildContextFragment(bouncerContext);
|
||||
var serializer = new TSerializer();
|
||||
|
||||
contextFragment = new dev.vality.bouncer.ctx.ContextFragment()
|
||||
var fragment = new dev.vality.bouncer.ctx.ContextFragment()
|
||||
.setType(ContextFragmentType.v1_thrift_binary)
|
||||
.setContent(serializer.serialize(fragment));
|
||||
.setContent(serializer.serialize(contextFragment));
|
||||
var userFragment = orgManagerService.getUserAuthContext(
|
||||
keycloakService.getAccessToken().getSubject());
|
||||
var context = new Context();
|
||||
context.putToFragments(bouncerProperties.getContextFragmentId(), contextFragment);
|
||||
context.putToFragments(bouncerProperties.getContextFragmentId(), fragment);
|
||||
context.putToFragments("user", userFragment);
|
||||
return context;
|
||||
}
|
||||
|
||||
private void enrichContextFragment(AnapiBouncerContext bouncerContext, ContextFragment fragment) {
|
||||
private ContextFragment buildContextFragment(AnapiBouncerContext bouncerContext) {
|
||||
var env = buildEnvironment();
|
||||
var contextAnalyticsApi = buildAnapiContext(bouncerContext);
|
||||
var contextReports = buildReportContext(bouncerContext);
|
||||
fragment.setAuth(buildAuth())
|
||||
ContextFragment fragment = new ContextFragment();
|
||||
return fragment
|
||||
.setAuth(buildAuth())
|
||||
.setEnv(env)
|
||||
.setAnapi(contextAnalyticsApi)
|
||||
.setReports(contextReports);
|
||||
|
@ -45,7 +45,6 @@ class StatPaymentToPaymentSearchResultConverterTest {
|
||||
() -> assertEquals(magistaPayment.getExternalId(), result.getExternalID()),
|
||||
() -> assertEquals(magistaPayment.getFee(), result.getFee()),
|
||||
() -> assertEquals(PaymentFlow.TypeEnum.PAYMENTFLOWINSTANT, result.getFlow().getType()),
|
||||
() -> assertNull(result.getGeoLocationInfo()),
|
||||
() -> assertEquals(magistaPayment.getStatusChangedAt(), result.getStatusChangedAt().toString()),
|
||||
() -> assertEquals(magistaPayment.getId(), result.getId()),
|
||||
() -> assertEquals(magistaPayment.getInvoiceId(), result.getInvoiceID()),
|
||||
|
Loading…
Reference in New Issue
Block a user