ebay-mcp 1.13.2 → 1.14.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 (169) hide show
  1. package/README.de.md +3 -3
  2. package/README.es.md +3 -3
  3. package/README.fr.md +3 -3
  4. package/README.ja.md +3 -3
  5. package/README.ko.md +3 -3
  6. package/README.md +163 -41
  7. package/README.pt-BR.md +3 -3
  8. package/README.ru.md +3 -3
  9. package/README.zh-CN.md +3 -3
  10. package/build/api/account-management/account.js +633 -297
  11. package/build/api/analytics-and-report/analytics.js +111 -65
  12. package/build/api/client.js +199 -140
  13. package/build/api/clientRequestError.js +23 -0
  14. package/build/api/clientTrading.js +213 -0
  15. package/build/api/clientTradingError.js +4 -0
  16. package/build/api/communication/feedback.js +147 -59
  17. package/build/api/communication/message.js +134 -81
  18. package/build/api/communication/negotiation.js +65 -53
  19. package/build/api/communication/notification.js +458 -164
  20. package/build/api/developer/developer.js +99 -45
  21. package/build/api/index.js +23 -8
  22. package/build/api/listing-management/inventory.js +884 -338
  23. package/build/api/listing-metadata/metadata.js +416 -170
  24. package/build/api/listing-metadata/taxonomy.js +187 -42
  25. package/build/api/marketing-and-promotions/marketing.js +1392 -598
  26. package/build/api/marketing-and-promotions/recommendation.js +49 -24
  27. package/build/api/order-management/dispute.js +226 -45
  28. package/build/api/order-management/fulfillment.js +144 -71
  29. package/build/api/order-management/orderIssueHelpers.js +61 -0
  30. package/build/api/other/compliance.js +50 -38
  31. package/build/api/other/edelivery.js +603 -159
  32. package/build/api/other/finding.js +280 -0
  33. package/build/api/other/identity.js +30 -15
  34. package/build/api/other/translation.js +29 -14
  35. package/build/api/other/vero.js +113 -27
  36. package/build/api/rateLimitTracker.js +55 -0
  37. package/build/api/shared/request.js +189 -98
  38. package/build/api/trading/trading.js +154 -87
  39. package/build/auth/credentialSession.js +250 -0
  40. package/build/auth/oauth.js +298 -171
  41. package/build/auth/{oauth-metadata.js → oauthMetadata.js} +22 -6
  42. package/build/auth/oauthMiddleware.js +104 -0
  43. package/build/auth/{scope-utils.js → scopeUtils.js} +101 -28
  44. package/build/auth/tokenVerifier.js +243 -0
  45. package/build/auth/tokenVerifierError.js +21 -0
  46. package/build/config/environment.js +148 -113
  47. package/build/config/{tool-families.js → toolFamilies.js} +30 -14
  48. package/build/index.js +25 -19
  49. package/build/mcp/{http-transport.js → httpTransport.js} +102 -52
  50. package/build/mcp/readOnlyFilter.js +67 -0
  51. package/build/mcp/runtime.js +31 -13
  52. package/build/mcp/{tool-gating.js → toolGating.js} +77 -49
  53. package/build/mcp/{ui-bridge.js → uiBridge.js} +80 -23
  54. package/build/schemas/account-management/account.js +144 -6
  55. package/build/schemas/analytics/analytics.js +33 -19
  56. package/build/schemas/communication/messages.js +12 -42
  57. package/build/schemas/developer/developer.js +135 -0
  58. package/build/schemas/fulfillment/orders.js +183 -21
  59. package/build/schemas/index.js +27 -19
  60. package/build/schemas/inventory-management/inventory.js +17 -9
  61. package/build/schemas/marketing/marketing.js +480 -25
  62. package/build/schemas/metadata/metadata.js +11 -6
  63. package/build/schemas/other/finding.js +27 -0
  64. package/build/schemas/other/otherApis.js +424 -0
  65. package/build/schemas/taxonomy/taxonomy.js +11 -5
  66. package/build/scripts/{auto-setup.js → autoSetup.js} +87 -74
  67. package/build/scripts/{build-ui.js → buildUi.js} +6 -1
  68. package/build/scripts/{dev-sync.js → devSync.js} +169 -110
  69. package/build/scripts/diagnostics.js +52 -44
  70. package/build/scripts/{download-specs.js → downloadSpecs.js} +29 -21
  71. package/build/scripts/{interactive-setup.js → interactiveSetup.js} +84 -78
  72. package/build/scripts/setup.js +241 -178
  73. package/build/scripts/{setup-shared.js → setupShared.js} +29 -7
  74. package/build/scripts/skills.js +35 -27
  75. package/build/scripts/updateApiStatusDoc.js +71 -0
  76. package/build/serverHttp.js +90 -0
  77. package/build/skills/content.js +124 -118
  78. package/build/skills/index.js +22 -10
  79. package/build/skills/install.js +21 -10
  80. package/build/skills/markers.js +50 -15
  81. package/build/skills/{registry-snapshot.js → registrySnapshot.js} +8 -2
  82. package/build/skills/render.js +41 -14
  83. package/build/skills/targets.js +49 -17
  84. package/build/tools/categories/account.js +166 -264
  85. package/build/tools/categories/analytics.js +11 -22
  86. package/build/tools/categories/browse.js +17 -0
  87. package/build/tools/categories/communication.js +124 -399
  88. package/build/tools/categories/connector.js +23 -20
  89. package/build/tools/categories/developer.js +46 -159
  90. package/build/tools/categories/fulfillment.js +84 -215
  91. package/build/tools/categories/index.js +6 -14
  92. package/build/tools/categories/inventory.js +238 -293
  93. package/build/tools/categories/marketing.js +677 -39
  94. package/build/tools/categories/metadata.js +190 -117
  95. package/build/tools/categories/other.js +81 -208
  96. package/build/tools/categories/taxonomy.js +29 -20
  97. package/build/tools/categories/{token-management.js → tokenManagement.js} +187 -192
  98. package/build/tools/categories/trading.js +16 -47
  99. package/build/tools/contracts.js +34 -24
  100. package/build/tools/{define-tool.js → defineTool.js} +44 -29
  101. package/build/tools/registry.js +87 -29
  102. package/build/tools/schemas.js +3 -57
  103. package/build/tools/ui/archetypes.js +1 -0
  104. package/build/tools/ui/{map-helpers.js → mapHelpers.js} +69 -19
  105. package/build/tools/ui/maps.js +294 -80
  106. package/build/types/index.js +1 -1
  107. package/build/ui/card.html +14 -14
  108. package/build/ui/chart.html +14 -14
  109. package/build/ui/stat.html +87 -0
  110. package/build/ui/table.html +14 -14
  111. package/build/utils/apiStatusFeed.js +95 -0
  112. package/build/utils/cliOutput.js +15 -0
  113. package/build/utils/cliUi.js +108 -0
  114. package/build/utils/communication/feedback.js +57 -77
  115. package/build/utils/communication/message.js +69 -98
  116. package/build/utils/communication/negotiation.js +30 -57
  117. package/build/utils/communication/notification.js +112 -252
  118. package/build/utils/{date-converter.js → dateConverter.js} +62 -30
  119. package/build/utils/effectSchema.js +203 -0
  120. package/build/utils/effectSchemaAdapter.js +121 -0
  121. package/build/utils/effectSchemaChainMethods.js +146 -0
  122. package/build/utils/effectSchemaRefinements.js +104 -0
  123. package/build/utils/effectSchemaStringMethods.js +63 -0
  124. package/build/utils/effectSchemaTypes.js +47 -0
  125. package/build/utils/{env-parser.js → envParser.js} +10 -2
  126. package/build/utils/errors.js +7 -3
  127. package/build/utils/http.js +148 -89
  128. package/build/utils/{llm-client-detector.js → llmClientDetector.js} +295 -274
  129. package/build/utils/logger.js +127 -51
  130. package/build/utils/{oauth-helper.js → oauthHelper.js} +127 -90
  131. package/build/utils/other/compliance.js +18 -38
  132. package/build/utils/other/identity.js +2 -2
  133. package/build/utils/other/translation.js +4 -4
  134. package/build/utils/other/vero.js +36 -20
  135. package/build/utils/schemaHelpers.js +22 -0
  136. package/build/utils/scopeHelper.js +270 -0
  137. package/build/utils/securityChecker.js +316 -0
  138. package/build/utils/{setup-validator.js → setupValidator.js} +113 -94
  139. package/build/utils/{setup-wizard.js → setupWizard.js} +57 -46
  140. package/build/utils/{token-utils.js → tokenUtils.js} +2 -2
  141. package/build/utils/trading/trading.js +35 -0
  142. package/build/utils/typeGuards.js +12 -0
  143. package/build/utils/version.js +65 -29
  144. package/package.json +10 -8
  145. package/build/api/client-trading.js +0 -124
  146. package/build/api/communication/shared.js +0 -59
  147. package/build/api/shared/query-params.js +0 -16
  148. package/build/auth/credential-session.js +0 -166
  149. package/build/auth/oauth-middleware.js +0 -100
  150. package/build/auth/token-verifier.js +0 -186
  151. package/build/schemas/other/other-apis.js +0 -390
  152. package/build/scripts/update-api-status-doc.js +0 -44
  153. package/build/server-http.js +0 -85
  154. package/build/tools/definitions/marketing.js +0 -1381
  155. package/build/tools/tool-handlers/marketing.js +0 -312
  156. package/build/utils/account-management/account.js +0 -818
  157. package/build/utils/api-status-feed.js +0 -84
  158. package/build/utils/cli-ui.js +0 -47
  159. package/build/utils/order-management/dispute.js +0 -369
  160. package/build/utils/order-management/fulfillment.js +0 -205
  161. package/build/utils/other/edelivery.js +0 -235
  162. package/build/utils/schema-helpers.js +0 -13
  163. package/build/utils/scope-helper.js +0 -207
  164. package/build/utils/security-checker.js +0 -248
  165. package/build/utils/type-guards.js +0 -6
  166. /package/build/auth/{oauth-types.js → oauthTypes.js} +0 -0
  167. /package/build/{server-http.d.ts → serverHttp.d.ts} +0 -0
  168. /package/build/tools/ui/{view-models.js → viewModels.js} +0 -0
  169. /package/build/types/{ebay-enums.js → ebayEnums.js} +0 -0
