Ignore:
Timestamp:
6 Jun 2012, 20:15:47 (13 years ago)
Author:
Henrik Bettermann
Message:

Customize amounts and bank data. pay_item_id and product_id still missing.

File:
1 edited

Legend:

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

    r8639 r8641  
    3434from waeup.fceokene.interfaces import MessageFactory as _
    3535
    36 PRODUCT_ID = '57'
     36PRODUCT_ID = '00'
    3737SITE_NAME = 'fceokene-kofa.waeup.org'
    38 PROVIDER_ACCT = '1010764827'
    39 PROVIDER_BANK_ID = '117'
     38PROVIDER_ACCT = '0026781725'
     39PROVIDER_BANK_ID = '31'
    4040PROVIDER_ITEM_NAME = 'BT Education'
     41ICT_ACCT = '6216801058'
     42ICT_BANK_ID = '117'
     43ICT_ITEM_NAME = 'FCEOkene ICT'
    4144INSTITUTION_NAME = 'FCEOkene'
    4245CURRENCY = '566'
     
    150153        return self.view.url(self.view.context, self.target)
    151154
    152 # Deprecated
    153 #class InterswitchRequestCallbackActionButtonStudent(RCABStudent):
    154 #    grok.order(3)
    155 #    grok.context(ICustomStudentOnlinePayment)
    156 #    icon = 'actionicon_call.png'
    157 #    text = _('Request CollegePAY callback')
    158 
    159 #    def target_url(self):
    160 #        if self.context.p_state == 'paid':
    161 #            return ''
    162 #        site_redirect_url = self.view.url(self.view.context, 'isw_callback')
    163 #        args = {
    164 #            'transRef':self.context.p_id,
    165 #            'prodID':PRODUCT_ID,
    166 #            'redirectURL':site_redirect_url}
    167 #        return QUERY_URL + '?%s' % urllib.urlencode(args)
    168 
    169 # Alternative preferred solution
    170155class InterswitchRequestWebserviceActionButtonStudent(APABStudent):
    171156    grok.order(2)
     
    183168    text = _('Requery CollegePAY')
    184169    target = 'request_webservice'
    185 
    186170
    187171class InterswitchPageStudent(KofaPage):
     
    229213        xmldict['provider_bank_id'] = PROVIDER_BANK_ID
    230214        xmldict['provider_item_name'] = PROVIDER_ITEM_NAME
    231         if student.current_mode.endswith('_ft') \
    232             and student.state == RETURNING:
    233             provider_amt = 600
    234         else:
    235             provider_amt = 1500
    236         xmldict['provider_amt'] = 100 * provider_amt
     215        xmldict['provider_amt'] = 100 * 1500
    237216        # Institution data
    238217        studycourse = student['studycourse']
    239         xmldict['institution_acct'] = ''
    240         xmldict['institution_bank_id'] = ''
    241         if student.current_mode.endswith('_ft'):
    242             #post-grad full-time students of all faculties
    243             if studycourse.current_level in ('700','710','800','810','900','910'):
    244                 xmldict['institution_acct'] = '1012842833'
    245                 xmldict['institution_bank_id'] = '117'
    246             #all other part-time students depending on faculty
    247             elif student.faccode in ('SSC','LAW','MED'):
    248                 xmldict['institution_acct'] = '0005986938'
    249                 xmldict['institution_bank_id'] = '31'
    250             elif student.faccode in ('ENG','PSC','PHA'):
    251                 xmldict['institution_acct'] = '0014413973'
    252                 xmldict['institution_bank_id'] = '129'
    253             elif student.faccode in ('LSC','DEN','AGR'):
    254                 xmldict['institution_acct'] = '1012801319'
    255                 xmldict['institution_bank_id'] = '117'
    256             elif student.faccode in ('ART','EDU','MGS','BMS'):
    257                 xmldict['institution_acct'] = '6220027556'
    258                 xmldict['institution_bank_id'] = '51'
    259         elif student.current_mode.endswith('_pt'):
    260             #post-grad part-time students of all faculties
    261             if studycourse.current_level in ('700','710','800','810','900','910'):
    262                 xmldict['institution_acct'] = '0023708207'
    263                 xmldict['institution_bank_id'] = '72'
    264             #all other part-time students depending on faculty
    265             elif student.faccode in ('ENG','LAW','MGS'):
    266                 xmldict['institution_acct'] = '2019006824'
    267                 xmldict['institution_bank_id'] = '8'
    268             elif student.faccode in ('IPA','PHA','SSC','AGR','EDU'):
    269                 xmldict['institution_acct'] = '0122012109'
    270                 xmldict['institution_bank_id'] = '16'
    271         xmldict['institution_amt'] = 100 * (self.amount_auth - provider_amt - 150)
     218        xmldict['institution_acct'] = '000000000000'
     219        xmldict['institution_bank_id'] = '00'
     220        xmldict['institution_amt'] = 100 * (self.amount_auth - 1500 - 150)
    272221        xmldict['institution_item_name'] = self.context.p_category
    273222        xmldict['institution_name'] = INSTITUTION_NAME
     
    295244    site_name = SITE_NAME
    296245    currency = CURRENCY
    297     pay_item_id = '5703'
     246    pay_item_id = '0000'
    298247    product_id = PRODUCT_ID
    299248
     
    312261            self.context.creation_date, tz).strftime("%Y-%m-%d %H:%M:%S %Z")
    313262        self.site_redirect_url = self.url(self.context, 'request_webservice')
     263        xmldict['detail_ref'] = self.context.p_id
    314264        # Provider data
    315         xmldict['detail_ref'] = self.context.p_id
    316         xmldict['provider_amt'] = 100 * 400
     265        xmldict['provider_amt'] = 100 * 365
    317266        xmldict['provider_acct'] = PROVIDER_ACCT
    318267        xmldict['provider_bank_id'] = PROVIDER_BANK_ID
    319268        xmldict['provider_item_name'] = PROVIDER_ITEM_NAME
     269        # ICT data
     270        xmldict['ict_amt'] = 100 * 135
     271        xmldict['ict_acct'] = ICT_ACCT
     272        xmldict['ict_bank_id'] = ICT_BANK_ID
     273        xmldict['ict_item_name'] = ICT_ITEM_NAME
    320274        # Institution data
    321         xmldict['institution_amt'] = 100 * (self.context.amount_auth - 400 - 150)
    322         xmldict['institution_acct'] = '0031716030'
    323         xmldict['institution_bank_id'] = '10'
     275        xmldict['institution_amt'] = 100 * (
     276            self.context.amount_auth - 365 - 150 - 135)
     277        xmldict['institution_acct'] = '1012415659'
     278        xmldict['institution_bank_id'] = '117'
    324279        xmldict['institution_item_name'] = self.context.p_category
    325280        xmldict['institution_name'] = INSTITUTION_NAME
     
    329284<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" />
    330285<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" />
     286<item_detail item_id="3" item_name="%(ict_item_name)s" item_amt="%(ict_amt)d" bank_id="%(ict_bank_id)s" acct_num="%(ict_acct)s" />
    331287</item_details>
    332288</payment_item_detail>""" % xmldict
     
    334290        return
    335291
    336 # Deprecated
    337 #class InterswitchPaymentCallbackPageStudent(UtilityView, grok.View):
    338 #    """ Callback view for the CollegePAY gateway
    339 #    """
    340 #    grok.context(ICustomStudentOnlinePayment)
    341 #    grok.name('isw_callback')
    342 #    grok.require('waeup.payStudent')
    343 
    344     # This view is not yet working for offline querying transactions
    345     # since the query string differs from the query string sent after
    346     # posting transactions. This Interswitch bug must be removed first.
    347     # Alternatively, we could use the webservice only and replace
    348     # the RequestCallbackActionButton by a RequestWebserviceActionButton
    349 
    350 #    def update(self):
    351 #        if self.context.p_state == 'paid':
    352 #            self.flash(_('This ticket has already been paid.'))
    353 #            return
    354 #        student = self.context.getStudent()
    355 #        query = self.request.form
    356 #        write_log_message(self,'callback received: %s' % query)
    357 #        self.context.r_card_num = query.get('cardNum', None)
    358 #        self.context.r_code = query.get('resp', None)
    359 #        self.context.r_pay_reference  = query.get('payRef', None)
    360 #        self.context.r_amount_approved = float(query.get('apprAmt', '0.0')) / 100
    361 #        self.context.r_desc = query.get('desc', None)
    362 #        if self.context.r_code != '00':
    363 #            self.flash(_('Unsuccessful callback: ${a}',
    364 #                mapping = {'a': query.get('desc', _('Incomplete query string.'))}))
    365 #            write_log_message(self,'unsuccessful callback: %s' % self.context.p_id)
    366 #            self.context.p_state = 'failed'
    367 #            return
    368 #        if self.context.r_amount_approved != payment.amount_auth:
    369 #            self.flash(_('Wrong amount'))
    370 #            write_log_message(
    371 #                self,'successful but wrong amount: %s' % self.context.p_id)
    372 #            self.context.p_state = 'failed'
    373 #            return
    374 #        try:
    375 #            validation_list = get_SOAP_response(
    376 #                PRODUCT_ID, self.context.p_id).split(':')
    377             # Validation does not make sense yet since the query string
    378             # formats are conflicting. We are only printing the validation
    379             # string, nothing else.
    380 #            print 'WARNING: Webservice validation is not yet implemented'
    381 #            print 'validation list: %s' % validation_list
    382 #        except:
    383 #            print 'Connection to webservice failed.'
    384         # Add webservice validation here
    385 #        write_log_message(self,'valid callback: %s' % self.context.p_id)
    386 #        self.context.p_state = 'paid'
    387 #        self.context.payment_date = datetime.utcnow()
    388 #        actions_after_student_payment(student, self.context, self)
    389 #        return
    390 
    391 #    def render(self):
    392 #        self.redirect(self.url(self.context, '@@index'))
    393 #        return
    394 
    395 # Alternative solution, replaces InterswitchPaymentCallbackPage
     292
    396293class InterswitchPaymentRequestWebservicePageStudent(UtilityView, grok.View):
    397294    """ Request webservice view for the CollegePAY gateway
Note: See TracChangeset for help on using the changeset viewer.