ft
All checks were successful
Deploy App to Docker / deploy (push) Successful in 23s

This commit is contained in:
zman 2025-04-07 16:49:18 -04:00
parent 846a44e5fc
commit fff6007a10
2 changed files with 9 additions and 6 deletions

View File

@ -318,15 +318,17 @@ async def update_cookies(
)
class TCGPlayerOrderRequest(BaseModel):
order_ids: List[str]
# optional
order_ids: Optional[List[str]] = None
@router.get("/processOrders", response_model=dict)
@router.post("/processOrders", response_model=ProcessOrdersResponse)
async def process_orders(
body: TCGPlayerOrderRequest,
tcgplayer_api_service: TCGPlayerAPIService = Depends(get_tcgplayer_api_service),
) -> ProcessOrdersResponse:
"""Process TCGPlayer orders."""
try:
orders = tcgplayer_api_service.process_open_orders()
orders = tcgplayer_api_service.process_open_orders(body.order_ids)
return ProcessOrdersResponse(
status_code=200,
success=True,

View File

@ -302,7 +302,7 @@ class TCGPlayerAPIService:
print("No orders found or no valid labels generated.")
return None
def process_open_orders(self):
def process_open_orders(self, order_ids: list[str]=None):
# get all open orders
url = f"{self.config.ORDER_BASE_URL}/search{self.config.API_VERSION}"
"""{"searchRange":"LastThreeMonths","filters":{"sellerKey":"e576ed4c","orderStatuses":["Processing","ReadyToShip","Received","Pulling","ReadyForPickup"],"fulfillmentTypes":["Normal"]},"sortBy":[{"sortingType":"orderStatus","direction":"ascending"},{"sortingType":"orderDate","direction":"ascending"}],"from":0,"size":25}"""
@ -324,6 +324,7 @@ class TCGPlayerAPIService:
if response:
orders = response.json()
if orders and 'orders' in orders:
if order_ids is None:
order_ids = [order['orderNumber'] for order in orders['orders']]
# get packing slip pdf
packing_slip_filename = self.get_packing_slip_pdf_for_orders(order_ids)