Ignore:
Timestamp:
13 Oct 2019, 19:15:33 (5 years ago)
Author:
Henrik Bettermann
Message:

Implement combi payments (tests will follow).

Location:
main/waeup.kofa/trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/CHANGES.txt

    r15652 r15664  
    441.6.1.dev0 (unreleased)
    55=======================
     6
     7* Implement combi payments.
    68
    79* Make max file size customizable.
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_export.py

    r15502 r15664  
    288288        cdate = str('%s#' % self.applicant['p120'].creation_date)
    289289        self.assertEqual(
    290             'ac,amount_auth,creation_date,p_category,p_id,'
     290            'ac,amount_auth,creation_date,p_category,p_combi,p_id,'
    291291            'p_item,p_session,p_state,payment_date,r_amount_approved,'
    292292            'r_code,r_desc,applicant_id,reg_number,display_fullname\r\n'
    293             ',0.0,%s,application,p120,,2012,paid,,0.0,,,dp2011_654321,'
     293            ',0.0,%s,application,[],p120,,2012,paid,,0.0,,,dp2011_654321,'
    294294            '123456,Anna M. Tester\r\n' % cdate, result)
    295295        return
     
    302302        cdate = str('%s#' % self.applicant['p120'].creation_date)
    303303        self.assertEqual(
    304             'ac,amount_auth,creation_date,p_category,p_id,'
     304            'ac,amount_auth,creation_date,p_category,p_combi,p_id,'
    305305            'p_item,p_session,p_state,payment_date,r_amount_approved,'
    306306            'r_code,r_desc,applicant_id,reg_number,display_fullname\r\n'
    307             ',0.0,%s,application,p120,,2012,paid,,0.0,,,dp2011_654321,'
     307            ',0.0,%s,application,[],p120,,2012,paid,,0.0,,,dp2011_654321,'
    308308            '123456,Anna M. Tester\r\n' % cdate, result)
    309309        return
     
    317317        cdate = str('%s#' % self.applicant['p120'].creation_date)
    318318        self.assertEqual(
    319             'ac,amount_auth,creation_date,p_category,p_id,'
     319            'ac,amount_auth,creation_date,p_category,p_combi,p_id,'
    320320            'p_item,p_session,p_state,payment_date,r_amount_approved,'
    321321            'r_code,r_desc,applicant_id,reg_number,display_fullname\r\n'
    322             ',0.0,%s,application,p120,,2012,paid,,0.0,,,dp2011_654321,'
     322            ',0.0,%s,application,[],p120,,2012,paid,,0.0,,,dp2011_654321,'
    323323            '123456,Anna M. Tester\r\n' % cdate, result)
    324324        return
  • main/waeup.kofa/trunk/src/waeup/kofa/interfaces.py

    r15609 r15664  
    303303    """A zope.schema-like field for usage in interfaces.
    304304
    305     Marker interface to distuingish result entries from ordinary
     305    Marker interface to distuingish referee entries from ordinary
    306306    object fields. Needed for registration of widgets.
    307307    """
  • main/waeup.kofa/trunk/src/waeup/kofa/payments/interfaces.py

    r13012 r15664  
    3737    DICT_NAME = 'PAYMENT_CATEGORIES'
    3838
     39class CombiPaymentCategorySource(ContextualDictSourceFactoryBase):
     40    """A payment category source delivers all categories of payments.
     41
     42    """
     43    #: name of dict to deliver from kofa utils.
     44    DICT_NAME = 'COMBI_PAYMENT_CATEGORIES'
     45
    3946class IPaymentsContainer(IKofaObject):
    4047    """A container for all kind of payment objects.
     
    5966        default = None,
    6067        required = False,
     68        )
     69
     70    p_combi = schema.List(
     71        title = _(u'Combi Payment'),
     72        value_type = schema.Choice(
     73            source = CombiPaymentCategorySource(),
     74            ),
     75        required = False,
     76        defaultFactory=list,
    6177        )
    6278
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r15642 r15664  
    19851985    grok.template('onlinepaymentaddform')
    19861986    grok.require('waeup.payStudent')
    1987     form_fields = grok.AutoFields(IStudentOnlinePayment).select(
    1988         'p_category')
     1987    form_fields = grok.AutoFields(IStudentOnlinePayment).select('p_combi')
    19891988    label = _('Add online payment')
    19901989    pnav = 4
     
    19991998    @action(_('Create ticket'), style='primary')
    20001999    def createTicket(self, **data):
    2001         p_category = data['p_category']
    2002         previous_session = data.get('p_session', None)
    2003         previous_level = data.get('p_level', None)
     2000        form = self.request.form
     2001        p_category = form.get('form.p_category', None)
     2002        p_combi = form.get('form.p_combi', None)
     2003        if isinstance(form.get('form.p_combi', None), unicode):
     2004            p_combi = [p_combi,]
    20042005        student = self.context.__parent__
    20052006        # The hostel_application payment category is temporarily used
     
    20202021        students_utils = getUtility(IStudentsUtils)
    20212022        error, payment = students_utils.setPaymentDetails(
    2022             p_category, student, previous_session, previous_level)
     2023            p_category, student, None, None, p_combi)
    20232024        if error is not None:
    20242025            self.flash(error, type="danger")
    20252026            return
    20262027        if p_category == 'transfer':
    2027             payment.p_item = self.request.form['new_programme']
     2028            payment.p_item = form['new_programme']
    20282029        self.context[payment.p_id] = payment
    20292030        self.flash(_('Payment ticket created.'))
     
    20612062        students_utils = getUtility(IStudentsUtils)
    20622063        error, payment = students_utils.setPaymentDetails(
    2063             p_category, student, previous_session, previous_level)
     2064            p_category, student, previous_session, previous_level, None)
    20642065        if error is not None:
    20652066            self.flash(error, type="danger")
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/onlinepaymentaddform.pt

    r13577 r15664  
    1010        <td>
    1111          <select id="form.p_category" name="form.p_category" size="1"
    12                   class="form-control half" onclick="test()">
     12                  class="form-control half" onclick="further()">
    1313            <option tal:repeat="item view/selectable_categories"
    1414                    tal:attributes="value python:item[0]">
     
    1818        </td>
    1919      </tr>
     20    </tbody>
     21  </table>
     22
     23  <table id="widgets" class="form-table" style="display: none;">
     24    <tbody>
     25      <tal:widgets content="structure provider:widgets" />
    2026    </tbody>
    2127  </table>
     
    4753
    4854<script type="text/javascript">
    49   function test() {
     55  function further() {
    5056      if (document.getElementById('form.p_category').value == 'transfer') {
    5157          document.getElementById('p_item').style.display = 'block';
     
    5359          document.getElementById('p_item').style.display = 'none';
    5460      }
     61      if (document.getElementById('form.p_category').value == 'combi') {
     62          document.getElementById('widgets').style.display = 'block';
     63      } else {
     64          document.getElementById('widgets').style.display = 'none';
     65      }
    5566  }
    5667</script>
  • main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py

    r15609 r15664  
    8383
    8484    def setPaymentDetails(category, student, previous_session=None,
    85             previous_level=None,):
     85            previous_level=None, combi=None):
    8686        """Create Payment object and set the payment data of a student for
    8787        the payment category specified.
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r15624 r15664  
    38343834            self.browser.headers['content-disposition'])
    38353835        self.assertTrue(
    3836             '666,12.12,2012-12-13 00:00:00#,schoolfee,1,my-id,p-item,100,2013,'
     3836            '666,12.12,2012-12-13 00:00:00#,schoolfee,[],1,my-id,p-item,100,2013,'
    38373837            'paid,2012-12-13 00:00:00#,12.12,r-code,,K1000000,234,123,Anna,,'
    38383838            'Tester,created,2004,2004,,fac1,dep1,CERT1' in self.browser.contents)
     
    38803880            self.browser.headers['content-disposition'])
    38813881        self.assertTrue(
    3882             '666,12.12,2012-12-13 00:00:00#,schoolfee,1,my-id,p-item,100,2013,'
     3882            '666,12.12,2012-12-13 00:00:00#,schoolfee,[],1,my-id,p-item,100,2013,'
    38833883            'paid,2012-12-13 00:00:00#,12.12,r-code,,K1000000,234,123,Anna,,'
    38843884            'Tester,created,2004,2004,,fac1,dep1,CERT1' in self.browser.contents)
     
    42374237            self.browser.headers['content-disposition'])
    42384238        self.assertTrue(
    4239             '666,12.12,2012-12-13 00:00:00#,schoolfee,1,my-id,p-item,100,2013,'
     4239            '666,12.12,2012-12-13 00:00:00#,schoolfee,[],1,my-id,p-item,100,2013,'
    42404240            'paid,2012-12-13 00:00:00#,12.12,r-code,,K1000000,234,123,Anna,,'
    42414241            'Tester,created,2004,2004,,fac1,dep1,CERT1' in self.browser.contents)
     
    42634263            self.browser.headers['content-disposition'])
    42644264        self.assertTrue(
    4265             '666,12.12,2012-12-13 00:00:00#,schoolfee,1,my-id,p-item,100,2013,'
     4265            '666,12.12,2012-12-13 00:00:00#,schoolfee,[],1,my-id,p-item,100,2013,'
    42664266            'paid,2012-12-13 00:00:00#,12.12,r-code,,K1000000,234,123,Anna,,'
    42674267            'Tester,created,2004,2004,,fac1,dep1,CERT1' in self.browser.contents)
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py

    r15609 r15664  
    823823        self.assertEqual(
    824824            result,
    825             'ac,amount_auth,creation_date,p_category,p_current,p_id,'
     825            'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,'
    826826            'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,'
    827827            'r_code,r_desc,student_id,state,current_session\r\n'
    828828
    829             ',0.0,2012-04-01 13:12:01#,,1,,,,,unpaid,,0.0,,,,,\r\n'
     829            ',0.0,2012-04-01 13:12:01#,,[],1,,,,,unpaid,,0.0,,,,,\r\n'
    830830            )
    831831        return
     
    841841        self.assertEqual(
    842842            result,
    843             'ac,amount_auth,creation_date,p_category,p_current,p_id,'
     843            'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,'
    844844            'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,'
    845845            'r_code,r_desc,student_id,state,current_session\r\n'
    846846
    847             '666,12.12,%s-04-01 13:12:01#,schoolfee,1,my-id,'
     847            '666,12.12,%s-04-01 13:12:01#,schoolfee,[],1,my-id,'
    848848            'p-item,100,%s,paid,%s-04-01 14:12:01#,12.12,'
    849849            'r-code,,A111111,created,2012\r\n'
     
    861861        self.assertEqual(
    862862            result,
    863             'ac,amount_auth,creation_date,p_category,p_current,p_id,'
     863            'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,'
    864864            'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,'
    865865            'r_code,r_desc,student_id,state,current_session\r\n'
    866866
    867             '666,12.12,%s-04-01 13:12:01#,schoolfee,1,my-id,'
     867            '666,12.12,%s-04-01 13:12:01#,schoolfee,[],1,my-id,'
    868868            'p-item,100,%s,paid,%s-04-01 14:12:01#,12.12,'
    869869            'r-code,,A111111,created,2012\r\n'
     
    881881        self.assertEqual(
    882882            result,
    883             'ac,amount_auth,creation_date,p_category,p_current,p_id,'
     883            'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,'
    884884            'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,'
    885885            'r_code,r_desc,student_id,state,current_session\r\n'
    886886
    887             '666,12.12,%s-04-01 13:12:01#,schoolfee,1,my-id,'
     887            '666,12.12,%s-04-01 13:12:01#,schoolfee,[],1,my-id,'
    888888            'p-item,100,%s,paid,%s-04-01 14:12:01#,12.12,'
    889889            'r-code,,A111111,created,2012\r\n'
     
    904904        self.assertEqual(
    905905            result,
    906             'ac,amount_auth,creation_date,p_category,p_current,p_id,'
     906            'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,'
    907907            'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,'
    908908            'r_code,r_desc,student_id,state,current_session\r\n'
    909909
    910             '666,12.12,%s-04-01 13:12:01#,schoolfee,1,my-id,'
     910            '666,12.12,%s-04-01 13:12:01#,schoolfee,[],1,my-id,'
    911911            'p-item,100,%s,paid,%s-04-01 14:12:01#,12.12,'
    912912            'r-code,,A111111,created,2012\r\n'
     
    942942        self.assertEqual(
    943943            result,
    944             'ac,amount_auth,creation_date,p_category,p_current,p_id,'
     944            'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,'
    945945            'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,'
    946946            'r_code,r_desc,student_id,state,current_session\r\n'
    947947
    948             '666,12.12,%s-04-01 13:12:01#,schoolfee,1,my-id,'
     948            '666,12.12,%s-04-01 13:12:01#,schoolfee,[],1,my-id,'
    949949            'p-item,100,%s,paid,%s-04-01 14:12:01#,12.12,'
    950950            'r-code,,A111111,created,2012\r\n'
     
    960960        self.assertEqual(
    961961            result,
    962             'ac,amount_auth,creation_date,p_category,p_current,p_id,'
     962            'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,'
    963963            'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,'
    964964            'r_code,r_desc,student_id,state,current_session\r\n'
     
    971971        self.assertEqual(
    972972            result,
    973             'ac,amount_auth,creation_date,p_category,p_current,p_id,'
     973            'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,'
    974974            'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,'
    975975            'r_code,r_desc,student_id,state,current_session\r\n'
     
    984984        self.assertEqual(
    985985            result,
    986             'ac,amount_auth,creation_date,p_category,p_current,p_id,'
     986            'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,'
    987987            'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,'
    988988            'r_code,r_desc,student_id,state,current_session\r\n'
     
    10091009        self.assertEqual(
    10101010            result,
    1011             'ac,amount_auth,creation_date,p_category,p_current,p_id,'
     1011            'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,'
    10121012            'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,'
    10131013            'r_code,r_desc,student_id,state,current_session\r\n'
     
    10191019        self.assertEqual(
    10201020            result,
    1021             'ac,amount_auth,creation_date,p_category,p_current,p_id,'
     1021            'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,'
    10221022            'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,'
    10231023            'r_code,r_desc,student_id,state,current_session\r\n'
    10241024
    1025             '666,12.12,%s-04-01 13:12:01#,schoolfee,1,my-id,'
     1025            '666,12.12,%s-04-01 13:12:01#,schoolfee,[],1,my-id,'
    10261026            'p-item,100,%s,unpaid,%s-04-01 14:12:01#,12.12,'
    10271027            'r-code,,A111111,created,2012\r\n'
     
    10481048        self.assertEqual(
    10491049            result,
    1050             'ac,amount_auth,creation_date,p_category,p_current,p_id,p_item,'
     1050            'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,p_item,'
    10511051            'p_level,p_session,p_state,payment_date,r_amount_approved,r_code,'
    10521052            'r_desc,student_id,matric_number,reg_number,firstname,middlename,lastname,'
    10531053            'state,current_session,entry_session,entry_mode,faccode,depcode,certcode\r\n'
    10541054
    1055             '666,12.12,%s-04-01 13:12:01#,schoolfee,1,my-id,p-item,100,%s,'
     1055            '666,12.12,%s-04-01 13:12:01#,schoolfee,[],1,my-id,p-item,100,%s,'
    10561056            'paid,%s-04-01 14:12:01#,12.12,r-code,,A111111,234,123,'
    10571057            'Anna,M.,Tester,created,2012,2010,ug_ft,NA,NA,CERT1\r\n'
     
    11071107        self.assertEqual(
    11081108            result,
    1109             'ac,amount_auth,creation_date,p_category,p_current,p_id,p_item,'
     1109            'ac,amount_auth,creation_date,p_category,p_combi,p_current,p_id,p_item,'
    11101110            'p_level,p_session,p_state,payment_date,r_amount_approved,r_code,'
    11111111            'r_desc,student_id,matric_number,reg_number,firstname,middlename,lastname,'
    11121112            'state,current_session,entry_session,entry_mode,faccode,depcode,certcode\r\n'
    1113             'abc,12.12,%s-04-01 13:12:01#,bed_allocation,1,id1,xyz,100,%s,'
     1113            'abc,12.12,%s-04-01 13:12:01#,bed_allocation,[],1,id1,xyz,100,%s,'
    11141114            'paid,%s-04-01 14:12:01#,12.12,cde,,A111111,234,123,'
    11151115            'Anna,M.,Tester,created,2012,2010,ug_ft,NA,NA,CERT1\r\n'
    1116             'abc,12.12,%s-04-01 13:12:01#,hostel_maintenance,1,id2,xyz,100,%s,'
     1116            'abc,12.12,%s-04-01 13:12:01#,hostel_maintenance,[],1,id2,xyz,100,%s,'
    11171117            'paid,%s-04-01 14:12:01#,12.12,cde,,A111111,234,123,'
    11181118            'Anna,M.,Tester,created,2012,2010,ug_ft,NA,NA,CERT1\r\n'
  • main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py

    r15662 r15664  
    403403
    404404    def setPaymentDetails(self, category, student,
    405             previous_session, previous_level):
     405            previous_session, previous_level, combi):
    406406        """Create a payment ticket and set the payment data of a
    407407        student for the payment category specified.
     
    493493            else:
    494494                return _(u'No bed allocated.'), None
     495        elif category == 'combi' and combi:
     496            categories = getUtility(IKofaUtils).COMBI_PAYMENT_CATEGORIES
     497            for cat in combi:
     498                fee_name = cat + '_fee'
     499                cat_amount = getattr(academic_session, fee_name, 0.0)
     500                if not cat_amount:
     501                    return _('%s undefined.' % categories[cat]), None
     502                amount += cat_amount
     503                p_item += u'%s + ' % categories[cat]
     504            p_item = p_item.strip(' + ')
    495505        else:
    496506            fee_name = category + '_fee'
  • main/waeup.kofa/trunk/src/waeup/kofa/utils/utils.py

    r15609 r15664  
    183183        'app_balance': 'Application Fee Balance',
    184184        'transcript': 'Transcript Fee',
    185         'late_registration': 'Late Course Registration Fee'
     185        'late_registration': 'Late Course Registration Fee',
     186        'combi': 'Combi Payments',
    186187        }
    187188
     
    200201    BALANCE_PAYMENT_CATEGORIES = {
    201202        'schoolfee': 'School Fee',
     203        }
     204
     205    COMBI_PAYMENT_CATEGORIES = {
     206        'gown': 'Gown Hire Fee',
     207        'transcript': 'Transcript Fee',
     208        'late_registration': 'Late Course Registration Fee',
    202209        }
    203210
Note: See TracChangeset for help on using the changeset viewer.