215 lines
10 KiB
Python
215 lines
10 KiB
Python
|
from django.db import models
|
||
|
|
||
|
from django.contrib.auth.models import User
|
||
|
import uuid
|
||
|
import os
|
||
|
import time
|
||
|
import datetime
|
||
|
|
||
|
from django.db.models.fields import CharField
|
||
|
from lpp.models import MNFLPPDDatabase
|
||
|
from pytz import timezone
|
||
|
# Create your models here.
|
||
|
|
||
|
|
||
|
class privilegedUser(models.Model):
|
||
|
user = models.ForeignKey(User, on_delete=models.CASCADE)
|
||
|
amount = models.IntegerField(default=0)
|
||
|
payment_status = models.CharField(max_length=100, blank=True)
|
||
|
is_active = models.CharField(max_length=100, blank=True)
|
||
|
dateSubscribed = models.DateTimeField(auto_now=True)
|
||
|
paymentId = models.CharField(max_length=100, blank=True)
|
||
|
orderId = models.CharField(max_length=100, blank=True)
|
||
|
razorpaySign = models.CharField(max_length=100, blank=True)
|
||
|
memberType = models.CharField(max_length=100, blank=True)
|
||
|
subId = models.CharField(max_length=100, blank=True)
|
||
|
months = models.IntegerField(default=0)
|
||
|
plan_id = models.CharField(max_length=100, blank=True)
|
||
|
paid_count = models.CharField(max_length=100, blank=True)
|
||
|
current_start = models.CharField(max_length=100, blank=True)
|
||
|
auth_attempts = models.CharField(max_length=100, blank=True)
|
||
|
totalCount = models.CharField(max_length=100, blank=True)
|
||
|
remainingCount = models.CharField(max_length=100, blank=True)
|
||
|
shortURL = models.CharField(max_length=100, blank=True)
|
||
|
|
||
|
|
||
|
class LifeMember(models.Model):
|
||
|
user = models.ForeignKey(User, on_delete=models.CASCADE)
|
||
|
is_active = models.CharField(max_length=100, blank=True)
|
||
|
dateSubscribed = models.DateTimeField(auto_now=True)
|
||
|
months = models.IntegerField(default=120)
|
||
|
paymentId = models.CharField(max_length=100, blank=True)
|
||
|
orderId = models.CharField(max_length=100, blank=True)
|
||
|
razorpaySign = models.CharField(max_length=100, blank=True)
|
||
|
|
||
|
|
||
|
class refer(models.Model):
|
||
|
refer_id = models.UUIDField(
|
||
|
primary_key=True, default=uuid.uuid4, editable=False)
|
||
|
refer_user = models.ForeignKey(User, on_delete=models.CASCADE)
|
||
|
refer_name1 = models.CharField(max_length=100, blank=True, null=True)
|
||
|
refer_email1 = models.CharField(max_length=100, blank=True, null=True)
|
||
|
|
||
|
|
||
|
class gift(models.Model):
|
||
|
gift_id = models.CharField(max_length=100, blank=True)
|
||
|
PhoneNumber = models.CharField(max_length=100, blank=True, null=True)
|
||
|
user = models.ForeignKey(User, on_delete=models.CASCADE)
|
||
|
name = models.CharField(max_length=100, blank=True)
|
||
|
email = models.CharField(max_length=100, blank=True)
|
||
|
plan = models.CharField(max_length=100, blank=True)
|
||
|
token = models.CharField(max_length=100, blank=True)
|
||
|
payment_id = models.CharField(max_length=100, default="", blank=True)
|
||
|
order_id = models.CharField(max_length=100, default="", blank=True)
|
||
|
is_paid = models.CharField(max_length=100, default='no', blank=True)
|
||
|
transactionID = models.CharField(max_length=100, default="", blank=True)
|
||
|
chargeID = models.CharField(max_length=100, default="", blank=True)
|
||
|
receipt = models.CharField(max_length=1000, default="", blank=True)
|
||
|
|
||
|
|
||
|
class privilegedUser1(models.Model):
|
||
|
# id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||
|
id = models.IntegerField(primary_key=True)
|
||
|
user = models.ForeignKey(User, on_delete=models.CASCADE,related_name="payment_user")
|
||
|
rmuser = models.IntegerField(blank=True, null=True)
|
||
|
is_active = models.CharField(
|
||
|
max_length=100, blank=True, default="") # yes/no
|
||
|
dateSubscribed = models.DateTimeField(auto_now=True)
|
||
|
transactionId = models.CharField(max_length=100, blank=True, default="")
|
||
|
chargeId = models.CharField(max_length=100, blank=True, default="")
|
||
|
razorpaySign = models.CharField(max_length=100, blank=True, default="")
|
||
|
# normal, yearly, Life Member
|
||
|
memberType = models.CharField(max_length=100, blank=True, default="")
|
||
|
months = models.IntegerField(default=0)
|
||
|
amount_captured = models.CharField(max_length=100, blank=True, default="")
|
||
|
amount_refunded = models.CharField(max_length=100, blank=True, default="")
|
||
|
application = models.CharField(max_length=100, blank=True, default="")
|
||
|
application_fee_amount = models.CharField(
|
||
|
max_length=100, blank=True, default="")
|
||
|
city = models.CharField(max_length=100, blank=True, default="")
|
||
|
country = models.CharField(max_length=100, blank=True, default="")
|
||
|
line1 = models.CharField(max_length=100, blank=True, default="")
|
||
|
line2 = models.CharField(max_length=100, blank=True, default="")
|
||
|
postal_code = models.CharField(max_length=100, blank=True, default="")
|
||
|
state = models.CharField(max_length=100, blank=True, default="")
|
||
|
email = models.CharField(max_length=100, blank=True, default="")
|
||
|
name = models.CharField(max_length=100, blank=True, default="")
|
||
|
phone = models.CharField(max_length=100, blank=True, default="")
|
||
|
currency = models.CharField(max_length=100, blank=True, default="")
|
||
|
created = models.CharField(max_length=100, blank=True, default="")
|
||
|
customer = models.CharField(max_length=100, blank=True, default="")
|
||
|
invoice = models.CharField(max_length=100, blank=True, default="")
|
||
|
paid = models.CharField(max_length=100, blank=True, default="")
|
||
|
card_brand = models.CharField(max_length=100, blank=True, default="")
|
||
|
card_country = models.CharField(max_length=100, blank=True, default="")
|
||
|
card_exp = models.CharField(max_length=100, blank=True, default="")
|
||
|
card_funding = models.CharField(max_length=100, blank=True, default="")
|
||
|
receipt_email = models.CharField(max_length=100, blank=True, default="")
|
||
|
receipt_url = models.CharField(max_length=100, blank=True, default="")
|
||
|
status = models.CharField(max_length=100, blank=True, default="")
|
||
|
|
||
|
|
||
|
class conversionPayment(models.Model):
|
||
|
pid = models.ManyToManyField(privilegedUser1)
|
||
|
script_title = models.CharField(max_length=100, blank=True, default="")
|
||
|
script_id = models.CharField(max_length=100, blank=True, default="")
|
||
|
dial_src_language = models.CharField(
|
||
|
max_length=100, blank=True, default="")
|
||
|
nondial_src_language = models.CharField(
|
||
|
max_length=100, blank=True, default="")
|
||
|
dial_dest_language = models.CharField(
|
||
|
max_length=100, blank=True, default="")
|
||
|
nondial_dest_language = models.CharField(
|
||
|
max_length=100, blank=True, default="")
|
||
|
dual_dial_script = models.CharField(max_length=100, blank=True, default="")
|
||
|
to_be_vetted_by_lpp = models.CharField(
|
||
|
max_length=100, blank=True, default="")
|
||
|
# assigned_to = models.OneToOneField(MNFLPPDDatabase, on_delete=models.CASCADE)
|
||
|
date_of_original_script = models.CharField(
|
||
|
max_length=100, blank=True, default="")
|
||
|
date_of_translated_script = models.CharField(
|
||
|
max_length=100, blank=True, default="")
|
||
|
deadline = models.CharField(max_length=100, blank=True, default="")
|
||
|
payment_intent_id = models.CharField(
|
||
|
max_length=100, blank=True, default="")
|
||
|
genre = models.CharField(max_length=100, blank=True, default="")
|
||
|
quality = models.CharField(max_length=100, blank=True, default="")
|
||
|
amount_for_system = models.CharField(
|
||
|
max_length=100, blank=True, default="")
|
||
|
amount_for_lpp = models.CharField(max_length=100, blank=True, default="")
|
||
|
discount = models.CharField(max_length=100, blank=True, default="")
|
||
|
total_amount = models.CharField(max_length=100, blank=True, default="")
|
||
|
has_paid = models.CharField(max_length=100, blank=True, default="")
|
||
|
script_file_path = models.CharField(max_length=100, blank=True, default="")
|
||
|
translated_file_path = models.CharField(
|
||
|
max_length=100, blank=True, default="")
|
||
|
vetted_by_lpp_path = models.CharField(
|
||
|
max_length=100, blank=True, default="")
|
||
|
|
||
|
|
||
|
MEMBERSHIP_CHOICES = (
|
||
|
("Monthly plan", "Monthly plan"),
|
||
|
("yearly", "yearly"),
|
||
|
("Monthly special", "Monthly special"),
|
||
|
("yearly special", "yearly special"),
|
||
|
("Life", "Life"),
|
||
|
|
||
|
)
|
||
|
|
||
|
|
||
|
class PromoCode(models.Model):
|
||
|
PromoCode = models.CharField(max_length=100, unique=True, blank=True)
|
||
|
Discount = models.IntegerField(default=20)
|
||
|
MembershipType = models.CharField(
|
||
|
max_length=100, choices=MEMBERSHIP_CHOICES, blank=True)
|
||
|
ValidFrom = models.DateTimeField(auto_now=True)
|
||
|
ValidTill = models.DateTimeField()
|
||
|
status = models.CharField(
|
||
|
max_length=100, blank=True, default="Deactivated")
|
||
|
CountsAllowed = models.IntegerField(default=1)
|
||
|
CountsUsed = models.IntegerField(default=0)
|
||
|
|
||
|
|
||
|
class Refund(models.Model):
|
||
|
status = (("Accept", "Accept"), ("Reject", "Reject"),
|
||
|
("Pending", "Pending"), ("Failed", "Failed"))
|
||
|
methods = (("Stripe", "Stripe"), ("Razorpay", "Razorpay"))
|
||
|
|
||
|
r_id = models.UUIDField(
|
||
|
primary_key=True, default=uuid.uuid4, editable=False)
|
||
|
|
||
|
payment_method = models.CharField(max_length=100, choices=methods)
|
||
|
|
||
|
payment_id = models.CharField(
|
||
|
max_length=1000, unique=True, blank=True, null=True)
|
||
|
service_name = models.CharField(
|
||
|
max_length=1000, unique=True, blank=True, null=True)
|
||
|
service_id = models.CharField(
|
||
|
max_length=1000, unique=True, blank=True, null=True)
|
||
|
claimed_user = models.ForeignKey(User, on_delete=models.CASCADE)
|
||
|
amount = models.DecimalField(max_digits=10, decimal_places=2)
|
||
|
reason = models.TextField()
|
||
|
status = models.CharField(max_length=100, choices=status)
|
||
|
created = models.DateTimeField(auto_now_add=True, blank=True, null=True)
|
||
|
updated = models.DateTimeField(auto_now=True, blank=True, null=True)
|
||
|
|
||
|
def __str__(self) -> str:
|
||
|
return str(self.payment_id)
|
||
|
|
||
|
class Qr_Payment(models.Model):
|
||
|
qr_id = models.UUIDField(
|
||
|
primary_key=True, default=uuid.uuid4, editable=False)
|
||
|
date_at = models.DateField(auto_now_add=True)
|
||
|
# id = models.IntegerField(primary_key=True)
|
||
|
user_id = models.ForeignKey(User, on_delete=models.CASCADE)
|
||
|
amount = models.DecimalField(max_digits=10, decimal_places=2)
|
||
|
name = models.CharField(
|
||
|
max_length=200, unique=True, blank=True, null=True)
|
||
|
phone = models.CharField(
|
||
|
max_length=200, unique=True, blank=True, null=True)
|
||
|
email = models.CharField(
|
||
|
max_length=200, unique=True, blank=True, null=True)
|
||
|
giftId = models.CharField(
|
||
|
max_length=1000, unique=True, blank=True, null=True)
|
||
|
status = models.BooleanField(default=False)
|