Все работает, кроме уведомления обратного вызова URL-адреса приемника, не работает. Ниже приведены коды в моем views.py
def view_that_asks_for_money(request):
# generating invoice id
total_invoices = 0
invoices_of_user = Invoice.objects.all().filter(user__username__exact=request.user.username)
if invoices_of_user:
total_invoices = len(invoices_of_user)
total_invoices += 1
invoice_key = request.user.username + "-" + str(total_invoices)
Invoice.objects.create(user=request.user, invoice_no=invoice_key)
print(invoice_key, reverse('paypal-ipn'))
valid_ipn_received.connect(receiver=show_me_the_money)
print(valid_ipn_received.receivers)
# What you want the button to do.
paypal_dict = {
"business": "osama.jameel.ahmad-facilitator@gmail.com",
"amount": "14.99",
"item_name": "One Month Premium Package",
"invoice": invoice_key,
"notify_url": "http://0.0.0.0:8000/" + reverse('paypal-ipn'),
"return_url": "http://0.0.0.0:8000/app/dashboard",
"cancel_return": "http://0.0.0.0:8000/app/change_password",
}
# Create the instance.
form = PayPalPaymentsForm(initial=paypal_dict)
context = {"form": form}
return render_to_response("core/payment.html", context)
@require_POST
@csrf_exempt
def ipn(request):
print("ipn(request)")
, а также метод получателя в views.py
def show_me_the_money(sender, **kwargs):
print("show_me_the_money: ")
ipn_obj = sender
print("show_me_the_money: " + ipn_obj.payment_status)
* 1006.* и следующие URL-адреса в моем urls.py
url(r'^paypal_ipn/', views.ipn, name="paypal-ipn"),
url(r'^something/paypal/', include('paypal.standard.ipn.urls')),
#patterns('paypal.standard.ipn.views',url(r'^paypal_notification/', 'ipn', name="paypal-ipn"),)
#url(r'^show_me_the_money/', core_views.show_me_the_money, name='show_me_the_money'),
url(r'^payment/', core_views.view_that_asks_for_money, name='paypal_page'),