Ignore:
Timestamp:
16 May 2024, 11:15:56 (4 months ago)
Author:
Henrik Bettermann
Message:

Customize serviceCodes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/etranzact/browser.py

    r17735 r17792  
    1717##
    1818
     19import os
     20import csv
    1921from kofacustom.nigeria.etranzact.applicantsbrowser import (
    2022    EtranzactPageApplicant, EtranzactReceiveResponseApplicant,
     
    324326CREDO_HOST = "api.credocentral.com"
    325327
     328scodes_path = os.path.join(
     329    os.path.dirname(__file__), 'servicecodes.csv')
     330reader = csv.DictReader(open(scodes_path, 'rb'))
     331SCODES = {line['p_category']:line['serviceCode'] for line in reader}
     332
    326333class CustomCredoPageStudent(CredoPageStudent):
    327334
     
    329336    api_public_key = API_PUBLIC_KEY
    330337
     338    @property
     339    def serviceCode(self):
     340        return SCODES.get(self.context.p_category, None)
     341
    331342class CustomCredoPageApplicant(CredoPageApplicant):
    332343
     
    334345    api_public_key = API_PUBLIC_KEY
    335346
     347    @property
     348    def serviceCode(self):
     349        return SCODES.get(self.context.p_category, None)
     350
    336351class CustomCredoVerifyPaymentStatusPageStudent(CredoVerifyPaymentStatusPageStudent):
    337352
Note: See TracChangeset for help on using the changeset viewer.