简体   繁体   English

django-paypal 突然停止接收来自 Paypal 的信号

[英]django-paypal suddenly stop recieving signals from Paypal

I'm working on Paypal integration to my Django project using Django-Paypal package.I have successfully configured everything and it was working but suddenly the signals form PayPal has stopped.我正在使用 Django-Paypal 包将 Paypal 集成到我的 Django 项目中。我已经成功配置了所有内容并且它正在工作,但突然来自 PayPal 的信号停止了。

What issue can be occurred?会出现什么问题?

Here's what i have done:这是我所做的:

from view.py:从view.py:

def payment_process(request):
minutes = int(request.user.tagging.count()) * 5
testhours = minutes / 60
hours = str(round(testhours, 3))
# pdb.set_trace()
# What you want the button to do.
invoice = generate_cid()
userInfo = {
    "name": str(request.user.first_name + ' ' + request.user.last_name),
    "hours": str(hours),
    "taggedArticles": str(request.user.tagging.count())
}
paypal_dict = {
    "business": settings.PAYPAL_RECEIVER_EMAIL,
    "item_name": "Certificate of Completion from Nami Montana",
    "custom": userInfo,
    "invoice": str(invoice),
    "amount": "5.00",
    "notify_url": "https://6fd5e31b.ngrok.io/users/paypal/",
    # "return_url": "https://6fd5e31b.ngrok.io/users/profile/",
    "cancel_return": "https://6fd5e31b.ngrok.io/users/cancel/",
}
print(paypal_dict)
# Create the instance.
form = PayPalPaymentsForm(initial=paypal_dict)
context = {"form": form}
return render(request, "users/generateCert.html", context)

from urls.py:来自 urls.py:

urlpatterns = [
   url('^paypal/', include('paypal.standard.ipn.urls')),
   url('^profile/buildCertificate/$', views.CertificateProcess.as_view(), name='certificate'),
   url('^cancel/$', views.payment_canceled, name='cancel'),
   url('^done/$', views.payment_done, name='done'),
   url('^process/$', views.payment_process, name='payment'),
]

From signals.py:从signals.py:

def show_me_the_money(sender, **kwargs):
ipn_obj = sender
custom = ipn_obj.custom
# Undertake some action depending upon `ipn_obj`.
if ipn_obj.payment_status == ST_PP_COMPLETED:
    print('Get success signal')
    user_info = ast.literal_eval(ipn_obj.custom)
    if int(user_info['taggedArticles']) > 11:
        # here i need to generate and send a pdf file to the user in a new tab
        pass
else:
    print('Get fail signal')


payment_was_successful.connect(show_me_the_money)

Update: When I have tested it with live IPN sandbox it returns IPN was sent and the handshake was verified更新:当我使用实时 IPN 沙箱对其进行测试时,它返回IPN was sent and the handshake was verified


Payment is successfully depositing to the PayPal sandbox merchant account, only the signal is doing some problem.付款已成功存入 PayPal 沙盒商家帐户,只是信号有问题。

Help me, please!请帮帮我!

Thanks in advance!提前致谢!

I have the same problem.我有同样的问题。 My application worked and now it doesn't.我的应用程序有效,但现在无效。 I tried a lot of things (with python3.5 and not 3.6, delete all .pyc, uninstall and install django-paypa, change port...) It doesn't seem to change any thing.我尝试了很多东西(使用 python3.5 而不是 3.6,删除所有 .pyc,卸载并安装 django-paypa,更改端口......)它似乎没有改变任何事情。

I was giving up, but I recived all my signals in one time.我正在放弃,但我一次收到了所有的信号。 It was a lot of time after.过了很久。 I tried immediately after and nothing, no signals.之后我立即尝试,什么也没有,没有信号。

So, for me, the probleme is on paypal's server.所以,对我来说,问题出在贝宝的服务器上。 They takes time.他们需要时间。 We have to wait.我们必须等待。

I hope my experience helps you :)希望我的经验对你有帮助:)

Currently, it works normally for me (11 march 2018 11am).目前,它对我来说正常工作(2018 年 3 月 11 日上午 11 点)。 I hope it's the same for you :)我希望你也一样:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM