This commit is contained in:
2025-04-13 22:34:47 -04:00
parent 18b32c8514
commit 593e8960b7
6 changed files with 40 additions and 228 deletions

View File

@ -20,7 +20,7 @@ class OrderManagementService(BaseTCGPlayerService):
self.shipping_endpoint = f"/shipping/export{self.API_VERSION}"
async def get_orders(self):
async def get_orders(self, open_only: bool = False):
search_from = 0
orders = []
while True:
@ -36,6 +36,9 @@ class OrderManagementService(BaseTCGPlayerService):
"from": search_from,
"size": 25
}
if open_only:
payload["filters"]["orderStatus"] = ["Processing","ReadyToShip","Received","Pulling","ReadyForPickup"]
payload["filters"]["fulfillmentTypes"] = ["Normal"]
response = await self._make_request("POST", self.order_search_endpoint, data=payload, headers=self._get_headers("POST", "application/json"), auth_required=True)
if len(response.get("orders")) == 0:
break