From 23c1665f0ec63648208283c0497d6077a73efdcd Mon Sep 17 00:00:00 2001 From: Egor Cherniak Date: Mon, 5 Jun 2023 11:19:46 +0300 Subject: [PATCH] Add additional info + custom context (#68) --- pom.xml | 2 +- .../ExitStateModelToTemporaryContextConverter.java | 1 + .../converter/entry/CtxToEntryModelConverter.java | 14 ++++++++++++++ .../flow/lib/handler/payment/DoNothingHandler.java | 1 + .../adapter/flow/lib/model/BaseRequestModel.java | 8 ++++++++ .../adapter/flow/lib/model/BaseResponseModel.java | 4 ++++ .../adapter/flow/lib/model/ExitStateModel.java | 1 + .../adapter/flow/lib/model/TemporaryContext.java | 1 + .../adapter/flow/lib/processor/ErrorProcessor.java | 1 + .../flow/lib/processor/RedirectProcessor.java | 1 + .../adapter/flow/lib/processor/RetryProcessor.java | 1 + .../flow/lib/processor/SuccessFinishProcessor.java | 1 + 12 files changed, 35 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4332de0..da15417 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ adapter-flow-lib - 0.1.24 + 0.1.25 jar adapter-flow-lib diff --git a/src/main/java/dev/vality/adapter/flow/lib/converter/ExitStateModelToTemporaryContextConverter.java b/src/main/java/dev/vality/adapter/flow/lib/converter/ExitStateModelToTemporaryContextConverter.java index c4f97f0..bdb4aa4 100644 --- a/src/main/java/dev/vality/adapter/flow/lib/converter/ExitStateModelToTemporaryContextConverter.java +++ b/src/main/java/dev/vality/adapter/flow/lib/converter/ExitStateModelToTemporaryContextConverter.java @@ -12,6 +12,7 @@ public class ExitStateModelToTemporaryContextConverter implements Converter()) + .additionalTrxInfo(getAdditionalTrxInfo(context)) .successRedirectUrl(getSuccessRedirectUrl(payment, adapterConfigurations)) .failedRedirectUrl(getFailureRedirectUrl(payment, adapterConfigurations)) .threeDsDataFromMpiCallback(temporaryContext.getThreeDsData()) @@ -186,5 +188,17 @@ public class CtxToEntryModelConverter implements Converter savedData; + /** + * Additional trx info from previous steps. + */ + private AdditionalTrxInfo additionalTrxInfo; /** * Data that comes in a callback from mpi after the 3ds step. * Parameter names can be unique to your implementation, only you can know. */ private Map threeDsDataFromMpiCallback; + /** + * Custom data for more flexibility + */ + private byte[] customContext; } diff --git a/src/main/java/dev/vality/adapter/flow/lib/model/BaseResponseModel.java b/src/main/java/dev/vality/adapter/flow/lib/model/BaseResponseModel.java index fa4b969..f8c8899 100644 --- a/src/main/java/dev/vality/adapter/flow/lib/model/BaseResponseModel.java +++ b/src/main/java/dev/vality/adapter/flow/lib/model/BaseResponseModel.java @@ -42,5 +42,9 @@ public class BaseResponseModel { * Data for support about transactions. */ private AdditionalTrxInfo additionalTrxInfo; + /** + * Custom data for more flexibility + */ + private byte[] customContext; } \ No newline at end of file diff --git a/src/main/java/dev/vality/adapter/flow/lib/model/ExitStateModel.java b/src/main/java/dev/vality/adapter/flow/lib/model/ExitStateModel.java index 50cfdd6..3ed2f01 100644 --- a/src/main/java/dev/vality/adapter/flow/lib/model/ExitStateModel.java +++ b/src/main/java/dev/vality/adapter/flow/lib/model/ExitStateModel.java @@ -29,6 +29,7 @@ public class ExitStateModel { private AdditionalTrxInfo additionalTrxInfo; private String recToken; + private byte[] customContext; } \ No newline at end of file diff --git a/src/main/java/dev/vality/adapter/flow/lib/model/TemporaryContext.java b/src/main/java/dev/vality/adapter/flow/lib/model/TemporaryContext.java index 2da377c..41c8eac 100644 --- a/src/main/java/dev/vality/adapter/flow/lib/model/TemporaryContext.java +++ b/src/main/java/dev/vality/adapter/flow/lib/model/TemporaryContext.java @@ -18,5 +18,6 @@ public class TemporaryContext { private String providerTrxId; private PollingInfo pollingInfo; private Map threeDsData; + private byte[] customContext; } 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 7612173..ab7336f 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 @@ -21,6 +21,7 @@ public class ErrorProcessor implements Processor saveData = response.getSaveData(); if (entryStateModel.getBaseRequestModel().getRecurrentPaymentData() != null && entryStateModel.getBaseRequestModel().getRecurrentPaymentData().isMakeRecurrent()) {