add payWay from payPal
authorDobrica Pavlinusic <dpavlin@deimos.ffzg.hr>
Tue, 8 Dec 2015 12:37:27 +0000 (13:37 +0100)
committerDobrica Pavlinusic <dpavlin@deimos.ffzg.hr>
Tue, 8 Dec 2015 12:37:27 +0000 (13:37 +0100)
13 files changed:
MaKaC/plugins/EPayment/payWay/__init__.py [new file with mode: 0644]
MaKaC/plugins/EPayment/payWay/epayment.py [new file with mode: 0644]
MaKaC/plugins/EPayment/payWay/tpls/CancelEPaymentPayPal.tpl [new file with mode: 0644]
MaKaC/plugins/EPayment/payWay/tpls/ConfModifEPaymentPayPal.tpl [new file with mode: 0644]
MaKaC/plugins/EPayment/payWay/tpls/ConfModifEPaymentPayPalDataModif.tpl [new file with mode: 0644]
MaKaC/plugins/EPayment/payWay/tpls/confirmEPaymentPayPal.tpl [new file with mode: 0644]
MaKaC/plugins/EPayment/payWay/webinterface/__init__.py [new file with mode: 0644]
MaKaC/plugins/EPayment/payWay/webinterface/pages/__init__.py [new file with mode: 0644]
MaKaC/plugins/EPayment/payWay/webinterface/pages/ePayments.py [new file with mode: 0644]
MaKaC/plugins/EPayment/payWay/webinterface/rh/__init__.py [new file with mode: 0644]
MaKaC/plugins/EPayment/payWay/webinterface/rh/ePaymentModif.py [new file with mode: 0644]
MaKaC/plugins/EPayment/payWay/webinterface/urlHandlers.py [new file with mode: 0644]
MaKaC/plugins/EPayment/payWay/webinterface/wcomponents.py [new file with mode: 0644]

