正在实施razorpay,出现上述错误。我需要在 razorpay api 中创建一个新客户。无法获得客户,因为它说错误无法获得客户。
from django.db import models
from customers.models import Customer
from django.db.models.signals import post_save,pre_save
import razorpay
client = razorpay.Client(auth=("", ""))
class BillingProfile(models.Model):
customer = models.OneToOneField(Customer,null=True,blank=True)
inserted = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
b_customer_id = models.CharField(max_length=120,null=True,blank=True)
def __str__(self):
return self.customer.name
def billing_profile_recieved(sender,instance,*args,**kwargs):
if not instance.b_customer_id and instance.customer:
print(instance.id,"OOOOOOOOOOOOOOOOOOOoo")
print(client,"------------------------------")
customer = client.customer.create(customer=instance.id) //_______ ERROR
print(customer)
pre_save.connect(billing_profile_recieved,sender=BillingProfile)
def user_created_reciever(sender,instance,created,*args,**kwargs):
if created:
BillingProfile.objects.get_or_create(customer=instance)
print(instance.user_customer,client)
post_save.connect(user_created_reciever, sender=Customer)