@openbox/shared-types 0.5.85 → 0.5.87

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.
@@ -1,7 +1,6 @@
1
1
  import { InvoicesDiscountsTypesKeys } from '../../invoices.enums';
2
- export type InvoicesCalculationsDetailsRequest = {
2
+ type InvoicesCalculationsDetailsBaseRequest = {
3
3
  id?: string;
4
- service: string;
5
4
  quantity: number;
6
5
  unitPrice: number;
7
6
  price: number;
@@ -10,6 +9,43 @@ export type InvoicesCalculationsDetailsRequest = {
10
9
  incRenta10: boolean;
11
10
  chargeDescription: string;
12
11
  };
12
+ /**
13
+ * Invoice calculation details request type that supports either a service OR a product.
14
+ * Each detail must reference exactly one of service or product, not both.
15
+ *
16
+ * @example
17
+ * // Service detail
18
+ * const serviceDetail: InvoicesCalculationsDetailsRequest = {
19
+ * service: "service-id-123",
20
+ * quantity: 1,
21
+ * unitPrice: 100,
22
+ * price: 100,
23
+ * incIva: true,
24
+ * incRenta5: false,
25
+ * incRenta10: false,
26
+ * chargeDescription: "Service charge"
27
+ * }
28
+ *
29
+ * @example
30
+ * // Product detail
31
+ * const productDetail: InvoicesCalculationsDetailsRequest = {
32
+ * product: "product-id-123",
33
+ * quantity: 2,
34
+ * unitPrice: 50,
35
+ * price: 100,
36
+ * incIva: true,
37
+ * incRenta5: false,
38
+ * incRenta10: false,
39
+ * chargeDescription: "Product charge"
40
+ * }
41
+ */
42
+ export type InvoicesCalculationsDetailsRequest = (InvoicesCalculationsDetailsBaseRequest & {
43
+ service: string;
44
+ product?: never;
45
+ }) | (InvoicesCalculationsDetailsBaseRequest & {
46
+ product: string;
47
+ service?: never;
48
+ });
13
49
  export type InvoicesCalculationsDiscountsRequest = {
14
50
  id?: string;
15
51
  type: InvoicesDiscountsTypesKeys;
@@ -22,3 +58,4 @@ export type InvoicesCalculationsCalculateSingleRequest = {
22
58
  details: InvoicesCalculationsDetailsRequest[];
23
59
  discounts: InvoicesCalculationsDiscountsRequest[] | null;
24
60
  };
61
+ export {};
@@ -1,7 +1,6 @@
1
1
  import { InvoicesDiscountsTypesKeys } from '../../invoices.enums';
2
- export type InvoicesCalculationsDetailsResponse = {
2
+ type InvoicesCalculationsDetailsBaseResponse = {
3
3
  id?: string;
4
- service: string;
5
4
  quantity: number;
6
5
  chargeDescription: string;
7
6
  price: number;
@@ -23,6 +22,34 @@ export type InvoicesCalculationsDetailsResponse = {
23
22
  vNoSujetaToShow: number;
24
23
  vGravadaToShow: number;
25
24
  };
25
+ /**
26
+ * Invoice calculation details response type that includes calculated values for either a service OR a product.
27
+ * The response will contain the same service/product identifier from the request plus all calculated tax and pricing information.
28
+ *
29
+ * @example
30
+ * // Service detail response
31
+ * const serviceResponse: InvoicesCalculationsDetailsResponse = {
32
+ * service: "service-id-123",
33
+ * quantity: 1,
34
+ * chargeDescription: "Service charge",
35
+ * price: 100,
36
+ * incIva: true,
37
+ * incRenta5: false,
38
+ * incRenta10: false,
39
+ * // ... calculated fields
40
+ * unitPrice: 100,
41
+ * ivaPrice: 13,
42
+ * ventaPrice: 113,
43
+ * sellingType: 1
44
+ * }
45
+ */
46
+ export type InvoicesCalculationsDetailsResponse = (InvoicesCalculationsDetailsBaseResponse & {
47
+ service: string;
48
+ product?: never;
49
+ }) | (InvoicesCalculationsDetailsBaseResponse & {
50
+ product: string;
51
+ service?: never;
52
+ });
26
53
  export type InvoicesCalculationsDiscountsResponse = {
27
54
  id?: string;
28
55
  type: InvoicesDiscountsTypesKeys;
@@ -66,3 +93,4 @@ export type InvoicesCalculationsCalculateSingleResponse = {
66
93
  discounts: InvoicesCalculationsDiscountsResponse[];
67
94
  totals: InvoicesCalculationsTotalsResponse;
68
95
  };
96
+ export {};
@@ -22,6 +22,6 @@ export type InvoicesDetails = {
22
22
  NCDTotal: boolean;
23
23
  invoice: Invoices;
24
24
  service?: ServicesResponse;
25
- product: InventoriesProductsResponse;
25
+ product?: InventoriesProductsResponse;
26
26
  sellingType: Pick<SystemSellingTypes, 'id' | 'name'>;
27
27
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openbox/shared-types",
3
- "version": "0.5.85",
3
+ "version": "0.5.87",
4
4
  "description": "Shared Types for Openbox Cloud. ",
5
5
  "types": "lib/index.d.js",
6
6
  "main": "lib/index.js",