Révision | 711a5ebc6565e66232b2a3a78fa60d1e2cc910b5 (tree) |
---|---|
l'heure | 2022-01-11 22:43:38 |
Auteur | Sergey Gusarov <laborer2008@gmai...> |
Commiter | Sergey Gusarov |
AccountNumber: Fixed syntax
@@ -31,7 +31,7 @@ | ||
31 | 31 | ] |
32 | 32 | |
33 | 33 | INDEX_START_CURRENCY = 5 |
34 | - INDEX_END_CURRENCY = 7 | |
34 | + INDEX_END_CURRENCY = 8 | |
35 | 35 | INDEX_CHECKSUM = 8 |
36 | 36 | |
37 | 37 | WEIGHT_COEF = [7, 1, 3, 7, 1, 3, 7, 1, 3, 7, 1, 3, 7, 1, 3, 7, 1, 3, 7, 1, 3, 7, 1] |
@@ -48,7 +48,7 @@ | ||
48 | 48 | |
49 | 49 | currencyPart = content[AccountNumber.INDEX_START_CURRENCY:AccountNumber.INDEX_END_CURRENCY] |
50 | 50 | if currencyPart not in AccountNumber.CURRENCY_PART: |
51 | - raise ValueError('Invalid(unknow currency part) account number: \'' + content + '\'') | |
51 | + raise ValueError('Invalid(unknow currency part \'' + currencyPart + '\'), account number: \'' + content + '\'') | |
52 | 52 | |
53 | 53 | return super().__new__(cls, content) |
54 | 54 |
@@ -65,8 +65,9 @@ | ||
65 | 65 | |
66 | 66 | checkSum = int(bic[AccountNumber.INDEX_CHECKSUM]) |
67 | 67 | |
68 | - commonReq = bic.orgNumber() + self | |
69 | - commonReq[Bic.ORG_NUMBER_LENGTH + AccountNumber.INDEX_CHECKSUM] = 0 | |
68 | + commonReq = list(bic.orgNumber() + str(self)) | |
69 | + checkSumIndex = Bic.ORG_NUMBER_LENGTH + AccountNumber.INDEX_CHECKSUM | |
70 | + commonReq[checkSumIndex] = 0 | |
70 | 71 | sum = 0 |
71 | 72 | i = 0 |
72 | 73 | for j in commonReq: |
@@ -12,8 +12,8 @@ | ||
12 | 12 | LENGTH = 9 |
13 | 13 | |
14 | 14 | INDEX_ORG_NUMBER_START = 6 |
15 | - INDEX_ORG_NUMBER_END = 8 | |
16 | - ORG_NUMBER_LENGTH = INDEX_ORG_NUMBER_END - INDEX_ORG_NUMBER_START + 1 | |
15 | + INDEX_ORG_NUMBER_END = 9 | |
16 | + ORG_NUMBER_LENGTH = INDEX_ORG_NUMBER_END - INDEX_ORG_NUMBER_START | |
17 | 17 | |
18 | 18 | def __new__(cls, content): |
19 | 19 | if not ((type(content) is str) or (type(content) is Bic)): |
@@ -27,4 +27,4 @@ | ||
27 | 27 | return super().__new__(cls, content) |
28 | 28 | |
29 | 29 | def orgNumber(self): |
30 | - return self[Bic.INDEX_ORG_NUMBER_START:Bic.INDEX_ORG_NUMBER_END] | |
30 | + return str(self[Bic.INDEX_ORG_NUMBER_START:Bic.INDEX_ORG_NUMBER_END]) |
@@ -205,7 +205,9 @@ | ||
205 | 205 | keyWord = self.getKeyWord(firstLineItem, accountName) |
206 | 206 | |
207 | 207 | if keyWord.startswith(Description.KeyWord.Prefix.ACCOUNT): |
208 | - pass | |
208 | + accountNumber = AccountNumber(lineItems[1]) | |
209 | + accountNumber.checkValue(self._bic, accountName) | |
210 | + self._accounts.append(accountNumber) | |
209 | 211 | elif keyWord.startswith(Description.KeyWord.Prefix.CARD): |
210 | 212 | if lenLineItems == 5: |
211 | 213 | pin = lineItems[4] |