@@ -1,818 +0,0 @@
1
- import { z } from 'zod';
2
- import { idSchema } from '../schema-helpers.js';
3
- /**
4
- * Zod schemas for Account API input validation
5
- * Based on: src/api/account-management/account.ts
6
- * OpenAPI spec: docs/sell-apps/account-management/sell_account_v1_oas3.json
7
- * Types from: src/types/sell_account_v1_oas3.ts
8
- */
9
- // Reusable schema for optional marketplace_id parameter
10
- const marketplaceIdSchema = z
11
- .string({
12
- invalid_type_error: 'marketplace_id must be a string',
13
- description: 'The eBay marketplace ID',
14
- })
15
- .optional();
16
- // ============================================================
17
- // Custom Policy Schemas
18
- // ============================================================
19
- /**
20
- * Schema for getCustomPolicies method
21
- * Endpoint: GET /custom_policy/
22
- * Query: GetCustomPoliciesParams - policy_types (optional)
23
- */
24
- export const getCustomPoliciesSchema = z.object({
25
- policy_types: z
26
- .string({
27
- invalid_type_error: 'policy_types must be a string',
28
- description: 'Comma-delimited list of custom policy types (PRODUCT_COMPLIANCE, TAKE_BACK)',
29
- })
30
- .optional(),
31
- });
32
- /**
33
- * Schema for getCustomPolicy method
34
- * Endpoint: GET /custom_policy/{custom_policy_id}
35
- * Path: GetCustomPolicyParams - custom_policy_id (required)
36
- */
37
- export const getCustomPolicySchema = z.object({
38
- custom_policy_id: idSchema('Custom policy ID', 'The unique identifier of the custom policy'),
39
- });
40
- /**
41
- * Schema for createCustomPolicy method
42
- * Endpoint: POST /custom_policy/
43
- * Body: CreateCustomPolicyRequest - name, label, description, policyType
44
- */
45
- export const createCustomPolicySchema = z.object({
46
- name: z
47
- .string({
48
- invalid_type_error: 'name must be a string',
49
- description: 'Seller-defined name for the custom policy (max 64 characters)',
50
- })
51
- .max(64, 'name must be 64 characters or less')
52
- .optional(),
53
- label: z
54
- .string({
55
- invalid_type_error: 'label must be a string',
56
- description: 'Seller-defined label for the custom policy (max 250 characters)',
57
- })
58
- .max(250, 'label must be 250 characters or less')
59
- .optional(),
60
- description: z
61
- .string({
62
- invalid_type_error: 'description must be a string',
63
- description: 'Seller-defined description of the custom policy (max 5000 characters)',
64
- })
65
- .max(5000, 'description must be 5000 characters or less')
66
- .optional(),
67
- policy_type: z
68
- .string({
69
- invalid_type_error: 'policy_type must be a string',
70
- description: 'Type of custom policy: PRODUCT_COMPLIANCE or TAKE_BACK',
71
- })
72
- .optional(),
73
- });
74
- /**
75
- * Schema for updateCustomPolicy method
76
- * Endpoint: PUT /custom_policy/{custom_policy_id}
77
- * Path: custom_policy_id (required)
78
- * Body: UpdateCustomPolicyRequest - name, label, description
79
- */
80
- export const updateCustomPolicySchema = z.object({
81
- custom_policy_id: idSchema('Custom policy ID', 'The unique identifier of the custom policy to update'),
82
- name: z
83
- .string({
84
- invalid_type_error: 'name must be a string',
85
- description: 'Updated name for the custom policy (max 64 characters)',
86
- })
87
- .max(64, 'name must be 64 characters or less')
88
- .optional(),
89
- label: z
90
- .string({
91
- invalid_type_error: 'label must be a string',
92
- description: 'Updated label for the custom policy (max 250 characters)',
93
- })
94
- .max(250, 'label must be 250 characters or less')
95
- .optional(),
96
- description: z
97
- .string({
98
- invalid_type_error: 'description must be a string',
99
- description: 'Updated description of the custom policy (max 5000 characters)',
100
- })
101
- .max(5000, 'description must be 5000 characters or less')
102
- .optional(),
103
- });
104
- /**
105
- * Schema for deleteCustomPolicy method
106
- * Endpoint: DELETE /custom_policy/{custom_policy_id}
107
- * Path: custom_policy_id (required)
108
- */
109
- export const deleteCustomPolicySchema = z.object({
110
- custom_policy_id: idSchema('Custom policy ID', 'The unique identifier of the custom policy to delete'),
111
- });
112
- // ============================================================
113
- // Fulfillment Policy Schemas
114
- // ============================================================
115
- /**
116
- * Schema for getFulfillmentPolicies method
117
- * Endpoint: GET /fulfillment_policy
118
- * Query: GetFulfillmentPoliciesParams - marketplace_id (required)
119
- */
120
- export const getFulfillmentPoliciesSchema = z.object({
121
- marketplace_id: z.string({
122
- message: 'Marketplace ID is required',
123
- required_error: 'marketplace_id is required',
124
- invalid_type_error: 'marketplace_id must be a string',
125
- description: 'The eBay marketplace ID',
126
- }),
127
- });
128
- /**
129
- * Schema for getFulfillmentPolicy method
130
- * Endpoint: GET /fulfillment_policy/{fulfillmentPolicyId}
131
- * Path: GetFulfillmentPolicyParams - fulfillmentPolicyId (required)
132
- */
133
- export const getFulfillmentPolicySchema = z.object({
134
- fulfillment_policy_id: idSchema('Fulfillment policy ID', 'The unique identifier of the fulfillment policy'),
135
- });
136
- /**
137
- * Schema for getFulfillmentPolicyByName method
138
- * Endpoint: GET /fulfillment_policy/get_by_policy_name
139
- * Query: GetFulfillmentPolicyByNameParams - marketplace_id (required), name (required)
140
- */
141
- export const getFulfillmentPolicyByNameSchema = z.object({
142
- marketplace_id: z.string({
143
- message: 'Marketplace ID is required',
144
- required_error: 'marketplace_id is required',
145
- invalid_type_error: 'marketplace_id must be a string',
146
- description: 'The eBay marketplace ID',
147
- }),
148
- name: z.string({
149
- message: 'Policy name is required',
150
- required_error: 'name is required',
151
- invalid_type_error: 'name must be a string',
152
- description: 'The fulfillment policy name',
153
- }),
154
- });
155
- /**
156
- * Schema for createFulfillmentPolicy method
157
- * Endpoint: POST /fulfillment_policy/
158
- * Body: FulfillmentPolicyRequest - complex object with many optional fields
159
- */
160
- export const createFulfillmentPolicySchema = z.object({
161
- category_types: z
162
- .array(z.object({
163
- name: z
164
- .string({
165
- invalid_type_error: 'category type name must be a string',
166
- description: 'Category type: ALL_EXCLUDING_MOTORS_VEHICLES or MOTORS_VEHICLES',
167
- })
168
- .optional(),
169
- }))
170
- .optional(),
171
- description: z
172
- .string({
173
- invalid_type_error: 'description must be a string',
174
- description: 'Seller-defined description of the fulfillment policy (max 250 characters)',
175
- })
176
- .max(250, 'description must be 250 characters or less')
177
- .optional(),
178
- freight_shipping: z
179
- .boolean({
180
- invalid_type_error: 'freight_shipping must be a boolean',
181
- description: 'Whether freight shipping is available for large items over 150 lbs',
182
- })
183
- .optional(),
184
- global_shipping: z
185
- .boolean({
186
- invalid_type_error: 'global_shipping must be a boolean',
187
- description: 'Whether to use Global Shipping Program (UK marketplace only)',
188
- })
189
- .optional(),
190
- handling_time: z
191
- .object({
192
- unit: z
193
- .string({
194
- invalid_type_error: 'unit must be a string',
195
- description: 'Time unit (typically DAY)',
196
- })
197
- .optional(),
198
- value: z
199
- .number({
200
- invalid_type_error: 'value must be a number',
201
- description: 'Number of handling time units (0-20 days)',
202
- })
203
- .int()
204
- .optional(),
205
- })
206
- .optional(),
207
- local_pickup: z
208
- .boolean({
209
- invalid_type_error: 'local_pickup must be a boolean',
210
- description: 'Whether local pickup is available',
211
- })
212
- .optional(),
213
- marketplace_id: marketplaceIdSchema,
214
- name: z
215
- .string({
216
- invalid_type_error: 'name must be a string',
217
- description: 'Seller-defined name for the fulfillment policy (max 64 characters)',
218
- })
219
- .max(64, 'name must be 64 characters or less')
220
- .optional(),
221
- pickup_drop_off: z
222
- .boolean({
223
- invalid_type_error: 'pickup_drop_off must be a boolean',
224
- description: 'Whether Click and Collect is available',
225
- })
226
- .optional(),
227
- shipping_options: z.array(z.record(z.unknown())).optional(),
228
- ship_to_locations: z
229
- .object({
230
- region_included: z.array(z.record(z.unknown())).optional(),
231
- region_excluded: z.array(z.record(z.unknown())).optional(),
232
- })
233
- .optional(),
234
- });
235
- /**
236
- * Schema for updateFulfillmentPolicy method
237
- * Endpoint: PUT /fulfillment_policy/{fulfillmentPolicyId}
238
- * Path: fulfillmentPolicyId (required)
239
- * Body: FulfillmentPolicyRequest
240
- */
241
- export const updateFulfillmentPolicySchema = z.object({
242
- fulfillment_policy_id: idSchema('Fulfillment policy ID', 'The unique identifier of the fulfillment policy to update'),
243
- category_types: z
244
- .array(z.object({
245
- name: z.string().optional(),
246
- }))
247
- .optional(),
248
- description: z.string().max(250).optional(),
249
- freight_shipping: z.boolean().optional(),
250
- global_shipping: z.boolean().optional(),
251
- handling_time: z
252
- .object({
253
- unit: z.string().optional(),
254
- value: z.number().int().optional(),
255
- })
256
- .optional(),
257
- local_pickup: z.boolean().optional(),
258
- marketplace_id: marketplaceIdSchema,
259
- name: z.string().max(64).optional(),
260
- pickup_drop_off: z.boolean().optional(),
261
- shipping_options: z.array(z.record(z.unknown())).optional(),
262
- ship_to_locations: z
263
- .object({
264
- region_included: z.array(z.record(z.unknown())).optional(),
265
- region_excluded: z.array(z.record(z.unknown())).optional(),
266
- })
267
- .optional(),
268
- });
269
- /**
270
- * Schema for deleteFulfillmentPolicy method
271
- * Endpoint: DELETE /fulfillment_policy/{fulfillmentPolicyId}
272
- * Path: fulfillmentPolicyId (required)
273
- */
274
- export const deleteFulfillmentPolicySchema = z.object({
275
- fulfillment_policy_id: idSchema('Fulfillment policy ID', 'The unique identifier of the fulfillment policy to delete'),
276
- });
277
- // ============================================================
278
- // Payment Policy Schemas
279
- // ============================================================
280
- /**
281
- * Schema for getPaymentPolicies method
282
- * Endpoint: GET /payment_policy
283
- * Query: GetPaymentPoliciesParams - marketplace_id (required)
284
- */
285
- export const getPaymentPoliciesSchema = z.object({
286
- marketplace_id: z.string({
287
- message: 'Marketplace ID is required',
288
- required_error: 'marketplace_id is required',
289
- invalid_type_error: 'marketplace_id must be a string',
290
- description: 'The eBay marketplace ID',
291
- }),
292
- });
293
- /**
294
- * Schema for getPaymentPolicy method
295
- * Endpoint: GET /payment_policy/{paymentPolicyId}
296
- * Path: GetPaymentPolicyParams - paymentPolicyId (required)
297
- */
298
- export const getPaymentPolicySchema = z.object({
299
- payment_policy_id: idSchema('Payment policy ID', 'The unique identifier of the payment policy'),
300
- });
301
- /**
302
- * Schema for getPaymentPolicyByName method
303
- * Endpoint: GET /payment_policy/get_by_policy_name
304
- * Query: GetPaymentPolicyByNameParams - marketplace_id (required), name (required)
305
- */
306
- export const getPaymentPolicyByNameSchema = z.object({
307
- marketplace_id: z.string({
308
- message: 'Marketplace ID is required',
309
- required_error: 'marketplace_id is required',
310
- invalid_type_error: 'marketplace_id must be a string',
311
- description: 'The eBay marketplace ID',
312
- }),
313
- name: z.string({
314
- message: 'Policy name is required',
315
- required_error: 'name is required',
316
- invalid_type_error: 'name must be a string',
317
- description: 'The payment policy name',
318
- }),
319
- });
320
- /**
321
- * Schema for createPaymentPolicy method
322
- * Endpoint: POST /payment_policy/
323
- * Body: PaymentPolicyRequest - complex object with many optional fields
324
- */
325
- export const createPaymentPolicySchema = z.object({
326
- category_types: z
327
- .array(z.object({
328
- name: z.string().optional(),
329
- }))
330
- .optional(),
331
- description: z
332
- .string({
333
- invalid_type_error: 'description must be a string',
334
- description: 'Seller-defined description of the payment policy (max 250 characters)',
335
- })
336
- .max(250, 'description must be 250 characters or less')
337
- .optional(),
338
- deposit: z
339
- .object({
340
- amount: z
341
- .object({
342
- currency: z.string().optional(),
343
- value: z.string().optional(),
344
- })
345
- .optional(),
346
- due_in: z
347
- .object({
348
- unit: z.string().optional(),
349
- value: z.number().int().optional(),
350
- })
351
- .optional(),
352
- payment_methods: z.array(z.record(z.unknown())).optional(),
353
- })
354
- .optional(),
355
- full_payment_due_in: z
356
- .object({
357
- unit: z.string().optional(),
358
- value: z.number().int().optional(),
359
- })
360
- .optional(),
361
- immediate_pay: z
362
- .boolean({
363
- invalid_type_error: 'immediate_pay must be a boolean',
364
- description: 'Whether immediate payment is required',
365
- })
366
- .optional(),
367
- marketplace_id: marketplaceIdSchema,
368
- name: z
369
- .string({
370
- invalid_type_error: 'name must be a string',
371
- description: 'Seller-defined name for the payment policy (max 64 characters)',
372
- })
373
- .max(64, 'name must be 64 characters or less')
374
- .optional(),
375
- payment_methods: z.array(z.record(z.unknown())).optional(),
376
- });
377
- /**
378
- * Schema for updatePaymentPolicy method
379
- * Endpoint: PUT /payment_policy/{paymentPolicyId}
380
- * Path: paymentPolicyId (required)
381
- * Body: PaymentPolicyRequest
382
- */
383
- export const updatePaymentPolicySchema = z.object({
384
- payment_policy_id: idSchema('Payment policy ID', 'The unique identifier of the payment policy to update'),
385
- category_types: z
386
- .array(z.object({
387
- name: z.string().optional(),
388
- }))
389
- .optional(),
390
- description: z.string().max(250).optional(),
391
- deposit: z
392
- .object({
393
- amount: z
394
- .object({
395
- currency: z.string().optional(),
396
- value: z.string().optional(),
397
- })
398
- .optional(),
399
- due_in: z
400
- .object({
401
- unit: z.string().optional(),
402
- value: z.number().int().optional(),
403
- })
404
- .optional(),
405
- payment_methods: z.array(z.record(z.unknown())).optional(),
406
- })
407
- .optional(),
408
- full_payment_due_in: z
409
- .object({
410
- unit: z.string().optional(),
411
- value: z.number().int().optional(),
412
- })
413
- .optional(),
414
- immediate_pay: z.boolean().optional(),
415
- marketplace_id: marketplaceIdSchema,
416
- name: z.string().max(64).optional(),
417
- payment_methods: z.array(z.record(z.unknown())).optional(),
418
- });
419
- /**
420
- * Schema for deletePaymentPolicy method
421
- * Endpoint: DELETE /payment_policy/{paymentPolicyId}
422
- * Path: paymentPolicyId (required)
423
- */
424
- export const deletePaymentPolicySchema = z.object({
425
- payment_policy_id: idSchema('Payment policy ID', 'The unique identifier of the payment policy to delete'),
426
- });
427
- // ============================================================
428
- // Return Policy Schemas
429
- // ============================================================
430
- /**
431
- * Schema for getReturnPolicies method
432
- * Endpoint: GET /return_policy
433
- * Query: GetReturnPoliciesParams - marketplace_id (required)
434
- */
435
- export const getReturnPoliciesSchema = z.object({
436
- marketplace_id: z.string({
437
- message: 'Marketplace ID is required',
438
- required_error: 'marketplace_id is required',
439
- invalid_type_error: 'marketplace_id must be a string',
440
- description: 'The eBay marketplace ID',
441
- }),
442
- });
443
- /**
444
- * Schema for getReturnPolicy method
445
- * Endpoint: GET /return_policy/{returnPolicyId}
446
- * Path: GetReturnPolicyParams - returnPolicyId (required)
447
- */
448
- export const getReturnPolicySchema = z.object({
449
- return_policy_id: idSchema('Return policy ID', 'The unique identifier of the return policy'),
450
- });
451
- /**
452
- * Schema for getReturnPolicyByName method
453
- * Endpoint: GET /return_policy/get_by_policy_name
454
- * Query: GetReturnPolicyByNameParams - marketplace_id (required), name (required)
455
- */
456
- export const getReturnPolicyByNameSchema = z.object({
457
- marketplace_id: z.string({
458
- message: 'Marketplace ID is required',
459
- required_error: 'marketplace_id is required',
460
- invalid_type_error: 'marketplace_id must be a string',
461
- description: 'The eBay marketplace ID',
462
- }),
463
- name: z.string({
464
- message: 'Policy name is required',
465
- required_error: 'name is required',
466
- invalid_type_error: 'name must be a string',
467
- description: 'The return policy name',
468
- }),
469
- });
470
- /**
471
- * Schema for createReturnPolicy method
472
- * Endpoint: POST /return_policy/
473
- * Body: ReturnPolicyRequest - complex object with many optional fields
474
- */
475
- export const createReturnPolicySchema = z.object({
476
- category_types: z
477
- .array(z.object({
478
- name: z.string().optional(),
479
- }))
480
- .optional(),
481
- description: z
482
- .string({
483
- invalid_type_error: 'description must be a string',
484
- description: 'Seller-defined description of the return policy (max 250 characters)',
485
- })
486
- .max(250, 'description must be 250 characters or less')
487
- .optional(),
488
- extended_holiday_returns_offered: z
489
- .boolean({
490
- invalid_type_error: 'extended_holiday_returns_offered must be a boolean',
491
- description: 'Whether extended holiday returns are offered',
492
- })
493
- .optional(),
494
- international_override: z
495
- .object({
496
- return_method: z.string().optional(),
497
- return_period: z
498
- .object({
499
- unit: z.string().optional(),
500
- value: z.number().int().optional(),
501
- })
502
- .optional(),
503
- returns_accepted: z.boolean().optional(),
504
- return_shipping_cost_payer: z.string().optional(),
505
- })
506
- .optional(),
507
- marketplace_id: marketplaceIdSchema,
508
- name: z
509
- .string({
510
- invalid_type_error: 'name must be a string',
511
- description: 'Seller-defined name for the return policy (max 64 characters)',
512
- })
513
- .max(64, 'name must be 64 characters or less')
514
- .optional(),
515
- refund_method: z
516
- .string({
517
- invalid_type_error: 'refund_method must be a string',
518
- description: 'Refund method: MONEY_BACK or MERCHANDISE_CREDIT',
519
- })
520
- .optional(),
521
- restocking_fee_percentage: z
522
- .string({
523
- invalid_type_error: 'restocking_fee_percentage must be a string',
524
- description: 'Restocking fee percentage (10, 15, 20, or custom)',
525
- })
526
- .optional(),
527
- return_instructions: z
528
- .string({
529
- invalid_type_error: 'return_instructions must be a string',
530
- description: 'Return instructions for the buyer (max 5000 characters)',
531
- })
532
- .max(5000, 'return_instructions must be 5000 characters or less')
533
- .optional(),
534
- return_method: z
535
- .string({
536
- invalid_type_error: 'return_method must be a string',
537
- description: 'Return method: REPLACEMENT or EXCHANGE',
538
- })
539
- .optional(),
540
- return_period: z
541
- .object({
542
- unit: z.string().optional(),
543
- value: z.number().int().optional(),
544
- })
545
- .optional(),
546
- returns_accepted: z
547
- .boolean({
548
- invalid_type_error: 'returns_accepted must be a boolean',
549
- description: 'Whether returns are accepted',
550
- })
551
- .optional(),
552
- return_shipping_cost_payer: z
553
- .string({
554
- invalid_type_error: 'return_shipping_cost_payer must be a string',
555
- description: 'Who pays return shipping: BUYER or SELLER',
556
- })
557
- .optional(),
558
- });
559
- /**
560
- * Schema for updateReturnPolicy method
561
- * Endpoint: PUT /return_policy/{returnPolicyId}
562
- * Path: returnPolicyId (required)
563
- * Body: ReturnPolicyRequest
564
- */
565
- export const updateReturnPolicySchema = z.object({
566
- return_policy_id: idSchema('Return policy ID', 'The unique identifier of the return policy to update'),
567
- category_types: z
568
- .array(z.object({
569
- name: z.string().optional(),
570
- }))
571
- .optional(),
572
- description: z.string().max(250).optional(),
573
- extended_holiday_returns_offered: z.boolean().optional(),
574
- international_override: z
575
- .object({
576
- return_method: z.string().optional(),
577
- return_period: z
578
- .object({
579
- unit: z.string().optional(),
580
- value: z.number().int().optional(),
581
- })
582
- .optional(),
583
- returns_accepted: z.boolean().optional(),
584
- return_shipping_cost_payer: z.string().optional(),
585
- })
586
- .optional(),
587
- marketplace_id: marketplaceIdSchema,
588
- name: z.string().max(64).optional(),
589
- refund_method: z.string().optional(),
590
- restocking_fee_percentage: z.string().optional(),
591
- return_instructions: z.string().max(5000).optional(),
592
- return_method: z.string().optional(),
593
- return_period: z
594
- .object({
595
- unit: z.string().optional(),
596
- value: z.number().int().optional(),
597
- })
598
- .optional(),
599
- returns_accepted: z.boolean().optional(),
600
- return_shipping_cost_payer: z.string().optional(),
601
- });
602
- /**
603
- * Schema for deleteReturnPolicy method
604
- * Endpoint: DELETE /return_policy/{returnPolicyId}
605
- * Path: returnPolicyId (required)
606
- */
607
- export const deleteReturnPolicySchema = z.object({
608
- return_policy_id: idSchema('Return policy ID', 'The unique identifier of the return policy to delete'),
609
- });
610
- // ============================================================
611
- // Privileges, KYC, and Other Account Schemas
612
- // ============================================================
613
- /**
614
- * Schema for getPrivileges method
615
- * Endpoint: GET /privilege
616
- * No parameters required
617
- */
618
- export const getPrivilegesSchema = z.object({});
619
- /**
620
- * Schema for getKyc method
621
- * Endpoint: GET /kyc
622
- * No parameters required
623
- */
624
- export const getKycSchema = z.object({});
625
- /**
626
- * Schema for optInToPaymentsProgram method
627
- * Endpoint: POST /payments_program/{marketplace_id}/{payments_program_type}
628
- * Path: marketplace_id (required), payments_program_type (required)
629
- */
630
- export const optInToPaymentsProgramSchema = z.object({
631
- marketplace_id: z.string({
632
- message: 'Marketplace ID is required',
633
- required_error: 'marketplace_id is required',
634
- invalid_type_error: 'marketplace_id must be a string',
635
- description: 'The eBay marketplace ID',
636
- }),
637
- payments_program_type: z.string({
638
- message: 'Payments program type is required',
639
- required_error: 'payments_program_type is required',
640
- invalid_type_error: 'payments_program_type must be a string',
641
- description: 'The payments program type (e.g., EBAY_PAYMENTS)',
642
- }),
643
- });
644
- /**
645
- * Schema for getPaymentsProgramStatus method
646
- * Endpoint: GET /payments_program/{marketplace_id}/{payments_program_type}
647
- * Path: marketplace_id (required), payments_program_type (required)
648
- */
649
- export const getPaymentsProgramStatusSchema = z.object({
650
- marketplace_id: z.string({
651
- message: 'Marketplace ID is required',
652
- required_error: 'marketplace_id is required',
653
- invalid_type_error: 'marketplace_id must be a string',
654
- description: 'The eBay marketplace ID',
655
- }),
656
- payments_program_type: z.string({
657
- message: 'Payments program type is required',
658
- required_error: 'payments_program_type is required',
659
- invalid_type_error: 'payments_program_type must be a string',
660
- description: 'The payments program type',
661
- }),
662
- });
663
- /**
664
- * Schema for getRateTables method
665
- * Endpoint: GET /rate_table
666
- * No parameters required
667
- */
668
- export const getRateTablesSchema = z.object({});
669
- /**
670
- * Schema for createOrReplaceSalesTax method
671
- * Endpoint: PUT /sales_tax/{country_code}/{jurisdiction_id}
672
- * Path: country_code (required), jurisdiction_id (required)
673
- * Body: SalesTaxBase - sales_tax_percentage, shipping_and_handling_taxed
674
- */
675
- export const createOrReplaceSalesTaxSchema = z.object({
676
- country_code: z.string({
677
- message: 'Country code is required',
678
- required_error: 'country_code is required',
679
- invalid_type_error: 'country_code must be a string',
680
- description: 'Two-letter ISO 3166-1 country code',
681
- }),
682
- jurisdiction_id: z.string({
683
- message: 'Jurisdiction ID is required',
684
- required_error: 'jurisdiction_id is required',
685
- invalid_type_error: 'jurisdiction_id must be a string',
686
- description: 'State or province ID (e.g., US state abbreviation)',
687
- }),
688
- sales_tax_percentage: z
689
- .string({
690
- invalid_type_error: 'sales_tax_percentage must be a string',
691
- description: 'Sales tax percentage (0-100)',
692
- })
693
- .optional(),
694
- shipping_and_handling_taxed: z
695
- .boolean({
696
- invalid_type_error: 'shipping_and_handling_taxed must be a boolean',
697
- description: 'Whether shipping and handling are taxed',
698
- })
699
- .optional(),
700
- });
701
- /**
702
- * Schema for bulkCreateOrReplaceSalesTax method
703
- * Endpoint: POST /sales_tax/bulk_create_or_replace
704
- * Body: Array of sales tax requests
705
- */
706
- export const bulkCreateOrReplaceSalesTaxSchema = z.object({
707
- requests: z
708
- .array(z.object({
709
- country_code: z.string().optional(),
710
- jurisdiction_id: z.string().optional(),
711
- sales_tax_base: z
712
- .object({
713
- sales_tax_percentage: z.string().optional(),
714
- shipping_and_handling_taxed: z.boolean().optional(),
715
- })
716
- .optional(),
717
- }), {
718
- invalid_type_error: 'requests must be an array',
719
- description: 'Array of sales tax requests',
720
- })
721
- .optional(),
722
- });
723
- /**
724
- * Schema for getSalesTax method
725
- * Endpoint: GET /sales_tax/{country_code}/{jurisdiction_id}
726
- * Path: country_code (required), jurisdiction_id (required)
727
- */
728
- export const getSalesTaxSchema = z.object({
729
- country_code: z.string({
730
- message: 'Country code is required',
731
- required_error: 'country_code is required',
732
- invalid_type_error: 'country_code must be a string',
733
- description: 'Two-letter ISO 3166-1 country code',
734
- }),
735
- jurisdiction_id: z.string({
736
- message: 'Jurisdiction ID is required',
737
- required_error: 'jurisdiction_id is required',
738
- invalid_type_error: 'jurisdiction_id must be a string',
739
- description: 'State or province ID',
740
- }),
741
- });
742
- /**
743
- * Schema for deleteSalesTax method
744
- * Endpoint: DELETE /sales_tax/{country_code}/{jurisdiction_id}
745
- * Path: country_code (required), jurisdiction_id (required)
746
- */
747
- export const deleteSalesTaxSchema = z.object({
748
- country_code: z.string({
749
- message: 'Country code is required',
750
- required_error: 'country_code is required',
751
- invalid_type_error: 'country_code must be a string',
752
- description: 'Two-letter ISO 3166-1 country code',
753
- }),
754
- jurisdiction_id: z.string({
755
- message: 'Jurisdiction ID is required',
756
- required_error: 'jurisdiction_id is required',
757
- invalid_type_error: 'jurisdiction_id must be a string',
758
- description: 'State or province ID',
759
- }),
760
- });
761
- /**
762
- * Schema for getSalesTaxes method
763
- * Endpoint: GET /sales_tax
764
- * Query: GetSalesTaxesParams - country_code (required)
765
- */
766
- export const getSalesTaxesSchema = z.object({
767
- country_code: z.string({
768
- message: 'Country code is required',
769
- required_error: 'country_code is required',
770
- invalid_type_error: 'country_code must be a string',
771
- description: 'Two-letter ISO 3166-1 country code',
772
- }),
773
- });
774
- /**
775
- * Schema for getSubscription method
776
- * Endpoint: GET /subscription
777
- * Query: GetSubscriptionParams - limit (optional)
778
- */
779
- export const getSubscriptionSchema = z.object({
780
- limit_type: z
781
- .string({
782
- invalid_type_error: 'limit_type must be a string',
783
- description: 'Type of subscription limit to retrieve',
784
- })
785
- .optional(),
786
- });
787
- /**
788
- * Schema for optInToProgram method
789
- * Endpoint: POST /program/opt_in
790
- * Body: OptInToProgramRequest - program_type
791
- */
792
- export const optInToProgramSchema = z.object({
793
- program_type: z
794
- .string({
795
- invalid_type_error: 'program_type must be a string',
796
- description: 'The program type to opt into (e.g., OUT_OF_STOCK_CONTROL)',
797
- })
798
- .optional(),
799
- });
800
- /**
801
- * Schema for optOutOfProgram method
802
- * Endpoint: POST /program/opt_out
803
- * Body: OptInToProgramRequest - program_type
804
- */
805
- export const optOutOfProgramSchema = z.object({
806
- program_type: z
807
- .string({
808
- invalid_type_error: 'program_type must be a string',
809
- description: 'The program type to opt out of',
810
- })
811
- .optional(),
812
- });
813
- /**
814
- * Schema for getOptedInPrograms method
815
- * Endpoint: GET /program
816
- * No parameters required
817
- */
818
- export const getOptedInProgramsSchema = z.object({});