@wix/auto_sdk_pricing-plans_orders 1.0.120 → 1.0.121

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 (49) hide show
  1. package/build/cjs/index.d.ts +129 -129
  2. package/build/cjs/index.js +548 -548
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/cjs/index.typings.d.ts +787 -787
  5. package/build/cjs/index.typings.js +421 -421
  6. package/build/cjs/index.typings.js.map +1 -1
  7. package/build/cjs/meta.d.ts +484 -484
  8. package/build/cjs/meta.js +352 -352
  9. package/build/cjs/meta.js.map +1 -1
  10. package/build/cjs/schemas.d.ts +199 -199
  11. package/build/cjs/schemas.js +885 -885
  12. package/build/cjs/schemas.js.map +1 -1
  13. package/build/es/index.d.mts +129 -129
  14. package/build/es/index.mjs +548 -548
  15. package/build/es/index.mjs.map +1 -1
  16. package/build/es/index.typings.d.mts +787 -787
  17. package/build/es/index.typings.mjs +421 -421
  18. package/build/es/index.typings.mjs.map +1 -1
  19. package/build/es/meta.d.mts +484 -484
  20. package/build/es/meta.mjs +352 -352
  21. package/build/es/meta.mjs.map +1 -1
  22. package/build/es/schemas.d.mts +199 -199
  23. package/build/es/schemas.mjs +885 -885
  24. package/build/es/schemas.mjs.map +1 -1
  25. package/build/internal/cjs/index.d.ts +129 -129
  26. package/build/internal/cjs/index.js +548 -548
  27. package/build/internal/cjs/index.js.map +1 -1
  28. package/build/internal/cjs/index.typings.d.ts +845 -786
  29. package/build/internal/cjs/index.typings.js +421 -421
  30. package/build/internal/cjs/index.typings.js.map +1 -1
  31. package/build/internal/cjs/meta.d.ts +578 -477
  32. package/build/internal/cjs/meta.js +352 -352
  33. package/build/internal/cjs/meta.js.map +1 -1
  34. package/build/internal/cjs/schemas.d.ts +199 -199
  35. package/build/internal/cjs/schemas.js +885 -885
  36. package/build/internal/cjs/schemas.js.map +1 -1
  37. package/build/internal/es/index.d.mts +129 -129
  38. package/build/internal/es/index.mjs +548 -548
  39. package/build/internal/es/index.mjs.map +1 -1
  40. package/build/internal/es/index.typings.d.mts +845 -786
  41. package/build/internal/es/index.typings.mjs +421 -421
  42. package/build/internal/es/index.typings.mjs.map +1 -1
  43. package/build/internal/es/meta.d.mts +578 -477
  44. package/build/internal/es/meta.mjs +352 -352
  45. package/build/internal/es/meta.mjs.map +1 -1
  46. package/build/internal/es/schemas.d.mts +199 -199
  47. package/build/internal/es/schemas.mjs +885 -885
  48. package/build/internal/es/schemas.mjs.map +1 -1
  49. package/package.json +4 -4
@@ -1,13 +1,29 @@
1
1
  // src/pricing-plans-v2-order-orders.schemas.ts
2
2
  import * as z from "zod";
