This is a snapshot of Indico's old Trac site. Any information contained herein is most probably outdated. Access our new GitHub site here.

Ticket #1078: 0003-FEAT-Add-a-bank-transfer-payment-module.patch

File 0003-FEAT-Add-a-bank-transfer-payment-module.patch, 55.2 KB (added by pedersen, 2 years ago)

new version with pdf invoice

  • new file indico/MaKaC/plugins/EPayment/bankTransfer/__init__.py

    From 875f549edba5fbdf2307efcec14215982b19548b Mon Sep 17 00:00:00 2001
    From: =?UTF-8?q?Bj=C3=B6rn=20Pedersen?= <bjoern.pedersen@frm2.tum.de>
    Date: Tue, 21 Aug 2012 17:47:30 +0200
    Subject: [PATCH 3/4] [FEAT] Add a bank transfer payment module
    
     * field for account data
     * field for pknumber (TUM-specific)
    ---
     .../plugins/EPayment/bankTransfer/__init__.py      |  28 ++
     .../plugins/EPayment/bankTransfer/epayment.py      | 504 +++++++++++++++++++++
     .../tpls/CancelEPaymentBankTransfer.tpl            |   8 +
     .../tpls/ConfModifEPaymentBankTransfer.tpl         |  40 ++
     .../ConfModifEPaymentBankTransferDataModif.tpl     |  43 ++
     .../tpls/confirmEPaymentBankTransfer.tpl           |  40 ++
     .../EPayment/bankTransfer/webinterface/__init__.py |  21 +
     .../bankTransfer/webinterface/pages/__init__.py    |  21 +
     .../bankTransfer/webinterface/pages/ePayments.py   | 179 ++++++++
     .../bankTransfer/webinterface/rh/__init__.py       |  37 ++
     .../bankTransfer/webinterface/rh/ePaymentModif.py  | 155 +++++++
     .../bankTransfer/webinterface/urlHandlers.py       |  68 +++
     .../bankTransfer/webinterface/wcomponents.py       |  47 ++
     indico/htdocs/bankTransfer.py                      |  28 ++
     setup.py                                           |   1 +
     15 files changed, 1220 insertions(+)
     create mode 100644 indico/MaKaC/plugins/EPayment/bankTransfer/__init__.py
     create mode 100644 indico/MaKaC/plugins/EPayment/bankTransfer/epayment.py
     create mode 100644 indico/MaKaC/plugins/EPayment/bankTransfer/tpls/CancelEPaymentBankTransfer.tpl
     create mode 100644 indico/MaKaC/plugins/EPayment/bankTransfer/tpls/ConfModifEPaymentBankTransfer.tpl
     create mode 100644 indico/MaKaC/plugins/EPayment/bankTransfer/tpls/ConfModifEPaymentBankTransferDataModif.tpl
     create mode 100644 indico/MaKaC/plugins/EPayment/bankTransfer/tpls/confirmEPaymentBankTransfer.tpl
     create mode 100644 indico/MaKaC/plugins/EPayment/bankTransfer/webinterface/__init__.py
     create mode 100644 indico/MaKaC/plugins/EPayment/bankTransfer/webinterface/pages/__init__.py
     create mode 100644 indico/MaKaC/plugins/EPayment/bankTransfer/webinterface/pages/ePayments.py
     create mode 100644 indico/MaKaC/plugins/EPayment/bankTransfer/webinterface/rh/__init__.py
     create mode 100644 indico/MaKaC/plugins/EPayment/bankTransfer/webinterface/rh/ePaymentModif.py
     create mode 100644 indico/MaKaC/plugins/EPayment/bankTransfer/webinterface/urlHandlers.py
     create mode 100644 indico/MaKaC/plugins/EPayment/bankTransfer/webinterface/wcomponents.py
     create mode 100644 indico/htdocs/bankTransfer.py
    
    diff --git a/indico/MaKaC/plugins/EPayment/bankTransfer/__init__.py b/indico/MaKaC/plugins/EPayment/bankTransfer/__init__.py
    new file mode 100644
    index 0000000..fda09ff
    - +  
     1# -*- coding: utf-8 -*- 
     2## 
     3## 
     4## This file is part of CDS Indico. 
     5## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 CERN. 
     6## 
     7## CDS Indico is free software; you can redistribute it and/or 
     8## modify it under the terms of the GNU General Public License as 
     9## published by the Free Software Foundation; either version 2 of the 
     10## License, or (at your option) any later version. 
     11## 
     12## CDS Indico is distributed in the hope that it will be useful, but 
     13## WITHOUT ANY WARRANTY; without even the implied warranty of 
     14## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
     15## General Public License for more details. 
     16## 
     17## You should have received a copy of the GNU General Public License 
     18## along with CDS Indico; if not, write to the Free Software Foundation, Inc., 
     19## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 
     20 
     21__metadata__ = { 
     22    'type': "EPayment", 
     23    'name': "BankTransfer" 
     24    } 
     25 
     26MODULE_ID = 'banktransfer' 
     27 
     28modules = {} 
  • new file indico/MaKaC/plugins/EPayment/bankTransfer/epayment.py

    diff --git a/indico/MaKaC/plugins/EPayment/bankTransfer/epayment.py b/indico/MaKaC/plugins/EPayment/bankTransfer/epayment.py
    new file mode 100644
    index 0000000..4f20c3a
    - +  
     1# -*- coding: utf-8 -*- 
     2## 
     3## 
     4## This file is part of CDS Indico. 
     5## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 CERN. 
     6## 
     7## CDS Indico is free software; you can redistribute it and/or 
     8## modify it under the terms of the GNU General Public License as 
     9## published by the Free Software Foundation; either version 2 of the 
     10## License, or (at your option) any later version. 
     11## 
     12## CDS Indico is distributed in the hope that it will be useful, but 
     13## WITHOUT ANY WARRANTY; without even the implied warranty of 
     14## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
     15## General Public License for more details. 
     16## 
     17## You should have received a copy of the GNU General Public License 
     18## along with CDS Indico; if not, write to the Free Software Foundation, Inc., 
     19## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 
     20 
     21from MaKaC.epayment import BaseEPayMod, BaseTransaction 
     22import MaKaC.webinterface.urlHandlers as urlHandlers 
     23from MaKaC.webinterface.common.tools import strip_ml_tags 
     24 
     25import tempfile, os 
     26 
     27 
     28from MaKaC.plugins.EPayment.bankTransfer.webinterface import urlHandlers as localUrlHandlers 
     29from MaKaC.plugins.EPayment.bankTransfer import MODULE_ID 
     30 
     31try : 
     32    from PIL import Image 
     33except ImportError, e: 
     34    from MaKaC.PDFinterface.base import Image 
     35from MaKaC.PDFinterface.base import escape, Int2Romans 
     36from datetime import timedelta, datetime 
     37from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle 
     38from reportlab.lib.units import inch, cm 
     39from reportlab.lib import colors 
     40from reportlab.lib.enums import TA_JUSTIFY, TA_CENTER, TA_LEFT, TA_RIGHT 
     41from reportlab.rl_config import defaultPageSize 
     42from reportlab.platypus import Table, TableStyle, KeepTogether, XPreformatted 
     43from reportlab.pdfgen import canvas 
     44from MaKaC.common.timezoneUtils import DisplayTZ, nowutc 
     45from MaKaC.registration import Registrant 
     46from MaKaC.PDFinterface.base import PDFBase, Paragraph, Spacer, PageBreak, Preformatted, FileDummy, setTTFonts, PDFSizes, modifiedFontSize, SimpleParagraph 
     47from reportlab.lib.pagesizes import landscape, A4 
     48from MaKaC.webinterface.common.tools import strip_ml_tags 
     49import re 
     50from MaKaC.i18n import _ 
     51from indico.util.i18n import i18nformat 
     52from MaKaC.common import Config 
     53 
     54class BankTransferMod(BaseEPayMod): 
     55    _accountOwner = "" 
     56    _accountBank = "" 
     57    _accountBLZ = "" 
     58    _accountNumber = "" 
     59    _accountIBAN = "" 
     60    _accountSwift = "" 
     61 
     62    def __init__(self, data=None): 
     63        BaseEPayMod.__init__(self) 
     64        self._title = "bank transfer" 
     65        self._detailPayment = "" 
     66        self._accountOwner = "" 
     67        self._accountBank = "" 
     68        self._accountBLZ = "" 
     69        self._accountNumber = "" 
     70        self._accountIBAN = "" 
     71        self._accountSwift = "" 
     72        self._pknumber = "" 
     73        if data is not None: 
     74            self.setValues(data) 
     75        self._id = "banktransfer" 
     76 
     77    def getId(self): 
     78        try: 
     79            if self._id: 
     80                pass 
     81        except AttributeError, e: 
     82            self._id = "banktransfer" 
     83        return self._id 
     84 
     85    def clone(self, newSessions): 
     86        sesf = BankTransferMod() 
     87        sesf.setTitle(self.getTitle()) 
     88 
     89 
     90        return sesf 
     91 
     92    def setValues(self, data): 
     93        try: 
     94            self.setTitle(data.get("title", "epayment")) 
     95            self.setdetailPayment(data.get("detailPayment", "")) 
     96            self.setAccountOwner(data.get("accountOwner", "")) 
     97            self.setAccountBank(data.get("accountBank", "")) 
     98            self.setAccountBLZ(data.get("accountBLZ", "")) 
     99            self.setAccountNumber(data.get("accountNumber", "")) 
     100            self.setAccountIBAN(data.get("accountIBAN", "")) 
     101            self.setAccountSwift(data.get("accountSwift", "")) 
     102            self.setPKNumber(data.get("pknumber", "")) 
     103        except: 
     104            pass 
     105 
     106    def getNewTempFile(self): 
     107        cfg = Config.getInstance() 
     108        tempPath = cfg.getUploadedFilesTempDir() 
     109        tempFile = tempfile.mkstemp( prefix='invoice', suffix=".pdf", dir = tempPath ) 
     110        return tempFile 
     111 
     112    def getExtraPaymentDetailsAttachment(self, registrant): 
     113 
     114        (handle, path) = self.getNewTempFile() 
     115        fil = os.fdopen(handle, 'wb') 
     116        data = InvoiceToPDF(registrant).getPDFBin() 
     117        fil.write(data) 
     118        fil.close() 
     119        return ('application/pdf', 'invoice.pdf', path) 
     120 
     121    def getExtraPaymentDetailsHTML(self, registrant): 
     122 
     123        txt = """<td align="right"><b>account bank</b></td> 
     124        <td align="left">%s</td> 
     125    </tr> 
     126    <tr> 
     127        <td align="right"><b>account BLZ</b></td> 
     128        <td align="left">%s</td> 
     129    </tr> 
     130    <tr> 
     131        <td align="right"><b>account Number</b></td> 
     132        <td align="left">%s</td> 
     133    </tr> 
     134    <tr> 
     135        <td align="right"><b>account IBAN</b></td> 
     136        <td align="left">%s</td> 
     137    </tr> 
     138    <tr> 
     139        <td align="right"><b>account SWIFT</b></td> 
     140        <td align="left">%s</td> 
     141    </tr> 
     142        <tr> 
     143            <td align="right"><b>Subject</b></td> 
     144            <td align="left">PK-Nr %s ID %s</td> 
     145        </tr> 
     146 
     147                        </table>""" % ( 
     148             self.getAccountBank(), 
     149             self.getAccountBLZ(), 
     150             self.getAccountNumber(), 
     151             self.getAccountIBAN(), 
     152             self.getAccountSwift(), 
     153             self.getPKNumber(), 
     154             registrant.getIdPay() 
     155             ) 
     156        return txt 
     157 
     158    def getExtraPaymentDetails(self, registrant): 
     159        txt = """\n\n\tAccount Owner: %s\n 
     160\tBank: %s\n 
     161\tBLZ: %s\n 
     162\tAccount: %s\n 
     163\tIBAN: %s\n 
     164\tSWIFT: %s\n 
     165\tSubject: PK-Nr %s  ID %s \n 
     166""" % ( 
     167             self.getAccountOwner(), 
     168             self.getAccountBank(), 
     169             self.getAccountBLZ(), 
     170             self.getAccountNumber(), 
     171             self.getAccountIBAN(), 
     172             self.getAccountSwift(), 
     173             self.getPKNumber(), 
     174             registrant.getIdPay() 
     175             ) 
     176        return txt 
     177 
     178    def getdetailPayment(self): 
     179        return self._detailPayment 
     180    def setdetailPayment(self, detailPayment): 
     181        self._detailPayment = detailPayment 
     182 
     183    def getAccountOwner(self): 
     184        return self._accountOwner 
     185    def setAccountOwner(self, accountOwner): 
     186        self._accountOwner = accountOwner 
     187    def getAccountBank(self): 
     188        return self._accountBank 
     189    def setAccountBank(self, accountBank): 
     190        self._accountBank = accountBank 
     191    def getAccountBLZ(self): 
     192        return self._accountBLZ 
     193    def setAccountBLZ(self, accountBLZ): 
     194        self._accountBLZ = accountBLZ 
     195    def getAccountNumber(self): 
     196        return self._accountNumber 
     197    def setAccountNumber(self, accountNumber): 
     198        self._accountNumber = accountNumber 
     199    def getAccountIBAN(self): 
     200        return self._accountIBAN 
     201    def setAccountIBAN(self, accountIBAN): 
     202        self._accountIBAN = accountIBAN 
     203    def getAccountSwift(self): 
     204        return self._accountSwift 
     205    def setAccountSwift(self, accountSwift): 
     206        self._accountSwift = accountSwift 
     207 
     208    def getPKNumber(self): 
     209        return self._pknumber 
     210    def setPKNumber(self, pknumber): 
     211        self._pknumber = pknumber 
     212 
     213 
     214    def getTitle(self): 
     215        return self._title 
     216    def setTitle(self, title): 
     217        self._title = title 
     218 
     219    def getUrl(self, registrant): 
     220        return localUrlHandlers.UHPayConfirmBankTransfer.getURL(registrant) 
     221 
     222    def getFormHTML(self, prix, Currency, conf, registrant, lang="en_GB", secure=False): 
     223        url_return = localUrlHandlers.UHPayConfirmBankTransfer.getURL(registrant) 
     224        url_cancel_return = localUrlHandlers.UHPayCancelBankTransfer.getURL(registrant) 
     225        url_notify = localUrlHandlers.UHPayParamsBankTransfer.getURL(registrant) 
     226        s = """ <form action="%s" method="POST" id="%s"> 
     227                        <input type="hidden" name="cmd" value="_xclick"> 
     228                        <input type="hidden" name="item_name" value="%s"> 
     229                        <input type="hidden" name="amount" value="%s"> 
     230                        <INPUT TYPE="hidden" NAME="currency_code" value="%s"> 
     231                        <input type="hidden" name="charset" value="utf-8"> 
     232                        <input type="hidden" name="return" value="%s"> 
     233                        <input type="hidden" name="cancel_return" value="%s"> 
     234                        <input type="hidden" name="notify_url" value="%s"> 
     235                   </form> 
     236                       """ % (self.getUrl(registrant), self.getId(), "%s: registration for %s" % (registrant.getFullName(), strip_ml_tags(conf.getTitle())), prix, Currency, \ 
     237                            url_return, url_cancel_return, url_notify) 
     238        #s=cgi.escape(s) 
     239        return s 
     240 
     241    def getConfModifEPaymentURL(self, conf): 
     242        return localUrlHandlers.UHConfModifEPaymentBankTransfer.getURL(conf) 
     243 
     244 
     245 
     246class TransactionBankTransferMod(BaseTransaction): 
     247 
     248    def __init__(self, parms): 
     249        BaseTransaction.__init__(self) 
     250        self._Data = parms 
     251 
     252    def isChangeable(self): return True 
     253 
     254    def getId(self): 
     255        try: 
     256            if self._id: 
     257                pass 
     258        except AttributeError, e: 
     259            self._id = "banktransfer" 
     260        return self._id 
     261 
     262    def getTransactionHTML(self): 
     263        payMod = getPayMod() 
     264        return"""<table> 
     265                          <tr> 
     266                            <td align="right"><b>Payment with:</b></td> 
     267                            <td align="left">Bank transfer</td> 
     268                          </tr> 
     269                          <tr> 
     270                            <td align="right"><b>OrderTotal:</b></td> 
     271                            <td align="left">%s %s</td> 
     272                          </tr> 
     273                          <tr><td>%s</td></tr> 
     274                        </table>%s""" % (self._Data["OrderTotal"], \ 
     275                             self._Data["Currency"], self._Data["payer_id"], payMod.getdetailPayment()) 
     276 
     277 
     278class TransactionBankTransfer(BaseTransaction): 
     279 
     280    def __init__(self, parms): 
     281        BaseTransaction.__init__(self) 
     282        self._Data = parms 
     283 
     284 
     285    def getId(self): 
     286        try: 
     287            if self._id: 
     288                pass 
     289        except AttributeError, e: 
     290            self._id = "banktransfer" 
     291        return self._id 
     292 
     293    def getTransactionHTML(self): 
     294        payMod = getPayMod() 
     295        return"""<table> 
     296                          <tr> 
     297                            <td align="right"><b>Payment with:</b></td> 
     298                            <td align="left">Bank transfer</td> 
     299                          </tr> 
     300                          <tr> 
     301                            <td align="right"><b>Payment Date:</b></td> 
     302                            <td align="left">%s</td> 
     303                          </tr> 
     304                          <tr> 
     305                            <td align="right"><b>Payment ID:</b></td> 
     306                            <td align="left">%s</td> 
     307                          </tr> 
     308                          <tr> 
     309                            <td align="right"><b>Order Total:</b></td> 
     310                            <td align="left">%s %s</td> 
     311                          </tr> 
     312                          <tr> 
     313                            <td align="right"><b>verify sign:</b></td> 
     314                            <td align="left">%s</td> 
     315                          </tr> 
     316                              <tr> 
     317        <td align="right"><b>account Owner</b></td> 
     318        <td align="left">%s</td> 
     319    </tr> 
     320                              <tr> 
     321        <td align="right"><b>account bank</b></td> 
     322        <td align="left">%s</td> 
     323    </tr> 
     324    <tr> 
     325        <td align="right"><b>account BLZ</b></td> 
     326        <td align="left">%s</td> 
     327    </tr> 
     328    <tr> 
     329        <td align="right"><b>account Number</b></td> 
     330        <td align="left">%s</td> 
     331    </tr> 
     332    <tr> 
     333        <td align="right"><b>account IBAN</b></td> 
     334        <td align="left">%s</td> 
     335    </tr> 
     336    <tr> 
     337        <td align="right"><b>account SWIFT</b></td> 
     338        <td align="left">%s</td> 
     339    </tr> 
     340        <tr> 
     341            <td align="right"><b>Subject</b></td> 
     342            <td align="left">PK-Nr %s ID %s</td> 
     343        </tr> 
     344 
     345                        </table>""" % ("", self._Data["payer_id"], self._Data["mc_gross"], \ 
     346                             self._Data["mc_currency"], self._Data["verify_sign"], 
     347                             payMod.getAccountOwner(), 
     348                             payMod.getAccountBank(), 
     349                             payMod.getAccountBLZ(), 
     350                             payMod.getAccountNumber(), 
     351                             payMod.getAccountIBAN(), 
     352                             payMod.getAccountSwift(), 
     353                             payMod.getPKNumber(), self._Data["payer_id"]) 
     354 
     355    def getTransactionTxt(self): 
     356        payMod = getPayMod() 
     357 
     358 
     359        return""" 
     360\tPayment with:BankTransfer\n 
     361\tPayment Date:%s\n 
     362\tPayment ID:%s\n 
     363\tOrder Total:%s %s\n 
     364\tverify sign:%s\n 
     365\n 
     366\tAccount Owner: %s\n 
     367\tBank: %s\n 
     368\tBLZ: %s\n 
     369\tAccount: %s\n 
     370\tIBAN: %s\n 
     371\tSWIFT: %s\n 
     372\tSubject: PK-Nr %s  ID %s\n 
     373""" % ("", self._Data["payer_id"], self._Data["mc_gross"], \ 
     374                             self._Data["mc_currency"], self._Data["verify_sign"], 
     375                             payMod.getAccountOwner(), 
     376                             payMod.getAccountBank(), 
     377                             payMod.getAccountBLZ(), 
     378                             payMod.getAccountNumber(), 
     379                             payMod.getAccountIBAN(), 
     380                             payMod.getAccountSwift(), 
     381                             payMod.getPKNumber(), self._Data["payer_id"]) 
     382 
     383 
     384 
     385def getPayMod(): 
     386    return BankTransferMod() 
     387 
     388def getPayModClass(): 
     389    return BankTransferMod 
     390 
     391 
     392class InvoiceToPDF(PDFBase): 
     393 
     394    def __init__(self, registrant): 
     395        self._registrant = registrant 
     396        story = [Spacer(1 * cm, 1 * cm)] 
     397        doc = None 
     398        PDFBase.__init__(self, doc, story) 
     399        self._title = _("params") 
     400        self._PAGE_HEIGHT = defaultPageSize[1] 
     401        self._PAGE_WIDTH = defaultPageSize[0] 
     402        self.paymod = self._registrant.getConference().getModPay().getPayModByTag('banktransfer') 
     403        self.paymod.setValues(self._registrant.getConference()) 
     404        self._fontsize = 'normal' 
     405        self.style0 = ParagraphStyle({}) 
     406        self.style0.fontName = "Helvetica" 
     407        self.style0.alignment = TA_LEFT 
     408        self.style1 = ParagraphStyle({}) 
     409        self.style1.fontName = "Helvetica-Bold" 
     410        self.style1.fontSize = modifiedFontSize(24, self._fontsize) 
     411        self.style1.leading = modifiedFontSize(36, self._fontsize) 
     412        self.style1.alignment = TA_CENTER 
     413        self.style2 = ParagraphStyle({}) 
     414        self.style2.fontName = "Helvetica" 
     415        self.style2.fontSize = modifiedFontSize(14, self._fontsize) 
     416        self.style2.leading = modifiedFontSize(20, self._fontsize) 
     417        self.style2.alignment = TA_CENTER 
     418 
     419    def getBody(self, story=None, indexedFlowable={}, level=1): 
     420        if not story: 
     421            story = self._story 
     422 
     423        #style = ParagraphStyle({}) 
     424        #style.fontSize = 12 
     425        sdate = self._registrant.getConference().getStartDate() 
     426        edate = self._registrant.getConference().getEndDate() 
     427        cLoc = self._registrant.getConference().getLocation().getName() 
     428        cTitle = strip_ml_tags(self._registrant.getConference().getTitle()) 
     429 
     430 
     431        regfullname = self._registrant.getFullName() 
     432        institut = self._registrant.getInstitution() 
     433        address = self._registrant.getAddress() 
     434        email = self._registrant.getEmail() 
     435        city = self._registrant.getCity() 
     436        country = self._registrant.getCountry() 
     437        fax = self._registrant.getFax() 
     438        total = self._registrant.getTotal() 
     439        idRegistrant = self._registrant.getIdPay() 
     440        #text = i18nformat(""" _("Abstract ID") : %s""")%self._abstract.getId() 
     441        #p = Paragraph(text, style, part=escape(self._abstract.getTitle())) 
     442        p = Paragraph(sdate.strftime('%d. %B %Y') + '-' + edate.strftime('%d. %B %Y'), self.style2) 
     443        story.append(p) 
     444        p = Paragraph(cTitle, self.style1) 
     445        story.append(p) 
     446        p = Paragraph(cLoc, self.style2) 
     447        story.append(p) 
     448        story.append(Spacer(cm, cm)) 
     449        p = Paragraph("Dear %s," % regfullname, self.style0) 
     450        story.append(p) 
     451        p = Paragraph("Thank you for signing up for %s. " 
     452                     "We have received the following information:" % cTitle, self.style0) 
     453        story.append(p) 
     454        story.append(Spacer(1 * cm, 1 * cm)) 
     455        tableInfo = [] 
     456        tableInfo.append(['Name', regfullname]) 
     457        tableInfo.append(['Institut', institut]) 
     458        tableInfo.append(['Address', address]) 
     459        tableInfo.append(['city', city]) 
     460        tableInfo.append(['Country', country]) 
     461        tableInfo.append(['e-mail', email]) 
     462        tableInfo.append(['FAX', fax]) 
     463        tableInfo.append(['Total', str(total)+ '€']) 
     464        tableInfo.append(['Registration-ID', idRegistrant]) 
     465 
     466        t = Table(tableInfo) 
     467        t.setStyle(TableStyle([('ALIGN', (-1, 0), (-1, -1), 'RIGHT'), 
     468                               ('ALIGN', (0, 0), (0, -1), 'LEFT'), 
     469                               ('INNERGRID', (0, 0), (-1, -1), 0.25, colors.black), 
     470                               ('BOX', (0, 0), (-1, -1), 0.25, colors.black), 
     471                       ])) 
     472 
     473        story.append(t) 
     474        story.append(Spacer(cm, cm)) 
     475        self.getInvoiceBlock() 
     476 
     477    def getInvoiceBlock(self): 
     478 
     479        pm = self.paymod 
     480        p = Paragraph("Invoice", self.style2) 
     481        self._story.append(p) 
     482        p = Paragraph ( 
     483                       """Please pay via bank transfer""", self.style0) 
     484        self._story.append(p) 
     485        self._story.append(Spacer(1 * cm, 1 * cm)) 
     486        tInfo = [ 
     487            ['Account Owner', pm.getAccountOwner()] , 
     488            ['Bank', pm.getAccountBank()], 
     489            ['IBAN', pm.getAccountIBAN()], 
     490            ['BIC/SWIFT', pm.getAccountSwift()], 
     491            ['Amount due', str(self._registrant.getTotal()) + '€'], 
     492            ['Reference', pm.getPKNumber() + ' ID: ' + self._registrant.getIdPay()]] 
     493        t = Table(tInfo) 
     494        t.setStyle(TableStyle([('ALIGN', (-1, 0), (-1, -1), 'RIGHT'), 
     495                               ('ALIGN', (0, 0), (0, -1), 'LEFT'), 
     496                               ('INNERGRID', (0, 0), (-1, -1), 0.25, colors.black), 
     497                               ('BOX', (0, 0), (-1, -1), 0.25, colors.black), 
     498                       ])) 
     499        self._story.append(t) 
     500 
     501 
     502 
     503    def firstPage(self, c, doc): 
     504        return 
  • new file indico/MaKaC/plugins/EPayment/bankTransfer/tpls/CancelEPaymentBankTransfer.tpl

    diff --git a/indico/MaKaC/plugins/EPayment/bankTransfer/tpls/CancelEPaymentBankTransfer.tpl b/indico/MaKaC/plugins/EPayment/bankTransfer/tpls/CancelEPaymentBankTransfer.tpl
    new file mode 100644
    index 0000000..69f1221
    - +  
     1    <table width="60%" align="center" border="0" style="border: 1px solid #777777"> 
     2        <tr> 
     3            <td class="groupTitle" colspan="2" style="text-align:center; background:#E5E5E5; color:gray">${ message }</td> 
     4        </tr> 
     5        <tr> 
     6            <td align="center" colspan="2" bgcolor="white" style="padding-bottom:10px">${ messagedetailPayment }</td> 
     7        </tr> 
     8    </table> 
  • new file indico/MaKaC/plugins/EPayment/bankTransfer/tpls/ConfModifEPaymentBankTransfer.tpl

    diff --git a/indico/MaKaC/plugins/EPayment/bankTransfer/tpls/ConfModifEPaymentBankTransfer.tpl b/indico/MaKaC/plugins/EPayment/bankTransfer/tpls/ConfModifEPaymentBankTransfer.tpl
    new file mode 100644
    index 0000000..deaa180
    - +  
     1<table width="90%" align="left" border="0"> 
     2    <tr> 
     3        <td class="dataCaptionTD"><span class="dataCaptionFormat">Title</span></td> 
     4        <td bgcolor="white" width="100%" class="blacktext">${ title }</td> 
     5        <form action=${ dataModificationURL } method="POST"> 
     6        <td rowspan="3" valign="bottom" align="right"> 
     7            <input type="submit" value="modify"> 
     8        </td> 
     9        </form> 
     10    </tr> 
     11    <tr> 
     12        <td class="dataCaptionTD"><span class="dataCaptionFormat">Account Owner</span></td> 
     13        <td bgcolor="white" width="100%" class="blacktext"><pre>${ accountOwner }</pre></td> 
     14    </tr> 
     15    <tr> 
     16        <td class="dataCaptionTD"><span class="dataCaptionFormat">account bank</span></td> 
     17        <td bgcolor="white" width="100%" class="blacktext"><pre>${ accountBank }</pre></td> 
     18    </tr> 
     19    <tr> 
     20        <td class="dataCaptionTD"><span class="dataCaptionFormat">account BLZ</span></td> 
     21        <td bgcolor="white" width="100%" class="blacktext"><pre>${ accountBLZ }</pre></td> 
     22    </tr> 
     23    <tr> 
     24        <td class="dataCaptionTD"><span class="dataCaptionFormat">account Number</span></td> 
     25        <td bgcolor="white" width="100%" class="blacktext"><pre>${ accountNumber }</pre></td> 
     26    </tr> 
     27    <tr> 
     28        <td class="dataCaptionTD"><span class="dataCaptionFormat">account IBAN</span></td> 
     29        <td bgcolor="white" width="100%" class="blacktext"><pre>${ accountIBAN }</pre></td> 
     30    </tr> 
     31    <tr> 
     32        <td class="dataCaptionTD"><span class="dataCaptionFormat">account SWIFT</span></td> 
     33        <td bgcolor="white" width="100%" class="blacktext"><pre>${ accountSwift }</pre></td> 
     34    </tr> 
     35    <tr> 
     36        <td class="dataCaptionTD"><span class="dataCaptionFormat">PK-Number</span></td> 
     37        <td bgcolor="white" width="100%" class="blacktext"><pre>${ pknumber }</pre></td> 
     38    </tr> 
     39    <tr><td>&nbsp;</td></tr> 
     40</table> 
  • new file indico/MaKaC/plugins/EPayment/bankTransfer/tpls/ConfModifEPaymentBankTransferDataModif.tpl

    diff --git a/indico/MaKaC/plugins/EPayment/bankTransfer/tpls/ConfModifEPaymentBankTransferDataModif.tpl b/indico/MaKaC/plugins/EPayment/bankTransfer/tpls/ConfModifEPaymentBankTransferDataModif.tpl
    new file mode 100644
    index 0000000..c4749b4
    - +  
     1<form action=${ postURL } method="POST"> 
     2    <table width="80%" align="center" border="0" style="border-left: 1px solid #777777"> 
     3        <tr> 
     4            <td class="groupTitle" colspan="2">Configuration of Bank transfer</td> 
     5        </tr> 
     6        <tr> 
     7            <td nowrap class="dataCaptionTD"><span class="titleCellFormat">Title</span></td> 
     8            <td align="left"><input type="text" name="title" size="60" value="${ title }"></td> 
     9        </tr> 
     10        <tr> 
     11            <td class="dataCaptionTD"><span class="dataCaptionFormat">Account Owner</span></td> 
     12            <td align="left"><input type="text" name="accountOwner" size="90" value="${ accountOwner }"></td> 
     13        </tr> 
     14        <tr> 
     15            <td class="dataCaptionTD"><span class="dataCaptionFormat"> Bank</span></td> 
     16            <td align="left"><input type="text" name="accountBank" size="90" value="${ accountBank }"></td> 
     17        </tr> 
     18        <tr> 
     19            <td class="dataCaptionTD"><span class="dataCaptionFormat"> BLZ</span></td> 
     20            <td align="left"><input type="text" name="accountBLZ" size="90" value="${ accountBLZ }"></td> 
     21        </tr> 
     22        <tr> 
     23            <td class="dataCaptionTD"><span class="dataCaptionFormat">Account Number</span></td> 
     24            <td align="left"><input type="text" name="accountNumber" size="90" value="${ accountNumber }"></td> 
     25        </tr> 
     26        <tr> 
     27            <td class="dataCaptionTD"><span class="dataCaptionFormat"> IBAN</span></td> 
     28            <td align="left"><input type="text" name="accountIBAN" size="90" value="${ accountIBAN }"></td> 
     29        </tr> 
     30        <tr> 
     31            <td class="dataCaptionTD"><span class="dataCaptionFormat"> Swift</span></td> 
     32            <td align="left"><input type="text" name="accountSwift" size="90" value="${ accountSwift }"></td> 
     33        </tr> 
     34        <tr> 
     35            <td class="dataCaptionTD"><span class="dataCaptionFormat">PK-Number</span></td> 
     36            <td align="left"><input type="text" name="pknumber" size="60" value="${ pknumber }"></td> 
     37        </tr> 
     38        <tr><td>&nbsp;</td></tr> 
     39        <tr> 
     40            <td colspan="2" align="left"><input type="submit" value="OK">&nbsp;<input type="submit" value="cancel" name="cancel"></td> 
     41        </tr> 
     42    </table> 
     43</form> 
  • new file indico/MaKaC/plugins/EPayment/bankTransfer/tpls/confirmEPaymentBankTransfer.tpl

    diff --git a/indico/MaKaC/plugins/EPayment/bankTransfer/tpls/confirmEPaymentBankTransfer.tpl b/indico/MaKaC/plugins/EPayment/bankTransfer/tpls/confirmEPaymentBankTransfer.tpl
    new file mode 100644
    index 0000000..30b614a
    - +  
     1 
     2    <table width="60%" align="center" border="0" style="border: 1px solid #777777"> 
     3        <tr> 
     4            <td class="groupTitle" colspan="2" style="text-align:center; background:#E5E5E5; color:gray">${ message }</td> 
     5        </tr> 
     6    <tr> 
     7        <td class="dataCaptionTD"><span class="dataCaptionFormat">Account Owner</span></td> 
     8        <td bgcolor="white" width="100%" class="blacktext"><pre>${ accountOwner }</pre></td> 
     9    </tr> 
     10    <tr> 
     11        <td class="dataCaptionTD"><span class="dataCaptionFormat">Bank</span></td> 
     12        <td bgcolor="white" width="100%" class="blacktext"><pre>${ accountBank }</pre></td> 
     13    </tr> 
     14<!--    <tr> 
     15        <td class="dataCaptionTD"><span class="dataCaptionFormat">BLZ</span></td> 
     16        <td bgcolor="white" width="100%" class="blacktext"><pre>${ accountBLZ }</pre></td> 
     17    </tr> 
     18    <tr> 
     19        <td class="dataCaptionTD"><span class="dataCaptionFormat">Number</span></td> 
     20        <td bgcolor="white" width="100%" class="blacktext"><pre>${ accountNumber }</pre></td> 
     21    </tr>--> 
     22    <tr> 
     23        <td class="dataCaptionTD"><span class="dataCaptionFormat">IBAN</span></td> 
     24        <td bgcolor="white" width="100%" class="blacktext"><pre>${ accountIBAN }</pre></td> 
     25    </tr> 
     26    <tr> 
     27        <td class="dataCaptionTD"><span class="dataCaptionFormat">SWIFT</span></td> 
     28        <td bgcolor="white" width="100%" class="blacktext"><pre>${ accountSwift }</pre></td> 
     29    </tr> 
     30        <tr> 
     31            <td class="dataCaptionTD"> <span class="dataCaptionFormat">Subject</span></td> 
     32            <td bgcolor="white" width="100%" class="blacktext"><pre>PK-Nr ${ pknumber} ID ${ id }</pre></td> 
     33        </tr> 
     34        <tr> 
     35            <td align="center" colspan="2" bgcolor="white" style="padding-bottom:10px">${ trinfo }</td> 
     36        </tr> 
     37         <tr><t></td><td><a href=${ pdfurl } >Download invoice </a></td></tr> 
     38    </table> 
     39 
     40     
     41 No newline at end of file 
  • new file indico/MaKaC/plugins/EPayment/bankTransfer/webinterface/__init__.py

    diff --git a/indico/MaKaC/plugins/EPayment/bankTransfer/webinterface/__init__.py b/indico/MaKaC/plugins/EPayment/bankTransfer/webinterface/__init__.py
    new file mode 100644
    index 0000000..46ad351
    - +  
     1# -*- coding: utf-8 -*- 
     2## 
     3## 
     4## This file is part of CDS Indico. 
     5## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 CERN. 
     6## 
     7## CDS Indico is free software; you can redistribute it and/or 
     8## modify it under the terms of the GNU General Public License as 
     9## published by the Free Software Foundation; either version 2 of the 
     10## License, or (at your option) any later version. 
     11## 
     12## CDS Indico is distributed in the hope that it will be useful, but 
     13## WITHOUT ANY WARRANTY; without even the implied warranty of 
     14## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
     15## General Public License for more details. 
     16## 
     17## You should have received a copy of the GNU General Public License 
     18## along with CDS Indico; if not, write to the Free Software Foundation, Inc., 
     19## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 
     20 
     21modules = {} 
  • new file indico/MaKaC/plugins/EPayment/bankTransfer/webinterface/pages/__init__.py

    diff --git a/indico/MaKaC/plugins/EPayment/bankTransfer/webinterface/pages/__init__.py b/indico/MaKaC/plugins/EPayment/bankTransfer/webinterface/pages/__init__.py
    new file mode 100644
    index 0000000..46ad351
    - +  
     1# -*- coding: utf-8 -*- 
     2## 
     3## 
     4## This file is part of CDS Indico. 
     5## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 CERN. 
     6## 
     7## CDS Indico is free software; you can redistribute it and/or 
     8## modify it under the terms of the GNU General Public License as 
     9## published by the Free Software Foundation; either version 2 of the 
     10## License, or (at your option) any later version. 
     11## 
     12## CDS Indico is distributed in the hope that it will be useful, but 
     13## WITHOUT ANY WARRANTY; without even the implied warranty of 
     14## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
     15## General Public License for more details. 
     16## 
     17## You should have received a copy of the GNU General Public License 
     18## along with CDS Indico; if not, write to the Free Software Foundation, Inc., 
     19## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 
     20 
     21modules = {} 
  • new file indico/MaKaC/plugins/EPayment/bankTransfer/webinterface/pages/ePayments.py

    diff --git a/indico/MaKaC/plugins/EPayment/bankTransfer/webinterface/pages/ePayments.py b/indico/MaKaC/plugins/EPayment/bankTransfer/webinterface/pages/ePayments.py
    new file mode 100644
    index 0000000..891c9b7
    - +  
     1# -*- coding: utf-8 -*- 
     2## 
     3## 
     4## This file is part of CDS Indico. 
     5## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 CERN. 
     6## 
     7## CDS Indico is free software; you can redistribute it and/or 
     8## modify it under the terms of the GNU General Public License as 
     9## published by the Free Software Foundation; either version 2 of the 
     10## License, or (at your option) any later version. 
     11## 
     12## CDS Indico is distributed in the hope that it will be useful, but 
     13## WITHOUT ANY WARRANTY; without even the implied warranty of 
     14## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
     15## General Public License for more details. 
     16## 
     17## You should have received a copy of the GNU General Public License 
     18## along with CDS Indico; if not, write to the Free Software Foundation, Inc., 
     19## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 
     20 
     21import MaKaC.webinterface.pages.conferences as conferences 
     22import MaKaC.webinterface.pages.registrationForm as registrationForm 
     23from MaKaC.webinterface import wcomponents 
     24from xml.sax.saxutils import quoteattr 
     25from MaKaC.common import Configuration 
     26from MaKaC.webinterface import urlHandlers 
     27import MaKaC 
     28from MaKaC.i18n import _ 
     29 
     30 
     31from MaKaC.plugins.EPayment.bankTransfer import MODULE_ID 
     32from MaKaC.plugins.EPayment.bankTransfer.webinterface.wcomponents import WTemplated 
     33from MaKaC.plugins.EPayment.bankTransfer.webinterface import urlHandlers as localUrlHandlers 
     34 
     35 
     36 
     37class WPConfModifEPaymentBankTransferBase(registrationForm.WPConfModifRegFormBase): 
     38 
     39    def _createTabCtrl( self ): 
     40        self._tabCtrl = wcomponents.TabControl() 
     41        self._tabMain = self._tabCtrl.newTab( "main", _("Main"), \ 
     42                localUrlHandlers.UHConfModifEPaymentBankTransfer.getURL( self._conf ) ) 
     43        wf = self._rh.getWebFactory() 
     44        if wf: 
     45            wf.customiseTabCtrl( self._tabCtrl ) 
     46        self._setActiveTab() 
     47 
     48    def _setActiveTab( self ): 
     49        pass 
     50 
     51    def _setActiveSideMenuItem(self): 
     52        self._regFormMenuItem.setActive(True) 
     53 
     54    def _getPageContent( self, params ): 
     55        self._createTabCtrl() 
     56        banner = wcomponents.WEpaymentBannerModif(self._conf.getModPay().getPayModByTag(MODULE_ID), self._conf).getHTML() 
     57        html = wcomponents.WTabControl( self._tabCtrl, self._getAW() ).getHTML( self._getTabContent( params ) ) 
     58        return banner+html 
     59 
     60    def _getTabContent( self, params ): 
     61        return "nothing" 
     62 
     63class WPConfModifEPaymentBankTransfer( WPConfModifEPaymentBankTransferBase ): 
     64 
     65    def _getTabContent( self, params ): 
     66        wc = WConfModifEPaymentBankTransfer(self._conf) 
     67        p = { 
     68             'dataModificationURL': quoteattr(str(localUrlHandlers.UHConfModifEPaymentBankTransferDataModif.getURL( self._conf ))) 
     69            } 
     70        return wc.getHTML(p) 
     71 
     72class WConfModifEPaymentBankTransfer( WTemplated ): 
     73 
     74    def __init__( self, conference ): 
     75        self._conf = conference 
     76 
     77    def getVars( self ): 
     78        vars = WTemplated.getVars(self) 
     79        modBankTransfer = self._conf.getModPay().getPayModByTag(MODULE_ID) 
     80        vars["title"] = modBankTransfer.getTitle() 
     81        vars["accountOwner"] = modBankTransfer.getAccountOwner() 
     82        vars["accountBank"] = modBankTransfer.getAccountBank() 
     83        vars["accountBLZ"] = modBankTransfer.getAccountBLZ() 
     84        vars["accountNumber"] = modBankTransfer.getAccountNumber() 
     85        vars["accountIBAN"] = modBankTransfer.getAccountIBAN() 
     86        vars["accountSwift"] = modBankTransfer.getAccountSwift() 
     87        vars["pknumber"] =  modBankTransfer.getPKNumber() 
     88        return vars 
     89 
     90class WPConfModifEPaymentBankTransferDataModif( WPConfModifEPaymentBankTransferBase ): 
     91 
     92    def _getTabContent( self, params ): 
     93        wc = WConfModifEPaymentBankTransferDataModif(self._conf) 
     94        p = {'postURL': quoteattr(str(localUrlHandlers.UHConfModifEPaymentBankTransferPerformDataModif.getURL( self._conf ))) 
     95            } 
     96        return wc.getHTML(p) 
     97 
     98class WConfModifEPaymentBankTransferDataModif( WTemplated ): 
     99 
     100    def __init__( self, conference ): 
     101        self._conf = conference 
     102 
     103    def getVars( self ): 
     104        vars = WTemplated.getVars(self) 
     105        modBankTransfer = self._conf.getModPay().getPayModByTag(MODULE_ID) 
     106        vars["title"] = modBankTransfer.getTitle() 
     107        vars["accountOwner"] = modBankTransfer.getAccountOwner() 
     108        vars["accountBank"] = modBankTransfer.getAccountBank() 
     109        vars["accountBLZ"] = modBankTransfer.getAccountBLZ() 
     110        vars["accountNumber"] = modBankTransfer.getAccountNumber() 
     111        vars["accountIBAN"] = modBankTransfer.getAccountIBAN() 
     112        vars["accountSwift"] = modBankTransfer.getAccountSwift() 
     113        vars["pknumber"] =  modBankTransfer.getPKNumber() 
     114        return vars 
     115 
     116class WPconfirmEPaymentBankTransfer( conferences.WPConferenceDefaultDisplayBase ): 
     117    #navigationEntry = navigation.NERegistrationFormDisplay 
     118 
     119    def __init__(self, rh, conf, reg): 
     120        conferences.WPConferenceDefaultDisplayBase.__init__(self, rh, conf) 
     121        self._registrant=reg 
     122 
     123 
     124    def _getBody( self, params ): 
     125        wc = WconfirmEPaymentBankTransfer(self._conf, self._registrant) 
     126        return wc.getHTML() 
     127 
     128    def _defineSectionMenu( self ): 
     129        conferences.WPConferenceDefaultDisplayBase._defineSectionMenu(self) 
     130        self._sectionMenu.setCurrentItem(self._regFormOpt) 
     131 
     132 
     133class WconfirmEPaymentBankTransfer( WTemplated ): 
     134    def __init__( self,configuration, registrant): 
     135        self._registrant = registrant 
     136        self._conf = configuration 
     137 
     138    def getVars( self ): 
     139        vars = WTemplated.getVars(self) 
     140        modBankTransfer = self._conf.getModPay().getPayModByTag(MODULE_ID) 
     141        vars["message"] = "Thank you for the payment!<br/> You have choosen payment by BankTransfer<br>"\ 
     142                          "Please see the information below for details." 
     143        vars["accountOwner"] = modBankTransfer.getAccountOwner() 
     144        vars["accountBank"] = modBankTransfer.getAccountBank() 
     145        vars["accountBLZ"] = modBankTransfer.getAccountBLZ() 
     146        vars["accountNumber"] = modBankTransfer.getAccountNumber() 
     147        vars["accountIBAN"] = modBankTransfer.getAccountIBAN() 
     148        vars["accountSwift"] = modBankTransfer.getAccountSwift() 
     149        vars["pknumber"] = modBankTransfer.getPKNumber() 
     150        vars["id"] = self._registrant.getIdPay() 
     151        vars["trinfo"]="%s:%s"%(self._registrant.getFirstName(),self._registrant.getSurName()) 
     152        vars['pdfurl'] = quoteattr(str(localUrlHandlers.UHPayBankTransferDisplayPDF.getURL(self._registrant))) 
     153        return vars 
     154 
     155class WPCancelEPaymentBankTransfer( conferences.WPConferenceDefaultDisplayBase ): 
     156    #navigationEntry = navigation.NERegistrationFormDisplay 
     157 
     158    def __init__(self, rh, conf, reg): 
     159        conferences.WPConferenceDefaultDisplayBase.__init__(self, rh, conf) 
     160        self._registrant=reg 
     161 
     162    def _getBody( self, params ): 
     163        wc = WCancelEPaymentBankTransfer( self._conf,self._registrant ) 
     164        return wc.getHTML() 
     165 
     166    def _defineSectionMenu( self ): 
     167        conferences.WPConferenceDefaultDisplayBase._defineSectionMenu(self) 
     168        self._sectionMenu.setCurrentItem(self._regFormOpt) 
     169 
     170class WCancelEPaymentBankTransfer( WTemplated ): 
     171    def __init__( self, conference,reg ): 
     172        self._conf = conference 
     173        self._registrant=reg 
     174 
     175    def getVars( self ): 
     176        vars = WTemplated.getVars(self) 
     177        vars["message"] = "You have cancelled your transaction.\nPlease check your email in order to complete your BankTransfer transaction." 
     178        vars["messagedetailPayment"]="%s:%s"%(self._registrant.getFirstName(),self._registrant.getSurName()) 
     179        return vars 
  • new file indico/MaKaC/plugins/EPayment/bankTransfer/webinterface/rh/__init__.py

    diff --git a/indico/MaKaC/plugins/EPayment/bankTransfer/webinterface/rh/__init__.py b/indico/MaKaC/plugins/EPayment/bankTransfer/webinterface/rh/__init__.py
    new file mode 100644
    index 0000000..1fe3d4d
    - +  
     1# -*- coding: utf-8 -*- 
     2## 
     3## 
     4## This file is part of CDS Indico. 
     5## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 CERN. 
     6## 
     7## CDS Indico is free software; you can redistribute it and/or 
     8## modify it under the terms of the GNU General Public License as 
     9## published by the Free Software Foundation; either version 2 of the 
     10## License, or (at your option) any later version. 
     11## 
     12## CDS Indico is distributed in the hope that it will be useful, but 
     13## WITHOUT ANY WARRANTY; without even the implied warranty of 
     14## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
     15## General Public License for more details. 
     16## 
     17## You should have received a copy of the GNU General Public License 
     18## along with CDS Indico; if not, write to the Free Software Foundation, Inc., 
     19## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 
     20 
     21modules = {} 
     22 
     23 
     24 
     25def getRHByTag(self, tag): 
     26    """Do the link between url handlers and request handlers""" 
     27    for mod in self.modules.values(): 
     28        for RH in mod.__dict__.keys(): 
     29            try: 
     30                if mod.__dict__[RH]._requestTag == tag: 
     31                    return mod.__dict__[RH] 
     32            except: 
     33                pass 
     34 
     35 
     36def preprocessParams(params): 
     37    return True 
  • new file indico/MaKaC/plugins/EPayment/bankTransfer/webinterface/rh/ePaymentModif.py

    diff --git a/indico/MaKaC/plugins/EPayment/bankTransfer/webinterface/rh/ePaymentModif.py b/indico/MaKaC/plugins/EPayment/bankTransfer/webinterface/rh/ePaymentModif.py
    new file mode 100644
    index 0000000..ecd0007
    - +  
     1# -*- coding: utf-8 -*- 
     2## 
     3## 
     4## This file is part of CDS Indico. 
     5## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 CERN. 
     6## 
     7## CDS Indico is free software; you can redistribute it and/or 
     8## modify it under the terms of the GNU General Public License as 
     9## published by the Free Software Foundation; either version 2 of the 
     10## License, or (at your option) any later version. 
     11## 
     12## CDS Indico is distributed in the hope that it will be useful, but 
     13## WITHOUT ANY WARRANTY; without even the implied warranty of 
     14## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
     15## General Public License for more details. 
     16## 
     17## You should have received a copy of the GNU General Public License 
     18## along with CDS Indico; if not, write to the Free Software Foundation, Inc., 
     19## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 
     20 
     21from MaKaC.webinterface.rh.ePaymentModif import RHEPaymentModifBase, RHConferenceBaseDisplay, RHRegistrationFormDisplayBase 
     22import MaKaC.webinterface.urlHandlers as urlHandlers 
     23from datetime import datetime 
     24from MaKaC.common.timezoneUtils import nowutc 
     25from MaKaC.common import Config 
     26 
     27 
     28from MaKaC.plugins.EPayment.bankTransfer.webinterface.pages import ePayments 
     29from MaKaC.plugins.EPayment.bankTransfer.webinterface import urlHandlers as localUrlHandlers 
     30from MaKaC.plugins.EPayment.bankTransfer import epayment as ePayment 
     31from MaKaC.plugins.EPayment.bankTransfer import MODULE_ID 
     32from MaKaC.webinterface.common.tools import cleanHTMLHeaderFilename 
     33 
     34 
     35class RHEPaymentmodifBankTransfer( RHEPaymentModifBase ): 
     36    _requestTag = "modifBankTransfer" 
     37 
     38    def _process( self ): 
     39        p = ePayments.WPConfModifEPaymentBankTransfer( self, self._conf ) 
     40        return p.display() 
     41 
     42class RHEPaymentmodifBankTransferDataModif( RHEPaymentModifBase ): 
     43    _requestTag = "modifBankTransferData" 
     44 
     45    def _process( self ): 
     46        p = ePayments.WPConfModifEPaymentBankTransferDataModif( self, self._conf ) 
     47        return p.display() 
     48 
     49class RHEPaymentmodifBankTransferPerformDataModif( RHEPaymentModifBase ): 
     50    _requestTag = "modifBankTransferPerformDataModif" 
     51 
     52    def _checkParams( self, params ): 
     53        RHEPaymentModifBase._checkParams( self, params ) 
     54        self._params=params 
     55        self._cancel = params.has_key("cancel") 
     56 
     57    def _process( self ): 
     58        if not self._cancel: 
     59            ses = self._conf.getModPay().getPayModByTag(MODULE_ID) 
     60            ses.setValues(self._params) 
     61        self._redirect(localUrlHandlers.UHConfModifEPaymentBankTransfer.getURL(self._conf)) 
     62 
     63 
     64 
     65 
     66class RHEPaymentconfirmBankTransfer( RHRegistrationFormDisplayBase ): 
     67    _requestTag = "confirm" 
     68 
     69    def _checkParams( self, params ): 
     70        RHRegistrationFormDisplayBase._checkParams( self, params ) 
     71        self._registrant=None 
     72        regId= params.get("registrantId","") 
     73        if regId is not None: 
     74            self._registrant=self._conf.getRegistrantById(regId) 
     75 
     76    def _processIfActive( self ): 
     77        if self._registrant is not None: 
     78            p = ePayments.WPconfirmEPaymentBankTransfer( self,self._conf,self._registrant) 
     79            return p.display() 
     80 
     81class RHAbstractDisplayPDF( RHRegistrationFormDisplayBase ): 
     82    _requestTag = 'pdf' 
     83 
     84    def _checkParams( self, params ): 
     85        RHRegistrationFormDisplayBase._checkParams( self, params ) 
     86        self._registrant=None 
     87        regId= params.get("registrantId","") 
     88        if regId is not None: 
     89            self._registrant=self._conf.getRegistrantById(regId) 
     90 
     91    def _process( self ): 
     92        filename = "%sInvoice.pdf"%self._target.getTitle() 
     93        pdf = ePayment.InvoiceToPDF(self._registrant) 
     94        data = pdf.getPDFBin() 
     95        #self._req.headers_out["Accept-Ranges"] = "bytes" 
     96        self._req.headers_out["Content-Length"] = "%s"%len(data) 
     97        cfg = Config.getInstance() 
     98        mimetype = cfg.getFileTypeMimeType( "PDF" ) 
     99        self._req.content_type = """%s"""%(mimetype) 
     100        self._req.headers_out["Content-Disposition"] = """inline; filename="%s\""""%cleanHTMLHeaderFilename(filename) 
     101        return data 
     102 
     103class RHEPaymentCancelBankTransfer( RHRegistrationFormDisplayBase ): 
     104    _requestTag = "cancel" 
     105 
     106    def _checkParams( self, params ): 
     107        RHRegistrationFormDisplayBase._checkParams( self, params ) 
     108        self._registrant=None 
     109        regId=params.get("registrantId","") 
     110        if regId is not None: 
     111            self._registrant=self._conf.getRegistrantById(regId) 
     112 
     113    def _processIfActive( self ): 
     114        if self._registrant is not None: 
     115            p = ePayments.WPCancelEPaymentBankTransfer( self,self._conf ,self._registrant) 
     116            return p.display() 
     117 
     118 
     119class RHEPaymentValideParamBankTransfer( RHConferenceBaseDisplay ): 
     120    _requestTag = "params" 
     121 
     122    def _checkParams( self, params ): 
     123        RHConferenceBaseDisplay._checkParams(self, params) 
     124        self._regForm = self._conf.getRegistrationForm() 
     125        self._params=params 
     126        self._registrant=None 
     127        regId=params.get("registrantId","") 
     128        if regId is not None: 
     129            self._registrant=self._conf.getRegistrantById(regId) 
     130 
     131    def _checkProtection(self): 
     132        # Just bypass everything else, as we want the payment service 
     133        # to acknowledge the payment 
     134        pass 
     135 
     136    def _process( self ): 
     137        regForm = self._conf.getRegistrationForm() 
     138        if not regForm.isActivated() or not self._conf.hasEnabledSection("regForm"): 
     139            p = regForm.WPRegFormInactive( self, self._conf ) 
     140            return p.display() 
     141        else: 
     142            if self._registrant is not None: 
     143                #self._registrant.setPayed(True) 
     144                d={} 
     145                #d["payment_date"]=nowutc() 
     146                d["payer_id"]=self._params.get("payer_id") 
     147                d["mc_currency"]=self._params.get("mc_currency") 
     148                d["mc_gross"]=self._params.get("mc_gross") 
     149                d["verify_sign"]=self._params.get("verify_sign") 
     150                tr=ePayment.TransactionBankTransfer(d) 
     151                self._registrant.setTransactionInfo(tr) 
     152                self._regForm.getNotification().sendEmailNewRegistrantConfirmPay(self._regForm,self._registrant ) 
     153 
     154 
     155 
  • new file indico/MaKaC/plugins/EPayment/bankTransfer/webinterface/urlHandlers.py

    diff --git a/indico/MaKaC/plugins/EPayment/bankTransfer/webinterface/urlHandlers.py b/indico/MaKaC/plugins/EPayment/bankTransfer/webinterface/urlHandlers.py
    new file mode 100644
    index 0000000..a9406c0
    - +  
     1# -*- coding: utf-8 -*- 
     2## 
     3## 
     4## This file is part of CDS Indico. 
     5## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 CERN. 
     6## 
     7## CDS Indico is free software; you can redistribute it and/or 
     8## modify it under the terms of the GNU General Public License as 
     9## published by the Free Software Foundation; either version 2 of the 
     10## License, or (at your option) any later version. 
     11## 
     12## CDS Indico is distributed in the hope that it will be useful, but 
     13## WITHOUT ANY WARRANTY; without even the implied warranty of 
     14## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
     15## General Public License for more details. 
     16## 
     17## You should have received a copy of the GNU General Public License 
     18## along with CDS Indico; if not, write to the Free Software Foundation, Inc., 
     19## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 
     20 
     21from MaKaC.webinterface.urlHandlers import URLHandler as MainURLHandler 
     22from MaKaC.plugins.EPayment import bankTransfer 
     23 
     24class EPURLHandler(MainURLHandler): 
     25     
     26    _requestTag = "" 
     27     
     28    def getURL( cls, target=None ): 
     29        """Gives the full URL for the corresponding request handler. In case 
     30            the target parameter is specified it will append to the URL the  
     31            the necessary parameters to make the target be specified in the url. 
     32             
     33            Parameters: 
     34                target - (Locable) Target object which must be uniquely  
     35                    specified in the URL so the destination request handler 
     36                    is able to retrieve it.  
     37        """ 
     38        #url = MainURLHandler.getURL(target) 
     39        url = cls._getURL() 
     40        if target is not None: 
     41            url.setParams( target.getLocator() ) 
     42        url.addParam( "EPaymentName",  bankTransfer.MODULE_ID) 
     43        url.addParam( "requestTag", cls._requestTag ) 
     44        return url 
     45    getURL = classmethod( getURL ) 
     46 
     47class UHConfModifEPayment(EPURLHandler): 
     48    _relativeURL = "confModifEpayment.py/modifModule" 
     49 
     50class UHConfModifEPaymentBankTransfer( UHConfModifEPayment ): 
     51    _requestTag = "modifBankTransfer"   
     52class UHConfModifEPaymentBankTransferDataModif( UHConfModifEPayment ): 
     53    _requestTag = "modifBankTransferData"     
     54class UHConfModifEPaymentBankTransferPerformDataModif( UHConfModifEPayment ): 
     55    _requestTag = "modifBankTransferPerformDataModif"    
     56 
     57 
     58class UHPay(EPURLHandler): 
     59    _relativeURL = "payment.py" 
     60 
     61class UHPayConfirmBankTransfer( UHPay ): 
     62    _requestTag = "confirm"       
     63class UHPayCancelBankTransfer( UHPay ): 
     64    _requestTag = "cancel"         
     65class UHPayParamsBankTransfer( UHPay ): 
     66    _requestTag = "params"   
     67class UHPayBankTransferDisplayPDF( UHPay ): 
     68    _requestTag = "pdf"   
  • new file indico/MaKaC/plugins/EPayment/bankTransfer/webinterface/wcomponents.py

    diff --git a/indico/MaKaC/plugins/EPayment/bankTransfer/webinterface/wcomponents.py b/indico/MaKaC/plugins/EPayment/bankTransfer/webinterface/wcomponents.py
    new file mode 100644
    index 0000000..d28122c
    - +  
     1# -*- coding: utf-8 -*- 
     2## 
     3## 
     4## This file is part of CDS Indico. 
     5## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 CERN. 
     6## 
     7## CDS Indico is free software; you can redistribute it and/or 
     8## modify it under the terms of the GNU General Public License as 
     9## published by the Free Software Foundation; either version 2 of the 
     10## License, or (at your option) any later version. 
     11## 
     12## CDS Indico is distributed in the hope that it will be useful, but 
     13## WITHOUT ANY WARRANTY; without even the implied warranty of 
     14## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
     15## General Public License for more details. 
     16## 
     17## You should have received a copy of the GNU General Public License 
     18## along with CDS Indico; if not, write to the Free Software Foundation, Inc., 
     19## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 
     20 
     21from MaKaC.webinterface import wcomponents 
     22import os 
     23import MaKaC.common.Configuration as Configuration 
     24 
     25from MaKaC.plugins.EPayment import bankTransfer 
     26 
     27class WTemplated(wcomponents.WTemplated): 
     28 
     29    def _setTPLFile(self): 
     30        """Sets the TPL (template) file for the object. It will try to get 
     31            from the configuration if there's a special TPL file for it and 
     32            if not it will look for a file called as the class name+".tpl" 
     33            in the configured TPL directory. 
     34        """ 
     35        cfg = Configuration.Config.getInstance() 
     36 
     37        dir = os.path.join(bankTransfer.__path__[0], "tpls") 
     38        file = cfg.getTPLFile( self.tplId ) 
     39        if file == "": 
     40            file = "%s.tpl"%self.tplId 
     41        self.tplFile = os.path.join(dir, file) 
     42 
     43        hfile = self._getSpecificTPL(os.path.join(dir,'chelp'), 
     44                                     self.tplId, 
     45                                     extension='wohl') 
     46 
     47        self.helpFile = os.path.join(dir,'chelp',hfile) 
  • new file indico/htdocs/bankTransfer.py

    diff --git a/indico/htdocs/bankTransfer.py b/indico/htdocs/bankTransfer.py
    new file mode 100644
    index 0000000..60e1d18
    - +  
     1# -*- coding: utf-8 -*- 
     2## 
     3## 
     4## This file is part of CDS Indico. 
     5## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 CERN. 
     6## 
     7## CDS Indico is free software; you can redistribute it and/or 
     8## modify it under the terms of the GNU General Public License as 
     9## published by the Free Software Foundation; either version 2 of the 
     10## License, or (at your option) any later version. 
     11## 
     12## CDS Indico is distributed in the hope that it will be useful, but 
     13## WITHOUT ANY WARRANTY; without even the implied warranty of 
     14## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
     15## General Public License for more details. 
     16## 
     17## You should have received a copy of the GNU General Public License 
     18## along with CDS Indico; if not, write to the Free Software Foundation, Inc., 
     19## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 
     20 
     21import MaKaC.webinterface.rh.ePaymentModif as ePaymentModif 
     22def confirm(req, **params): 
     23    return ePaymentModif.RHEPaymentConfirmBankTransfer( req ).process( params ) 
     24 
     25def cancel(req, **params): 
     26    return ePaymentModif.RHEPaymentCancelBankTransfer ( req ).process( params ) 
     27def pdf(req, **params): 
     28    return ePaymentModif.RHAbstractDisplayPDF( req ).process( params ) 
  • setup.py

    diff --git a/setup.py b/setup.py
    index c1783ad..71936b9 100644
    a b if __name__ == '__main__': 
    532532            EPayment.worldPay = MaKaC.plugins.EPayment.worldPay 
    533533            EPayment.yellowPay = MaKaC.plugins.EPayment.yellowPay 
    534534            EPayment.skipjack = MaKaC.plugins.EPayment.skipjack 
     535            EPayment.bankTransfer = MaKaC.plugins.EPayment.bankTransfer 
    535536 
    536537            importer.invenio = indico.ext.importer.invenio 
    537538            importer.dummy = indico.ext.importer.dummy