Changeset 2891


Ignore:
Timestamp:
9 Dec 2007, 11:03:55 (17 years ago)
Author:
Henrik Bettermann
Message:

make maintenance payment work

rename fields target and subject

Location:
WAeUP_SRP
Files:
1 added
1 deleted
15 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/Payment.py

    r2874 r2891  
    4343            d['key'] = payment.getId()
    4444            d['amount'] = doc.amount
    45             d['description'] = d['type_description'] = doc.type_description
     45            d['type_description'] = doc.type_description
    4646            subject = ''
    4747            if doc.type_description.startswith('School'):
     
    5555                    p_status = "paid"
    5656                    break
    57                 if doc.resp_code in ("00","IP"):
     57                if doc.resp_code in ("00","IP","AP"):
    5858                    p_type = "online"
    5959                    p_status = "paid"
     
    6464            d['key'] = payment.getId()
    6565            d['type'] = p_type  # scratch card
    66             d['target'] = student_record.course
     66            d['item'] = student_record.course
    6767            d['status'] = p_status
    6868            d['resp_approved_amount'] = getattr(doc,'resp_approved_amount',None)
     
    7373            d['resp_card_num'] = doc.resp_card_num
    7474            d['date'] = getattr(doc,'date',None)
    75             d['resp_date'] = getattr(doc,'resp_date',None)
     75            #d['resp_date'] = getattr(doc,'resp_date',None)
    7676            # msg = " ".join(["%s: %s" % (key,value) for key,value in d.items()])
    7777            # logger.info(msg)
    78            
     78
    7979            review_state = wftool.getInfoFor(payment,'review_state',None)
    8080            if review_state == "closed":
  • WAeUP_SRP/base/skins/waeup_epayment/interswitch_acco_cb.py

    r2857 r2891  
    5353for rc,pdk in resp_codes:
    5454    pd[pdk] = request.get(rc,'')
     55   
     56   
     57## for testing purposes
     58pd['resp_desc'] = 'Simulated Callback'
     59pd['resp_pay_reference'] = 'XXXX'
     60pd['resp_code'] = '00'
     61pd['resp_card_num'] = '0000'
     62pd['resp_approved_amount'] = '10000'   
    5563
    5664if pd['resp_code'] == '00' and len(pd['resp_approved_amount']) > 4:
    5765    pd['resp_approved_amount'] = pd['resp_approved_amount'][:-2]
     66    pd['status'] = 'paid'
    5867else:
    5968    pd['resp_approved_amount'] = '0'
     69    pd['status'] = 'failed'   
    6070
    6171review_state = wftool.getInfoFor(context,'review_state',None)
     
    8696    else:
    8797        logger.info('%s received unsuccessfull callback: %s' % (student_id,pd['resp_desc']))
     98
     99    try:
     100        wftool.doActionFor(context,'close')
     101    except:
     102        logger.info('%s no workflow action close' % student_id)       
    88103    try:
    89104        wftool.doActionFor(acco_info['acco'],'pay_maintenance_fee',dest_container=acco_info['acco'])
     
    92107        logger.info('%s no workflow action pay_maintainance_fee' % student_id)
    93108        return request.RESPONSE.redirect("%s/waeup_document_view" % context.absolute_url())
    94    
    95 else:       
     109 
     110
     111else:
    96112    next_info = context.getNextInfo(s_brain)
    97113    next_session_id = next_info['next_session_id']
     
    101117    next_verdict = next_info['next_verdict']
    102118    next_previous_verdict = next_info['next_previous_verdict']
    103    
     119
    104120    if  resp == '00':
    105121        if context.getStudentReviewState() == "school_fee_paid":
     
    121137            if next_transition:
    122138                wftool.doActionFor(student,next_transition)
    123    
     139
    124140        logger.info('%s received valid callback' % student_id)
    125141        referer = request.get('HTTP_REFERER','none')
     
    133149    except:
    134150        logger.info('%s no workflow action close' % student_id)
    135    
    136151
     152
  • WAeUP_SRP/base/skins/waeup_epayment/pay_by_sc.py

    r2881 r2891  
    106106    info['status'] = 'paid'
    107107    info['session_id'] = student_record.session
    108     info['target'] = student_record.course
    109     info['subject'] = 'schoolfee'
     108    info['item'] = student_record.course
     109    info['category'] = 'schoolfee'
    110110    info['resp_code'] = "SC"
    111111    info['resp_desc'] = "SC Payment Successful"
  • WAeUP_SRP/base/skins/waeup_epayment/pay_interswitch_acco.py

    r2877 r2891  
    1919from urllib import urlencode
    2020import logging
    21 logger = logging.getLogger('Skins.pay_interswitch')
     21logger = logging.getLogger('Skins.pay_interswitch_acco')
    2222import DateTime
    2323
     
    7575info['student_id'] = student_id
    7676info['student_name'] = student_record.name
     77info['session_id'] = student_record.session
    7778info['student_email'] = student_record.email
    7879info['date'] = now
     
    105106                                                      payment_id)
    106107
    107 logger.info('%(student_id)s initiated %(description)s payment with order_id %(order_id)s and callback url %(callback_url)s' % info)
     108logger.info('%(student_id)s initiated %(type_description)s payment with order_id %(order_id)s and callback url %(callback_url)s' % info)
    108109payment_fields = (('product_id','site_id'),
    109110                  ('site_name','site_name'),
  • WAeUP_SRP/base/skins/waeup_epayment/payment_receipt.pt

    r2885 r2891  
    2020        </tr>       
    2121        <tr>
    22           <td>JAMB Registration Number:</td>
     22          <td>Registration Number:</td>
    2323          <td tal:content="student/jamb_reg_no" />
    2424        </tr>           
  • WAeUP_SRP/base/skins/waeup_epayment/simulate_callback.py

    r2857 r2891  
    1313current = DateTime.DateTime()
    1414pr = context.portal_registration
    15 logger = logging.getLogger('EPayment.Simulate')
     15logger = logging.getLogger('Skins.simulate_callback')
    1616
    1717args = {}
     
    2424#set_trace()
    2525#url = "%s" % (context.absolute_url())
    26 raw_url = REQUEST.get("site_redirect_url") 
     26raw_url = REQUEST.get("site_redirect_url")
    2727url = "%s&%s" % (raw_url,urlencode(args))
    2828return REQUEST.RESPONSE.redirect(url)
  • WAeUP_SRP/base/skins/waeup_layout/layout_student_acco_edit.pt

    r2243 r2891  
    1616  apply request/apply_button|nothing;
    1717  widgets python:context.getRenderedWidgets(layout);
     18  info python: context.getAccommodationInfo();
     19  maintenance_online info/online_payment|nothing;
     20 
     21 
     22 
     23 
    1824  ">
    1925  <form action="" id="editForm" method="post"
     
    4450                     tal:attributes="for cell/widget_input_area_id|nothing;">label</label>:
    4551            </div>
    46             <button type="button" class="tooltipControl"
    47                     tal:condition="widget/help"
    48                     tal:attributes="onclick python:'toggleElementVisibility(\'%s\')' % tooltip_id;"> ? </button>
    4952            </td>
    5053            <td>
     
    5255              <div tal:replace="structure cell/widget_rendered"/>
    5356            </span>
    54             <div class="tooltipArea" style="visibility: hidden;"
    55                  tal:condition="widget/help"
    56                  tal:attributes="id tooltip_id;
    57                  onclick python:'showElement(false, \'%s\')' % tooltip_id;"
    58                  >
    59               <tal:block tal:content="widget/help">This is the help for this field
    60               </tal:block>
    61             </div>
    62             <tal:block condition="err">
    63               <tal:block define="msg python:cpsmcat(err, mapping=err_mapping)">
    64                 <br /><em style="color: red"
    65                           tal:content="msg">err</em>
    66               </tal:block>
    67             </tal:block>
    6857            </td>
    6958          </div>
     
    9180                     tal:attributes="for cell/widget_input_area_id|nothing;">label</label>:
    9281            </div>
    93             <button type="button" class="tooltipControl"
    94                     tal:condition="widget/help"
    95                     tal:attributes="onclick python:'toggleElementVisibility(\'%s\')' % tooltip_id;"> ? </button>
    9682          </td>
    9783          <td>
     
    9985              <div tal:replace="structure cell/widget_rendered"/>
    10086            </span>
    101             <div class="tooltipArea" style="visibility: hidden;"
    102                  tal:condition="widget/help"
    103                  tal:attributes="id tooltip_id;
    104                  onclick python:'showElement(false, \'%s\')' % tooltip_id;"
    105                  >
    106               <tal:block tal:content="widget/help">This is the help for this field
    107               </tal:block>
    108             </div>
    109             <tal:block condition="err">
    110               <tal:block define="msg python:cpsmcat(err, mapping=err_mapping)">
    111                 <br /><em style="color: red"
    112                           tal:content="msg">err</em>
    113               </tal:block>
    114             </tal:block>
    11587          </td>
    11688        </div>
     
    12294         value="Save"
    12395         id="cpsdocument_edit_button"
    124          tal:condition="not:creation" />
    125   <input type="submit" class="standalone" name="apply_admission"
    126          value="apply for admission"
    127          id="cpsdocument_edit_and_view_button"
    128          tal:condition="apply"
    129          tal:attributes="value apply"/>
    130   <input type="submit"
    131          class="standalone"
    132          name="cpsdocument_create_button"
    133          value="apply"
    134          tal:attributes="value options/button"
    135          tal:condition="creation" />
     96         tal:condition="python:not creation and not maintenance_online" />
    13697
    13798</form>
  • WAeUP_SRP/base/skins/waeup_student/accommodation_edit_form.pt

    r2889 r2891  
    33                   data_storage options/ds|nothing;
    44                   mode options/mode;
    5                    edition python:1;"
     5                   edition python:1;
     6                   info python: context.getAccommodationInfo();
     7                   maintenance_online info/online_payment|nothing"
    68                   >
    79<metal:block define-macro="edit_form">
     
    2729        <br />
    2830        <div tal:replace="structure rendered_main" />
    29           <p>Instructions :</p>
    30         <ul tal:condition="python: mode == 'create'">
    31             <li>Buy a Hostel Application Scratch Card.</li>
     31       
     32        <p tal:condition="not: maintenance_online">Instructions :</p>
     33       
     34        <ul tal:condition="python: mode == 'create' and not maintenance_online">
     35                  <li>Buy a Hostel Application Scratch Card.</li>
    3236            <li>Enter the PIN above and press 'Book'.</li>
    3337            <li>Print your Hostel Allocation Slip.</li>
    34           </ul>
    35         <tal:block condition="python: mode == 'edit'"
    36                    tal:define="info python: context.getAccommodationInfo();
    37                    maintenance_online info/online_payment|nothing"
    38                    >
    39           <ul tal:condition="not: maintenance_online" tal:omit-tag="">
    40             <li>Buy a Hostel Maintainance Scratch Card
    41               (Code: <span tal:replace="python: info['acco_doc'].acco_maint_code" />) for
    42               <span tal:replace="python: info['acco_doc'].acco_maint_fee" /> Nairas</li>
    43             <li>Enter the PIN above and press 'Save'.</li>
    44             <li>Print your Hostel Maintenance Receipt.</li>
    45           </ul>
     38        </ul>
     39 
     40        <tal:block condition="python: mode == 'edit'" >
     41 
     42           <ul tal:condition="not: maintenance_online" tal:omit-tag="">
     43             <li>Buy a Hostel Maintainance Scratch Card
     44               (Code: <span tal:replace="python: info['acco_doc'].acco_maint_code" />) for
     45               <span tal:replace="python: info['acco_doc'].acco_maint_fee" /> Nairas</li>
     46             <li>Enter the PIN above and press 'Save'.</li>
     47             <li>Print your Hostel Maintenance Receipt.</li>
     48           </ul>
     49         
     50       
    4651          <tal:block condition="maintenance_online">
    4752            <table tal:condition="not: info/maintenance_paid">
  • WAeUP_SRP/fceokene/profiles/default/layouts/payment.xml

    r2877 r2891  
    128128  <property name="vocabulary">payment_status</property>
    129129 </widget>
    130  <widget name="subject" meta_type="Select Widget">
    131   <property name="title">Payment Subject</property>
    132   <property name="fields">
    133    <element value="subject"/>
    134   </property>
    135   <property name="is_required">False</property>
    136   <property name="label">Payment Subject</property>
    137   <property name="label_edit">Payment Subject</property>
    138   <property name="readonly_layout_modes"/>
    139   <property name="hidden_layout_modes"/>
    140   <property name="hidden_readonly_layout_modes"/>
    141   <property name="vocabulary">payment_subjects</property>
    142  </widget>
    143  <widget name="target" meta_type="String Widget">
    144   <property name="title">Payment Target</property>
    145   <property name="fields">
    146    <element value="target"/>
    147   </property>
    148   <property name="is_required">False</property>
    149   <property name="label">Payment for</property>
    150   <property name="label_edit">Payment for</property>
     130 <widget name="category" meta_type="Select Widget">
     131  <property name="title">Payment Category</property>
     132  <property name="fields">
     133   <element value="category"/>
     134  </property>
     135  <property name="is_required">False</property>
     136  <property name="label">Payment Category</property>
     137  <property name="label_edit">Payment Category</property>
     138  <property name="readonly_layout_modes"/>
     139  <property name="hidden_layout_modes"/>
     140  <property name="hidden_readonly_layout_modes"/>
     141  <property name="vocabulary">payment_categories</property>
     142 </widget>
     143 <widget name="item" meta_type="String Widget">
     144  <property name="title">Payment Item</property>
     145  <property name="fields">
     146   <element value="item"/>
     147  </property>
     148  <property name="is_required">False</property>
     149  <property name="label">Payment Item</property>
     150  <property name="label_edit">Payment Item</property>
    151151  <property name="readonly_layout_modes"/>
    152152  <property name="hidden_layout_modes"/>
  • WAeUP_SRP/fceokene/profiles/default/payments_catalog.xml

    r2863 r2891  
    1414 <column value="status"/>
    1515 <column value="student_id"/>
    16  <column value="subject"/>
     16 <column value="category"/>
    1717 <column value="surcharge"/>
    1818 <column value="type"/>
    19  <column value="target"/>
     19 <column value="item"/>
    2020 <index name="key" meta_type="FieldIndex">
    2121  <indexed_attr value="key"/>
     
    3535 <index name="resp_desc" meta_type="KeywordIndex">
    3636  <indexed_attr value="resp_desc"/>
    37  </index> 
     37 </index>
    3838 <index name="session_id" meta_type="FieldIndex">
    3939  <indexed_attr value="session_id"/>
     
    4141  <index name="status" meta_type="FieldIndex">
    4242    <indexed_attr value="status"/>
    43  </index> 
     43 </index>
    4444 <index name="student_id" meta_type="FieldIndex">
    4545  <indexed_attr value="student_id"/>
    4646 </index>
    47  <index name="subject" meta_type="KeywordIndex">
    48   <indexed_attr value="subject"/>
     47 <index name="category" meta_type="FieldIndex">
     48  <indexed_attr value="category"/>
    4949 </index>
    50  <index name="target" meta_type="FieldIndex">
    51   <indexed_attr value="target"/>
     50 <index name="item" meta_type="FieldIndex">
     51  <indexed_attr value="item"/>
    5252 </index>
    53  <index name="type" meta_type="KeywordIndex">
     53 <index name="type" meta_type="FieldIndex">
    5454  <indexed_attr value="type"/>
    5555 </index>
  • WAeUP_SRP/fceokene/profiles/default/schemas/payment.xml

    r2877 r2891  
    88  <field name="amount" meta_type="CPS String Field"/>
    99  <field name="surcharge" meta_type="CPS String Field"/>
    10   <field name="subject" meta_type="CPS String Field"/>
     10  <field name="item" meta_type="CPS String Field"/>
    1111  <field name="type" meta_type="CPS String Field"/>
    12   <field name="target" meta_type="CPS String Field"/>
     12  <field name="category" meta_type="CPS String Field"/>
    1313  <field name="status" meta_type="CPS String Field"/>
    1414  <field name="resp_pay_reference" meta_type="CPS String Field"/>
  • WAeUP_SRP/fceokene/profiles/default/vocabularies.xml

    r2813 r2891  
    3131 <object name="payment_types" meta_type="CPS Vocabulary"/>
    3232 <object name="payment_status" meta_type="CPS Vocabulary"/>
    33  <object name="payment_subjects" meta_type="CPS Vocabulary"/>
     33 <object name="payment_categories" meta_type="CPS Vocabulary"/>
    3434 <object name="exam_types" meta_type="CPS Vocabulary"/>
    3535 <object name="pin_prefixes" meta_type="CPS Vocabulary"/>
     
    4949 <object name="screening_types" meta_type="CPS Vocabulary"/>
    5050 <object name="aos" meta_type="CPS Vocabulary"/>
    51  <object name="application_status" meta_type="CPS Vocabulary"/> 
     51 <object name="application_status" meta_type="CPS Vocabulary"/>
    5252 </object>
  • WAeUP_SRP/fceokene/waeup_custom/getInterswitchParams.py

    r2857 r2891  
    1010# $Id$
    1111
    12 test = "simulate"
     12test = ""
    1313d = {}
    14 d['payment_possible'] = True 
     14d['payment_possible'] = True
    1515d['pay_ship_to'] = "Federal College Okene"
    1616
     
    1818d['site_name'] = "fceokene.waeup.org"
    1919d['currency_id'] = '566'
    20 d['type'] = 'online' 
    21 d['status'] = 'started' 
     20d['type'] = 'online'
     21d['status'] = 'started'
    2222d['surcharge'] = '150'
    2323d['payment_params'] = 'switch_college_split'
    2424if test == 'simulate':
    25     d['action'] = "%s/payments/%s/simulate_callback" % (student.absolute_url(),payment_id)
     25    d['action'] = "%s/payments/%s/simulate_callback" % (student.absolute_url(),payment_id) #do not use simulate_callback
    2626elif test == 'test':
    27     d['action'] = "https://webpay.interswitchng.com/testpaydirect/webpay/pay.aspx"
     27    d['action'] = "https://webpay.interswitchng.com/test_paydirect/webpay/pay.aspx"
    2828else:
    2929    d['action'] = "https://webpay.interswitchng.com/paydirect/webpay/pay.aspx"
    3030if paytype in ("HOM",):
    3131    d['callback_function'] = 'interswitch_acco_cb'
    32     d['pay_item_id'] = '8302' 
    33     d['description'] = d['type_description'] = 'Hostel Maintenance Fee'
    34     d['pay_item_name'] = "FCE Okene %(description)s" % d
    35     d['amount'] = '4000' 
    36     d['subject'] = 'hostel_maintenance'
    37     d['target'] = paytype
     32    d['pay_item_id'] = '8302'
     33    d['type_description'] = 'Hostel Maintenance Fee'
     34    d['pay_item_name'] = "FCE Okene %(type_description)s" % d
     35    d['amount'] = '4000'
     36    d['category'] = 'hostel_maintenance'
     37    d['item'] = paytype
    3838
    3939return d
  • WAeUP_SRP/fceokene/waeup_custom/getPaymentsFolderInfo.py

    r2890 r2891  
    4343#student = getattr(students,student_id)
    4444student_record = context.students_catalog.getRecordByKey(student_id)
    45 context['updatePayments']()
     45#context['updatePayments']()
    4646payments = []
    4747
     
    9898                                  hasattr(so_doc, 'order_id') and not so_doc.resp_code) or str(member) in ('admin','gbenga','isouaba'):
    9999            row['is_requeryable'] = True
    100             row['callback_url'] = "%s/payments/%s/interswitch_cb" % (student.absolute_url(),
    101                                                             so.getId)
     100            row['callback_url'] = "%s/interswitch_cb" % (payments_path)
    102101            href = '%(query_url)s' % info
    103102            href += '?transRef=%(trans_ref)s' % row
  • WAeUP_SRP/fceokene/waeup_custom/pay_interswitch.py

    r2883 r2891  
    6262info['status'] = 'started'
    6363info['session_id'] = student_record.session
    64 info['target'] = student_record.course
    65 info['subject'] = 'schoolfee'
     64info['item'] = student_record.course
     65info['category'] = 'schoolfee'
    6666info['student_email'] = student_record.email
    6767now = DateTime.DateTime()
Note: See TracChangeset for help on using the changeset viewer.