From 03a858f2882bedeb5925b65cb045ccbbb1202329 Mon Sep 17 00:00:00 2001
From: wayne <wayne8692wayne8692@gmail.com>
Date: 星期三, 24 十一月 2021 16:01:04 +0800
Subject: [PATCH] [update] otp呼叫方式調整,並針對sit版本除錯

---
 pamapi/src/main/java/com/pollex/pam/service/dto/OtpResponseDTO.java |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/pamapi/src/main/java/com/pollex/pam/service/dto/OtpResponseDTO.java b/pamapi/src/main/java/com/pollex/pam/service/dto/OtpResponseDTO.java
index 758001a..1919516 100644
--- a/pamapi/src/main/java/com/pollex/pam/service/dto/OtpResponseDTO.java
+++ b/pamapi/src/main/java/com/pollex/pam/service/dto/OtpResponseDTO.java
@@ -1,5 +1,8 @@
 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;
@@ -7,14 +10,18 @@
     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);
         }
     }
 

--
Gitblit v1.8.0