Example #1
0
    def test_functions(self):

        # Test verify_session
        verified = verify_session(self.good_sessid)
        self.assertEqual(verified, True)

        verified = verify_session(self.junk_sessid)
        self.assertEqual(verified, False)

        # Test save_session
        save_session(self.junk_sessid)
        try:
            sess = IpaymuSessionID.objects.get(sessid=self.junk_sessid)
        except IpaymuSessionID.DoesNotExist:
            raise
        else:
            self.assertEqual(sess.sessid, self.junk_sessid)
Example #2
0
    def test_functions(self):

        # Test verify_session
        verified = verify_session(self.good_sessid)
        self.assertEqual(verified, True)

        verified = verify_session(self.junk_sessid)
        self.assertEqual(verified, False)

        # Test save_session
        save_session(self.junk_sessid)
        try:
            sess = IpaymuSessionID.objects.get(sessid=self.junk_sessid)
        except IpaymuSessionID.DoesNotExist:
            raise
        else:
            self.assertEqual(sess.sessid, self.junk_sessid)
Example #3
0
def notify(request):
    """
    This view point will be called by the iPaymu server on the background to notify
    the transaction has been success.
    """
    if request.method == 'POST':
        # Excecute callback if session ID verified.
        # Since we did't disable CSRF protection for this view.
        if(verify_session(request.POST.get('sid'))):
            execute_callback('notification_received', request, dict(request.POST))
    # Just return an empty response to avoid No Response error
    return HttpResponse('')
Example #4
0
def notify(request):
    """
    This view point will be called by the iPaymu server on the background to notify
    the transaction has been success.
    """
    if request.method == 'POST':
        # Excecute callback if session ID verified.
        # Since we did't disable CSRF protection for this view.
        if (verify_session(request.POST.get('sid'))):
            execute_callback('notification_received', request,
                             dict(request.POST))
    # Just return an empty response to avoid No Response error
    return HttpResponse('')