From 44d4564aa02c0466ae43fdf4673e2dc2e2826120 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=81ukasz=20Nowak?= <luke@nexedi.com>
Date: Thu, 6 Oct 2011 17:32:14 +0200
Subject: [PATCH] Revert "Implement getFormString."

This reverts commit e5b9bfac48e60e7d3a5883a805e73ff6ebf2fe82.
---
 .../DocumentTemplateItem/PayzenService.py     | 36 +--------
 .../Base_getPayzenServicePaymentConfig.xml    | 74 -------------------
 .../Base_getPayzenTransId.xml                 | 69 -----------------
 bt5/erp5_payzen_secure_payment/bt/revision    |  2 +-
 4 files changed, 2 insertions(+), 179 deletions(-)
 delete mode 100644 bt5/erp5_payzen_secure_payment/SkinTemplateItem/portal_skins/erp5_payzen_secure_payment/Base_getPayzenServicePaymentConfig.xml
 delete mode 100644 bt5/erp5_payzen_secure_payment/SkinTemplateItem/portal_skins/erp5_payzen_secure_payment/Base_getPayzenTransId.xml

diff --git a/bt5/erp5_payzen_secure_payment/DocumentTemplateItem/PayzenService.py b/bt5/erp5_payzen_secure_payment/DocumentTemplateItem/PayzenService.py
index 98fbc025b7..64986e88e5 100644
--- a/bt5/erp5_payzen_secure_payment/DocumentTemplateItem/PayzenService.py
+++ b/bt5/erp5_payzen_secure_payment/DocumentTemplateItem/PayzenService.py
@@ -1,5 +1,4 @@
 import zope
-import hashlib
 from AccessControl import ClassSecurityInfo
 from Products.ERP5Type import Permissions, PropertySheet, interfaces
 from Products.ERP5Type.XMLObject import XMLObject
@@ -48,40 +47,7 @@ class PayzenService(XMLObject):
 
   # proposed methods
   def getFormString(self, document, **kw):
-    """Returns unterminated form for current document
-
-    The responsiblity of the caller is to finish the form."""
-    self.Base_checkConsistency()
-    content_kw = dict()
-    content_kw['vads_action_mode'] = self.getPayzenVadsActionMode()
-    content_kw['vads_amount'] = int(document.getTotalPrice() * 100)
-    integration_tool = self.restrictedTraverse(self.getIntegrationSite())
-    content_kw['vads_currency'] = integration_tool.getMappingFromCategory(
-      'resource/currency_module/%s' % document.getPriceCurrencyReference()
-      ).split('/')[-1]
-    content_kw['vads_ctx_mode'] = self.getPayzenVadsCtxMode()
-    content_kw['vads_page_action'] = self.getPayzenVadsPageAction()
-    content_kw['vads_payment_config'] = document\
-      .Base_getPayzenServicePaymentConfig()
-    content_kw['vads_site_id'] = self.getServiceUsername()
-    # date as YYYYMMDDHHMMSS
-    content_kw['vads_trans_date'] = document.getStartDate().strftime(
-      '%Y%m%d%H%M%S')
-    content_kw['vads_trans_id'] = document.Base_getPayzenTransId()
-    content_kw['vads_version'] = self.getPayzenVadsVersion()
-    # all data are completed, now it is time to create signature
-    sorted_keys = content_kw.keys()
-    sorted_keys.sort()
-    signature = ''
-    form = '<FORM METHOD="POST" ACTION="%s">\n' % self.getLinkUrlString()
-    for k in sorted_keys:
-      v = str(content_kw[k])
-      signature += v + '+'
-      form += '<INPUT TYPE="HIDDEN" NAME="%s" VALUE="%s">\n' % (k, v)
-    signature += self.getServicePassword()
-    form += '<INPUT TYPE="HIDDEN" NAME="signature" VALUE="%s">' % \
-      hashlib.sha1(signature).hexdigest()
-    return form
+    """Returns form string of against passed document"""
 
   def getSignature(self, document):
     """Returns signature for current document"""
