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/interswitch
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • 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.