Working site
This commit is contained in:
@@ -1,14 +1,23 @@
|
|||||||
FROM python:3.9
|
FROM python:3.9
|
||||||
ENV PYTHONFAULTHANDLER=1
|
ENV PYTHONFAULTHANDLER=1
|
||||||
|
|
||||||
ENV PYTHONUNBUFFERED=1
|
ENV PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
ENV MODE="LOCAL"
|
ENV MODE="LOCAL"
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Install Chrony (modern NTP implementation)
|
||||||
|
RUN apt-get update && apt-get install -y chrony
|
||||||
|
|
||||||
|
# Configure Chrony NTP servers
|
||||||
|
RUN echo "server time.nist.gov iburst" >> /etc/chrony/chrony.conf
|
||||||
|
RUN echo "server pool.ntp.org iburst" >> /etc/chrony/chrony.conf
|
||||||
|
|
||||||
|
# Copy and install Python dependencies
|
||||||
COPY requirements.txt requirements.txt
|
COPY requirements.txt requirements.txt
|
||||||
RUN pip install -r requirements.txt
|
RUN pip install -r requirements.txt
|
||||||
|
|
||||||
|
# Copy source code
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
# Start Chrony service and then run the application
|
||||||
|
CMD chronyd -d && uvicorn app.main:app --host 0.0.0.0 --port 8000
|
||||||
|
|||||||
@@ -135,7 +135,11 @@ def create_customer_profile(customer: schemas.Customer, card_info: schemas.CardC
|
|||||||
else:
|
else:
|
||||||
controller.execute()
|
controller.execute()
|
||||||
response = controller.getresponse()
|
response = controller.getresponse()
|
||||||
|
|
||||||
|
# Check if response is None (API call failed)
|
||||||
|
if response is None:
|
||||||
|
print("ERROR: Authorize.net API call returned None - likely a network/connectivity issue")
|
||||||
|
raise ValueError("Could not connect to the payment gateway. Please check network connectivity.")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if response.messages.resultCode == "Ok":
|
if response.messages.resultCode == "Ok":
|
||||||
@@ -389,6 +393,12 @@ def add_payment_profile_to_customer(customer_profile_id: str, customer: schemas.
|
|||||||
controller.execute()
|
controller.execute()
|
||||||
|
|
||||||
response = controller.getresponse()
|
response = controller.getresponse()
|
||||||
|
|
||||||
|
# Check if response is None (API call failed)
|
||||||
|
if response is None:
|
||||||
|
print("ERROR: Authorize.net API call returned None - likely a network/connectivity issue")
|
||||||
|
raise ValueError("Could not connect to the payment gateway. Please check network connectivity.")
|
||||||
|
|
||||||
if response.messages.resultCode == "Ok":
|
if response.messages.resultCode == "Ok":
|
||||||
# Fix: Proper payment profile ID extraction (same bug fix as above)
|
# Fix: Proper payment profile ID extraction (same bug fix as above)
|
||||||
if hasattr(response, 'customerPaymentProfileId') and response.customerPaymentProfileId:
|
if hasattr(response, 'customerPaymentProfileId') and response.customerPaymentProfileId:
|
||||||
@@ -440,6 +450,11 @@ def get_customer_payment_profiles(customer_profile_id: str):
|
|||||||
|
|
||||||
response = controller.getresponse()
|
response = controller.getresponse()
|
||||||
|
|
||||||
|
# Check if response is None (API call failed)
|
||||||
|
if response is None:
|
||||||
|
print("ERROR: Authorize.net API call returned None - likely a network/connectivity issue")
|
||||||
|
raise ValueError("Could not connect to the payment gateway. Please check network connectivity.")
|
||||||
|
|
||||||
if response.messages.resultCode == "Ok":
|
if response.messages.resultCode == "Ok":
|
||||||
payment_profile_ids = []
|
payment_profile_ids = []
|
||||||
if response.profile.paymentProfiles is not None:
|
if response.profile.paymentProfiles is not None:
|
||||||
|
|||||||
Reference in New Issue
Block a user