Changeset 8259


Ignore:
Timestamp:
23 Apr 2012, 14:06:39 (15 years ago)
Author:
Henrik Bettermann
Message:

Implement acceptance fee payments via Interswitch (part 2)

Location:
main/waeup.uniben/trunk/src/waeup/uniben
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.uniben/trunk/src/waeup/uniben/applicants/browser.py

    r8254 r8259  
    1919"""
    2020import grok
     21from zope.component import getUtility
     22from zope.i18n import translate
    2123from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget
     24from waeup.kofa.students.interfaces import IStudentsUtils
    2225from waeup.kofa.applicants.interfaces import (
    2326    IApplicantRegisterUpdate, IApplicant, IApplicantEdit)
    … …  
    2730    ApplicantRegistrationPage, ApplicantAddFormPage,
    2831    OnlinePaymentDisplayFormPage, AcceptanceFeePaymentAddPage,
    29     OnlinePaymentBreadcrumb)
    30 from waeup.kofa.applicants.viewlets import RequestCallbackActionButton
     32    OnlinePaymentBreadcrumb, ExportPDFPaymentSlipPage,
     33    ApplicantBaseDisplayFormPage)
     34from waeup.kofa.applicants.viewlets import (
     35    RequestCallbackActionButton, PaymentReceiptActionButton)
    3136from waeup.kofa.applicants.pdf import PDFApplicationSlip
    3237from waeup.uniben.applicants.interfaces import (
    … …  
    3641
    3742#class RequestCallbackActionButton(RequestCallbackActionButton):
    38 #    """ Do not display the base package callback button in custom pages.
     43#    """ Display the base package callback button in custom pages.
    3944#    """
    40 #    @property
    41 #    def target_url(self):
    42 #        return ''
     45#    grok.context(ICustomApplicantOnlinePayment)
    4346
    4447#class CustomOnlinePaymentCallbackPage(OnlinePaymentCallbackPage):
    45 #    """ Neutralize callback simulation view
     48#    """ Activate callback simulation view
    4649#    """
    47 #    def update(self):
    48 #        return
     50#    grok.context(ICustomApplicantOnlinePayment)
    4951
    5052class CustomOnlinePaymentBreadcrumb(OnlinePaymentBreadcrumb):
    5153    """A breadcrumb for payments.
    5254    """
     55    grok.context(ICustomApplicantOnlinePayment)
     56
     57class PaymentReceiptActionButton(PaymentReceiptActionButton):
     58    grok.order(4)
    5359    grok.context(ICustomApplicantOnlinePayment)
    5460
    … …  
    144150        payment.surcharge_3 = session_config.surcharge_3
    145151        return payment
     152
     153class CustomExportPDFPaymentSlipPage(ExportPDFPaymentSlipPage):
     154    """Deliver a PDF slip of the context.
     155    """
     156    grok.context(ICustomApplicantOnlinePayment)
     157    form_fields = grok.AutoFields(ICustomApplicantOnlinePayment)
     158    form_fields['creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
     159    form_fields['payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
     160
     161    @property
     162    def note(self):
     163        tcode = self.context.p_id
     164        tcode = tcode[len(tcode)-8:len(tcode)]
     165        amount = self.context.amount_auth
     166        note = translate(_(
     167            u"""<br /><br /><br />
     168The tranzaction code for eTranzact payments is <strong>${a}</strong>.""",
     169            mapping = {'a':tcode}))
     170        return note
  • main/waeup.uniben/trunk/src/waeup/uniben/etranzact/browser.py

    r8256 r8259  
    2929from waeup.uniben.students.interfaces import ICustomStudentOnlinePayment
    3030from waeup.uniben.applicants.interfaces import ICustomApplicantOnlinePayment
     31
    3132
    3233TERMINAL_ID = '0500000003'
    … …  
    101102class EtranzactEnterPinActionButtonApplicant(RCABApplicant):
    102103    grok.context(ICustomApplicantOnlinePayment)
     104    grok.order(3)
    103105    icon = 'actionicon_call.png'
    104106    text = _('Query eTranzact History')
    … …  
    107109class EtranzactEnterPinActionButtonStudent(RCABStudent):
    108110    grok.context(ICustomStudentOnlinePayment)
     111    grok.order(3)
    109112    icon = 'actionicon_call.png'
    110113    text = _('Query eTranzact History')
  • main/waeup.uniben/trunk/src/waeup/uniben/interswitch/browser.py

    r8256 r8259  
    2828from waeup.kofa.students.viewlets import RequestCallbackActionButton as RCABStudent
    2929from waeup.kofa.applicants.viewlets import RequestCallbackActionButton as RCABApplicant
     30from waeup.kofa.payments.interfaces import payment_categories
    3031from waeup.uniben.students.utils import actions_after_student_payment
    3132from waeup.uniben.applicants.utils import actions_after_applicant_payment
    … …  
    3435#    Interswitch test account data:
    3536#
    36 #    Card Number: 6274807700000007
    37 #    Expiry Date: July 2012
    38 #    PIN: 0000
    39 
    40 #    Card Number: 6278050000000007
    41 #    Expiry Date: July 2012
    42 #    PIN: 0000
     37#   Card Number: 6274807700000007
     38#   Expiry Date: July 2012
     39#   PIN: 0000
     40
     41#   Card Number: 6278050000000007
     42#   Expiry Date: July 2012
     43#   PIN: 0000
     44#
     45#   PAN,EXPIRY,PIN,CVV2
     46#   5060990330000003386,1304,0000,543
     47#   5060990330000003394,1304,0000,865
     48#   5060990330000003402,1304,0000,012
     49#   5060990330000003410,1304,0000,737
     50#   5060990330000003428,1304,0000,310
     51#   5060990330000003436,1304,0000,173
    4352
    4453PRODUCT_ID = '57'
    … …  
    160169
    161170class InterswitchActionButtonStudent(RCABStudent):
    162     grok.order(2)
     171    grok.order(1)
    163172    grok.context(ICustomStudentOnlinePayment)
    164173    icon = 'actionicon_pay.png'
    … …  
    173182
    174183class InterswitchActionButtonApplicant(RCABApplicant):
    175     grok.order(2)
     184    grok.order(1)
    176185    grok.context(ICustomApplicantOnlinePayment)
    177186    icon = 'actionicon_pay.png'
    … …  
    186195
    187196# Deprecated
    188 class InterswitchRequestCallbackActionButtonStudent(RCABStudent):
    189     grok.order(3)
     197#class InterswitchRequestCallbackActionButtonStudent(RCABStudent):
     198#    grok.order(3)
     199#    grok.context(ICustomStudentOnlinePayment)
     200#    icon = 'actionicon_call.png'
     201#    text = _('Request CollegePAY callback')
     202
     203#    def target_url(self):
     204#        if self.context.p_state == 'paid':
     205#            return ''
     206#        site_redirect_url = self.view.url(self.view.context, 'isw_callback')
     207#        args = {
     208#            'transRef':self.context.p_id,
     209#            'prodID':PRODUCT_ID,
     210#            'redirectURL':site_redirect_url}
     211#        return QUERY_URL + '?%s' % urllib.urlencode(args)
     212
     213# Alternative preferred solution
     214class InterswitchRequestWebserviceActionButtonStudent(RCABStudent):
     215    grok.order(2)
    190216    grok.context(ICustomStudentOnlinePayment)
    191217    icon = 'actionicon_call.png'
    192     text = _('Request CollegePAY callback')
    193 
    194     def target_url(self):
    195         if self.context.p_state == 'paid':
    196             return ''
    197         site_redirect_url = self.view.url(self.view.context, 'isw_callback')
    198         args = {
    199             'transRef':self.context.p_id,
    200             'prodID':PRODUCT_ID,
    201             'redirectURL':site_redirect_url}
    202         return QUERY_URL + '?%s' % urllib.urlencode(args)
    203 
    204 # Alternative preferred solution
    205 class InterswitchRequestWebserviceActionButtonStudent(RCABStudent):
    206     grok.order(4)
    207     grok.context(ICustomStudentOnlinePayment)
    208     icon = 'actionicon_call.png'
    209     text = _('Request CollegePAY webservice')
     218    text = _('Request CollegePAY Webservice')
    210219    target = 'request_webservice'
    211220
    212221class InterswitchRequestWebserviceActionButtonApplicant(RCABApplicant):
    213     grok.order(4)
     222    grok.order(2)
    214223    grok.context(ICustomApplicantOnlinePayment)
    215224    icon = 'actionicon_call.png'
    216     text = _('Request CollegePAY webservice')
     225    text = _('Request CollegePAY Webservice')
    217226    target = 'request_webservice'
    218227
    … …  
    252261        self.amount = (self.context.amount_auth + self.context.surcharge_1 +
    253262            self.context.surcharge_2 + self.context.surcharge_3)
     263        self.category = payment_categories.getTermByToken(
     264            self.context.p_category).title
    254265        self.amount_100 = 100 * self.amount
    255266        self.local_date_time = str(self.context.creation_date)
    … …  
    267278
    268279    def update(self):
    269         if self.context.p_state != 'unpaid':
    270             self.flash(_("Payment ticket can't be re-send to CollegePAY."))
    271             self.redirect(self.url(self.context, '@@index'))
    272             return
     280        #if self.context.p_state != 'unpaid':
     281        #    self.flash(_("Payment ticket can't be re-send to CollegePAY."))
     282        #    self.redirect(self.url(self.context, '@@index'))
     283        #    return
    273284        self.applicant = self.context.__parent__
    274285        xmldict = {}
    275286        xmldict['department'] = None
    276287        xmldict['faculty'] = None
     288        self.category = payment_categories.getTermByToken(
     289            self.context.p_category).title
    277290        self.amount = (self.context.amount_auth + self.context.surcharge_1 +
    278291            self.context.surcharge_2 + self.context.surcharge_3)
  • main/waeup.uniben/trunk/src/waeup/uniben/interswitch/browser_templates/applicant_goto_interswitch.pt

    r8256 r8259  
    5050          Payment Category:</td>
    5151        <td>
    52           <span tal:replace="view/context/p_category">PAYMENTCATEGORY</span>
     52          <span tal:replace="view/category">PAYMENTCATEGORY</span>
    5353        </td>
    5454      </tr>
    … …  
    6363  <input type="hidden" name="local_date_time" tal:attributes="value view/local_date_time" />
    6464  <input type="hidden" name="amount" tal:attributes="value view/amount_100" />
    65 
    6665  <input type="hidden" name="txn_ref" tal:attributes="value view/context/p_id" />
    67   <input type="hidden" name="cust_id_desc" tal:attributes="value view/context/p_item" />
    68   <input type="hidden" name="pay_item_name" tal:attributes="value view/context/p_category" />
    69 
     66  <input type="hidden" name="pay_item_name" tal:attributes="value view/context/p_item" />
     67  <input type="hidden" name="cust_id_desc" tal:attributes="value view/category" />
    7068  <input type="hidden" name="cust_id" tal:attributes="value view/applicant/applicant_id" />
    7169  <input type="hidden" name="cust_name" tal:attributes="value view/applicant/display_fullname" />
    72 
    7370
    7471  <input type="hidden" name="payment_params" value="college_split" />
  • main/waeup.uniben/trunk/src/waeup/uniben/interswitch/browser_templates/student_goto_interswitch.pt

    r8256 r8259  
    5050          Payment Category:</td>
    5151        <td>
    52           <span tal:replace="view/context/p_category">PAYMENTCATEGORY</span>
     52          <span tal:replace="view/category">PAYMENTCATEGORY</span>
    5353        </td>
    5454      </tr>
    … …  
    6363  <input type="hidden" name="local_date_time" tal:attributes="value view/local_date_time" />
    6464  <input type="hidden" name="amount" tal:attributes="value view/amount_100" />
    65 
    6665  <input type="hidden" name="txn_ref" tal:attributes="value view/context/p_id" />
    67   <input type="hidden" name="cust_id_desc" tal:attributes="value view/context/p_item" />
    68   <input type="hidden" name="pay_item_name" tal:attributes="value view/context/p_category" />
    69 
     66  <input type="hidden" name="pay_item_name" tal:attributes="value view/context/p_item" />
     67  <input type="hidden" name="cust_id_desc" tal:attributes="value view/category" />
    7068  <input type="hidden" name="cust_id" tal:attributes="value view/student/student_id" />
    7169  <input type="hidden" name="cust_name" tal:attributes="value view/student/display_fullname" />
    72 
    7370
    7471  <input type="hidden" name="payment_params" value="college_split" />
  • main/waeup.uniben/trunk/src/waeup/uniben/students/browser.py

    r8247 r8259  
    1919from zope.formlib.textwidgets import BytesDisplayWidget
    2020from zope.component import getUtility
     21from zope.i18n import translate
    2122from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget
    2223from waeup.kofa.interfaces import IExtFileStore
    … …  
    2930    StudentBaseEditFormPage, StudentPersonalEditFormPage,
    3031    OnlinePaymentDisplayFormPage, OnlinePaymentAddFormPage,
    31     OnlinePaymentBreadcrumb)
    32 from waeup.kofa.students.viewlets import RequestCallbackActionButton
     32    OnlinePaymentBreadcrumb, ExportPDFPaymentSlipPage)
     33from waeup.kofa.students.viewlets import (
     34    RequestCallbackActionButton, PaymentReceiptActionButton)
    3335from waeup.uniben.students.interfaces import (
    3436    ICustomStudentBase, ICustomStudent, ICustomStudentPersonal,
    … …  
    3840from waeup.uniben.interfaces import MessageFactory as _
    3941
     42#class RequestCallbackActionButton(RequestCallbackActionButton):
     43#    """ Display the base package callback button in custom pages.
     44#    """
     45#    grok.context(ICustomStudentOnlinePayment)
     46
     47#class CustomOnlinePaymentCallbackPage(OnlinePaymentCallbackPage):
     48#    """ Activate callback simulation view
     49#    """
     50#    grok.context(ICustomStudentOnlinePayment)
     51
    4052class CustomOnlinePaymentBreadcrumb(OnlinePaymentBreadcrumb):
    4153    """A breadcrumb for payments.
    … …  
    4355    grok.context(ICustomStudentOnlinePayment)
    4456
    45 class RequestCallbackActionButton(RequestCallbackActionButton):
    46     """ Do not display the base package callback button in custom pages.
    47     """
    48     @property
    49     def target_url(self):
    50         return ''
    51 
    52 class CustomOnlinePaymentCallbackPage(OnlinePaymentCallbackPage):
    53     """ Neutralize callback simulation view
    54     """
    55     def update(self):
    56         return
     57class PaymentReceiptActionButton(PaymentReceiptActionButton):
     58    grok.order(4)
     59    grok.context(ICustomStudentOnlinePayment)
    5760
    5861class CustomStudentBaseManageFormPage(StudentBaseManageFormPage):
    … …  
    182185        payment.surcharge_3 = pay_details['surcharge_3']
    183186        return payment
     187
     188class CustomExportPDFPaymentSlipPage(ExportPDFPaymentSlipPage):
     189    """Deliver a PDF slip of the context.
     190    """
     191    grok.context(ICustomStudentOnlinePayment)
     192    form_fields = grok.AutoFields(ICustomStudentOnlinePayment)
     193    form_fields['creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
     194    form_fields['payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
     195
     196    @property
     197    def note(self):
     198        tcode = self.context.p_id
     199        tcode = tcode[len(tcode)-8:len(tcode)]
     200        amount = self.context.amount_auth
     201        note = translate(_(
     202            u"""<br /><br /><br />
     203The tranzaction code for eTranzact payments is <strong>${a}</strong>.""",
     204            mapping = {'a':tcode}))
     205        return note
Note: See TracChangeset for help on using the changeset viewer.