branddrive-python-sdk 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- branddrive/__init__.py +33 -0
- branddrive/client.py +134 -0
- branddrive/config.py +15 -0
- branddrive/dataclasses/__init__.py +118 -0
- branddrive/dataclasses/_utils.py +8 -0
- branddrive/dataclasses/customers.py +66 -0
- branddrive/dataclasses/expenses.py +155 -0
- branddrive/dataclasses/invoices.py +131 -0
- branddrive/dataclasses/payment_links.py +134 -0
- branddrive/dataclasses/pos.py +141 -0
- branddrive/dataclasses/products.py +166 -0
- branddrive/dataclasses/purchase_orders.py +141 -0
- branddrive/dataclasses/services.py +76 -0
- branddrive/dataclasses/vendors.py +48 -0
- branddrive/dataclasses/wallets.py +72 -0
- branddrive/exceptions.py +35 -0
- branddrive/protocols/__init__.py +43 -0
- branddrive/protocols/analytics.py +61 -0
- branddrive/protocols/customers.py +42 -0
- branddrive/protocols/expenses.py +69 -0
- branddrive/protocols/invoices.py +81 -0
- branddrive/protocols/payment_links.py +49 -0
- branddrive/protocols/pos.py +88 -0
- branddrive/protocols/products.py +150 -0
- branddrive/protocols/purchase_orders.py +68 -0
- branddrive/protocols/services.py +56 -0
- branddrive/protocols/vendors.py +39 -0
- branddrive/protocols/wallets.py +52 -0
- branddrive/resources/__init__.py +125 -0
- branddrive/resources/_utils.py +10 -0
- branddrive/resources/analytics.py +198 -0
- branddrive/resources/customers.py +194 -0
- branddrive/resources/expenses.py +209 -0
- branddrive/resources/invoices.py +268 -0
- branddrive/resources/payment_links.py +265 -0
- branddrive/resources/pos.py +353 -0
- branddrive/resources/products.py +612 -0
- branddrive/resources/purchase_orders.py +235 -0
- branddrive/resources/services.py +184 -0
- branddrive/resources/vendors.py +152 -0
- branddrive/resources/wallets.py +204 -0
- branddrive_python_sdk-0.1.0.dist-info/METADATA +132 -0
- branddrive_python_sdk-0.1.0.dist-info/RECORD +45 -0
- branddrive_python_sdk-0.1.0.dist-info/WHEEL +5 -0
- branddrive_python_sdk-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import Any, Optional
|
|
5
|
+
|
|
6
|
+
from ._utils import omit_none
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@dataclass
|
|
10
|
+
class WalletFundData:
|
|
11
|
+
"""Request payload for funding a wallet."""
|
|
12
|
+
|
|
13
|
+
amount: int | float
|
|
14
|
+
|
|
15
|
+
def to_dict(self) -> dict[str, Any]:
|
|
16
|
+
return {"amount": self.amount}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@dataclass
|
|
20
|
+
class WalletBusinessTransferData:
|
|
21
|
+
"""Request payload for a transfer to another business wallet."""
|
|
22
|
+
|
|
23
|
+
to_wallet_id: int
|
|
24
|
+
amount: int | float
|
|
25
|
+
tx_pin: int
|
|
26
|
+
|
|
27
|
+
def to_dict(self) -> dict[str, Any]:
|
|
28
|
+
return {
|
|
29
|
+
"toWalletId": self.to_wallet_id,
|
|
30
|
+
"amount": self.amount,
|
|
31
|
+
"txPin": self.tx_pin,
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@dataclass
|
|
36
|
+
class WalletPersonalTransferData:
|
|
37
|
+
"""Request payload for a transfer to a personal wallet."""
|
|
38
|
+
|
|
39
|
+
to_personal_wallet_id: int
|
|
40
|
+
amount: int | float
|
|
41
|
+
tx_pin: int
|
|
42
|
+
narration: Optional[str] = None
|
|
43
|
+
|
|
44
|
+
def to_dict(self) -> dict[str, Any]:
|
|
45
|
+
return omit_none({
|
|
46
|
+
"toPersonalWalletId": self.to_personal_wallet_id,
|
|
47
|
+
"amount": self.amount,
|
|
48
|
+
"txPin": self.tx_pin,
|
|
49
|
+
"narration": self.narration,
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
@dataclass
|
|
54
|
+
class WalletExternalTransferData:
|
|
55
|
+
"""Request payload for a transfer to an external bank account."""
|
|
56
|
+
|
|
57
|
+
amount: int | float
|
|
58
|
+
tx_pin: int
|
|
59
|
+
account_number: str | int
|
|
60
|
+
bank_code: str | int
|
|
61
|
+
beneficiary_id: Optional[str] = None
|
|
62
|
+
narration: Optional[str] = None
|
|
63
|
+
|
|
64
|
+
def to_dict(self) -> dict[str, Any]:
|
|
65
|
+
return omit_none({
|
|
66
|
+
"amount": self.amount,
|
|
67
|
+
"txPin": self.tx_pin,
|
|
68
|
+
"accountNumber": self.account_number,
|
|
69
|
+
"bankCode": self.bank_code,
|
|
70
|
+
"beneficiaryId": self.beneficiary_id,
|
|
71
|
+
"narration": self.narration,
|
|
72
|
+
})
|
branddrive/exceptions.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Optional
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class InvalidAPIKeyException(Exception):
|
|
8
|
+
"""Exception raised for invalid API key errors."""
|
|
9
|
+
def __init__(self, message: str = "Invalid API Key") -> None:
|
|
10
|
+
super().__init__(message)
|
|
11
|
+
|
|
12
|
+
class InvalidBaseURLException(Exception):
|
|
13
|
+
"""Exception raised for invalid base URL errors."""
|
|
14
|
+
def __init__(self, message: str = "Invalid Base URL") -> None:
|
|
15
|
+
super().__init__(message)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class APIException(Exception):
|
|
20
|
+
"""Base exception for BrandDrive API errors."""
|
|
21
|
+
def __init__(self, message: str, status_code: Optional[int], request_id: Optional[str]) -> None:
|
|
22
|
+
super().__init__(f"Exception: {message} (Status code: {status_code}, Request ID: {request_id})")
|
|
23
|
+
self.status_code = status_code
|
|
24
|
+
self.request_id = request_id
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def handle_api_exception(res: httpx.Response) -> APIException:
|
|
28
|
+
"""Handle API exceptions based on the response."""
|
|
29
|
+
try:
|
|
30
|
+
message = res.json().get("message", "Unknown error")
|
|
31
|
+
except (ValueError, KeyError, TypeError):
|
|
32
|
+
message = res.reason_phrase
|
|
33
|
+
return APIException(message, res.status_code, res.headers.get("X-Request-ID"))
|
|
34
|
+
|
|
35
|
+
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from .customers import _CustomerAPI
|
|
2
|
+
from .invoices import _InvoiceAPI
|
|
3
|
+
from .products import (
|
|
4
|
+
_DistributionAPI,
|
|
5
|
+
_GroupedProductAPI,
|
|
6
|
+
_PricingDistributionAPI,
|
|
7
|
+
_ProductAPI,
|
|
8
|
+
_SingleProductAPI,
|
|
9
|
+
)
|
|
10
|
+
from .pos import _POSAPI
|
|
11
|
+
from .vendors import _VendorAPI
|
|
12
|
+
from .services import _ServiceAPI, _ServiceCategoryAPI
|
|
13
|
+
from .purchase_orders import _PurchaseOrderAPI
|
|
14
|
+
from .expenses import (
|
|
15
|
+
_ExpenseAPI,
|
|
16
|
+
_ExpensePaymentAPI,
|
|
17
|
+
_ExpenseProcurementAPI,
|
|
18
|
+
)
|
|
19
|
+
from .wallets import _WalletAPI
|
|
20
|
+
from .payment_links import _PaymentLinkAPI, _PaymentLinkCategoryAPI
|
|
21
|
+
from .analytics import _AnalyticsAPI
|
|
22
|
+
|
|
23
|
+
__all__ = [
|
|
24
|
+
"_CustomerAPI",
|
|
25
|
+
"_InvoiceAPI",
|
|
26
|
+
"_DistributionAPI",
|
|
27
|
+
"_GroupedProductAPI",
|
|
28
|
+
"_PricingDistributionAPI",
|
|
29
|
+
"_ProductAPI",
|
|
30
|
+
"_SingleProductAPI",
|
|
31
|
+
"_POSAPI",
|
|
32
|
+
"_VendorAPI",
|
|
33
|
+
"_ServiceAPI",
|
|
34
|
+
"_ServiceCategoryAPI",
|
|
35
|
+
"_PurchaseOrderAPI",
|
|
36
|
+
"_ExpenseAPI",
|
|
37
|
+
"_ExpensePaymentAPI",
|
|
38
|
+
"_ExpenseProcurementAPI",
|
|
39
|
+
"_WalletAPI",
|
|
40
|
+
"_PaymentLinkAPI",
|
|
41
|
+
"_PaymentLinkCategoryAPI",
|
|
42
|
+
"_AnalyticsAPI",
|
|
43
|
+
]
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from datetime import date
|
|
4
|
+
from typing import Any, Protocol
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class _AnalyticsAPI(Protocol):
|
|
8
|
+
def get_profit_and_loss(
|
|
9
|
+
self,
|
|
10
|
+
branch_id: int,
|
|
11
|
+
duration: str,
|
|
12
|
+
start_date: date | None = None,
|
|
13
|
+
end_date: date | None = None,
|
|
14
|
+
) -> dict[str, Any]: ...
|
|
15
|
+
|
|
16
|
+
def get_sales_and_income(
|
|
17
|
+
self,
|
|
18
|
+
branch_id: int,
|
|
19
|
+
start_date: date,
|
|
20
|
+
end_date: date,
|
|
21
|
+
resolution: str | None = None,
|
|
22
|
+
) -> dict[str, Any]: ...
|
|
23
|
+
|
|
24
|
+
def get_performance_overview(
|
|
25
|
+
self,
|
|
26
|
+
start_date: date | None = None,
|
|
27
|
+
end_date: date | None = None,
|
|
28
|
+
) -> dict[str, Any]: ...
|
|
29
|
+
|
|
30
|
+
def get_total_payment_distribution(
|
|
31
|
+
self,
|
|
32
|
+
start_date: date,
|
|
33
|
+
end_date: date,
|
|
34
|
+
branch_id: int,
|
|
35
|
+
) -> dict[str, Any]: ...
|
|
36
|
+
|
|
37
|
+
def get_orders_by_team(
|
|
38
|
+
self,
|
|
39
|
+
branch_id: int,
|
|
40
|
+
team_email: str,
|
|
41
|
+
start_date: date | None = None,
|
|
42
|
+
end_date: date | None = None,
|
|
43
|
+
) -> dict[str, Any]: ...
|
|
44
|
+
|
|
45
|
+
def get_leaderboard(
|
|
46
|
+
self,
|
|
47
|
+
start_date: date | None = None,
|
|
48
|
+
end_date: date | None = None,
|
|
49
|
+
) -> dict[str, Any]: ...
|
|
50
|
+
|
|
51
|
+
def get_banking_and_wallet(
|
|
52
|
+
self,
|
|
53
|
+
start_date: date | None = None,
|
|
54
|
+
end_date: date | None = None,
|
|
55
|
+
) -> dict[str, Any]: ...
|
|
56
|
+
|
|
57
|
+
def get_cpv(
|
|
58
|
+
self,
|
|
59
|
+
start_date: date | None = None,
|
|
60
|
+
end_date: date | None = None,
|
|
61
|
+
) -> dict[str, Any]: ...
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Any, Optional, Protocol
|
|
5
|
+
|
|
6
|
+
from ..dataclasses.customers import CustomerData, UpdateCustomerData
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class _CustomerAPI(Protocol):
|
|
10
|
+
def create_customer(self, customer_data: CustomerData) -> dict[str, Any]: ...
|
|
11
|
+
|
|
12
|
+
def import_csv(
|
|
13
|
+
self,
|
|
14
|
+
file_path: str | Path,
|
|
15
|
+
file_field: str = "file",
|
|
16
|
+
) -> dict[str, Any]: ...
|
|
17
|
+
|
|
18
|
+
def export(
|
|
19
|
+
self,
|
|
20
|
+
email: Optional[str] = None,
|
|
21
|
+
file_type: Optional[str] = None,
|
|
22
|
+
) -> bytes: ...
|
|
23
|
+
|
|
24
|
+
def retrieve_customer(self, customer_id: int) -> dict[str, Any]: ...
|
|
25
|
+
|
|
26
|
+
def update_customer(
|
|
27
|
+
self,
|
|
28
|
+
customer_id: int,
|
|
29
|
+
customer_data: UpdateCustomerData,
|
|
30
|
+
) -> dict[str, Any]: ...
|
|
31
|
+
|
|
32
|
+
def toggle_status(self, customer_id: int) -> dict[str, Any]: ...
|
|
33
|
+
|
|
34
|
+
def delete_customer(self, customer_id: int) -> dict[str, Any]: ...
|
|
35
|
+
|
|
36
|
+
def list_cusotmers(
|
|
37
|
+
self,
|
|
38
|
+
search: Optional[str] = None,
|
|
39
|
+
sort: Optional[str] = None,
|
|
40
|
+
limit: int = 10,
|
|
41
|
+
offset: int = 0,
|
|
42
|
+
) -> dict[str, Any]: ...
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any, Protocol
|
|
4
|
+
|
|
5
|
+
from ..dataclasses.expenses import (
|
|
6
|
+
ExpenseCreate,
|
|
7
|
+
ExpensePaymentCreate,
|
|
8
|
+
ExpenseProcurementCreate,
|
|
9
|
+
ExpenseProcurementUpdate,
|
|
10
|
+
ExpenseUpdate,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class _ExpenseProcurementAPI(Protocol):
|
|
15
|
+
def add_procurement(
|
|
16
|
+
self,
|
|
17
|
+
procurement_data: ExpenseProcurementCreate,
|
|
18
|
+
) -> dict[str, Any]: ...
|
|
19
|
+
|
|
20
|
+
def update_procurement(
|
|
21
|
+
self,
|
|
22
|
+
expense_id: int,
|
|
23
|
+
procurement_id: int,
|
|
24
|
+
procurement_data: ExpenseProcurementUpdate,
|
|
25
|
+
) -> dict[str, Any]: ...
|
|
26
|
+
|
|
27
|
+
def delete_procurement(
|
|
28
|
+
self,
|
|
29
|
+
expense_id: int,
|
|
30
|
+
procurement_id: int,
|
|
31
|
+
) -> dict[str, Any]: ...
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class _ExpensePaymentAPI(Protocol):
|
|
35
|
+
def record_payment(
|
|
36
|
+
self,
|
|
37
|
+
payment_data: ExpensePaymentCreate,
|
|
38
|
+
) -> dict[str, Any]: ...
|
|
39
|
+
|
|
40
|
+
def remove_payment(
|
|
41
|
+
self,
|
|
42
|
+
expense_id: int,
|
|
43
|
+
payment_id: int,
|
|
44
|
+
) -> dict[str, Any]: ...
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class _ExpenseAPI(Protocol):
|
|
48
|
+
procurements: _ExpenseProcurementAPI
|
|
49
|
+
payments: _ExpensePaymentAPI
|
|
50
|
+
|
|
51
|
+
def create_expense(self, expense_data: ExpenseCreate) -> dict[str, Any]: ...
|
|
52
|
+
|
|
53
|
+
def list_expenses(
|
|
54
|
+
self,
|
|
55
|
+
limit: int = 10,
|
|
56
|
+
offset: int = 0,
|
|
57
|
+
) -> dict[str, Any]: ...
|
|
58
|
+
|
|
59
|
+
def retrieve_expense(self, expense_id: int) -> dict[str, Any]: ...
|
|
60
|
+
|
|
61
|
+
def get_expense_categories(self) -> dict[str, Any]: ...
|
|
62
|
+
|
|
63
|
+
def update_expense(
|
|
64
|
+
self,
|
|
65
|
+
expense_id: int,
|
|
66
|
+
expense_data: ExpenseUpdate,
|
|
67
|
+
) -> dict[str, Any]: ...
|
|
68
|
+
|
|
69
|
+
def delete_expense(self, expense_id: int) -> dict[str, Any]: ...
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any, Protocol
|
|
4
|
+
|
|
5
|
+
from ..dataclasses.invoices import (
|
|
6
|
+
InvoiceCreate,
|
|
7
|
+
InvoiceCreateSend,
|
|
8
|
+
InvoiceUpdate,
|
|
9
|
+
RecurringScheduleCreate,
|
|
10
|
+
RecurringScheduleUpdate,
|
|
11
|
+
)
|
|
12
|
+
from ..dataclasses.products import ProcurementData, UpdateProcurementData
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class _InvoiceAPI(Protocol):
|
|
16
|
+
def create_invoice(self, invoice_data: InvoiceCreate) -> dict[str, Any]: ...
|
|
17
|
+
|
|
18
|
+
def create_send_invoice(
|
|
19
|
+
self,
|
|
20
|
+
invoice_data: InvoiceCreateSend,
|
|
21
|
+
) -> dict[str, Any]: ...
|
|
22
|
+
|
|
23
|
+
def send_invoice(self, invoice_id: int) -> dict[str, Any]: ...
|
|
24
|
+
|
|
25
|
+
def list_invoices(
|
|
26
|
+
self,
|
|
27
|
+
currency_id: int = 0,
|
|
28
|
+
limit: int = 10,
|
|
29
|
+
offset: int = 0,
|
|
30
|
+
) -> dict[str, Any]: ...
|
|
31
|
+
|
|
32
|
+
def retrieve_invoice(self, invoice_id: int) -> dict[str, Any]: ...
|
|
33
|
+
|
|
34
|
+
def preview_invoice(self, invoice_id: int) -> bytes: ...
|
|
35
|
+
|
|
36
|
+
def update_invoice(
|
|
37
|
+
self,
|
|
38
|
+
invoice_id: int,
|
|
39
|
+
invoice_data: InvoiceUpdate,
|
|
40
|
+
) -> dict[str, Any]: ...
|
|
41
|
+
|
|
42
|
+
def update_send_invoice(
|
|
43
|
+
self,
|
|
44
|
+
invoice_id: int,
|
|
45
|
+
invoice_data: InvoiceUpdate,
|
|
46
|
+
) -> dict[str, Any]: ...
|
|
47
|
+
|
|
48
|
+
def list_procurements(self, invoice_id: int) -> dict[str, Any]: ...
|
|
49
|
+
|
|
50
|
+
def add_procurement(
|
|
51
|
+
self,
|
|
52
|
+
invoice_id: int,
|
|
53
|
+
procurement: ProcurementData,
|
|
54
|
+
) -> dict[str, Any]: ...
|
|
55
|
+
|
|
56
|
+
def update_procurement(
|
|
57
|
+
self,
|
|
58
|
+
invoice_id: int,
|
|
59
|
+
procurement_id: int,
|
|
60
|
+
procurement_data: UpdateProcurementData,
|
|
61
|
+
) -> dict[str, Any]: ...
|
|
62
|
+
|
|
63
|
+
def delete_procurement(
|
|
64
|
+
self,
|
|
65
|
+
invoice_id: int,
|
|
66
|
+
procurement_id: int,
|
|
67
|
+
) -> dict[str, Any]: ...
|
|
68
|
+
|
|
69
|
+
def delete_invoice(self, invoice_id: int) -> dict[str, Any]: ...
|
|
70
|
+
|
|
71
|
+
def create_recurring_schedule(
|
|
72
|
+
self,
|
|
73
|
+
invoice_id: int,
|
|
74
|
+
schedule_data: RecurringScheduleCreate,
|
|
75
|
+
) -> dict[str, Any]: ...
|
|
76
|
+
|
|
77
|
+
def update_recurring_schedule(
|
|
78
|
+
self,
|
|
79
|
+
invoice_schedule_id: int,
|
|
80
|
+
schedule_data: RecurringScheduleUpdate,
|
|
81
|
+
) -> dict[str, Any]: ...
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any, Protocol
|
|
4
|
+
|
|
5
|
+
from ..dataclasses.payment_links import (
|
|
6
|
+
PaymentLinkCategoryCreate,
|
|
7
|
+
PaymentLinkCreate,
|
|
8
|
+
PaymentLinkPayData,
|
|
9
|
+
PaymentLinkUpdate,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class _PaymentLinkCategoryAPI(Protocol):
|
|
14
|
+
def add_category(
|
|
15
|
+
self,
|
|
16
|
+
payment_link_id: int,
|
|
17
|
+
category_data: PaymentLinkCategoryCreate,
|
|
18
|
+
) -> dict[str, Any]: ...
|
|
19
|
+
|
|
20
|
+
def remove_category(
|
|
21
|
+
self,
|
|
22
|
+
payment_link_id: int,
|
|
23
|
+
category_id: int,
|
|
24
|
+
) -> dict[str, Any]: ...
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class _PaymentLinkAPI(Protocol):
|
|
28
|
+
categories: _PaymentLinkCategoryAPI
|
|
29
|
+
|
|
30
|
+
def create_payment_link(
|
|
31
|
+
self,
|
|
32
|
+
payment_link_data: PaymentLinkCreate,
|
|
33
|
+
) -> dict[str, Any]: ...
|
|
34
|
+
|
|
35
|
+
def list_payment_links(self) -> dict[str, Any]: ...
|
|
36
|
+
|
|
37
|
+
def list_payments(self) -> dict[str, Any]: ...
|
|
38
|
+
|
|
39
|
+
def pay(self, payment_data: PaymentLinkPayData) -> dict[str, Any]: ...
|
|
40
|
+
|
|
41
|
+
def validate_payment_link(self, code: str) -> dict[str, Any]: ...
|
|
42
|
+
|
|
43
|
+
def update_payment_link(
|
|
44
|
+
self,
|
|
45
|
+
payment_link_id: int,
|
|
46
|
+
payment_link_data: PaymentLinkUpdate,
|
|
47
|
+
) -> dict[str, Any]: ...
|
|
48
|
+
|
|
49
|
+
def delete_payment_link(self, payment_link_id: int) -> dict[str, Any]: ...
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any, Iterable, Optional, Protocol
|
|
4
|
+
|
|
5
|
+
from ..dataclasses.pos import (
|
|
6
|
+
POSCreate,
|
|
7
|
+
POSPaymentProcurement,
|
|
8
|
+
POSProductProcurement,
|
|
9
|
+
POSProcurementUpdate,
|
|
10
|
+
POSVoidData,
|
|
11
|
+
PosUpdate,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class _POSAPI(Protocol):
|
|
16
|
+
def create_pos(self, pos_data: POSCreate) -> dict[str, Any]: ...
|
|
17
|
+
|
|
18
|
+
def add_payment(
|
|
19
|
+
self,
|
|
20
|
+
pos_id: int,
|
|
21
|
+
procurements: Optional[Iterable[POSPaymentProcurement]] = None,
|
|
22
|
+
) -> dict[str, Any]: ...
|
|
23
|
+
|
|
24
|
+
def add_service_procurement(
|
|
25
|
+
self,
|
|
26
|
+
pos_id: int,
|
|
27
|
+
procurements: Iterable[POSProductProcurement],
|
|
28
|
+
) -> dict[str, Any]: ...
|
|
29
|
+
|
|
30
|
+
def add_product_procurement(
|
|
31
|
+
self,
|
|
32
|
+
pos_id: int,
|
|
33
|
+
procurements: Iterable[POSProductProcurement],
|
|
34
|
+
) -> dict[str, Any]: ...
|
|
35
|
+
|
|
36
|
+
def send_to_kitchen(self, pos_id: int) -> dict[str, Any]: ...
|
|
37
|
+
|
|
38
|
+
def list_pos(
|
|
39
|
+
self,
|
|
40
|
+
offset: int = 0,
|
|
41
|
+
limit: int = 10,
|
|
42
|
+
branch_id: Optional[int] = None,
|
|
43
|
+
type: str = "closed",
|
|
44
|
+
) -> dict[str, Any]: ...
|
|
45
|
+
|
|
46
|
+
def retrieve_pos(
|
|
47
|
+
self,
|
|
48
|
+
pos_id: Optional[int] = None,
|
|
49
|
+
customer_name: Optional[str] = None,
|
|
50
|
+
) -> dict[str, Any]: ...
|
|
51
|
+
|
|
52
|
+
def customer_view(self, pos_id: int) -> dict[str, Any]: ...
|
|
53
|
+
|
|
54
|
+
def kitchen_list(
|
|
55
|
+
self,
|
|
56
|
+
start_date: Optional[str] = None,
|
|
57
|
+
end_date: Optional[str] = None,
|
|
58
|
+
search: Optional[str] = None,
|
|
59
|
+
) -> dict[str, Any]: ...
|
|
60
|
+
|
|
61
|
+
def update_pos(self, pos_id: int, pos_data: PosUpdate) -> dict[str, Any]: ...
|
|
62
|
+
|
|
63
|
+
def void_pos(
|
|
64
|
+
self,
|
|
65
|
+
pos_id: int,
|
|
66
|
+
pos_data: Optional[POSVoidData] = None,
|
|
67
|
+
) -> dict[str, Any]: ...
|
|
68
|
+
|
|
69
|
+
def update_procurement(
|
|
70
|
+
self,
|
|
71
|
+
procurement_id: int,
|
|
72
|
+
procurement_data: POSProcurementUpdate,
|
|
73
|
+
) -> dict[str, Any]: ...
|
|
74
|
+
|
|
75
|
+
def toggle_kitchen(
|
|
76
|
+
self,
|
|
77
|
+
pos_id: int,
|
|
78
|
+
procurement_id: int,
|
|
79
|
+
) -> dict[str, Any]: ...
|
|
80
|
+
|
|
81
|
+
def delete_pos(self, pos_ids: list[int]) -> dict[str, Any]: ...
|
|
82
|
+
|
|
83
|
+
def delete_procurements(
|
|
84
|
+
self,
|
|
85
|
+
procurement_ids: list[int],
|
|
86
|
+
) -> dict[str, Any]: ...
|
|
87
|
+
|
|
88
|
+
def delete_payment(self, pos_id: int, payment_id: int) -> dict[str, Any]: ...
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any, Protocol, Optional
|
|
4
|
+
|
|
5
|
+
from ..dataclasses.products import (
|
|
6
|
+
ProductDistributionCreate,
|
|
7
|
+
ProductDistributionUpdate,
|
|
8
|
+
SingleProductCreate,
|
|
9
|
+
UpdateProductData,
|
|
10
|
+
ProductVariationCreate,
|
|
11
|
+
ProductCategoryUpdate,
|
|
12
|
+
ProductCategoryCreate,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class _SingleProductAPI(Protocol):
|
|
17
|
+
def create_product(
|
|
18
|
+
self,
|
|
19
|
+
product_data: SingleProductCreate,
|
|
20
|
+
) -> dict[str, Any]: ...
|
|
21
|
+
|
|
22
|
+
def get_variable_product(self, variable_name: str) -> dict[str, Any]: ...
|
|
23
|
+
|
|
24
|
+
def update_product(
|
|
25
|
+
self,
|
|
26
|
+
product_id: int,
|
|
27
|
+
product_data: UpdateProductData,
|
|
28
|
+
) -> dict[str, Any]: ...
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class _GroupedProductAPI(Protocol):
|
|
32
|
+
def create_grouped_products(
|
|
33
|
+
self,
|
|
34
|
+
products: list[SingleProductCreate],
|
|
35
|
+
) -> dict[str, Any]: ...
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class _DistributionAPI(Protocol):
|
|
39
|
+
def add_distribution(
|
|
40
|
+
self,
|
|
41
|
+
product_id: int,
|
|
42
|
+
distribution: ProductDistributionCreate,
|
|
43
|
+
) -> dict[str, Any]: ...
|
|
44
|
+
|
|
45
|
+
def update_distribution(
|
|
46
|
+
self,
|
|
47
|
+
product_id: int,
|
|
48
|
+
distribution: ProductDistributionUpdate,
|
|
49
|
+
) -> dict[str, Any]: ...
|
|
50
|
+
|
|
51
|
+
def delete_distribution(
|
|
52
|
+
self,
|
|
53
|
+
product_id: int,
|
|
54
|
+
distribution_ids: list[int],
|
|
55
|
+
) -> dict[str, Any]: ...
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class _PricingDistributionAPI(Protocol):
|
|
59
|
+
def add_pricing_distribution(
|
|
60
|
+
self,
|
|
61
|
+
product_id: int,
|
|
62
|
+
price_distributions: list[dict[str, Any]],
|
|
63
|
+
) -> dict[str, Any]: ...
|
|
64
|
+
|
|
65
|
+
def update_pricing_distribution(
|
|
66
|
+
self,
|
|
67
|
+
product_id: int,
|
|
68
|
+
price_distributions: list[dict[str, Any]],
|
|
69
|
+
) -> dict[str, Any]: ...
|
|
70
|
+
|
|
71
|
+
def delete_pricing_distribution(
|
|
72
|
+
self,
|
|
73
|
+
price_distribution_ids: list[int],
|
|
74
|
+
) -> dict[str, Any]: ...
|
|
75
|
+
|
|
76
|
+
class _VariationAPI(Protocol):
|
|
77
|
+
def regenerate_variation(
|
|
78
|
+
self,
|
|
79
|
+
product_id: int,
|
|
80
|
+
variation: ProductVariationCreate
|
|
81
|
+
) -> dict[str, Any]: ...
|
|
82
|
+
|
|
83
|
+
def update_variation(
|
|
84
|
+
self,
|
|
85
|
+
variation_id: int,
|
|
86
|
+
variation: ProductVariationCreate
|
|
87
|
+
) -> dict[str, Any]: ...
|
|
88
|
+
|
|
89
|
+
def delete_variation(
|
|
90
|
+
self,
|
|
91
|
+
product_id: int,
|
|
92
|
+
variation_name: str,
|
|
93
|
+
attribute: str
|
|
94
|
+
) -> dict[str, Any]: ...
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
class _CategoryAPI(Protocol):
|
|
98
|
+
def create_category(
|
|
99
|
+
self,
|
|
100
|
+
category: ProductCategoryCreate
|
|
101
|
+
) -> dict[str, Any]:...
|
|
102
|
+
|
|
103
|
+
def list_categories(
|
|
104
|
+
self,
|
|
105
|
+
limit: int = 10
|
|
106
|
+
) -> dict[str, Any]: ...
|
|
107
|
+
|
|
108
|
+
def update_category(
|
|
109
|
+
self,
|
|
110
|
+
category_id: int,
|
|
111
|
+
category_data: ProductCategoryUpdate
|
|
112
|
+
) -> dict[str, Any]: ...
|
|
113
|
+
|
|
114
|
+
def delete_category(
|
|
115
|
+
self,
|
|
116
|
+
category_id: int
|
|
117
|
+
) -> dict[str, Any]: ...
|
|
118
|
+
|
|
119
|
+
class _ProductAPI(Protocol):
|
|
120
|
+
single: _SingleProductAPI
|
|
121
|
+
grouped: _GroupedProductAPI
|
|
122
|
+
distribution: _DistributionAPI
|
|
123
|
+
pricing_distribution: _PricingDistributionAPI
|
|
124
|
+
variation: _VariationAPI
|
|
125
|
+
category: _CategoryAPI
|
|
126
|
+
|
|
127
|
+
def delete_products(
|
|
128
|
+
self,
|
|
129
|
+
product_ids: list[int]
|
|
130
|
+
|
|
131
|
+
) -> dict[str, Any]: ...
|
|
132
|
+
|
|
133
|
+
def export_products(
|
|
134
|
+
self,
|
|
135
|
+
export_type: str,
|
|
136
|
+
email: Optional[str] = None,
|
|
137
|
+
branch_id: Optional[int] = None,
|
|
138
|
+
search: Optional[str] = None,
|
|
139
|
+
category_id: Optional[int] = None,
|
|
140
|
+
limit: int = 10,
|
|
141
|
+
offset: int = 0
|
|
142
|
+
) -> dict[str, Any]: ...
|
|
143
|
+
|
|
144
|
+
def list_products(
|
|
145
|
+
self,
|
|
146
|
+
limit: int = 10,
|
|
147
|
+
offset: int = 0,
|
|
148
|
+
search: Optional[str] = None,
|
|
149
|
+
sort: Optional[str] = None
|
|
150
|
+
) -> dict[str, Any]: ...
|