| | |
| | | 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 failReason; |
| | | |
| | | public OtpResponseDTO(String[] strings) { |
| | | if(strings.length == 4) { |
| | | this.indexKey = strings[0]; |
| | | this.success = "0".equals(strings[1]); |
| | | this.failCode = strings[2]; |
| | | this.failReason = strings[3]; |
| | | 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 RuntimeException("the otp response can't format"); |
| | | throw new IllegalArgumentException("the otp response can't format: " + strings); |
| | | } |
| | | } |
| | | |