@@ -37,10 +37,13 @@ func ThIDCardCID(card Transmitter, opt ...OptThIDCard) (string, error) {
37
37
o (& cfg )
38
38
}
39
39
40
- cid , err := APDUGetRsp (card , APDUThaiIDCardCID )
40
+ resp , err := APDUGetRsp (card , APDUThaiIDCardCID )
41
+ resp = []byte (strings .Replace (string (resp ), " " , "" , - 1 ))
42
+ resp = bytes .Replace (resp , []byte ("\000 " ), nil , - 1 )
41
43
if err != nil {
42
44
return "" , err
43
45
}
46
+ cid := resp
44
47
45
48
return thIDCardMutateString (string (cid ), cfg )
46
49
}
@@ -52,10 +55,13 @@ func ThIDCardFullnameEn(card Transmitter, opt ...OptThIDCard) (string, error) {
52
55
o (& cfg )
53
56
}
54
57
55
- fullnameEN , err := APDUGetRsp (card , APDUThaiIDCardFullnameEn )
58
+ resp , err := APDUGetRsp (card , APDUThaiIDCardFullnameEn )
59
+ resp = []byte (strings .Replace (string (resp ), " " , "" , - 1 ))
60
+ resp = bytes .Replace (resp , []byte ("\000 " ), nil , - 1 )
56
61
if err != nil {
57
62
return "" , err
58
63
}
64
+ fullnameEN := resp
59
65
60
66
return thIDCardMutateString (string (fullnameEN ), cfg )
61
67
}
@@ -67,10 +73,13 @@ func ThIDCardFullnameTh(card Transmitter, opt ...OptThIDCard) (string, error) {
67
73
o (& cfg )
68
74
}
69
75
70
- fullnameTH , err := APDUGetRsp (card , APDUThaiIDCardFullnameTh )
76
+ resp , err := APDUGetRsp (card , APDUThaiIDCardFullnameTh )
77
+ resp = []byte (strings .Replace (string (resp ), " " , "" , - 1 ))
78
+ resp = bytes .Replace (resp , []byte ("\000 " ), nil , - 1 )
71
79
if err != nil {
72
80
return "" , err
73
81
}
82
+ fullnameTH := resp
74
83
75
84
return thIDCardMutateString (string (fullnameTH ), cfg )
76
85
}
@@ -82,10 +91,13 @@ func ThIDCardBirth(card Transmitter, opt ...OptThIDCard) (string, error) {
82
91
o (& cfg )
83
92
}
84
93
85
- birth , err := APDUGetRsp (card , APDUThaiIDCardBirth )
94
+ resp , err := APDUGetRsp (card , APDUThaiIDCardBirth )
95
+ resp = []byte (strings .Replace (string (resp ), " " , "" , - 1 ))
96
+ resp = bytes .Replace (resp , []byte ("\000 " ), nil , - 1 )
86
97
if err != nil {
87
98
return "" , err
88
99
}
100
+ birth := resp
89
101
90
102
return thIDCardMutateString (string (birth ), cfg )
91
103
}
@@ -97,10 +109,13 @@ func ThIDCardGender(card Transmitter, opt ...OptThIDCard) (string, error) {
97
109
o (& cfg )
98
110
}
99
111
100
- gender , err := APDUGetRsp (card , APDUThaiIDCardGender )
112
+ resp , err := APDUGetRsp (card , APDUThaiIDCardGender )
113
+ resp = []byte (strings .Replace (string (resp ), " " , "" , - 1 ))
114
+ resp = bytes .Replace (resp , []byte ("\000 " ), nil , - 1 )
101
115
if err != nil {
102
116
return "" , err
103
117
}
118
+ gender := resp
104
119
105
120
return thIDCardMutateString (string (gender ), cfg )
106
121
}
@@ -131,12 +146,15 @@ func ThIDCardIssueDate(card Transmitter, opt ...OptThIDCard) (string, error) {
131
146
o (& cfg )
132
147
}
133
148
134
- issuer , err := APDUGetRsp (card , APDUThaiIDCardIssuedate )
149
+ resp , err := APDUGetRsp (card , APDUThaiIDCardIssuedate )
150
+ resp = []byte (strings .Replace (string (resp ), " " , "" , - 1 ))
151
+ resp = bytes .Replace (resp , []byte ("\000 " ), nil , - 1 )
135
152
if err != nil {
136
153
return "" , err
137
154
}
155
+ issuerDate := resp
138
156
139
- return thIDCardMutateString (string (issuer ), cfg )
157
+ return thIDCardMutateString (string (issuerDate ), cfg )
140
158
}
141
159
142
160
//ThIDCardExpireDate get expire date from Thai national ID smart card.
@@ -146,12 +164,15 @@ func ThIDCardExpireDate(card Transmitter, opt ...OptThIDCard) (string, error) {
146
164
o (& cfg )
147
165
}
148
166
149
- expire , err := APDUGetRsp (card , APDUThaiIDCardExpiredate )
167
+ resp , err := APDUGetRsp (card , APDUThaiIDCardExpiredate )
168
+ resp = []byte (strings .Replace (string (resp ), " " , "" , - 1 ))
169
+ resp = bytes .Replace (resp , []byte ("\000 " ), nil , - 1 )
150
170
if err != nil {
151
171
return "" , err
152
172
}
173
+ expireDate := resp
153
174
154
- return thIDCardMutateString (string (expire ), cfg )
175
+ return thIDCardMutateString (string (expireDate ), cfg )
155
176
}
156
177
157
178
//ThIDCardAddress get address from Thai national ID smart card.
@@ -161,10 +182,13 @@ func ThIDCardAddress(card Transmitter, opt ...OptThIDCard) (string, error) {
161
182
o (& cfg )
162
183
}
163
184
164
- address , err := APDUGetRsp (card , APDUThaiIDCardAddress )
185
+ resp , err := APDUGetRsp (card , APDUThaiIDCardAddress )
186
+ resp = []byte (strings .Replace (string (resp ), " " , "" , - 1 ))
187
+ resp = bytes .Replace (resp , []byte ("\000 " ), nil , - 1 )
165
188
if err != nil {
166
189
return "" , err
167
190
}
191
+ address := resp
168
192
169
193
return thIDCardMutateString (string (address ), cfg )
170
194
}
0 commit comments