@wix/auto_sdk_ecom_order-payment-requests 1.0.61 → 1.0.62

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 +16 -3
  2. package/build/cjs/index.js +100 -0
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/cjs/index.typings.d.ts +90 -1
  5. package/build/cjs/index.typings.js +91 -0
  6. package/build/cjs/index.typings.js.map +1 -1
  7. package/build/cjs/meta.d.ts +70 -2
  8. package/build/cjs/meta.js +65 -0
  9. package/build/cjs/meta.js.map +1 -1
  10. package/build/cjs/schemas.d.ts +5 -1
  11. package/build/cjs/schemas.js +13 -2
  12. package/build/cjs/schemas.js.map +1 -1
  13. package/build/es/index.d.mts +16 -3
  14. package/build/es/index.mjs +99 -0
  15. package/build/es/index.mjs.map +1 -1
  16. package/build/es/index.typings.d.mts +90 -1
  17. package/build/es/index.typings.mjs +90 -0
  18. package/build/es/index.typings.mjs.map +1 -1
  19. package/build/es/meta.d.mts +70 -2
  20. package/build/es/meta.mjs +64 -0
  21. package/build/es/meta.mjs.map +1 -1
  22. package/build/es/schemas.d.mts +5 -1
  23. package/build/es/schemas.mjs +10 -1
  24. package/build/es/schemas.mjs.map +1 -1
  25. package/build/internal/cjs/index.d.ts +23 -5
  26. package/build/internal/cjs/index.js +100 -0
  27. package/build/internal/cjs/index.js.map +1 -1
  28. package/build/internal/cjs/index.typings.d.ts +99 -2
  29. package/build/internal/cjs/index.typings.js +91 -0
  30. package/build/internal/cjs/index.typings.js.map +1 -1
  31. package/build/internal/cjs/meta.d.ts +70 -2
  32. package/build/internal/cjs/meta.js +65 -0
  33. package/build/internal/cjs/meta.js.map +1 -1
  34. package/build/internal/cjs/schemas.d.ts +5 -1
  35. package/build/internal/cjs/schemas.js +13 -2
  36. package/build/internal/cjs/schemas.js.map +1 -1
  37. package/build/internal/es/index.d.mts +23 -5
  38. package/build/internal/es/index.mjs +99 -0
  39. package/build/internal/es/index.mjs.map +1 -1
  40. package/build/internal/es/index.typings.d.mts +99 -2
  41. package/build/internal/es/index.typings.mjs +90 -0
  42. package/build/internal/es/index.typings.mjs.map +1 -1
  43. package/build/internal/es/meta.d.mts +70 -2
  44. package/build/internal/es/meta.mjs +64 -0
  45. package/build/internal/es/meta.mjs.map +1 -1
  46. package/build/internal/es/schemas.d.mts +5 -1
  47. package/build/internal/es/schemas.mjs +10 -1
  48. package/build/internal/es/schemas.mjs.map +1 -1
  49. package/package.json +2 -2
@@ -235,6 +235,73 @@ interface CreateOrderPaymentRequestResponse {
235
235
  */
236
236
  orderPaymentRequestUrl?: string;
237
237
  }
