when I want to use the zeep package in django for the payment gateway, I face an error. error image, code image
callback function in views.py in shop app:
# Callback function
def callback(request):
if request.GET.get('Status') == 'NOK':
authority = request.GET.get('authority')
invoice = get_object_or_404(models.Invoice, authority=authority)
amount = 0
order = invoice.order
order_items = models.OrderItem.objects.filter(order=order)
for item in order_items:
amount += item.product_cost
result = client.service.PaymentVerification(MERCHANT, authority, amount)
if result.Status == 100:
return render(request, 'callback.html', {'invoice': invoice})
else:
return HttpResponse('error ' + str(result.Status))
else:
return HttpResponse('error ')
The zeep documentation shows that the object client
must be initialized as shown in the example listed on the site:
from zeep import Client, Settings
settings = Settings(strict=False, xml_huge_tree=True)
client = Client('http://my-wsdl/wsdl', settings=settings)
I suspect you either made a typo in defining it or just never did.