Changeset 14121 for main


Ignore:
Timestamp:
24 Aug 2016, 06:03:58 (8 years ago)
Author:
Henrik Bettermann
Message:

Split pg application payments.

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

    r14088 r14121  
    103103        xmldict['provider_bank_id'] = PROVIDER_BANK_ID
    104104        xmldict['provider_item_name'] = PROVIDER_ITEM_NAME
    105         xmldict['institution_amt'] = 100 * (
    106             self.context.amount_auth - provider_amt - GATEWAY_AMT)
    107105        xmldict['institution_item_name'] = self.category
    108106        xmldict['institution_name'] = INSTITUTION_NAME
    109         # Interswitch amount is not part of the xml data
    110         xmltext = """<payment_item_detail>
     107
     108        if self.applicant.applicant_id.startswith('pg'):
     109            handbook_amount = 2000.0
     110            xmldict['handbook_amount'] = 100 * handbook_amount
     111            xmldict['institution_amt'] = 100 * (
     112                self.context.amount_auth - provider_amt - handbook_amount -GATEWAY_AMT)
     113            xmltext = """<payment_item_detail>
    111114<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s">
    112115<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" />
    113116<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" />
    114 </item_details>
    115 </payment_item_detail>""" % xmldict
     117<item_detail item_id="3" item_name="PG Handbook" item_amt="%(handbook_amount)d" bank_id="117" acct_num="1014270207" />
     118</item_details>
     119</payment_item_detail>""" % xmldict
     120
     121        else:
     122            xmldict['institution_amt'] = 100 * (
     123                self.context.amount_auth - provider_amt - GATEWAY_AMT)
     124            xmltext = """<payment_item_detail>
     125<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s">
     126<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" />
     127<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" />
     128</item_details>
     129</payment_item_detail>""" % xmldict
     130
    116131        self.xml_data = """<input type="hidden" name="xml_data" value='%s'  />""" % xmltext
    117132        self.context.provider_amt = provider_amt
  • main/waeup.aaue/trunk/src/waeup/aaue/interswitch/tests.py

    r14081 r14121  
    8282        self.assertTrue(
    8383            'item_name="Application Fee" item_amt="775000" bank_id="117" acct_num="1010835352"'
     84            in self.browser.contents)
     85        self.assertTrue(
     86            '<input type="hidden" name="product_id" value="5845" />'
     87            in self.browser.contents)
     88        delta = timedelta(days=8)
     89        self.applicant.values()[0].creation_date -= delta
     90        self.browser.open(self.payment_url)
     91        self.browser.getLink("CollegePAY", index=0).click()
     92        self.assertTrue(
     93            'This payment ticket is too old. Please create a new ticket'
     94            in self.browser.contents)
     95
     96    def test_interswitch_form_pg(self):
     97        self.applicant.applicant_id = u'pg_anything'
     98        self.browser.getControl("Add online").click()
     99        self.assertTrue('ticket created' in self.browser.contents)
     100        #self.browser.getLink(value).click()
     101        self.assertTrue('Amount Authorized' in self.browser.contents)
     102        self.assertTrue('<span>10000.0</span>' in self.browser.contents)
     103        self.payment_url = self.browser.url
     104        # Manager can access InterswitchForm
     105        self.browser.getLink("CollegePAY", index=0).click()
     106        self.assertTrue('Total Amount Authorized:' in self.browser.contents)
     107        self.assertTrue(
     108            '<input type="hidden" name="amount" value="1000000" />'
     109            in self.browser.contents)
     110        self.assertTrue(
     111            'item_name="BT Education" item_amt="200000"'
     112            in self.browser.contents)
     113        self.assertTrue(
     114            'item_name="Application Fee" item_amt="575000" bank_id="117" acct_num="1010835352"'
     115            in self.browser.contents)
     116        self.assertTrue(
     117            'item_name="PG Handbook" item_amt="200000" bank_id="117" acct_num="1014270207"'
    84118            in self.browser.contents)
    85119        self.assertTrue(
Note: See TracChangeset for help on using the changeset viewer.