- Implement tests for `EbayOAuthClient` to verify authorization URL generation with configured scopes and token reuse logic. - Add tests for `WebhookChallengeHandler` to ensure correct SHA256 response generation and for `WebhookSignatureParser` to validate extraction of known fields from signature strings.
41 lines
1.4 KiB
Python
41 lines
1.4 KiB
Python
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
from ebay_client.core.http.transport import ApiTransport
|
|
|
|
FULFILLMENT_READ_SCOPE = "https://api.ebay.com/oauth/api_scope/sell.fulfillment.readonly"
|
|
|
|
|
|
class FulfillmentClient:
|
|
def __init__(self, transport: ApiTransport) -> None:
|
|
self.transport = transport
|
|
|
|
def get_order(self, order_id: str) -> dict[str, Any]:
|
|
return self.transport.request_json(
|
|
"GET",
|
|
f"/sell/fulfillment/v1/order/{order_id}",
|
|
scopes=[FULFILLMENT_READ_SCOPE],
|
|
)
|
|
|
|
def get_orders(self, *, limit: int | None = None, offset: int | None = None) -> dict[str, Any]:
|
|
return self.transport.request_json(
|
|
"GET",
|
|
"/sell/fulfillment/v1/order",
|
|
scopes=[FULFILLMENT_READ_SCOPE],
|
|
params={"limit": limit, "offset": offset},
|
|
)
|
|
|
|
def get_shipping_fulfillments(self, order_id: str) -> dict[str, Any]:
|
|
return self.transport.request_json(
|
|
"GET",
|
|
f"/sell/fulfillment/v1/order/{order_id}/shipping_fulfillment",
|
|
scopes=[FULFILLMENT_READ_SCOPE],
|
|
)
|
|
|
|
def get_shipping_fulfillment(self, order_id: str, fulfillment_id: str) -> dict[str, Any]:
|
|
return self.transport.request_json(
|
|
"GET",
|
|
f"/sell/fulfillment/v1/order/{order_id}/shipping_fulfillment/{fulfillment_id}",
|
|
scopes=[FULFILLMENT_READ_SCOPE],
|
|
)
|