37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
from sipro.api.client import get_client
|
|
|
|
client = get_client()
|
|
router = '/orders'
|
|
|
|
|
|
def get_orders_by_supplier_product_id(supplier_product_id: str) -> list[dict]:
|
|
method = f'{router}/getBySupplierProductId?supplierProductId={supplier_product_id}'
|
|
response = client.method('GET', method)
|
|
return response
|
|
|
|
|
|
def get_order_by_id(order_id) -> dict:
|
|
method = f'{router}/getOrderById?orderId={order_id}'
|
|
response = client.method('GET', method)
|
|
return response
|
|
|
|
|
|
def ship_order(order_id: int) -> dict:
|
|
method = f'{router}/shipOrder'
|
|
data = {'orderId': order_id}
|
|
response = client.method('POST', method, data=data)
|
|
return response
|
|
|
|
|
|
def close_order(order_id: int) -> dict:
|
|
method = f'{router}/closeOrder'
|
|
data = {'orderId': order_id}
|
|
response = client.method('POST', method, data=data)
|
|
return response
|
|
|
|
|
|
def get_orders(order_by: str, desc: int, page: int, shipment_date: str, status: str, shipment_warehouse_id: int):
|
|
method = f'{router}/getOrders?orderBy={order_by}&desc={desc}&page={page}&shipmentDate={shipment_date}&status={status}&shipmentWarehouseId={shipment_warehouse_id}'
|
|
response = client.method('GET', method)
|
|
return response
|