mirror of
https://github.com/valitydev/adapter-flow-lib.git
synced 2024-11-06 00:05:22 +00:00
Fix trx (#15)
This commit is contained in:
parent
9660ae04a6
commit
063586c512
2
pom.xml
2
pom.xml
@ -13,7 +13,7 @@
|
||||
</parent>
|
||||
|
||||
<artifactId>adapter-flow-lib</artifactId>
|
||||
<version>0.0.10</version>
|
||||
<version>0.0.11</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>adapter-flow-lib</name>
|
||||
|
@ -2,6 +2,7 @@ package dev.vality.adapter.flow.lib.flow.simple;
|
||||
|
||||
import dev.vality.adapter.flow.lib.constant.Status;
|
||||
import dev.vality.adapter.flow.lib.constant.Step;
|
||||
import dev.vality.adapter.flow.lib.constant.TargetStatus;
|
||||
import dev.vality.adapter.flow.lib.flow.ResultIntentResolver;
|
||||
import dev.vality.adapter.flow.lib.model.EntryStateModel;
|
||||
import dev.vality.adapter.flow.lib.model.ExitStateModel;
|
||||
@ -23,19 +24,18 @@ public class SimpleRedirectWithPollingResultIntentResolver implements ResultInte
|
||||
case CHECK_STATUS -> exitStateModel.getLastOperationStatus() == Status.NEED_REDIRECT
|
||||
? intentResultFactory.createSuspendIntentWithCallbackAfterTimeout(exitStateModel)
|
||||
: intentResultFactory.createSleepIntentWithExponentialPolling(exitStateModel);
|
||||
case DO_NOTHING -> createIntentByCurrentStep(exitStateModel, currentStep);
|
||||
case DO_NOTHING -> createIntentByTargetStatus(exitStateModel);
|
||||
case REFUND, CANCEL -> intentResultFactory.createFinishIntentSuccess();
|
||||
default -> throw new IllegalStateException("Wrong nextStep: " + nextStep);
|
||||
};
|
||||
}
|
||||
|
||||
private Intent createIntentByCurrentStep(ExitStateModel exitStateModel, Step currentStep) {
|
||||
return switch (currentStep) {
|
||||
case CHECK_STATUS, CHECK_NEED_3DS_V2, FINISH_THREE_DS_V1, FINISH_THREE_DS_V2, DO_NOTHING,
|
||||
PAY, AUTH -> intentResultFactory.createFinishIntentSuccessWithCheckToken(exitStateModel);
|
||||
case REFUND, CANCEL -> intentResultFactory.createFinishIntentSuccess();
|
||||
default -> throw new IllegalStateException("Wrong currentStep: " + currentStep);
|
||||
};
|
||||
private Intent createIntentByTargetStatus(ExitStateModel exitStateModel) {
|
||||
if (exitStateModel.getEntryStateModel().getTargetStatus() == TargetStatus.CANCELLED
|
||||
|| exitStateModel.getEntryStateModel().getTargetStatus() == TargetStatus.REFUNDED) {
|
||||
return intentResultFactory.createFinishIntentSuccess();
|
||||
}
|
||||
return intentResultFactory.createFinishIntentSuccessWithCheckToken(exitStateModel);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user