238
+ interface BulkCreateOrderPaymentRequestsRequest {
239
+ /**
240
+ * Order payment requests to create.
241
+ * @minSize 1
242
+ * @maxSize 100
243
+ */
244
+ orderPaymentRequests: OrderPaymentRequest[];
245
+ /**
246
+ * Whether to return the created order payment requests and their payment page URLs in the response.
247
+ * Default: `false`.
248
+ */
249
+ returnEntity?: boolean;
250
+ }
251
+ interface BulkCreateOrderPaymentRequestsResponse {
252
+ /**
253
+ * Results of the bulk create operation in the same order as the request items.
254
+ * @minSize 1
255
+ * @maxSize 100
256
+ */
257
+ results?: BulkOrderPaymentRequestResult[];
258
+ /** Metadata about the bulk create operation. */
259
+ bulkActionMetadata?: BulkActionMetadata;
260
+ }
261
+ interface ItemMetadata {
262
+ /**
263
+ * Item ID. Provided only whenever possible. For example, `itemId` can't be provided when item creation has failed.
264
+ * @format GUID
265
+ */
266
+ _id?: string | null;
267
+ /** Index of the item within the request array. Allows for correlation between request and response items. */
268
+ originalIndex?: number;
269
+ /** Whether the requested action for this item was successful. When `false`, the `error` field is returned. */
270
+ success?: boolean;
271
+ /** Details about the error in case of failure. */
272
+ error?: ApplicationError;
273
+ }
274
+ interface ApplicationError {
275
+ /** Error code. */
276
+ code?: string;
277
+ /** Description of the error. */
278
+ description?: string;
279
+ /** Data related to the error. */
280
+ data?: Record<string, any> | null;
281
+ }
282
+ interface BulkOrderPaymentRequestItem {
283
+ /** Created order payment request. */
284
+ orderPaymentRequest?: OrderPaymentRequest;
285
+ /**
286
+ * Payment page URL for the created order payment request.
287
+ * @format WEB_URL
288
+ */
289
+ orderPaymentRequestUrl?: string;
290
+ }
291
+ interface BulkOrderPaymentRequestResult {
292
+ /** Metadata about this item, including its original request index and any error. */
293
+ itemMetadata?: ItemMetadata;
294
+ /** Created order payment request and its payment page URL. Returned when `returnEntity` is `true`. */
295
+ item?: BulkOrderPaymentRequestItem;
296
+ }
297
+ interface BulkActionMetadata {
298
+ /** Number of items that were successfully processed. */
299
+ totalSuccesses?: number;
300
+ /** Number of items that couldn't be processed. */
301
+ totalFailures?: number;
302
+ /** Number of failures without details because detailed failure threshold was exceeded. */
303
+ undetailedFailures?: number;
304
+ }
238
305
  interface GetOrderPaymentRequestRequest {
239
306
  /**
240
307
  * ID of the order payment request to retrieve.
@@ -822,6 +889,36 @@ interface CreateOrderPaymentRequestOptions {
822
889
  /** Order payment request to create. */
823
890
  orderPaymentRequest?: OrderPaymentRequest;
824
891
  }
