Esempio n. 1
0
def ipn(request, reference_id):
    """ Process an IPN response from Amazon.
    """

    print "IPN", reference_id, request.POST

    if api.is_valid_signature(request.POST, request.build_absolute_uri()):
        _update_transaction(reference_id, request.POST)

    return HttpResponse('Thanks, Amazon!')
Esempio n. 2
0
def ipn(request, reference_id):
    """ Process an IPN response from Amazon.
    """
    
    print "IPN", reference_id, request.POST
    
    if api.is_valid_signature(request.POST, request.build_absolute_uri()):
        _update_transaction(reference_id, request.POST)
    
    return HttpResponse('Thanks, Amazon!')
Esempio n. 3
0
def complete(request, reference_id):
    """ Upon completion of a transaction, users are sent back to this URL.
    
        If SIMPLEPAY_COMPLETE_REDIRECT is defined in settings.py, the user will
        be redirected to this URL. Otherwise the simplepay.transaction_complete.html
        template will be displayed to the user.
    """
    
    if not api.is_valid_signature(request.META['QUERY_STRING'], request.build_absolute_uri()):
        return HttpResponseBadRequest('invalid parameters')
        
    _update_transaction(reference_id, request.GET)

    if REDIRECT:
        return HttpResponseRedirect(REDIRECT)
    return render_to_response('simplepay/transaction_complete.html')
Esempio n. 4
0
def complete(request, reference_id):
    """ Upon completion of a transaction, users are sent back to this URL.
    
        If SIMPLEPAY_COMPLETE_REDIRECT is defined in settings.py, the user will
        be redirected to this URL. Otherwise the simplepay.transaction_complete.html
        template will be displayed to the user.
    """

    if not api.is_valid_signature(request.META['QUERY_STRING'],
                                  request.build_absolute_uri()):
        return HttpResponseBadRequest('invalid parameters')

    _update_transaction(reference_id, request.GET)

    if REDIRECT:
        return HttpResponseRedirect(REDIRECT)
    return render_to_response('simplepay/transaction_complete.html')
Esempio n. 5
0
def abandon(request, reference_id):
    """ Users that cancel a transaction are passed to this URL by Amazon. Arguments that
        are passed are used to update the transaction and stored as a message from Amazon.
        
        If SIMPLEPAY_COMPLETE_REDIRECT is defined in settings.py, the user will
        be redirected to this URL. Otherwise the simplepay.transaction_complete.html
        template will be displayed to the user.
    """
    
    if not api.is_valid_signature(request.META['QUERY_STRING'], request.build_absolute_uri()):
        return HttpResponseBadRequest('invalid parameters')
        
    _update_transaction(reference_id, request.GET)

    if REDIRECT:
        return HttpResponseRedirect(SIMPLEPAY_COMPLETE_REDIRECT)
    return render_to_response('simplepay/transaction_abandoned.html')
Esempio n. 6
0
def abandon(request, reference_id):
    """ Users that cancel a transaction are passed to this URL by Amazon. Arguments that
        are passed are used to update the transaction and stored as a message from Amazon.
        
        If SIMPLEPAY_COMPLETE_REDIRECT is defined in settings.py, the user will
        be redirected to this URL. Otherwise the simplepay.transaction_complete.html
        template will be displayed to the user.
    """

    if not api.is_valid_signature(request.META['QUERY_STRING'],
                                  request.build_absolute_uri()):
        return HttpResponseBadRequest('invalid parameters')

    _update_transaction(reference_id, request.GET)

    if REDIRECT:
        return HttpResponseRedirect(SIMPLEPAY_COMPLETE_REDIRECT)
    return render_to_response('simplepay/transaction_abandoned.html')