mirror of
https://github.com/valitydev/adapter-flow-lib.git
synced 2024-11-06 00:05:22 +00:00
Add preAuth (#34)
This commit is contained in:
parent
35685ba833
commit
ba825592ca
2
pom.xml
2
pom.xml
@ -12,7 +12,7 @@
|
||||
</parent>
|
||||
|
||||
<artifactId>adapter-flow-lib</artifactId>
|
||||
<version>0.1.5</version>
|
||||
<version>0.1.6</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>adapter-flow-lib</name>
|
||||
|
@ -10,6 +10,10 @@ import dev.vality.adapter.flow.lib.model.BaseResponseModel;
|
||||
*/
|
||||
public interface RemoteClient {
|
||||
|
||||
default BaseResponseModel preAuth(BaseRequestModel request) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
default BaseResponseModel auth(BaseRequestModel request) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package dev.vality.adapter.flow.lib.constant;
|
||||
|
||||
public enum Step {
|
||||
|
||||
PRE_AUTH,
|
||||
AUTH,
|
||||
PAY,
|
||||
GENERATE_TOKEN,
|
||||
|
@ -0,0 +1,29 @@
|
||||
package dev.vality.adapter.flow.lib.handler.payment;
|
||||
|
||||
import dev.vality.adapter.flow.lib.client.RemoteClient;
|
||||
import dev.vality.adapter.flow.lib.constant.Step;
|
||||
import dev.vality.adapter.flow.lib.handler.CommonHandlerImpl;
|
||||
import dev.vality.adapter.flow.lib.model.BaseRequestModel;
|
||||
import dev.vality.adapter.flow.lib.model.BaseResponseModel;
|
||||
import dev.vality.adapter.flow.lib.model.EntryStateModel;
|
||||
import dev.vality.adapter.flow.lib.model.ExitStateModel;
|
||||
import dev.vality.adapter.flow.lib.processor.Processor;
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
|
||||
|
||||
public class PreAuthHandler
|
||||
extends CommonHandlerImpl<BaseRequestModel, BaseResponseModel, EntryStateModel, ExitStateModel> {
|
||||
|
||||
public PreAuthHandler(
|
||||
RemoteClient client,
|
||||
Converter<EntryStateModel, BaseRequestModel> converter,
|
||||
Processor<ExitStateModel, BaseResponseModel, EntryStateModel> responseProcessorChain
|
||||
) {
|
||||
super(client::preAuth, converter, responseProcessorChain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHandle(EntryStateModel entryStateModel) {
|
||||
return Step.PRE_AUTH == entryStateModel.getCurrentStep();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user