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

Configure application fee accounts.

File:
1 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
Note: See TracChangeset for help on using the changeset viewer.