@zauru-sdk/services 2.0.186 → 2.0.189

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.
@@ -95,3 +95,65 @@ export async function closeCase(headers, id) {
95
95
  return true;
96
96
  });
97
97
  }
98
+ //==============================================
99
+ //======= ENDPOINTS DE POS/CASES
100
+ //==============================================
101
+ /**
102
+ * createPOSCase
103
+ * @param headers
104
+ * @param body
105
+ * @returns
106
+ */
107
+ export async function createPOSCase(headers, body) {
108
+ return handlePossibleAxiosErrors(async () => {
109
+ const sendBody = {
110
+ ...body,
111
+ case_supplies_attributes: arrayToObject(body.case_supplies),
112
+ tag_ids: ["", ...(body.taggings?.map((x) => x.tag_id) ?? [])],
113
+ };
114
+ if (sendBody.deleted_case_supplies)
115
+ delete sendBody.deleted_case_supplies;
116
+ if (sendBody.__rvfInternalFormId)
117
+ delete sendBody.__rvfInternalFormId;
118
+ if (sendBody.case_supplies)
119
+ delete sendBody.case_supplies;
120
+ if (sendBody.taggings)
121
+ delete sendBody.taggings;
122
+ const response = await httpZauru.post(`/pos/cases.json`, { case: sendBody }, { headers });
123
+ return response.data;
124
+ });
125
+ }
126
+ /**
127
+ * updatePOSCase
128
+ * @param headers
129
+ * @param body
130
+ * @returns
131
+ */
132
+ export async function updatePOSCase(headers, body) {
133
+ return handlePossibleAxiosErrors(async () => {
134
+ const sendBody = {
135
+ ...body,
136
+ case_supplies_attributes: arrayToObject(body.case_supplies),
137
+ };
138
+ if (sendBody.deleted_case_supplies)
139
+ delete sendBody.deleted_case_supplies;
140
+ if (sendBody.__rvfInternalFormId)
141
+ delete sendBody.__rvfInternalFormId;
142
+ if (sendBody.case_supplies)
143
+ delete sendBody.case_supplies;
144
+ const response = await httpZauru.patch(`/pos/cases/${body.id}.json`, { case: sendBody }, { headers });
145
+ return response.data;
146
+ });
147
+ }
148
+ /**
149
+ * closePOSCase
150
+ * @param headers
151
+ * @param id
152
+ * @returns
153
+ */
154
+ export async function closePOSCase(headers, id) {
155
+ return handlePossibleAxiosErrors(async () => {
156
+ await httpZauru.get(`/pos/cases/${id}/close.json`, { headers });
157
+ return true;
158
+ });
159
+ }
@@ -38,3 +38,24 @@ export declare function deleteCase(headers: any, id: string | number): Promise<A
38
38
  * @returns
39
39
  */
40
40
  export declare function closeCase(headers: any, id: string | number): Promise<AxiosUtilsResponse<boolean>>;
41
+ /**
42
+ * createPOSCase
43
+ * @param headers
44
+ * @param body
45
+ * @returns
46
+ */
47
+ export declare function createPOSCase(headers: any, body: Partial<CaseGraphQL>): Promise<AxiosUtilsResponse<CaseGraphQL>>;
48
+ /**
49
+ * updatePOSCase
50
+ * @param headers
51
+ * @param body
52
+ * @returns
53
+ */
54
+ export declare function updatePOSCase(headers: any, body: Partial<CaseGraphQL>): Promise<AxiosUtilsResponse<CaseGraphQL>>;
55
+ /**
56
+ * closePOSCase
57
+ * @param headers
58
+ * @param id
59
+ * @returns
60
+ */
61
+ export declare function closePOSCase(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.0.186",
3
+ "version": "2.0.189",
4
4
  "description": "Servicios de consulta a Zauru",
5
5
  "main": "./dist/esm/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -24,12 +24,12 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@remix-run/node": "^2.8.1",
27
- "@zauru-sdk/common": "^2.0.186",
27
+ "@zauru-sdk/common": "^2.0.187",
28
28
  "@zauru-sdk/config": "^2.0.100",
29
- "@zauru-sdk/graphql": "^2.0.186",
30
- "@zauru-sdk/types": "^2.0.186",
29
+ "@zauru-sdk/graphql": "^2.0.187",
30
+ "@zauru-sdk/types": "^2.0.187",
31
31
  "axios": "^1.6.7",
32
32
  "chalk": "5.3.0"
33
33
  },
34
- "gitHead": "ac66c630f3321403498b88e85be6bd8ad7655493"
34
+ "gitHead": "b708b00848274bc8e119cd831da5e03ed9c74615"
35
35
  }