@zauru-sdk/services 2.19.1 → 2.21.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.
@@ -27,6 +27,7 @@ export const nativeLogin = async (session, codeValue) => {
27
27
  session.set("name", userInfo?.name);
28
28
  session.set("email", userInfo?.email);
29
29
  session.set("employee_id", userInfo?.employee_id);
30
+ session.set("selected_entity", userInfo?.selected_entity);
30
31
  return userInfo;
31
32
  });
32
33
  };
@@ -118,3 +118,69 @@ export async function deleteInvoiceOrder(headers, id) {
118
118
  return true;
119
119
  });
120
120
  }
121
+ /**
122
+ * REGISTROS DE POS
123
+ */
124
+ /**
125
+ * createInvoicePOS
126
+ * @param headers
127
+ * @param body
128
+ * @returns
129
+ */
130
+ export async function createInvoicePOS(headers, body) {
131
+ return handlePossibleAxiosErrors(async () => {
132
+ const sendBody = {
133
+ ...body,
134
+ issued: true, //(true) - Esto lo hace una factura
135
+ invoice_details_attributes: arrayToObject(body.invoice_details),
136
+ tag_ids: ["", ...(body.tagging_invoices?.map((x) => x.tag_id) ?? [])],
137
+ taxable: 1,
138
+ pos: true,
139
+ };
140
+ if (sendBody.deleted_invoice_details)
141
+ delete sendBody.deleted_invoice_details;
142
+ if (sendBody.__rvfInternalFormId)
143
+ delete sendBody.__rvfInternalFormId;
144
+ if (sendBody.invoice_details)
145
+ delete sendBody.invoice_details;
146
+ if (sendBody.tagging_invoices)
147
+ delete sendBody.tagging_invoices;
148
+ const response = await httpZauru.post(`/pos/orders.json`, { invoice: sendBody }, { headers });
149
+ return response.data;
150
+ });
151
+ }
152
+ /**
153
+ * updateInvoicePOS
154
+ * @param headers
155
+ * @param body
156
+ * @returns
157
+ */
158
+ export async function updateInvoicePOS(headers, body) {
159
+ return handlePossibleAxiosErrors(async () => {
160
+ const sendBody = {
161
+ ...body,
162
+ invoice_details_attributes: arrayToObject(body.invoice_details),
163
+ };
164
+ if (sendBody.deleted_invoice_details)
165
+ delete sendBody.deleted_invoice_details;
166
+ if (sendBody.__rvfInternalFormId)
167
+ delete sendBody.__rvfInternalFormId;
168
+ if (sendBody.invoice_details)
169
+ delete sendBody.invoice_details;
170
+ const response = await httpZauru.patch(`/pos/orders/${body.id}.json`, { invoice: sendBody }, { headers });
171
+ return response.data;
172
+ });
173
+ }
174
+ /**
175
+ * deleteInvoicePOS
176
+ * @param headers
177
+ * @param body
178
+ */
179
+ export async function deleteInvoicePOS(headers, id) {
180
+ return handlePossibleAxiosErrors(async () => {
181
+ await httpZauru.get(`/pos/orders/${id}/void`, {
182
+ headers,
183
+ });
184
+ return true;
185
+ });
186
+ }
@@ -34,3 +34,26 @@ export declare function updateInvoiceOrder(headers: any, body: Partial<InvoiceGr
34
34
  * @param body
35
35
  */
36
36
  export declare function deleteInvoiceOrder(headers: any, id: string | number): Promise<AxiosUtilsResponse<boolean>>;
37
+ /**
38
+ * REGISTROS DE POS
39
+ */
40
+ /**
41
+ * createInvoicePOS
42
+ * @param headers
43
+ * @param body
44
+ * @returns
45
+ */
46
+ export declare function createInvoicePOS(headers: any, body: Partial<InvoiceGraphQL>): Promise<AxiosUtilsResponse<InvoiceGraphQL>>;
47
+ /**
48
+ * updateInvoicePOS
49
+ * @param headers
50
+ * @param body
51
+ * @returns
52
+ */
53
+ export declare function updateInvoicePOS(headers: any, body: Partial<InvoiceGraphQL>): Promise<AxiosUtilsResponse<InvoiceGraphQL>>;
54
+ /**
55
+ * deleteInvoicePOS
56
+ * @param headers
57
+ * @param body
58
+ */
59
+ export declare function deleteInvoicePOS(headers: any, id: string | number): Promise<AxiosUtilsResponse<boolean>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/services",
3
- "version": "2.19.1",
3
+ "version": "2.21.0",
4
4
  "description": "Servicios de consulta a Zauru",
5
5
  "main": "./dist/esm/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -32,5 +32,5 @@
32
32
  "axios": "^1.6.7",
33
33
  "chalk": "5.3.0"
34
34
  },
35
- "gitHead": "f046b37495e3236ca23f08e529b10bcd46037cfa"
35
+ "gitHead": "2ad2e1d01bd57bfc7d5ae019a471b0dc68703ed7"
36
36
  }