diff --git a/bt5/erp5_payzen_secure_payment/SkinTemplateItem/portal_skins/erp5_payzen_secure_payment/Base_getPayzenServicePaymentConfig.xml b/bt5/erp5_payzen_secure_payment/SkinTemplateItem/portal_skins/erp5_payzen_secure_payment/Base_getPayzenServicePaymentConfig.xml
deleted file mode 100644
index bd6ba0003f..0000000000
--- a/bt5/erp5_payzen_secure_payment/SkinTemplateItem/portal_skins/erp5_payzen_secure_payment/Base_getPayzenServicePaymentConfig.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0"?>
-<ZopeData>
-  <record id="1" aka="AAAAAAAAAAE=">
-    <pickle>
-      <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>Script_magic</string> </key>
-            <value> <int>3</int> </value>
-        </item>
-        <item>
-            <key> <string>_bind_names</string> </key>
-            <value>
-              <object>
-                <klass>
-                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
-                </klass>
-                <tuple/>
-                <state>
-                  <dictionary>
-                    <item>
-                        <key> <string>_asgns</string> </key>
-                        <value>
-                          <dictionary>
-                            <item>
-                                <key> <string>name_container</string> </key>
-                                <value> <string>container</string> </value>
-                            </item>
-                            <item>
-                                <key> <string>name_context</string> </key>
-                                <value> <string>context</string> </value>
-                            </item>
-                            <item>
-                                <key> <string>name_m_self</string> </key>
-                                <value> <string>script</string> </value>
-                            </item>
-                            <item>
-                                <key> <string>name_subpath</string> </key>
-                                <value> <string>traverse_subpath</string> </value>
-                            </item>
-                          </dictionary>
-                        </value>
-                    </item>
-                  </dictionary>
-                </state>
-              </object>
-            </value>
-        </item>
-        <item>
-            <key> <string>_body</string> </key>
-            <value> <string>"""Returns vads_payment_config for current document\n
-\n
-Default implementation returns single payment operation (SINGLE)\n
-\n
-It is possible to configure it on application level.\n
-"""\n
-\n
-return "SINGLE"\n
-</string> </value>
-        </item>
-        <item>
-            <key> <string>_params</string> </key>
-            <value> <string></string> </value>
-        </item>
-        <item>
-            <key> <string>id</string> </key>
-            <value> <string>Base_getPayzenServicePaymentConfig</string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-</ZopeData>
diff --git a/bt5/erp5_payzen_secure_payment/SkinTemplateItem/portal_skins/erp5_payzen_secure_payment/Base_getPayzenTransId.xml b/bt5/erp5_payzen_secure_payment/SkinTemplateItem/portal_skins/erp5_payzen_secure_payment/Base_getPayzenTransId.xml
deleted file mode 100644
index d9c1d0dd9d..0000000000
--- a/bt5/erp5_payzen_secure_payment/SkinTemplateItem/portal_skins/erp5_payzen_secure_payment/Base_getPayzenTransId.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0"?>
-<ZopeData>
-  <record id="1" aka="AAAAAAAAAAE=">
-    <pickle>
-      <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>Script_magic</string> </key>
-            <value> <int>3</int> </value>
-        </item>
-        <item>
-            <key> <string>_bind_names</string> </key>
-            <value>
-              <object>
-                <klass>
-                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
-                </klass>
-                <tuple/>
-                <state>
-                  <dictionary>
-                    <item>
-                        <key> <string>_asgns</string> </key>
-                        <value>
-                          <dictionary>
-                            <item>
-                                <key> <string>name_container</string> </key>
-                                <value> <string>container</string> </value>
-                            </item>
-                            <item>
-                                <key> <string>name_context</string> </key>
-                                <value> <string>context</string> </value>
-                            </item>
-                            <item>
-                                <key> <string>name_m_self</string> </key>
-                                <value> <string>script</string> </value>
-                            </item>
-                            <item>
-                                <key> <string>name_subpath</string> </key>
-                                <value> <string>traverse_subpath</string> </value>
-                            </item>
-                          </dictionary>
-                        </value>
-                    </item>
-                  </dictionary>
-                </state>
-              </object>
-            </value>
-        </item>
-        <item>
-            <key> <string>_body</string> </key>
-            <value> <string>"""Script shall return payzen compatible transaction id"""\n
-\n
-return context.getReference()\n
-</string> </value>
-        </item>
-        <item>
-            <key> <string>_params</string> </key>
-            <value> <string></string> </value>
-        </item>
-        <item>
-            <key> <string>id</string> </key>
-            <value> <string>Base_getPayzenTransId</string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-</ZopeData>
diff --git a/bt5/erp5_payzen_secure_payment/bt/revision b/bt5/erp5_payzen_secure_payment/bt/revision
index 25bf17fc5a..8e2afd3427 100644
--- a/bt5/erp5_payzen_secure_payment/bt/revision
+++ b/bt5/erp5_payzen_secure_payment/bt/revision
@@ -1 +1 @@
-18
\ No newline at end of file
+17
\ No newline at end of file
-- 
2.30.9