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.
Files changed (231) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +85 -0
  3. package/dist/accounting/accounts/index.d.ts +52 -0
  4. package/dist/accounting/accounts/index.d.ts.map +1 -0
  5. package/dist/accounting/accounts/index.js +72 -0
  6. package/dist/accounting/accounts/index.js.map +1 -0
  7. package/dist/accounting/accounts/type.d.ts +125 -0
  8. package/dist/accounting/accounts/type.d.ts.map +1 -0
  9. package/dist/accounting/accounts/type.js +4 -0
  10. package/dist/accounting/accounts/type.js.map +1 -0
  11. package/dist/accounting/index.d.ts +10 -0
  12. package/dist/accounting/index.d.ts.map +1 -0
  13. package/dist/accounting/index.js +16 -0
  14. package/dist/accounting/index.js.map +1 -0
  15. package/dist/accounting/journal-entries/index.d.ts +52 -0
  16. package/dist/accounting/journal-entries/index.d.ts.map +1 -0
  17. package/dist/accounting/journal-entries/index.js +72 -0
  18. package/dist/accounting/journal-entries/index.js.map +1 -0
  19. package/dist/accounting/journal-entries/type.d.ts +151 -0
  20. package/dist/accounting/journal-entries/type.d.ts.map +1 -0
  21. package/dist/accounting/journal-entries/type.js +4 -0
  22. package/dist/accounting/journal-entries/type.js.map +1 -0
  23. package/dist/common/type.d.ts +105 -0
  24. package/dist/common/type.d.ts.map +1 -0
  25. package/dist/common/type.js +3 -0
  26. package/dist/common/type.js.map +1 -0
  27. package/dist/contacts/contacts/index.d.ts +57 -0
  28. package/dist/contacts/contacts/index.d.ts.map +1 -0
  29. package/dist/contacts/contacts/index.js +82 -0
  30. package/dist/contacts/contacts/index.js.map +1 -0
  31. package/dist/contacts/contacts/type.d.ts +286 -0
  32. package/dist/contacts/contacts/type.d.ts.map +1 -0
  33. package/dist/contacts/contacts/type.js +4 -0
  34. package/dist/contacts/contacts/type.js.map +1 -0
  35. package/dist/contacts/groups/index.d.ts +42 -0
  36. package/dist/contacts/groups/index.d.ts.map +1 -0
  37. package/dist/contacts/groups/index.js +59 -0
  38. package/dist/contacts/groups/index.js.map +1 -0
  39. package/dist/contacts/groups/type.d.ts +34 -0
  40. package/dist/contacts/groups/type.d.ts.map +1 -0
  41. package/dist/contacts/groups/type.js +4 -0
  42. package/dist/contacts/groups/type.js.map +1 -0
  43. package/dist/contacts/index.d.ts +10 -0
  44. package/dist/contacts/index.d.ts.map +1 -0
  45. package/dist/contacts/index.js +15 -0
  46. package/dist/contacts/index.js.map +1 -0
  47. package/dist/control-panel/index.d.ts +15 -0
  48. package/dist/control-panel/index.d.ts.map +1 -0
  49. package/dist/control-panel/index.js +35 -0
  50. package/dist/control-panel/index.js.map +1 -0
  51. package/dist/control-panel/locations/index.d.ts +51 -0
  52. package/dist/control-panel/locations/index.d.ts.map +1 -0
  53. package/dist/control-panel/locations/index.js +70 -0
  54. package/dist/control-panel/locations/index.js.map +1 -0
  55. package/dist/control-panel/locations/type.d.ts +91 -0
  56. package/dist/control-panel/locations/type.d.ts.map +1 -0
  57. package/dist/control-panel/locations/type.js +4 -0
  58. package/dist/control-panel/locations/type.js.map +1 -0
  59. package/dist/control-panel/tag-groups/index.d.ts +44 -0
  60. package/dist/control-panel/tag-groups/index.d.ts.map +1 -0
  61. package/dist/control-panel/tag-groups/index.js +63 -0
  62. package/dist/control-panel/tag-groups/index.js.map +1 -0
  63. package/dist/control-panel/tag-groups/type.d.ts +64 -0
  64. package/dist/control-panel/tag-groups/type.d.ts.map +1 -0
  65. package/dist/control-panel/tag-groups/type.js +4 -0
  66. package/dist/control-panel/tag-groups/type.js.map +1 -0
  67. package/dist/control-panel/tags/index.d.ts +43 -0
  68. package/dist/control-panel/tags/index.d.ts.map +1 -0
  69. package/dist/control-panel/tags/index.js +60 -0
  70. package/dist/control-panel/tags/index.js.map +1 -0
  71. package/dist/control-panel/tags/type.d.ts +60 -0
  72. package/dist/control-panel/tags/type.d.ts.map +1 -0
  73. package/dist/control-panel/tags/type.js +4 -0
  74. package/dist/control-panel/tags/type.js.map +1 -0
  75. package/dist/files/index.d.ts +29 -0
  76. package/dist/files/index.d.ts.map +1 -0
  77. package/dist/files/index.js +42 -0
  78. package/dist/files/index.js.map +1 -0
  79. package/dist/files/type.d.ts +50 -0
  80. package/dist/files/type.d.ts.map +1 -0
  81. package/dist/files/type.js +4 -0
  82. package/dist/files/type.js.map +1 -0
  83. package/dist/index.d.ts +73 -0
  84. package/dist/index.d.ts.map +1 -0
  85. package/dist/index.js +130 -0
  86. package/dist/index.js.map +1 -0
  87. package/dist/lists/index.d.ts +24 -0
  88. package/dist/lists/index.d.ts.map +1 -0
  89. package/dist/lists/index.js +33 -0
  90. package/dist/lists/index.js.map +1 -0
  91. package/dist/lists/type.d.ts +781 -0
  92. package/dist/lists/type.d.ts.map +1 -0
  93. package/dist/lists/type.js +3 -0
  94. package/dist/lists/type.js.map +1 -0
  95. package/dist/products/groups/index.d.ts +42 -0
  96. package/dist/products/groups/index.d.ts.map +1 -0
  97. package/dist/products/groups/index.js +59 -0
  98. package/dist/products/groups/index.js.map +1 -0
  99. package/dist/products/groups/type.d.ts +53 -0
  100. package/dist/products/groups/type.d.ts.map +1 -0
  101. package/dist/products/groups/type.js +5 -0
  102. package/dist/products/groups/type.js.map +1 -0
  103. package/dist/products/index.d.ts +10 -0
  104. package/dist/products/index.d.ts.map +1 -0
  105. package/dist/products/index.js +15 -0
  106. package/dist/products/index.js.map +1 -0
  107. package/dist/products/products/index.d.ts +51 -0
  108. package/dist/products/products/index.d.ts.map +1 -0
  109. package/dist/products/products/index.js +70 -0
  110. package/dist/products/products/index.js.map +1 -0
  111. package/dist/products/products/type.d.ts +270 -0
  112. package/dist/products/products/type.d.ts.map +1 -0
  113. package/dist/products/products/type.js +4 -0
  114. package/dist/products/products/type.js.map +1 -0
  115. package/dist/purchases/bills/index.d.ts +51 -0
  116. package/dist/purchases/bills/index.d.ts.map +1 -0
  117. package/dist/purchases/bills/index.js +75 -0
  118. package/dist/purchases/bills/index.js.map +1 -0
  119. package/dist/purchases/bills/type.d.ts +254 -0
  120. package/dist/purchases/bills/type.d.ts.map +1 -0
  121. package/dist/purchases/bills/type.js +4 -0
  122. package/dist/purchases/bills/type.js.map +1 -0
  123. package/dist/purchases/credit-notes/index.d.ts +51 -0
  124. package/dist/purchases/credit-notes/index.d.ts.map +1 -0
  125. package/dist/purchases/credit-notes/index.js +71 -0
  126. package/dist/purchases/credit-notes/index.js.map +1 -0
  127. package/dist/purchases/credit-notes/type.d.ts +204 -0
  128. package/dist/purchases/credit-notes/type.d.ts.map +1 -0
  129. package/dist/purchases/credit-notes/type.js +4 -0
  130. package/dist/purchases/credit-notes/type.js.map +1 -0
  131. package/dist/purchases/goods-received-notes/index.d.ts +51 -0
  132. package/dist/purchases/goods-received-notes/index.d.ts.map +1 -0
  133. package/dist/purchases/goods-received-notes/index.js +71 -0
  134. package/dist/purchases/goods-received-notes/index.js.map +1 -0
  135. package/dist/purchases/goods-received-notes/type.d.ts +184 -0
  136. package/dist/purchases/goods-received-notes/type.d.ts.map +1 -0
  137. package/dist/purchases/goods-received-notes/type.js +4 -0
  138. package/dist/purchases/goods-received-notes/type.js.map +1 -0
  139. package/dist/purchases/index.d.ts +18 -0
  140. package/dist/purchases/index.d.ts.map +1 -0
  141. package/dist/purchases/index.js +23 -0
  142. package/dist/purchases/index.js.map +1 -0
  143. package/dist/purchases/payments/index.d.ts +51 -0
  144. package/dist/purchases/payments/index.d.ts.map +1 -0
  145. package/dist/purchases/payments/index.js +71 -0
  146. package/dist/purchases/payments/index.js.map +1 -0
  147. package/dist/purchases/payments/type.d.ts +183 -0
  148. package/dist/purchases/payments/type.d.ts.map +1 -0
  149. package/dist/purchases/payments/type.js +4 -0
  150. package/dist/purchases/payments/type.js.map +1 -0
  151. package/dist/purchases/purchase-orders/index.d.ts +51 -0
  152. package/dist/purchases/purchase-orders/index.d.ts.map +1 -0
  153. package/dist/purchases/purchase-orders/index.js +71 -0
  154. package/dist/purchases/purchase-orders/index.js.map +1 -0
  155. package/dist/purchases/purchase-orders/type.d.ts +182 -0
  156. package/dist/purchases/purchase-orders/type.d.ts.map +1 -0
  157. package/dist/purchases/purchase-orders/type.js +4 -0
  158. package/dist/purchases/purchase-orders/type.js.map +1 -0
  159. package/dist/purchases/refunds/index.d.ts +51 -0
  160. package/dist/purchases/refunds/index.d.ts.map +1 -0
  161. package/dist/purchases/refunds/index.js +71 -0
  162. package/dist/purchases/refunds/index.js.map +1 -0
  163. package/dist/purchases/refunds/type.d.ts +181 -0
  164. package/dist/purchases/refunds/type.d.ts.map +1 -0
  165. package/dist/purchases/refunds/type.js +4 -0
  166. package/dist/purchases/refunds/type.js.map +1 -0
  167. package/dist/sales/credit-notes/index.d.ts +52 -0
  168. package/dist/sales/credit-notes/index.d.ts.map +1 -0
  169. package/dist/sales/credit-notes/index.js +72 -0
  170. package/dist/sales/credit-notes/index.js.map +1 -0
  171. package/dist/sales/credit-notes/type.d.ts +304 -0
  172. package/dist/sales/credit-notes/type.d.ts.map +1 -0
  173. package/dist/sales/credit-notes/type.js +4 -0
  174. package/dist/sales/credit-notes/type.js.map +1 -0
  175. package/dist/sales/delivery-orders/index.d.ts +51 -0
  176. package/dist/sales/delivery-orders/index.d.ts.map +1 -0
  177. package/dist/sales/delivery-orders/index.js +72 -0
  178. package/dist/sales/delivery-orders/index.js.map +1 -0
  179. package/dist/sales/delivery-orders/type.d.ts +212 -0
  180. package/dist/sales/delivery-orders/type.d.ts.map +1 -0
  181. package/dist/sales/delivery-orders/type.js +4 -0
  182. package/dist/sales/delivery-orders/type.js.map +1 -0
  183. package/dist/sales/index.d.ts +20 -0
  184. package/dist/sales/index.d.ts.map +1 -0
  185. package/dist/sales/index.js +24 -0
  186. package/dist/sales/index.js.map +1 -0
  187. package/dist/sales/invoices/index.d.ts +52 -0
  188. package/dist/sales/invoices/index.d.ts.map +1 -0
  189. package/dist/sales/invoices/index.js +73 -0
  190. package/dist/sales/invoices/index.js.map +1 -0
  191. package/dist/sales/invoices/type.d.ts +335 -0
  192. package/dist/sales/invoices/type.d.ts.map +1 -0
  193. package/dist/sales/invoices/type.js +4 -0
  194. package/dist/sales/invoices/type.js.map +1 -0
  195. package/dist/sales/payments/index.d.ts +52 -0
  196. package/dist/sales/payments/index.d.ts.map +1 -0
  197. package/dist/sales/payments/index.js +72 -0
  198. package/dist/sales/payments/index.js.map +1 -0
  199. package/dist/sales/payments/type.d.ts +242 -0
  200. package/dist/sales/payments/type.d.ts.map +1 -0
  201. package/dist/sales/payments/type.js +4 -0
  202. package/dist/sales/payments/type.js.map +1 -0
  203. package/dist/sales/quotations/index.d.ts +51 -0
  204. package/dist/sales/quotations/index.d.ts.map +1 -0
  205. package/dist/sales/quotations/index.js +71 -0
  206. package/dist/sales/quotations/index.js.map +1 -0
  207. package/dist/sales/quotations/type.d.ts +202 -0
  208. package/dist/sales/quotations/type.d.ts.map +1 -0
  209. package/dist/sales/quotations/type.js +3 -0
  210. package/dist/sales/quotations/type.js.map +1 -0
  211. package/dist/sales/refunds/index.d.ts +52 -0
  212. package/dist/sales/refunds/index.d.ts.map +1 -0
  213. package/dist/sales/refunds/index.js +72 -0
  214. package/dist/sales/refunds/index.js.map +1 -0
  215. package/dist/sales/refunds/type.d.ts +225 -0
  216. package/dist/sales/refunds/type.d.ts.map +1 -0
  217. package/dist/sales/refunds/type.js +4 -0
  218. package/dist/sales/refunds/type.js.map +1 -0
  219. package/dist/sales/sales-orders/index.d.ts +52 -0
  220. package/dist/sales/sales-orders/index.d.ts.map +1 -0
  221. package/dist/sales/sales-orders/index.js +72 -0
  222. package/dist/sales/sales-orders/index.js.map +1 -0
  223. package/dist/sales/sales-orders/type.d.ts +202 -0
  224. package/dist/sales/sales-orders/type.d.ts.map +1 -0
  225. package/dist/sales/sales-orders/type.js +4 -0
  226. package/dist/sales/sales-orders/type.js.map +1 -0
  227. package/dist/types.d.ts +17 -0
  228. package/dist/types.d.ts.map +1 -0
  229. package/dist/types.js +4 -0
  230. package/dist/types.js.map +1 -0
  231. package/package.json +44 -0
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ // src/purchases/purchase-orders/index.ts
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.PurchaseOrdersAPI = void 0;
5
+ class PurchaseOrdersAPI {
6
+ constructor(_request) {
7
+ this._request = _request;
8
+ }
9
+ /**
10
+ * Creates a new purchase order.
11
+ * Endpoint: POST /purchases/orders
12
+ * @param data - The data for the new purchase order.
13
+ * @returns A promise that resolves to the created purchase order.
14
+ */
15
+ async create(data) {
16
+ const response = await this._request("/purchases/orders", "POST", data);
17
+ return response.transaction;
18
+ }
19
+ /**
20
+ * Retrieves a paginated list of purchase orders.
21
+ * Endpoint: GET /purchases/orders
22
+ * @param params - Optional parameters for filtering and pagination.
23
+ * @returns A promise that resolves to the API response for listing purchase orders.
24
+ */
25
+ async list(params) {
26
+ return this._request("/purchases/orders", "GET", undefined, params);
27
+ }
28
+ /**
29
+ * Retrieves a specific purchase order by its ID.
30
+ * Endpoint: GET /purchases/orders/{id}
31
+ * @param id - The ID of the purchase order to retrieve.
32
+ * @returns A promise that resolves to the purchase order.
33
+ */
34
+ async get(id) {
35
+ const response = await this._request(`/purchases/orders/${id}`, "GET");
36
+ return response.transaction;
37
+ }
38
+ /**
39
+ * Updates an existing purchase order.
40
+ * Endpoint: PUT /purchases/orders/{id}
41
+ * @param id - The ID of the purchase order to update.
42
+ * @param data - The data to update the purchase order with.
43
+ * @returns A promise that resolves to the updated purchase order.
44
+ */
45
+ async update(id, data) {
46
+ const response = await this._request(`/purchases/orders/${id}`, "PUT", data);
47
+ return response.transaction;
48
+ }
49
+ /**
50
+ * Deletes a purchase order.
51
+ * Endpoint: DELETE /purchases/orders/{id}
52
+ * @param id - The ID of the purchase order to delete.
53
+ * @returns A promise that resolves when the purchase order is deleted.
54
+ */
55
+ async delete(id) {
56
+ await this._request(`/purchases/orders/${id}`, "DELETE");
57
+ }
58
+ /**
59
+ * Updates the status of an existing purchase order.
60
+ * Endpoint: PATCH /purchases/orders/{id}
61
+ * @param id - The ID of the purchase order to update.
62
+ * @param data - The data containing the new status.
63
+ * @returns A promise that resolves to the updated purchase order.
64
+ */
65
+ async updateStatus(id, data) {
66
+ const response = await this._request(`/purchases/orders/${id}`, "PATCH", data);
67
+ return response.transaction;
68
+ }
69
+ }
70
+ exports.PurchaseOrdersAPI = PurchaseOrdersAPI;
71
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/purchases/purchase-orders/index.ts"],"names":[],"mappings":";AAAA,yCAAyC;;;AAazC,MAAa,iBAAiB;IAC5B,YAAoB,QAAiC;QAAjC,aAAQ,GAAR,QAAQ,CAAyB;IAAG,CAAC;IAEzD;;;;;OAKG;IACH,KAAK,CAAC,MAAM,CACV,IAAoC;QAEpC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,QAAQ,CAClC,mBAAmB,EACnB,MAAM,EACN,IAAI,CACL,CAAC;QACF,OAAO,QAAQ,CAAC,WAAW,CAAC;IAC9B,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,IAAI,CACR,MAAqC;QAErC,OAAO,IAAI,CAAC,QAAQ,CAClB,mBAAmB,EACnB,KAAK,EACL,SAAS,EACT,MAAM,CACP,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,GAAG,CAAC,EAAmB;QAC3B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,QAAQ,CAClC,qBAAqB,EAAE,EAAE,EACzB,KAAK,CACN,CAAC;QACF,OAAO,QAAQ,CAAC,WAAW,CAAC;IAC9B,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,MAAM,CACV,EAAmB,EACnB,IAAoC;QAEpC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,QAAQ,CAClC,qBAAqB,EAAE,EAAE,EACzB,KAAK,EACL,IAAI,CACL,CAAC;QACF,OAAO,QAAQ,CAAC,WAAW,CAAC;IAC9B,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,MAAM,CAAC,EAAmB;QAC9B,MAAM,IAAI,CAAC,QAAQ,CAAO,qBAAqB,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAC;IACjE,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,YAAY,CAChB,EAAmB,EACnB,IAA0C;QAE1C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,QAAQ,CAClC,qBAAqB,EAAE,EAAE,EACzB,OAAO,EACP,IAAI,CACL,CAAC;QACF,OAAO,QAAQ,CAAC,WAAW,CAAC;IAC9B,CAAC;CACF;AAlGD,8CAkGC"}
@@ -0,0 +1,182 @@
1
+ import { BukkuEmailDetails, BukkuFileAttachment, BukkuAttachedFileResponse, BukkuListPagination, BukkuFormItem } from "../../common/type";
2
+ /**
3
+ * Represents a form item for creating or updating a Bukku Purchase Order.
4
+ */
5
+ export interface BukkuPurchaseOrderFormItemCreateParams {
6
+ /** The id of the item, required when you're updating an item. */
7
+ id?: number;
8
+ /** The type of the item, leave null for normal item. */
9
+ type?: "bundle" | "subtitle" | "subtotal" | null;
10
+ /** The account of the item, required for normal item. */
11
+ account_id?: number;
12
+ /** The description of the item, required for normal / bundle & subtitle items. */
13
+ description?: string;
14
+ /** The service date of the item, following format YYYY-MM-DD. */
15
+ service_date?: string;
16
+ /** The product of the item. */
17
+ product_id?: number;
18
+ /** The product unit / UOM of the product, leave blank to use the product's default unit. */
19
+ product_unit_id?: number;
20
+ /** The location of the product, used for inventory product, leave blank to use the system default location. */
21
+ location_id?: number;
22
+ /** The unit price of the item, supports up to 4 decimal points, required for normal items. */
23
+ unit_price?: number;
24
+ /** The quantity of the item, supports up to 4 decimal points, required for normal items. */
25
+ quantity?: number;
26
+ /** The discount of the item, supports value (eg. 255.12) or percentage (eg. 10%). Max 14 chars. */
27
+ discount?: string;
28
+ /** The tax code of the item. */
29
+ tax_code_id?: number;
30
+ /** The child items, used by bundle. */
31
+ children?: BukkuPurchaseOrderFormItemCreateParams[];
32
+ }
33
+ /**
34
+ * Parameters for creating a Bukku Purchase Order.
35
+ * Based on POST /purchases/orders
36
+ */
37
+ export interface BukkuPurchaseOrderCreateParams {
38
+ contact_id: number;
39
+ number?: string;
40
+ number2?: string;
41
+ date: string;
42
+ currency_code: string;
43
+ exchange_rate: number;
44
+ billing_party?: string;
45
+ show_shipping?: boolean;
46
+ shipping_party?: string;
47
+ shipping_info?: string;
48
+ tag_ids?: number[];
49
+ term_id?: number;
50
+ title?: string;
51
+ description?: string;
52
+ remarks?: string;
53
+ tax_mode: "inclusive" | "exclusive";
54
+ form_items: BukkuPurchaseOrderFormItemCreateParams[];
55
+ status: "draft" | "pending_approval" | "ready";
56
+ email?: BukkuEmailDetails;
57
+ files?: BukkuFileAttachment[];
58
+ }
59
+ /**
60
+ * Represents a Bukku Purchase Order object as returned by the API.
61
+ */
62
+ export interface BukkuPurchaseOrder {
63
+ id: number;
64
+ contact_id: number;
65
+ contact_name: string;
66
+ number: string;
67
+ number2: string | null;
68
+ date: string;
69
+ currency_code: string;
70
+ currency_symbol: string;
71
+ exchange_rate: number;
72
+ billing_party: string | null;
73
+ show_shipping: boolean;
74
+ shipping_info: string | null;
75
+ shipping_party: string | null;
76
+ tag_ids: number[] | null;
77
+ tag_names: string[] | null;
78
+ term_id: number | null;
79
+ term_name: string | null;
80
+ title: string | null;
81
+ description: string | null;
82
+ remarks: string | null;
83
+ tax_mode: "inclusive" | "exclusive";
84
+ form_items: BukkuFormItem[];
85
+ amount: number;
86
+ status: string;
87
+ type: string;
88
+ short_link: string;
89
+ files: BukkuAttachedFileResponse[] | null;
90
+ }
91
+ /**
92
+ * Represents the API response structure when a purchase order is created or retrieved.
93
+ */
94
+ export interface BukkuPurchaseOrderResponse {
95
+ transaction: BukkuPurchaseOrder;
96
+ }
97
+ /**
98
+ * Parameters for updating a Bukku Purchase Order.
99
+ * Based on PUT /purchases/orders/{id}
100
+ */
101
+ export interface BukkuPurchaseOrderUpdateParams {
102
+ contact_id: number;
103
+ number: string;
104
+ number2?: string;
105
+ date: string;
106
+ currency_code: string;
107
+ exchange_rate: number;
108
+ billing_party?: string;
109
+ show_shipping?: boolean;
110
+ shipping_party?: string;
111
+ shipping_info?: string;
112
+ tag_ids?: number[];
113
+ term_id?: number;
114
+ title?: string;
115
+ description?: string;
116
+ remarks?: string;
117
+ tax_mode: "inclusive" | "exclusive";
118
+ form_items: BukkuPurchaseOrderFormItemCreateParams[];
119
+ email?: BukkuEmailDetails;
120
+ files?: BukkuFileAttachment[];
121
+ }
122
+ /**
123
+ * Parameters for updating the status of a Bukku Purchase Order.
124
+ * Based on PATCH /purchases/orders/{id}
125
+ */
126
+ export interface BukkuPurchaseOrderStatusUpdateParams {
127
+ status: "draft" | "pending_approval" | "ready" | "void";
128
+ }
129
+ /**
130
+ * Parameters for listing Bukku Purchase Orders (GET /purchases/orders).
131
+ */
132
+ export interface BukkuPurchaseOrderListParams {
133
+ search?: string;
134
+ custom_search?: string;
135
+ contact_id?: number;
136
+ date_from?: string;
137
+ date_to?: string;
138
+ status?: "all" | "draft" | "pending_approval" | "ready" | "void";
139
+ email_status?: "UNSENT" | "PENDING" | "SENT" | "BOUNCED" | "OPENED" | "VIEWED";
140
+ transfer_status?: "ALL" | "OUTSTANDING" | "NOT_TRANSFERRED" | "PARTIAL_TRANSFERRED" | "TRANSFERRED";
141
+ page?: number;
142
+ page_size?: number;
143
+ sort_by?: "number" | "date" | "contact_name" | "number2" | "title" | "description" | "amount" | "created_at";
144
+ sort_dir?: "asc" | "desc";
145
+ [key: string]: any;
146
+ }
147
+ /**
148
+ * Represents a summary of a Bukku Purchase Order as it appears in a list.
149
+ */
150
+ export interface BukkuPurchaseOrderListItem {
151
+ id: number;
152
+ contact_id: number;
153
+ contact_name: string;
154
+ number: string;
155
+ number2: string | null;
156
+ date: string;
157
+ currency_code: string;
158
+ currency_symbol: string;
159
+ exchange_rate: number;
160
+ billing_party?: string | null;
161
+ shipping_party?: string | null;
162
+ tag_names?: string[] | null;
163
+ title?: string | null;
164
+ description?: string | null;
165
+ amount: number;
166
+ status: string;
167
+ transfer_status?: string;
168
+ email_status?: string;
169
+ file_count?: number;
170
+ short_link?: string;
171
+ created_by?: string;
172
+ created_at: string;
173
+ updated_at: string;
174
+ }
175
+ /**
176
+ * Represents the API response structure for listing purchase orders.
177
+ */
178
+ export interface BukkuPurchaseOrderListApiResponse {
179
+ paging: BukkuListPagination;
180
+ transactions: BukkuPurchaseOrderListItem[];
181
+ }
182
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../src/purchases/purchase-orders/type.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,EACnB,aAAa,EACd,MAAM,mBAAmB,CAAC;AAE3B;;GAEG;AACH,MAAM,WAAW,sCAAsC;IACrD,iEAAiE;IACjE,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,wDAAwD;IACxD,IAAI,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,UAAU,GAAG,IAAI,CAAC;IACjD,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kFAAkF;IAClF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iEAAiE;IACjE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+BAA+B;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4FAA4F;IAC5F,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,+GAA+G;IAC/G,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8FAA8F;IAC9F,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4FAA4F;IAC5F,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mGAAmG;IACnG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gCAAgC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC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EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CAEpB;AAED;;GAEG;AACH,MAAM,WAAW,iCAAiC;IAChD,MAAM,EAAE,mBAAmB,CAAC;IAC5B,YAAY,EAAE,0BAA0B,EAAE,CAAC;CAC5C"}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ // src/purchases/purchase-orders/type.ts
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../../src/purchases/purchase-orders/type.ts"],"names":[],"mappings":";AAAA,wCAAwC"}
@@ -0,0 +1,51 @@
1
+ import type { BukkuAPIRequestFunction } from "../../types";
2
+ import { BukkuRefund, BukkuRefundCreateParams, BukkuRefundListParams, BukkuRefundListApiResponse, BukkuRefundUpdateParams, BukkuRefundStatusUpdateParams } from "./type";
3
+ export declare class RefundsAPI {
4
+ private _request;
5
+ constructor(_request: BukkuAPIRequestFunction);
6
+ /**
7
+ * Creates a new purchase refund.
8
+ * Endpoint: POST /purchases/refunds
9
+ * @param data - The data for the new refund.
10
+ * @returns A promise that resolves to the created refund.
11
+ */
12
+ create(data: BukkuRefundCreateParams): Promise<BukkuRefund>;
13
+ /**
14
+ * Retrieves a paginated list of purchase refunds.
15
+ * Endpoint: GET /purchases/refunds
16
+ * @param params - Optional parameters for filtering and pagination.
17
+ * @returns A promise that resolves to the API response for listing refunds.
18
+ */
19
+ list(params?: BukkuRefundListParams): Promise<BukkuRefundListApiResponse>;
20
+ /**
21
+ * Retrieves a specific purchase refund by its ID.
22
+ * Endpoint: GET /purchases/refunds/{id}
23
+ * @param id - The ID of the refund to retrieve.
24
+ * @returns A promise that resolves to the refund.
25
+ */
26
+ get(id: string | number): Promise<BukkuRefund>;
27
+ /**
28
+ * Updates an existing purchase refund.
29
+ * Endpoint: PUT /purchases/refunds/{id}
30
+ * @param id - The ID of the refund to update.
31
+ * @param data - The data to update the refund with.
32
+ * @returns A promise that resolves to the updated refund.
33
+ */
34
+ update(id: string | number, data: BukkuRefundUpdateParams): Promise<BukkuRefund>;
35
+ /**
36
+ * Updates the status of an existing purchase refund.
37
+ * Endpoint: PATCH /purchases/refunds/{id}
38
+ * @param id - The ID of the refund to update.
39
+ * @param data - The data containing the new status.
40
+ * @returns A promise that resolves to the updated refund.
41
+ */
42
+ updateStatus(id: string | number, data: BukkuRefundStatusUpdateParams): Promise<BukkuRefund>;
43
+ /**
44
+ * Deletes a purchase refund.
45
+ * Endpoint: DELETE /purchases/refunds/{id}
46
+ * @param id - The ID of the refund to delete.
47
+ * @returns A promise that resolves when the refund 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/refunds/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EACL,WAAW,EACX,uBAAuB,EAEvB,qBAAqB,EACrB,0BAA0B,EAC1B,uBAAuB,EACvB,6BAA6B,EAC9B,MAAM,QAAQ,CAAC;AAEhB,qBAAa,UAAU;IACT,OAAO,CAAC,QAAQ;gBAAR,QAAQ,EAAE,uBAAuB;IAErD;;;;;OAKG;IACG,MAAM,CAAC,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,WAAW,CAAC;IASjE;;;;;OAKG;IACG,IAAI,CAAC,MAAM,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAS/E;;;;;OAKG;IACG,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAQpD;;;;;;OAMG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,WAAW,CAAC;IAStF;;;;;;OAMG;IACG,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,IAAI,EAAE,6BAA6B,GAAG,OAAO,CAAC,WAAW,CAAC;IASlG;;;;;OAKG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGjD"}
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ // src/purchases/refunds/index.ts
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.RefundsAPI = void 0;
5
+ class RefundsAPI {
6
+ constructor(_request) {
7
+ this._request = _request;
8
+ }
9
+ /**
10
+ * Creates a new purchase refund.
11
+ * Endpoint: POST /purchases/refunds
12
+ * @param data - The data for the new refund.
13
+ * @returns A promise that resolves to the created refund.
14
+ */
15
+ async create(data) {
16
+ const response = await this._request("/purchases/refunds", "POST", data);
17
+ return response.transaction;
18
+ }
19
+ /**
20
+ * Retrieves a paginated list of purchase refunds.
21
+ * Endpoint: GET /purchases/refunds
22
+ * @param params - Optional parameters for filtering and pagination.
23
+ * @returns A promise that resolves to the API response for listing refunds.
24
+ */
25
+ async list(params) {
26
+ return this._request("/purchases/refunds", "GET", undefined, params);
27
+ }
28
+ /**
29
+ * Retrieves a specific purchase refund by its ID.
30
+ * Endpoint: GET /purchases/refunds/{id}
31
+ * @param id - The ID of the refund to retrieve.
32
+ * @returns A promise that resolves to the refund.
33
+ */
34
+ async get(id) {
35
+ const response = await this._request(`/purchases/refunds/${id}`, "GET");
36
+ return response.transaction;
37
+ }
38
+ /**
39
+ * Updates an existing purchase refund.
40
+ * Endpoint: PUT /purchases/refunds/{id}
41
+ * @param id - The ID of the refund to update.
42
+ * @param data - The data to update the refund with.
43
+ * @returns A promise that resolves to the updated refund.
44
+ */
45
+ async update(id, data) {
46
+ const response = await this._request(`/purchases/refunds/${id}`, "PUT", data);
47
+ return response.transaction;
48
+ }
49
+ /**
50
+ * Updates the status of an existing purchase refund.
51
+ * Endpoint: PATCH /purchases/refunds/{id}
52
+ * @param id - The ID of the refund to update.
53
+ * @param data - The data containing the new status.
54
+ * @returns A promise that resolves to the updated refund.
55
+ */
56
+ async updateStatus(id, data) {
57
+ const response = await this._request(`/purchases/refunds/${id}`, "PATCH", data);
58
+ return response.transaction;
59
+ }
60
+ /**
61
+ * Deletes a purchase refund.
62
+ * Endpoint: DELETE /purchases/refunds/{id}
63
+ * @param id - The ID of the refund to delete.
64
+ * @returns A promise that resolves when the refund is deleted.
65
+ */
66
+ async delete(id) {
67
+ await this._request(`/purchases/refunds/${id}`, "DELETE");
68
+ }
69
+ }
70
+ exports.RefundsAPI = RefundsAPI;
71
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/purchases/refunds/index.ts"],"names":[],"mappings":";AAAA,iCAAi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AC,CAAC;IAClE,CAAC;CACF;AAxFD,gCAwFC"}
@@ -0,0 +1,181 @@
1
+ import { BukkuEmailDetails, BukkuFileAttachment, BukkuAttachedFileResponse, BukkuListPagination } from "../../common/type";
2
+ import { BukkuBillLinkedItem } from "../bills/type";
3
+ /**
4
+ * Represents a link item for creating/updating a Bukku Purchase Refund.
5
+ * Specifies which transactions the refund is applied to (e.g., linking to a credit note or payment).
6
+ */
7
+ export interface BukkuRefundLinkItemCreateParams {
8
+ id?: number;
9
+ target_transaction_id: number;
10
+ apply_amount: number;
11
+ }
12
+ /**
13
+ * Represents a deposit item for creating/updating a Bukku Purchase Refund.
14
+ * This details how the refund is being issued (e.g., back to a bank account).
15
+ */
16
+ export interface BukkuRefundDepositItemCreateParams {
17
+ id?: number;
18
+ payment_method_id?: number;
19
+ account_id: number;
20
+ amount: number;
21
+ number?: string;
22
+ fee_text?: string;
23
+ fee_account_id?: number;
24
+ }
25
+ /**
26
+ * Parameters for creating a Bukku Purchase Refund.
27
+ * Based on POST /purchases/refunds
28
+ */
29
+ export interface BukkuRefundCreateParams {
30
+ contact_id: number;
31
+ number?: string;
32
+ number2?: string;
33
+ date: string;
34
+ currency_code: string;
35
+ exchange_rate: number;
36
+ tag_ids?: number[];
37
+ description?: string;
38
+ remarks?: string;
39
+ link_items?: BukkuRefundLinkItemCreateParams[];
40
+ deposit_items: BukkuRefundDepositItemCreateParams[];
41
+ status: "draft" | "pending_approval" | "ready";
42
+ email?: BukkuEmailDetails;
43
+ files?: BukkuFileAttachment[];
44
+ }
45
+ /**
46
+ * Represents a link item as returned in a Bukku Refund response (how refund is applied).
47
+ */
48
+ export interface BukkuRefundAppliedLinkItem {
49
+ id: number;
50
+ target_transaction_id: number;
51
+ type: string;
52
+ number: string;
53
+ date: string;
54
+ description: string;
55
+ amount: number;
56
+ balance: number;
57
+ }
58
+ /**
59
+ * Represents a deposit item as returned in a Bukku Refund response.
60
+ */
61
+ export interface BukkuRefundDepositItem {
62
+ id: number;
63
+ line: number;
64
+ payment_method_id: number | null;
65
+ account_id: number;
66
+ amount: number;
67
+ number: string | null;
68
+ fee_text: string | number | null;
69
+ fee_account_id: number | null;
70
+ }
71
+ /**
72
+ * Represents a Bukku Purchase Refund object as returned by the API.
73
+ * (Assumed structure based on other transaction types like Payment)
74
+ */
75
+ export interface BukkuRefund {
76
+ id: number;
77
+ contact_id: number;
78
+ contact_name: string;
79
+ date: string;
80
+ currency_code: string;
81
+ currency_symbol: string;
82
+ exchange_rate: number;
83
+ amount: number;
84
+ number: string;
85
+ number2: string | null;
86
+ tag_ids: number[] | null;
87
+ tag_names: string[] | null;
88
+ link_items: BukkuRefundAppliedLinkItem[] | null;
89
+ linked_items: BukkuBillLinkedItem[] | null;
90
+ deposit_items: BukkuRefundDepositItem[] | null;
91
+ remarks: string | null;
92
+ description: string | null;
93
+ balance: number;
94
+ status: string;
95
+ type: string;
96
+ short_link: string | null;
97
+ files: BukkuAttachedFileResponse[] | null;
98
+ }
99
+ /**
100
+ * Represents the API response structure when a refund is created or retrieved.
101
+ */
102
+ export interface BukkuRefundResponse {
103
+ transaction: BukkuRefund;
104
+ }
105
+ /**
106
+ * Parameters for updating a Bukku Purchase Refund.
107
+ * (Assumed structure, similar to BukkuPaymentUpdateParams and refund create parameters)
108
+ */
109
+ export interface BukkuRefundUpdateParams {
110
+ contact_id: number;
111
+ number: string;
112
+ number2?: string;
113
+ date: string;
114
+ currency_code: string;
115
+ exchange_rate: number;
116
+ tag_ids?: number[];
117
+ description?: string;
118
+ remarks?: string;
119
+ link_items?: BukkuRefundLinkItemCreateParams[];
120
+ deposit_items: BukkuRefundDepositItemCreateParams[];
121
+ email?: BukkuEmailDetails;
122
+ files?: BukkuFileAttachment[];
123
+ }
124
+ /**
125
+ * Parameters for updating the status of a Bukku Purchase Refund.
126
+ */
127
+ export interface BukkuRefundStatusUpdateParams {
128
+ status: "draft" | "pending_approval" | "ready" | "void";
129
+ }
130
+ /**
131
+ * Parameters for listing Bukku Purchase Refunds.
132
+ * (Assumed structure, similar to BukkuPaymentListParams)
133
+ */
134
+ export interface BukkuRefundListParams {
135
+ search?: string;
136
+ custom_search?: string;
137
+ contact_id?: number;
138
+ date_from?: string;
139
+ date_to?: string;
140
+ status?: "all" | "draft" | "pending_approval" | "ready" | "void";
141
+ payment_status?: "paid" | "outstanding";
142
+ email_status?: "UNSENT" | "PENDING" | "SENT" | "BOUNCED" | "OPENED" | "VIEWED";
143
+ account_id?: string;
144
+ page?: number;
145
+ page_size?: number;
146
+ sort_by?: "number" | "date" | "contact_name" | "number2" | "description" | "amount" | "created_at";
147
+ sort_dir?: "asc" | "desc";
148
+ [key: string]: any;
149
+ }
150
+ /**
151
+ * Represents a summary of a Bukku Purchase Refund as it might appear in a list.
152
+ * (Assumed structure, similar to BukkuPaymentListItem)
153
+ */
154
+ export interface BukkuRefundListItem {
155
+ id: number;
156
+ contact_id: number;
157
+ contact_name: string;
158
+ number: string;
159
+ number2: string | null;
160
+ date: string;
161
+ currency_code: string;
162
+ currency_symbol: string;
163
+ exchange_rate: number;
164
+ amount: number;
165
+ status: string;
166
+ description?: string | null;
167
+ tag_names?: string[] | null;
168
+ file_count?: number;
169
+ short_link?: string;
170
+ created_by?: string;
171
+ created_at: string;
172
+ updated_at: string;
173
+ }
174
+ /**
175
+ * Represents the API response structure for listing purchase refunds.
176
+ */
177
+ export interface BukkuRefundListApiResponse {
178
+ paging: BukkuListPagination;
179
+ transactions: BukkuRefundListItem[];
180
+ }
181
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../src/purchases/refunds/type.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,EAEpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEpD;;;GAGG;AACH,MAAM,WAAW,+BAA+B;IAC9C,E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,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EACJ,QAAQ,GACR,MAAM,GACN,cAAc,GACd,SAAS,GACT,aAAa,GACb,QAAQ,GACR,YAAY,CAAC;IACjB,QAAQ,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IAEf,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,mBAAmB,CAAC;IAC5B,YAAY,EAAE,mBAAmB,EAAE,CAAC;CACrC"}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ // src/purchases/refunds/type.ts
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../../src/purchases/refunds/type.ts"],"names":[],"mappings":";AAAA,gCAAgC"}
@@ -0,0 +1,52 @@
1
+ import type { BukkuAPIRequestFunction } from "../../types";
2
+ import { BukkuCreditNote, BukkuCreditNoteCreateParams, BukkuCreditNoteListParams, BukkuCreditNoteListApiResponse, BukkuCreditNoteUpdateParams, BukkuCreditNoteStatusUpdateParams } from "./type";
3
+ export declare class CreditNotesAPI {
4
+ private _request;
5
+ constructor(_request: BukkuAPIRequestFunction);
6
+ /**
7
+ * Creates a new credit note.
8
+ * Endpoint: POST /sales/credit_notes
9
+ * @param data - The data for the new credit note.
10
+ * @returns A promise that resolves to the created credit note.
11
+ */
12
+ create(data: BukkuCreditNoteCreateParams): Promise<BukkuCreditNote>;
13
+ /**
14
+ * Retrieves a paginated list of credit notes.
15
+ * Endpoint: GET /sales/credit_notes
16
+ * @param params - Optional parameters for filtering and pagination.
17
+ * @returns A promise that resolves to the API response for listing credit notes.
18
+ */
19
+ list(params?: BukkuCreditNoteListParams): Promise<BukkuCreditNoteListApiResponse>;
20
+ /**
21
+ * Retrieves a specific credit note by its ID.
22
+ * Endpoint: GET /sales/credit_notes/{id}
23
+ * @param id - The ID of the credit note to retrieve.
24
+ * @returns A promise that resolves to the credit note.
25
+ */
26
+ get(id: string | number): Promise<BukkuCreditNote>;
27
+ /**
28
+ * Updates an existing credit note.
29
+ * Endpoint: PUT /sales/credit_notes/{id}
30
+ * @param id - The ID of the credit note to update.
31
+ * @param data - The data to update the credit note with.
32
+ * @returns A promise that resolves to the updated credit note.
33
+ */
34
+ update(id: string | number, data: BukkuCreditNoteUpdateParams): Promise<BukkuCreditNote>;
35
+ /**
36
+ * Deletes a credit note.
37
+ * Endpoint: DELETE /sales/credit_notes/{id}
38
+ * Note: Deletion policy for credit notes (e.g. status restrictions) should be verified with API documentation.
39
+ * @param id - The ID of the credit note to delete.
40
+ * @returns A promise that resolves when the credit note is deleted.
41
+ */
42
+ delete(id: string | number): Promise<void>;
43
+ /**
44
+ * Updates the status of an existing credit note.
45
+ * Endpoint: PATCH /sales/credit_notes/{id}
46
+ * @param id - The ID of the credit note to update.
47
+ * @param data - The data containing the new status.
48
+ * @returns A promise that resolves to the updated credit note.
49
+ */
50
+ updateStatus(id: string | number, data: BukkuCreditNoteStatusUpdateParams): Promise<BukkuCreditNote>;
51
+ }
52
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sales/credit-notes/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EACL,eAAe,EACf,2BAA2B,EAE3B,yBAAyB,EACzB,8BAA8B,EAC9B,2BAA2B,EAC3B,iCAAiC,EAClC,MAAM,QAAQ,CAAC;AAEhB,qBAAa,cAAc;IACb,OAAO,CAAC,QAAQ;gBAAR,QAAQ,EAAE,uBAAuB;IAErD;;;;;OAKG;IACG,MAAM,CAAC,IAAI,EAAE,2BAA2B,GAAG,OAAO,CAAC,eAAe,CAAC;IASzE;;;;;OAKG;IACG,IAAI,CACR,MAAM,CAAC,EAAE,yBAAyB,GACjC,OAAO,CAAC,8BAA8B,CAAC;IAS1C;;;;;OAKG;IACG,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAQxD;;;;;;OAMG;IACG,MAAM,CACV,EAAE,EAAE,MAAM,GAAG,MAAM,EACnB,IAAI,EAAE,2BAA2B,GAChC,OAAO,CAAC,eAAe,CAAC;IAS3B;;;;;;OAMG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhD;;;;;;OAMG;IACG,YAAY,CAChB,EAAE,EAAE,MAAM,GAAG,MAAM,EACnB,IAAI,EAAE,iCAAiC,GACtC,OAAO,CAAC,eAAe,CAAC;CAQ5B"}