mirror of
https://github.com/brain-tec/account_ebics.git
synced 2024-11-22 04:02:03 +00:00
add ebics version check
This commit is contained in:
parent
e618566a99
commit
f6697cc5c2
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
'name': 'EBICS banking protocol',
|
'name': 'EBICS banking protocol',
|
||||||
'version': '13.0.1.1.3',
|
'version': '13.0.1.1.4',
|
||||||
'license': 'LGPL-3',
|
'license': 'LGPL-3',
|
||||||
'author': 'Noviat',
|
'author': 'Noviat',
|
||||||
'website': 'www.noviat.com',
|
'website': 'www.noviat.com',
|
||||||
|
@ -191,6 +191,8 @@ class EbicsUserID(models.Model):
|
|||||||
if not self.ebics_passphrase:
|
if not self.ebics_passphrase:
|
||||||
raise UserError(
|
raise UserError(
|
||||||
_("Set a passphrase."))
|
_("Set a passphrase."))
|
||||||
|
|
||||||
|
ebics_version = self.ebics_config_id.ebics_version
|
||||||
try:
|
try:
|
||||||
keyring = EbicsKeyRing(
|
keyring = EbicsKeyRing(
|
||||||
keys=self.ebics_keys_fn,
|
keys=self.ebics_keys_fn,
|
||||||
@ -235,16 +237,23 @@ class EbicsUserID(models.Model):
|
|||||||
user.create_certificates(**kwargs)
|
user.create_certificates(**kwargs)
|
||||||
|
|
||||||
client = EbicsClient(
|
client = EbicsClient(
|
||||||
bank, user, version=self.ebics_config_id.ebics_version)
|
bank, user, version=ebics_version)
|
||||||
|
|
||||||
# Send the public electronic signature key to the bank.
|
# Send the public electronic signature key to the bank.
|
||||||
try:
|
try:
|
||||||
if self.ebics_config_id.ebics_version == 'H003':
|
supported_versions = client.HEV()
|
||||||
|
if ebics_version not in supported_versions:
|
||||||
|
err_msg = _("EBICS version mismatch.") + "\n"
|
||||||
|
err_msg += _("Versions supported by your bank:")
|
||||||
|
for k in supported_versions:
|
||||||
|
err_msg += "\n%s: %s " % (k, supported_versions[k])
|
||||||
|
raise UserError(err_msg)
|
||||||
|
if ebics_version == 'H003':
|
||||||
bank._order_number = self.ebics_config_id._get_order_number()
|
bank._order_number = self.ebics_config_id._get_order_number()
|
||||||
OrderID = client.INI()
|
OrderID = client.INI()
|
||||||
_logger.info(
|
_logger.info(
|
||||||
'%s, EBICS INI command, OrderID=%s', self._name, OrderID)
|
'%s, EBICS INI command, OrderID=%s', self._name, OrderID)
|
||||||
if self.ebics_version == 'H003':
|
if ebics_version == 'H003':
|
||||||
self.ebics_config_id._update_order_number(OrderID)
|
self.ebics_config_id._update_order_number(OrderID)
|
||||||
except URLError:
|
except URLError:
|
||||||
exctype, value = exc_info()[:2]
|
exctype, value = exc_info()[:2]
|
||||||
@ -271,11 +280,11 @@ class EbicsUserID(models.Model):
|
|||||||
raise UserError(error)
|
raise UserError(error)
|
||||||
|
|
||||||
# Send the public authentication and encryption keys to the bank.
|
# Send the public authentication and encryption keys to the bank.
|
||||||
if self.ebics_config_id.ebics_version == 'H003':
|
if ebics_version == 'H003':
|
||||||
bank._order_number = self.ebics_config_id._get_order_number()
|
bank._order_number = self.ebics_config_id._get_order_number()
|
||||||
OrderID = client.HIA()
|
OrderID = client.HIA()
|
||||||
_logger.info('%s, EBICS HIA command, OrderID=%s', self._name, OrderID)
|
_logger.info('%s, EBICS HIA command, OrderID=%s', self._name, OrderID)
|
||||||
if self.ebics_version == 'H003':
|
if ebics_version == 'H003':
|
||||||
self.ebics_config_id._update_order_number(OrderID)
|
self.ebics_config_id._update_order_number(OrderID)
|
||||||
|
|
||||||
# Create an INI-letter which must be printed and sent to the bank.
|
# Create an INI-letter which must be printed and sent to the bank.
|
||||||
|
Loading…
Reference in New Issue
Block a user