Ignore:
Timestamp:
23 May 2018, 05:45:13 (6 years ago)
Author:
Henrik Bettermann
Message:

Further customize payment components.

Location:
main/kofacustom.edopoly/trunk/src/kofacustom/edopoly
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/browser/pages.py

    r15000 r15015  
    3434    form_fields = grok.AutoFields(ICustomSessionConfiguration)
    3535
     36class CustomCertificatePage(CertificatePage):
     37    """Index page for certificates.
     38    """
     39    form_fields = grok.AutoFields(ICertificate).omit(
     40        'school_fee_2', 'school_fee_3', 'school_fee_4', 'ratio',
     41        'custom_textline_1', 'custom_textline_2',
     42        'custom_float_1', 'custom_float_2')
     43
     44class CustomCertificateManageFormPage(CertificateManageFormPage):
     45    """Manage the properties of a `Certificate` instance.
     46    """
     47    form_fields = grok.AutoFields(ICertificate).omit(
     48        'school_fee_2', 'school_fee_3', 'school_fee_4', 'ratio',
     49        'custom_textline_1', 'custom_textline_2',
     50        'custom_float_1', 'custom_float_2')
  • main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/interfaces.py

    r15013 r15015  
    8787        )
    8888
     89    certificate_fee = schema.Float(
     90        title = _(u'Certificate Fee'),
     91        default = 0.0,
     92        required = False,
     93        )
     94
    8995    def getSessionString():
    9096        """Returns the session string from the vocabulary.
  • main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/interswitch/browser.py

    r15009 r15015  
    3030from kofacustom.edopoly.interfaces import MessageFactory as _
    3131
    32 PRODUCT_ID = '6207' # must be provided by Interswitch
     32PRODUCT_ID = '7571' # must be provided by Interswitch
    3333SITE_NAME = 'edopoly-kofa.waeup.org'
    3434PROVIDER_ACCT = '0773411069'
     
    3737INSTITUTION_NAME = 'EdoPoly'
    3838CURRENCY = '566'
    39 GATEWAY_AMT = 300.0
    40 
    41 #POST_ACTION = 'https://webpay.interswitchng.com/paydirect/pay'
    42 POST_ACTION = 'https://sandbox.interswitchng.com/webpay/pay'
    43 #HOST = 'webpay.interswitchng.com'
    44 HOST = 'sandbox.interswitchng.com'
    45 #URL = '/paydirect/api/v1/gettransaction.json'
    46 URL = '/webpay/api/v1/gettransaction.json'
     39GATEWAY_AMT = 250.0
     40MAC = '672ABFB2F3755A7793DE545BDA00F44878DF59140B43A1E7DF16245D299F3108AFF65502F16D95256B3242B43CBC3F512A208EB1BA977080D65328800C49912C'
     41
     42POST_ACTION = 'https://webpay.interswitchng.com/paydirect/pay'
     43#POST_ACTION = 'https://sandbox.interswitchng.com/webpay/pay'
     44HOST = 'webpay.interswitchng.com'
     45#HOST = 'sandbox.interswitchng.com'
     46URL = '/paydirect/api/v1/gettransaction.json'
     47#URL = '/webpay/api/v1/gettransaction.json'
    4748
    4849httplib.HTTPSConnection.debuglevel = 0
     
    5859    currency = CURRENCY
    5960    product_id = PRODUCT_ID
    60     mac = 'CEF793CBBE838AA0CBB29B74D571113B4EA6586D3BA77E7CFA0B95E278364EFC4526ED7BD255A366CDDE11F1F607F0F844B09D93B16F7CFE87563B2272007AB3'  # must be provided by Interswitch
     61    mac = MAC
    6162
    6263    def update(self):
     
    7374        xmldict['provider_bank_id'] = PROVIDER_BANK_ID
    7475        xmldict['provider_item_name'] = PROVIDER_ITEM_NAME
     76        provider_amt = 0.0
     77        if self.context.p_category == 'ict_entre':
     78            provider_amt = 3000.0
     79        if self.context.p_category == 'clearance':
     80            provider_amt = 1500.0
     81        if self.context.p_category in ('transcript', 'certificate'):
     82            provider_amt = 2000.0
    7583        # Institution data
    7684        xmldict['institution_acct'] = '1015666713'
    7785        xmldict['institution_bank_id'] = '121'
    7886        xmldict['institution_amt'] = '0.0'
    79         provider_amt = 0.0
    8087        self.pay_item_id = '101' # must be provided by Interswitch
    8188        xmldict['provider_amt'] = 100 * provider_amt
     
    120127    site_name = SITE_NAME
    121128    currency = CURRENCY
    122     pay_item_id = '0000' # must be provided by Interswitch
    123     product_id = PRODUCT_ID
    124     mac = ''
     129    pay_item_id = '101' # must be provided by Interswitch
     130    product_id = PRODUCT_ID
     131    mac = MAC
    125132
    126133    def update(self):
     
    131138            return
    132139        xmldict = {}
    133         provider_amt = 400.0
    134         xmldict['institution_acct'] = '00000000000'
    135         xmldict['institution_bank_id'] = '00'
     140        provider_amt = 1000.0
     141        xmldict['institution_acct'] = '1015666713'
     142        xmldict['institution_bank_id'] = '121'
    136143        xmldict['detail_ref'] = self.context.p_id
    137144        xmldict['provider_amt'] = 100 * provider_amt
     
    171178    gateway_host = HOST
    172179    gateway_url = URL
    173     mac = 'CEF793CBBE838AA0CBB29B74D571113B4EA6586D3BA77E7CFA0B95E278364EFC4526ED7BD255A366CDDE11F1F607F0F844B09D93B16F7CFE87563B2272007AB3'
     180    mac = MAC
    174181
    175182class CustomInterswitchPaymentVerifyWebservicePageStudent(
     
    181188    gateway_host = HOST
    182189    gateway_url = URL
     190    mac = MAC
    183191
    184192class CustomInterswitchPaymentRequestWebservicePageApplicant(
     
    190198    gateway_host = HOST
    191199    gateway_url = URL
     200    mac = MAC
    192201
    193202class CustomInterswitchPaymentVerifyWebservicePageApplicant(
     
    199208    gateway_host = HOST
    200209    gateway_url = URL
     210    mac = MAC
  • main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/interswitch/tests.py

    r15000 r15015  
    5353    def test_interswitch_form(self):
    5454        # Manager can access InterswitchForm
     55        # School Fee
    5556        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    5657        self.browser.open(self.payments_path)
     
    7172        self.payment_url = self.browser.url
    7273        self.browser.getLink("CollegePAY", index=0).click()
    73         self.assertTrue('<input type="hidden" name="pay_item_id" value="0000" />' in
     74        self.assertTrue('<input type="hidden" name="pay_item_id" value="101" />' in
    7475                           self.browser.contents)
    7576        self.assertEqual(self.student.current_mode, 'ug_ft')
     
    7879            self.browser.contents)
    7980        self.assertTrue(
    80             'item_name="School Fee" item_amt="3985000" bank_id="00" acct_num="00000000"' in
     81            'item_name="Tuition Fee" item_amt="3975000" bank_id="121" acct_num="1015666713"' in
     82            self.browser.contents)
     83        # Clearance Fee
     84        self.browser.open(self.payments_path + '/addop')
     85        self.browser.getControl(name="form.p_category").value = ['clearance']
     86        self.browser.getControl("Create ticket").click()
     87        self.assertMatches('...ticket created...',
     88                           self.browser.contents)
     89        ctrl = self.browser.getControl(name='val_id')
     90        self.value = ctrl.options[1]
     91        self.browser.getLink(self.value).click()
     92        self.assertTrue(
     93            '<span>3456.0</span>' in self.browser.contents)
     94        self.payment_url = self.browser.url
     95        self.browser.getLink("CollegePAY", index=0).click()
     96        self.assertTrue('<input type="hidden" name="pay_item_id" value="101" />' in
     97                           self.browser.contents)
     98        self.assertTrue(
     99            '<input type="hidden" name="amount" value="345600" />' in
     100            self.browser.contents)
     101        self.assertTrue(
     102            'item_name="Acceptance Fee" item_amt="170600" bank_id="121" acct_num="1015666713"' in
    81103            self.browser.contents)
    82104
     
    92114        self.browser.open(self.payments_path + '/xyz')
    93115        self.browser.getLink("CollegePAY", index=0).click()
    94         self.assertMatches('...<input type="hidden" name="pay_item_id" value="0000" />...',
     116        self.assertMatches('...<input type="hidden" name="pay_item_id" value="101" />...',
    95117                           self.browser.contents)
    96118        self.assertMatches('...Total Amount Authorized:...',
  • main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/locales/en/LC_MESSAGES/waeup.kofa.po

    r15014 r15015  
    1414msgid "Academics"
    1515msgstr "Schools"
     16
     17#: school_fee_1
     18msgid "Initial School Fee"
     19msgstr "Tuition Fee"
     20
     21#: school_fee_2
     22msgid "Returning School Fee"
     23msgstr "Tuition Fee 2 (not used)"
     24
     25#: school_fee_3
     26msgid "Foreigner Initial School Fee"
     27msgstr "Tuition Fee 3 (not used)"
     28
     29#: school_fee_4
     30msgid "Foreigner Returning School Fee"
     31msgstr "Tuition Fee 4 (not used)"
  • main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/students/utils.py

    r15013 r15015  
    118118                return _('Study course data are incomplete.'), None
    119119            if previous_session:
    120                 # Students can pay for previous sessions in all
    121                 # workflow states.  Fresh students are excluded by the
    122                 # update method of the PreviousPaymentAddFormPage.
    123                 if previous_level == 100:
    124                     amount = getattr(certificate, 'school_fee_1', 0.0)
    125                 else:
    126                     amount = getattr(certificate, 'school_fee_2', 0.0)
     120                amount = getattr(certificate, 'school_fee_1', 0.0)
    127121            else:
    128                 if student.state == CLEARED:
    129                     amount = getattr(certificate, 'school_fee_1', 0.0)
    130                 elif student.state == RETURNING:
     122                amount = getattr(certificate, 'school_fee_1', 0.0)
     123                if student.state == RETURNING:
    131124                    # In case of returning school fee payment the
    132125                    # payment session and level contain the values of
     
    139132                            u'Session configuration object is not available.'
    140133                            ), None
    141                     amount = getattr(certificate, 'school_fee_2', 0.0)
     134                   
    142135                elif student.is_postgrad and student.state == PAID:
    143136                    # Returning postgraduate students also pay for the
     
    150143                            u'Session configuration object is not available.'
    151144                            ), None
    152                     amount = getattr(certificate, 'school_fee_2', 0.0)
    153145        elif category == 'clearance':
    154146            try:
     
    179171        elif category == 'siwess_combo':
    180172            amount = academic_session.siwess_combo_fee
     173        elif category == 'transcript':
     174            amount = academic_session.transcript_fee
     175        elif category == 'certificate':
     176            amount = academic_session.certificate_fee
    181177        if amount in (0.0, None):
    182178            return _('Amount could not be determined.'), None
  • main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/utils/utils.py

    r15013 r15015  
    3333        'ict_entre': 'ICT & Entrepreneur Fee',
    3434        'logbook_combo': 'Logbook Combo Fee',
    35         'siwess_combo': 'SIWESS Combo Fee'
     35        'siwess_combo': 'SIWESS Combo Fee',
     36        'transcript': 'Transcript Fee',
     37        'certificate': 'Certificate Fee',
    3638        }
    3739
Note: See TracChangeset for help on using the changeset viewer.