stuff changed:
- ui has been made 'kinda better' (after making it worse for a while lol - ESP rfid readers are now supported [ill upload the code for them in another repo later] - admin system has been secured a bit better and seems to be working well
This commit is contained in:
@@ -5,6 +5,7 @@ from datetime import datetime, timedelta
|
||||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
from ...core.database import get_db
|
||||
from ...core.datetime import unix_ms_utc, utc_now
|
||||
from ...models.models import Payment, PaymentStatus, PaymentMethod, User, Membership, MembershipStatus, MembershipTier
|
||||
from ...schemas import (
|
||||
PaymentCreate, PaymentUpdate, PaymentResponse, MessageResponse,
|
||||
@@ -121,7 +122,7 @@ async def update_payment(
|
||||
|
||||
# If marking as completed, set payment_date if not already set
|
||||
if update_data.get("status") == PaymentStatus.COMPLETED and not payment.payment_date:
|
||||
update_data["payment_date"] = datetime.utcnow()
|
||||
update_data["payment_date"] = utc_now()
|
||||
|
||||
for field, value in update_data.items():
|
||||
setattr(payment, field, value)
|
||||
@@ -182,7 +183,7 @@ async def process_square_payment(
|
||||
)
|
||||
|
||||
# Create a reference ID for tracking
|
||||
reference_id = f"user_{current_user.id}_tier_{tier.id}_{datetime.utcnow().timestamp()}"
|
||||
reference_id = f"user_{current_user.id}_tier_{tier.id}_{unix_ms_utc(utc_now())}"
|
||||
|
||||
# Process payment with Square
|
||||
square_result = await square_service.create_payment(
|
||||
@@ -204,7 +205,7 @@ async def process_square_payment(
|
||||
# Payment succeeded - create membership and payment records in a transaction
|
||||
try:
|
||||
# Calculate membership dates
|
||||
start_date = datetime.utcnow().date()
|
||||
start_date = utc_now().date()
|
||||
end_date = start_date + relativedelta(years=1)
|
||||
|
||||
# Create membership with ACTIVE status
|
||||
@@ -226,7 +227,7 @@ async def process_square_payment(
|
||||
payment_method=PaymentMethod.SQUARE,
|
||||
status=PaymentStatus.COMPLETED,
|
||||
transaction_id=square_result.get('payment_id'),
|
||||
payment_date=datetime.utcnow(),
|
||||
payment_date=utc_now(),
|
||||
notes=payment_request.note
|
||||
)
|
||||
db.add(payment)
|
||||
@@ -389,7 +390,7 @@ async def record_manual_payment(
|
||||
payment_method=payment_data.payment_method,
|
||||
notes=payment_data.notes,
|
||||
status=PaymentStatus.COMPLETED,
|
||||
payment_date=datetime.utcnow()
|
||||
payment_date=utc_now()
|
||||
)
|
||||
|
||||
db.add(payment)
|
||||
|
||||
Reference in New Issue
Block a user