diff --git a/MaKaC/plugins/EPayment/payWay/__init__.py b/MaKaC/plugins/EPayment/payWay/__init__.py
new file mode 100644 (file)
index 0000000..fe454d0
--- /dev/null
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+##
+##
+## This file is part of Indico.
+## Copyright (C) 2002 - 2014 European Organization for Nuclear Research (CERN).
+##
+## Indico is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License as
+## published by the Free Software Foundation; either version 3 of the
+## License, or (at your option) any later version.
+##
+## Indico is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Indico;if not, see <http://www.gnu.org/licenses/>.
+
+__metadata__ = {
+    'type': "EPayment",
+    'name': "PayPal"
+    }
+
+MODULE_ID = 'PayPal'
+
+modules = {}
diff --git a/MaKaC/plugins/EPayment/payWay/epayment.py b/MaKaC/plugins/EPayment/payWay/epayment.py
new file mode 100644 (file)
index 0000000..95c08cb
--- /dev/null
@@ -0,0 +1,146 @@
+# -*- coding: utf-8 -*-
+##
+##
+## This file is part of Indico.
+## Copyright (C) 2002 - 2014 European Organization for Nuclear Research (CERN).
+##
+## Indico is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License as
+## published by the Free Software Foundation; either version 3 of the
+## License, or (at your option) any later version.
+##
+## Indico is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Indico;if not, see <http://www.gnu.org/licenses/>.
+
+from MaKaC.epayment import BaseEPayMod, BaseTransaction
+import MaKaC.webinterface.urlHandlers as urlHandlers
+from MaKaC.webinterface.common.tools import strip_ml_tags
+
+
+from MaKaC.plugins.EPayment.payPal.webinterface import urlHandlers as localUrlHandlers
+from MaKaC.plugins.EPayment.payPal import MODULE_ID
+
+class PayPalMod(BaseEPayMod):
+
+    def __init__(self, data=None):
+        BaseEPayMod.__init__(self)
+        self._title = "paypal"
+
+        self._url="https://www.paypal.com/cgi-bin/webscr"
+        self._business= ""
+
+        if data is not None:
+            setValue(data)
+
+    def getId(self):
+        return MODULE_ID
+
+    def clone(self, newSessions):
+        sesf = PayPalMod()
+        sesf.setTitle(self.getTitle())
+        sesf.setUrl(self.getUrl())
+        sesf.setBusiness(self.getBusiness())
+
+        return sesf
+
+    def setValues(self, data):
+        self.setTitle(data.get("title", "epayment"))
+        self.setUrl(data.get("url", ""))
+        self.setBusiness(data["business"])
+
+    def getUrl(self):
+        return self._url
+    def setUrl(self,url):
+        self._url=url
+
+    def getBusiness(self):
+        return self._business
+    def setBusiness(self,business):
+        self._business= business
+
+    def getFormHTML(self,prix,Currency,conf,registrant,lang = "en_GB", secure=False):
+        url_return=localUrlHandlers.UHPayConfirmPayPal.getURL(registrant)
+        url_cancel_return=localUrlHandlers.UHPayCancelPayPal.getURL(registrant)
+        url_notify=localUrlHandlers.UHPayParamsPayPal.getURL(registrant)
+        s=""" <form action="%s" method="POST" id="%s">
+                        <input type="hidden" name="cmd" value="_xclick">
+                        <input type="hidden" name="business" value="%s">
+                        <input type="hidden" name="item_name" value="%s">
+                        <input type="hidden" name="amount" value="%s">
+                        <INPUT TYPE="hidden" NAME="currency_code" value="%s">
+                        <input type="hidden" name="charset" value="utf-8">
+                        <input type="hidden" name="return" value="%s">
+                        <input type="hidden" name="cancel_return" value="%s">
+                        <input type="hidden" name="notify_url" value="%s">
+                   </form>
+                       """%(self.getUrl(),self.getId(),self.getBusiness(), "%s: registration for %s"%(registrant.getFullName(),strip_ml_tags(conf.getTitle())),prix,Currency,\
+                            url_return,url_cancel_return,url_notify)
+        #s=cgi.escape(s)
+        return s
+
+    def getConfModifEPaymentURL(self, conf):
+        return localUrlHandlers.UHConfModifEPaymentPayPal.getURL(conf)
+
+
+
+class TransactionPayPal(BaseTransaction):
+
+    def __init__(self,parms):
+        BaseTransaction.__init__(self)
+        self._Data=parms
+
+
+    def getId(self):
+        try:
+            if self._id:
+                pass
+        except AttributeError, e:
+            self._id="paypal"
+        return self._id
+
+    def getTransactionHTML(self):
+        return"""<table>
+                          <tr>
+                            <td align="right"><b>Payment with:</b></td>
+                            <td align="left">PayPal</td>
+                          </tr>
+                          <tr>
+                            <td align="right"><b>Payment Date:</b></td>
+                            <td align="left">%s</td>
+                          </tr>
+                          <tr>
+                            <td align="right"><b>Payment ID:</b></td>
+                            <td align="left">%s</td>
+                          </tr>
+                          <tr>
+                            <td align="right"><b>Order Total:</b></td>
+                            <td align="left">%s %s</td>
+                          </tr>
+                          <tr>
+                            <td align="right"><b>verify sign:</b></td>
+                            <td align="left">%s</td>
+                          </tr>
+                        </table>"""%(self._Data["payment_date"],self._Data["payer_id"], self._Data["mc_gross"], \
+                             self._Data["mc_currency"], self._Data["verify_sign"])
+    def getTransactionTxt(self):
+        return"""
+\tPayment with:PayPal\n
+\tPayment Date:%s\n
+\tPayment ID:%s\n
+\tOrder Total:%s %s\n
+\tverify sign:%s
+"""%(self._Data["payment_date"],self._Data["payer_id"], self._Data["mc_gross"], \
+                             self._Data["mc_currency"], self._Data["verify_sign"])
+
+
+
+def getPayMod():
+    return PayPalMod()
+
+def getPayModClass():
+    return PayPalMod
diff --git a/MaKaC/plugins/EPayment/payWay/tpls/CancelEPaymentPayPal.tpl b/MaKaC/plugins/EPayment/payWay/tpls/CancelEPaymentPayPal.tpl
new file mode 100644 (file)
index 0000000..69f1221
--- /dev/null
@@ -0,0 +1,8 @@
+    <table width="60%" align="center" border="0" style="border: 1px solid #777777">
+        <tr>
+            <td class="groupTitle" colspan="2" style="text-align:center; background:#E5E5E5; color:gray">${ message }</td>
+        </tr>
+        <tr>
+            <td align="center" colspan="2" bgcolor="white" style="padding-bottom:10px">${ messagedetailPayment }</td>
+        </tr>
+    </table>
diff --git a/MaKaC/plugins/EPayment/payWay/tpls/ConfModifEPaymentPayPal.tpl b/MaKaC/plugins/EPayment/payWay/tpls/ConfModifEPaymentPayPal.tpl
new file mode 100644 (file)
index 0000000..1f04a01
--- /dev/null
@@ -0,0 +1,20 @@
+<table width="90%" align="left" border="0">
+    <tr>
+        <td class="dataCaptionTD"><span class="dataCaptionFormat">Title</span></td>
+        <td bgcolor="white" width="100%" class="blacktext">${ title }</td>
+        <form action=${ dataModificationURL } method="POST">
+        <td rowspan="3" valign="bottom" align="right">
+            <input type="submit" value="modify">
+        </td>
+        </form>
+    </tr>
+    <tr>
+        <td class="dataCaptionTD"><span class="dataCaptionFormat">URL of PayPal</span></td>
+        <td bgcolor="white" width="100%" class="blacktext"><pre>${ url }</pre></td>
+    </tr>
+    <tr>
+        <td class="dataCaptionTD"><span class="dataCaptionFormat">business</span></td>
+        <td bgcolor="white" width="100%" class="blacktext"><pre>${ business }</pre></td>
+    </tr>
+    <tr><td>&nbsp;</td></tr>
+</table>
diff --git a/MaKaC/plugins/EPayment/payWay/tpls/ConfModifEPaymentPayPalDataModif.tpl b/MaKaC/plugins/EPayment/payWay/tpls/ConfModifEPaymentPayPalDataModif.tpl
new file mode 100644 (file)
index 0000000..0777390
--- /dev/null
@@ -0,0 +1,23 @@
+<form action=${ postURL } method="POST">
+    <table width="80%" align="center" border="0" style="border-left: 1px solid #777777">
+        <tr>
+            <td class="groupTitle" colspan="2">Configuration of PayPal</td>
+        </tr>
+        <tr>
+            <td nowrap class="dataCaptionTD"><span class="titleCellFormat">Title</span></td>
+            <td align="left"><input type="text" name="title" size="60" value="${ title }"></td>
+        </tr>
+        <tr>
+            <td class="dataCaptionTD"><span class="dataCaptionFormat">URL of PayPal</span></td>
+            <td align="left"><input type="text" name="url" size="60" value="${ url }"></td>
+        </tr>
+        <tr>
+            <td class="dataCaptionTD"><span class="dataCaptionFormat">business</span></td>
+            <td align="left"><input type="text" name="business" size="60" value="${ business }"></td>
+        </tr>
+        <tr><td>&nbsp;</td></tr>
+        <tr>
+            <td colspan="2" align="left"><input type="submit" value="OK">&nbsp;<input type="submit" value="cancel" name="cancel"></td>
+        </tr>
+    </table>
+</form>
diff --git a/MaKaC/plugins/EPayment/payWay/tpls/confirmEPaymentPayPal.tpl b/MaKaC/plugins/EPayment/payWay/tpls/confirmEPaymentPayPal.tpl
new file mode 100644 (file)
index 0000000..4f9e3d1
--- /dev/null
@@ -0,0 +1,9 @@
+
+    <table width="60%" align="center" border="0" style="border: 1px solid #777777">
+        <tr>
+            <td class="groupTitle" colspan="2" style="text-align:center; background:#E5E5E5; color:gray">${ message }</td>
+        </tr>
+        <tr>
+            <td align="center" colspan="2" bgcolor="white" style="padding-bottom:10px">${ trinfo }</td>
+        </tr>
+    </table>
diff --git a/MaKaC/plugins/EPayment/payWay/webinterface/__init__.py b/MaKaC/plugins/EPayment/payWay/webinterface/__init__.py
new file mode 100644 (file)
index 0000000..362d07c
--- /dev/null
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+##
+##
+## This file is part of Indico.
+## Copyright (C) 2002 - 2014 European Organization for Nuclear Research (CERN).
+##
+## Indico is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License as
+## published by the Free Software Foundation; either version 3 of the
+## License, or (at your option) any later version.
+##
+## Indico is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Indico;if not, see <http://www.gnu.org/licenses/>.
+
+modules = {}
diff --git a/MaKaC/plugins/EPayment/payWay/webinterface/pages/__init__.py b/MaKaC/plugins/EPayment/payWay/webinterface/pages/__init__.py
new file mode 100644 (file)
index 0000000..362d07c
--- /dev/null
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+##
+##
+## This file is part of Indico.
+## Copyright (C) 2002 - 2014 European Organization for Nuclear Research (CERN).
+##
+## Indico is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License as
+## published by the Free Software Foundation; either version 3 of the
+## License, or (at your option) any later version.
+##
+## Indico is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Indico;if not, see <http://www.gnu.org/licenses/>.
+
+modules = {}
diff --git a/MaKaC/plugins/EPayment/payWay/webinterface/pages/ePayments.py b/MaKaC/plugins/EPayment/payWay/webinterface/pages/ePayments.py
new file mode 100644 (file)
index 0000000..91d96e8
--- /dev/null
@@ -0,0 +1,157 @@
+# -*- coding: utf-8 -*-
+##
+##
+## This file is part of Indico.
+## Copyright (C) 2002 - 2014 European Organization for Nuclear Research (CERN).
+##
+## Indico is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License as
+## published by the Free Software Foundation; either version 3 of the
+## License, or (at your option) any later version.
+##
+## Indico is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Indico;if not, see <http://www.gnu.org/licenses/>.
+
+import MaKaC.webinterface.pages.conferences as conferences
+import MaKaC.webinterface.pages.registrationForm as registrationForm
+from MaKaC.webinterface import wcomponents
+from xml.sax.saxutils import quoteattr
+from indico.core import config as Configuration
+from MaKaC.webinterface import urlHandlers
+import MaKaC
+from MaKaC.i18n import _
+
+
+from MaKaC.plugins.EPayment.payPal import MODULE_ID
+from MaKaC.plugins.EPayment.payPal.webinterface.wcomponents import WTemplated
+from MaKaC.plugins.EPayment.payPal.webinterface import urlHandlers as localUrlHandlers
+
+
+
+class WPConfModifEPaymentPayPalBase(registrationForm.WPConfModifRegFormBase):
+
+    def _createTabCtrl( self ):
+        self._tabCtrl = wcomponents.TabControl()
+        self._tabMain = self._tabCtrl.newTab( "main", _("Main"), \
+                localUrlHandlers.UHConfModifEPaymentPayPal.getURL( self._conf ) )
+        wf = self._rh.getWebFactory()
+        if wf:
+            wf.customiseTabCtrl( self._tabCtrl )
+        self._setActiveTab()
+
+    def _setActiveTab( self ):
+        pass
+
+    def _setActiveSideMenuItem(self):
+        self._regFormMenuItem.setActive(True)
+
+    def _getPageContent( self, params ):
+        self._createTabCtrl()
+        banner = wcomponents.WEpaymentBannerModif(self._conf.getModPay().getPayModByTag(MODULE_ID), self._conf).getHTML()
+        html = wcomponents.WTabControl( self._tabCtrl, self._getAW() ).getHTML( self._getTabContent( params ) )
+        return banner+html
+
+    def _getTabContent( self, params ):
+        return "nothing"
+
+class WPConfModifEPaymentPayPal( WPConfModifEPaymentPayPalBase ):
+
+    def _getTabContent( self, params ):
+        wc = WConfModifEPaymentPayPal(self._conf)
+        p = {
+             'dataModificationURL': quoteattr(str(localUrlHandlers.UHConfModifEPaymentPayPalDataModif.getURL( self._conf )))
+            }
+        return wc.getHTML(p)
+
+class WConfModifEPaymentPayPal( WTemplated ):
+
+    def __init__( self, conference ):
+        self._conf = conference
+
+    def getVars( self ):
+        vars = WTemplated.getVars(self)
+        modPayPal = self._conf.getModPay().getPayModByTag(MODULE_ID)
+        vars["title"] = modPayPal.getTitle()
+        vars["url"] = modPayPal.getUrl()
+        vars["business"] =  modPayPal.getBusiness()
+        return vars
+
+class WPConfModifEPaymentPayPalDataModif( WPConfModifEPaymentPayPalBase ):
+
+    def _getTabContent( self, params ):
+        wc = WConfModifEPaymentPayPalDataModif(self._conf)
+        p = {'postURL': quoteattr(str(localUrlHandlers.UHConfModifEPaymentPayPalPerformDataModif.getURL( self._conf )))
+            }
+        return wc.getHTML(p)
+
+class WConfModifEPaymentPayPalDataModif( WTemplated ):
+
+    def __init__( self, conference ):
+        self._conf = conference
+
+    def getVars( self ):
+        vars = WTemplated.getVars(self)
+        modPayPal = self._conf.getModPay().getPayModByTag(MODULE_ID)
+        vars["title"] = modPayPal.getTitle()
+        vars["url"] = modPayPal.getUrl()
+        vars["business"] =  modPayPal.getBusiness()
+        return vars
+
+class WPconfirmEPaymentPayPal( conferences.WPConferenceDefaultDisplayBase ):
+    #navigationEntry = navigation.NERegistrationFormDisplay
+
+    def __init__(self, rh, conf, reg):
+        conferences.WPConferenceDefaultDisplayBase.__init__(self, rh, conf)
+        self._registrant=reg
+
+
+    def _getBody( self, params ):
+        wc = WconfirmEPaymentPayPal(self._conf, self._registrant)
+        return wc.getHTML()
+
+    def _defineSectionMenu( self ):
+        conferences.WPConferenceDefaultDisplayBase._defineSectionMenu(self)
+        self._sectionMenu.setCurrentItem(self._regFormOpt)
+
+
+class WconfirmEPaymentPayPal( WTemplated ):
+    def __init__( self,configuration, registrant):
+        self._registrant = registrant
+        self._conf = configuration
+
+    def getVars( self ):
+        vars = WTemplated.getVars(self)
+        vars["message"] = "Thank you for the payment!<br/> You have used PayPal"
+        vars["trinfo"]="%s:%s"%(self._registrant.getFirstName(),self._registrant.getSurName())
+        return vars
+
+class WPCancelEPaymentPayPal( conferences.WPConferenceDefaultDisplayBase ):
+    #navigationEntry = navigation.NERegistrationFormDisplay
+
+    def __init__(self, rh, conf, reg):
+        conferences.WPConferenceDefaultDisplayBase.__init__(self, rh, conf)
+        self._registrant=reg
+
+    def _getBody( self, params ):
+        wc = WCancelEPaymentPayPal( self._conf,self._registrant )
+        return wc.getHTML()
+
+    def _defineSectionMenu( self ):
+        conferences.WPConferenceDefaultDisplayBase._defineSectionMenu(self)
+        self._sectionMenu.setCurrentItem(self._regFormOpt)
+
+class WCancelEPaymentPayPal( WTemplated ):
+    def __init__( self, conference,reg ):
+        self._conf = conference
+        self._registrant=reg
+
+    def getVars( self ):
+        vars = WTemplated.getVars(self)
+        vars["message"] = "You have cancelled your transaction.\nPlease check your email in order to complete your PayPal transaction."
+        vars["messagedetailPayment"]="%s:%s"%(self._registrant.getFirstName(),self._registrant.getSurName())
+        return vars
diff --git a/MaKaC/plugins/EPayment/payWay/webinterface/rh/__init__.py b/MaKaC/plugins/EPayment/payWay/webinterface/rh/__init__.py
new file mode 100644 (file)
index 0000000..1f2a98d
--- /dev/null
@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+##
+##
+## This file is part of Indico.
+## Copyright (C) 2002 - 2014 European Organization for Nuclear Research (CERN).
+##
+## Indico is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License as
+## published by the Free Software Foundation; either version 3 of the
+## License, or (at your option) any later version.
+##
+## Indico is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Indico;if not, see <http://www.gnu.org/licenses/>.
+
+modules = {}
+
+
+
+def getRHByTag(self, tag):
+    """Do the link between url handlers and request handlers"""
+    for mod in self.modules.values():
+        for RH in mod.__dict__.keys():
+            try:
+                if mod.__dict__[RH]._requestTag == tag:
+                    return mod.__dict__[RH]
+            except:
+                pass
+
+
+def preprocessParams(params):
+    return True
diff --git a/MaKaC/plugins/EPayment/payWay/webinterface/rh/ePaymentModif.py b/MaKaC/plugins/EPayment/payWay/webinterface/rh/ePaymentModif.py
new file mode 100644 (file)
index 0000000..7c6e071
--- /dev/null
@@ -0,0 +1,130 @@
+# -*- coding: utf-8 -*-
+##
+##
+## This file is part of Indico.
+## Copyright (C) 2002 - 2014 European Organization for Nuclear Research (CERN).
+##
+## Indico is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License as
+## published by the Free Software Foundation; either version 3 of the
+## License, or (at your option) any later version.
+##
+## Indico is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Indico;if not, see <http://www.gnu.org/licenses/>.
+
+from MaKaC.webinterface.rh.ePaymentModif import RHEPaymentModifBase, RHConferenceBaseDisplay, RHRegistrationFormDisplayBase
+import MaKaC.webinterface.urlHandlers as urlHandlers
+from datetime import datetime
+from MaKaC.common.timezoneUtils import nowutc
+
+
+from MaKaC.plugins.EPayment.payPal.webinterface.pages import ePayments
+from MaKaC.plugins.EPayment.payPal.webinterface import urlHandlers as localUrlHandlers
+from MaKaC.plugins.EPayment.payPal import epayment as ePayment
+from MaKaC.plugins.EPayment.payPal import MODULE_ID
+
+
+class RHEPaymentmodifPayPal( RHEPaymentModifBase ):
+    _requestTag = "modifPayPal"
+
+    def _process( self ):
+        p = ePayments.WPConfModifEPaymentPayPal( self, self._conf )
+        return p.display()
+
+class RHEPaymentmodifPayPalDataModif( RHEPaymentModifBase ):
+    _requestTag = "modifPayPalData"
+
+    def _process( self ):
+        p = ePayments.WPConfModifEPaymentPayPalDataModif( self, self._conf )
+        return p.display()
+
+class RHEPaymentmodifPayPalPerformDataModif( RHEPaymentModifBase ):
+    _requestTag = "modifPayPalPerformDataModif"
+
+    def _checkParams( self, params ):
+        RHEPaymentModifBase._checkParams( self, params )
+        self._params=params
+        self._cancel = params.has_key("cancel")
+
+    def _process( self ):
+        if not self._cancel:
+            ses = self._conf.getModPay().getPayModByTag(MODULE_ID)
+            ses.setValues(self._params)
+        self._redirect(localUrlHandlers.UHConfModifEPaymentPayPal.getURL(self._conf))
+
+
+
+
+class RHEPaymentconfirmPayPal( RHRegistrationFormDisplayBase ):
+    _requestTag = "confirm"
+
+    def _checkParams( self, params ):
+        RHRegistrationFormDisplayBase._checkParams( self, params )
+        self._registrant=None
+        regId= params.get("registrantId","")
+        if regId is not None:
+            self._registrant=self._conf.getRegistrantById(regId)
+
+    def _processIfActive( self ):
+        if self._registrant is not None:
+            p = ePayments.WPconfirmEPaymentPayPal( self,self._conf,self._registrant)
+            return p.display()
+
+class RHEPaymentCancelPayPal( RHRegistrationFormDisplayBase ):
+    _requestTag = "cancel"
+
+    def _checkParams( self, params ):
+        RHRegistrationFormDisplayBase._checkParams( self, params )
+        self._registrant=None
+        regId=params.get("registrantId","")
+        if regId is not None:
+            self._registrant=self._conf.getRegistrantById(regId)
+
+    def _processIfActive( self ):
+        if self._registrant is not None:
+            p = ePayments.WPCancelEPaymentPayPal( self,self._conf ,self._registrant)
+            return p.display()
+
+
+class RHEPaymentValideParamPayPal( RHConferenceBaseDisplay ):
+    _requestTag = "params"
+
+    def _checkParams( self, params ):
+        RHConferenceBaseDisplay._checkParams(self, params)
+        self._regForm = self._conf.getRegistrationForm()
+        self._params=params
+        self._registrant=None
+        regId=params.get("registrantId","")
+        if regId is not None:
+            self._registrant=self._conf.getRegistrantById(regId)
+
+    def _checkProtection(self):
+        # Just bypass everything else, as we want the payment service
+        # to acknowledge the payment
+        pass
+
+    def _process( self ):
+        regForm = self._conf.getRegistrationForm()
+        if not regForm.isActivated() or not self._conf.hasEnabledSection("regForm"):
+            p = registrationForm.WPRegFormInactive( self, self._conf )
+            return p.display()
+        else:
+            if self._registrant is not None:
+                self._registrant.setPayed(True)
+                d={}
+                d["payment_date"]=nowutc()
+                d["payer_id"]=self._params.get("payer_id")
+                d["mc_currency"]=self._params.get("mc_currency")
+                d["mc_gross"]=self._params.get("mc_gross")
+                d["verify_sign"]=self._params.get("verify_sign")
+                tr=ePayment.TransactionPayPal(d)
+                self._registrant.setTransactionInfo(tr)
+                self._regForm.getNotification().sendEmailNewRegistrantConfirmPay(self._regForm,self._registrant )
+
+
+
diff --git a/MaKaC/plugins/EPayment/payWay/webinterface/urlHandlers.py b/MaKaC/plugins/EPayment/payWay/webinterface/urlHandlers.py
new file mode 100644 (file)
index 0000000..a3ecee3
--- /dev/null
@@ -0,0 +1,52 @@
+# -*- coding: utf-8 -*-
+##
+##
+## This file is part of Indico.
+## Copyright (C) 2002 - 2014 European Organization for Nuclear Research (CERN).
+##
+## Indico is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License as
+## published by the Free Software Foundation; either version 3 of the
+## License, or (at your option) any later version.
+##
+## Indico is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Indico;if not, see <http://www.gnu.org/licenses/>.
+
+from MaKaC.webinterface.urlHandlers import URLHandler as MainURLHandler
+from MaKaC.plugins.EPayment import payPal
+
+
+class EPURLHandler(MainURLHandler):
+    _requestTag = ''
+
+    @classmethod
+    def getURL(cls, target=None):
+        return super(EPURLHandler, cls).getURL(target, EPaymentName=payPal.MODULE_ID, requestTag=cls._requestTag)
+
+
+class UHConfModifEPayment(EPURLHandler):
+    _endpoint = 'event_mgmt.confModifEpayment-modifModule'
+
+
+class UHConfModifEPaymentPayPal( UHConfModifEPayment ):
+    _requestTag = "modifPayPal"
+class UHConfModifEPaymentPayPalDataModif( UHConfModifEPayment ):
+    _requestTag = "modifPayPalData"
+class UHConfModifEPaymentPayPalPerformDataModif( UHConfModifEPayment ):
+    _requestTag = "modifPayPalPerformDataModif"
+
+
+class UHPay(EPURLHandler):
+    _endpoint = 'misc.payment'
+
+class UHPayConfirmPayPal( UHPay ):
+    _requestTag = "confirm"
+class UHPayCancelPayPal( UHPay ):
+    _requestTag = "cancel"
+class UHPayParamsPayPal( UHPay ):
+    _requestTag = "params"
diff --git a/MaKaC/plugins/EPayment/payWay/webinterface/wcomponents.py b/MaKaC/plugins/EPayment/payWay/webinterface/wcomponents.py
new file mode 100644 (file)
index 0000000..e0d9cf6
--- /dev/null
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+##
+##
+## This file is part of Indico.
+## Copyright (C) 2002 - 2014 European Organization for Nuclear Research (CERN).
+##
+## Indico is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License as
+## published by the Free Software Foundation; either version 3 of the
+## License, or (at your option) any later version.
+##
+## Indico is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Indico;if not, see <http://www.gnu.org/licenses/>.
+
+from MaKaC.webinterface import wcomponents
+import os
+import pkg_resources
+import MaKaC.common.Configuration as Configuration
+
+from MaKaC.plugins.EPayment import payPal
+
+class WTemplated(wcomponents.WTemplated):
+
+    def _setTPLFile(self):
+        """Sets the TPL (template) file for the object. It will try to get
+            from the configuration if there's a special TPL file for it and
+            if not it will look for a file called as the class name+".tpl"
+            in the configured TPL directory.
+        """
+        cfg = Configuration.Config.getInstance()
+        dir = pkg_resources.resource_filename(payPal.__name__, "tpls")
+        file = cfg.getTPLFile( self.tplId )
+        if file == "":
+            file = "%s.tpl"%self.tplId
+        self.tplFile = os.path.join(dir, file)
+
+        hfile = self._getSpecificTPL(os.path.join(dir,'chelp'),
+                                     self.tplId,
+                                     extension='wohl')
+
+        self.helpFile = os.path.join(dir,'chelp',hfile)