bukku-client 0.1.0-test.0
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.
- package/LICENSE +674 -0
- package/README.md +85 -0
- package/dist/accounting/accounts/index.d.ts +52 -0
- package/dist/accounting/accounts/index.d.ts.map +1 -0
- package/dist/accounting/accounts/index.js +72 -0
- package/dist/accounting/accounts/index.js.map +1 -0
- package/dist/accounting/accounts/type.d.ts +125 -0
- package/dist/accounting/accounts/type.d.ts.map +1 -0
- package/dist/accounting/accounts/type.js +4 -0
- package/dist/accounting/accounts/type.js.map +1 -0
- package/dist/accounting/index.d.ts +10 -0
- package/dist/accounting/index.d.ts.map +1 -0
- package/dist/accounting/index.js +16 -0
- package/dist/accounting/index.js.map +1 -0
- package/dist/accounting/journal-entries/index.d.ts +52 -0
- package/dist/accounting/journal-entries/index.d.ts.map +1 -0
- package/dist/accounting/journal-entries/index.js +72 -0
- package/dist/accounting/journal-entries/index.js.map +1 -0
- package/dist/accounting/journal-entries/type.d.ts +151 -0
- package/dist/accounting/journal-entries/type.d.ts.map +1 -0
- package/dist/accounting/journal-entries/type.js +4 -0
- package/dist/accounting/journal-entries/type.js.map +1 -0
- package/dist/common/type.d.ts +105 -0
- package/dist/common/type.d.ts.map +1 -0
- package/dist/common/type.js +3 -0
- package/dist/common/type.js.map +1 -0
- package/dist/contacts/contacts/index.d.ts +57 -0
- package/dist/contacts/contacts/index.d.ts.map +1 -0
- package/dist/contacts/contacts/index.js +82 -0
- package/dist/contacts/contacts/index.js.map +1 -0
- package/dist/contacts/contacts/type.d.ts +286 -0
- package/dist/contacts/contacts/type.d.ts.map +1 -0
- package/dist/contacts/contacts/type.js +4 -0
- package/dist/contacts/contacts/type.js.map +1 -0
- package/dist/contacts/groups/index.d.ts +42 -0
- package/dist/contacts/groups/index.d.ts.map +1 -0
- package/dist/contacts/groups/index.js +59 -0
- package/dist/contacts/groups/index.js.map +1 -0
- package/dist/contacts/groups/type.d.ts +34 -0
- package/dist/contacts/groups/type.d.ts.map +1 -0
- package/dist/contacts/groups/type.js +4 -0
- package/dist/contacts/groups/type.js.map +1 -0
- package/dist/contacts/index.d.ts +10 -0
- package/dist/contacts/index.d.ts.map +1 -0
- package/dist/contacts/index.js +15 -0
- package/dist/contacts/index.js.map +1 -0
- package/dist/control-panel/index.d.ts +15 -0
- package/dist/control-panel/index.d.ts.map +1 -0
- package/dist/control-panel/index.js +35 -0
- package/dist/control-panel/index.js.map +1 -0
- package/dist/control-panel/locations/index.d.ts +51 -0
- package/dist/control-panel/locations/index.d.ts.map +1 -0
- package/dist/control-panel/locations/index.js +70 -0
- package/dist/control-panel/locations/index.js.map +1 -0
- package/dist/control-panel/locations/type.d.ts +91 -0
- package/dist/control-panel/locations/type.d.ts.map +1 -0
- package/dist/control-panel/locations/type.js +4 -0
- package/dist/control-panel/locations/type.js.map +1 -0
- package/dist/control-panel/tag-groups/index.d.ts +44 -0
- package/dist/control-panel/tag-groups/index.d.ts.map +1 -0
- package/dist/control-panel/tag-groups/index.js +63 -0
- package/dist/control-panel/tag-groups/index.js.map +1 -0
- package/dist/control-panel/tag-groups/type.d.ts +64 -0
- package/dist/control-panel/tag-groups/type.d.ts.map +1 -0
- package/dist/control-panel/tag-groups/type.js +4 -0
- package/dist/control-panel/tag-groups/type.js.map +1 -0
- package/dist/control-panel/tags/index.d.ts +43 -0
- package/dist/control-panel/tags/index.d.ts.map +1 -0
- package/dist/control-panel/tags/index.js +60 -0
- package/dist/control-panel/tags/index.js.map +1 -0
- package/dist/control-panel/tags/type.d.ts +60 -0
- package/dist/control-panel/tags/type.d.ts.map +1 -0
- package/dist/control-panel/tags/type.js +4 -0
- package/dist/control-panel/tags/type.js.map +1 -0
- package/dist/files/index.d.ts +29 -0
- package/dist/files/index.d.ts.map +1 -0
- package/dist/files/index.js +42 -0
- package/dist/files/index.js.map +1 -0
- package/dist/files/type.d.ts +50 -0
- package/dist/files/type.d.ts.map +1 -0
- package/dist/files/type.js +4 -0
- package/dist/files/type.js.map +1 -0
- package/dist/index.d.ts +73 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +130 -0
- package/dist/index.js.map +1 -0
- package/dist/lists/index.d.ts +24 -0
- package/dist/lists/index.d.ts.map +1 -0
- package/dist/lists/index.js +33 -0
- package/dist/lists/index.js.map +1 -0
- package/dist/lists/type.d.ts +781 -0
- package/dist/lists/type.d.ts.map +1 -0
- package/dist/lists/type.js +3 -0
- package/dist/lists/type.js.map +1 -0
- package/dist/products/groups/index.d.ts +42 -0
- package/dist/products/groups/index.d.ts.map +1 -0
- package/dist/products/groups/index.js +59 -0
- package/dist/products/groups/index.js.map +1 -0
- package/dist/products/groups/type.d.ts +53 -0
- package/dist/products/groups/type.d.ts.map +1 -0
- package/dist/products/groups/type.js +5 -0
- package/dist/products/groups/type.js.map +1 -0
- package/dist/products/index.d.ts +10 -0
- package/dist/products/index.d.ts.map +1 -0
- package/dist/products/index.js +15 -0
- package/dist/products/index.js.map +1 -0
- package/dist/products/products/index.d.ts +51 -0
- package/dist/products/products/index.d.ts.map +1 -0
- package/dist/products/products/index.js +70 -0
- package/dist/products/products/index.js.map +1 -0
- package/dist/products/products/type.d.ts +270 -0
- package/dist/products/products/type.d.ts.map +1 -0
- package/dist/products/products/type.js +4 -0
- package/dist/products/products/type.js.map +1 -0
- package/dist/purchases/bills/index.d.ts +51 -0
- package/dist/purchases/bills/index.d.ts.map +1 -0
- package/dist/purchases/bills/index.js +75 -0
- package/dist/purchases/bills/index.js.map +1 -0
- package/dist/purchases/bills/type.d.ts +254 -0
- package/dist/purchases/bills/type.d.ts.map +1 -0
- package/dist/purchases/bills/type.js +4 -0
- package/dist/purchases/bills/type.js.map +1 -0
- package/dist/purchases/credit-notes/index.d.ts +51 -0
- package/dist/purchases/credit-notes/index.d.ts.map +1 -0
- package/dist/purchases/credit-notes/index.js +71 -0
- package/dist/purchases/credit-notes/index.js.map +1 -0
- package/dist/purchases/credit-notes/type.d.ts +204 -0
- package/dist/purchases/credit-notes/type.d.ts.map +1 -0
- package/dist/purchases/credit-notes/type.js +4 -0
- package/dist/purchases/credit-notes/type.js.map +1 -0
- package/dist/purchases/goods-received-notes/index.d.ts +51 -0
- package/dist/purchases/goods-received-notes/index.d.ts.map +1 -0
- package/dist/purchases/goods-received-notes/index.js +71 -0
- package/dist/purchases/goods-received-notes/index.js.map +1 -0
- package/dist/purchases/goods-received-notes/type.d.ts +184 -0
- package/dist/purchases/goods-received-notes/type.d.ts.map +1 -0
- package/dist/purchases/goods-received-notes/type.js +4 -0
- package/dist/purchases/goods-received-notes/type.js.map +1 -0
- package/dist/purchases/index.d.ts +18 -0
- package/dist/purchases/index.d.ts.map +1 -0
- package/dist/purchases/index.js +23 -0
- package/dist/purchases/index.js.map +1 -0
- package/dist/purchases/payments/index.d.ts +51 -0
- package/dist/purchases/payments/index.d.ts.map +1 -0
- package/dist/purchases/payments/index.js +71 -0
- package/dist/purchases/payments/index.js.map +1 -0
- package/dist/purchases/payments/type.d.ts +183 -0
- package/dist/purchases/payments/type.d.ts.map +1 -0
- package/dist/purchases/payments/type.js +4 -0
- package/dist/purchases/payments/type.js.map +1 -0
- package/dist/purchases/purchase-orders/index.d.ts +51 -0
- package/dist/purchases/purchase-orders/index.d.ts.map +1 -0
- package/dist/purchases/purchase-orders/index.js +71 -0
- package/dist/purchases/purchase-orders/index.js.map +1 -0
- package/dist/purchases/purchase-orders/type.d.ts +182 -0
- package/dist/purchases/purchase-orders/type.d.ts.map +1 -0
- package/dist/purchases/purchase-orders/type.js +4 -0
- package/dist/purchases/purchase-orders/type.js.map +1 -0
- package/dist/purchases/refunds/index.d.ts +51 -0
- package/dist/purchases/refunds/index.d.ts.map +1 -0
- package/dist/purchases/refunds/index.js +71 -0
- package/dist/purchases/refunds/index.js.map +1 -0
- package/dist/purchases/refunds/type.d.ts +181 -0
- package/dist/purchases/refunds/type.d.ts.map +1 -0
- package/dist/purchases/refunds/type.js +4 -0
- package/dist/purchases/refunds/type.js.map +1 -0
- package/dist/sales/credit-notes/index.d.ts +52 -0
- package/dist/sales/credit-notes/index.d.ts.map +1 -0
- package/dist/sales/credit-notes/index.js +72 -0
- package/dist/sales/credit-notes/index.js.map +1 -0
- package/dist/sales/credit-notes/type.d.ts +304 -0
- package/dist/sales/credit-notes/type.d.ts.map +1 -0
- package/dist/sales/credit-notes/type.js +4 -0
- package/dist/sales/credit-notes/type.js.map +1 -0
- package/dist/sales/delivery-orders/index.d.ts +51 -0
- package/dist/sales/delivery-orders/index.d.ts.map +1 -0
- package/dist/sales/delivery-orders/index.js +72 -0
- package/dist/sales/delivery-orders/index.js.map +1 -0
- package/dist/sales/delivery-orders/type.d.ts +212 -0
- package/dist/sales/delivery-orders/type.d.ts.map +1 -0
- package/dist/sales/delivery-orders/type.js +4 -0
- package/dist/sales/delivery-orders/type.js.map +1 -0
- package/dist/sales/index.d.ts +20 -0
- package/dist/sales/index.d.ts.map +1 -0
- package/dist/sales/index.js +24 -0
- package/dist/sales/index.js.map +1 -0
- package/dist/sales/invoices/index.d.ts +52 -0
- package/dist/sales/invoices/index.d.ts.map +1 -0
- package/dist/sales/invoices/index.js +73 -0
- package/dist/sales/invoices/index.js.map +1 -0
- package/dist/sales/invoices/type.d.ts +335 -0
- package/dist/sales/invoices/type.d.ts.map +1 -0
- package/dist/sales/invoices/type.js +4 -0
- package/dist/sales/invoices/type.js.map +1 -0
- package/dist/sales/payments/index.d.ts +52 -0
- package/dist/sales/payments/index.d.ts.map +1 -0
- package/dist/sales/payments/index.js +72 -0
- package/dist/sales/payments/index.js.map +1 -0
- package/dist/sales/payments/type.d.ts +242 -0
- package/dist/sales/payments/type.d.ts.map +1 -0
- package/dist/sales/payments/type.js +4 -0
- package/dist/sales/payments/type.js.map +1 -0
- package/dist/sales/quotations/index.d.ts +51 -0
- package/dist/sales/quotations/index.d.ts.map +1 -0
- package/dist/sales/quotations/index.js +71 -0
- package/dist/sales/quotations/index.js.map +1 -0
- package/dist/sales/quotations/type.d.ts +202 -0
- package/dist/sales/quotations/type.d.ts.map +1 -0
- package/dist/sales/quotations/type.js +3 -0
- package/dist/sales/quotations/type.js.map +1 -0
- package/dist/sales/refunds/index.d.ts +52 -0
- package/dist/sales/refunds/index.d.ts.map +1 -0
- package/dist/sales/refunds/index.js +72 -0
- package/dist/sales/refunds/index.js.map +1 -0
- package/dist/sales/refunds/type.d.ts +225 -0
- package/dist/sales/refunds/type.d.ts.map +1 -0
- package/dist/sales/refunds/type.js +4 -0
- package/dist/sales/refunds/type.js.map +1 -0
- package/dist/sales/sales-orders/index.d.ts +52 -0
- package/dist/sales/sales-orders/index.d.ts.map +1 -0
- package/dist/sales/sales-orders/index.js +72 -0
- package/dist/sales/sales-orders/index.js.map +1 -0
- package/dist/sales/sales-orders/type.d.ts +202 -0
- package/dist/sales/sales-orders/type.d.ts.map +1 -0
- package/dist/sales/sales-orders/type.js +4 -0
- package/dist/sales/sales-orders/type.js.map +1 -0
- package/dist/types.d.ts +17 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +4 -0
- package/dist/types.js.map +1 -0
- package/package.json +44 -0
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import { BukkuListPagination } from "../../common/type";
|
|
2
|
+
/**
|
|
3
|
+
* Represents a unit for a product when creating or updating.
|
|
4
|
+
*/
|
|
5
|
+
export interface BukkuProductUnitParams {
|
|
6
|
+
/** The ID of the unit, required when updating an existing unit. Omit for new units. */
|
|
7
|
+
id?: number;
|
|
8
|
+
label: string;
|
|
9
|
+
rate: number;
|
|
10
|
+
sale_price?: number;
|
|
11
|
+
purchase_price?: number;
|
|
12
|
+
is_base?: boolean;
|
|
13
|
+
is_sale_default?: boolean;
|
|
14
|
+
is_purchase_default?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Represents a custom sale price for a product when creating or updating.
|
|
18
|
+
*/
|
|
19
|
+
export interface BukkuProductSalePriceParams {
|
|
20
|
+
/** The ID of the sale price entry, required when updating an existing one. Omit for new entries. */
|
|
21
|
+
id?: number;
|
|
22
|
+
price_level_id?: number;
|
|
23
|
+
contact_id?: number;
|
|
24
|
+
date_from?: string;
|
|
25
|
+
date_to?: string;
|
|
26
|
+
product_unit_id: number;
|
|
27
|
+
minimum_quantity: number;
|
|
28
|
+
currency_code: string;
|
|
29
|
+
unit_price?: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Represents a custom purchase price for a product when creating or updating.
|
|
33
|
+
*/
|
|
34
|
+
export interface BukkuProductPurchasePriceParams {
|
|
35
|
+
/** The ID of the purchase price entry, required when updating an existing one. Omit for new entries. */
|
|
36
|
+
id?: number;
|
|
37
|
+
price_level_id?: number;
|
|
38
|
+
contact_id?: number;
|
|
39
|
+
date_from?: string;
|
|
40
|
+
date_to?: string;
|
|
41
|
+
product_unit_id: number;
|
|
42
|
+
minimum_quantity: number;
|
|
43
|
+
currency_code: string;
|
|
44
|
+
unit_price?: number;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Parameters for creating a new Product.
|
|
48
|
+
* Based on POST /products
|
|
49
|
+
*/
|
|
50
|
+
export interface BukkuProductCreateParams {
|
|
51
|
+
name: string;
|
|
52
|
+
sku?: string;
|
|
53
|
+
classification_code?: string | null;
|
|
54
|
+
is_selling: boolean;
|
|
55
|
+
sale_description?: string;
|
|
56
|
+
sale_account_id?: number;
|
|
57
|
+
sale_tax_code_id?: number;
|
|
58
|
+
is_buying: boolean;
|
|
59
|
+
purchase_description?: string;
|
|
60
|
+
purchase_account_id?: number;
|
|
61
|
+
purchase_tax_code_id?: number;
|
|
62
|
+
track_inventory: boolean;
|
|
63
|
+
inventory_account_id?: number;
|
|
64
|
+
quantity_low_alert?: number;
|
|
65
|
+
bin_location?: string;
|
|
66
|
+
remarks?: string;
|
|
67
|
+
units: BukkuProductUnitParams[];
|
|
68
|
+
group_ids?: number[];
|
|
69
|
+
sale_prices?: BukkuProductSalePriceParams[];
|
|
70
|
+
purchase_prices?: BukkuProductPurchasePriceParams[];
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Represents a Unit of a Product as returned by the API.
|
|
74
|
+
*/
|
|
75
|
+
export interface BukkuProductUnitResponse {
|
|
76
|
+
id: number;
|
|
77
|
+
label: string;
|
|
78
|
+
rate: number;
|
|
79
|
+
sale_price: number | null;
|
|
80
|
+
purchase_price: number | null;
|
|
81
|
+
is_base: boolean;
|
|
82
|
+
is_sale_default: boolean;
|
|
83
|
+
is_purchase_default: boolean;
|
|
84
|
+
created_at: string;
|
|
85
|
+
updated_at: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Represents a Custom Sale Price of a Product as returned by the API.
|
|
89
|
+
*/
|
|
90
|
+
export interface BukkuProductSalePriceResponse {
|
|
91
|
+
id: number;
|
|
92
|
+
price_level_id: number | null;
|
|
93
|
+
contact_id: number | null;
|
|
94
|
+
date_from: string | null;
|
|
95
|
+
date_to: string | null;
|
|
96
|
+
minimum_quantity: number;
|
|
97
|
+
product_unit_id: number;
|
|
98
|
+
currency_code: string;
|
|
99
|
+
unit_price: number | null;
|
|
100
|
+
created_at: string;
|
|
101
|
+
updated_at: string;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Represents a Custom Purchase Price of a Product as returned by the API.
|
|
105
|
+
*/
|
|
106
|
+
export interface BukkuProductPurchasePriceResponse {
|
|
107
|
+
id: number;
|
|
108
|
+
price_level_id: number | null;
|
|
109
|
+
contact_id: number | null;
|
|
110
|
+
date_from: string | null;
|
|
111
|
+
date_to: string | null;
|
|
112
|
+
minimum_quantity: number;
|
|
113
|
+
product_unit_id: number;
|
|
114
|
+
currency_code: string;
|
|
115
|
+
unit_price: number | null;
|
|
116
|
+
created_at: string;
|
|
117
|
+
updated_at: string;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Represents a Product object as returned by the API.
|
|
121
|
+
*/
|
|
122
|
+
export interface BukkuProduct {
|
|
123
|
+
id: number;
|
|
124
|
+
name: string;
|
|
125
|
+
sku: string | null;
|
|
126
|
+
classification_code: string | null;
|
|
127
|
+
type: string;
|
|
128
|
+
is_selling: boolean;
|
|
129
|
+
sale_description: string | null;
|
|
130
|
+
sale_account_id: number | null;
|
|
131
|
+
sale_tax_code_id: number | null;
|
|
132
|
+
is_buying: boolean;
|
|
133
|
+
purchase_description: string | null;
|
|
134
|
+
purchase_account_id: number | null;
|
|
135
|
+
purchase_tax_code_id: number | null;
|
|
136
|
+
track_inventory: boolean;
|
|
137
|
+
inventory_account_id: number | null;
|
|
138
|
+
quantity_low_alert: number | null;
|
|
139
|
+
quantity: number | null;
|
|
140
|
+
bin_location: string | null;
|
|
141
|
+
remarks: string | null;
|
|
142
|
+
units: BukkuProductUnitResponse[] | null;
|
|
143
|
+
group_ids: number[] | null;
|
|
144
|
+
sale_prices: BukkuProductSalePriceResponse[] | null;
|
|
145
|
+
purchase_prices: BukkuProductPurchasePriceResponse[] | null;
|
|
146
|
+
is_archived: boolean;
|
|
147
|
+
created_at: string;
|
|
148
|
+
updated_at: string;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Represents the API response structure when a product is created or retrieved.
|
|
152
|
+
*/
|
|
153
|
+
export interface BukkuProductResponse {
|
|
154
|
+
product: BukkuProduct;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Parameters for listing Bukku Products.
|
|
158
|
+
* Based on GET /products query parameters
|
|
159
|
+
*/
|
|
160
|
+
export interface BukkuProductListParams {
|
|
161
|
+
/** Search for keywords in Name, SKU, Sale Description, Purchase Description, Remarks. <= 60 characters */
|
|
162
|
+
search?: string;
|
|
163
|
+
/** Search by the stock level of product. */
|
|
164
|
+
stock_level?: "all" | "no_stock" | "low_stock";
|
|
165
|
+
/** Search by product mode. */
|
|
166
|
+
mode?: "sale" | "purchase";
|
|
167
|
+
/** Search by product type. */
|
|
168
|
+
type?: "product" | "bundle";
|
|
169
|
+
/** Whether to include soft deleted products. */
|
|
170
|
+
include_archived?: boolean;
|
|
171
|
+
/** The current page number. Default: 1, Min: 1. */
|
|
172
|
+
page?: number;
|
|
173
|
+
/** Number of records per page. Default: 30. */
|
|
174
|
+
page_size?: number;
|
|
175
|
+
/** Sort by field. */
|
|
176
|
+
sort_by?: "name" | "sku" | "sale_price" | "purchase_price" | "quantity";
|
|
177
|
+
/** Sort the list in ascending or descending order. */
|
|
178
|
+
sort_dir?: "asc" | "desc";
|
|
179
|
+
[key: string]: any;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Represents a summary of a Bukku Product as it appears in a list.
|
|
183
|
+
* This should align with the fields returned by the GET /products endpoint for list items.
|
|
184
|
+
* Based on the full BukkuProduct, but might be a subset.
|
|
185
|
+
*/
|
|
186
|
+
export interface BukkuProductListItem {
|
|
187
|
+
id: number;
|
|
188
|
+
name: string;
|
|
189
|
+
sku: string | null;
|
|
190
|
+
classification_code: string | null;
|
|
191
|
+
type: string;
|
|
192
|
+
is_selling: boolean;
|
|
193
|
+
sale_description: string | null;
|
|
194
|
+
sale_account_id: number | null;
|
|
195
|
+
sale_tax_code_id: number | null;
|
|
196
|
+
is_buying: boolean;
|
|
197
|
+
purchase_description: string | null;
|
|
198
|
+
purchase_account_id: number | null;
|
|
199
|
+
purchase_tax_code_id: number | null;
|
|
200
|
+
track_inventory: boolean;
|
|
201
|
+
inventory_account_id: number | null;
|
|
202
|
+
quantity_low_alert: number | null;
|
|
203
|
+
quantity: number | null;
|
|
204
|
+
bin_location: string | null;
|
|
205
|
+
remarks: string | null;
|
|
206
|
+
is_archived: boolean;
|
|
207
|
+
created_at: string;
|
|
208
|
+
updated_at: string;
|
|
209
|
+
sale_price?: number | null;
|
|
210
|
+
purchase_price?: number | null;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Represents the API response structure for listing products.
|
|
214
|
+
*/
|
|
215
|
+
export interface BukkuProductListApiResponse {
|
|
216
|
+
paging: BukkuListPagination;
|
|
217
|
+
products: BukkuProductListItem[];
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Parameters for updating an existing Product.
|
|
221
|
+
* Based on PUT /products/{productId}
|
|
222
|
+
* Fields that are required for creation are also required for update.
|
|
223
|
+
*/
|
|
224
|
+
export interface BukkuProductUpdateParams {
|
|
225
|
+
name: string;
|
|
226
|
+
sku?: string;
|
|
227
|
+
classification_code?: string | null;
|
|
228
|
+
is_selling: boolean;
|
|
229
|
+
sale_description?: string;
|
|
230
|
+
sale_account_id?: number;
|
|
231
|
+
sale_tax_code_id?: number;
|
|
232
|
+
is_buying: boolean;
|
|
233
|
+
purchase_description?: string;
|
|
234
|
+
purchase_account_id?: number;
|
|
235
|
+
purchase_tax_code_id?: number;
|
|
236
|
+
track_inventory: boolean;
|
|
237
|
+
inventory_account_id?: number;
|
|
238
|
+
quantity_low_alert?: number;
|
|
239
|
+
bin_location?: string;
|
|
240
|
+
remarks?: string;
|
|
241
|
+
/**
|
|
242
|
+
* Array of product units.
|
|
243
|
+
* When updating, include 'id' for existing units to modify them.
|
|
244
|
+
* Omit 'id' for new units to add them.
|
|
245
|
+
* Units not included in the array might be removed (API behavior dependent).
|
|
246
|
+
*/
|
|
247
|
+
units: BukkuProductUnitParams[];
|
|
248
|
+
group_ids?: number[];
|
|
249
|
+
/**
|
|
250
|
+
* Array of product custom sale prices.
|
|
251
|
+
* Include 'id' for existing entries to modify. Omit for new entries.
|
|
252
|
+
* Entries not included might be removed.
|
|
253
|
+
*/
|
|
254
|
+
sale_prices?: BukkuProductSalePriceParams[];
|
|
255
|
+
/**
|
|
256
|
+
* Array of product custom purchase prices.
|
|
257
|
+
* Include 'id' for existing entries to modify. Omit for new entries.
|
|
258
|
+
* Entries not included might be removed.
|
|
259
|
+
*/
|
|
260
|
+
purchase_prices?: BukkuProductPurchasePriceParams[];
|
|
261
|
+
is_archived?: boolean;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Parameters for archiving or unarchiving a Product.
|
|
265
|
+
* Based on PATCH /products/{productId}
|
|
266
|
+
*/
|
|
267
|
+
export interface BukkuProductArchiveParams {
|
|
268
|
+
is_archived: boolean;
|
|
269
|
+
}
|
|
270
|
+
//# sourceMappingURL=type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../src/products/products/type.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,uFAAuF;IACvF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,oGAAoG;IACpG,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,+BAA+B;IAC9C,wGAAwG;IACxG,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,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"names":[],"mappings":";AAAA,sCAAsC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { BukkuAPIRequestFunction } from "../../types";
|
|
2
|
+
import { BukkuBill, BukkuBillCreateParams, BukkuBillListParams, BukkuBillListApiResponse, BukkuBillUpdateParams, BukkuBillStatusUpdateParams } from "./type";
|
|
3
|
+
export declare class BillsAPI {
|
|
4
|
+
private _request;
|
|
5
|
+
constructor(_request: BukkuAPIRequestFunction);
|
|
6
|
+
/**
|
|
7
|
+
* Creates a new bill.
|
|
8
|
+
* Endpoint: POST /purchases/bills
|
|
9
|
+
* @param data - The data for the new bill.
|
|
10
|
+
* @returns A promise that resolves to the created bill.
|
|
11
|
+
*/
|
|
12
|
+
create(data: BukkuBillCreateParams): Promise<BukkuBill>;
|
|
13
|
+
/**
|
|
14
|
+
* Retrieves a paginated list of bills.
|
|
15
|
+
* Endpoint: GET /purchases/bills
|
|
16
|
+
* @param params - Optional parameters for filtering and pagination.
|
|
17
|
+
* @returns A promise that resolves to the API response for listing bills.
|
|
18
|
+
*/
|
|
19
|
+
list(params?: BukkuBillListParams): Promise<BukkuBillListApiResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* Retrieves a specific bill by its ID.
|
|
22
|
+
* Endpoint: GET /purchases/bills/{id}
|
|
23
|
+
* @param id - The ID of the bill to retrieve.
|
|
24
|
+
* @returns A promise that resolves to the bill.
|
|
25
|
+
*/
|
|
26
|
+
get(id: string | number): Promise<BukkuBill>;
|
|
27
|
+
/**
|
|
28
|
+
* Updates an existing bill.
|
|
29
|
+
* Endpoint: PUT /purchases/bills/{id}
|
|
30
|
+
* @param id - The ID of the bill to update.
|
|
31
|
+
* @param data - The data to update the bill with.
|
|
32
|
+
* @returns A promise that resolves to the updated bill.
|
|
33
|
+
*/
|
|
34
|
+
update(id: string | number, data: BukkuBillUpdateParams): Promise<BukkuBill>;
|
|
35
|
+
/**
|
|
36
|
+
* Updates the status of an existing bill.
|
|
37
|
+
* Endpoint: PATCH /purchases/bills/{id}
|
|
38
|
+
* @param id - The ID of the bill to update.
|
|
39
|
+
* @param data - The data containing the new status.
|
|
40
|
+
* @returns A promise that resolves to the updated bill.
|
|
41
|
+
*/
|
|
42
|
+
updateStatus(id: string | number, data: BukkuBillStatusUpdateParams): Promise<BukkuBill>;
|
|
43
|
+
/**
|
|
44
|
+
* Deletes a bill.
|
|
45
|
+
* Endpoint: DELETE /purchases/bills/{id}
|
|
46
|
+
* @param id - The ID of the bill to delete.
|
|
47
|
+
* @returns A promise that resolves when the bill is deleted.
|
|
48
|
+
*/
|
|
49
|
+
delete(id: string | number): Promise<void>;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/purchases/bills/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EACL,SAAS,EACT,qBAAqB,EAErB,mBAAmB,EACnB,wBAAwB,EACxB,qBAAqB,EACrB,2BAA2B,EAC5B,MAAM,QAAQ,CAAC;AAEhB,qBAAa,QAAQ;IACP,OAAO,CAAC,QAAQ;gBAAR,QAAQ,EAAE,uBAAuB;IAErD;;;;;OAKG;IACG,MAAM,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,SAAS,CAAC;IAS7D;;;;;OAKG;IACG,IAAI,CAAC,MAAM,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAS3E;;;;;OAKG;IACG,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAQlD;;;;;;OAMG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,SAAS,CAAC;IASlF;;;;;;OAMG;IACG,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,IAAI,EAAE,2BAA2B,GAAG,OAAO,CAAC,SAAS,CAAC;IAY9F;;;;;OAKG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGjD"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// src/purchases/bills/index.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.BillsAPI = void 0;
|
|
5
|
+
class BillsAPI {
|
|
6
|
+
constructor(_request) {
|
|
7
|
+
this._request = _request;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new bill.
|
|
11
|
+
* Endpoint: POST /purchases/bills
|
|
12
|
+
* @param data - The data for the new bill.
|
|
13
|
+
* @returns A promise that resolves to the created bill.
|
|
14
|
+
*/
|
|
15
|
+
async create(data) {
|
|
16
|
+
const response = await this._request("/purchases/bills", "POST", data);
|
|
17
|
+
return response.transaction;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Retrieves a paginated list of bills.
|
|
21
|
+
* Endpoint: GET /purchases/bills
|
|
22
|
+
* @param params - Optional parameters for filtering and pagination.
|
|
23
|
+
* @returns A promise that resolves to the API response for listing bills.
|
|
24
|
+
*/
|
|
25
|
+
async list(params) {
|
|
26
|
+
return this._request("/purchases/bills", "GET", undefined, params);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Retrieves a specific bill by its ID.
|
|
30
|
+
* Endpoint: GET /purchases/bills/{id}
|
|
31
|
+
* @param id - The ID of the bill to retrieve.
|
|
32
|
+
* @returns A promise that resolves to the bill.
|
|
33
|
+
*/
|
|
34
|
+
async get(id) {
|
|
35
|
+
const response = await this._request(`/purchases/bills/${id}`, "GET");
|
|
36
|
+
return response.transaction;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Updates an existing bill.
|
|
40
|
+
* Endpoint: PUT /purchases/bills/{id}
|
|
41
|
+
* @param id - The ID of the bill to update.
|
|
42
|
+
* @param data - The data to update the bill with.
|
|
43
|
+
* @returns A promise that resolves to the updated bill.
|
|
44
|
+
*/
|
|
45
|
+
async update(id, data) {
|
|
46
|
+
const response = await this._request(`/purchases/bills/${id}`, "PUT", data);
|
|
47
|
+
return response.transaction;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Updates the status of an existing bill.
|
|
51
|
+
* Endpoint: PATCH /purchases/bills/{id}
|
|
52
|
+
* @param id - The ID of the bill to update.
|
|
53
|
+
* @param data - The data containing the new status.
|
|
54
|
+
* @returns A promise that resolves to the updated bill.
|
|
55
|
+
*/
|
|
56
|
+
async updateStatus(id, data) {
|
|
57
|
+
// Assuming the PATCH endpoint for status update follows a similar pattern
|
|
58
|
+
// and the response returns the full bill object.
|
|
59
|
+
// The API documentation for PATCH /purchases/bills/{id} would confirm this.
|
|
60
|
+
const response = await this._request(`/purchases/bills/${id}`, // Or a specific status endpoint like /purchases/bills/{id}/status
|
|
61
|
+
"PATCH", data);
|
|
62
|
+
return response.transaction;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Deletes a bill.
|
|
66
|
+
* Endpoint: DELETE /purchases/bills/{id}
|
|
67
|
+
* @param id - The ID of the bill to delete.
|
|
68
|
+
* @returns A promise that resolves when the bill is deleted.
|
|
69
|
+
*/
|
|
70
|
+
async delete(id) {
|
|
71
|
+
await this._request(`/purchases/bills/${id}`, "DELETE");
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.BillsAPI = BillsAPI;
|
|
75
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/purchases/bills/index.ts"],"names":[],"mappings":";AAAA,+BAA+B;;;AAa/B,MAAa,QAAQ;IACnB,YAAoB,QAAiC;QAAjC,aAAQ,GAAR,QAAQ,CAAyB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C;CACF;AA3FD,4BA2FC"}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { // Assuming this might be needed for update/create later
|
|
2
|
+
BukkuFileAttachment, // For create/update
|
|
3
|
+
BukkuAttachedFileResponse, // For response
|
|
4
|
+
BukkuListPagination, BukkuFormItem } from "../../common/type";
|
|
5
|
+
/**
|
|
6
|
+
* Represents a form item for creating a Bukku Bill.
|
|
7
|
+
* Based on the form_items array in the POST /purchases/bills request body.
|
|
8
|
+
*/
|
|
9
|
+
export interface BukkuBillFormItemCreateParams {
|
|
10
|
+
id?: number;
|
|
11
|
+
transfer_item_id?: number;
|
|
12
|
+
type?: "bundle" | "subtitle" | "subtotal" | null;
|
|
13
|
+
account_id?: number;
|
|
14
|
+
description?: string;
|
|
15
|
+
service_date?: string;
|
|
16
|
+
product_id?: number;
|
|
17
|
+
product_unit_id?: number;
|
|
18
|
+
location_id?: number;
|
|
19
|
+
unit_price?: number;
|
|
20
|
+
quantity?: number;
|
|
21
|
+
discount?: string;
|
|
22
|
+
tax_code_id?: number;
|
|
23
|
+
classification_code?: string;
|
|
24
|
+
children?: BukkuBillFormItemCreateParams[];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Represents a deposit item for creating a Bukku Bill.
|
|
28
|
+
* Based on the deposit_items array in the POST /purchases/bills request body.
|
|
29
|
+
*/
|
|
30
|
+
export interface BukkuBillDepositItemCreateParams {
|
|
31
|
+
id?: number;
|
|
32
|
+
payment_method_id?: number;
|
|
33
|
+
account_id: number;
|
|
34
|
+
amount: number;
|
|
35
|
+
number?: string;
|
|
36
|
+
fee_text?: string;
|
|
37
|
+
fee_account_id?: number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Parameters for creating a Bukku Bill.
|
|
41
|
+
* Based on POST /purchases/bills
|
|
42
|
+
*/
|
|
43
|
+
export interface BukkuBillCreateParams {
|
|
44
|
+
payment_mode: "cash" | "credit" | "claim";
|
|
45
|
+
contact_id: number;
|
|
46
|
+
contact2_id?: number;
|
|
47
|
+
number?: string;
|
|
48
|
+
number2?: string;
|
|
49
|
+
date: string;
|
|
50
|
+
term_id?: number;
|
|
51
|
+
due_date?: string;
|
|
52
|
+
currency_code: string;
|
|
53
|
+
exchange_rate: number;
|
|
54
|
+
billing_party?: string;
|
|
55
|
+
tag_ids?: number[];
|
|
56
|
+
description?: string;
|
|
57
|
+
remarks?: string;
|
|
58
|
+
tax_mode: "inclusive" | "exclusive";
|
|
59
|
+
form_items: BukkuBillFormItemCreateParams[];
|
|
60
|
+
deposit_items?: BukkuBillDepositItemCreateParams[];
|
|
61
|
+
status: "draft" | "pending_approval" | "ready";
|
|
62
|
+
files?: BukkuFileAttachment[];
|
|
63
|
+
customs_form_no?: string | null;
|
|
64
|
+
customs_k2_form_no?: string | null;
|
|
65
|
+
incoterms?: string | null;
|
|
66
|
+
myinvois_action?: "NORMAL" | "VALIDATE" | "EXTERNAL";
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Represents a term item within a Bukku Bill response.
|
|
70
|
+
*/
|
|
71
|
+
export interface BukkuBillTermItem {
|
|
72
|
+
id: number;
|
|
73
|
+
term_id: number;
|
|
74
|
+
term_name: string;
|
|
75
|
+
date: string;
|
|
76
|
+
payment_due: string;
|
|
77
|
+
description: string;
|
|
78
|
+
amount: number;
|
|
79
|
+
balance: number;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Represents a deposit item as returned in a Bukku Bill response.
|
|
83
|
+
*/
|
|
84
|
+
export interface BukkuBillDepositItem {
|
|
85
|
+
id: number;
|
|
86
|
+
line: number;
|
|
87
|
+
payment_method_id: number;
|
|
88
|
+
account_id: number;
|
|
89
|
+
amount: number;
|
|
90
|
+
number: string;
|
|
91
|
+
fee_text: string | null;
|
|
92
|
+
fee_account_id: number | null;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Represents a linked item as returned in a Bukku Bill response.
|
|
96
|
+
*/
|
|
97
|
+
export interface BukkuBillLinkedItem {
|
|
98
|
+
id: number;
|
|
99
|
+
origin_transaction_id: number;
|
|
100
|
+
type: string;
|
|
101
|
+
number: string;
|
|
102
|
+
date: string;
|
|
103
|
+
amount: number;
|
|
104
|
+
balance: number;
|
|
105
|
+
apply_amount: number;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Represents a Bukku Bill object as returned by the API.
|
|
109
|
+
* Based on the response sample for POST /purchases/bills
|
|
110
|
+
*/
|
|
111
|
+
export interface BukkuBill {
|
|
112
|
+
id: number;
|
|
113
|
+
payment_mode: "cash" | "credit" | "claim";
|
|
114
|
+
contact_id: number;
|
|
115
|
+
contact_name: string;
|
|
116
|
+
contact2_id: number | null;
|
|
117
|
+
contact2_name: string | null;
|
|
118
|
+
number: string;
|
|
119
|
+
number2: string | null;
|
|
120
|
+
date: string;
|
|
121
|
+
term_id: number | null;
|
|
122
|
+
term_name: string | null;
|
|
123
|
+
term_items: BukkuBillTermItem[] | null;
|
|
124
|
+
due_date: string | null;
|
|
125
|
+
currency_code: string;
|
|
126
|
+
currency_symbol: string;
|
|
127
|
+
exchange_rate: number;
|
|
128
|
+
billing_party: string | null;
|
|
129
|
+
tag_ids: number[] | null;
|
|
130
|
+
tag_names: string[] | null;
|
|
131
|
+
description: string | null;
|
|
132
|
+
remarks: string | null;
|
|
133
|
+
tax_mode: "inclusive" | "exclusive";
|
|
134
|
+
form_items: BukkuFormItem[];
|
|
135
|
+
deposit_items: BukkuBillDepositItem[] | null;
|
|
136
|
+
linked_items: BukkuBillLinkedItem[] | null;
|
|
137
|
+
amount: number;
|
|
138
|
+
balance: number;
|
|
139
|
+
status: string;
|
|
140
|
+
type: string;
|
|
141
|
+
files: BukkuAttachedFileResponse[] | null;
|
|
142
|
+
customs_form_no: string | null;
|
|
143
|
+
customs_k2_form_no: string | null;
|
|
144
|
+
incoterms: string | null;
|
|
145
|
+
myinvois_action: "NORMAL" | "VALIDATE" | "EXTERNAL" | null;
|
|
146
|
+
myinvois_document_uuid: string | null;
|
|
147
|
+
myinvois_document_long_id: string | null;
|
|
148
|
+
myinvois_document_status: string | null;
|
|
149
|
+
issued_at: string | null;
|
|
150
|
+
validated_at: string | null;
|
|
151
|
+
rejected_at: string | null;
|
|
152
|
+
reject_message: string | null;
|
|
153
|
+
cancelled_at: string | null;
|
|
154
|
+
cancel_message: string | null;
|
|
155
|
+
short_link?: string;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Represents the API response structure when a bill is created or retrieved.
|
|
159
|
+
*/
|
|
160
|
+
export interface BukkuBillResponse {
|
|
161
|
+
transaction: BukkuBill;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Parameters for updating a Bukku Bill.
|
|
165
|
+
* Based on PUT /purchases/bills/{id}
|
|
166
|
+
*/
|
|
167
|
+
export interface BukkuBillUpdateParams {
|
|
168
|
+
payment_mode: "cash" | "credit" | "claim";
|
|
169
|
+
contact_id: number;
|
|
170
|
+
contact2_id?: number;
|
|
171
|
+
number: string;
|
|
172
|
+
number2?: string;
|
|
173
|
+
date: string;
|
|
174
|
+
term_id?: number;
|
|
175
|
+
due_date?: string;
|
|
176
|
+
currency_code: string;
|
|
177
|
+
exchange_rate: number;
|
|
178
|
+
billing_party?: string;
|
|
179
|
+
tag_ids?: number[];
|
|
180
|
+
description?: string;
|
|
181
|
+
remarks?: string;
|
|
182
|
+
tax_mode: "inclusive" | "exclusive";
|
|
183
|
+
form_items: BukkuBillFormItemCreateParams[];
|
|
184
|
+
deposit_items?: BukkuBillDepositItemCreateParams[];
|
|
185
|
+
files?: BukkuFileAttachment[];
|
|
186
|
+
customs_form_no?: string | null;
|
|
187
|
+
customs_k2_form_no?: string | null;
|
|
188
|
+
incoterms?: string | null;
|
|
189
|
+
myinvois_action?: "NORMAL" | "VALIDATE" | "EXTERNAL";
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Parameters for updating the status of a Bukku Bill.
|
|
193
|
+
* Typically includes a status field.
|
|
194
|
+
*/
|
|
195
|
+
export interface BukkuBillStatusUpdateParams {
|
|
196
|
+
status: "draft" | "pending_approval" | "ready" | "void";
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Parameters for listing Bukku Bills.
|
|
200
|
+
* This would include filters, pagination, sorting.
|
|
201
|
+
*/
|
|
202
|
+
export interface BukkuBillListParams {
|
|
203
|
+
search?: string;
|
|
204
|
+
custom_search?: string;
|
|
205
|
+
contact_id?: number;
|
|
206
|
+
date_from?: string;
|
|
207
|
+
date_to?: string;
|
|
208
|
+
status?: "all" | "draft" | "pending_approval" | "ready" | "void";
|
|
209
|
+
payment_mode?: "credit" | "cash" | "claim";
|
|
210
|
+
payment_status?: "PAID" | "OUTSTANDING" | "OVERDUE";
|
|
211
|
+
page?: number;
|
|
212
|
+
page_size?: number;
|
|
213
|
+
sort_by?: "number" | "date" | "contact_name" | "contact2_name" | "number2" | "description" | "amount" | "balance" | "created_at";
|
|
214
|
+
sort_dir?: "asc" | "desc";
|
|
215
|
+
[key: string]: any;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Represents a summary of a Bukku Bill as it appears in a list.
|
|
219
|
+
*/
|
|
220
|
+
export interface BukkuBillListItem {
|
|
221
|
+
id: number;
|
|
222
|
+
payment_mode: string;
|
|
223
|
+
contact_id: number;
|
|
224
|
+
contact_name: string;
|
|
225
|
+
contact2_name?: string | null;
|
|
226
|
+
number: string;
|
|
227
|
+
number2: string | null;
|
|
228
|
+
date: string;
|
|
229
|
+
due_date?: string | null;
|
|
230
|
+
currency_code: string;
|
|
231
|
+
currency_symbol: string;
|
|
232
|
+
exchange_rate: number;
|
|
233
|
+
billing_party?: string | null;
|
|
234
|
+
tag_names?: string[] | null;
|
|
235
|
+
description?: string | null;
|
|
236
|
+
amount: number;
|
|
237
|
+
balance?: number;
|
|
238
|
+
status: string;
|
|
239
|
+
file_count?: number;
|
|
240
|
+
short_link?: string;
|
|
241
|
+
created_by?: string;
|
|
242
|
+
created_at: string;
|
|
243
|
+
updated_at: string;
|
|
244
|
+
myinvois_document_status?: string | null;
|
|
245
|
+
myinvois_document_uuid?: string | null;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Represents the API response structure for listing bills.
|
|
249
|
+
*/
|
|
250
|
+
export interface BukkuBillListApiResponse {
|
|
251
|
+
paging: BukkuListPagination;
|
|
252
|
+
transactions: BukkuBillListItem[];
|
|
253
|
+
}
|
|
254
|
+
//# sourceMappingURL=type.d.ts.map
|