892
+ /**
893
+ * Creates multiple order payment requests in a single request. Works synchronously.
894
+ *
895
+ * The response contains an item-level result for every requested order payment request. Items are processed independently, so some may succeed while others fail.
896
+ *
897
+ * Per-item failures are returned in `results[].itemMetadata.error`. Possible application error codes are:
898
+ * - `ORDER_NOT_FOUND`: The referenced order wasn't found.
899
+ * - `PARTIAL_PAYMENT_NOT_SUPPORTED_FOR_SUBSCRIPTION`: The requested amount doesn't equal the subscription order total.
900
+ * - `INVALID_ORDER_STATUS_FOR_SUBSCRIPTION`: The subscription order isn't in `INITIALIZED` status.
901
+ * - `SITE_NOT_PUBLISHED`: The site isn't published.
902
+ * - `ORDER_PAYMENT_REQUEST_PAGE_NOT_FOUND`: The Payment Request Page isn't available on the site.
903
+ * @param orderPaymentRequests - Order payment requests to create.
904
+ * @internal
905
+ * @documentationMaturity preview
906
+ * @requiredField orderPaymentRequests
907
+ * @requiredField orderPaymentRequests.amount
908
+ * @requiredField orderPaymentRequests.orderId
909
+ * @requiredField orderPaymentRequests.source.externalId
910
+ * @requiredField orderPaymentRequests.title
911
+ * @permissionId ecom:v1:order_payment_request:bulk_create_order_payment_requests
912
+ * @fqn wix.ecom.order_payment_request.api.v1.OrderPaymentRequestsService.BulkCreateOrderPaymentRequests
913
+ */
914
+ declare function bulkCreateOrderPaymentRequests(orderPaymentRequests: NonNullablePaths<OrderPaymentRequest, `amount` | `orderId` | `source.externalId` | `title`, 3>[], options?: BulkCreateOrderPaymentRequestsOptions): Promise<NonNullablePaths<BulkCreateOrderPaymentRequestsResponse, `results` | `results.${number}.itemMetadata.originalIndex` | `results.${number}.itemMetadata.success` | `results.${number}.itemMetadata.error.code` | `results.${number}.itemMetadata.error.description` | `results.${number}.item.orderPaymentRequest.status` | `results.${number}.item.orderPaymentRequest.orderId` | `results.${number}.item.orderPaymentRequest.currency` | `results.${number}.item.orderPaymentRequest.title` | `results.${number}.item.orderPaymentRequestUrl` | `bulkActionMetadata.totalSuccesses` | `bulkActionMetadata.totalFailures` | `bulkActionMetadata.undetailedFailures`, 6>>;
915
+ interface BulkCreateOrderPaymentRequestsOptions {
916
+ /**
917
+ * Whether to return the created order payment requests and their payment page URLs in the response.
918
+ * Default: `false`.
919
+ */
920
+ returnEntity?: boolean;
921
+ }
825
922
  /**
826
923
  * Retrieves an order payment request.
827
924
  * @param orderPaymentRequestId - ID of the order payment request to retrieve.
@@ -1191,7 +1288,7 @@ interface UpdateExtendedFieldsOptions {
1191
1288
  *
1192
1289
  * Only `UNPAID` order payment requests can be voided. Voiding an order payment request that is already `VOIDED` succeeds without making any changes. Voiding a `PAID` or `EXPIRED` order payment request fails.
1193
1290
  * @param orderPaymentRequestId - ID of the order payment request to void.
1194
- * @internal
1291
+ * @public
1195
1292
  * @documentationMaturity preview
1196
1293
  * @requiredField orderPaymentRequestId
1197
1294
  * @permissionId ECOM.ORDER_PAYMENT_REQUEST_UPDATE
@@ -1202,4 +1299,4 @@ declare function voidOrderPaymentRequest(orderPaymentRequestId: string): Promise
1202
1299
  __applicationErrorsType?: VoidOrderPaymentRequestApplicationErrors;
1203
1300
  }>;
1204
1301
 
1205
- export { type AccountInfo, type AccountInfoMetadata, type ActionEvent, type ActionLink, type ActionLinks, type BaseEventMetadata, type CommonQueryWithEntityContext, type CreateOrderPaymentRequestApplicationErrors, type CreateOrderPaymentRequestOptions, type CreateOrderPaymentRequestRequest, type CreateOrderPaymentRequestResponse, type CursorPaging, type CursorPagingMetadata, type CursorQuery, type CursorQueryPagingMethodOneOf, type Cursors, type DeleteOrderPaymentRequestApplicationErrors, type DeleteOrderPaymentRequestRequest, type DeleteOrderPaymentRequestResponse, type DomainEvent, type DomainEventBodyOneOf, type Empty, type EntityCreatedEvent, type EntityDeletedEvent, type EntityUpdatedEvent, type EventMetadata, type ExtendedFields, type GetOrderPaymentRequestApplicationErrors, type GetOrderPaymentRequestRequest, type GetOrderPaymentRequestResponse, type GetOrderPaymentRequestURLRequest, type GetOrderPaymentRequestURLResponse, type GetOrderPaymentRequestUrlApplicationErrors, type IdentificationData, type IdentificationDataIdOneOf, type MessageEnvelope, type OrderPaymentRequest, type OrderPaymentRequestCreatedEnvelope, type OrderPaymentRequestDeletedEnvelope, type OrderPaymentRequestExpired, type OrderPaymentRequestExpiredEnvelope, type OrderPaymentRequestPaid, type OrderPaymentRequestPaidEnvelope, type OrderPaymentRequestQuery, type OrderPaymentRequestQuerySpec, type OrderPaymentRequestUpdatedEnvelope, type OrderPaymentRequestVoided, type OrderPaymentRequestVoidedEnvelope, type OrderPaymentRequestsQueryBuilder, type OrderPaymentRequestsQueryResult, PaymentMethod, type PaymentMethodWithLiterals, type Price, type QueryOrderPaymentRequestsRequest, type QueryOrderPaymentRequestsResponse, type RestoreInfo, SortOrder, type SortOrderWithLiterals, type Sorting, type Source, Status, type StatusWithLiterals, type SubscriptionInfo, type UpdateExtendedFieldsOptions, type UpdateExtendedFieldsRequest, type UpdateExtendedFieldsResponse, type UpdateOrderPaymentRequest, type UpdateOrderPaymentRequestApplicationErrors, type UpdateOrderPaymentRequestRequest, type UpdateOrderPaymentRequestResponse, type VoidOrderPaymentRequestApplicationErrors, type VoidOrderPaymentRequestRequest, type VoidOrderPaymentRequestResponse, WebhookIdentityType, type WebhookIdentityTypeWithLiterals, createOrderPaymentRequest, deleteOrderPaymentRequest, getOrderPaymentRequest, getOrderPaymentRequestUrl, onOrderPaymentRequestCreated, onOrderPaymentRequestDeleted, onOrderPaymentRequestExpired, onOrderPaymentRequestPaid, onOrderPaymentRequestUpdated, onOrderPaymentRequestVoided, queryOrderPaymentRequests, typedQueryOrderPaymentRequests, updateExtendedFields, updateOrderPaymentRequest, utils, voidOrderPaymentRequest };
1302
+ export { type AccountInfo, type AccountInfoMetadata, type ActionEvent, type ActionLink, type ActionLinks, type ApplicationError, type BaseEventMetadata, type BulkActionMetadata, type BulkCreateOrderPaymentRequestsOptions, type BulkCreateOrderPaymentRequestsRequest, type BulkCreateOrderPaymentRequestsResponse, type BulkOrderPaymentRequestItem, type BulkOrderPaymentRequestResult, type CommonQueryWithEntityContext, type CreateOrderPaymentRequestApplicationErrors, type CreateOrderPaymentRequestOptions, type CreateOrderPaymentRequestRequest, type CreateOrderPaymentRequestResponse, type CursorPaging, type CursorPagingMetadata, type CursorQuery, type CursorQueryPagingMethodOneOf, type Cursors, type DeleteOrderPaymentRequestApplicationErrors, type DeleteOrderPaymentRequestRequest, type DeleteOrderPaymentRequestResponse, type DomainEvent, type DomainEventBodyOneOf, type Empty, type EntityCreatedEvent, type EntityDeletedEvent, type EntityUpdatedEvent, type EventMetadata, type ExtendedFields, type GetOrderPaymentRequestApplicationErrors, type GetOrderPaymentRequestRequest, type GetOrderPaymentRequestResponse, type GetOrderPaymentRequestURLRequest, type GetOrderPaymentRequestURLResponse, type GetOrderPaymentRequestUrlApplicationErrors, type IdentificationData, type IdentificationDataIdOneOf, type ItemMetadata, type MessageEnvelope, type OrderPaymentRequest, type OrderPaymentRequestCreatedEnvelope, type OrderPaymentRequestDeletedEnvelope, type OrderPaymentRequestExpired, type OrderPaymentRequestExpiredEnvelope, type OrderPaymentRequestPaid, type OrderPaymentRequestPaidEnvelope, type OrderPaymentRequestQuery, type OrderPaymentRequestQuerySpec, type OrderPaymentRequestUpdatedEnvelope, type OrderPaymentRequestVoided, type OrderPaymentRequestVoidedEnvelope, type OrderPaymentRequestsQueryBuilder, type OrderPaymentRequestsQueryResult, PaymentMethod, type PaymentMethodWithLiterals, type Price, type QueryOrderPaymentRequestsRequest, type QueryOrderPaymentRequestsResponse, type RestoreInfo, SortOrder, type SortOrderWithLiterals, type Sorting, type Source, Status, type StatusWithLiterals, type SubscriptionInfo, type UpdateExtendedFieldsOptions, type UpdateExtendedFieldsRequest, type UpdateExtendedFieldsResponse, type UpdateOrderPaymentRequest, type UpdateOrderPaymentRequestApplicationErrors, type UpdateOrderPaymentRequestRequest, type UpdateOrderPaymentRequestResponse, type VoidOrderPaymentRequestApplicationErrors, type VoidOrderPaymentRequestRequest, type VoidOrderPaymentRequestResponse, WebhookIdentityType, type WebhookIdentityTypeWithLiterals, bulkCreateOrderPaymentRequests, createOrderPaymentRequest, deleteOrderPaymentRequest, getOrderPaymentRequest, getOrderPaymentRequestUrl, onOrderPaymentRequestCreated, onOrderPaymentRequestDeleted, onOrderPaymentRequestExpired, onOrderPaymentRequestPaid, onOrderPaymentRequestUpdated, onOrderPaymentRequestVoided, queryOrderPaymentRequests, typedQueryOrderPaymentRequests, updateExtendedFields, updateOrderPaymentRequest, utils, voidOrderPaymentRequest };
@@ -94,6 +94,49 @@ function createOrderPaymentRequest(payload) {
94
94
  }
95
95
  return __createOrderPaymentRequest;
96
96
  }
97
+ function bulkCreateOrderPaymentRequests(payload) {
98
+ function __bulkCreateOrderPaymentRequests({ host }) {
99
+ const serializedData = transformPaths(payload, [
100
+ {
101
+ transformFn: transformSDKTimestampToRESTTimestamp,
102
+ paths: [
103
+ { path: "orderPaymentRequests.expirationDate" },
104
+ { path: "orderPaymentRequests.createdDate" },
105
+ { path: "orderPaymentRequests.updatedDate" }
106
+ ]
107
+ }
108
+ ]);
109
+ const metadata = {
110
+ entityFqdn: "wix.ecom.v1.order_payment_request",
111
+ method: "POST",
112
+ methodFqn: "wix.ecom.order_payment_request.api.v1.OrderPaymentRequestsService.BulkCreateOrderPaymentRequests",
113
+ packageName: PACKAGE_NAME,
114
+ migrationOptions: {
115
+ optInTransformResponse: true
116
+ },
117
+ url: resolveWixEcomOrderPaymentRequestApiV1OrderPaymentRequestsServiceUrl(
118
+ {
119
+ protoPath: "/v1/bulk/order-payment-requests/create",
120
+ data: serializedData,
121
+ host
122
+ }
123
+ ),
124
+ data: serializedData,
125
+ transformResponse: (payload2) => transformPaths(payload2, [
126
+ {
127
+ transformFn: transformRESTTimestampToSDKTimestamp,
128
+ paths: [
129
+ { path: "results.item.orderPaymentRequest.expirationDate" },
130
+ { path: "results.item.orderPaymentRequest.createdDate" },
131
+ { path: "results.item.orderPaymentRequest.updatedDate" }
132
+ ]
133
+ }
134
+ ])
135
+ };
136
+ return metadata;
137
+ }
138
+ return __bulkCreateOrderPaymentRequests;
139
+ }
97
140
  function getOrderPaymentRequest(payload) {
98
141
  function __getOrderPaymentRequest({ host }) {
99
142
  const metadata = {
@@ -369,6 +412,52 @@ async function createOrderPaymentRequest2(options) {
369
412
  throw transformedError;
370
413
  }
371
414
  }
415
+ async function bulkCreateOrderPaymentRequests2(orderPaymentRequests, options) {
416
+ const { httpClient, sideEffects } = arguments[2];
417
+ const payload = transformPaths2(
418
+ renameKeysFromSDKRequestToRESTRequest({
419
+ orderPaymentRequests,
420
+ returnEntity: options?.returnEntity
421
+ }),
422
+ [
423
+ {
424
+ transformFn: transformSDKImageToRESTImage,
425
+ paths: [{ path: "orderPaymentRequests.image" }]
426
+ }
427
+ ]
428
+ );
429
+ const reqOpts = bulkCreateOrderPaymentRequests(
430
+ payload
431
+ );
432
+ sideEffects?.onSiteCall?.();
433
+ try {
434
+ const result = await httpClient.request(reqOpts);
435
+ sideEffects?.onSuccess?.(result);
436
+ return renameKeysFromRESTResponseToSDKResponse(
437
+ transformPaths2(result.data, [
438
+ {
439
+ transformFn: transformRESTImageToSDKImage,
440
+ paths: [{ path: "results.item.orderPaymentRequest.image" }]
441
+ }
442
+ ])
443
+ );
444
+ } catch (err) {
445
+ const transformedError = sdkTransformError(
446
+ err,
447
+ {
448
+ spreadPathsToArguments: {},
449
+ explicitPathsToArguments: {
450
+ orderPaymentRequests: "$[0]",
451
+ returnEntity: "$[1].returnEntity"
452
+ },
453
+ singleArgumentUnchanged: false
454
+ },
455
+ ["orderPaymentRequests", "options"]
456
+ );
457
+ sideEffects?.onError?.(err);
458
+ throw transformedError;
459
+ }
460
+ }
372
461
  async function getOrderPaymentRequest2(orderPaymentRequestId) {
373
462
  const { httpClient, sideEffects } = arguments[1];
374
463
  const payload = renameKeysFromSDKRequestToRESTRequest({
@@ -646,6 +735,7 @@ export {
646
735
  SortOrder,
647
736
  Status,
648
737
  WebhookIdentityType,
738
+ bulkCreateOrderPaymentRequests2 as bulkCreateOrderPaymentRequests,
649
739
  createOrderPaymentRequest2 as createOrderPaymentRequest,
650
740
  deleteOrderPaymentRequest2 as deleteOrderPaymentRequest,
651
741
  getOrderPaymentRequest2 as getOrderPaymentRequest,