From 4c10c52e063731f41b784afb932831032bb3be31 Mon Sep 17 00:00:00 2001 From: Anatolii Karlov Date: Thu, 18 May 2023 20:12:16 +0600 Subject: [PATCH] add trxInfo for error flow (#67) * add trxInfo for error flow * add trxInfo for error flow --- pom.xml | 2 +- .../exit/ExitModelToProxyResultConverter.java | 23 ++++++++++-------- ...itModelToRecTokenProxyResultConverter.java | 24 +++++++++++-------- .../flow/lib/processor/ErrorProcessor.java | 5 ++++ 4 files changed, 33 insertions(+), 21 deletions(-) diff --git a/pom.xml b/pom.xml index 875dbad..4332de0 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ adapter-flow-lib - 0.1.23 + 0.1.24 jar adapter-flow-lib diff --git a/src/main/java/dev/vality/adapter/flow/lib/converter/exit/ExitModelToProxyResultConverter.java b/src/main/java/dev/vality/adapter/flow/lib/converter/exit/ExitModelToProxyResultConverter.java index a72aa6c..9ea4c3a 100644 --- a/src/main/java/dev/vality/adapter/flow/lib/converter/exit/ExitModelToProxyResultConverter.java +++ b/src/main/java/dev/vality/adapter/flow/lib/converter/exit/ExitModelToProxyResultConverter.java @@ -28,23 +28,26 @@ public class ExitModelToProxyResultConverter implements Converter()) - .setAdditionalInfo(AdditionalInfoUtils.initAdditionalTrxInfo(exitStateModel)) - ); + .setTrx(getTransactionInfo(exitStateModel)); } - + private TransactionInfo getTransactionInfo(ExitStateModel exitStateModel) { + return new TransactionInfo() + .setId(exitStateModel.getProviderTrxId()) + .setExtra(exitStateModel.getTrxExtra() != null + ? exitStateModel.getTrxExtra() + : new HashMap<>()) + .setAdditionalInfo(AdditionalInfoUtils.initAdditionalTrxInfo(exitStateModel)); + } } diff --git a/src/main/java/dev/vality/adapter/flow/lib/converter/exit/ExitModelToRecTokenProxyResultConverter.java b/src/main/java/dev/vality/adapter/flow/lib/converter/exit/ExitModelToRecTokenProxyResultConverter.java index 50442ed..438ff57 100644 --- a/src/main/java/dev/vality/adapter/flow/lib/converter/exit/ExitModelToRecTokenProxyResultConverter.java +++ b/src/main/java/dev/vality/adapter/flow/lib/converter/exit/ExitModelToRecTokenProxyResultConverter.java @@ -11,6 +11,7 @@ import dev.vality.damsel.proxy_provider.RecurrentTokenIntent; import dev.vality.damsel.proxy_provider.RecurrentTokenProxyResult; import lombok.RequiredArgsConstructor; import org.springframework.core.convert.converter.Converter; +import org.springframework.util.StringUtils; import java.util.HashMap; @@ -28,23 +29,26 @@ public class ExitModelToRecTokenProxyResultConverter implements Converter()) - .setAdditionalInfo(AdditionalInfoUtils.initAdditionalTrxInfo(exitStateModel)) - ); + .setTrx(getTransactionInfo(exitStateModel)); } + private TransactionInfo getTransactionInfo(ExitStateModel exitStateModel) { + return new TransactionInfo() + .setId(exitStateModel.getProviderTrxId()) + .setExtra(exitStateModel.getTrxExtra() != null + ? exitStateModel.getTrxExtra() + : new HashMap<>()) + .setAdditionalInfo(AdditionalInfoUtils.initAdditionalTrxInfo(exitStateModel)); + } } diff --git a/src/main/java/dev/vality/adapter/flow/lib/processor/ErrorProcessor.java b/src/main/java/dev/vality/adapter/flow/lib/processor/ErrorProcessor.java index 4fd7411..7612173 100644 --- a/src/main/java/dev/vality/adapter/flow/lib/processor/ErrorProcessor.java +++ b/src/main/java/dev/vality/adapter/flow/lib/processor/ErrorProcessor.java @@ -6,6 +6,7 @@ import dev.vality.adapter.flow.lib.model.ExitStateModel; import dev.vality.adapter.flow.lib.utils.ErrorUtils; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.util.StringUtils; @Slf4j @RequiredArgsConstructor @@ -20,6 +21,10 @@ public class ErrorProcessor implements Processor