Ignore:
Timestamp:
7 Nov 2015, 12:05:48 (9 years ago)
Author:
Henrik Bettermann
Message:

Prepare function for computing the gateway amount dynamically (will be modified on next Monday).

Transaction fee is already embedded in each of the fee items and must this be substracted.

Location:
main/waeup.aaue/trunk/src/waeup/aaue
Files:
4 edited

Legend:

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

    r13403 r13406  
    4949
    5050
     51def dynamic_gateway_amt(fee):
     52    return GATEWAY_AMT
     53
    5154def contr_agreement(student):
    5255    if student.current_mode == 'found' or student.current_mode.endswith('_pt'):
     
    216219                    - joint_venture_amt
    217220                    - aaue_share_amt
    218                     - student_union_due_amt
    219                     - student_welfare_assurance_amt
     221                    - (student_union_due_amt - GATEWAY_AMT)
     222                    - (student_welfare_assurance_amt - GATEWAY_AMT)
    220223                    - GATEWAY_AMT)
    221224                xmltext = """<payment_item_detail>
     
    271274                xmldict['institution_amt'] = 100 * (
    272275                    self.context.amount_auth
    273                     - gown_fee_amt
    274                     - aaue_fl_fee_amt
     276                    - (gown_fee_amt - GATEWAY_AMT)
     277                    - (aaue_fl_fee_amt - GATEWAY_AMT)
    275278                    - GATEWAY_AMT)
    276279                xmltext = """<payment_item_detail>
     
    299302            xmldict['institution_bank_id'] = '123'
    300303            xmldict['institution_amt'] = 100 * (
    301                 self.context.amount_auth - GATEWAY_AMT)
     304                self.context.amount_auth -
     305                dynamic_gateway_amt(self.context.amount_auth))
    302306            xmltext = """<payment_item_detail>
    303307<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
     
    312316            xmldict['institution_bank_id'] = '51'
    313317            xmldict['institution_amt'] = 100 * (
    314                 self.context.amount_auth - GATEWAY_AMT)
     318                self.context.amount_auth -
     319                dynamic_gateway_amt(self.context.amount_auth))
    315320            xmltext = """<payment_item_detail>
    316321<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
     
    325330            xmldict['institution_bank_id'] = '123'
    326331            xmldict['institution_amt'] = 100 * (
    327                 self.context.amount_auth - GATEWAY_AMT)
     332                self.context.amount_auth -
     333                dynamic_gateway_amt(self.context.amount_auth))
    328334            xmltext = """<payment_item_detail>
    329335<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
     
    338344            xmldict['institution_bank_id'] = '51'
    339345            xmldict['institution_amt'] = 100 * (
    340                 self.context.amount_auth - GATEWAY_AMT)
     346                self.context.amount_auth -
     347                dynamic_gateway_amt(self.context.amount_auth))
    341348            xmltext = """<payment_item_detail>
    342349<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
     
    351358            xmldict['institution_bank_id'] = '117'
    352359            xmldict['institution_amt'] = 100 * (
    353                 self.context.amount_auth - GATEWAY_AMT)
     360                self.context.amount_auth -
     361                dynamic_gateway_amt(self.context.amount_auth))
    354362            xmltext = """<payment_item_detail>
    355363<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
     
    364372            xmldict['institution_bank_id'] = '117'
    365373            xmldict['institution_amt'] = 100 * (
    366                 self.context.amount_auth - GATEWAY_AMT)
     374                self.context.amount_auth -
     375                dynamic_gateway_amt(self.context.amount_auth))
    367376            xmltext = """<payment_item_detail>
    368377<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
     
    377386            xmldict['institution_bank_id'] = '123'
    378387            xmldict['institution_amt'] = 100 * (
    379                 self.context.amount_auth - GATEWAY_AMT)
     388                self.context.amount_auth -
     389                dynamic_gateway_amt(self.context.amount_auth))
    380390            xmltext = """<payment_item_detail>
    381391<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
  • main/waeup.aaue/trunk/src/waeup/aaue/interswitch/tests.py

    r13403 r13406  
    121121        self.browser.getLink(self.value).click()
    122122        self.assertTrue('Amount Authorized' in self.browser.contents)
    123         self.assertTrue('<span>51750.0</span>' in self.browser.contents)
     123        # 50250 + 1000 + 500 - 500
     124        self.assertTrue('<span>51250.0</span>' in self.browser.contents)
    124125        self.payment_url = self.browser.url
    125126        self.browser.getLink("CollegePAY", index=0).click()
     
    136137        self.assertEqual(self.student.current_mode, 'ug_pt')
    137138        self.assertTrue(
    138             '<input type="hidden" name="amount" value="5175000" />'
     139            '<input type="hidden" name="amount" value="5125000" />'
    139140            in self.browser.contents)
    140141        self.assertTrue(
     
    203204        self.browser.getLink(self.value).click()
    204205        self.assertTrue('Amount Authorized' in self.browser.contents)
    205         self.assertTrue('<span>43050.0</span>' in  self.browser.contents)
     206        # 40250 + 2000 + 800 -500
     207        self.assertTrue('<span>42550.0</span>' in self.browser.contents)
    206208        self.payment_url = self.browser.url
    207209        self.browser.getLink("CollegePAY", index=0).click()
     
    210212        self.assertTrue('Total Amount Authorized:' in self.browser.contents)
    211213        self.assertTrue(
    212             '<input type="hidden" name="amount" value="4305000" />'
     214            '<input type="hidden" name="amount" value="4255000" />'
    213215            in self.browser.contents)
    214216        self.assertTrue(
  • main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py

    r13403 r13406  
    317317        self.browser.getLink(value).click()
    318318        self.assertTrue('Amount Authorized' in self.browser.contents)
    319         self.assertEqual(self.student['payments'][value].amount_auth, 51750.0)
     319        self.assertEqual(self.student['payments'][value].amount_auth, 51250.0)
    320320        self.browser.open(self.browser.url + '/payment_slip.pdf')
    321321        self.assertEqual(self.browser.headers['Status'], '200 Ok')
  • main/waeup.aaue/trunk/src/waeup/aaue/students/utils.py

    r13405 r13406  
    2424from waeup.kofa.accesscodes import create_accesscode
    2525from waeup.kofa.students.utils import trans
     26from waeup.aaue.interswitch.browser import dynamic_gateway_amt
    2627from waeup.aaue.interfaces import MessageFactory as _
    2728
     
    148149                    # Otherwise we can't add somtehing
    149150                    amount = 0.0
    150                 amount += academic_session.matric_gown_fee + academic_session.lapel_fee
     151                amount += academic_session.matric_gown_fee + \
     152                          academic_session.lapel_fee - \
     153                          2*(dynamic_gateway_amt(amount))
    151154        elif category == 'late_registration':
    152155            amount = academic_session.late_registration_fee
     
    183186                    # Otherwise we can't add somtehing
    184187                    amount = 0.0
    185                 amount += academic_session.welfare_fee + academic_session.union_fee
     188                amount += academic_session.welfare_fee + \
     189                          academic_session.union_fee - \
     190                          2*(dynamic_gateway_amt(amount))
    186191        if amount in (0.0, None):
    187192            return _(u'Amount could not be determined.'), None
Note: See TracChangeset for help on using the changeset viewer.