Ignore:
Timestamp:
9 Nov 2018, 07:56:13 (6 years ago)
Author:
Henrik Bettermann
Message:

Configure bridge payments. Reduce code redundancy.

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

    r15192 r15224  
    8080    provider_bank_id = PROVIDER_BANK_ID
    8181    provider_acct = PROVIDER_ACCT
     82    institution_acct = '1010835352'
     83    institution_bank_id = '117'
    8284
    8385    def update(self):
     
    102104                self.provider_bank_id = '10'
    103105                self.provider_acct = '0427773399'
     106            elif self.applicant.applicant_id.startswith('bridge',): # easier to test
     107                provider_amt = 2000.0
     108                self.institution_acct = '1014847058'
     109                self.institution_bank_id = '7'
     110
    104111        xmldict = {}
    105         xmldict['institution_acct'] = '1010835352'
    106         xmldict['institution_bank_id'] = '117'
    107112        xmldict['detail_ref'] = self.context.p_id
    108113        xmldict['provider_amt'] = 100 * provider_amt
     
    110115        xmldict['provider_bank_id'] = self.provider_bank_id
    111116        xmldict['provider_item_name'] = PROVIDER_ITEM_NAME
     117        xmldict['institution_acct'] = self.institution_acct
     118        xmldict['institution_bank_id'] = self.institution_bank_id
    112119        xmldict['institution_item_name'] = self.category
    113120        xmldict['institution_name'] = INSTITUTION_NAME
     121        xmldict['institution_amt'] = 100 * (
     122            self.context.amount_auth - provider_amt - GATEWAY_AMT)
     123        xmltext = """<payment_item_detail>
     124<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s">
     125<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" />
     126<item_detail item_id="2" item_name="%(provider_item_name)s" item_amt="%(provider_amt)d" bank_id="%(provider_bank_id)s" acct_num="%(provider_acct)s" />
     127</item_details>
     128</payment_item_detail>""" % xmldict
    114129
    115130        if self.applicant.applicant_id.startswith('pg'):
     
    123138<item_detail item_id="2" item_name="%(provider_item_name)s" item_amt="%(provider_amt)d" bank_id="%(provider_bank_id)s" acct_num="%(provider_acct)s" />
    124139<item_detail item_id="3" item_name="PG Handbook" item_amt="%(handbook_amount)d" bank_id="117" acct_num="1010827641" />
    125 </item_details>
    126 </payment_item_detail>""" % xmldict
    127 
    128         elif self.applicant.applicant_id.startswith('utme'):
    129             xmldict['provider_amt'] = 100 * provider_amt
    130             xmldict['institution_amt'] = 100 * (
    131                 self.context.amount_auth - provider_amt - GATEWAY_AMT)
    132             xmltext = """<payment_item_detail>
    133 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s">
    134 <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" />
    135 <item_detail item_id="2" item_name="%(provider_item_name)s" item_amt="%(provider_amt)d" bank_id="%(provider_bank_id)s" acct_num="%(provider_acct)s" />
    136 </item_details>
    137 </payment_item_detail>""" % xmldict
    138 
    139         else:
    140             xmldict['institution_amt'] = 100 * (
    141                 self.context.amount_auth - provider_amt - GATEWAY_AMT)
    142             xmltext = """<payment_item_detail>
    143 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s">
    144 <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" />
    145 <item_detail item_id="2" item_name="%(provider_item_name)s" item_amt="%(provider_amt)d" bank_id="%(provider_bank_id)s" acct_num="%(provider_acct)s" />
    146140</item_details>
    147141</payment_item_detail>""" % xmldict
  • main/waeup.aaue/trunk/src/waeup/aaue/interswitch/tests.py

    r15191 r15224  
    157157        self.assertTrue(
    158158            'This payment ticket is too old. Please create a new ticket'
     159            in self.browser.contents)
     160
     161    def test_interswitch_form_bridge(self):
     162        self.applicant.applicant_id = u'bridge_xyz'
     163        self.browser.getControl("Add online").click()
     164        self.assertTrue('ticket created' in self.browser.contents)
     165        #self.browser.getLink(value).click()
     166        self.assertTrue('Amount Authorized' in self.browser.contents)
     167        self.assertTrue('<span>10000.0</span>' in self.browser.contents)
     168        self.payment_url = self.browser.url
     169        # Manager can access InterswitchForm
     170        self.browser.getLink("CollegePAY", index=0).click()
     171        self.assertTrue('Total Amount Authorized:' in self.browser.contents)
     172        self.assertTrue(
     173            '<input type="hidden" name="amount" value="1000000" />'
     174            in self.browser.contents)
     175        self.assertTrue(
     176            'item_name="WAeAC" item_amt="200000"'
     177            in self.browser.contents)
     178        self.assertTrue(
     179            'item_name="Application Fee" item_amt="775000" bank_id="7" acct_num="1014847058"'
    159180            in self.browser.contents)
    160181
  • main/waeup.aaue/trunk/src/waeup/aaue/utils/utils.py

    r15217 r15224  
    145145        'ioe_dp': 'Institute of Education Diploma',
    146146        'ijmbe': 'IJMBE Preparation',
    147         'bridge': 'Bridge'
     147        'bridge': 'Bridge',
    148148        }
    149149
Note: See TracChangeset for help on using the changeset viewer.