From e97b86be1908693e54ea9fb0f1a07ef18ce91324 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=81ukasz=20Nowak?= <luke@nexedi.com>
Date: Tue, 28 Aug 2012 17:22:58 +0200
Subject: [PATCH] Invert logic.

There is nothing to do if transaction is not yet registered in integration tool.
---
 .../vifib_payzen/PaymentTransaction_updateStatus.xml           | 3 ++-
 .../scripts/PayzenEvent_updateStatus.xml                       | 3 +--
 master/bt5/vifib_payzen/bt/revision                            | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/master/bt5/vifib_payzen/SkinTemplateItem/portal_skins/vifib_payzen/PaymentTransaction_updateStatus.xml b/master/bt5/vifib_payzen/SkinTemplateItem/portal_skins/vifib_payzen/PaymentTransaction_updateStatus.xml
index 8d8f50cbe..fdf433862 100644
--- a/master/bt5/vifib_payzen/SkinTemplateItem/portal_skins/vifib_payzen/PaymentTransaction_updateStatus.xml
+++ b/master/bt5/vifib_payzen/SkinTemplateItem/portal_skins/vifib_payzen/PaymentTransaction_updateStatus.xml
@@ -67,7 +67,8 @@ if context.PaymentTransaction_getPreviousPayzenId() is not None and context.getS
   context.updateCausalityState()\n
   portal.system_event_module.newContent(title=\'Transaction %s Payzen registration\' % context.getTitle(), portal_type=\'Payzen Event\', source_value=service, destination_value=context).registerPayzen()\n
 else:\n
-  portal.system_event_module.newContent(title=\'Transaction %s Payzen status update\' % context.getTitle(), portal_type=\'Payzen Event\', source_value=service, destination_value=context).updateStatus()\n
+  if portal.restrictedTraverse(portal.portal_preferences.getPreferredPayzenIntegrationSite()).getMappingFromCategory(\'causality/%s\' % context.getRelativeUrl()) != \'Causality/%s\' % context.getRelativeUrl():\n
+    portal.system_event_module.newContent(title=\'Transaction %s Payzen status update\' % context.getTitle(), portal_type=\'Payzen Event\', source_value=service, destination_value=context).updateStatus()\n
 </string> </value>
         </item>
         <item>
diff --git a/master/bt5/vifib_payzen/WorkflowTemplateItem/portal_workflow/payzen_interface_workflow/scripts/PayzenEvent_updateStatus.xml b/master/bt5/vifib_payzen/WorkflowTemplateItem/portal_workflow/payzen_interface_workflow/scripts/PayzenEvent_updateStatus.xml
index f5168ecd3..1c14a37cd 100644
--- a/master/bt5/vifib_payzen/WorkflowTemplateItem/portal_workflow/payzen_interface_workflow/scripts/PayzenEvent_updateStatus.xml
+++ b/master/bt5/vifib_payzen/WorkflowTemplateItem/portal_workflow/payzen_interface_workflow/scripts/PayzenEvent_updateStatus.xml
@@ -58,8 +58,7 @@ integration_tool = portal.restrictedTraverse(portal.portal_preferences.getPrefer
 \n
 transaction_id = integration_tool.getMappingFromCategory(\'causality/%s\' % payment_transaction.getRelativeUrl())\n
 if transaction_id == \'Causality/%s\' % payment_transaction.getRelativeUrl():\n
-  payzen_event.confirm(comment=\'Transaction not registered in payzen integration tool\')\n
-  return\n
+  raise ValueError(\'Transaction not registered in payzen integration tool\')\n
 transaction_id = transaction_id.split(\'/\')[1]\n
 transmissionDate, transactionId = transaction_id.split(\'_\')\n
 \n
diff --git a/master/bt5/vifib_payzen/bt/revision b/master/bt5/vifib_payzen/bt/revision
index b44fe09a7..d1cbcfa54 100644
--- a/master/bt5/vifib_payzen/bt/revision
+++ b/master/bt5/vifib_payzen/bt/revision
@@ -1 +1 @@
-65
\ No newline at end of file
+66
\ No newline at end of file
-- 
2.30.9