Ignore:
Timestamp:
3 Dec 2015, 17:37:00 (9 years ago)
Author:
Henrik Bettermann
Message:

Configure application fee accounts.

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

Legend:

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

    r13527 r13532  
    4545HTTPS = True
    4646
    47 URL = '/paydirect/services/TransactionQueryWs.asmx'
    4847httplib.HTTPSConnection.debuglevel = 0
    4948
     
    5453    return 0.0
    5554
    56 def contr_agreement(student):
     55def contr_agreement_applicant(applicant):
     56    if applicant.__parent__.code[:2] in ('fp', 'pt'):
     57        return 'first'
     58    return 'second'
     59
     60def contr_agreement_student(student):
    5761    if student.current_mode == 'found' or student.current_mode.endswith('_pt'):
    5862        return 'first'
     
    6973    site_name = SITE_NAME
    7074    currency = CURRENCY
    71     pay_item_id = '101'
    72     product_id = PRODUCT_ID_PT
    7375    mac = '74424F1DFECD6058F153148255CDD55E16724B4F380ADB2C63C5D1D7A5675759010C8153DCB930AAF2D38903CBF7CE32B8A6BA2C16BBC46721DF2E3F3E4548E3'
    7476
     
    8082            self.redirect(self.url(self.context, '@@index'))
    8183            return
     84        if contr_agreement_applicant(self.context.__parent__) == 'first':
     85            self.product_id = PRODUCT_ID_PT
     86            self.pay_item_id = '101'
     87        else:
     88            self.product_id = PRODUCT_ID_REGULAR
     89            self.pay_item_id = '109'
    8290        xmldict = {}
    8391        provider_amt = 1000.0
     
    9199        xmldict['institution_amt'] = 100 * (
    92100            self.context.amount_auth - provider_amt - GATEWAY_AMT)
    93         xmldict['institution_item_name'] = self.context.p_category
     101        xmldict['institution_item_name'] = self.category
    94102        xmldict['institution_name'] = INSTITUTION_NAME
    95103        # Interswitch amount is not part of the xml data
     
    106114        hashargs = (
    107115            self.context.p_id +
    108             PRODUCT_ID_PT +
     116            self.product_id +
    109117            self.pay_item_id +
    110118            str(int(self.amount_auth)) +
     
    123131    site_name = SITE_NAME
    124132    currency = CURRENCY
    125     pay_item_id = '101'
     133    #pay_item_id = '101'
    126134    #mac = '74424F1DFECD6058F153148255CDD55E16724B4F380ADB2C63C5D1D7A5675759010C8153DCB930AAF2D38903CBF7CE32B8A6BA2C16BBC46721DF2E3F3E4548E3'
    127135    mac = '9718FA00B0F5070B388A9896ADCED9B2FB02D30F71E12E68BDADC63F6852A3496FF97D8A0F9DA9F753B911A49BB09BB87B55FD02046BD325C74C46C0123CF023'
     
    148156            self.redirect(self.url(self.context, '@@index'))
    149157            return
    150         if contr_agreement(student) == 'first':
     158        if contr_agreement_student(student) == 'first':
    151159            self.product_id = PRODUCT_ID_PT
    152160        else:
     
    187195        # Schoolfee
    188196        if self.context.p_category.startswith('schoolfee'):
    189             if contr_agreement(student) == 'first':
     197            if contr_agreement_student(student) == 'first':
    190198                # First agreement
    191199                provider_amt = 1900.0
     
    262270        # Clearance
    263271        elif self.context.p_category.startswith('clearance'):
    264             if contr_agreement(student) == 'first':
     272            if contr_agreement_student(student) == 'first':
    265273                # First agreement
    266274                if student.current_mode == 'found':
     
    408416    """
    409417    grok.context(ICustomApplicantOnlinePayment)
    410     product_id = PRODUCT_ID_PT
    411418    gateway_host = HOST
    412     gateway_url = URL
     419    gateway_url = '/paydirect/api/v1/gettransaction.json'
    413420    https = HTTPS
     421    mac = '74424F1DFECD6058F153148255CDD55E16724B4F380ADB2C63C5D1D7A5675759010C8153DCB930AAF2D38903CBF7CE32B8A6BA2C16BBC46721DF2E3F3E4548E3'
     422
     423    @property
     424    def product_id(self):
     425        if contr_agreement_applicant(self.context.__parent__) == 'first':
     426            return PRODUCT_ID_PT
     427        return PRODUCT_ID_REGULAR
    414428
    415429class CustomInterswitchPaymentRequestWebservicePageStudent(
     
    425439    @property
    426440    def product_id(self):
    427         if contr_agreement(self.context.student) == 'first':
     441        if contr_agreement_student(self.context.student) == 'first':
    428442            return PRODUCT_ID_PT
    429443        return PRODUCT_ID_REGULAR
  • main/waeup.aaue/trunk/src/waeup/aaue/interswitch/tests.py

    r13530 r13532  
    5959        super(InterswitchTestsApplicants, self).fill_correct_values()
    6060        self.browser.getControl(name="form.programme_type").value = ['regular']
    61         self.applicantscontainer.application_fee = 1000.0
     61        self.applicantscontainer.application_fee = 10000.0
    6262        self.browser.getControl(name="form.nationality").value = ['NG']
    6363        self.browser.getControl(name="transition").value = ['start']
    6464        self.browser.getControl("Save").click()
     65
     66    def test_interswitch_form_regular(self):
    6567        self.browser.getControl("Add online").click()
    6668        self.assertTrue('ticket created' in self.browser.contents)
    6769        #self.browser.getLink(value).click()
    6870        self.assertTrue('Amount Authorized' in self.browser.contents)
    69         self.assertTrue('<span>1000.0</span>' in self.browser.contents)
    70         self.payment_url = self.browser.url
    71 
    72     def test_interswitch_form(self):
    73         # Manager can access InterswitchForm
    74         self.browser.getLink("CollegePAY", index=0).click()
    75         self.assertTrue('Total Amount Authorized:' in self.browser.contents)
    76         self.assertTrue(
    77             '<input type="hidden" name="amount" value="100000" />'
     71        self.assertTrue('<span>10000.0</span>' in self.browser.contents)
     72        self.payment_url = self.browser.url
     73        # Manager can access InterswitchForm
     74        self.browser.getLink("CollegePAY", index=0).click()
     75        self.assertTrue('Total Amount Authorized:' in self.browser.contents)
     76        self.assertTrue(
     77            '<input type="hidden" name="amount" value="1000000" />'
     78            in self.browser.contents)
     79        self.assertTrue(
     80            'item_name="BT Education" item_amt="100000"'
     81            in self.browser.contents)
     82        self.assertTrue(
     83            'item_name="Application Fee" item_amt="875000" bank_id="117" acct_num="1010835352"'
     84            in self.browser.contents)
     85        self.assertTrue(
     86            '<input type="hidden" name="product_id" value="5845" />'
    7887            in self.browser.contents)
    7988        delta = timedelta(days=8)
Note: See TracChangeset for help on using the changeset viewer.