mirror of
https://github.com/valitydev/adapter-flow-lib.git
synced 2024-11-06 00:05:22 +00:00
Fix get card data (#9)
This commit is contained in:
parent
a99037996a
commit
40cab571c5
2
pom.xml
2
pom.xml
@ -13,7 +13,7 @@
|
|||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>adapter-flow-lib</artifactId>
|
<artifactId>adapter-flow-lib</artifactId>
|
||||||
<version>0.0.5</version>
|
<version>0.0.6</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>adapter-flow-lib</name>
|
<name>adapter-flow-lib</name>
|
||||||
|
@ -76,9 +76,11 @@ public class CtxToEntryModelConverter implements Converter<PaymentContext, Entry
|
|||||||
.providerTrxId(trx != null ? trx.getId() : temporaryContext.getProviderTrxId())
|
.providerTrxId(trx != null ? trx.getId() : temporaryContext.getProviderTrxId())
|
||||||
.savedData(trx != null ? trx.getExtra() : new HashMap<>())
|
.savedData(trx != null ? trx.getExtra() : new HashMap<>())
|
||||||
.successRedirectUrl(getSuccessRedirectUrl(payment, adapterConfigurations))
|
.successRedirectUrl(getSuccessRedirectUrl(payment, adapterConfigurations))
|
||||||
|
.threeDsDataFromMpiCallback(temporaryContext.getThreeDsData())
|
||||||
.build())
|
.build())
|
||||||
.targetStatus(targetStatus)
|
.targetStatus(targetStatus)
|
||||||
.currentStep(currentStep)
|
.currentStep(currentStep)
|
||||||
|
.startedPollingInfo(temporaryContext.getPollingInfo())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,6 +50,8 @@ public class RecCtxToEntryModelConverter implements Converter<RecurrentTokenCont
|
|||||||
|
|
||||||
TransactionInfo transactionInfo = tokenInfo.getTrx();
|
TransactionInfo transactionInfo = tokenInfo.getTrx();
|
||||||
Long orderId = idGenerator.get(tokenInfo.getPaymentTool().getId());
|
Long orderId = idGenerator.get(tokenInfo.getPaymentTool().getId());
|
||||||
|
var temporaryContext = temporaryContextService.getTemporaryContext(context, temporaryContextDeserializer);
|
||||||
|
|
||||||
return entryStateModelBuilder
|
return entryStateModelBuilder
|
||||||
.baseRequestModel(BaseRequestModel.builder()
|
.baseRequestModel(BaseRequestModel.builder()
|
||||||
.recurrentPaymentData(RecurrentPaymentData
|
.recurrentPaymentData(RecurrentPaymentData
|
||||||
@ -74,8 +76,10 @@ public class RecCtxToEntryModelConverter implements Converter<RecurrentTokenCont
|
|||||||
.savedData(transactionInfo == null || transactionInfo.getExtra() == null
|
.savedData(transactionInfo == null || transactionInfo.getExtra() == null
|
||||||
? new HashMap<>()
|
? new HashMap<>()
|
||||||
: transactionInfo.getExtra())
|
: transactionInfo.getExtra())
|
||||||
|
.threeDsDataFromMpiCallback(temporaryContext.getThreeDsData())
|
||||||
.build())
|
.build())
|
||||||
.currentStep(generalExitStateModel.getNextStep())
|
.currentStep(generalExitStateModel.getNextStep())
|
||||||
|
.startedPollingInfo(temporaryContext.getPollingInfo())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import dev.vality.adapter.flow.lib.model.ThreeDsData;
|
|||||||
import dev.vality.adapter.flow.lib.serde.ParametersSerializer;
|
import dev.vality.adapter.flow.lib.serde.ParametersSerializer;
|
||||||
import dev.vality.adapter.flow.lib.utils.CallbackUrlExtractor;
|
import dev.vality.adapter.flow.lib.utils.CallbackUrlExtractor;
|
||||||
import dev.vality.adapter.flow.lib.utils.ThreeDsDataInitializer;
|
import dev.vality.adapter.flow.lib.utils.ThreeDsDataInitializer;
|
||||||
|
import dev.vality.adapter.flow.lib.utils.TimeoutUtils;
|
||||||
import dev.vality.adapter.flow.lib.utils.TimerProperties;
|
import dev.vality.adapter.flow.lib.utils.TimerProperties;
|
||||||
import dev.vality.damsel.base.Timer;
|
import dev.vality.damsel.base.Timer;
|
||||||
import dev.vality.damsel.proxy_provider.*;
|
import dev.vality.damsel.proxy_provider.*;
|
||||||
@ -72,13 +73,13 @@ public class IntentResultFactory {
|
|||||||
String redirectUrl = entryStateModel.getBaseRequestModel().getSuccessRedirectUrl();
|
String redirectUrl = entryStateModel.getBaseRequestModel().getSuccessRedirectUrl();
|
||||||
params.put(RedirectFields.TERM_URL.getValue(), callbackUrlExtractor.extractCallbackUrl(redirectUrl));
|
params.put(RedirectFields.TERM_URL.getValue(), callbackUrlExtractor.extractCallbackUrl(redirectUrl));
|
||||||
ThreeDsData threeDsData = exitStateModel.getThreeDsData();
|
ThreeDsData threeDsData = exitStateModel.getThreeDsData();
|
||||||
int timerRedirectTimeout = extractRedirectTimeout(
|
int timerRedirectTimeoutMin = extractRedirectTimeout(
|
||||||
entryStateModel.getBaseRequestModel().getAdapterConfigurations(),
|
entryStateModel.getBaseRequestModel().getAdapterConfigurations(),
|
||||||
timerProperties.getRedirectTimeoutMin());
|
timerProperties.getRedirectTimeoutMin());
|
||||||
return Intent.suspend(
|
return Intent.suspend(
|
||||||
new SuspendIntent(
|
new SuspendIntent(
|
||||||
tagManagementService.findTag(params),
|
tagManagementService.findTag(params),
|
||||||
Timer.timeout(timerRedirectTimeout))
|
Timer.timeout(TimeoutUtils.toSeconds(timerRedirectTimeoutMin)))
|
||||||
.setTimeoutBehaviour(TimeoutBehaviour.callback(
|
.setTimeoutBehaviour(TimeoutBehaviour.callback(
|
||||||
ByteBuffer.wrap(parametersSerializer.writeByte(params)))
|
ByteBuffer.wrap(parametersSerializer.writeByte(params)))
|
||||||
).setUserInteraction(createPostUserInteraction(threeDsData.getAcsUrl(), params))
|
).setUserInteraction(createPostUserInteraction(threeDsData.getAcsUrl(), params))
|
||||||
@ -102,11 +103,9 @@ public class IntentResultFactory {
|
|||||||
exitStateModel.setPollingInfo(pollingInfo);
|
exitStateModel.setPollingInfo(pollingInfo);
|
||||||
|
|
||||||
Map<String, String> adapterConfigurations = entryStateModel.getBaseRequestModel().getAdapterConfigurations();
|
Map<String, String> adapterConfigurations = entryStateModel.getBaseRequestModel().getAdapterConfigurations();
|
||||||
int nextTimeout =
|
int nextTimeoutSec =
|
||||||
exponentialBackOffPollingService.prepareNextPollingInterval(pollingInfo, adapterConfigurations);
|
exponentialBackOffPollingService.prepareNextPollingInterval(pollingInfo, adapterConfigurations);
|
||||||
return Intent.sleep(
|
return Intent.sleep(new SleepIntent(Timer.timeout(nextTimeoutSec)));
|
||||||
new SleepIntent(Timer.timeout(nextTimeout))
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Intent createFinishIntentFailed(ExitStateModel exitStateModel) {
|
public Intent createFinishIntentFailed(ExitStateModel exitStateModel) {
|
||||||
|
@ -7,6 +7,7 @@ import dev.vality.adapter.flow.lib.model.PollingInfo;
|
|||||||
import dev.vality.adapter.flow.lib.model.ThreeDsData;
|
import dev.vality.adapter.flow.lib.model.ThreeDsData;
|
||||||
import dev.vality.adapter.flow.lib.utils.CallbackUrlExtractor;
|
import dev.vality.adapter.flow.lib.utils.CallbackUrlExtractor;
|
||||||
import dev.vality.adapter.flow.lib.utils.ThreeDsDataInitializer;
|
import dev.vality.adapter.flow.lib.utils.ThreeDsDataInitializer;
|
||||||
|
import dev.vality.adapter.flow.lib.utils.TimeoutUtils;
|
||||||
import dev.vality.adapter.flow.lib.utils.TimerProperties;
|
import dev.vality.adapter.flow.lib.utils.TimerProperties;
|
||||||
import dev.vality.damsel.base.Timer;
|
import dev.vality.damsel.base.Timer;
|
||||||
import dev.vality.damsel.proxy_provider.*;
|
import dev.vality.damsel.proxy_provider.*;
|
||||||
@ -35,13 +36,13 @@ public class RecurrentIntentResultFactory {
|
|||||||
Map<String, String> params = ThreeDsDataInitializer.initThreeDsParameters(exitStateModel);
|
Map<String, String> params = ThreeDsDataInitializer.initThreeDsParameters(exitStateModel);
|
||||||
String redirectUrl = entryStateModel.getBaseRequestModel().getSuccessRedirectUrl();
|
String redirectUrl = entryStateModel.getBaseRequestModel().getSuccessRedirectUrl();
|
||||||
params.put(RedirectFields.TERM_URL.getValue(), callbackUrlExtractor.extractCallbackUrl(redirectUrl));
|
params.put(RedirectFields.TERM_URL.getValue(), callbackUrlExtractor.extractCallbackUrl(redirectUrl));
|
||||||
int timerRedirectTimeout = extractRedirectTimeout(
|
int timerRedirectTimeoutMin = extractRedirectTimeout(
|
||||||
entryStateModel.getBaseRequestModel().getAdapterConfigurations(),
|
entryStateModel.getBaseRequestModel().getAdapterConfigurations(),
|
||||||
timerProperties.getRedirectTimeoutMin());
|
timerProperties.getRedirectTimeoutMin());
|
||||||
return RecurrentTokenIntent.suspend(
|
return RecurrentTokenIntent.suspend(
|
||||||
new SuspendIntent(
|
new SuspendIntent(
|
||||||
tagManagementService.findTag(params),
|
tagManagementService.findTag(params),
|
||||||
Timer.timeout(timerRedirectTimeout)
|
Timer.timeout(TimeoutUtils.toSeconds(timerRedirectTimeoutMin))
|
||||||
).setUserInteraction(createPostUserInteraction(threeDsData.getAcsUrl(), params))
|
).setUserInteraction(createPostUserInteraction(threeDsData.getAcsUrl(), params))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -59,10 +60,10 @@ public class RecurrentIntentResultFactory {
|
|||||||
exitStateModel.setPollingInfo(pollingInfo);
|
exitStateModel.setPollingInfo(pollingInfo);
|
||||||
|
|
||||||
Map<String, String> adapterConfigurations = entryStateModel.getBaseRequestModel().getAdapterConfigurations();
|
Map<String, String> adapterConfigurations = entryStateModel.getBaseRequestModel().getAdapterConfigurations();
|
||||||
int nextTimeout =
|
int nextTimeoutSec =
|
||||||
exponentialBackOffPollingService.prepareNextPollingInterval(pollingInfo, adapterConfigurations);
|
exponentialBackOffPollingService.prepareNextPollingInterval(pollingInfo, adapterConfigurations);
|
||||||
return RecurrentTokenIntent.sleep(
|
return RecurrentTokenIntent.sleep(
|
||||||
new SleepIntent(Timer.timeout(nextTimeout))
|
new SleepIntent(Timer.timeout(nextTimeoutSec))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
package dev.vality.adapter.flow.lib.utils;
|
||||||
|
|
||||||
|
public class TimeoutUtils {
|
||||||
|
|
||||||
|
public static int toSeconds(int timerRedirectTimeoutMin) {
|
||||||
|
return timerRedirectTimeoutMin * 60;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user