Changeset 12982


Ignore:
Timestamp:
22 May 2015, 07:19:27 (9 years ago)
Author:
Henrik Bettermann
Message:

Fix exporter and test if the ticket-expire mechanism works, for both applicant and student payments.

Location:
main/kofacustom.wdu/trunk/src/kofacustom/wdu
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.wdu/trunk/src/kofacustom/wdu/applicants/export.py

    r12086 r12982  
    3333        ICustomUGApplicant.names() +
    3434        ICustomPGApplicant.names() +
    35         INigeriaUGApplicant.names() +
     35        #INigeriaUGApplicant.names() +
    3636        INigeriaPGApplicant.names() +
    3737        IApplicantBaseData.names()
  • main/kofacustom.wdu/trunk/src/kofacustom/wdu/applicants/tests/test_browser.py

    r12888 r12982  
    7979        self.assertMatches(result,
    8080            'aggregate,applicant_id,application_date,application_number,'
    81             'course1,course2,course_admitted,date_of_birth,display_fullname,'
    82             'email,emp2_end,emp2_position,emp2_reason,emp2_start,emp_end,'
    83             'emp_position,emp_reason,emp_start,employer,employer2,'
    84             'firstname,history,hq_degree,hq_disc,hq_matric_no,hq_school,'
    85             'hq_session,hq_type,jamb_age,jamb_reg_number,jamb_score,'
    86             'jamb_subjects,lastname,lga,locked,marit_stat,middlename,'
    87             'nationality,next_kin_address,notice,nysc_lga,nysc_year,'
    88             'olevel_exam_date,olevel_exam_date2,olevel_exam_number,'
    89             'olevel_exam_number2,olevel_results,olevel_results2,'
    90             'olevel_school,olevel_school2,olevel_type,olevel_type2,'
    91             'password,phone,pp_school,presently_inst,reg_number,'
    92             'religion,result_uploaded,screening_date,screening_score,'
    93             'screening_venue,sex,special_application,state,student_id,'
    94             'suspended,container_code\r\n'
    95             ',dp2011_654321,,654321,CERT1,CERT1,CERT1,1981-02-04#,'
     81            'body_responsible_address,course1,course2,course_admitted,'
     82            'date_of_birth,display_fullname,email,emp2_end,emp2_position,'
     83            'emp2_reason,emp2_start,emp_end,emp_position,emp_reason,'
     84            'emp_start,employer,employer2,firstname,history,hq_degree,'
     85            'hq_disc,hq_matric_no,hq_school,hq_session,hq_type,'
     86            'jamb_reg_number,jamb_score,jamb_subjects,lastname,lga,'
     87            'locked,marit_stat,middlename,nationality,next_kin_address,'
     88            'notice,nysc_lga,nysc_year,olevel_exam_date,olevel_exam_date2,'
     89            'olevel_exam_number,olevel_exam_number2,olevel_results,'
     90            'olevel_results2,olevel_school,olevel_school2,olevel_type,'
     91            'olevel_type2,password,phone,pp_school,presently_inst,'
     92            'reg_number,religion,result_uploaded,screening_date,'
     93            'screening_score,screening_venue,sex,special_application,'
     94            'state,student_id,suspended,container_code\r\n'
     95            ',dp2011_654321,,654321,,CERT1,CERT1,CERT1,1981-02-04#,'
    9696            'Anna M. Tester,anna@sample.com,,,,,,,,,,,Anna,'
    97             '[u\'2015-04-26 13:44:05 WAT - Application initialized by system\']'
    98             ',,,,,,,,,,,Tester,,0,,M.,NG,,"Some notice\nin lines.",,,,,,,,,,,,,'
     97            '[u\'2015-05-22 05:35:35 WAT - Application initialized by system\']'
     98            ',,,,,,,,,,Tester,,0,,M.,NG,,"Some notice\nin lines.",,,,,,,,,,,,,'
    9999            'any password,+234-123-12345#,,,123456,,,'
    100             '"Saturday, 16th June 2012 2:00:00 PM",98,Exam Room,'
    101             'f,,initialized,,0,dp2011\r\n')
     100            '"Saturday, 16th June 2012 2:00:00 PM",98,Exam Room,f,,'
     101            'initialized,,0,dp2011\r\n')
    102102        # We can import the same file if we ignore some columns.
    103103        # Since the applicants_catalog hasn't been notified, the same
     
    107107            self.outfile,
    108108            ['aggreagate','ignore_applicant_id','application_date',
    109             'ignore_application_number','course1','course2',
    110             'course_admitted','date_of_birth','ignore3','email','emp2_end',
    111             'emp2_position','emp2_reason','emp2_start','emp_end','emp_position',
    112             'emp_reason','emp_start','employer','employer2','firstname','ignore4',
    113             'hq_degree','hq_disc','hq_matric_no','hq_school','hq_session','hq_type',
    114             'jamb_age','jamb_score','jamb_subjects','lastname','lga','locked','middlename',
    115             'nationality','notice','nysc_lga',
    116             'nysc_year','password','phone','pp_school','presently_inst',
    117             'reg_number','result_uploaded',
    118             'screening_date','screening_score','screening_venue','sex',
    119             'special_application',
     109            'ignore_application_number',
     110            'body_responsible_address','course1','course2','course_admitted',
     111            'date_of_birth','display_fullname','email','emp2_end','emp2_position',
     112            'emp2_reason','emp2_start','emp_end','emp_position','emp_reason',
     113            'emp_start','employer','employer2','firstname','history','hq_degree',
     114            'hq_disc','hq_matric_no','hq_school','hq_session','hq_type',
     115            'jamb_reg_number','jamb_score','jamb_subjects','lastname','lga',
     116            'locked','marit_stat','middlename','nationality','next_kin_address',
     117            'notice','nysc_lga','nysc_year','olevel_exam_date','olevel_exam_date2',
     118            'olevel_exam_number','olevel_exam_number2','olevel_results',
     119            'olevel_results2','olevel_school','olevel_school2','olevel_type',
     120            'olevel_type2','password','phone','pp_school','presently_inst',
     121            'reg_number','religion','result_uploaded','screening_date',
     122            'screening_score','screening_venue','sex','special_application',
    120123            'state','student_id','suspended','container_code'],
    121124            mode='create')
    122125        num_succ, num_fail, finished_path, failed_path = result
    123         #content = open(failed_path).read()
    124126        self.assertEqual(num_succ,1)
    125127        self.assertEqual(num_fail,0)
     
    132134        result = processor.doImport(
    133135            self.outfile,
    134             ['aggregate','ignore_applicant_id','application_date',
    135             'ignore_application_number','course1','course2',
    136             'course_admitted','date_of_birth','ignore3','email','emp2_end',
    137             'emp2_position','emp2_reason','emp2_start','emp_end','emp_position',
    138             'emp_reason','emp_start','employer','employer2','firstname','ignore4',
    139             'hq_degree','hq_disc','hq_matric_no','hq_school','hq_session','hq_type',
    140             'jamb_age','jamb_score','jamb_subjects','lastname','lga','locked','middlename',
    141             'nationality','notice','nysc_lga',
    142             'nysc_year','password','phone','pp_school','presently_inst',
    143             'reg_number','result_uploaded','screening_date','screening_score',
    144             'screening_venue','sex','special_application',
     136            ['aggreagate','ignore_applicant_id','application_date',
     137            'ignore_application_number',
     138            'body_responsible_address','course1','course2','course_admitted',
     139            'date_of_birth','display_fullname','email','emp2_end','emp2_position',
     140            'emp2_reason','emp2_start','emp_end','emp_position','emp_reason',
     141            'emp_start','employer','employer2','firstname','history','hq_degree',
     142            'hq_disc','hq_matric_no','hq_school','hq_session','hq_type',
     143            'jamb_reg_number','jamb_score','jamb_subjects','lastname','lga',
     144            'locked','marit_stat','middlename','nationality','next_kin_address',
     145            'notice','nysc_lga','nysc_year','olevel_exam_date','olevel_exam_date2',
     146            'olevel_exam_number','olevel_exam_number2','olevel_results',
     147            'olevel_results2','olevel_school','olevel_school2','olevel_type',
     148            'olevel_type2','password','phone','pp_school','presently_inst',
     149            'reg_number','religion','result_uploaded','screening_date',
     150            'screening_score','screening_venue','sex','special_application',
    145151            'state','student_id','suspended','ignore_container_code'],
    146152            mode='update')
  • main/kofacustom.wdu/trunk/src/kofacustom/wdu/interswitch/browser.py

    r12510 r12982  
    6262
    6363    def update(self):
    64         super(CustomInterswitchPageStudent, self).update()
     64        error = self.init_update()
     65        if error:
     66            self.flash(error, type='danger')
     67            self.redirect(self.url(self.context, '@@index'))
     68            return
    6569        student = self.student
    6670        xmldict = self.xmldict
     
    125129
    126130    def update(self):
    127         super(CustomInterswitchPageApplicant, self).update()
     131        error = self.init_update()
     132        if error:
     133            self.flash(error, type='danger')
     134            self.redirect(self.url(self.context, '@@index'))
     135            return
    128136        xmldict = {}
    129137        provider_amt = 500.0
  • main/kofacustom.wdu/trunk/src/kofacustom/wdu/interswitch/tests.py

    r12478 r12982  
    8585            '...item_name="School Fees" item_amt="23000000" bank_id="47" acct_num="4742014159"...',
    8686            self.browser.contents)
     87
     88    def test_interswitch_form_ticket_expired(self):
     89        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     90        acc_payment = createObject('waeup.StudentOnlinePayment')
     91        acc_payment.p_state = 'unpaid'
     92        acc_payment.p_category = 'schoolfee'
     93        acc_payment.p_id = 'xyz'
     94        acc_payment.pay_item_id = '123'
     95        acc_payment.amount_auth = 876.0
     96        self.student['payments']['xyz'] = acc_payment
     97        self.browser.open(self.payments_path + '/xyz')
     98        self.browser.getLink("CollegePAY", index=0).click()
     99        self.assertMatches('...<input type="hidden" name="pay_item_id" value="101" />...',
     100                           self.browser.contents)
     101        self.assertMatches('...Total Amount Authorized:...',
     102                           self.browser.contents)
     103        self.assertEqual(self.student.current_mode, 'ug_ft')
     104        self.assertMatches(
     105            '...<input type="hidden" name="amount" value="87600" />...',
     106            self.browser.contents)
     107        delta = timedelta(minutes=61)
     108        acc_payment.creation_date -= delta
     109        self.browser.open(self.payments_path + '/xyz')
     110        self.browser.getLink("CollegePAY", index=0).click()
     111        self.assertMatches(
     112            '...This payment ticket is too old. Please create a new ticket...',
     113            self.browser.contents)
     114        delta = timedelta(minutes=2)
     115        acc_payment.creation_date += delta
     116        self.browser.open(self.payments_path + '/xyz')
     117        self.browser.getLink("CollegePAY", index=0).click()
     118        self.assertMatches('...Total Amount Authorized:...',
     119                           self.browser.contents)
     120
    87121
    88122    @external_test
     
    208242            '...<input type="hidden" name="amount" value="100000" />...',
    209243            self.browser.contents)
     244        delta = timedelta(minutes=61)
     245        self.applicant.values()[0].creation_date -= delta
     246        self.browser.open(self.payment_url)
     247        self.browser.getLink("CollegePAY", index=0).click()
     248        self.assertMatches(
     249            '...This payment ticket is too old. Please create a new ticket...',
     250            self.browser.contents)
    210251
    211252    @external_test
Note: See TracChangeset for help on using the changeset viewer.