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: 0004-Add-Mailorder-payment-module.patch

File 0004-Add-Mailorder-payment-module.patch, 53.4 KB (added by pedersen, 2 years ago)

a mail-order credit card eapyment module

  • new file indico/MaKaC/plugins/EPayment/bankTransfer/tpls/confirmEPaymentBankTransferInvoice.tpl

    From 86f79924f165ff77b682e11ddc1fae7842155603 Mon Sep 17 00:00:00 2001
    From: =?UTF-8?q?Bj=C3=B6rn=20Pedersen?= <bjoern.pedersen@frm2.tum.de>
    Date: Wed, 17 Apr 2013 18:42:57 +0200
    Subject: [PATCH 4/4] Add Mailorder payment module
    
    ---
     .../tpls/confirmEPaymentBankTransferInvoice.tpl    |  37 ++
     .../MaKaC/plugins/EPayment/mailorderCC/__init__.py |  28 ++
     .../MaKaC/plugins/EPayment/mailorderCC/epayment.py | 414 +++++++++++++++++++++
     .../mailorderCC/tpls/CancelEPaymentmailorderCC.tpl |   8 +
     .../tpls/ConfModifEPaymentmailorderCC.tpl          |  28 ++
     .../tpls/ConfModifEPaymentmailorderCCDataModif.tpl |  31 ++
     .../tpls/confirmEPaymentmailorderCC.tpl            |  18 +
     .../tpls/confirmEPaymentmailorderCCInvoice.tpl     |  17 +
     .../EPayment/mailorderCC/webinterface/__init__.py  |  21 ++
     .../mailorderCC/webinterface/pages/__init__.py     |  21 ++
     .../mailorderCC/webinterface/pages/ePayments.py    | 171 +++++++++
     .../mailorderCC/webinterface/rh/__init__.py        |  37 ++
     .../mailorderCC/webinterface/rh/ePaymentModif.py   | 155 ++++++++
     .../mailorderCC/webinterface/urlHandlers.py        |  71 ++++
     .../mailorderCC/webinterface/wcomponents.py        |  47 +++
     indico/htdocs/mailorderCC.py                       |  31 ++
     setup.py                                           |   1 +
     17 files changed, 1136 insertions(+)
     create mode 100644 indico/MaKaC/plugins/EPayment/bankTransfer/tpls/confirmEPaymentBankTransferInvoice.tpl
     create mode 100644 indico/MaKaC/plugins/EPayment/mailorderCC/__init__.py
     create mode 100644 indico/MaKaC/plugins/EPayment/mailorderCC/epayment.py
     create mode 100644 indico/MaKaC/plugins/EPayment/mailorderCC/tpls/CancelEPaymentmailorderCC.tpl
     create mode 100644 indico/MaKaC/plugins/EPayment/mailorderCC/tpls/ConfModifEPaymentmailorderCC.tpl
     create mode 100644 indico/MaKaC/plugins/EPayment/mailorderCC/tpls/ConfModifEPaymentmailorderCCDataModif.tpl
     create mode 100644 indico/MaKaC/plugins/EPayment/mailorderCC/tpls/confirmEPaymentmailorderCC.tpl
     create mode 100644 indico/MaKaC/plugins/EPayment/mailorderCC/tpls/confirmEPaymentmailorderCCInvoice.tpl
     create mode 100644 indico/MaKaC/plugins/EPayment/mailorderCC/webinterface/__init__.py
     create mode 100644 indico/MaKaC/plugins/EPayment/mailorderCC/webinterface/pages/__init__.py
     create mode 100644 indico/MaKaC/plugins/EPayment/mailorderCC/webinterface/pages/ePayments.py
     create mode 100644 indico/MaKaC/plugins/EPayment/mailorderCC/webinterface/rh/__init__.py
     create mode 100644 indico/MaKaC/plugins/EPayment/mailorderCC/webinterface/rh/ePaymentModif.py
     create mode 100644 indico/MaKaC/plugins/EPayment/mailorderCC/webinterface/urlHandlers.py
     create mode 100644 indico/MaKaC/plugins/EPayment/mailorderCC/webinterface/wcomponents.py
     create mode 100644 indico/htdocs/mailorderCC.py
    
    diff --git a/indico/MaKaC/plugins/EPayment/bankTransfer/tpls/confirmEPaymentBankTransferInvoice.tpl b/indico/MaKaC/plugins/EPayment/bankTransfer/tpls/confirmEPaymentBankTransferInvoice.tpl
    new file mode 100644
    index 0000000..8377c1c
    - +  
     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    </table> 
  • new file indico/MaKaC/plugins/EPayment/mailorderCC/__init__.py

    diff --git a/indico/MaKaC/plugins/EPayment/mailorderCC/__init__.py b/indico/MaKaC/plugins/EPayment/mailorderCC/__init__.py
    new file mode 100644
    index 0000000..8038199
    - +  
     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': "mailorderCC" 
     24    } 
     25 
     26MODULE_ID = 'mailorderCC' 
     27 
     28modules = {} 
  • new file indico/MaKaC/plugins/EPayment/mailorderCC/epayment.py

    diff --git a/indico/MaKaC/plugins/EPayment/mailorderCC/epayment.py b/indico/MaKaC/plugins/EPayment/mailorderCC/epayment.py
    new file mode 100644
    index 0000000..b1d5f99
    - +  
     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 
     24import tempfile, os 
     25 
     26from MaKaC.plugins.EPayment.mailorderCC.webinterface import urlHandlers as localUrlHandlers 
     27from MaKaC.plugins.EPayment.mailorderCC import MODULE_ID 
     28 
     29try : 
     30    from PIL import Image 
     31except ImportError, e: 
     32    from MaKaC.PDFinterface.base import Image 
     33from MaKaC.PDFinterface.base import escape, Int2Romans 
     34from datetime import timedelta, datetime 
     35from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle 
     36from reportlab.lib.units import inch, cm 
     37from reportlab.lib import colors 
     38from reportlab.lib.enums import TA_JUSTIFY, TA_CENTER, TA_LEFT, TA_RIGHT 
     39from reportlab.rl_config import defaultPageSize 
     40from reportlab.platypus import Table, TableStyle, KeepTogether, XPreformatted 
     41from reportlab.pdfgen import canvas 
     42from MaKaC.common.timezoneUtils import DisplayTZ, nowutc 
     43from MaKaC.registration import Registrant 
     44from MaKaC.PDFinterface.base import PDFBase, Paragraph, Spacer, PageBreak, Preformatted, FileDummy, setTTFonts, PDFSizes, modifiedFontSize, SimpleParagraph 
     45from reportlab.lib.pagesizes import landscape, A4 
     46from MaKaC.webinterface.common.tools import strip_ml_tags 
     47import re 
     48from MaKaC.i18n import _ 
     49from indico.util.i18n import i18nformat 
     50from MaKaC.common import Config 
     51 
     52class mailorderCCMod(BaseEPayMod): 
     53    _accountOwner = "" 
     54 
     55    def __init__(self, data=None): 
     56        BaseEPayMod.__init__(self) 
     57        self._title = "Credit card by mailorder" 
     58        self._detailPayment = "" 
     59        self._accountOwner = "" 
     60        self._pknumber = "" 
     61        self._faxreceiver = "" 
     62        self._mailreceiver = "" 
     63        if data is not None: 
     64            self.setValues(data) 
     65        self._id = "mailorderCC" 
     66 
     67    def getId(self): 
     68        try: 
     69            if self._id: 
     70                pass 
     71        except AttributeError, e: 
     72            self._id = "mailorderCC" 
     73        return self._id 
     74 
     75    def clone(self, newSessions): 
     76        sesf = mailorderCCMod() 
     77        sesf.setTitle(self.getTitle()) 
     78 
     79 
     80        return sesf 
     81 
     82    def setValues(self, data): 
     83        try: 
     84            self.setTitle(data.get("title", "epayment")) 
     85            self.setdetailPayment(data.get("detailPayment", "")) 
     86            self.setAccountOwner(data.get("accountOwner", "")) 
     87            self.setPKNumber(data.get("pknumber", "")) 
     88            self.setFaxReceiver(data.get("faxreceiver", "")) 
     89            self.setMailReceiver(data.get("mailreceiver", "")) 
     90        except: 
     91            pass 
     92    def getNewTempFile(self): 
     93        cfg = Config.getInstance() 
     94        tempPath = cfg.getUploadedFilesTempDir() 
     95        tempFile = tempfile.mkstemp( prefix='mailordercc', suffix=".pdf", dir = tempPath ) 
     96        return tempFile 
     97 
     98    def getExtraPaymentDetailsAttachment(self, registrant): 
     99 
     100        (handle, path) = self.getNewTempFile() 
     101        fil = os.fdopen(handle, 'wb') 
     102        data = MailorderToPDF(registrant).getPDFBin() 
     103        fil.write(data) 
     104        fil.close() 
     105        return ('application/pdf', 'mailordercc.pdf', path) 
     106 
     107 
     108    def getExtraPaymentDetailsHTML(self, registrant): 
     109 
     110        txt = """<p> Please check the attached pdf for info how to pay by   
     111        credit card via mailorder</p>""" 
     112        return txt 
     113 
     114    def getExtraPaymentDetails(self, registrant): 
     115        txt = """\n\n\tPlease check the attached pdf for info how to pay by   
     116        credit card via mailorder.\n""" 
     117        return txt 
     118 
     119    def getdetailPayment(self): 
     120        return self._detailPayment 
     121    def setdetailPayment(self, detailPayment): 
     122        self._detailPayment = detailPayment 
     123 
     124    def getAccountOwner(self): 
     125        return self._accountOwner 
     126    def setAccountOwner(self, accountOwner): 
     127        self._accountOwner = accountOwner 
     128 
     129    def getPKNumber(self): 
     130        return self._pknumber 
     131    def setPKNumber(self, pknumber): 
     132        self._pknumber = pknumber 
     133 
     134    def getFaxReceiver(self): 
     135        if hasattr(self, '_faxreceiver'): 
     136            return self._faxreceiver 
     137        return '' 
     138    def setFaxReceiver(self, Receiver): 
     139        self._faxreceiver = Receiver 
     140    def getMailReceiver(self): 
     141        if hasattr(self, '_mailreceiver'): 
     142            return self._mailreceiver 
     143        return '' 
     144    def setMailReceiver(self, Receiver): 
     145        self._mailreceiver = Receiver 
     146 
     147    def getTitle(self): 
     148        return self._title 
     149    def setTitle(self, title): 
     150        self._title = title 
     151 
     152    def getUrl(self, registrant): 
     153        return localUrlHandlers.UHPayConfirmmailorderCC.getURL(registrant) 
     154 
     155    def getFormHTML(self, prix, Currency, conf, registrant, lang="en_GB", secure=False): 
     156        url_return = localUrlHandlers.UHPayConfirmmailorderCC.getURL(registrant) 
     157        url_cancel_return = localUrlHandlers.UHPayCancelmailorderCC.getURL(registrant) 
     158        url_notify = localUrlHandlers.UHPayParamsmailorderCC.getURL(registrant) 
     159        s = """ <form action="%s" method="POST" id="%s"> 
     160                        <input type="hidden" name="cmd" value="_xclick"> 
     161                        <input type="hidden" name="item_name" value="%s"> 
     162                        <input type="hidden" name="amount" value="%s"> 
     163                        <INPUT TYPE="hidden" NAME="currency_code" value="%s"> 
     164                        <input type="hidden" name="charset" value="utf-8"> 
     165                        <input type="hidden" name="return" value="%s"> 
     166                        <input type="hidden" name="cancel_return" value="%s"> 
     167                        <input type="hidden" name="notify_url" value="%s"> 
     168                   </form> 
     169                       """ % (self.getUrl(registrant), self.getId(), "%s: registration for %s" % (registrant.getFullName(), strip_ml_tags(conf.getTitle())), prix, Currency, \ 
     170                            url_return, url_cancel_return, url_notify) 
     171        #s=cgi.escape(s) 
     172        return s 
     173 
     174    def getConfModifEPaymentURL(self, conf): 
     175        return localUrlHandlers.UHConfModifEPaymentmailorderCC.getURL(conf) 
     176 
     177 
     178 
     179class TransactionmailorderCCMod(BaseTransaction): 
     180 
     181    def __init__(self, parms): 
     182        BaseTransaction.__init__(self) 
     183        self._Data = parms 
     184 
     185    def isChangeable(self): return True 
     186 
     187    def getId(self): 
     188        try: 
     189            if self._id: 
     190                pass 
     191        except AttributeError, e: 
     192            self._id = "mailorderCC" 
     193        return self._id 
     194 
     195    def getTransactionHTML(self): 
     196        payMod = getPayMod() 
     197        return"""<table> 
     198                          <tr> 
     199                            <td align="right"><b>Payment with:</b></td> 
     200                            <td align="left">Credit card by mailorder</td> 
     201                          </tr> 
     202                          <tr> 
     203                            <td align="right"><b>OrderTotal:</b></td> 
     204                            <td align="left">%s %s</td> 
     205                          </tr> 
     206                          <tr><td>%s</td></tr> 
     207                        </table>%s""" % (self._Data["OrderTotal"], \ 
     208                             self._Data["Currency"], self._Data["payer_id"], payMod.getdetailPayment()) 
     209 
     210 
     211class TransactionmailorderCC(BaseTransaction): 
     212 
     213    def __init__(self, parms): 
     214        BaseTransaction.__init__(self) 
     215        self._Data = parms 
     216 
     217 
     218    def getId(self): 
     219        try: 
     220            if self._id: 
     221                pass 
     222        except AttributeError, e: 
     223            self._id = "mailorderCC" 
     224        return self._id 
     225 
     226    def getTransactionHTML(self): 
     227        payMod = getPayMod() 
     228        return"""<table> 
     229                          <tr> 
     230                            <td align="right"><b>Payment with:</b></td> 
     231                            <td align="left">Credit card by mailorder</td> 
     232                          </tr> 
     233                          <tr> 
     234                            <td align="right"><b>Payment Date:</b></td> 
     235                            <td align="left">%s</td> 
     236                          </tr> 
     237                          <tr> 
     238                            <td align="right"><b>Payment ID:</b></td> 
     239                            <td align="left">%s</td> 
     240                          </tr> 
     241                          <tr> 
     242                            <td align="right"><b>Order Total:</b></td> 
     243                            <td align="left">%s %s</td> 
     244                          </tr> 
     245                          <tr> 
     246                            <td align="right"><b>verify sign:</b></td> 
     247                            <td align="left">%s</td> 
     248                          </tr> 
     249                              <tr> 
     250        <td align="right"><b>account Owner</b></td> 
     251        <td align="left">%s</td> 
     252    </tr> 
     253        <tr> 
     254            <td align="right"><b>Subject</b></td> 
     255            <td align="left">PK-Nr %s ID %s</td> 
     256        </tr> 
     257 
     258                        </table>""" % ("", self._Data["payer_id"], self._Data["mc_gross"], \ 
     259                             self._Data["mc_currency"], self._Data["verify_sign"], 
     260                             payMod.getAccountOwner(), 
     261                             payMod.getPKNumber(), self._Data["payer_id"]) 
     262 
     263    def getTransactionTxt(self): 
     264        payMod = getPayMod() 
     265 
     266 
     267        return""" 
     268\tPayment with:mailorderCC\n 
     269\tPayment Date:%s\n 
     270\tPayment ID:%s\n 
     271\tOrder Total:%s %s\n 
     272\tverify sign:%s\n 
     273\n 
     274\tAccount Owner: %s\n 
     275\tSubject: PK-Nr %s  ID %s\n 
     276""" % ("", self._Data["payer_id"], self._Data["mc_gross"], \ 
     277                             self._Data["mc_currency"], self._Data["verify_sign"], 
     278                             payMod.getAccountOwner(), 
     279                             payMod.getPKNumber(), self._Data["payer_id"]) 
     280 
     281 
     282 
     283def getPayMod(): 
     284    return mailorderCCMod() 
     285 
     286def getPayModClass(): 
     287    return mailorderCCMod 
     288 
     289 
     290class MailorderToPDF(PDFBase): 
     291 
     292    def __init__(self, registrant): 
     293        self._registrant = registrant 
     294        story = [Spacer(1 * cm, 1 * cm)] 
     295        doc = None 
     296        PDFBase.__init__(self, doc, story) 
     297        self._title = _("params") 
     298        self._PAGE_HEIGHT = defaultPageSize[1] 
     299        self._PAGE_WIDTH = defaultPageSize[0] 
     300        self.paymod = self._registrant.getConference().getModPay().getPayModByTag('mailorderCC') 
     301        self.paymod.setValues(self._registrant.getConference()) 
     302        self._fontsize = 'normal' 
     303        self.style0 = ParagraphStyle({}) 
     304        self.style0.fontName = "Helvetica" 
     305        self.style0.alignment = TA_LEFT 
     306        self.style1 = ParagraphStyle({}) 
     307        self.style1.fontName = "Helvetica-Bold" 
     308        self.style1.fontSize = modifiedFontSize(24, self._fontsize) 
     309        self.style1.leading = modifiedFontSize(36, self._fontsize) 
     310        self.style1.alignment = TA_CENTER 
     311        self.style2 = ParagraphStyle({}) 
     312        self.style2.fontName = "Helvetica" 
     313        self.style2.fontSize = modifiedFontSize(14, self._fontsize) 
     314        self.style2.leading = modifiedFontSize(20, self._fontsize) 
     315        self.style2.alignment = TA_CENTER 
     316 
     317    def getBody(self, story=None, indexedFlowable={}, level=1): 
     318        if not story: 
     319            story = self._story 
     320 
     321        #style = ParagraphStyle({}) 
     322        #style.fontSize = 12 
     323        sdate = self._registrant.getConference().getStartDate() 
     324        edate = self._registrant.getConference().getEndDate() 
     325        cLoc = self._registrant.getConference().getLocation().getName() 
     326        cTitle = strip_ml_tags(self._registrant.getConference().getTitle()) 
     327 
     328 
     329        regfullname = self._registrant.getFullName() 
     330        institut = self._registrant.getInstitution() 
     331        address = self._registrant.getAddress() 
     332        email = self._registrant.getEmail() 
     333        city = self._registrant.getCity() 
     334        country = self._registrant.getCountry() 
     335        fax = self._registrant.getFax() 
     336        total = self._registrant.getTotal() 
     337        idRegistrant = self._registrant.getIdPay() 
     338        #text = i18nformat(""" _("Abstract ID") : %s""")%self._abstract.getId() 
     339        #p = Paragraph(text, style, part=escape(self._abstract.getTitle())) 
     340        p = Paragraph(sdate.strftime('%d. %B %Y') + '-' + edate.strftime('%d. %B %Y'), self.style2) 
     341        story.append(p) 
     342        p = Paragraph(cTitle, self.style1) 
     343        story.append(p) 
     344        p = Paragraph(cLoc, self.style2) 
     345        story.append(p) 
     346        story.append(Spacer(cm, cm)) 
     347        p = Paragraph("Dear %s," % regfullname, self.style0) 
     348        story.append(p) 
     349        p = Paragraph("Thank you for signing up for %s. " 
     350                     "We have received the following information:" % cTitle, self.style0) 
     351        story.append(p) 
     352        story.append(Spacer(1 * cm, 1 * cm)) 
     353        tableInfo = [] 
     354        tableInfo.append(['Name', regfullname]) 
     355        tableInfo.append(['Institut', institut]) 
     356        tableInfo.append(['Address', address]) 
     357        tableInfo.append(['city', city]) 
     358        tableInfo.append(['Country', country]) 
     359        tableInfo.append(['e-mail', email]) 
     360        tableInfo.append(['FAX', fax]) 
     361        tableInfo.append(['Total', total]) 
     362        tableInfo.append(['Registration-ID', idRegistrant]) 
     363 
     364        t = Table(tableInfo) 
     365        t.setStyle(TableStyle([('ALIGN', (-1, 0), (-1, -1), 'RIGHT'), 
     366                               ('ALIGN', (0, 0), (0, -1), 'LEFT'), 
     367                               ('INNERGRID', (0, 0), (-1, -1), 0.25, colors.black), 
     368                               ('BOX', (0, 0), (-1, -1), 0.25, colors.black), 
     369                       ])) 
     370 
     371        story.append(t) 
     372        story.append(Spacer(cm, cm)) 
     373        self.getCCBlock() 
     374 
     375    def getCCBlock(self): 
     376 
     377 
     378        p = Paragraph("Credit card", self.style2) 
     379        self._story.append(p) 
     380        p = Paragraph ( 
     381"""Payment by credit card can only be accepted if  required data are complete  
     382and the form is sent either by fax to:""", self.style0) 
     383        self._story.append(p) 
     384        p = Paragraph("* %s" % self.paymod.getFaxReceiver(), self.style0) 
     385        self._story.append(p) 
     386        p = Paragraph("or by post to:", self.style0) 
     387        self._story.append(p) 
     388        p = Paragraph("* %s" % self.paymod.getMailReceiver(), self.style0) 
     389        self._story.append(p) 
     390 
     391        p = Paragraph('Credit card details received via email/internet cannot be accepted.', self.style0) 
     392        self._story.append(p) 
     393        self._story.append(Spacer(1 * cm, 1 * cm)) 
     394        tInfo = [ 
     395            ['Credit card company', '[ ] Mastercard     [ ] Visa (we cannot accept other cards)'], 
     396            ['Credit card number (16 digits)', ''], 
     397            ['Security code (3 or 4 digits)', ''], 
     398            ['Valid through (mm/yyyy)', ''], 
     399            ['Name of card holder', ''], 
     400            ['Address of card holder', ''], 
     401            ['Amount', str(self._registrant.getTotal()) + '€'], 
     402            ['Signature of the cardholder', '']] 
     403        t = Table(tInfo) 
     404        t.setStyle(TableStyle([('ALIGN', (-1, 0), (-1, -1), 'RIGHT'), 
     405                               ('ALIGN', (0, 0), (0, -1), 'LEFT'), 
     406                               ('INNERGRID', (0, 0), (-1, -1), 0.25, colors.black), 
     407                               ('BOX', (0, 0), (-1, -1), 0.25, colors.black), 
     408                       ])) 
     409        self._story.append(t) 
     410 
     411 
     412 
     413    def firstPage(self, c, doc): 
     414        return 
  • new file indico/MaKaC/plugins/EPayment/mailorderCC/tpls/CancelEPaymentmailorderCC.tpl

    diff --git a/indico/MaKaC/plugins/EPayment/mailorderCC/tpls/CancelEPaymentmailorderCC.tpl b/indico/MaKaC/plugins/EPayment/mailorderCC/tpls/CancelEPaymentmailorderCC.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/mailorderCC/tpls/ConfModifEPaymentmailorderCC.tpl

    diff --git a/indico/MaKaC/plugins/EPayment/mailorderCC/tpls/ConfModifEPaymentmailorderCC.tpl b/indico/MaKaC/plugins/EPayment/mailorderCC/tpls/ConfModifEPaymentmailorderCC.tpl
    new file mode 100644
    index 0000000..86efb57
    - +  
     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">PK-Number</span></td> 
     17        <td bgcolor="white" width="100%" class="blacktext"><pre>${ pknumber }</pre></td> 
     18    </tr> 
     19    <tr> 
     20        <td class="dataCaptionTD"><span class="dataCaptionFormat">Fax receiver</span></td> 
     21        <td bgcolor="white" width="100%" class="blacktext"><pre>${ faxreceiver }</pre></td> 
     22    </tr> 
     23    <tr> 
     24        <td class="dataCaptionTD"><span class="dataCaptionFormat">Mail receiver</span></td> 
     25        <td bgcolor="white" width="100%" class="blacktext"><pre>${ mailreceiver }</pre></td> 
     26    </tr> 
     27    <tr><td>&nbsp;</td></tr> 
     28</table> 
  • new file indico/MaKaC/plugins/EPayment/mailorderCC/tpls/ConfModifEPaymentmailorderCCDataModif.tpl

    diff --git a/indico/MaKaC/plugins/EPayment/mailorderCC/tpls/ConfModifEPaymentmailorderCCDataModif.tpl b/indico/MaKaC/plugins/EPayment/mailorderCC/tpls/ConfModifEPaymentmailorderCCDataModif.tpl
    new file mode 100644
    index 0000000..0d23d8b
    - +  
     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 Credit card by mailorder</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">Fax receiver</span></td> 
     16            <td align="left"><input type="text" name="faxreceiver" size="120" value="${ faxreceiver }"></td> 
     17        </tr> 
     18        <tr> 
     19            <td class="dataCaptionTD"><span class="dataCaptionFormat">Mail receiver</span></td> 
     20            <td align="left"><input type="text" name="mailreceiver" size="120" value="${ mailreceiver }"></td> 
     21        </tr> 
     22        <tr> 
     23            <td class="dataCaptionTD"><span class="dataCaptionFormat">PK-Number</span></td> 
     24            <td align="left"><input type="text" name="pknumber" size="60" value="${ pknumber }"></td> 
     25        </tr> 
     26        <tr><td>&nbsp;</td></tr> 
     27        <tr> 
     28            <td colspan="2" align="left"><input type="submit" value="OK">&nbsp;<input type="submit" value="cancel" name="cancel"></td> 
     29        </tr> 
     30    </table> 
     31</form> 
  • new file indico/MaKaC/plugins/EPayment/mailorderCC/tpls/confirmEPaymentmailorderCC.tpl

    diff --git a/indico/MaKaC/plugins/EPayment/mailorderCC/tpls/confirmEPaymentmailorderCC.tpl b/indico/MaKaC/plugins/EPayment/mailorderCC/tpls/confirmEPaymentmailorderCC.tpl
    new file mode 100644
    index 0000000..23e8303
    - +  
     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">Subject</span></td> 
     12            <td bgcolor="white" width="100%" class="blacktext"><pre>PK-Nr ${ pknumber} ID ${ id }</pre></td> 
     13        </tr> 
     14        <tr> 
     15            <td align="center" colspan="2" bgcolor="white" style="padding-bottom:10px">${ trinfo }</td> 
     16        </tr> 
     17        <tr><t></td><td><a href=${ pdfurl } >Download mailorder form</a></td></tr> 
     18    </table> 
  • new file indico/MaKaC/plugins/EPayment/mailorderCC/tpls/confirmEPaymentmailorderCCInvoice.tpl

    diff --git a/indico/MaKaC/plugins/EPayment/mailorderCC/tpls/confirmEPaymentmailorderCCInvoice.tpl b/indico/MaKaC/plugins/EPayment/mailorderCC/tpls/confirmEPaymentmailorderCCInvoice.tpl
    new file mode 100644
    index 0000000..aab3d6c
    - +  
     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">Subject</span></td> 
     12            <td bgcolor="white" width="100%" class="blacktext"><pre>PK-Nr ${ pknumber} ID ${ id }</pre></td> 
     13        </tr> 
     14        <tr> 
     15            <td align="center" colspan="2" bgcolor="white" style="padding-bottom:10px">${ trinfo }</td> 
     16        </tr> 
     17    </table> 
  • new file indico/MaKaC/plugins/EPayment/mailorderCC/webinterface/__init__.py

    diff --git a/indico/MaKaC/plugins/EPayment/mailorderCC/webinterface/__init__.py b/indico/MaKaC/plugins/EPayment/mailorderCC/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/mailorderCC/webinterface/pages/__init__.py

    diff --git a/indico/MaKaC/plugins/EPayment/mailorderCC/webinterface/pages/__init__.py b/indico/MaKaC/plugins/EPayment/mailorderCC/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/mailorderCC/webinterface/pages/ePayments.py

    diff --git a/indico/MaKaC/plugins/EPayment/mailorderCC/webinterface/pages/ePayments.py b/indico/MaKaC/plugins/EPayment/mailorderCC/webinterface/pages/ePayments.py
    new file mode 100644
    index 0000000..adc0e99
    - +  
     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.mailorderCC import MODULE_ID 
     32from MaKaC.plugins.EPayment.mailorderCC.webinterface.wcomponents import WTemplated 
     33from MaKaC.plugins.EPayment.mailorderCC.webinterface import urlHandlers as localUrlHandlers 
     34 
     35 
     36 
     37class WPConfModifEPaymentmailorderCCBase(registrationForm.WPConfModifRegFormBase): 
     38 
     39    def _createTabCtrl(self): 
     40        self._tabCtrl = wcomponents.TabControl() 
     41        self._tabMain = self._tabCtrl.newTab("main", _("Main"), \ 
     42                localUrlHandlers.UHConfModifEPaymentmailorderCC.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 WPConfModifEPaymentmailorderCC(WPConfModifEPaymentmailorderCCBase): 
     64 
     65    def _getTabContent(self, params): 
     66        wc = WConfModifEPaymentmailorderCC(self._conf) 
     67        p = { 
     68             'dataModificationURL': quoteattr(str(localUrlHandlers.UHConfModifEPaymentmailorderCCDataModif.getURL(self._conf))) 
     69            } 
     70        return wc.getHTML(p) 
     71 
     72class WConfModifEPaymentmailorderCC(WTemplated): 
     73 
     74    def __init__(self, conference): 
     75        self._conf = conference 
     76 
     77    def getVars(self): 
     78        vars = WTemplated.getVars(self) 
     79        modmailorderCC = self._conf.getModPay().getPayModByTag(MODULE_ID) 
     80        vars["title"] = modmailorderCC.getTitle() 
     81        vars["accountOwner"] = modmailorderCC.getAccountOwner() 
     82        vars["pknumber"] = modmailorderCC.getPKNumber() 
     83        vars["faxreceiver"] = modmailorderCC.getFaxReceiver() 
     84        vars["mailreceiver"] = modmailorderCC.getMailReceiver() 
     85        return vars 
     86 
     87class WPConfModifEPaymentmailorderCCDataModif(WPConfModifEPaymentmailorderCCBase): 
     88 
     89    def _getTabContent(self, params): 
     90        wc = WConfModifEPaymentmailorderCCDataModif(self._conf) 
     91        p = {'postURL': quoteattr(str(localUrlHandlers.UHConfModifEPaymentmailorderCCPerformDataModif.getURL(self._conf))) 
     92            } 
     93        return wc.getHTML(p) 
     94 
     95class WConfModifEPaymentmailorderCCDataModif(WTemplated): 
     96 
     97    def __init__(self, conference): 
     98        self._conf = conference 
     99 
     100    def getVars(self): 
     101        vars = WTemplated.getVars(self) 
     102        modmailorderCC = self._conf.getModPay().getPayModByTag(MODULE_ID) 
     103        vars["title"] = modmailorderCC.getTitle() 
     104        vars["accountOwner"] = modmailorderCC.getAccountOwner() 
     105        vars["pknumber"] = modmailorderCC.getPKNumber() 
     106        vars["faxreceiver"] = modmailorderCC.getFaxReceiver() 
     107        vars["mailreceiver"] = modmailorderCC.getMailReceiver() 
     108        return vars 
     109 
     110class WPconfirmEPaymentmailorderCC(conferences.WPConferenceDefaultDisplayBase): 
     111    #navigationEntry = navigation.NERegistrationFormDisplay 
     112 
     113    def __init__(self, rh, conf, reg): 
     114        conferences.WPConferenceDefaultDisplayBase.__init__(self, rh, conf) 
     115        self._registrant = reg 
     116 
     117 
     118    def _getBody(self, params): 
     119        wc = WconfirmEPaymentmailorderCC(self._conf, self._registrant) 
     120        return wc.getHTML() 
     121 
     122    def _defineSectionMenu(self): 
     123        conferences.WPConferenceDefaultDisplayBase._defineSectionMenu(self) 
     124        self._sectionMenu.setCurrentItem(self._regFormOpt) 
     125 
     126 
     127class WconfirmEPaymentmailorderCC(WTemplated): 
     128    def __init__(self, configuration, registrant): 
     129        self._registrant = registrant 
     130        self._conf = configuration 
     131 
     132    def getVars(self): 
     133        vars = WTemplated.getVars(self) 
     134        modmailorderCC = self._conf.getModPay().getPayModByTag(MODULE_ID) 
     135        vars["message"] = "Thank you for the payment!<br/> You have choosen payment by mailorderCC<br>"\ 
     136                          "Please see the information below for details." 
     137        vars["accountOwner"] = modmailorderCC.getAccountOwner() 
     138        vars["pknumber"] = modmailorderCC.getPKNumber() 
     139        vars["faxreceiver"] = modmailorderCC.getFaxReceiver() 
     140        vars["mailreceiver"] = modmailorderCC.getMailReceiver() 
     141        vars["id"] = self._registrant.getIdPay() 
     142        vars["trinfo"] = "%s:%s" % (self._registrant.getFirstName(), self._registrant.getSurName()) 
     143        vars['pdfurl'] = quoteattr(str(localUrlHandlers.UHPayMailorderCCDisplayPDF.getURL(self._registrant))) 
     144 
     145        return vars 
     146 
     147class WPCancelEPaymentmailorderCC(conferences.WPConferenceDefaultDisplayBase): 
     148    #navigationEntry = navigation.NERegistrationFormDisplay 
     149 
     150    def __init__(self, rh, conf, reg): 
     151        conferences.WPConferenceDefaultDisplayBase.__init__(self, rh, conf) 
     152        self._registrant = reg 
     153 
     154    def _getBody(self, params): 
     155        wc = WCancelEPaymentmailorderCC(self._conf, self._registrant) 
     156        return wc.getHTML() 
     157 
     158    def _defineSectionMenu(self): 
     159        conferences.WPConferenceDefaultDisplayBase._defineSectionMenu(self) 
     160        self._sectionMenu.setCurrentItem(self._regFormOpt) 
     161 
     162class WCancelEPaymentmailorderCC(WTemplated): 
     163    def __init__(self, conference, reg): 
     164        self._conf = conference 
     165        self._registrant = reg 
     166 
     167    def getVars(self): 
     168        vars = WTemplated.getVars(self) 
     169        vars["message"] = "You have cancelled your transaction.\nPlease check your email in order to complete your mailorderCC transaction." 
     170        vars["messagedetailPayment"] = "%s:%s" % (self._registrant.getFirstName(), self._registrant.getSurName()) 
     171        return vars 
  • new file indico/MaKaC/plugins/EPayment/mailorderCC/webinterface/rh/__init__.py

    diff --git a/indico/MaKaC/plugins/EPayment/mailorderCC/webinterface/rh/__init__.py b/indico/MaKaC/plugins/EPayment/mailorderCC/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/mailorderCC/webinterface/rh/ePaymentModif.py

    diff --git a/indico/MaKaC/plugins/EPayment/mailorderCC/webinterface/rh/ePaymentModif.py b/indico/MaKaC/plugins/EPayment/mailorderCC/webinterface/rh/ePaymentModif.py
    new file mode 100644
    index 0000000..9e62e8a
    - +  
     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 
     27from MaKaC.plugins.EPayment.mailorderCC.webinterface.pages import ePayments 
     28from MaKaC.plugins.EPayment.mailorderCC.webinterface import urlHandlers as localUrlHandlers 
     29from MaKaC.plugins.EPayment.mailorderCC import epayment as ePayment 
     30from MaKaC.plugins.EPayment.mailorderCC import MODULE_ID 
     31from MaKaC.webinterface.common.tools import cleanHTMLHeaderFilename 
     32 
     33 
     34class RHEPaymentmodifmailorderCC( RHEPaymentModifBase ): 
     35    _requestTag = "modifmailorderCC" 
     36 
     37    def _process( self ): 
     38        p = ePayments.WPConfModifEPaymentmailorderCC( self, self._conf ) 
     39        return p.display() 
     40 
     41class RHEPaymentmodifmailorderCCDataModif( RHEPaymentModifBase ): 
     42    _requestTag = "modifmailorderCCData" 
     43 
     44    def _process( self ): 
     45        p = ePayments.WPConfModifEPaymentmailorderCCDataModif( self, self._conf ) 
     46        return p.display() 
     47 
     48class RHEPaymentmodifmailorderCCPerformDataModif( RHEPaymentModifBase ): 
     49    _requestTag = "modifmailorderCCPerformDataModif" 
     50 
     51    def _checkParams( self, params ): 
     52        RHEPaymentModifBase._checkParams( self, params ) 
     53        self._params=params 
     54        self._cancel = params.has_key("cancel") 
     55 
     56    def _process( self ): 
     57        if not self._cancel: 
     58            ses = self._conf.getModPay().getPayModByTag(MODULE_ID) 
     59            ses.setValues(self._params) 
     60        self._redirect(localUrlHandlers.UHConfModifEPaymentmailorderCC.getURL(self._conf)) 
     61 
     62 
     63 
     64 
     65 
     66class RHEPaymentconfirmmailorderCC( 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.WPconfirmEPaymentmailorderCC( 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 = "%sMailorderCCForm.pdf"%self._target.getTitle() 
     93        pdf = ePayment.MailorderToPDF(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 RHEPaymentCancelmailorderCC( 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.WPCancelEPaymentmailorderCC( self,self._conf ,self._registrant) 
     116            return p.display() 
     117 
     118 
     119class RHEPaymentValideParammailorderCC( 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.TransactionmailorderCC(d) 
     151                self._registrant.setTransactionInfo(tr) 
     152                self._regForm.getNotification().sendEmailNewRegistrantConfirmPay(self._regForm,self._registrant ) 
     153 
     154 
     155 
  • new file indico/MaKaC/plugins/EPayment/mailorderCC/webinterface/urlHandlers.py

    diff --git a/indico/MaKaC/plugins/EPayment/mailorderCC/webinterface/urlHandlers.py b/indico/MaKaC/plugins/EPayment/mailorderCC/webinterface/urlHandlers.py
    new file mode 100644
    index 0000000..6b7aafd
    - +  
     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 mailorderCC 
     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",  mailorderCC.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 UHConfModifEPaymentmailorderCC( UHConfModifEPayment ): 
     51    _requestTag = "modifmailorderCC"   
     52class UHConfModifEPaymentmailorderCCDataModif( UHConfModifEPayment ): 
     53    _requestTag = "modifmailorderCCData"     
     54class UHConfModifEPaymentmailorderCCPerformDataModif( UHConfModifEPayment ): 
     55    _requestTag = "modifmailorderCCPerformDataModif"    
     56 
     57 
     58class UHPay(EPURLHandler): 
     59    _relativeURL = "payment.py" 
     60 
     61class UHPayConfirmmailorderCC( UHPay ): 
     62    _requestTag = "confirm"       
     63 
     64class UHPayCancelmailorderCC( UHPay ): 
     65    _requestTag = "cancel"         
     66 
     67class UHPayParamsmailorderCC( UHPay ): 
     68    _requestTag = "params"   
     69 
     70class UHPayMailorderCCDisplayPDF( UHPay ): 
     71    _requestTag = "pdf"   
  • new file indico/MaKaC/plugins/EPayment/mailorderCC/webinterface/wcomponents.py

    diff --git a/indico/MaKaC/plugins/EPayment/mailorderCC/webinterface/wcomponents.py b/indico/MaKaC/plugins/EPayment/mailorderCC/webinterface/wcomponents.py
    new file mode 100644
    index 0000000..02b84ca
    - +  
     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 mailorderCC 
     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(mailorderCC.__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/mailorderCC.py

    diff --git a/indico/htdocs/mailorderCC.py b/indico/htdocs/mailorderCC.py
    new file mode 100644
    index 0000000..e5f6eee
    - +  
     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.RHEPaymentConfirmmailorderCC( req ).process( params ) 
     24 
     25def cancel(req, **params): 
     26    return ePaymentModif.RHEPaymentCancelmailorderCC ( req ).process( params ) 
     27def pdf(req, **params): 
     28    return ePaymentModif.RHAbstractDisplayPDF( req ).process( params ) 
     29 
     30def getAttachedFile(req,**params): 
     31    return ePaymentModif.RHGetAttachedFile(req).process(params) 
     32 No newline at end of file 
  • setup.py

    diff --git a/setup.py b/setup.py
    index 71936b9..9292200 100644
    a b if __name__ == '__main__': 
    533533            EPayment.yellowPay = MaKaC.plugins.EPayment.yellowPay 
    534534            EPayment.skipjack = MaKaC.plugins.EPayment.skipjack 
    535535            EPayment.bankTransfer = MaKaC.plugins.EPayment.bankTransfer 
     536            EPayment.mailorderCC = MaKaC.plugins.EPayment.mailorderCC 
    536537 
    537538            importer.invenio = indico.ext.importer.invenio 
    538539            importer.dummy = indico.ext.importer.dummy