From ab094e5a80f7be07806548b292ee3931516467a9 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 14 Jul 2017 16:05:35 +0200 Subject: [PATCH] [FIX] payment_authorize: acquier reference The field `acquirer_reference` is not a mandatory field. If not retrieved from the provider, it will have a NULL value in the DB, and therefore will be `False` in Python. The `capture` and `void` method will crash in this case, because of: `etree.SubElement(tx, "refTransId").text = transaction_id` opw-751231 --- addons/payment_authorize/models/payment.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/payment_authorize/models/payment.py b/addons/payment_authorize/models/payment.py index c7ea1d48134..01f7fc3f9b9 100644 --- a/addons/payment_authorize/models/payment.py +++ b/addons/payment_authorize/models/payment.py @@ -256,14 +256,14 @@ class TxAuthorize(models.Model): def authorize_s2s_capture_transaction(self): self.ensure_one() transaction = AuthorizeAPI(self.acquirer_id) - tree = transaction.capture(self.acquirer_reference, self.amount) + tree = transaction.capture(self.acquirer_reference or '', self.amount) return self._authorize_s2s_validate_tree(tree) @api.multi def authorize_s2s_void_transaction(self): self.ensure_one() transaction = AuthorizeAPI(self.acquirer_id) - tree = transaction.void(self.acquirer_reference) + tree = transaction.void(self.acquirer_reference or '') return self._authorize_s2s_validate_tree(tree) @api.multi