Ignore:
Timestamp:
24 Jul 2014, 07:16:53 (10 years ago)
Author:
Henrik Bettermann
Message:

Use dictionary for special payment parameter configuration.

Location:
main/waeup.kwarapoly/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kwarapoly/trunk/CHANGES.txt

    r11768 r11769  
    441.2dev (unreleased)
    55===================
     6
     7* Use dictionary for special payment parameter configuration.
    68
    79* If the total amount (amount authorized) is less than 2000 Nairas
  • main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/interswitch/browser.py

    r11768 r11769  
    5050#URL = '/test_paydirect/services/TransactionQueryWs.asmx'
    5151httplib.HTTPConnection.debuglevel = 0
     52
     53
     54SPECIAL_PAYMENT_PARAMS = {
     55    'certificate': ('111', 200.0, 300.0, '7000016724', '9'),
     56    'state_result': ('112', 200.0, 300.0, '7000016724', '9'),
     57    'transcript_local': ('113', 200.0, 300.0, '7000016724', '9'),
     58    'transcript_foreign': ('114', 200.0, 300.0, '7000016724', '9'),
     59    'ver_result': ('115', 200.0, 300.0, '7000016724', '9'),
     60    'change_course': ('116', 200.0, 300.0, '7000016724', '9'),
     61    'change_inst': ('117', 200.0, 300.0, '7000016724', '9'),
     62    'jamb_reject': ('118', 200.0, 300.0, '7000016724', '9'),
     63    'cert_of_cert': ('119', 200.0, 300.0, '7000016724', '9'),
     64    'ref_let': ('120', 200.0, 300.0, '7000016724', '9'),
     65    'proc_cert': ('121', 200.0, 300.0, '7000016724', '9'),
     66    'loss_idcard': ('122', 6.0, 9.0, '7000016724', '9'),
     67    'loss_examcard': ('123', 3.0, 4.5, '7000016724', '9'),
     68    'loss_result': ('124', 200.0, 300.0, '7000016724', '9'),
     69    'loss_receipt': ('125', 200.0, 300.0, '7000016724', '9'),
     70    'loss_clearance': ('126', 200.0, 300.0, '7000016724', '9'),
     71    'conv_brochure': ('127', 200.0, 300.0, '7000016724', '9'),
     72    'hnd_certificate': ('128', 200.0, 300.0, '7000016724', '9'),
     73    'hnd_state_result': ('129', 200.0, 300.0, '7000016724', '9'),
     74    'hnd_transcript_local': ('130', 200.0, 300.0, '7000016724', '9'),
     75    'hnd_transcript_foreign': ('131', 200.0, 300.0, '7000016724', '9'),
     76    'staff_loss_idcard': ('132', 6.0, 9.0, '7000016724', '9'),
     77    'hnd_conv_brochure': ('133', 200.0, 300.0, '7000016724', '9'),
     78    'pgd_state_result': ('134', 200.0, 300.0, '7000016724', '9'),
     79    'pgd_conv_brochure': ('135', 200.0, 300.0, '7000016724', '9'),
     80    'pgd_certificate': ('136', 200.0, 300.0, '7000016724', '9'),
     81    'log_book': ('137', 3.0, 4.5, '1010508401', '117'),
     82    'pgd_transcript_foreign': ('138', 200.0, 300.0, '7000016724', '9'),
     83    'pgd_transcript_local': ('139', 200.0, 300.0, '7000016724', '9'),
     84    'jamb_regularization': ('140', 200.0, 300.0, '0838798020', '76'),
     85    }
    5286
    5387class CustomInterswitchPageStudent(InterswitchPageStudent):
     
    116150                xmldict['institution_bank_id'] = '8'
    117151                self.pay_item_id = '108'
    118         elif self.context.p_category == 'certificate':
    119             self.pay_item_id = '111'
    120         elif self.context.p_category == 'state_result':
    121             self.pay_item_id = '112'
    122         elif self.context.p_category == 'transcript_local':
    123             self.pay_item_id = '113'
    124         elif self.context.p_category == 'transcript_foreign':
    125             self.pay_item_id = '114'
    126         elif self.context.p_category == 'ver_result':
    127             self.pay_item_id = '115'
    128         elif self.context.p_category == 'change_course':
    129             self.pay_item_id = '116'
    130         elif self.context.p_category == 'change_inst':
    131             self.pay_item_id = '117'
    132         elif self.context.p_category == 'jamb_reject':
    133             self.pay_item_id = '118'
    134         elif self.context.p_category == 'cert_of_cert':
    135             self.pay_item_id = '119'
    136         elif self.context.p_category == 'ref_let':
    137             self.pay_item_id = '120'
    138         elif self.context.p_category == 'proc_cert':
    139             self.pay_item_id = '121'
    140         elif self.context.p_category == 'loss_idcard':
    141             self.pay_item_id = '122'
    142             dalash_amt = 6.0
    143             provider_amt = 9.0
    144             #gateway_amt = 15.0
    145             gateway_amt = round(0.015 * self.context.amount_auth, 2)
    146         elif self.context.p_category == 'loss_examcard':
    147             self.pay_item_id = '123'
    148             dalash_amt = 3.0
    149             provider_amt = 4.5
    150             #gateway_amt = 7.5
    151             gateway_amt = round(0.015 * self.context.amount_auth, 2)
    152         elif self.context.p_category == 'loss_result':
    153             self.pay_item_id = '124'
    154         elif self.context.p_category == 'loss_receipt':
    155             self.pay_item_id = '125'
    156         elif self.context.p_category == 'loss_clearance':
    157             self.pay_item_id = '126'
    158         elif self.context.p_category == 'conv_brochure':
    159             self.pay_item_id = '127'
    160         elif self.context.p_category == 'hnd_certificate':
    161             self.pay_item_id = '128'
    162         elif self.context.p_category == 'hnd_state_result':
    163             self.pay_item_id = '129'
    164         elif self.context.p_category == 'hnd_transcript_local':
    165             self.pay_item_id = '130'
    166         elif self.context.p_category == 'hnd_transcript_foreign':
    167             self.pay_item_id = '131'
    168         elif self.context.p_category == 'staff_loss_idcard':
    169             self.pay_item_id = '132'
    170             dalash_amt = 6.0
    171             provider_amt = 9.0
    172             #gateway_amt = 15.0
    173             gateway_amt = round(0.015 * self.context.amount_auth, 2)
    174         elif self.context.p_category == 'hnd_conv_brochure':
    175             self.pay_item_id = '133'
    176         elif self.context.p_category == 'pgd_state_result':
    177             self.pay_item_id = '134'
    178         elif self.context.p_category == 'pgd_conv_brochure':
    179             self.pay_item_id = '135'
    180         elif self.context.p_category == 'pgd_certificate':
    181             self.pay_item_id = '136'
    182         elif self.context.p_category == 'log_book':
    183             self.pay_item_id = '137'
    184             dalash_amt = 3.0
    185             provider_amt = 4.5
    186             #gateway_amt = 7.5
    187             gateway_amt = round(0.015 * self.context.amount_auth, 2)
    188             xmldict['institution_acct'] = "1010508401"
    189             xmldict['institution_bank_id'] = '117'
    190         elif self.context.p_category == 'pgd_transcript_foreign':
    191             self.pay_item_id = '138'
    192         elif self.context.p_category == 'pgd_transcript_local':
    193             self.pay_item_id = '139'
    194         elif self.context.p_category == 'jamb_regularization':
    195             self.pay_item_id = '140'
    196             xmldict['institution_acct'] = "0838798020"
    197             xmldict['institution_bank_id'] = '76'
     152        elif self.context.p_category in SPECIAL_PAYMENT_PARAMS.keys():
     153            self.pay_item_id = SPECIAL_PAYMENT_PARAMS[self.context.p_category][0]
     154            dalash_amt = SPECIAL_PAYMENT_PARAMS[self.context.p_category][1]
     155            provider_amt = SPECIAL_PAYMENT_PARAMS[self.context.p_category][2]
     156            xmldict['institution_acct'] = SPECIAL_PAYMENT_PARAMS[self.context.p_category][3]
     157            xmldict['institution_bank_id'] = SPECIAL_PAYMENT_PARAMS[self.context.p_category][4]
     158            if self.context.amount_auth <= 2000.0:
     159                gateway_amt = round(0.015 * self.context.amount_auth, 2)
    198160        elif 'maintenance' in self.context.p_category:
    199161            self.pay_item_id = '102'
     
    267229        dalash_amt = 200.0
    268230        gateway_amt = GATEWAY_AMT
     231        xmldict['institution_acct'] = '00000000000'
     232        xmldict['institution_bank_id'] = '00'
    269233        if self.applicant.applicant_id.startswith('hnd'):
    270234            xmldict['institution_acct'] = '1771440667'
     
    291255            dalash_amt = 0.0
    292256        elif self.applicant.applicant_id.startswith('special'):
    293             xmldict['institution_acct'] = "7000016724"
    294             xmldict['institution_bank_id'] = '9'
    295             if self.applicant.special_application == 'certificate':
    296                 self.pay_item_id = '111'
    297             elif self.applicant.special_application == 'state_result':
    298                 self.pay_item_id = '112'
    299             elif self.applicant.special_application == 'transcript_local':
    300                 self.pay_item_id = '113'
    301             elif self.applicant.special_application == 'transcript_foreign':
    302                 self.pay_item_id = '114'
    303             elif self.applicant.special_application == 'ver_result':
    304                 self.pay_item_id = '115'
    305             elif self.applicant.special_application == 'change_course':
    306                 self.pay_item_id = '116'
    307             elif self.applicant.special_application == 'change_inst':
    308                 self.pay_item_id = '117'
    309             elif self.applicant.special_application == 'jamb_reject':
    310                 self.pay_item_id = '118'
    311             elif self.applicant.special_application == 'cert_of_cert':
    312                 self.pay_item_id = '119'
    313             elif self.applicant.special_application == 'ref_let':
    314                 self.pay_item_id = '120'
    315             elif self.applicant.special_application == 'proc_cert':
    316                 self.pay_item_id = '121'
    317             elif self.applicant.special_application == 'loss_idcard':
    318                 self.pay_item_id = '122'
    319                 dalash_amt = 6.0
    320                 provider_amt = 9.0
    321                 #gateway_amt = 15.0
    322                 gateway_amt = round(0.015 * self.context.amount_auth, 2)
    323             elif self.applicant.special_application == 'loss_examcard':
    324                 self.pay_item_id = '123'
    325                 dalash_amt = 3.0
    326                 provider_amt = 4.5
    327                 #gateway_amt = 7.5
    328                 gateway_amt = round(0.015 * self.context.amount_auth, 2)
    329             elif self.applicant.special_application == 'loss_result':
    330                 self.pay_item_id = '124'
    331             elif self.applicant.special_application == 'loss_receipt':
    332                 self.pay_item_id = '125'
    333             elif self.applicant.special_application == 'loss_clearance':
    334                 self.pay_item_id = '126'
    335             elif self.applicant.special_application == 'conv_brochure':
    336                 self.pay_item_id = '127'
    337             elif self.applicant.special_application == 'hnd_certificate':
    338                 self.pay_item_id = '128'
    339             elif self.applicant.special_application == 'hnd_state_result':
    340                 self.pay_item_id = '129'
    341             elif self.applicant.special_application == 'hnd_transcript_local':
    342                 self.pay_item_id = '130'
    343             elif self.applicant.special_application == 'hnd_transcript_foreign':
    344                 self.pay_item_id = '131'
    345             elif self.applicant.special_application == 'staff_loss_idcard':
    346                 self.pay_item_id = '132'
    347                 dalash_amt = 6.0
    348                 provider_amt = 9.0
    349                 #gateway_amt = 15.0
    350                 gateway_amt = round(0.015 * self.context.amount_auth, 2)
    351             elif self.context.p_category == 'hnd_conv_brochure':
    352                 self.pay_item_id = '133'
    353             elif self.context.p_category == 'pgd_state_result':
    354                 self.pay_item_id = '134'
    355             elif self.context.p_category == 'pgd_conv_brochure':
    356                 self.pay_item_id = '135'
    357             elif self.context.p_category == 'pgd_certificate':
    358                 self.pay_item_id = '136'
    359             elif self.context.p_category == 'log_book':
    360                 self.pay_item_id = '137'
    361                 dalash_amt = 3.0
    362                 provider_amt = 4.5
    363                 #gateway_amt = 7.5
    364                 gateway_amt = round(0.015 * self.context.amount_auth, 2)
    365                 xmldict['institution_acct'] = "1010508401"
    366                 xmldict['institution_bank_id'] = '117'
    367             elif self.context.p_category == 'pgd_transcript_foreign':
    368                 self.pay_item_id = '138'
    369             elif self.context.p_category == 'pgd_transcript_local':
    370                 self.pay_item_id = '139'
    371             elif self.context.p_category == 'jamb_regularization':
    372                 self.pay_item_id = '140'
    373                 xmldict['institution_acct'] = "0838798020"
    374                 xmldict['institution_bank_id'] = '76'
    375             else:
    376                 xmldict['institution_acct'] = '00000000000'
    377                 xmldict['institution_bank_id'] = '00'
    378         else:
    379             xmldict['institution_acct'] = '00000000000'
    380             xmldict['institution_bank_id'] = '00'
     257            if self.context.p_category in SPECIAL_PAYMENT_PARAMS.keys():
     258                self.pay_item_id = SPECIAL_PAYMENT_PARAMS[self.context.p_category][0]
     259                dalash_amt = SPECIAL_PAYMENT_PARAMS[self.context.p_category][1]
     260                provider_amt = SPECIAL_PAYMENT_PARAMS[self.context.p_category][2]
     261                xmldict['institution_acct'] = SPECIAL_PAYMENT_PARAMS[self.context.p_category][3]
     262                xmldict['institution_bank_id'] = SPECIAL_PAYMENT_PARAMS[self.context.p_category][4]
     263                if self.context.amount_auth <= 2000.0:
     264                    gateway_amt = round(0.015 * self.context.amount_auth, 2)
    381265        xmldict['dalash_amt'] = 100 * dalash_amt
    382266        xmldict['detail_ref'] = self.context.p_id
  • main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/interswitch/tests.py

    r11768 r11769  
    628628            in self.browser.contents)
    629629
     630        self.special_applicant.special_application = u'log_book'
     631        self.configuration.log_book_fee = 570.5
     632        self.browser.open(self.special_manage_path)
     633        self.browser.getControl("Add online").click()
     634        self.assertMatches('...ticket created...',
     635                           self.browser.contents)
     636        self.browser.getLink("CollegePAY", index=0).click()
     637        # The university gets 570.5 - (1.5% x 570.5) - 3 - 4.5
     638        self.assertTrue(
     639            '<item_detail item_id="1" item_name="Log Book Fees" '
     640            'item_amt="55444" bank_id="117" acct_num="1010508401" />'
     641            in self.browser.contents)
     642
     643
    630644    @external_test
    631645    def test_webservice(self):
Note: See TracChangeset for help on using the changeset viewer.