package com.pollex.pam.service.dto;
|
|
import java.util.Arrays;
|
import java.util.List;
|
|
public class OtpResponseDTO {
|
private final String indexKey;
|
private final boolean success;
|
private final String failCode;
|
private final String failReason;
|
|
public OtpResponseDTO(String[] strings) {
|
this(Arrays.asList(strings));
|
}
|
|
public OtpResponseDTO(List<String> strings) {
|
if(strings.size() == 4) {
|
this.indexKey = strings.get(0);
|
this.success = "0".equals(strings.get(1));
|
this.failCode = strings.get(2);
|
this.failReason = strings.get(3);
|
}
|
else {
|
throw new IllegalArgumentException("the otp response can't format: " + strings);
|
}
|
}
|
|
public String getIndexKey() {
|
return indexKey;
|
}
|
|
public boolean isSuccess() {
|
return success;
|
}
|
|
public String getFailCode() {
|
return failCode;
|
}
|
|
public String getFailReason() {
|
return failReason;
|
}
|
}
|