1 /**
2 * @oas [post] /admin/claims
3 * operationId: PostClaims
4 * summary: Create a Claim
5 * description: Create a claim. The claim is still in the request state, and the changes are only applied on the order once the claim is confirmed.
6 * x-authenticated: true
7 * parameters:
8 * - name: fields
9 * in: query
10 * description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default
11 * fields. without prefix it will replace the entire default fields.
12 * required: false
13 * schema:
14 * type: string
15 * title: fields
16 * description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default
17 * fields. without prefix it will replace the entire default fields.
18 * externalDocs:
19 * url: "#select-fields-and-relations"
20 * - name: id
21 * in: query
22 * required: false
23 * schema:
24 * oneOf:
25 * - type: string
26 * title: id
27 * description: Filter by the claim's ID.
28 * - type: array
29 * description: Filter by multiple claim IDs.
30 * items:
31 * type: string
32 * title: id
33 * description: A claim ID.
34 * - name: status
35 * in: query
36 * required: false
37 * schema:
38 * oneOf:
39 * - type: string
40 * title: status
41 * description: Filter by the claim's status.
42 * - type: array
43 * description: Filter by multiple claim statuses.
44 * items:
45 * type: string
46 * title: status
47 * description: A claim status.
48 * - name: created_at
49 * in: query
50 * description: Filter by a claim's creation date.
51 * required: false
52 * schema:
53 * type: object
54 * description: Filter by a claim's creation date.
55 * properties:
56 * $and:
57 * type: array
58 * description: Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
59 * items:
60 * type: object
61 * title: $and
62 * $or:
63 * type: array
64 * description: Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
65 * items:
66 * type: object
67 * title: $or
68 * $eq:
69 * oneOf:
70 * - type: string
71 * title: $eq
72 * description: Filter by an exact match.
73 * - type: array
74 * description: Filter by an exact match.
75 * items:
76 * type: string
77 * title: $eq
78 * description: Filter by an exact match.
79 * $ne:
80 * type: string
81 * title: $ne
82 * description: Filter by values not equal to this parameter.
83 * $in:
84 * type: array
85 * description: Filter by values in this array.
86 * items:
87 * type: string
88 * title: $in
89 * description: Filter by values in this array.
90 * $nin:
91 * type: array
92 * description: Filter by values not in this array.
93 * items:
94 * type: string
95 * title: $nin
96 * description: Filter by values not in this array.
97 * $not:
98 * oneOf:
99 * - type: string
100 * title: $not
101 * description: Filter by values not matching the conditions in this parameter.
102 * - type: object
103 * description: Filter by values not matching the conditions in this parameter.
104 * - type: array
105 * description: Filter by values not matching the conditions in this parameter.
106 * items:
107 * type: string
108 * title: $not
109 * description: Filter by values not matching the conditions in this parameter.
110 * $gt:
111 * type: string
112 * title: $gt
113 * description: Filter by values greater than this parameter. Useful for numbers and dates only.
114 * $gte:
115 * type: string
116 * title: $gte
117 * description: Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
118 * $lt:
119 * type: string
120 * title: $lt
121 * description: Filter by values less than this parameter. Useful for numbers and dates only.
122 * $lte:
123 * type: string
124 * title: $lte
125 * description: Filter by values less than or equal to this parameter. Useful for numbers and dates only.
126 * $like:
127 * type: string
128 * title: $like
129 * description: Apply a `like` filter. Useful for strings only.
130 * $re:
131 * type: string
132 * title: $re
133 * description: Apply a regex filter. Useful for strings only.
134 * $ilike:
135 * type: string
136 * title: $ilike
137 * description: Apply a case-insensitive `like` filter. Useful for strings only.
138 * $fulltext:
139 * type: string
140 * title: $fulltext
141 * description: Filter to apply on full-text properties.
142 * $overlap:
143 * type: array
144 * description: Filter arrays that have overlapping values with this parameter.
145 * items:
146 * type: string
147 * title: $overlap
148 * description: Filter arrays that have overlapping values with this parameter.
149 * $contains:
150 * type: array
151 * description: Filter arrays that contain some of the values of this parameter.
152 * items:
153 * type: string
154 * title: $contains
155 * description: Filter arrays that contain some of the values of this parameter.
156 * $contained:
157 * type: array
158 * description: Filter arrays that contain all values of this parameter.
159 * items:
160 * type: string
161 * title: $contained
162 * description: Filter arrays that contain all values of this parameter.
163 * $exists:
164 * type: boolean
165 * title: $exists
166 * description: Filter by whether a value for this parameter exists (not `null`).
167 * title: created_at
168 * - name: updated_at
169 * in: query
170 * description: Filter by a claim's update date.
171 * required: false
172 * schema:
173 * type: object
174 * description: Filter by a claim's update date.
175 * properties:
176 * $and:
177 * type: array
178 * description: Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
179 * items:
180 * type: object
181 * title: $and
182 * $or:
183 * type: array
184 * description: Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
185 * items:
186 * type: object
187 * title: $or
188 * $eq:
189 * oneOf:
190 * - type: string
191 * title: $eq
192 * description: Filter by an exact match.
193 * - type: array
194 * description: Filter by an exact match.
195 * items:
196 * type: string
197 * title: $eq
198 * description: Filter by an exact match.
199 * $ne:
200 * type: string
201 * title: $ne
202 * description: Filter by values not equal to this parameter.
203 * $in:
204 * type: array
205 * description: Filter by values in this array.
206 * items:
207 * type: string
208 * title: $in
209 * description: Filter by values in this array.
210 * $nin:
211 * type: array
212 * description: Filter by values not in this array.
213 * items:
214 * type: string
215 * title: $nin
216 * description: Filter by values not in this array.
217 * $not:
218 * oneOf:
219 * - type: string
220 * title: $not
221 * description: Filter by values not matching the conditions in this parameter.
222 * - type: object
223 * description: Filter by values not matching the conditions in this parameter.
224 * - type: array
225 * description: Filter by values not matching the conditions in this parameter.
226 * items:
227 * type: string
228 * title: $not
229 * description: Filter by values not matching the conditions in this parameter.
230 * $gt:
231 * type: string
232 * title: $gt
233 * description: Filter by values greater than this parameter. Useful for numbers and dates only.
234 * $gte:
235 * type: string
236 * title: $gte
237 * description: Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
238 * $lt:
239 * type: string
240 * title: $lt
241 * description: Filter by values less than this parameter. Useful for numbers and dates only.
242 * $lte:
243 * type: string
244 * title: $lte
245 * description: Filter by values less than or equal to this parameter. Useful for numbers and dates only.
246 * $like:
247 * type: string
248 * title: $like
249 * description: Apply a `like` filter. Useful for strings only.
250 * $re:
251 * type: string
252 * title: $re
253 * description: Apply a regex filter. Useful for strings only.
254 * $ilike:
255 * type: string
256 * title: $ilike
257 * description: Apply a case-insensitive `like` filter. Useful for strings only.
258 * $fulltext:
259 * type: string
260 * title: $fulltext
261 * description: Filter to apply on full-text properties.
262 * $overlap:
263 * type: array
264 * description: Filter arrays that have overlapping values with this parameter.
265 * items:
266 * type: string
267 * title: $overlap
268 * description: Filter arrays that have overlapping values with this parameter.
269 * $contains:
270 * type: array
271 * description: Filter arrays that contain some of the values of this parameter.
272 * items:
273 * type: string
274 * title: $contains
275 * description: Filter arrays that contain some of the values of this parameter.
276 * $contained:
277 * type: array
278 * description: Filter arrays that contain all values of this parameter.
279 * items:
280 * type: string
281 * title: $contained
282 * description: Filter arrays that contain all values of this parameter.
283 * $exists:
284 * type: boolean
285 * title: $exists
286 * description: Filter by whether a value for this parameter exists (not `null`).
287 * title: updated_at
288 * - name: deleted_at
289 * in: query
290 * description: Filter by a claim's deletion date.
291 * required: false
292 * schema:
293 * type: object
294 * description: Filter by a claim's deletion date.
295 * properties:
296 * $and:
297 * type: array
298 * description: Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
299 * items:
300 * type: object
301 * title: $and
302 * $or:
303 * type: array
304 * description: Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
305 * items:
306 * type: object
307 * title: $or
308 * $eq:
309 * oneOf:
310 * - type: string
311 * title: $eq
312 * description: Filter by an exact match.
313 * - type: array
314 * description: Filter by an exact match.
315 * items:
316 * type: string
317 * title: $eq
318 * description: Filter by an exact match.
319 * $ne:
320 * type: string
321 * title: $ne
322 * description: Filter by values not equal to this parameter.
323 * $in:
324 * type: array
325 * description: Filter by values in this array.
326 * items:
327 * type: string
328 * title: $in
329 * description: Filter by values in this array.
330 * $nin:
331 * type: array
332 * description: Filter by values not in this array.
333 * items:
334 * type: string
335 * title: $nin
336 * description: Filter by values not in this array.
337 * $not:
338 * oneOf:
339 * - type: string
340 * title: $not
341 * description: Filter by values not matching the conditions in this parameter.
342 * - type: object
343 * description: Filter by values not matching the conditions in this parameter.
344 * - type: array
345 * description: Filter by values not matching the conditions in this parameter.
346 * items:
347 * type: string
348 * title: $not
349 * description: Filter by values not matching the conditions in this parameter.
350 * $gt:
351 * type: string
352 * title: $gt
353 * description: Filter by values greater than this parameter. Useful for numbers and dates only.
354 * $gte:
355 * type: string
356 * title: $gte
357 * description: Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
358 * $lt:
359 * type: string
360 * title: $lt
361 * description: Filter by values less than this parameter. Useful for numbers and dates only.
362 * $lte:
363 * type: string
364 * title: $lte
365 * description: Filter by values less than or equal to this parameter. Useful for numbers and dates only.
366 * $like:
367 * type: string
368 * title: $like
369 * description: Apply a `like` filter. Useful for strings only.
370 * $re:
371 * type: string
372 * title: $re
373 * description: Apply a regex filter. Useful for strings only.
374 * $ilike:
375 * type: string
376 * title: $ilike
377 * description: Apply a case-insensitive `like` filter. Useful for strings only.
378 * $fulltext:
379 * type: string
380 * title: $fulltext
381 * description: Filter to apply on full-text properties.
382 * $overlap:
383 * type: array
384 * description: Filter arrays that have overlapping values with this parameter.
385 * items:
386 * type: string
387 * title: $overlap
388 * description: Filter arrays that have overlapping values with this parameter.
389 * $contains:
390 * type: array
391 * description: Filter arrays that contain some of the values of this parameter.
392 * items:
393 * type: string
394 * title: $contains
395 * description: Filter arrays that contain some of the values of this parameter.
396 * $contained:
397 * type: array
398 * description: Filter arrays that contain all values of this parameter.
399 * items:
400 * type: string
401 * title: $contained
402 * description: Filter arrays that contain all values of this parameter.
403 * $exists:
404 * type: boolean
405 * title: $exists
406 * description: Filter by whether a value for this parameter exists (not `null`).
407 * title: deleted_at
408 * security:
409 * - api_token: []
410 * - cookie_auth: []
411 * - jwt_token: []
412 * requestBody:
413 * content:
414 * application/json:
415 * schema:
416 * $ref: "#/components/schemas/AdminCreateClaim"
417 * x-codeSamples:
418 * - lang: JavaScript
419 * label: JS SDK
420 * source: |-
421 * import Medusa from "@medusajs/js-sdk"
422 *
423 * export const sdk = new Medusa({
424 * baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
425 * debug: import.meta.env.DEV,
426 * auth: {
427 * type: "session",
428 * },
429 * })
430 *
431 * sdk.admin.claim.create({
432 * type: "refund",
433 * order_id: "order_123",
434 * })
435 * .then(({ claim }) => {
436 * console.log(claim)
437 * })
438 * - lang: Shell
439 * label: cURL
440 * source: |-
441 * curl -X POST '{backend_url}/admin/claims' \
442 * -H 'Authorization: Bearer {jwt_token}' \
443 * -H 'Content-Type: application/json' \
444 * --data-raw '{
445 * "type": "{value}",
446 * "order_id": "{value}",
447 * "metadata": {}
448 * }'
449 * tags:
450 * - Claims
451 * responses:
452 * "200":
453 * description: OK
454 * content:
455 * application/json:
456 * schema:
457 * $ref: "#/components/schemas/AdminClaimOrderResponse"
458 * "400":
459 * $ref: "#/components/responses/400_error"
460 * "401":
461 * $ref: "#/components/responses/unauthorized"
462 * "404":
463 * $ref: "#/components/responses/not_found_error"
464 * "409":
465 * $ref: "#/components/responses/invalid_state_error"
466 * "422":
467 * $ref: "#/components/responses/invalid_request_error"
468 * "500":
469 * $ref: "#/components/responses/500_error"
470 * x-workflow: beginClaimOrderWorkflow
471 * x-events: []
472 *
473 */
474