Revision | 7ea2f1f66fd4a3b695b264c8805c54d2f8f24cc1 (tree) |
---|---|
Zeit | 2022-01-12 11:31:12 |
Autor | Sergey Gusarov <laborer2008@gmai...> |
Commiter | Sergey Gusarov |
Description: check for repeated keywords like ACCOUNT_00 and ACCOUNT_00
@@ -142,9 +142,16 @@ | ||
142 | 142 | raise ValueError('Invalid body length: \'' + bodyLen + '\'') |
143 | 143 | |
144 | 144 | self._accounts = [] |
145 | + accountNumbers = [] | |
146 | + | |
145 | 147 | self._cards = [] |
148 | + cardNumbers = [] | |
149 | + | |
146 | 150 | self._contracts = [] |
151 | + contractNumbers = [] | |
152 | + | |
147 | 153 | self._passwords = [] |
154 | + passwordNumbers = [] | |
148 | 155 | |
149 | 156 | self._comment = None |
150 | 157 | self._keyWord = None |
@@ -205,23 +212,47 @@ | ||
205 | 212 | keyWord = self.getKeyWord(firstLineItem, accountName) |
206 | 213 | |
207 | 214 | if keyWord.startswith(Description.KeyWord.Prefix.ACCOUNT): |
208 | - accountNumber = AccountNumber(lineItems[1]) | |
209 | - accountNumber.checkValue(self._bic, accountName) | |
210 | - self._accounts.append(accountNumber) | |
211 | - elif keyWord.startswith(Description.KeyWord.Prefix.CARD): | |
212 | - if lenLineItems == 5: | |
213 | - pin = lineItems[4] | |
215 | + if firstLineItem in accountNumbers: | |
216 | + logger.error('Not unique account number \'' + firstLineItem + '\'') | |
217 | + continue | |
214 | 218 | else: |
215 | - pin = '' | |
219 | + accountNumbers.append(firstLineItem) | |
216 | 220 | |
217 | - card = Card(self._bic, lineItems[1], lineItems[2], lineItems[3], pin) | |
218 | - self._cards.append(card) | |
221 | + accountNumber = AccountNumber(lineItems[1]) | |
222 | + accountNumber.checkValue(self._bic, accountName) | |
223 | + self._accounts.append(accountNumber) | |
224 | + elif keyWord.startswith(Description.KeyWord.Prefix.CARD): | |
225 | + if firstLineItem in cardNumbers: | |
226 | + logger.error('Not unique card number \'' + firstLineItem + '\'') | |
227 | + continue | |
228 | + else: | |
229 | + cardNumbers.append(firstLineItem) | |
230 | + | |
231 | + if lenLineItems == 5: | |
232 | + pin = lineItems[4] | |
233 | + else: | |
234 | + pin = '' | |
235 | + | |
236 | + card = Card(self._bic, lineItems[1], lineItems[2], lineItems[3], pin) | |
237 | + self._cards.append(card) | |
219 | 238 | elif keyWord.startswith(Description.KeyWord.Prefix.CONTRACT): |
220 | - contract = Contract(lineItems[1]) | |
221 | - self._contracts.append(contract) | |
239 | + if firstLineItem in contractNumbers: | |
240 | + logger.error('Not unique contract number \'' + firstLineItem + '\'') | |
241 | + continue | |
242 | + else: | |
243 | + contractNumbers.append(firstLineItem) | |
244 | + | |
245 | + contract = Contract(lineItems[1]) | |
246 | + self._contracts.append(contract) | |
222 | 247 | elif keyWord.startswith(Description.KeyWord.Prefix.PASSWORD): |
223 | - password = PassWord(lineItems[1]) | |
224 | - self._passwords.append(password) | |
248 | + if firstLineItem in passwordNumbers: | |
249 | + logger.error('Not unique password number \'' + firstLineItem + '\'') | |
250 | + continue | |
251 | + else: | |
252 | + passwordNumbers.append(firstLineItem) | |
253 | + | |
254 | + password = PassWord(lineItems[1]) | |
255 | + self._passwords.append(password) | |
225 | 256 | elif keyWord.startswith(Description.KeyWord.BIC): |
226 | 257 | # Already tried to find bic |
227 | 258 | pass |