more cleaning and added the url in API endpoint
Some checks failed
Build and deploy the backend to staging / Build and push image (pull_request) Failing after 1m59s
Build and deploy the backend to staging / Deploy to staging (pull_request) Has been skipped
Run linting on the backend code / Build (pull_request) Successful in 46s
Run testing on the backend code / Build (pull_request) Failing after 2m46s

This commit is contained in:
2025-10-19 22:20:54 +02:00
parent a884b9ee14
commit d9724ff07d
4 changed files with 12 additions and 12 deletions

View File

@@ -231,7 +231,12 @@ class PaypalClient:
return access_token return access_token
def order(self, order_request: OrderRequest): def order(
self,
order_request: OrderRequest,
return_url_success: str,
return_url_failure: str
):
""" """
Creates a new PayPal order. Creates a new PayPal order.
@@ -263,10 +268,9 @@ class PaypalClient:
} }
} }
], ],
# TODO: add these to anydev website
'application_context': { 'application_context': {
'return_url': 'https://anydev.info', 'return_url': return_url_success,
'cancel_url': 'https://anydev.info' 'cancel_url': return_url_failure
} }
} }

View File

@@ -23,7 +23,9 @@ logger = logging.getLogger(__name__)
def create_order( def create_order(
user_id: str, user_id: str,
basket: list, basket: list,
currency: Literal['CHF', 'EUR', 'USD'] currency: Literal['CHF', 'EUR', 'USD'],
return_url_success: str = 'https://anydev.info',
return_url_failure: str = 'https://anydev.info'
): ):
""" """
Creates a new PayPal order. Creates a new PayPal order.
@@ -45,7 +47,7 @@ def create_order(
) )
# Process the order and return the details # Process the order and return the details
return paypal_client.order(order_request = order) return paypal_client.order(order_request=order, return_url_success=return_url_success, return_url_failure=return_url_failure)

View File

@@ -1,14 +1,11 @@
"""Collection of tests to ensure correct implementation and track progress.""" """Collection of tests to ensure correct implementation and track progress."""
import os
import time import time
import yaml
from fastapi.testclient import TestClient from fastapi.testclient import TestClient
import pytest import pytest
from .test_utils import load_trip_landmarks, log_trip_details from .test_utils import load_trip_landmarks, log_trip_details
from ..supabase.supabase import SupabaseClient from ..supabase.supabase import SupabaseClient
from ..structs.preferences import Preferences, Preference from ..structs.preferences import Preferences, Preference
from ..constants import PARAMETERS_DIR
from ..main import app from ..main import app

View File

@@ -1,12 +1,9 @@
"""Helper methods for testing.""" """Helper methods for testing."""
import time
import logging import logging
from functools import wraps
from fastapi import HTTPException from fastapi import HTTPException
from ..cache import client as cache_client from ..cache import client as cache_client
from ..structs.landmark import Landmark from ..structs.landmark import Landmark
from ..structs.preferences import Preferences, Preference
def landmarks_to_osmid(landmarks: list[Landmark]) -> list[int] : def landmarks_to_osmid(landmarks: list[Landmark]) -> list[int] :