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>
|
</parent>
|
||||||
|
|
||||||
<artifactId>adapter-flow-lib</artifactId>
|
<artifactId>adapter-flow-lib</artifactId>
|
||||||
<version>0.0.10</version>
|
<version>0.0.11</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>adapter-flow-lib</name>
|
<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.Status;
|
||||||
import dev.vality.adapter.flow.lib.constant.Step;
|
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.flow.ResultIntentResolver;
|
||||||
import dev.vality.adapter.flow.lib.model.EntryStateModel;
|
import dev.vality.adapter.flow.lib.model.EntryStateModel;
|
||||||
import dev.vality.adapter.flow.lib.model.ExitStateModel;
|
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
|
case CHECK_STATUS -> exitStateModel.getLastOperationStatus() == Status.NEED_REDIRECT
|
||||||
? intentResultFactory.createSuspendIntentWithCallbackAfterTimeout(exitStateModel)
|
? intentResultFactory.createSuspendIntentWithCallbackAfterTimeout(exitStateModel)
|
||||||
: intentResultFactory.createSleepIntentWithExponentialPolling(exitStateModel);
|
: intentResultFactory.createSleepIntentWithExponentialPolling(exitStateModel);
|
||||||
case DO_NOTHING -> createIntentByCurrentStep(exitStateModel, currentStep);
|
case DO_NOTHING -> createIntentByTargetStatus(exitStateModel);
|
||||||
case REFUND, CANCEL -> intentResultFactory.createFinishIntentSuccess();
|
case REFUND, CANCEL -> intentResultFactory.createFinishIntentSuccess();
|
||||||
default -> throw new IllegalStateException("Wrong nextStep: " + nextStep);
|
default -> throw new IllegalStateException("Wrong nextStep: " + nextStep);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private Intent createIntentByCurrentStep(ExitStateModel exitStateModel, Step currentStep) {
|
private Intent createIntentByTargetStatus(ExitStateModel exitStateModel) {
|
||||||
return switch (currentStep) {
|
if (exitStateModel.getEntryStateModel().getTargetStatus() == TargetStatus.CANCELLED
|
||||||
case CHECK_STATUS, CHECK_NEED_3DS_V2, FINISH_THREE_DS_V1, FINISH_THREE_DS_V2, DO_NOTHING,
|
|| exitStateModel.getEntryStateModel().getTargetStatus() == TargetStatus.REFUNDED) {
|
||||||
PAY, AUTH -> intentResultFactory.createFinishIntentSuccessWithCheckToken(exitStateModel);
|
return intentResultFactory.createFinishIntentSuccess();
|
||||||
case REFUND, CANCEL -> intentResultFactory.createFinishIntentSuccess();
|
}
|
||||||
default -> throw new IllegalStateException("Wrong currentStep: " + currentStep);
|
return intentResultFactory.createFinishIntentSuccessWithCheckToken(exitStateModel);
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user