3
- var ManagementGetOrderRequest = z.object({
4
- _id: z.string().describe("Order ID.").regex(
3
+ var CreateOnlineOrderRequest = z.object({
4
+ planId: z.string().describe("Plan ID.").regex(
5
5
  /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
6
6
  "Must be a valid GUID"
7
7
  ),
8
- options: z.object({ fieldSet: z.enum(["UNKNOWN_SET", "BASIC", "FULL"]).optional() }).describe("Options to use when getting an order. ").optional()
8
+ options: z.object({
9
+ startDate: z.date().describe(
10
+ "Start date and time for the plan of the online order in a `YYYY-MM-DDThh:mm[:ss][.sss]Z` format.\n\nDefault: Current date and time."
11
+ ).optional().nullable(),
12
+ couponCode: z.string().describe("Coupon code to apply.").min(1).max(20).optional().nullable(),
13
+ onBehalf: z.object({
14
+ memberId: z.string().describe("Member ID.").regex(
15
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
16
+ "Must be a valid GUID"
17
+ ),
18
+ orderMethod: z.enum(["UNKNOWN", "MOTO", "POS"]).optional()
19
+ }).describe("Provided if checkout is initiated on buyer's behalf.").optional(),
20
+ submissionId: z.string().describe("Submission ID of the form submitted with this order.").regex(
21
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
22
+ "Must be a valid GUID"
23
+ ).optional().nullable()
24
+ }).optional()
9
25
  });
10
- var ManagementGetOrderResponse = z.object({
26
+ var CreateOnlineOrderResponse = z.object({
11
27
  order: z.object({
12
28
  _id: z.string().describe("Order ID.").regex(
13
29
  /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
@@ -328,470 +344,365 @@ var ManagementGetOrderResponse = z.object({
328
344
  }).describe(
329
345
  "Information about the form submitted during the plan's checkout."
330
346
  ).optional()
331
- }).describe("Order.").optional()
347
+ }).describe("Created online order.").optional()
332
348
  });
333
- var ManagementListOrdersRequest = z.object({
349
+ var CreateOfflineOrderRequest = z.object({
350
+ planId: z.string().describe("ID of the plan being ordered, from the Plans API.").regex(
351
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
352
+ "Must be a valid GUID"
353
+ ),
354
+ memberId: z.string().describe("ID of the member ordering the plan, from the Members API.").regex(
355
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
356
+ "Must be a valid GUID"
357
+ ),
334
358
  options: z.object({
335
- buyerIds: z.array(z.string()).optional(),
336
- planIds: z.array(z.string()).optional(),
337
- autoRenewCanceled: z.boolean().describe(
338
- "Filter by whether or not the auto-renewal of recurring orders was canceled."
359
+ startDate: z.date().describe(
360
+ "Start date and time for the ordered plan in a `YYYY-MM-DDThh:mm[:ss][.sss]Z` format.\n\nDefault: Current date and time."
339
361
  ).optional().nullable(),
340
- orderStatuses: z.array(
341
- z.enum([
342
- "UNDEFINED",
343
- "DRAFT",
344
- "PENDING",
345
- "ACTIVE",
346
- "PAUSED",
347
- "ENDED",
348
- "CANCELED"
349
- ])
362
+ paid: z.boolean().describe("Whether the order is paid.\n\nDefault: `false`").optional().nullable(),
363
+ couponCode: z.string().describe("Coupon code to apply, from the Coupons API.").min(1).max(20).optional().nullable(),
364
+ submissionId: z.string().describe("Form submission ID that was submitted with the order.").regex(
365
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
366
+ "Must be a valid GUID"
367
+ ).optional().nullable()
368
+ }).describe("Options for creating an offline order. ").optional()
369
+ });
370
+ var CreateOfflineOrderResponse = z.object({
371
+ order: z.object({
372
+ _id: z.string().describe("Order ID.").regex(
373
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
374
+ "Must be a valid GUID"
350
375
  ).optional(),
351
- paymentStatuses: z.array(
352
- z.enum([
353
- "UNDEFINED",
354
- "PAID",
355
- "REFUNDED",
356
- "FAILED",
357
- "UNPAID",
358
- "PENDING",
359
- "NOT_APPLICABLE"
360
- ])
376
+ planId: z.string().describe(
377
+ "ID of the plan purchased with the order, from the Plans API."
378
+ ).regex(
379
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
380
+ "Must be a valid GUID"
361
381
  ).optional(),
362
- limit: z.number().int().describe(
363
- "Number of orders to return. See Sorting and Paging for more information.\n\nMax: `50`"
364
- ).min(1).max(50).optional().nullable(),
365
- offset: z.number().int().describe("Number of orders to skip in the current sort order.").min(0).optional().nullable(),
366
- sorting: z.object({
367
- fieldName: z.string().describe("Name of the field to sort by.").max(512).optional(),
368
- order: z.enum(["ASC", "DESC"]).optional(),
369
- origin: z.object({
370
- latitude: z.number().describe("Address latitude.").optional().nullable(),
371
- longitude: z.number().describe("Address longitude.").optional().nullable()
372
- }).describe(
373
- "Origin point for geo-distance sorting on a GEO field\nresults are ordered by distance from this point (ASC = nearest first, DESC = farthest first)."
374
- ).optional()
375
- }).describe(
376
- "Sort order.\n\nUse `ASC` for ascending order or `DESC` for descending order.\n\nDefault: `DESC`."
382
+ subscriptionId: z.string().describe(
383
+ "ID of the related Wix subscription.\n\nEvery pricing plan order corresponds to a Wix subscription, including orders for single payment plans. Learn more in\na [Pricing Plans overview](https://support.wix.com/en/article/pricing-plans-an-overview#create-plans-to-suit-your-business)."
384
+ ).regex(
385
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
386
+ "Must be a valid GUID"
377
387
  ).optional(),
378
- fieldSet: z.enum(["UNKNOWN_SET", "BASIC", "FULL"]).optional()
379
- }).describe("Filtering, sorting, and pagination options. ").optional()
380
- });
381
- var ManagementListOrdersResponse = z.object({
382
- orders: z.array(
383
- z.object({
384
- _id: z.string().describe("Order ID.").regex(
385
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
386
- "Must be a valid GUID"
387
- ).optional(),
388
- planId: z.string().describe(
389
- "ID of the plan purchased with the order, from the Plans API."
390
- ).regex(
391
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
392
- "Must be a valid GUID"
393
- ).optional(),
394
- subscriptionId: z.string().describe(
395
- "ID of the related Wix subscription.\n\nEvery pricing plan order corresponds to a Wix subscription, including orders for single payment plans. Learn more in\na [Pricing Plans overview](https://support.wix.com/en/article/pricing-plans-an-overview#create-plans-to-suit-your-business)."
396
- ).regex(
388
+ wixPayOrderId: z.string().describe(
389
+ "Wix Pay order ID.\n\nProvided by Wix whether the order is created online or offline. The field is omitted when the order is free."
390
+ ).regex(
391
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
392
+ "Must be a valid GUID"
393
+ ).optional().nullable(),
394
+ buyer: z.object({
395
+ memberId: z.string().describe("Member ID for a Wix site member, from the Members API.").regex(
397
396
  /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
398
397
  "Must be a valid GUID"
399
398
  ).optional(),
400
- wixPayOrderId: z.string().describe(
401
- "Wix Pay order ID.\n\nProvided by Wix whether the order is created online or offline. The field is omitted when the order is free."
399
+ contactId: z.string().describe(
400
+ "Contact ID for a Wix site contact, from the Contacts API."
402
401
  ).regex(
403
402
  /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
404
403
  "Must be a valid GUID"
405
- ).optional().nullable(),
406
- buyer: z.object({
407
- memberId: z.string().describe(
408
- "Member ID for a Wix site member, from the Members API."
409
- ).regex(
410
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
411
- "Must be a valid GUID"
404
+ ).optional()
405
+ }).describe(
406
+ "The buyer's IDs. Includes `memberId` and `contactId`.\n\nCurrently, Pricing Plan purchases are limited to members only. `contactId` is returned,\nbut a buyer will not be able to purchase a plan without a `memberId`."
407
+ ).optional(),
408
+ priceDetails: z.intersection(
409
+ z.object({
410
+ subtotal: z.string().describe(
411
+ 'Price of the order excluding tax, specified as a monetary amount. for example, `"9.99"`.'
412
412
  ).optional(),
413
- contactId: z.string().describe(
414
- "Contact ID for a Wix site contact, from the Contacts API."
415
- ).regex(
416
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
417
- "Must be a valid GUID"
418
- ).optional()
419
- }).describe(
420
- "The buyer's IDs. Includes `memberId` and `contactId`.\n\nCurrently, Pricing Plan purchases are limited to members only. `contactId` is returned,\nbut a buyer will not be able to purchase a plan without a `memberId`."
421
- ).optional(),
422
- priceDetails: z.intersection(
423
- z.object({
424
- subtotal: z.string().describe(
425
- 'Price of the order excluding tax, specified as a monetary amount. for example, `"9.99"`.'
426
- ).optional(),
427
- discount: z.string().describe("Total discount applied.").optional(),
428
- tax: z.object({
429
- name: z.string().describe("Name of the tax. For example, VAT.").optional(),
430
- includedInPrice: z.boolean().describe(
431
- "Whether tax is included in the original price. When `false`, tax is added at checkout."
432
- ).optional(),
433
- rate: z.string().describe(
434
- 'Tax rate percentage, as a number between 0 and 100. For example, a 7% tax rate is `"7.00"`.'
435
- ).optional(),
436
- amount: z.string().describe(
437
- 'Total tax, specified as a monetary amount. For example, `"3.99"`.'
438
- ).optional()
439
- }).describe("Tax applied.").optional(),
440
- total: z.string().describe(
441
- 'Price after tax and discount is applied, specified as a monetary amount. For example, `"13.98"`.\n\nIf no tax is applied, the amount is the same as `subtotal`.'
413
+ discount: z.string().describe("Total discount applied.").optional(),
414
+ tax: z.object({
415
+ name: z.string().describe("Name of the tax. For example, VAT.").optional(),
416
+ includedInPrice: z.boolean().describe(
417
+ "Whether tax is included in the original price. When `false`, tax is added at checkout."
442
418
  ).optional(),
443
- planPrice: z.string().describe(
444
- "Plan price as it was at the moment of order creation."
419
+ rate: z.string().describe(
420
+ 'Tax rate percentage, as a number between 0 and 100. For example, a 7% tax rate is `"7.00"`.'
445
421
  ).optional(),
446
- currency: z.string().describe(
447
- "Currency code. Must be valid ISO 4217 currency code (e.g., USD)."
422
+ amount: z.string().describe(
423
+ 'Total tax, specified as a monetary amount. For example, `"3.99"`.'
424
+ ).optional()
425
+ }).describe("Tax applied.").optional(),
426
+ total: z.string().describe(
427
+ 'Price after tax and discount is applied, specified as a monetary amount. For example, `"13.98"`.\n\nIf no tax is applied, the amount is the same as `subtotal`.'
428
+ ).optional(),
429
+ planPrice: z.string().describe("Plan price as it was at the moment of order creation.").optional(),
430
+ currency: z.string().describe(
431
+ "Currency code. Must be valid ISO 4217 currency code (e.g., USD)."
432
+ ).optional(),
433
+ freeTrialDays: z.number().int().describe(
434
+ "Free trial period for the order in days. Only available for recurring plans."
435
+ ).min(1).max(999).optional().nullable(),
436
+ coupon: z.object({
437
+ code: z.string().describe("Code of the applied coupon.").min(1).max(20).optional(),
438
+ amount: z.string().describe(
439
+ "Total discount of the coupon, as a monetary amount."
448
440
  ).optional(),
449
- freeTrialDays: z.number().int().describe(
450
- "Free trial period for the order in days. Only available for recurring plans."
451
- ).min(1).max(999).optional().nullable(),
452
- coupon: z.object({
453
- code: z.string().describe("Code of the applied coupon.").min(1).max(20).optional(),
454
- amount: z.string().describe(
455
- "Total discount of the coupon, as a monetary amount."
456
- ).optional(),
457
- _id: z.string().describe("Coupon ID.").regex(
458
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
459
- "Must be a valid GUID"
460
- ).optional()
461
- }).describe(
462
- "Coupon applied to the order. Empty means no coupon was applied."
441
+ _id: z.string().describe("Coupon ID.").regex(
442
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
443
+ "Must be a valid GUID"
463
444
  ).optional()
445
+ }).describe(
446
+ "Coupon applied to the order. Empty means no coupon was applied."
447
+ ).optional()
448
+ }),
449
+ z.xor([
450
+ z.object({
451
+ subscription: z.never().optional(),
452
+ singlePaymentForDuration: z.never().optional(),
453
+ singlePaymentUnlimited: z.never().optional()
464
454
  }),
465
- z.xor([
466
- z.object({
467
- subscription: z.never().optional(),
468
- singlePaymentForDuration: z.never().optional(),
469
- singlePaymentUnlimited: z.never().optional()
470
- }),
471
- z.object({
472
- singlePaymentForDuration: z.never().optional(),
473
- singlePaymentUnlimited: z.never().optional(),
474
- subscription: z.object({
475
- cycleDuration: z.object({
476
- count: z.number().int().describe(
477
- "Number of days, months, weeks, or years in a single payment cycle. Currently limited to support only `1`."
478
- ).min(1).optional().nullable(),
479
- unit: z.enum(["UNDEFINED", "DAY", "WEEK", "MONTH", "YEAR"]).describe("Unit of time for the cycle duration.").optional()
480
- }).describe(
481
- "Number of payment cycles the subscription is valid for.\n`0` for unlimited plans or for plans that are valid until canceled."
482
- ).optional(),
483
- cycleCount: z.number().int().describe(
484
- "Length of a payment cycle. For example, 1 month to have monthly payments.\nMultiply `cycleDuration`'s `count` by `cycleCount` to get the subscription duration.\nCurrently, only a value of `1` is supported."
485
- ).min(0).max(2e3).optional().nullable()
486
- }).describe("Order has recurring payments.")
487
- }),
488
- z.object({
489
- subscription: z.never().optional(),
490
- singlePaymentUnlimited: z.never().optional(),
491
- singlePaymentForDuration: z.object({
455
+ z.object({
456
+ singlePaymentForDuration: z.never().optional(),
457
+ singlePaymentUnlimited: z.never().optional(),
458
+ subscription: z.object({
459
+ cycleDuration: z.object({
492
460
  count: z.number().int().describe(
493
461
  "Number of days, months, weeks, or years in a single payment cycle. Currently limited to support only `1`."
494
462
  ).min(1).optional().nullable(),
495
463
  unit: z.enum(["UNDEFINED", "DAY", "WEEK", "MONTH", "YEAR"]).describe("Unit of time for the cycle duration.").optional()
496
464
  }).describe(
497
- "One-time payment. Order is valid for a specified duration."
498
- )
499
- }),
500
- z.object({
501
- subscription: z.never().optional(),
502
- singlePaymentForDuration: z.never().optional(),
503
- singlePaymentUnlimited: z.boolean().describe(
504
- "One-time payment. Order is valid until it is canceled."
505
- )
506
- })
507
- ])
508
- ).describe(
509
- "__Deprecated.__ Use `pricing` instead. This property will be removed on September 30, 2022."
510
- ).optional(),
511
- pricing: z.intersection(
465
+ "Number of payment cycles the subscription is valid for.\n`0` for unlimited plans or for plans that are valid until canceled."
466
+ ).optional(),
467
+ cycleCount: z.number().int().describe(
468
+ "Length of a payment cycle. For example, 1 month to have monthly payments.\nMultiply `cycleDuration`'s `count` by `cycleCount` to get the subscription duration.\nCurrently, only a value of `1` is supported."
469
+ ).min(0).max(2e3).optional().nullable()
470
+ }).describe("Order has recurring payments.")
471
+ }),
512
472
  z.object({
513
- prices: z.array(
514
- z.object({
515
- duration: z.object({
516
- cycleFrom: z.number().int().describe(
517
- "Price starts to apply with this cycle.\n\n`1` is the first payment cycle for all pricing models."
473
+ subscription: z.never().optional(),
474
+ singlePaymentUnlimited: z.never().optional(),
475
+ singlePaymentForDuration: z.object({
476
+ count: z.number().int().describe(
477
+ "Number of days, months, weeks, or years in a single payment cycle. Currently limited to support only `1`."
478
+ ).min(1).optional().nullable(),
479
+ unit: z.enum(["UNDEFINED", "DAY", "WEEK", "MONTH", "YEAR"]).describe("Unit of time for the cycle duration.").optional()
480
+ }).describe(
481
+ "One-time payment. Order is valid for a specified duration."
482
+ )
483
+ }),
484
+ z.object({
485
+ subscription: z.never().optional(),
486
+ singlePaymentForDuration: z.never().optional(),
487
+ singlePaymentUnlimited: z.boolean().describe(
488
+ "One-time payment. Order is valid until it is canceled."
489
+ )
490
+ })
491
+ ])
492
+ ).describe(
493
+ "__Deprecated.__ Use `pricing` instead. This property will be removed on September 30, 2022."
494
+ ).optional(),
495
+ pricing: z.intersection(
496
+ z.object({
497
+ prices: z.array(
498
+ z.object({
499
+ duration: z.object({
500
+ cycleFrom: z.number().int().describe(
501
+ "Price starts to apply with this cycle.\n\n`1` is the first payment cycle for all pricing models."
502
+ ).optional(),
503
+ numberOfCycles: z.number().int().describe(
504
+ "Amount of cycles to apply price for.\n\nFor `subscription` pricing models with a finite number of cycles, the `numberOfCycles` is the same as `pricing.subscription.cycleCount`.\n\nFor `subscription` pricing models that are unlimited or until-canceled, the `numberOfCycles` is not returned.\n\nFor `singlePaymentForDuration` and `singlePaymentUnlimited` pricing models, the `numberOfCycles` is `1`."
505
+ ).optional().nullable()
506
+ }).describe(
507
+ "Cycle duration to apply `price` for.\n\nUse with all pricing models.\nCan apply the same price to multiple payment cycles."
508
+ ).optional(),
509
+ price: z.object({
510
+ subtotal: z.string().describe(
511
+ 'Price of the order excluding tax, specified as a monetary amount. For example, `"9.99"`.'
512
+ ).optional(),
513
+ coupon: z.object({
514
+ code: z.string().describe("Code of the applied coupon.").min(1).max(20).optional(),
515
+ amount: z.string().describe(
516
+ "Total discount of the coupon, as a monetary amount."
518
517
  ).optional(),
519
- numberOfCycles: z.number().int().describe(
520
- "Amount of cycles to apply price for.\n\nFor `subscription` pricing models with a finite number of cycles, the `numberOfCycles` is the same as `pricing.subscription.cycleCount`.\n\nFor `subscription` pricing models that are unlimited or until-canceled, the `numberOfCycles` is not returned.\n\nFor `singlePaymentForDuration` and `singlePaymentUnlimited` pricing models, the `numberOfCycles` is `1`."
521
- ).optional().nullable()
518
+ _id: z.string().describe("Coupon ID.").regex(
519
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
520
+ "Must be a valid GUID"
521
+ ).optional()
522
522
  }).describe(
523
- "Cycle duration to apply `price` for.\n\nUse with all pricing models.\nCan apply the same price to multiple payment cycles."
523
+ "Coupon applied to the order, from the Coupons API."
524
524
  ).optional(),
525
- price: z.object({
526
- subtotal: z.string().describe(
527
- 'Price of the order excluding tax, specified as a monetary amount. For example, `"9.99"`.'
528
- ).optional(),
529
- coupon: z.object({
530
- code: z.string().describe("Code of the applied coupon.").min(1).max(20).optional(),
531
- amount: z.string().describe(
532
- "Total discount of the coupon, as a monetary amount."
533
- ).optional(),
534
- _id: z.string().describe("Coupon ID.").regex(
535
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
536
- "Must be a valid GUID"
537
- ).optional()
538
- }).describe(
539
- "Coupon applied to the order, from the Coupons API."
540
- ).optional(),
541
- discount: z.string().describe("Total discount applied to the order.").optional(),
542
- tax: z.object({
543
- name: z.string().describe("Name of the tax. For example, VAT.").optional(),
544
- includedInPrice: z.boolean().describe(
545
- "Whether tax is included in the original price. When `false`, tax is added at checkout."
546
- ).optional(),
547
- rate: z.string().describe(
548
- 'Tax rate percentage, as a number between 0 and 100. For example, a 7% tax rate is `"7.00"`.'
549
- ).optional(),
550
- amount: z.string().describe(
551
- 'Total tax, specified as a monetary amount. For example, `"3.99"`.'
552
- ).optional()
553
- }).describe(
554
- "Tax applied to the order.\n\nTax is only applied if the site [has it configured](https://support.wix.com/en/article/pricing-plans-setting-up-tax-collection)."
555
- ).optional(),
556
- total: z.string().describe(
557
- 'Price after tax and discount is applied. Specified as a monetary amount, for example, `"13.98"`.\n\nIf no tax is applied, the amount is the same as `subtotal`.'
525
+ discount: z.string().describe("Total discount applied to the order.").optional(),
526
+ tax: z.object({
527
+ name: z.string().describe("Name of the tax. For example, VAT.").optional(),
528
+ includedInPrice: z.boolean().describe(
529
+ "Whether tax is included in the original price. When `false`, tax is added at checkout."
558
530
  ).optional(),
559
- currency: z.string().describe(
560
- "Three-letter currency code in\n[ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format."
531
+ rate: z.string().describe(
532
+ 'Tax rate percentage, as a number between 0 and 100. For example, a 7% tax rate is `"7.00"`.'
561
533
  ).optional(),
562
- proration: z.string().describe(
563
- "Price change after billing date was change and price was adjusted. Could be positive and negative values."
534
+ amount: z.string().describe(
535
+ 'Total tax, specified as a monetary amount. For example, `"3.99"`.'
564
536
  ).optional()
565
- }).describe("Order price.").optional()
566
- })
567
- ).optional()
568
- }),
569
- z.xor([
570
- z.object({
571
- subscription: z.never().optional(),
572
- singlePaymentForDuration: z.never().optional(),
573
- singlePaymentUnlimited: z.never().optional()
574
- }),
575
- z.object({
576
- singlePaymentForDuration: z.never().optional(),
577
- singlePaymentUnlimited: z.never().optional(),
578
- subscription: z.object({
579
- cycleDuration: z.object({
580
- count: z.number().int().describe(
581
- "Number of days, months, weeks, or years in a single payment cycle. Currently limited to support only `1`."
582
- ).min(1).optional().nullable(),
583
- unit: z.enum(["UNDEFINED", "DAY", "WEEK", "MONTH", "YEAR"]).describe("Unit of time for the cycle duration.").optional()
584
537
  }).describe(
585
- "Number of payment cycles the subscription is valid for.\n`0` for unlimited plans or for plans that are valid until canceled."
538
+ "Tax applied to the order.\n\nTax is only applied if the site [has it configured](https://support.wix.com/en/article/pricing-plans-setting-up-tax-collection)."
586
539
  ).optional(),
587
- cycleCount: z.number().int().describe(
588
- "Length of a payment cycle. For example, 1 month to have monthly payments.\nMultiply `cycleDuration`'s `count` by `cycleCount` to get the subscription duration.\nCurrently, only a value of `1` is supported."
589
- ).min(0).max(2e3).optional().nullable()
590
- }).describe(
591
- "Pricing model for an order with recurring payment cycles."
592
- )
593
- }),
594
- z.object({
595
- subscription: z.never().optional(),
596
- singlePaymentUnlimited: z.never().optional(),
597
- singlePaymentForDuration: z.object({
540
+ total: z.string().describe(
541
+ 'Price after tax and discount is applied. Specified as a monetary amount, for example, `"13.98"`.\n\nIf no tax is applied, the amount is the same as `subtotal`.'
542
+ ).optional(),
543
+ currency: z.string().describe(
544
+ "Three-letter currency code in\n[ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format."
545
+ ).optional(),
546
+ proration: z.string().describe(
547
+ "Price change after billing date was change and price was adjusted. Could be positive and negative values."
548
+ ).optional()
549
+ }).describe("Order price.").optional()
550
+ })
551
+ ).optional()
552
+ }),
553
+ z.xor([
554
+ z.object({
555
+ subscription: z.never().optional(),
556
+ singlePaymentForDuration: z.never().optional(),
557
+ singlePaymentUnlimited: z.never().optional()
558
+ }),
559
+ z.object({
560
+ singlePaymentForDuration: z.never().optional(),
561
+ singlePaymentUnlimited: z.never().optional(),
562
+ subscription: z.object({
563
+ cycleDuration: z.object({
598
564
  count: z.number().int().describe(
599
565
  "Number of days, months, weeks, or years in a single payment cycle. Currently limited to support only `1`."
600
566
  ).min(1).optional().nullable(),
601
567
  unit: z.enum(["UNDEFINED", "DAY", "WEEK", "MONTH", "YEAR"]).describe("Unit of time for the cycle duration.").optional()
602
568
  }).describe(
603
- "Pricing model for an order with a one-time payment and the order is valid for a specific amount of time."
604
- )
605
- }),
606
- z.object({
607
- subscription: z.never().optional(),
608
- singlePaymentForDuration: z.never().optional(),
609
- singlePaymentUnlimited: z.boolean().describe(
610
- "Pricing model for an order with a one-time payment and the order is valid until canceled."
611
- )
612
- })
613
- ])
614
- ).describe(
615
- "Order pricing model, price, and payment schedule.\n\nLearn more about [pricing models](https://dev.wix.com/api/rest/wix-pricing-plans/pricing-plans/introduction#wix-pricing-plans_pricing-plans_introduction_pricing-models)."
616
- ).optional(),
617
- type: z.enum(["UNDEFINED", "ONLINE", "OFFLINE", "EXTERNAL"]).describe("How the order was processed.").optional(),
618
- status: z.enum([
619
- "UNDEFINED",
620
- "DRAFT",
621
- "PENDING",
622
- "ACTIVE",
623
- "PAUSED",
624
- "ENDED",
625
- "CANCELED"
626
- ]).describe("Status of the order.").optional(),
627
- autoRenewCanceled: z.boolean().describe(
628
- "Whether the order will be canceled at the next payment date.\n\nIf `true`, the order status will be `CANCELED` and the next payment won't be charged. Omitted for single payment orders."
629
- ).optional().nullable(),
630
- cancellation: z.object({
631
- requestedDate: z.date().describe("Date and time the cancellation was requested.").optional().nullable(),
632
- cause: z.enum([
633
- "UNDEFINED",
634
- "OWNER_ACTION",
635
- "MEMBER_ACTION",
636
- "PAYMENT_FAILURE",
637
- "PAYMENT_SETUP_FAILURE",
638
- "UNKNOWN"
639
- ]).describe("Reason for the cancellation.").optional(),
640
- effectiveAt: z.enum(["UNDEFINED", "IMMEDIATELY", "NEXT_PAYMENT_DATE"]).describe(
641
- "When the cancellation takes effect. Set when cancelling the order."
642
- ).optional()
643
- }).describe(
644
- "Details about the cancellation of an order.\n\nOnly present if the status is `CANCELED`."
645
- ).optional(),
646
- lastPaymentStatus: z.enum([
647
- "UNDEFINED",
648
- "PAID",
649
- "REFUNDED",
650
- "FAILED",
651
- "UNPAID",
652
- "PENDING",
653
- "NOT_APPLICABLE"
654
- ]).describe(
655
- "Status of the last payment for the order.\nUpdated automatically for online orders. Updated manually by the Wix user for offline orders."
656
- ).optional(),
657
- startDate: z.date().describe("Start date and time for the ordered plan.").optional().nullable(),
658
- endDate: z.date().describe(
659
- "Current end date and time for the ordered plan.\n\n`endDate` may be updated over the course of an order.\nIf the order is paused, it will have a later `endDate` once it is resumed.\n`endDate` may also be postponed.\n\nOmitted if the order is valid until canceled and still `ACTIVE`."
660
- ).optional().nullable(),
661
- pausePeriods: z.array(
569
+ "Number of payment cycles the subscription is valid for.\n`0` for unlimited plans or for plans that are valid until canceled."
570
+ ).optional(),
571
+ cycleCount: z.number().int().describe(
572
+ "Length of a payment cycle. For example, 1 month to have monthly payments.\nMultiply `cycleDuration`'s `count` by `cycleCount` to get the subscription duration.\nCurrently, only a value of `1` is supported."
573
+ ).min(0).max(2e3).optional().nullable()
574
+ }).describe(
575
+ "Pricing model for an order with recurring payment cycles."
576
+ )
577
+ }),
662
578
  z.object({
663
- status: z.enum(["UNDEFINED", "ACTIVE", "ENDED"]).describe("Status of the pause period.").optional(),
664
- pauseDate: z.date().describe("Start date and time of the pause period.").optional().nullable(),
665
- resumeDate: z.date().describe(
666
- "End date and time of the pause period.\n\nOmitted while the pause period remains `ACTIVE`."
667
- ).optional().nullable()
579
+ subscription: z.never().optional(),
580
+ singlePaymentUnlimited: z.never().optional(),
581
+ singlePaymentForDuration: z.object({
582
+ count: z.number().int().describe(
583
+ "Number of days, months, weeks, or years in a single payment cycle. Currently limited to support only `1`."
584
+ ).min(1).optional().nullable(),
585
+ unit: z.enum(["UNDEFINED", "DAY", "WEEK", "MONTH", "YEAR"]).describe("Unit of time for the cycle duration.").optional()
586
+ }).describe(
587
+ "Pricing model for an order with a one-time payment and the order is valid for a specific amount of time."
588
+ )
589
+ }),
590
+ z.object({
591
+ subscription: z.never().optional(),
592
+ singlePaymentForDuration: z.never().optional(),
593
+ singlePaymentUnlimited: z.boolean().describe(
594
+ "Pricing model for an order with a one-time payment and the order is valid until canceled."
595
+ )
668
596
  })
669
- ).optional(),
670
- freeTrialDays: z.number().int().describe(
671
- "Free trial period for the order, in days.\n\nOnly available for recurring plans."
672
- ).min(1).max(999).optional().nullable(),
673
- earliestEndDate: z.date().describe(
674
- "Earliest end date and time that the plan for the order can expire.\n\nCalculated by using the original end date plus any pause periods. Omitted if the order is active until canceled. Reserved for future use."
675
- ).optional().nullable(),
676
- currentCycle: z.object({
677
- index: z.number().int().describe(
678
- "Index of the current payment cycle in the order.\n\n`0` when order is in a free trial period. In all other cases, the index starts with `1`."
679
- ).min(0).optional(),
680
- startedDate: z.date().describe("Start date and time for the current payment cycle.").optional().nullable(),
681
- endedDate: z.date().describe("End date and time for the current payment cycle.").optional().nullable()
682
- }).describe(
683
- "Current payment cycle for the order.\n\n`currentCycle` will be omitted if the order's status is `CANCELED` or `ENDED`, or if the `startDate` hasn't passed yet."
684
- ).optional(),
685
- planName: z.string().describe("Plan name at the time of purchase.").optional(),
686
- planDescription: z.string().describe("Plan description at the time of purchase").optional(),
687
- planPrice: z.string().describe("Plan price as it was at the moment of order creation.").optional(),
688
- _createdDate: z.date().describe("Date and time the order was created.").optional().nullable(),
689
- _updatedDate: z.date().describe("Date and time the order was updated.").optional().nullable(),
690
- formData: z.object({
691
- formId: z.string().describe(
692
- "ID of the [order form](https://dev.wix.com/docs/rest/api-reference/wix-forms/form-submissions/introduction) associated with the plan at checkout."
693
- ).regex(
694
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
695
- "Must be a valid GUID"
696
- ).optional().nullable(),
697
- submissionId: z.string().describe(
698
- "ID of a submission to the plan's order form at checkout. Every time a visitor completes the checkout process for a plan, a new submission is created."
699
- ).regex(
700
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
701
- "Must be a valid GUID"
702
- ).optional().nullable(),
703
- submissionData: z.record(z.string(), z.any()).describe("Data submitted to the plan's order form at checkout.").optional()
704
- }).describe(
705
- "Information about the form submitted during the plan's checkout."
597
+ ])
598
+ ).describe(
599
+ "Order pricing model, price, and payment schedule.\n\nLearn more about [pricing models](https://dev.wix.com/api/rest/wix-pricing-plans/pricing-plans/introduction#wix-pricing-plans_pricing-plans_introduction_pricing-models)."
600
+ ).optional(),
601
+ type: z.enum(["UNDEFINED", "ONLINE", "OFFLINE", "EXTERNAL"]).describe("How the order was processed.").optional(),
602
+ status: z.enum([
603
+ "UNDEFINED",
604
+ "DRAFT",
605
+ "PENDING",
606
+ "ACTIVE",
607
+ "PAUSED",
608
+ "ENDED",
609
+ "CANCELED"
610
+ ]).describe("Status of the order.").optional(),
611
+ autoRenewCanceled: z.boolean().describe(
612
+ "Whether the order will be canceled at the next payment date.\n\nIf `true`, the order status will be `CANCELED` and the next payment won't be charged. Omitted for single payment orders."
613
+ ).optional().nullable(),
614
+ cancellation: z.object({
615
+ requestedDate: z.date().describe("Date and time the cancellation was requested.").optional().nullable(),
616
+ cause: z.enum([
617
+ "UNDEFINED",
618
+ "OWNER_ACTION",
619
+ "MEMBER_ACTION",
620
+ "PAYMENT_FAILURE",
621
+ "PAYMENT_SETUP_FAILURE",
622
+ "UNKNOWN"
623
+ ]).describe("Reason for the cancellation.").optional(),
624
+ effectiveAt: z.enum(["UNDEFINED", "IMMEDIATELY", "NEXT_PAYMENT_DATE"]).describe(
625
+ "When the cancellation takes effect. Set when cancelling the order."
706
626
  ).optional()
707
- })
708
- ).optional(),
709
- pagingMetadata: z.object({
710
- count: z.number().int().describe("Number of items returned in the response.").optional().nullable(),
711
- offset: z.number().int().describe("Offset that was requested.").optional().nullable(),
712
- total: z.number().int().describe(
713
- "Total number of items that match the query. Returned if offset paging is used and the `tooManyToCount` flag is not set."
627
+ }).describe(
628
+ "Details about the cancellation of an order.\n\nOnly present if the status is `CANCELED`."
629
+ ).optional(),
630
+ lastPaymentStatus: z.enum([
631
+ "UNDEFINED",
632
+ "PAID",
633
+ "REFUNDED",
634
+ "FAILED",
635
+ "UNPAID",
636
+ "PENDING",
637
+ "NOT_APPLICABLE"
638
+ ]).describe(
639
+ "Status of the last payment for the order.\nUpdated automatically for online orders. Updated manually by the Wix user for offline orders."
640
+ ).optional(),
641
+ startDate: z.date().describe("Start date and time for the ordered plan.").optional().nullable(),
642
+ endDate: z.date().describe(
643
+ "Current end date and time for the ordered plan.\n\n`endDate` may be updated over the course of an order.\nIf the order is paused, it will have a later `endDate` once it is resumed.\n`endDate` may also be postponed.\n\nOmitted if the order is valid until canceled and still `ACTIVE`."
714
644
  ).optional().nullable(),
715
- tooManyToCount: z.boolean().describe(
716
- "Flag that indicates the server failed to calculate the `total` field."
645
+ pausePeriods: z.array(
646
+ z.object({
647
+ status: z.enum(["UNDEFINED", "ACTIVE", "ENDED"]).describe("Status of the pause period.").optional(),
648
+ pauseDate: z.date().describe("Start date and time of the pause period.").optional().nullable(),
649
+ resumeDate: z.date().describe(
650
+ "End date and time of the pause period.\n\nOmitted while the pause period remains `ACTIVE`."
651
+ ).optional().nullable()
652
+ })
653
+ ).optional(),
654
+ freeTrialDays: z.number().int().describe(
655
+ "Free trial period for the order, in days.\n\nOnly available for recurring plans."
656
+ ).min(1).max(999).optional().nullable(),
657
+ earliestEndDate: z.date().describe(
658
+ "Earliest end date and time that the plan for the order can expire.\n\nCalculated by using the original end date plus any pause periods. Omitted if the order is active until canceled. Reserved for future use."
717
659
  ).optional().nullable(),
718
- cursors: z.object({
719
- next: z.string().describe(
720
- "Cursor string pointing to the next page in the list of results."
721
- ).max(16e3).optional().nullable(),
722
- prev: z.string().describe(
723
- "Cursor pointing to the previous page in the list of results."
724
- ).max(16e3).optional().nullable()
660
+ currentCycle: z.object({
661
+ index: z.number().int().describe(
662
+ "Index of the current payment cycle in the order.\n\n`0` when order is in a free trial period. In all other cases, the index starts with `1`."
663
+ ).min(0).optional(),
664
+ startedDate: z.date().describe("Start date and time for the current payment cycle.").optional().nullable(),
665
+ endedDate: z.date().describe("End date and time for the current payment cycle.").optional().nullable()
725
666
  }).describe(
726
- "Cursors to navigate through the result pages using `next` and `prev`. Returned if cursor paging is used."
667
+ "Current payment cycle for the order.\n\n`currentCycle` will be omitted if the order's status is `CANCELED` or `ENDED`, or if the `startDate` hasn't passed yet."
668
+ ).optional(),
669
+ planName: z.string().describe("Plan name at the time of purchase.").optional(),
670
+ planDescription: z.string().describe("Plan description at the time of purchase").optional(),
671
+ planPrice: z.string().describe("Plan price as it was at the moment of order creation.").optional(),
672
+ _createdDate: z.date().describe("Date and time the order was created.").optional().nullable(),
673
+ _updatedDate: z.date().describe("Date and time the order was updated.").optional().nullable(),
674
+ formData: z.object({
675
+ formId: z.string().describe(
676
+ "ID of the [order form](https://dev.wix.com/docs/rest/api-reference/wix-forms/form-submissions/introduction) associated with the plan at checkout."
677
+ ).regex(
678
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
679
+ "Must be a valid GUID"
680
+ ).optional().nullable(),
681
+ submissionId: z.string().describe(
682
+ "ID of a submission to the plan's order form at checkout. Every time a visitor completes the checkout process for a plan, a new submission is created."
683
+ ).regex(
684
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
685
+ "Must be a valid GUID"
686
+ ).optional().nullable(),
687
+ submissionData: z.record(z.string(), z.any()).describe("Data submitted to the plan's order form at checkout.").optional()
688
+ }).describe(
689
+ "Information about the form submitted during the plan's checkout."
727
690
  ).optional()
728
- }).describe(
729
- "Object containing paging-related data (number of orders returned, offset)."
730
- ).optional()
731
- });
732
- var PostponeEndDateRequest = z.object({
733
- _id: z.string().describe("Order ID.").regex(
734
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
735
- "Must be a valid GUID"
736
- ),
737
- endDate: z.date().describe(
738
- "New end date and time.\n\nMust be later than the current end date and time."
739
- )
740
- });
741
- var PostponeEndDateResponse = z.object({});
742
- var CancelOrderRequest = z.object({
743
- _id: z.string().describe("Order ID.").regex(
744
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
745
- "Must be a valid GUID"
746
- ),
747
- effectiveAt: z.enum(["UNDEFINED", "IMMEDIATELY", "NEXT_PAYMENT_DATE"])
748
- });
749
- var CancelOrderResponse = z.object({});
750
- var MarkAsPaidRequest = z.object({
751
- _id: z.string().describe("Order ID.").regex(
752
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
753
- "Must be a valid GUID"
754
- )
755
- });
756
- var MarkAsPaidResponse = z.object({});
757
- var PauseOrderRequest = z.object({
758
- _id: z.string().describe("Order ID.").regex(
759
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
760
- "Must be a valid GUID"
761
- )
762
- });
763
- var PauseOrderResponse = z.object({});
764
- var ResumeOrderRequest = z.object({
765
- _id: z.string().describe("Order ID.").regex(
766
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
767
- "Must be a valid GUID"
768
- )
691
+ }).describe("Order.").optional()
769
692
  });
770
- var ResumeOrderResponse = z.object({});
771
- var CreateOnlineOrderRequest = z.object({
693
+ var GetOnlineOrderPreviewRequest = z.object({
772
694
  planId: z.string().describe("Plan ID.").regex(
773
695
  /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
774
696
  "Must be a valid GUID"
775
697
  ),
776
698
  options: z.object({
777
699
  startDate: z.date().describe(
778
- "Start date and time for the plan of the online order in a `YYYY-MM-DDThh:mm[:ss][.sss]Z` format.\n\nDefault: Current date and time."
700
+ "Start date and time for the plan of the order preview in a `YYYY-MM-DDThh:mm[:ss][.sss]Z` format.\n\nDefault: Current date and time."
779
701
  ).optional().nullable(),
780
- couponCode: z.string().describe("Coupon code to apply.").min(1).max(20).optional().nullable(),
781
- onBehalf: z.object({
782
- memberId: z.string().describe("Member ID.").regex(
783
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
784
- "Must be a valid GUID"
785
- ),
786
- orderMethod: z.enum(["UNKNOWN", "MOTO", "POS"]).optional()
787
- }).describe("Provided if checkout is initiated on buyer's behalf.").optional(),
788
- submissionId: z.string().describe("Submission ID of the form submitted with this order.").regex(
789
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
790
- "Must be a valid GUID"
791
- ).optional().nullable()
702
+ couponCode: z.string().describe("Coupon code to apply.").min(1).max(20).optional().nullable()
792
703
  }).optional()
793
704
  });
794
- var CreateOnlineOrderResponse = z.object({
705
+ var GetOnlineOrderPreviewResponse = z.object({
795
706
  order: z.object({
796
707
  _id: z.string().describe("Order ID.").regex(
797
708
  /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
@@ -1112,30 +1023,32 @@ var CreateOnlineOrderResponse = z.object({
1112
1023
  }).describe(
1113
1024
  "Information about the form submitted during the plan's checkout."
1114
1025
  ).optional()
1115
- }).describe("Created online order.").optional()
1026
+ }).describe(
1027
+ "Order preview. This field is undefined if the member has already reached the purchase limit for the order's plan."
1028
+ ).optional(),
1029
+ purchaseLimitExceeded: z.boolean().describe(
1030
+ "Whether the member has already reached purchase limit for the order's plan."
1031
+ ).optional()
1116
1032
  });
1117
- var CreateOfflineOrderRequest = z.object({
1118
- planId: z.string().describe("ID of the plan being ordered, from the Plans API.").regex(
1033
+ var GetOfflineOrderPreviewRequest = z.object({
1034
+ planId: z.string().describe("ID of the plan of the previewed order.").regex(
1119
1035
  /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
1120
1036
  "Must be a valid GUID"
1121
1037
  ),
1122
- memberId: z.string().describe("ID of the member ordering the plan, from the Members API.").regex(
1038
+ memberId: z.string().describe(
1039
+ "Member ID of the buyer the previewed order is for, from the Members API."
1040
+ ).regex(
1123
1041
  /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
1124
1042
  "Must be a valid GUID"
1125
1043
  ),
1126
1044
  options: z.object({
1127
1045
  startDate: z.date().describe(
1128
- "Start date and time for the ordered plan in a `YYYY-MM-DDThh:mm[:ss][.sss]Z` format.\n\nDefault: Current date and time."
1046
+ "Start date and time for plan of the previewed order in a `YYYY-MM-DDThh:mm[:ss][.sss]Z` format.\n\nDefault: Current date and time."
1129
1047
  ).optional().nullable(),
1130
- paid: z.boolean().describe("Whether the order is paid.\n\nDefault: `false`").optional().nullable(),
1131
- couponCode: z.string().describe("Coupon code to apply, from the Coupons API.").min(1).max(20).optional().nullable(),
1132
- submissionId: z.string().describe("Form submission ID that was submitted with the order.").regex(
1133
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
1134
- "Must be a valid GUID"
1135
- ).optional().nullable()
1136
- }).describe("Options for creating an offline order. ").optional()
1048
+ couponCode: z.string().describe("Coupon code to apply, from the Coupons API.").min(1).max(20).optional().nullable()
1049
+ }).describe("Options for previewing the offline order. ").optional()
1137
1050
  });
1138
- var CreateOfflineOrderResponse = z.object({
1051
+ var GetOfflineOrderPreviewResponse = z.object({
1139
1052
  order: z.object({
1140
1053
  _id: z.string().describe("Order ID.").regex(
1141
1054
  /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
@@ -1456,21 +1369,166 @@ var CreateOfflineOrderResponse = z.object({
1456
1369
  }).describe(
1457
1370
  "Information about the form submitted during the plan's checkout."
1458
1371
  ).optional()
1459
- }).describe("Order.").optional()
1372
+ }).describe("The previewed order, as if the plan had been ordered.").optional(),
1373
+ purchaseLimitExceeded: z.boolean().describe(
1374
+ "Whether this previewed order would exceed the permitted amount of purchases available\nfor this plan for this buyer.\n\nAlways `false` for plans that do not have purchase limits."
1375
+ ).optional()
1460
1376
  });
1461
- var GetOnlineOrderPreviewRequest = z.object({
1462
- planId: z.string().describe("Plan ID.").regex(
1377
+ var GetPricePreviewRequest = z.object({
1378
+ planId: z.string().describe("ID of plan to preview.").regex(
1463
1379
  /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
1464
1380
  "Must be a valid GUID"
1465
1381
  ),
1466
1382
  options: z.object({
1467
- startDate: z.date().describe(
1468
- "Start date and time for the plan of the order preview in a `YYYY-MM-DDThh:mm[:ss][.sss]Z` format.\n\nDefault: Current date and time."
1469
- ).optional().nullable(),
1470
- couponCode: z.string().describe("Coupon code to apply.").min(1).max(20).optional().nullable()
1471
- }).optional()
1383
+ couponCode: z.string().describe("Coupon code to apply, from the Coupons API.").min(1).max(20).optional().nullable()
1384
+ }).describe("Options for getting a price preview. ").optional()
1472
1385
  });
1473
- var GetOnlineOrderPreviewResponse = z.object({
1386
+ var GetPricePreviewResponse = z.object({
1387
+ price: z.intersection(
1388
+ z.object({
1389
+ subtotal: z.string().describe(
1390
+ 'Price of the order excluding tax, specified as a monetary amount. for example, `"9.99"`.'
1391
+ ).optional(),
1392
+ discount: z.string().describe("Total discount applied.").optional(),
1393
+ tax: z.object({
1394
+ name: z.string().describe("Name of the tax. For example, VAT.").optional(),
1395
+ includedInPrice: z.boolean().describe(
1396
+ "Whether tax is included in the original price. When `false`, tax is added at checkout."
1397
+ ).optional(),
1398
+ rate: z.string().describe(
1399
+ 'Tax rate percentage, as a number between 0 and 100. For example, a 7% tax rate is `"7.00"`.'
1400
+ ).optional(),
1401
+ amount: z.string().describe(
1402
+ 'Total tax, specified as a monetary amount. For example, `"3.99"`.'
1403
+ ).optional()
1404
+ }).describe("Tax applied.").optional(),
1405
+ total: z.string().describe(
1406
+ 'Price after tax and discount is applied, specified as a monetary amount. For example, `"13.98"`.\n\nIf no tax is applied, the amount is the same as `subtotal`.'
1407
+ ).optional(),
1408
+ planPrice: z.string().describe("Plan price as it was at the moment of order creation.").optional(),
1409
+ currency: z.string().describe(
1410
+ "Currency code. Must be valid ISO 4217 currency code (e.g., USD)."
1411
+ ).optional(),
1412
+ freeTrialDays: z.number().int().describe(
1413
+ "Free trial period for the order in days. Only available for recurring plans."
1414
+ ).min(1).max(999).optional().nullable(),
1415
+ coupon: z.object({
1416
+ code: z.string().describe("Code of the applied coupon.").min(1).max(20).optional(),
1417
+ amount: z.string().describe("Total discount of the coupon, as a monetary amount.").optional(),
1418
+ _id: z.string().describe("Coupon ID.").regex(
1419
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
1420
+ "Must be a valid GUID"
1421
+ ).optional()
1422
+ }).describe(
1423
+ "Coupon applied to the order. Empty means no coupon was applied."
1424
+ ).optional()
1425
+ }),
1426
+ z.xor([
1427
+ z.object({
1428
+ subscription: z.never().optional(),
1429
+ singlePaymentForDuration: z.never().optional(),
1430
+ singlePaymentUnlimited: z.never().optional()
1431
+ }),
1432
+ z.object({
1433
+ singlePaymentForDuration: z.never().optional(),
1434
+ singlePaymentUnlimited: z.never().optional(),
1435
+ subscription: z.object({
1436
+ cycleDuration: z.object({
1437
+ count: z.number().int().describe(
1438
+ "Number of days, months, weeks, or years in a single payment cycle. Currently limited to support only `1`."
1439
+ ).min(1).optional().nullable(),
1440
+ unit: z.enum(["UNDEFINED", "DAY", "WEEK", "MONTH", "YEAR"]).describe("Unit of time for the cycle duration.").optional()
1441
+ }).describe(
1442
+ "Number of payment cycles the subscription is valid for.\n`0` for unlimited plans or for plans that are valid until canceled."
1443
+ ).optional(),
1444
+ cycleCount: z.number().int().describe(
1445
+ "Length of a payment cycle. For example, 1 month to have monthly payments.\nMultiply `cycleDuration`'s `count` by `cycleCount` to get the subscription duration.\nCurrently, only a value of `1` is supported."
1446
+ ).min(0).max(2e3).optional().nullable()
1447
+ }).describe("Order has recurring payments.")
1448
+ }),
1449
+ z.object({
1450
+ subscription: z.never().optional(),
1451
+ singlePaymentUnlimited: z.never().optional(),
1452
+ singlePaymentForDuration: z.object({
1453
+ count: z.number().int().describe(
1454
+ "Number of days, months, weeks, or years in a single payment cycle. Currently limited to support only `1`."
1455
+ ).min(1).optional().nullable(),
1456
+ unit: z.enum(["UNDEFINED", "DAY", "WEEK", "MONTH", "YEAR"]).describe("Unit of time for the cycle duration.").optional()
1457
+ }).describe(
1458
+ "One-time payment. Order is valid for a specified duration."
1459
+ )
1460
+ }),
1461
+ z.object({
1462
+ subscription: z.never().optional(),
1463
+ singlePaymentForDuration: z.never().optional(),
1464
+ singlePaymentUnlimited: z.boolean().describe("One-time payment. Order is valid until it is canceled.")
1465
+ })
1466
+ ])
1467
+ ).describe(
1468
+ "__Deprecated.__ Use `prices` instead. This property will be removed on September 30, 2022."
1469
+ ).optional(),
1470
+ prices: z.array(
1471
+ z.object({
1472
+ duration: z.object({
1473
+ cycleFrom: z.number().int().describe(
1474
+ "Price starts to apply with this cycle.\n\n`1` is the first payment cycle for all pricing models."
1475
+ ).optional(),
1476
+ numberOfCycles: z.number().int().describe(
1477
+ "Amount of cycles to apply price for.\n\nFor `subscription` pricing models with a finite number of cycles, the `numberOfCycles` is the same as `pricing.subscription.cycleCount`.\n\nFor `subscription` pricing models that are unlimited or until-canceled, the `numberOfCycles` is not returned.\n\nFor `singlePaymentForDuration` and `singlePaymentUnlimited` pricing models, the `numberOfCycles` is `1`."
1478
+ ).optional().nullable()
1479
+ }).describe(
1480
+ "Cycle duration to apply `price` for.\n\nUse with all pricing models.\nCan apply the same price to multiple payment cycles."
1481
+ ).optional(),
1482
+ price: z.object({
1483
+ subtotal: z.string().describe(
1484
+ 'Price of the order excluding tax, specified as a monetary amount. For example, `"9.99"`.'
1485
+ ).optional(),
1486
+ coupon: z.object({
1487
+ code: z.string().describe("Code of the applied coupon.").min(1).max(20).optional(),
1488
+ amount: z.string().describe(
1489
+ "Total discount of the coupon, as a monetary amount."
1490
+ ).optional(),
1491
+ _id: z.string().describe("Coupon ID.").regex(
1492
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
1493
+ "Must be a valid GUID"
1494
+ ).optional()
1495
+ }).describe("Coupon applied to the order, from the Coupons API.").optional(),
1496
+ discount: z.string().describe("Total discount applied to the order.").optional(),
1497
+ tax: z.object({
1498
+ name: z.string().describe("Name of the tax. For example, VAT.").optional(),
1499
+ includedInPrice: z.boolean().describe(
1500
+ "Whether tax is included in the original price. When `false`, tax is added at checkout."
1501
+ ).optional(),
1502
+ rate: z.string().describe(
1503
+ 'Tax rate percentage, as a number between 0 and 100. For example, a 7% tax rate is `"7.00"`.'
1504
+ ).optional(),
1505
+ amount: z.string().describe(
1506
+ 'Total tax, specified as a monetary amount. For example, `"3.99"`.'
1507
+ ).optional()
1508
+ }).describe(
1509
+ "Tax applied to the order.\n\nTax is only applied if the site [has it configured](https://support.wix.com/en/article/pricing-plans-setting-up-tax-collection)."
1510
+ ).optional(),
1511
+ total: z.string().describe(
1512
+ 'Price after tax and discount is applied. Specified as a monetary amount, for example, `"13.98"`.\n\nIf no tax is applied, the amount is the same as `subtotal`.'
1513
+ ).optional(),
1514
+ currency: z.string().describe(
1515
+ "Three-letter currency code in\n[ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format."
1516
+ ).optional(),
1517
+ proration: z.string().describe(
1518
+ "Price change after billing date was change and price was adjusted. Could be positive and negative values."
1519
+ ).optional()
1520
+ }).describe("Order price.").optional()
1521
+ })
1522
+ ).optional()
1523
+ });
1524
+ var ManagementGetOrderRequest = z.object({
1525
+ _id: z.string().describe("Order ID.").regex(
1526
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
1527
+ "Must be a valid GUID"
1528
+ ),
1529
+ options: z.object({ fieldSet: z.enum(["UNKNOWN_SET", "BASIC", "FULL"]).optional() }).describe("Options to use when getting an order. ").optional()
1530
+ });
1531
+ var ManagementGetOrderResponse = z.object({
1474
1532
  order: z.object({
1475
1533
  _id: z.string().describe("Order ID.").regex(
1476
1534
  /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
@@ -1791,504 +1849,446 @@ var GetOnlineOrderPreviewResponse = z.object({
1791
1849
  }).describe(
1792
1850
  "Information about the form submitted during the plan's checkout."
1793
1851
  ).optional()
1794
- }).describe(
1795
- "Order preview. This field is undefined if the member has already reached the purchase limit for the order's plan."
1796
- ).optional(),
1797
- purchaseLimitExceeded: z.boolean().describe(
1798
- "Whether the member has already reached purchase limit for the order's plan."
1799
- ).optional()
1852
+ }).describe("Order.").optional()
1800
1853
  });
1801
- var GetOfflineOrderPreviewRequest = z.object({
1802
- planId: z.string().describe("ID of the plan of the previewed order.").regex(
1803
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
1804
- "Must be a valid GUID"
1805
- ),
1806
- memberId: z.string().describe(
1807
- "Member ID of the buyer the previewed order is for, from the Members API."
1808
- ).regex(
1809
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
1810
- "Must be a valid GUID"
1811
- ),
1854
+ var ManagementListOrdersRequest = z.object({
1812
1855
  options: z.object({
1813
- startDate: z.date().describe(
1814
- "Start date and time for plan of the previewed order in a `YYYY-MM-DDThh:mm[:ss][.sss]Z` format.\n\nDefault: Current date and time."
1856
+ buyerIds: z.array(z.string()).optional(),
1857
+ planIds: z.array(z.string()).optional(),
1858
+ autoRenewCanceled: z.boolean().describe(
1859
+ "Filter by whether or not the auto-renewal of recurring orders was canceled."
1815
1860
  ).optional().nullable(),
1816
- couponCode: z.string().describe("Coupon code to apply, from the Coupons API.").min(1).max(20).optional().nullable()
1817
- }).describe("Options for previewing the offline order. ").optional()
1818
- });
1819
- var GetOfflineOrderPreviewResponse = z.object({
1820
- order: z.object({
1821
- _id: z.string().describe("Order ID.").regex(
1822
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
1823
- "Must be a valid GUID"
1861
+ orderStatuses: z.array(
1862
+ z.enum([
1863
+ "UNDEFINED",
1864
+ "DRAFT",
1865
+ "PENDING",
1866
+ "ACTIVE",
1867
+ "PAUSED",
1868
+ "ENDED",
1869
+ "CANCELED"
1870
+ ])
1824
1871
  ).optional(),
1825
- planId: z.string().describe(
1826
- "ID of the plan purchased with the order, from the Plans API."
1827
- ).regex(
1828
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
1829
- "Must be a valid GUID"
1872
+ paymentStatuses: z.array(
1873
+ z.enum([
1874
+ "UNDEFINED",
1875
+ "PAID",
1876
+ "REFUNDED",
1877
+ "FAILED",
1878
+ "UNPAID",
1879
+ "PENDING",
1880
+ "NOT_APPLICABLE"
1881
+ ])
1830
1882
  ).optional(),
1831
- subscriptionId: z.string().describe(
1832
- "ID of the related Wix subscription.\n\nEvery pricing plan order corresponds to a Wix subscription, including orders for single payment plans. Learn more in\na [Pricing Plans overview](https://support.wix.com/en/article/pricing-plans-an-overview#create-plans-to-suit-your-business)."
1833
- ).regex(
1834
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
1835
- "Must be a valid GUID"
1883
+ limit: z.number().int().describe(
1884
+ "Number of orders to return. See Sorting and Paging for more information.\n\nMax: `50`"
1885
+ ).min(1).max(50).optional().nullable(),
1886
+ offset: z.number().int().describe("Number of orders to skip in the current sort order.").min(0).optional().nullable(),
1887
+ sorting: z.object({
1888
+ fieldName: z.string().describe("Name of the field to sort by.").max(512).optional(),
1889
+ order: z.enum(["ASC", "DESC"]).optional(),
1890
+ origin: z.object({
1891
+ latitude: z.number().describe("Address latitude.").optional().nullable(),
1892
+ longitude: z.number().describe("Address longitude.").optional().nullable()
1893
+ }).describe(
1894
+ "Origin point for geo-distance sorting on a GEO field\nresults are ordered by distance from this point (ASC = nearest first, DESC = farthest first)."
1895
+ ).optional()
1896
+ }).describe(
1897
+ "Sort order.\n\nUse `ASC` for ascending order or `DESC` for descending order.\n\nDefault: `DESC`."
1836
1898
  ).optional(),
1837
- wixPayOrderId: z.string().describe(
1838
- "Wix Pay order ID.\n\nProvided by Wix whether the order is created online or offline. The field is omitted when the order is free."
1839
- ).regex(
1840
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
1841
- "Must be a valid GUID"
1842
- ).optional().nullable(),
1843
- buyer: z.object({
1844
- memberId: z.string().describe("Member ID for a Wix site member, from the Members API.").regex(
1899
+ fieldSet: z.enum(["UNKNOWN_SET", "BASIC", "FULL"]).optional()
1900
+ }).describe("Filtering, sorting, and pagination options. ").optional()
1901
+ });
1902
+ var ManagementListOrdersResponse = z.object({
1903
+ orders: z.array(
1904
+ z.object({
1905
+ _id: z.string().describe("Order ID.").regex(
1845
1906
  /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
1846
1907
  "Must be a valid GUID"
1847
1908
  ).optional(),
1848
- contactId: z.string().describe(
1849
- "Contact ID for a Wix site contact, from the Contacts API."
1909
+ planId: z.string().describe(
1910
+ "ID of the plan purchased with the order, from the Plans API."
1850
1911
  ).regex(
1851
1912
  /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
1852
1913
  "Must be a valid GUID"
1853
- ).optional()
1854
- }).describe(
1855
- "The buyer's IDs. Includes `memberId` and `contactId`.\n\nCurrently, Pricing Plan purchases are limited to members only. `contactId` is returned,\nbut a buyer will not be able to purchase a plan without a `memberId`."
1856
- ).optional(),
1857
- priceDetails: z.intersection(
1858
- z.object({
1859
- subtotal: z.string().describe(
1860
- 'Price of the order excluding tax, specified as a monetary amount. for example, `"9.99"`.'
1914
+ ).optional(),
1915
+ subscriptionId: z.string().describe(
1916
+ "ID of the related Wix subscription.\n\nEvery pricing plan order corresponds to a Wix subscription, including orders for single payment plans. Learn more in\na [Pricing Plans overview](https://support.wix.com/en/article/pricing-plans-an-overview#create-plans-to-suit-your-business)."
1917
+ ).regex(
1918
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
1919
+ "Must be a valid GUID"
1920
+ ).optional(),
1921
+ wixPayOrderId: z.string().describe(
1922
+ "Wix Pay order ID.\n\nProvided by Wix whether the order is created online or offline. The field is omitted when the order is free."
1923
+ ).regex(
1924
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
1925
+ "Must be a valid GUID"
1926
+ ).optional().nullable(),
1927
+ buyer: z.object({
1928
+ memberId: z.string().describe(
1929
+ "Member ID for a Wix site member, from the Members API."
1930
+ ).regex(
1931
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
1932
+ "Must be a valid GUID"
1861
1933
  ).optional(),
1862
- discount: z.string().describe("Total discount applied.").optional(),
1863
- tax: z.object({
1864
- name: z.string().describe("Name of the tax. For example, VAT.").optional(),
1865
- includedInPrice: z.boolean().describe(
1866
- "Whether tax is included in the original price. When `false`, tax is added at checkout."
1934
+ contactId: z.string().describe(
1935
+ "Contact ID for a Wix site contact, from the Contacts API."
1936
+ ).regex(
1937
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
1938
+ "Must be a valid GUID"
1939
+ ).optional()
1940
+ }).describe(
1941
+ "The buyer's IDs. Includes `memberId` and `contactId`.\n\nCurrently, Pricing Plan purchases are limited to members only. `contactId` is returned,\nbut a buyer will not be able to purchase a plan without a `memberId`."
1942
+ ).optional(),
1943
+ priceDetails: z.intersection(
1944
+ z.object({
1945
+ subtotal: z.string().describe(
1946
+ 'Price of the order excluding tax, specified as a monetary amount. for example, `"9.99"`.'
1867
1947
  ).optional(),
1868
- rate: z.string().describe(
1869
- 'Tax rate percentage, as a number between 0 and 100. For example, a 7% tax rate is `"7.00"`.'
1948
+ discount: z.string().describe("Total discount applied.").optional(),
1949
+ tax: z.object({
1950
+ name: z.string().describe("Name of the tax. For example, VAT.").optional(),
1951
+ includedInPrice: z.boolean().describe(
1952
+ "Whether tax is included in the original price. When `false`, tax is added at checkout."
1953
+ ).optional(),
1954
+ rate: z.string().describe(
1955
+ 'Tax rate percentage, as a number between 0 and 100. For example, a 7% tax rate is `"7.00"`.'
1956
+ ).optional(),
1957
+ amount: z.string().describe(
1958
+ 'Total tax, specified as a monetary amount. For example, `"3.99"`.'
1959
+ ).optional()
1960
+ }).describe("Tax applied.").optional(),
1961
+ total: z.string().describe(
1962
+ 'Price after tax and discount is applied, specified as a monetary amount. For example, `"13.98"`.\n\nIf no tax is applied, the amount is the same as `subtotal`.'
1870
1963
  ).optional(),
1871
- amount: z.string().describe(
1872
- 'Total tax, specified as a monetary amount. For example, `"3.99"`.'
1873
- ).optional()
1874
- }).describe("Tax applied.").optional(),
1875
- total: z.string().describe(
1876
- 'Price after tax and discount is applied, specified as a monetary amount. For example, `"13.98"`.\n\nIf no tax is applied, the amount is the same as `subtotal`.'
1877
- ).optional(),
1878
- planPrice: z.string().describe("Plan price as it was at the moment of order creation.").optional(),
1879
- currency: z.string().describe(
1880
- "Currency code. Must be valid ISO 4217 currency code (e.g., USD)."
1881
- ).optional(),
1882
- freeTrialDays: z.number().int().describe(
1883
- "Free trial period for the order in days. Only available for recurring plans."
1884
- ).min(1).max(999).optional().nullable(),
1885
- coupon: z.object({
1886
- code: z.string().describe("Code of the applied coupon.").min(1).max(20).optional(),
1887
- amount: z.string().describe(
1888
- "Total discount of the coupon, as a monetary amount."
1964
+ planPrice: z.string().describe(
1965
+ "Plan price as it was at the moment of order creation."
1889
1966
  ).optional(),
1890
- _id: z.string().describe("Coupon ID.").regex(
1891
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
1892
- "Must be a valid GUID"
1967
+ currency: z.string().describe(
1968
+ "Currency code. Must be valid ISO 4217 currency code (e.g., USD)."
1969
+ ).optional(),
1970
+ freeTrialDays: z.number().int().describe(
1971
+ "Free trial period for the order in days. Only available for recurring plans."
1972
+ ).min(1).max(999).optional().nullable(),
1973
+ coupon: z.object({
1974
+ code: z.string().describe("Code of the applied coupon.").min(1).max(20).optional(),
1975
+ amount: z.string().describe(
1976
+ "Total discount of the coupon, as a monetary amount."
1977
+ ).optional(),
1978
+ _id: z.string().describe("Coupon ID.").regex(
1979
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
1980
+ "Must be a valid GUID"
1981
+ ).optional()
1982
+ }).describe(
1983
+ "Coupon applied to the order. Empty means no coupon was applied."
1893
1984
  ).optional()
1894
- }).describe(
1895
- "Coupon applied to the order. Empty means no coupon was applied."
1896
- ).optional()
1897
- }),
1898
- z.xor([
1899
- z.object({
1900
- subscription: z.never().optional(),
1901
- singlePaymentForDuration: z.never().optional(),
1902
- singlePaymentUnlimited: z.never().optional()
1903
1985
  }),
1904
- z.object({
1905
- singlePaymentForDuration: z.never().optional(),
1906
- singlePaymentUnlimited: z.never().optional(),
1907
- subscription: z.object({
1908
- cycleDuration: z.object({
1986
+ z.xor([
1987
+ z.object({
1988
+ subscription: z.never().optional(),
1989
+ singlePaymentForDuration: z.never().optional(),
1990
+ singlePaymentUnlimited: z.never().optional()
1991
+ }),
1992
+ z.object({
1993
+ singlePaymentForDuration: z.never().optional(),
1994
+ singlePaymentUnlimited: z.never().optional(),
1995
+ subscription: z.object({
1996
+ cycleDuration: z.object({
1997
+ count: z.number().int().describe(
1998
+ "Number of days, months, weeks, or years in a single payment cycle. Currently limited to support only `1`."
1999
+ ).min(1).optional().nullable(),
2000
+ unit: z.enum(["UNDEFINED", "DAY", "WEEK", "MONTH", "YEAR"]).describe("Unit of time for the cycle duration.").optional()
2001
+ }).describe(
2002
+ "Number of payment cycles the subscription is valid for.\n`0` for unlimited plans or for plans that are valid until canceled."
2003
+ ).optional(),
2004
+ cycleCount: z.number().int().describe(
2005
+ "Length of a payment cycle. For example, 1 month to have monthly payments.\nMultiply `cycleDuration`'s `count` by `cycleCount` to get the subscription duration.\nCurrently, only a value of `1` is supported."
2006
+ ).min(0).max(2e3).optional().nullable()
2007
+ }).describe("Order has recurring payments.")
2008
+ }),
2009
+ z.object({
2010
+ subscription: z.never().optional(),
2011
+ singlePaymentUnlimited: z.never().optional(),
2012
+ singlePaymentForDuration: z.object({
1909
2013
  count: z.number().int().describe(
1910
2014
  "Number of days, months, weeks, or years in a single payment cycle. Currently limited to support only `1`."
1911
2015
  ).min(1).optional().nullable(),
1912
2016
  unit: z.enum(["UNDEFINED", "DAY", "WEEK", "MONTH", "YEAR"]).describe("Unit of time for the cycle duration.").optional()
1913
2017
  }).describe(
1914
- "Number of payment cycles the subscription is valid for.\n`0` for unlimited plans or for plans that are valid until canceled."
1915
- ).optional(),
1916
- cycleCount: z.number().int().describe(
1917
- "Length of a payment cycle. For example, 1 month to have monthly payments.\nMultiply `cycleDuration`'s `count` by `cycleCount` to get the subscription duration.\nCurrently, only a value of `1` is supported."
1918
- ).min(0).max(2e3).optional().nullable()
1919
- }).describe("Order has recurring payments.")
1920
- }),
1921
- z.object({
1922
- subscription: z.never().optional(),
1923
- singlePaymentUnlimited: z.never().optional(),
1924
- singlePaymentForDuration: z.object({
1925
- count: z.number().int().describe(
1926
- "Number of days, months, weeks, or years in a single payment cycle. Currently limited to support only `1`."
1927
- ).min(1).optional().nullable(),
1928
- unit: z.enum(["UNDEFINED", "DAY", "WEEK", "MONTH", "YEAR"]).describe("Unit of time for the cycle duration.").optional()
1929
- }).describe(
1930
- "One-time payment. Order is valid for a specified duration."
1931
- )
1932
- }),
1933
- z.object({
1934
- subscription: z.never().optional(),
1935
- singlePaymentForDuration: z.never().optional(),
1936
- singlePaymentUnlimited: z.boolean().describe(
1937
- "One-time payment. Order is valid until it is canceled."
1938
- )
1939
- })
1940
- ])
1941
- ).describe(
1942
- "__Deprecated.__ Use `pricing` instead. This property will be removed on September 30, 2022."
1943
- ).optional(),
1944
- pricing: z.intersection(
1945
- z.object({
1946
- prices: z.array(
2018
+ "One-time payment. Order is valid for a specified duration."
2019
+ )
2020
+ }),
1947
2021
  z.object({
1948
- duration: z.object({
1949
- cycleFrom: z.number().int().describe(
1950
- "Price starts to apply with this cycle.\n\n`1` is the first payment cycle for all pricing models."
1951
- ).optional(),
1952
- numberOfCycles: z.number().int().describe(
1953
- "Amount of cycles to apply price for.\n\nFor `subscription` pricing models with a finite number of cycles, the `numberOfCycles` is the same as `pricing.subscription.cycleCount`.\n\nFor `subscription` pricing models that are unlimited or until-canceled, the `numberOfCycles` is not returned.\n\nFor `singlePaymentForDuration` and `singlePaymentUnlimited` pricing models, the `numberOfCycles` is `1`."
1954
- ).optional().nullable()
1955
- }).describe(
1956
- "Cycle duration to apply `price` for.\n\nUse with all pricing models.\nCan apply the same price to multiple payment cycles."
1957
- ).optional(),
1958
- price: z.object({
1959
- subtotal: z.string().describe(
1960
- 'Price of the order excluding tax, specified as a monetary amount. For example, `"9.99"`.'
1961
- ).optional(),
1962
- coupon: z.object({
1963
- code: z.string().describe("Code of the applied coupon.").min(1).max(20).optional(),
1964
- amount: z.string().describe(
1965
- "Total discount of the coupon, as a monetary amount."
2022
+ subscription: z.never().optional(),
2023
+ singlePaymentForDuration: z.never().optional(),
2024
+ singlePaymentUnlimited: z.boolean().describe(
2025
+ "One-time payment. Order is valid until it is canceled."
2026
+ )
2027
+ })
2028
+ ])
2029
+ ).describe(
2030
+ "__Deprecated.__ Use `pricing` instead. This property will be removed on September 30, 2022."
2031
+ ).optional(),
2032
+ pricing: z.intersection(
2033
+ z.object({
2034
+ prices: z.array(
2035
+ z.object({
2036
+ duration: z.object({
2037
+ cycleFrom: z.number().int().describe(
2038
+ "Price starts to apply with this cycle.\n\n`1` is the first payment cycle for all pricing models."
1966
2039
  ).optional(),
1967
- _id: z.string().describe("Coupon ID.").regex(
1968
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
1969
- "Must be a valid GUID"
1970
- ).optional()
2040
+ numberOfCycles: z.number().int().describe(
2041
+ "Amount of cycles to apply price for.\n\nFor `subscription` pricing models with a finite number of cycles, the `numberOfCycles` is the same as `pricing.subscription.cycleCount`.\n\nFor `subscription` pricing models that are unlimited or until-canceled, the `numberOfCycles` is not returned.\n\nFor `singlePaymentForDuration` and `singlePaymentUnlimited` pricing models, the `numberOfCycles` is `1`."
2042
+ ).optional().nullable()
1971
2043
  }).describe(
1972
- "Coupon applied to the order, from the Coupons API."
2044
+ "Cycle duration to apply `price` for.\n\nUse with all pricing models.\nCan apply the same price to multiple payment cycles."
1973
2045
  ).optional(),
1974
- discount: z.string().describe("Total discount applied to the order.").optional(),
1975
- tax: z.object({
1976
- name: z.string().describe("Name of the tax. For example, VAT.").optional(),
1977
- includedInPrice: z.boolean().describe(
1978
- "Whether tax is included in the original price. When `false`, tax is added at checkout."
2046
+ price: z.object({
2047
+ subtotal: z.string().describe(
2048
+ 'Price of the order excluding tax, specified as a monetary amount. For example, `"9.99"`.'
1979
2049
  ).optional(),
1980
- rate: z.string().describe(
1981
- 'Tax rate percentage, as a number between 0 and 100. For example, a 7% tax rate is `"7.00"`.'
2050
+ coupon: z.object({
2051
+ code: z.string().describe("Code of the applied coupon.").min(1).max(20).optional(),
2052
+ amount: z.string().describe(
2053
+ "Total discount of the coupon, as a monetary amount."
2054
+ ).optional(),
2055
+ _id: z.string().describe("Coupon ID.").regex(
2056
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
2057
+ "Must be a valid GUID"
2058
+ ).optional()
2059
+ }).describe(
2060
+ "Coupon applied to the order, from the Coupons API."
1982
2061
  ).optional(),
1983
- amount: z.string().describe(
1984
- 'Total tax, specified as a monetary amount. For example, `"3.99"`.'
1985
- ).optional()
1986
- }).describe(
1987
- "Tax applied to the order.\n\nTax is only applied if the site [has it configured](https://support.wix.com/en/article/pricing-plans-setting-up-tax-collection)."
1988
- ).optional(),
1989
- total: z.string().describe(
1990
- 'Price after tax and discount is applied. Specified as a monetary amount, for example, `"13.98"`.\n\nIf no tax is applied, the amount is the same as `subtotal`.'
1991
- ).optional(),
1992
- currency: z.string().describe(
1993
- "Three-letter currency code in\n[ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format."
1994
- ).optional(),
1995
- proration: z.string().describe(
1996
- "Price change after billing date was change and price was adjusted. Could be positive and negative values."
1997
- ).optional()
1998
- }).describe("Order price.").optional()
1999
- })
2000
- ).optional()
2001
- }),
2002
- z.xor([
2003
- z.object({
2004
- subscription: z.never().optional(),
2005
- singlePaymentForDuration: z.never().optional(),
2006
- singlePaymentUnlimited: z.never().optional()
2062
+ discount: z.string().describe("Total discount applied to the order.").optional(),
2063
+ tax: z.object({
2064
+ name: z.string().describe("Name of the tax. For example, VAT.").optional(),
2065
+ includedInPrice: z.boolean().describe(
2066
+ "Whether tax is included in the original price. When `false`, tax is added at checkout."
2067
+ ).optional(),
2068
+ rate: z.string().describe(
2069
+ 'Tax rate percentage, as a number between 0 and 100. For example, a 7% tax rate is `"7.00"`.'
2070
+ ).optional(),
2071
+ amount: z.string().describe(
2072
+ 'Total tax, specified as a monetary amount. For example, `"3.99"`.'
2073
+ ).optional()
2074
+ }).describe(
2075
+ "Tax applied to the order.\n\nTax is only applied if the site [has it configured](https://support.wix.com/en/article/pricing-plans-setting-up-tax-collection)."
2076
+ ).optional(),
2077
+ total: z.string().describe(
2078
+ 'Price after tax and discount is applied. Specified as a monetary amount, for example, `"13.98"`.\n\nIf no tax is applied, the amount is the same as `subtotal`.'
2079
+ ).optional(),
2080
+ currency: z.string().describe(
2081
+ "Three-letter currency code in\n[ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format."
2082
+ ).optional(),
2083
+ proration: z.string().describe(
2084
+ "Price change after billing date was change and price was adjusted. Could be positive and negative values."
2085
+ ).optional()
2086
+ }).describe("Order price.").optional()
2087
+ })
2088
+ ).optional()
2007
2089
  }),
2008
- z.object({
2009
- singlePaymentForDuration: z.never().optional(),
2010
- singlePaymentUnlimited: z.never().optional(),
2011
- subscription: z.object({
2012
- cycleDuration: z.object({
2090
+ z.xor([
2091
+ z.object({
2092
+ subscription: z.never().optional(),
2093
+ singlePaymentForDuration: z.never().optional(),
2094
+ singlePaymentUnlimited: z.never().optional()
2095
+ }),
2096
+ z.object({
2097
+ singlePaymentForDuration: z.never().optional(),
2098
+ singlePaymentUnlimited: z.never().optional(),
2099
+ subscription: z.object({
2100
+ cycleDuration: z.object({
2101
+ count: z.number().int().describe(
2102
+ "Number of days, months, weeks, or years in a single payment cycle. Currently limited to support only `1`."
2103
+ ).min(1).optional().nullable(),
2104
+ unit: z.enum(["UNDEFINED", "DAY", "WEEK", "MONTH", "YEAR"]).describe("Unit of time for the cycle duration.").optional()
2105
+ }).describe(
2106
+ "Number of payment cycles the subscription is valid for.\n`0` for unlimited plans or for plans that are valid until canceled."
2107
+ ).optional(),
2108
+ cycleCount: z.number().int().describe(
2109
+ "Length of a payment cycle. For example, 1 month to have monthly payments.\nMultiply `cycleDuration`'s `count` by `cycleCount` to get the subscription duration.\nCurrently, only a value of `1` is supported."
2110
+ ).min(0).max(2e3).optional().nullable()
2111
+ }).describe(
2112
+ "Pricing model for an order with recurring payment cycles."
2113
+ )
2114
+ }),
2115
+ z.object({
2116
+ subscription: z.never().optional(),
2117
+ singlePaymentUnlimited: z.never().optional(),
2118
+ singlePaymentForDuration: z.object({
2013
2119
  count: z.number().int().describe(
2014
2120
  "Number of days, months, weeks, or years in a single payment cycle. Currently limited to support only `1`."
2015
2121
  ).min(1).optional().nullable(),
2016
2122
  unit: z.enum(["UNDEFINED", "DAY", "WEEK", "MONTH", "YEAR"]).describe("Unit of time for the cycle duration.").optional()
2017
2123
  }).describe(
2018
- "Number of payment cycles the subscription is valid for.\n`0` for unlimited plans or for plans that are valid until canceled."
2019
- ).optional(),
2020
- cycleCount: z.number().int().describe(
2021
- "Length of a payment cycle. For example, 1 month to have monthly payments.\nMultiply `cycleDuration`'s `count` by `cycleCount` to get the subscription duration.\nCurrently, only a value of `1` is supported."
2022
- ).min(0).max(2e3).optional().nullable()
2023
- }).describe(
2024
- "Pricing model for an order with recurring payment cycles."
2025
- )
2026
- }),
2027
- z.object({
2028
- subscription: z.never().optional(),
2029
- singlePaymentUnlimited: z.never().optional(),
2030
- singlePaymentForDuration: z.object({
2031
- count: z.number().int().describe(
2032
- "Number of days, months, weeks, or years in a single payment cycle. Currently limited to support only `1`."
2033
- ).min(1).optional().nullable(),
2034
- unit: z.enum(["UNDEFINED", "DAY", "WEEK", "MONTH", "YEAR"]).describe("Unit of time for the cycle duration.").optional()
2035
- }).describe(
2036
- "Pricing model for an order with a one-time payment and the order is valid for a specific amount of time."
2037
- )
2038
- }),
2039
- z.object({
2040
- subscription: z.never().optional(),
2041
- singlePaymentForDuration: z.never().optional(),
2042
- singlePaymentUnlimited: z.boolean().describe(
2043
- "Pricing model for an order with a one-time payment and the order is valid until canceled."
2044
- )
2045
- })
2046
- ])
2047
- ).describe(
2048
- "Order pricing model, price, and payment schedule.\n\nLearn more about [pricing models](https://dev.wix.com/api/rest/wix-pricing-plans/pricing-plans/introduction#wix-pricing-plans_pricing-plans_introduction_pricing-models)."
2049
- ).optional(),
2050
- type: z.enum(["UNDEFINED", "ONLINE", "OFFLINE", "EXTERNAL"]).describe("How the order was processed.").optional(),
2051
- status: z.enum([
2052
- "UNDEFINED",
2053
- "DRAFT",
2054
- "PENDING",
2055
- "ACTIVE",
2056
- "PAUSED",
2057
- "ENDED",
2058
- "CANCELED"
2059
- ]).describe("Status of the order.").optional(),
2060
- autoRenewCanceled: z.boolean().describe(
2061
- "Whether the order will be canceled at the next payment date.\n\nIf `true`, the order status will be `CANCELED` and the next payment won't be charged. Omitted for single payment orders."
2062
- ).optional().nullable(),
2063
- cancellation: z.object({
2064
- requestedDate: z.date().describe("Date and time the cancellation was requested.").optional().nullable(),
2065
- cause: z.enum([
2124
+ "Pricing model for an order with a one-time payment and the order is valid for a specific amount of time."
2125
+ )
2126
+ }),
2127
+ z.object({
2128
+ subscription: z.never().optional(),
2129
+ singlePaymentForDuration: z.never().optional(),
2130
+ singlePaymentUnlimited: z.boolean().describe(
2131
+ "Pricing model for an order with a one-time payment and the order is valid until canceled."
2132
+ )
2133
+ })
2134
+ ])
2135
+ ).describe(
2136
+ "Order pricing model, price, and payment schedule.\n\nLearn more about [pricing models](https://dev.wix.com/api/rest/wix-pricing-plans/pricing-plans/introduction#wix-pricing-plans_pricing-plans_introduction_pricing-models)."
2137
+ ).optional(),
2138
+ type: z.enum(["UNDEFINED", "ONLINE", "OFFLINE", "EXTERNAL"]).describe("How the order was processed.").optional(),
2139
+ status: z.enum([
2066
2140
  "UNDEFINED",
2067
- "OWNER_ACTION",
2068
- "MEMBER_ACTION",
2069
- "PAYMENT_FAILURE",
2070
- "PAYMENT_SETUP_FAILURE",
2071
- "UNKNOWN"
2072
- ]).describe("Reason for the cancellation.").optional(),
2073
- effectiveAt: z.enum(["UNDEFINED", "IMMEDIATELY", "NEXT_PAYMENT_DATE"]).describe(
2074
- "When the cancellation takes effect. Set when cancelling the order."
2075
- ).optional()
2076
- }).describe(
2077
- "Details about the cancellation of an order.\n\nOnly present if the status is `CANCELED`."
2078
- ).optional(),
2079
- lastPaymentStatus: z.enum([
2080
- "UNDEFINED",
2081
- "PAID",
2082
- "REFUNDED",
2083
- "FAILED",
2084
- "UNPAID",
2085
- "PENDING",
2086
- "NOT_APPLICABLE"
2087
- ]).describe(
2088
- "Status of the last payment for the order.\nUpdated automatically for online orders. Updated manually by the Wix user for offline orders."
2089
- ).optional(),
2090
- startDate: z.date().describe("Start date and time for the ordered plan.").optional().nullable(),
2091
- endDate: z.date().describe(
2092
- "Current end date and time for the ordered plan.\n\n`endDate` may be updated over the course of an order.\nIf the order is paused, it will have a later `endDate` once it is resumed.\n`endDate` may also be postponed.\n\nOmitted if the order is valid until canceled and still `ACTIVE`."
2093
- ).optional().nullable(),
2094
- pausePeriods: z.array(
2095
- z.object({
2096
- status: z.enum(["UNDEFINED", "ACTIVE", "ENDED"]).describe("Status of the pause period.").optional(),
2097
- pauseDate: z.date().describe("Start date and time of the pause period.").optional().nullable(),
2098
- resumeDate: z.date().describe(
2099
- "End date and time of the pause period.\n\nOmitted while the pause period remains `ACTIVE`."
2100
- ).optional().nullable()
2101
- })
2102
- ).optional(),
2103
- freeTrialDays: z.number().int().describe(
2104
- "Free trial period for the order, in days.\n\nOnly available for recurring plans."
2105
- ).min(1).max(999).optional().nullable(),
2106
- earliestEndDate: z.date().describe(
2107
- "Earliest end date and time that the plan for the order can expire.\n\nCalculated by using the original end date plus any pause periods. Omitted if the order is active until canceled. Reserved for future use."
2108
- ).optional().nullable(),
2109
- currentCycle: z.object({
2110
- index: z.number().int().describe(
2111
- "Index of the current payment cycle in the order.\n\n`0` when order is in a free trial period. In all other cases, the index starts with `1`."
2112
- ).min(0).optional(),
2113
- startedDate: z.date().describe("Start date and time for the current payment cycle.").optional().nullable(),
2114
- endedDate: z.date().describe("End date and time for the current payment cycle.").optional().nullable()
2115
- }).describe(
2116
- "Current payment cycle for the order.\n\n`currentCycle` will be omitted if the order's status is `CANCELED` or `ENDED`, or if the `startDate` hasn't passed yet."
2117
- ).optional(),
2118
- planName: z.string().describe("Plan name at the time of purchase.").optional(),
2119
- planDescription: z.string().describe("Plan description at the time of purchase").optional(),
2120
- planPrice: z.string().describe("Plan price as it was at the moment of order creation.").optional(),
2121
- _createdDate: z.date().describe("Date and time the order was created.").optional().nullable(),
2122
- _updatedDate: z.date().describe("Date and time the order was updated.").optional().nullable(),
2123
- formData: z.object({
2124
- formId: z.string().describe(
2125
- "ID of the [order form](https://dev.wix.com/docs/rest/api-reference/wix-forms/form-submissions/introduction) associated with the plan at checkout."
2126
- ).regex(
2127
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
2128
- "Must be a valid GUID"
2129
- ).optional().nullable(),
2130
- submissionId: z.string().describe(
2131
- "ID of a submission to the plan's order form at checkout. Every time a visitor completes the checkout process for a plan, a new submission is created."
2132
- ).regex(
2133
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
2134
- "Must be a valid GUID"
2141
+ "DRAFT",
2142
+ "PENDING",
2143
+ "ACTIVE",
2144
+ "PAUSED",
2145
+ "ENDED",
2146
+ "CANCELED"
2147
+ ]).describe("Status of the order.").optional(),
2148
+ autoRenewCanceled: z.boolean().describe(
2149
+ "Whether the order will be canceled at the next payment date.\n\nIf `true`, the order status will be `CANCELED` and the next payment won't be charged. Omitted for single payment orders."
2135
2150
  ).optional().nullable(),
2136
- submissionData: z.record(z.string(), z.any()).describe("Data submitted to the plan's order form at checkout.").optional()
2137
- }).describe(
2138
- "Information about the form submitted during the plan's checkout."
2139
- ).optional()
2140
- }).describe("The previewed order, as if the plan had been ordered.").optional(),
2141
- purchaseLimitExceeded: z.boolean().describe(
2142
- "Whether this previewed order would exceed the permitted amount of purchases available\nfor this plan for this buyer.\n\nAlways `false` for plans that do not have purchase limits."
2143
- ).optional()
2144
- });
2145
- var GetPricePreviewRequest = z.object({
2146
- planId: z.string().describe("ID of plan to preview.").regex(
2147
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
2148
- "Must be a valid GUID"
2149
- ),
2150
- options: z.object({
2151
- couponCode: z.string().describe("Coupon code to apply, from the Coupons API.").min(1).max(20).optional().nullable()
2152
- }).describe("Options for getting a price preview. ").optional()
2153
- });
2154
- var GetPricePreviewResponse = z.object({
2155
- price: z.intersection(
2156
- z.object({
2157
- subtotal: z.string().describe(
2158
- 'Price of the order excluding tax, specified as a monetary amount. for example, `"9.99"`.'
2159
- ).optional(),
2160
- discount: z.string().describe("Total discount applied.").optional(),
2161
- tax: z.object({
2162
- name: z.string().describe("Name of the tax. For example, VAT.").optional(),
2163
- includedInPrice: z.boolean().describe(
2164
- "Whether tax is included in the original price. When `false`, tax is added at checkout."
2165
- ).optional(),
2166
- rate: z.string().describe(
2167
- 'Tax rate percentage, as a number between 0 and 100. For example, a 7% tax rate is `"7.00"`.'
2168
- ).optional(),
2169
- amount: z.string().describe(
2170
- 'Total tax, specified as a monetary amount. For example, `"3.99"`.'
2151
+ cancellation: z.object({
2152
+ requestedDate: z.date().describe("Date and time the cancellation was requested.").optional().nullable(),
2153
+ cause: z.enum([
2154
+ "UNDEFINED",
2155
+ "OWNER_ACTION",
2156
+ "MEMBER_ACTION",
2157
+ "PAYMENT_FAILURE",
2158
+ "PAYMENT_SETUP_FAILURE",
2159
+ "UNKNOWN"
2160
+ ]).describe("Reason for the cancellation.").optional(),
2161
+ effectiveAt: z.enum(["UNDEFINED", "IMMEDIATELY", "NEXT_PAYMENT_DATE"]).describe(
2162
+ "When the cancellation takes effect. Set when cancelling the order."
2171
2163
  ).optional()
2172
- }).describe("Tax applied.").optional(),
2173
- total: z.string().describe(
2174
- 'Price after tax and discount is applied, specified as a monetary amount. For example, `"13.98"`.\n\nIf no tax is applied, the amount is the same as `subtotal`.'
2164
+ }).describe(
2165
+ "Details about the cancellation of an order.\n\nOnly present if the status is `CANCELED`."
2175
2166
  ).optional(),
2176
- planPrice: z.string().describe("Plan price as it was at the moment of order creation.").optional(),
2177
- currency: z.string().describe(
2178
- "Currency code. Must be valid ISO 4217 currency code (e.g., USD)."
2167
+ lastPaymentStatus: z.enum([
2168
+ "UNDEFINED",
2169
+ "PAID",
2170
+ "REFUNDED",
2171
+ "FAILED",
2172
+ "UNPAID",
2173
+ "PENDING",
2174
+ "NOT_APPLICABLE"
2175
+ ]).describe(
2176
+ "Status of the last payment for the order.\nUpdated automatically for online orders. Updated manually by the Wix user for offline orders."
2177
+ ).optional(),
2178
+ startDate: z.date().describe("Start date and time for the ordered plan.").optional().nullable(),
2179
+ endDate: z.date().describe(
2180
+ "Current end date and time for the ordered plan.\n\n`endDate` may be updated over the course of an order.\nIf the order is paused, it will have a later `endDate` once it is resumed.\n`endDate` may also be postponed.\n\nOmitted if the order is valid until canceled and still `ACTIVE`."
2181
+ ).optional().nullable(),
2182
+ pausePeriods: z.array(
2183
+ z.object({
2184
+ status: z.enum(["UNDEFINED", "ACTIVE", "ENDED"]).describe("Status of the pause period.").optional(),
2185
+ pauseDate: z.date().describe("Start date and time of the pause period.").optional().nullable(),
2186
+ resumeDate: z.date().describe(
2187
+ "End date and time of the pause period.\n\nOmitted while the pause period remains `ACTIVE`."
2188
+ ).optional().nullable()
2189
+ })
2179
2190
  ).optional(),
2180
2191
  freeTrialDays: z.number().int().describe(
2181
- "Free trial period for the order in days. Only available for recurring plans."
2192
+ "Free trial period for the order, in days.\n\nOnly available for recurring plans."
2182
2193
  ).min(1).max(999).optional().nullable(),
2183
- coupon: z.object({
2184
- code: z.string().describe("Code of the applied coupon.").min(1).max(20).optional(),
2185
- amount: z.string().describe("Total discount of the coupon, as a monetary amount.").optional(),
2186
- _id: z.string().describe("Coupon ID.").regex(
2194
+ earliestEndDate: z.date().describe(
2195
+ "Earliest end date and time that the plan for the order can expire.\n\nCalculated by using the original end date plus any pause periods. Omitted if the order is active until canceled. Reserved for future use."
2196
+ ).optional().nullable(),
2197
+ currentCycle: z.object({
2198
+ index: z.number().int().describe(
2199
+ "Index of the current payment cycle in the order.\n\n`0` when order is in a free trial period. In all other cases, the index starts with `1`."
2200
+ ).min(0).optional(),
2201
+ startedDate: z.date().describe("Start date and time for the current payment cycle.").optional().nullable(),
2202
+ endedDate: z.date().describe("End date and time for the current payment cycle.").optional().nullable()
2203
+ }).describe(
2204
+ "Current payment cycle for the order.\n\n`currentCycle` will be omitted if the order's status is `CANCELED` or `ENDED`, or if the `startDate` hasn't passed yet."
2205
+ ).optional(),
2206
+ planName: z.string().describe("Plan name at the time of purchase.").optional(),
2207
+ planDescription: z.string().describe("Plan description at the time of purchase").optional(),
2208
+ planPrice: z.string().describe("Plan price as it was at the moment of order creation.").optional(),
2209
+ _createdDate: z.date().describe("Date and time the order was created.").optional().nullable(),
2210
+ _updatedDate: z.date().describe("Date and time the order was updated.").optional().nullable(),
2211
+ formData: z.object({
2212
+ formId: z.string().describe(
2213
+ "ID of the [order form](https://dev.wix.com/docs/rest/api-reference/wix-forms/form-submissions/introduction) associated with the plan at checkout."
2214
+ ).regex(
2187
2215
  /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
2188
2216
  "Must be a valid GUID"
2189
- ).optional()
2217
+ ).optional().nullable(),
2218
+ submissionId: z.string().describe(
2219
+ "ID of a submission to the plan's order form at checkout. Every time a visitor completes the checkout process for a plan, a new submission is created."
2220
+ ).regex(
2221
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
2222
+ "Must be a valid GUID"
2223
+ ).optional().nullable(),
2224
+ submissionData: z.record(z.string(), z.any()).describe("Data submitted to the plan's order form at checkout.").optional()
2190
2225
  }).describe(
2191
- "Coupon applied to the order. Empty means no coupon was applied."
2226
+ "Information about the form submitted during the plan's checkout."
2192
2227
  ).optional()
2193
- }),
2194
- z.xor([
2195
- z.object({
2196
- subscription: z.never().optional(),
2197
- singlePaymentForDuration: z.never().optional(),
2198
- singlePaymentUnlimited: z.never().optional()
2199
- }),
2200
- z.object({
2201
- singlePaymentForDuration: z.never().optional(),
2202
- singlePaymentUnlimited: z.never().optional(),
2203
- subscription: z.object({
2204
- cycleDuration: z.object({
2205
- count: z.number().int().describe(
2206
- "Number of days, months, weeks, or years in a single payment cycle. Currently limited to support only `1`."
2207
- ).min(1).optional().nullable(),
2208
- unit: z.enum(["UNDEFINED", "DAY", "WEEK", "MONTH", "YEAR"]).describe("Unit of time for the cycle duration.").optional()
2209
- }).describe(
2210
- "Number of payment cycles the subscription is valid for.\n`0` for unlimited plans or for plans that are valid until canceled."
2211
- ).optional(),
2212
- cycleCount: z.number().int().describe(
2213
- "Length of a payment cycle. For example, 1 month to have monthly payments.\nMultiply `cycleDuration`'s `count` by `cycleCount` to get the subscription duration.\nCurrently, only a value of `1` is supported."
2214
- ).min(0).max(2e3).optional().nullable()
2215
- }).describe("Order has recurring payments.")
2216
- }),
2217
- z.object({
2218
- subscription: z.never().optional(),
2219
- singlePaymentUnlimited: z.never().optional(),
2220
- singlePaymentForDuration: z.object({
2221
- count: z.number().int().describe(
2222
- "Number of days, months, weeks, or years in a single payment cycle. Currently limited to support only `1`."
2223
- ).min(1).optional().nullable(),
2224
- unit: z.enum(["UNDEFINED", "DAY", "WEEK", "MONTH", "YEAR"]).describe("Unit of time for the cycle duration.").optional()
2225
- }).describe(
2226
- "One-time payment. Order is valid for a specified duration."
2227
- )
2228
- }),
2229
- z.object({
2230
- subscription: z.never().optional(),
2231
- singlePaymentForDuration: z.never().optional(),
2232
- singlePaymentUnlimited: z.boolean().describe("One-time payment. Order is valid until it is canceled.")
2233
- })
2234
- ])
2235
- ).describe(
2236
- "__Deprecated.__ Use `prices` instead. This property will be removed on September 30, 2022."
2237
- ).optional(),
2238
- prices: z.array(
2239
- z.object({
2240
- duration: z.object({
2241
- cycleFrom: z.number().int().describe(
2242
- "Price starts to apply with this cycle.\n\n`1` is the first payment cycle for all pricing models."
2243
- ).optional(),
2244
- numberOfCycles: z.number().int().describe(
2245
- "Amount of cycles to apply price for.\n\nFor `subscription` pricing models with a finite number of cycles, the `numberOfCycles` is the same as `pricing.subscription.cycleCount`.\n\nFor `subscription` pricing models that are unlimited or until-canceled, the `numberOfCycles` is not returned.\n\nFor `singlePaymentForDuration` and `singlePaymentUnlimited` pricing models, the `numberOfCycles` is `1`."
2246
- ).optional().nullable()
2247
- }).describe(
2248
- "Cycle duration to apply `price` for.\n\nUse with all pricing models.\nCan apply the same price to multiple payment cycles."
2249
- ).optional(),
2250
- price: z.object({
2251
- subtotal: z.string().describe(
2252
- 'Price of the order excluding tax, specified as a monetary amount. For example, `"9.99"`.'
2253
- ).optional(),
2254
- coupon: z.object({
2255
- code: z.string().describe("Code of the applied coupon.").min(1).max(20).optional(),
2256
- amount: z.string().describe(
2257
- "Total discount of the coupon, as a monetary amount."
2258
- ).optional(),
2259
- _id: z.string().describe("Coupon ID.").regex(
2260
- /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
2261
- "Must be a valid GUID"
2262
- ).optional()
2263
- }).describe("Coupon applied to the order, from the Coupons API.").optional(),
2264
- discount: z.string().describe("Total discount applied to the order.").optional(),
2265
- tax: z.object({
2266
- name: z.string().describe("Name of the tax. For example, VAT.").optional(),
2267
- includedInPrice: z.boolean().describe(
2268
- "Whether tax is included in the original price. When `false`, tax is added at checkout."
2269
- ).optional(),
2270
- rate: z.string().describe(
2271
- 'Tax rate percentage, as a number between 0 and 100. For example, a 7% tax rate is `"7.00"`.'
2272
- ).optional(),
2273
- amount: z.string().describe(
2274
- 'Total tax, specified as a monetary amount. For example, `"3.99"`.'
2275
- ).optional()
2276
- }).describe(
2277
- "Tax applied to the order.\n\nTax is only applied if the site [has it configured](https://support.wix.com/en/article/pricing-plans-setting-up-tax-collection)."
2278
- ).optional(),
2279
- total: z.string().describe(
2280
- 'Price after tax and discount is applied. Specified as a monetary amount, for example, `"13.98"`.\n\nIf no tax is applied, the amount is the same as `subtotal`.'
2281
- ).optional(),
2282
- currency: z.string().describe(
2283
- "Three-letter currency code in\n[ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format."
2284
- ).optional(),
2285
- proration: z.string().describe(
2286
- "Price change after billing date was change and price was adjusted. Could be positive and negative values."
2287
- ).optional()
2288
- }).describe("Order price.").optional()
2289
2228
  })
2229
+ ).optional(),
2230
+ pagingMetadata: z.object({
2231
+ count: z.number().int().describe("Number of items returned in the response.").optional().nullable(),
2232
+ offset: z.number().int().describe("Offset that was requested.").optional().nullable(),
2233
+ total: z.number().int().describe(
2234
+ "Total number of items that match the query. Returned if offset paging is used and the `tooManyToCount` flag is not set."
2235
+ ).optional().nullable(),
2236
+ tooManyToCount: z.boolean().describe(
2237
+ "Flag that indicates the server failed to calculate the `total` field."
2238
+ ).optional().nullable(),
2239
+ cursors: z.object({
2240
+ next: z.string().describe(
2241
+ "Cursor string pointing to the next page in the list of results."
2242
+ ).max(16e3).optional().nullable(),
2243
+ prev: z.string().describe(
2244
+ "Cursor pointing to the previous page in the list of results."
2245
+ ).max(16e3).optional().nullable()
2246
+ }).describe(
2247
+ "Cursors to navigate through the result pages using `next` and `prev`. Returned if cursor paging is used."
2248
+ ).optional()
2249
+ }).describe(
2250
+ "Object containing paging-related data (number of orders returned, offset)."
2290
2251
  ).optional()
2291
2252
  });
2253
+ var PostponeEndDateRequest = z.object({
2254
+ _id: z.string().describe("Order ID.").regex(
2255
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
2256
+ "Must be a valid GUID"
2257
+ ),
2258
+ endDate: z.date().describe(
2259
+ "New end date and time.\n\nMust be later than the current end date and time."
2260
+ )
2261
+ });
2262
+ var PostponeEndDateResponse = z.object({});
2263
+ var CancelOrderRequest = z.object({
2264
+ _id: z.string().describe("Order ID.").regex(
2265
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
2266
+ "Must be a valid GUID"
2267
+ ),
2268
+ effectiveAt: z.enum(["UNDEFINED", "IMMEDIATELY", "NEXT_PAYMENT_DATE"])
2269
+ });
2270
+ var CancelOrderResponse = z.object({});
2271
+ var MarkAsPaidRequest = z.object({
2272
+ _id: z.string().describe("Order ID.").regex(
2273
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
2274
+ "Must be a valid GUID"
2275
+ )
2276
+ });
2277
+ var MarkAsPaidResponse = z.object({});
2278
+ var PauseOrderRequest = z.object({
2279
+ _id: z.string().describe("Order ID.").regex(
2280
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
2281
+ "Must be a valid GUID"
2282
+ )
2283
+ });
2284
+ var PauseOrderResponse = z.object({});
2285
+ var ResumeOrderRequest = z.object({
2286
+ _id: z.string().describe("Order ID.").regex(
2287
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
2288
+ "Must be a valid GUID"
2289
+ )
2290
+ });
2291
+ var ResumeOrderResponse = z.object({});
2292
2292
  var MemberGetOrderRequest = z.object({
2293
2293
  _id: z.string().describe("Order ID.").regex(
2294
2294
  /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,