46 lines
2.0 KiB
Python
46 lines
2.0 KiB
Python
from sqlalchemy import Column, Integer, String, Float, DateTime, Boolean
|
|
from .database import Base
|
|
import datetime
|
|
|
|
|
|
|
|
|
|
class Customer(Base):
|
|
__tablename__ = "customers"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
account_number = Column(String(25))
|
|
customer_last_name = Column(String(250))
|
|
customer_first_name = Column(String(250))
|
|
customer_town = Column(String(140))
|
|
customer_state = Column(Integer)
|
|
customer_zip = Column(String(25))
|
|
customer_first_call = Column(DateTime)
|
|
customer_email = Column(String(500))
|
|
customer_automatic = Column(Integer)
|
|
customer_phone_number = Column(String(25))
|
|
customer_home_type = Column(Integer)
|
|
customer_apt = Column(String(140))
|
|
customer_address = Column(String(1000))
|
|
company_id = Column(Integer)
|
|
customer_latitude = Column(String(250))
|
|
customer_longitude = Column(String(250))
|
|
correct_address = Column(Boolean)
|
|
|
|
class Transaction(Base):
|
|
__tablename__ = "transactions"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
preauthorize_amount = Column(Float, nullable=True) # Amount preauthorized (for auth transactions)
|
|
charge_amount = Column(Float, nullable=True) # Final charge amount (for charge/capture transactions)
|
|
transaction_type = Column(Integer) # 0 = charge, 1 = auth, 3 = capture
|
|
status = Column(Integer) # 0 = approved, 1 = declined
|
|
auth_net_transaction_id = Column(String, unique=True, index=True, nullable=True)
|
|
customer_id = Column(Integer)
|
|
service_id = Column(Integer, nullable=True) # Reference to Service_Service.id
|
|
delivery_id = Column(Integer, nullable=True) # Reference to Delivery_Delivery.id
|
|
card_id = Column(Integer, nullable=True) # Reference to credit card used for payment
|
|
payment_gateway = Column(Integer, default=1) # 1 = Authorize.Net, 0 = Other
|
|
rejection_reason = Column(String, nullable=True) # Detailed error message when payment is declined
|
|
created_at = Column(DateTime, default=datetime.datetime.utcnow)
|