Ignore:
Timestamp:
9 Aug 2017, 14:03:33 (7 years ago)
Author:
Henrik Bettermann
Message:

The callback is a JSON response.

Do not trigger any action on students or applicants if payment was already paid.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/remita/webservices.py

    r14786 r14788  
    9696                continue
    9797            ticket = results[0]
     98            if ticket.p_state == 'waived':
     99                failed += 1
     100                continue
     101            waspaid = (ticket.p_state == 'paid')
    98102            success, msg, log = query_remita(
    99103                ticket, self.merchantId, self.api_key,
     
    105109                ticket.student.writeLogMessage(self, log)
    106110                successful += 1
    107                 write_payments_log(ticket.student.student_id, ticket)
    108                 flashtype, msg, log = ticket.doAfterStudentPayment()
    109                 if log is not None:
    110                     ticket.student.writeLogMessage(self, log)
     111                if not waspaid:
     112                    write_payments_log(ticket.student.student_id, ticket)
     113                    flashtype, msg, log = ticket.doAfterStudentPayment()
     114                    if log is not None:
     115                        ticket.student.writeLogMessage(self, log)
    111116            else:
    112117                applicant = ticket.__parent__
    113118                applicant.writeLogMessage(self, log)
    114119                successful += 1
    115                 write_payments_log(applicant.applicant_id, ticket)
    116                 flashtype, msg, log = ticket.doAfterApplicantPayment()
    117                 if log is not None:
    118                     applicant.writeLogMessage(self, log)
     120                if not waspaid:
     121                    write_payments_log(applicant.applicant_id, ticket)
     122                    flashtype, msg, log = ticket.doAfterApplicantPayment()
     123                    if log is not None:
     124                        applicant.writeLogMessage(self, log)
    119125        self.output = '%s (%s)' % (successful, failed + successful)
    120126        return
Note: See TracChangeset for help on using the changeset viewer.