mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[FIX] account_banking: fix unused typo in sepa code
[IMP] account_banking: do not consult online convertor for dutch 7 scheme
accounts, but calculate our own.
This commit is contained in:
@@ -42,7 +42,7 @@
|
||||
# account owning banks. Don't use it, unless you are prepared to loose your
|
||||
# money. It is for heuristic validation purposes only.
|
||||
|
||||
__all__ = ['IBAN']
|
||||
__all__ = ['IBAN', 'BBAN']
|
||||
|
||||
def modulo_97_base10(abuffer):
|
||||
'''
|
||||
@@ -312,7 +312,7 @@ class IBAN(str):
|
||||
format = cls.BBAN_formats[countrycode]
|
||||
|
||||
if BBAN:
|
||||
if len(BBAN) == len(formats._iban):
|
||||
if len(BBAN) == len(format._iban):
|
||||
ibanno = cls(countrycode + '00' + BBAN)
|
||||
return cls(countrycode + ibanno.checksum + BBAN)
|
||||
raise ValueError, \
|
||||
|
||||
@@ -45,7 +45,22 @@ def get_iban_bic_NL(bank_acc):
|
||||
banks operating in the Netherlands and will only convert Dutch local
|
||||
account numbers.
|
||||
'''
|
||||
data = urllib.urlencode(dict(number=bank_acc.lstrip('0'), method='POST'))
|
||||
# sanity check: Dutch 7 scheme uses ING as sink and online convertor
|
||||
# calculates accounts, so no need to consult it - calculate our own
|
||||
number = bank_acc.lstrip('0')
|
||||
if len(number) <= 7:
|
||||
return struct(
|
||||
iban = IBAN(BBAN='INGB' + number.rjust(10, '0'),
|
||||
countrycode='NL'
|
||||
).replace(' ',''),
|
||||
account = iban,
|
||||
bic = 'INGBNL2A',
|
||||
code = 'INGBNL',
|
||||
bank = 'ING Bank N.V.'
|
||||
country_id = 'NL',
|
||||
)
|
||||
|
||||
data = urllib.urlencode(dict(number=number, method='POST'))
|
||||
request = urllib2.Request(IBANlink_NL, data)
|
||||
response = urllib2.urlopen(request)
|
||||
soup = BeautifulSoup(response)
|
||||
|
||||
Reference in New Issue
Block a user