Ignore:
Timestamp:
9 Nov 2015, 07:08:21 (9 years ago)
Author:
Henrik Bettermann
Message:

Determine net amount instead of gateway reduction. This is much easier to handle.

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

Legend:

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

    r13410 r13414  
    4949
    5050
    51 def dynamic_gateway_amt(fee):
    52     return GATEWAY_AMT
     51def gateway_net_amt(fee):
     52    if fee > GATEWAY_AMT:
     53        return fee - GATEWAY_AMT
     54    return 0.0
    5355
    5456def contr_agreement(student):
     
    8789        xmldict['provider_bank_id'] = PROVIDER_BANK_ID
    8890        xmldict['provider_item_name'] = PROVIDER_ITEM_NAME
    89         xmldict['institution_amt'] = 100 * (self.context.amount_auth - provider_amt - GATEWAY_AMT)
     91        xmldict['institution_amt'] = 100 * (
     92            self.context.amount_auth - provider_amt - GATEWAY_AMT)
    9093        xmldict['institution_item_name'] = self.context.p_category
    9194        xmldict['institution_name'] = INSTITUTION_NAME
     
    189192                joint_venture_amt = 1100.0
    190193                aaue_share_amt = 1000.0
    191                 student_union_due_amt = academic_session.union_fee - \
    192                     dynamic_gateway_amt(academic_session.union_fee)
    193                 student_welfare_assurance_amt = academic_session.welfare_fee - \
    194                     dynamic_gateway_amt(academic_session.welfare_fee)
     194                student_union_due_amt = gateway_net_amt(
     195                    academic_session.union_fee)
     196                student_welfare_assurance_amt = gateway_net_amt(
     197                    academic_session.welfare_fee)
    195198                xmldict['institution_bank_id'] = '7'
    196199                xmldict['institution_acct'] = '1014847058'
     
    204207                joint_venture_amt = 1000.0
    205208                aaue_share_amt = 1500.0
    206                 student_union_due_amt = academic_session.union_fee - \
    207                     dynamic_gateway_amt(academic_session.union_fee)
    208                 student_welfare_assurance_amt = academic_session.welfare_fee - \
    209                     dynamic_gateway_amt(academic_session.welfare_fee)
     209                student_union_due_amt = gateway_net_amt(
     210                    academic_session.union_fee)
     211                student_welfare_assurance_amt = gateway_net_amt(
     212                    academic_session.welfare_fee)
    210213                xmldict['institution_bank_id'] = '117'
    211214                xmldict['institution_acct'] = '1010827641'
     
    220223                xmldict['student_welfare_assurance_amt'] = 100 * student_welfare_assurance_amt
    221224                xmldict['institution_amt'] = 100 * (
    222                     self.context.amount_auth
     225                    gateway_net_amt(self.context.amount_auth)
    223226                    - provider_amt
    224227                    - joint_venture_amt
    225228                    - aaue_share_amt
    226229                    - student_union_due_amt
    227                     - student_welfare_assurance_amt
    228                     - dynamic_gateway_amt(self.context.amount_auth))
     230                    - student_welfare_assurance_amt)
    229231                xmltext = """<payment_item_detail>
    230232<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
     
    240242                # Schoolfee without additional fees
    241243                xmldict['institution_amt'] = 100 * (
    242                     self.context.amount_auth
     244                    gateway_net_amt(self.context.amount_auth)
    243245                    - provider_amt
    244246                    - joint_venture_amt
    245                     - aaue_share_amt
    246                     - dynamic_gateway_amt(self.context.amount_auth))
     247                    - aaue_share_amt)
    247248                xmltext = """<payment_item_detail>
    248249<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
     
    273274            if self.context.p_category.endswith('_incl'):
    274275                # Clearance including additional fees
    275                 gown_fee_amt = academic_session.matric_gown_fee - \
    276                     dynamic_gateway_amt(academic_session.matric_gown_fee)
    277                 aaue_fl_fee_amt = academic_session.lapel_fee - \
    278                     dynamic_gateway_amt(academic_session.lapel_fee)
     276                gown_fee_amt = gateway_net_amt(academic_session.matric_gown_fee)
     277                aaue_lf_fee_amt = gateway_net_amt(academic_session.lapel_fee)
    279278                xmldict['gown_fee_amt'] = 100 * gown_fee_amt
    280                 xmldict['aaue_fl_fee_amt'] = 100 * aaue_fl_fee_amt
     279                xmldict['aaue_lf_fee_amt'] = 100 * aaue_lf_fee_amt
    281280                xmldict['institution_amt'] = 100 * (
    282                     self.context.amount_auth
     281                    gateway_net_amt(self.context.amount_auth)
    283282                    - gown_fee_amt
    284                     - aaue_fl_fee_amt
    285                     - dynamic_gateway_amt(self.context.amount_auth))
     283                    - aaue_lf_fee_amt)
    286284                xmltext = """<payment_item_detail>
    287285<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
    288286<item_detail item_id="1" item_name="%(institution_item_name)s" item_amt="%(institution_amt)d" bank_id="%(institution_bank_id)s" acct_num="%(institution_acct)s" />
    289287<item_detail item_id="2" item_name="Matriculation Gown Fee" item_amt="%(gown_fee_amt)d" bank_id="51" acct_num="5060020947" />
    290 <item_detail item_id="3" item_name="AAU File-Lapel Fee" item_amt="%(aaue_fl_fee_amt)d" bank_id="51" acct_num="4010660109" />
     288<item_detail item_id="3" item_name="AAU File-Lapel Fee" item_amt="%(aaue_lf_fee_amt)d" bank_id="51" acct_num="4010660109" />
    291289</item_details>
    292290</payment_item_detail>""" % xmldict
     
    295293                # Clearance without additional fees
    296294                xmldict['institution_amt'] = 100 * (
    297                     self.context.amount_auth
    298                     - dynamic_gateway_amt(self.context.amount_auth))
     295                    gateway_net_amt(self.context.amount_auth))
    299296                xmltext = """<payment_item_detail>
    300297<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
     
    309306            xmldict['institution_bank_id'] = '123'
    310307            xmldict['institution_amt'] = 100 * (
    311                 self.context.amount_auth -
    312                 dynamic_gateway_amt(self.context.amount_auth))
     308                gateway_net_amt(self.context.amount_auth))
    313309            xmltext = """<payment_item_detail>
    314310<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
     
    323319            xmldict['institution_bank_id'] = '51'
    324320            xmldict['institution_amt'] = 100 * (
    325                 self.context.amount_auth -
    326                 dynamic_gateway_amt(self.context.amount_auth))
     321                gateway_net_amt(self.context.amount_auth))
    327322            xmltext = """<payment_item_detail>
    328323<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
     
    337332            xmldict['institution_bank_id'] = '123'
    338333            xmldict['institution_amt'] = 100 * (
    339                 self.context.amount_auth -
    340                 dynamic_gateway_amt(self.context.amount_auth))
     334                gateway_net_amt(self.context.amount_auth))
    341335            xmltext = """<payment_item_detail>
    342336<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
     
    351345            xmldict['institution_bank_id'] = '51'
    352346            xmldict['institution_amt'] = 100 * (
    353                 self.context.amount_auth -
    354                 dynamic_gateway_amt(self.context.amount_auth))
     347                gateway_net_amt(self.context.amount_auth))
    355348            xmltext = """<payment_item_detail>
    356349<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
     
    365358            xmldict['institution_bank_id'] = '117'
    366359            xmldict['institution_amt'] = 100 * (
    367                 self.context.amount_auth -
    368                 dynamic_gateway_amt(self.context.amount_auth))
     360                gateway_net_amt(self.context.amount_auth))
    369361            xmltext = """<payment_item_detail>
    370362<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
     
    379371            xmldict['institution_bank_id'] = '123'
    380372            xmldict['institution_amt'] = 100 * (
    381                 self.context.amount_auth -
    382                 dynamic_gateway_amt(self.context.amount_auth))
     373                gateway_net_amt(self.context.amount_auth))
    383374            xmltext = """<payment_item_detail>
    384375<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
  • main/waeup.aaue/trunk/src/waeup/aaue/students/browser.py

    r13410 r13414  
    5353    ICustomStudentPersonalEdit,
    5454    ICustomUGStudentClearance)
    55 from waeup.aaue.interswitch.browser import dynamic_gateway_amt
     55from waeup.aaue.interswitch.browser import gateway_net_amt
    5656from waeup.aaue.interfaces import MessageFactory as _
    5757
     
    145145        text += '250.0 Naira Transaction Charge'
    146146        if self.context.p_category == 'schoolfee_incl' and academic_session:
    147             welfare_fee = academic_session.welfare_fee - dynamic_gateway_amt(
    148                 academic_session.welfare_fee)
    149             union_fee = academic_session.union_fee - dynamic_gateway_amt(
    150                 academic_session.union_fee)
     147            welfare_fee = gateway_net_amt(academic_session.welfare_fee)
     148            union_fee = gateway_net_amt(academic_session.union_fee)
    151149            text += (', %s Naira Student Welfare Assurance Fee and %s Naira Students\' Union Dues'
    152150                     % (welfare_fee, union_fee))
    153151        elif self.context.p_category in (
    154152            'clearance_incl', 'clearance_medical_incl') and academic_session:
    155             matric_gown_fee = academic_session.matric_gown_fee - dynamic_gateway_amt(
    156                 academic_session.matric_gown_fee)
    157             lapel_fee = academic_session.lapel_fee - dynamic_gateway_amt(
    158                 academic_session.lapel_fee)
     153            matric_gown_fee = gateway_net_amt(academic_session.matric_gown_fee)
     154            lapel_fee = gateway_net_amt(academic_session.lapel_fee)
    159155            text += (', %s Naira Matriculation Gown Fee and %s Naira Lapel/File Fee'
    160156                     % (matric_gown_fee, lapel_fee))
  • main/waeup.aaue/trunk/src/waeup/aaue/students/utils.py

    r13413 r13414  
    2424from waeup.kofa.accesscodes import create_accesscode
    2525from waeup.kofa.students.utils import trans
    26 from waeup.aaue.interswitch.browser import dynamic_gateway_amt
     26from waeup.aaue.interswitch.browser import gateway_net_amt
    2727from waeup.aaue.interfaces import MessageFactory as _
    2828
     
    145145                    # Otherwise we can't add somtehing
    146146                    amount = 0.0
    147                 amount += academic_session.matric_gown_fee + \
    148                     academic_session.lapel_fee - \
    149                     dynamic_gateway_amt(academic_session.matric_gown_fee) -\
    150                     dynamic_gateway_amt(academic_session.lapel_fee)
     147                amount += gateway_net_amt(academic_session.matric_gown_fee) + \
     148                    gateway_net_amt(academic_session.lapel_fee)
    151149        elif category == 'late_registration':
    152150            amount = academic_session.late_registration_fee
     
    183181                    # Otherwise we can't add somtehing
    184182                    amount = 0.0
    185                 amount += academic_session.welfare_fee + \
    186                     academic_session.union_fee - \
    187                     dynamic_gateway_amt(academic_session.welfare_fee) -\
    188                     dynamic_gateway_amt(academic_session.union_fee)
     183                amount += gateway_net_amt(academic_session.welfare_fee) + \
     184                    gateway_net_amt(academic_session.union_fee)
    189185        if amount in (0.0, None):
    190186            return _(u'Amount could not be determined.'), None
Note: See TracChangeset for help on using the changeset viewer.