Ignore:
Timestamp:
4 Aug 2017, 05:04:42 (7 years ago)
Author:
Henrik Bettermann
Message:

Rename template which can also be used for applicants.

Define templatedir.

Location:
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/remita
Files:
2 edited
1 moved

Legend:

Unmodified
Added
Removed
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/remita/browser_templates/goto_remita.pt

    r14764 r14765  
    3535          Customer Name:</td>
    3636        <td>
    37           <span tal:replace="view/student/display_fullname">CUSTNAME</span>
     37          <span tal:replace="view/customer/display_fullname">CUSTNAME</span>
    3838        </td>
    3939      </tr>
     
    4242          Email Address:</td>
    4343        <td>
    44           <span tal:replace="view/student/email">EMAIL</span>
     44          <span tal:replace="view/customer/email">EMAIL</span>
    4545        </td>
    4646      </tr>
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/remita/studentsbrowser.py

    r14764 r14765  
    2727from waeup.kofa.students.interfaces import IStudentsUtils
    2828from waeup.kofa.students.browser import OnlinePaymentDisplayFormPage as OPDPStudent
    29 from waeup.kofa.applicants.browser import OnlinePaymentDisplayFormPage as OPDPApplicant
    3029from kofacustom.nigeria.remita.helpers import (
    3130    get_JSON_POST_response, query_remita, write_payments_log)
    3231from kofacustom.nigeria.payments.interfaces import INigeriaOnlinePayment
    3332from kofacustom.nigeria.students.interfaces import INigeriaStudentOnlinePayment
    34 from kofacustom.nigeria.applicants.interfaces import INigeriaApplicantOnlinePayment
    3533from kofacustom.nigeria.interfaces import MessageFactory as _
     34
     35grok.templatedir('browser_templates')
    3636
    3737def module_activated(session):
     
    123123            self.flash(_('Remita Retrieval Reference not found.'), type='danger')
    124124            return
    125 
    126125        # Remita sends a POST request which may contain more information
    127126        # if a payment was not successful.
     
    130129            self.flash('Transaction status message from Remita: %s'
    131130                % resp.get('status'), type='warning')
    132 
    133131        success, msg, log = query_remita(
    134132            self.context,
     
    139137            self.https,
    140138            False)
    141 
    142139        student.writeLogMessage(self, log)
    143140        if not success:
     
    160157    grok.context(INigeriaStudentOnlinePayment)
    161158    grok.name('verify_payment_status')
    162     grok.require('waeup.payStudent')
     159    grok.require('waeup.manageStudent')
    163160
    164161    # Here we use Remita test portal data
     
    180177            self.flash(_('Remita Retrieval Reference not found.'), type='danger')
    181178            return
    182 
    183179        # Remita sends a POST request which may contain more information
    184180        # if a payment was not successful.
     
    187183            self.flash('Transaction status message from Remita: %s'
    188184                % resp.get('status'), type='warning')
    189 
    190185        success, msg, log = query_remita(
    191186            self.context,
     
    196191            self.https,
    197192            True)
    198 
    199193        student.writeLogMessage(self, log)
    200194        if not success:
    201195            self.flash(msg, type='danger')
    202196            return
    203         write_payments_log(student.student_id, self.context)
    204         flashtype, msg, log = self.context.doAfterStudentPayment()
    205         if log is not None:
    206             student.writeLogMessage(self, log)
    207         self.flash(msg, type=flashtype)
     197        self.flash(msg)
    208198        return
    209199
     
    220210    grok.context(INigeriaOnlinePayment)
    221211    grok.name('goto_remita')
    222     grok.template('student_goto_remita')
     212    grok.template('goto_remita')
    223213    grok.require('waeup.payStudent')
    224214    label = _('Pay via Remita')
     
    255245        if time_delta.days > 7:
    256246            return _("This payment ticket is too old. Please create a new ticket.")
    257         student = self.context.student
    258         certificate = getattr(student['studycourse'],'certificate',None)
     247        certificate = getattr(self.context.student['studycourse'],'certificate',None)
    259248        if certificate is None:
    260249            return _("Study course data are incomplete.")
    261250        kofa_utils = getUtility(IKofaUtils)
    262251        student_utils = getUtility(IStudentsUtils)
    263         if student_utils.samePaymentMade(student, self.context.p_category,
     252        if student_utils.samePaymentMade(self.context.student, self.context.p_category,
    264253            self.context.p_item, self.context.p_session):
    265254            return _("This type of payment has already been made.")
    266255        self.responseurl = self.url(self.context, 'request_payment_status')
    267         self.student = student
    268256        resp = get_JSON_POST_response(
    269257            merchantId=self.merchantId,
     
    276264            url=self.init_url,
    277265            https=self.https,
    278             fullname=self.student.display_fullname,
    279             email=self.student.email,
     266            fullname=self.context.student.display_fullname,
     267            email=self.context.student.email,
    280268            lineitems=self.lineitems)
    281269        if resp.get('error'):
     
    288276        hashargs =      self.merchantId + self.rrr + self.api_key
    289277        self.hashvalue = hashlib.sha512(hashargs).hexdigest()
     278        self.customer = self.context.student
    290279        return
    291280
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/remita/tests.py

    r14756 r14765  
    122122
    123123    # successful transaction
    124     # (hopefully this transaction remain in the Remita database)
     124    # (hopefully this transaction remains in the Remita database)
    125125    orderId = '3456346346'
    126126    rrr = u'280007640804'
     
    185185    @external_test
    186186    def test_remita_form(self):
    187         # Manager can access InterswitchForm
     187        # Manager can access Remita form
    188188        self.browser.getLink("Pay via Remita").click()
    189189        # The RRR has been retrieved
     
    197197    @external_test
    198198    def test_requery_verify_payment_status(self):
    199         # Manager can access InterswitchForm
     199        # Manager can access Remita form
    200200        self.browser.getLink("Requery Remita Payment Status").click()
    201201        self.assertTrue('Remita Retrieval Reference not found.'
     
    216216        self.assertEqual(self.payment.r_code, '01')
    217217        self.browser.getLink("Verify Remita Payment Status").click()
    218         self.assertTrue('Successful payment' in self.browser.contents)
     218        self.assertTrue('Successful callback received' in self.browser.contents)
    219219        return
Note: See TracChangeset for help on using the changeset viewer.