Ignore:
Timestamp:
24 Jan 2014, 11:35:27 (11 years ago)
Author:
Henrik Bettermann
Message:

Output like

http://imopoly.mycampustest.ihems.net/EIMSPayeeIdDetails.aspx?PAYEE_ID=12NDCSTWK33Y256&PAYMENT_TYPE=TRANSCRIPT%20FEE

Location:
main/waeup.aaue/trunk/src/waeup/aaue/etranzact
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.aaue/trunk/src/waeup/aaue/etranzact/browser.py

    r10954 r10978  
    4040from waeup.aaue.applicants.interfaces import ICustomApplicantOnlinePayment
    4141
     42ERROR_PART1 = (
     43        'PayeeName=N/A~'
     44        + 'Faculty=N/A~'
     45        + 'Department=N/A~'
     46        + 'Level=N/A~'
     47        + 'ProgrammeType=N/A~'
     48        + 'StudyType=N/A~'
     49        + 'Session=N/A~'
     50        + 'PayeeID=N/A~'
     51        + 'Amount=N/A~'
     52        + 'FeeStatus=')
     53ERROR_PART2 = (
     54        '~Semester=N/A~'
     55        + 'PaymentType=N/A~'
     56        + 'MatricNumber=N/A~'
     57        + 'Email=N/A~'
     58        + 'PhoneNumber=N/A')
     59
    4260class CustomPaymentDataWebservice(PaymentDataWebservice):
    4361    """A simple webservice to publish payment and payer details on request from
     
    5573    def update(self, PAYEE_ID=None, PAYMENT_TYPE=None):
    5674        if PAYEE_ID == None:
    57             self.output = 'Missing PAYEE_ID' # '-1'
     75            self.output = ERROR_PART1 + 'Missing PAYEE_ID' + ERROR_PART2
    5876            return
    5977        real_ip = self.request.get('HTTP_X_FORWARDED_FOR', None)
     
    6482        if real_ip  and self.ACCEPTED_IP:
    6583            if real_ip not in  self.ACCEPTED_IP:
    66                 self.output = 'Wrong IP address' # '-2'
     84                self.output = ERROR_PART1 + 'Wrong IP address' + ERROR_PART2
    6785                return
    6886        if PAYMENT_TYPE not in ('SCHOOL-FEE', 'ACCEPTANCE-FEE', 'APPLICATION-FEE'):
    69             self.output = 'Invalid PAYMENT_TYPE' # '-3'
     87            self.output = ERROR_PART1 + 'Invalid PAYMENT_TYPE' + ERROR_PART2
    7088            return
    7189
     
    85103        results = list(cat.searchResults(p_id=(PAYEE_ID, PAYEE_ID)))
    86104        if len(results) != 1:
    87             self.output = 'Invalid PAYEE_ID' # '-1'
     105            self.output = ERROR_PART1 + 'Invalid PAYEE_ID' + ERROR_PART2
    88106            return
    89107        if PAYMENT_TYPE == 'SCHOOL-FEE' \
    90108            and not results[0].p_category.startswith('schoolfee'):
    91             self.output = 'Wrong PAYMENT_TYPE' # '-5'
     109            self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
    92110            return
    93111        if PAYMENT_TYPE == 'ACCEPTANCE-FEE' \
    94112            and not results[0].p_category == 'clearance':
    95             self.output = 'Wrong PAYMENT_TYPE' # '-6'
     113            self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
    96114            return
    97115        if PAYMENT_TYPE == 'APPLICATION-FEE' \
    98116            and not results[0].p_category == 'application':
    99             self.output = 'Wrong PAYMENT_TYPE' # '-7'
     117            self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2
    100118            return
    101119        try:
     
    110128            level = owner.current_level
    111129        except (TypeError, AttributeError):
    112             self.output = 'Unknown error, please contact Kofa administrator' # '-8'
     130            self.output = ERROR_PART1 +  'Unknown error' + ERROR_PART2
    113131            return
    114132        amount = results[0].amount_auth
  • main/waeup.aaue/trunk/src/waeup/aaue/etranzact/tests.py

    r10954 r10978  
    2121from waeup.kofa.configuration import SessionConfiguration
    2222from waeup.aaue.testing import FunctionalLayer
     23from waeup.aaue.etranzact.browser import ERROR_PART1, ERROR_PART2
    2324
    2425
     
    108109
    109110        self.browser.open('http://localhost/app/feerequest')
    110         self.assertEqual(self.browser.contents, 'Missing PAYEE_ID')
     111        self.assertEqual(self.browser.contents, ERROR_PART1 + 'Missing PAYEE_ID' + ERROR_PART2)
    111112        self.browser.open('http://localhost/app/feerequest?NONSENSE=nonsense')
    112         self.assertEqual(self.browser.contents, 'Missing PAYEE_ID')
     113        self.assertEqual(self.browser.contents, ERROR_PART1 + 'Missing PAYEE_ID' + ERROR_PART2)
    113114        self.browser.open(
    114115            'http://localhost/app/feerequest?PAYEE_ID=nonsense&PAYMENT_TYPE=SCHOOL-FEE')
    115         self.assertEqual(self.browser.contents, 'Invalid PAYEE_ID')
     116        self.assertEqual(self.browser.contents, ERROR_PART1 + 'Invalid PAYEE_ID' + ERROR_PART2)
    116117        self.browser.open(
    117118            'http://localhost/app/feerequest?PAYEE_ID=%s&PAYMENT_TYPE=NONSENSE'
    118119            % self.p_id)
    119         self.assertEqual(self.browser.contents, 'Invalid PAYMENT_TYPE')
     120        self.assertEqual(self.browser.contents, ERROR_PART1 + 'Invalid PAYMENT_TYPE' + ERROR_PART2)
    120121        self.browser.open(
    121122            'http://localhost/app/feerequest?PAYEE_ID=%s'
    122123            % self.p_id)
    123         self.assertEqual(self.browser.contents, 'Invalid PAYMENT_TYPE')
     124        self.assertEqual(self.browser.contents, ERROR_PART1 + 'Invalid PAYMENT_TYPE' + ERROR_PART2)
    124125        self.browser.open(
    125126            'http://localhost/app/feerequest?PAYEE_ID=%s&PAYMENT_TYPE=ACCEPTANCE-FEE'
    126127            % self.p_id)
    127         self.assertEqual(self.browser.contents, 'Wrong PAYMENT_TYPE')
     128        self.assertEqual(self.browser.contents, ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2)
    128129        self.browser.open(
    129130            'http://localhost/app/feerequest?PAYEE_ID=%s&PAYMENT_TYPE=APPLICATION-FEE'
    130131            % self.p_id)
    131         self.assertEqual(self.browser.contents, 'Wrong PAYMENT_TYPE')
     132        self.assertEqual(self.browser.contents, ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2)
    132133
    133134
Note: See TracChangeset for help on using the changeset viewer.