* The string must contain the date and time in UTC in the following format: * `2016-03-22T06:12:27Z` */ diff --git a/src/main/java/dev/vality/adapter/flow/lib/model/Currency.java b/src/main/java/dev/vality/adapter/flow/lib/model/Currency.java new file mode 100644 index 0000000..e52511e --- /dev/null +++ b/src/main/java/dev/vality/adapter/flow/lib/model/Currency.java @@ -0,0 +1,23 @@ +package dev.vality.adapter.flow.lib.model; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + +@Data +@SuperBuilder +@NoArgsConstructor +@AllArgsConstructor +public class Currency { + + /** + * Currency in symbolic formats (example: "USD"). + */ + private String symbolicCode; + /** + * Currency in symbolic formats (example: "USD"). + */ + private Short numericCode; + +} diff --git a/src/main/java/dev/vality/adapter/flow/lib/model/ThreeDsData.java b/src/main/java/dev/vality/adapter/flow/lib/model/ThreeDsData.java index 17817fb..3a273dc 100644 --- a/src/main/java/dev/vality/adapter/flow/lib/model/ThreeDsData.java +++ b/src/main/java/dev/vality/adapter/flow/lib/model/ThreeDsData.java @@ -1,5 +1,6 @@ package dev.vality.adapter.flow.lib.model; +import dev.vality.adapter.flow.lib.constant.HttpMethod; import dev.vality.adapter.flow.lib.constant.ThreeDsType; import lombok.AllArgsConstructor; import lombok.Data; @@ -14,6 +15,10 @@ import java.util.Map; @AllArgsConstructor public class ThreeDsData { + /** + * Http method type. + */ + private HttpMethod httpMethod = HttpMethod.GET; /** * Use type to select desired 3ds flow. */ diff --git a/src/main/java/dev/vality/adapter/flow/lib/service/IntentResultFactory.java b/src/main/java/dev/vality/adapter/flow/lib/service/IntentResultFactory.java index 8dcd9d3..1655bef 100644 --- a/src/main/java/dev/vality/adapter/flow/lib/service/IntentResultFactory.java +++ b/src/main/java/dev/vality/adapter/flow/lib/service/IntentResultFactory.java @@ -1,5 +1,6 @@ package dev.vality.adapter.flow.lib.service; +import dev.vality.adapter.flow.lib.constant.HttpMethod; import dev.vality.adapter.flow.lib.constant.RedirectFields; import dev.vality.adapter.flow.lib.model.EntryStateModel; import dev.vality.adapter.flow.lib.model.ExitStateModel; @@ -13,6 +14,7 @@ import dev.vality.adapter.flow.lib.utils.TimerProperties; import dev.vality.damsel.base.Timer; import dev.vality.damsel.proxy_provider.*; import dev.vality.damsel.timeout_behaviour.TimeoutBehaviour; +import dev.vality.damsel.user_interaction.UserInteraction; import dev.vality.error.mapping.ErrorMapping; import lombok.RequiredArgsConstructor; @@ -81,18 +83,22 @@ public class IntentResultFactory { Timer.timeout(TimeoutUtils.toSeconds(timerRedirectTimeoutMin))) .setTimeoutBehaviour(TimeoutBehaviour.callback( ByteBuffer.wrap(parametersSerializer.writeByte(params))) - ).setUserInteraction(createGetUserInteraction(threeDsData.getAcsUrl())) + ).setUserInteraction(createUserInteraction(threeDsData)) ); } + private UserInteraction createUserInteraction(ThreeDsData threeDsData) { + if (threeDsData.getHttpMethod() == HttpMethod.GET) { + return createGetUserInteraction(threeDsData.getAcsUrl()); + } else { + return createPostUserInteraction(threeDsData.getAcsUrl(), threeDsData.getParameters()); + } + } + public Intent createFinishIntentSuccess() { return Intent.finish(new FinishIntent(FinishStatus.success(new Success()))); } - public Intent createSleepIntentForReinvocation() { - return Intent.sleep(new SleepIntent(Timer.timeout(0))); - } - public Intent createSleepIntentWithExponentialPolling(ExitStateModel exitStateModel) { EntryStateModel entryStateModel = exitStateModel.getEntryStateModel(); PollingInfo pollingInfo = pollingInfoService.initPollingInfo(entryStateModel);