@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 };
@@ -24,6 +24,7 @@ __export(index_typings_exports, {
24
24
  SortOrder: () => SortOrder,
25
25
  Status: () => Status,
26
26
  WebhookIdentityType: () => WebhookIdentityType,
27
+ bulkCreateOrderPaymentRequests: () => bulkCreateOrderPaymentRequests2,
27
28
  createOrderPaymentRequest: () => createOrderPaymentRequest2,
28
29
  deleteOrderPaymentRequest: () => deleteOrderPaymentRequest2,
29
30
  getOrderPaymentRequest: () => getOrderPaymentRequest2,
@@ -130,6 +131,49 @@ function createOrderPaymentRequest(payload) {
130
131
  }
131
132
  return __createOrderPaymentRequest;
132
133
  }
134
+ function bulkCreateOrderPaymentRequests(payload) {
135
+ function __bulkCreateOrderPaymentRequests({ host }) {
136
+ const serializedData = (0, import_transform_paths.transformPaths)(payload, [
137
+ {
138
+ transformFn: import_timestamp.transformSDKTimestampToRESTTimestamp,
139
+ paths: [
140
+ { path: "orderPaymentRequests.expirationDate" },
141
+ { path: "orderPaymentRequests.createdDate" },
142
+ { path: "orderPaymentRequests.updatedDate" }
143
+ ]
144
+ }
145
+ ]);
146
+ const metadata = {
147
+ entityFqdn: "wix.ecom.v1.order_payment_request",
148
+ method: "POST",
149
+ methodFqn: "wix.ecom.order_payment_request.api.v1.OrderPaymentRequestsService.BulkCreateOrderPaymentRequests",
150
+ packageName: PACKAGE_NAME,
151
+ migrationOptions: {
152
+ optInTransformResponse: true
153
+ },
154
+ url: resolveWixEcomOrderPaymentRequestApiV1OrderPaymentRequestsServiceUrl(
155
+ {
156
+ protoPath: "/v1/bulk/order-payment-requests/create",
157
+ data: serializedData,
158
+ host
159
+ }
160
+ ),
161
+ data: serializedData,
162
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
163
+ {
164
+ transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
165
+ paths: [
166
+ { path: "results.item.orderPaymentRequest.expirationDate" },
167
+ { path: "results.item.orderPaymentRequest.createdDate" },
168
+ { path: "results.item.orderPaymentRequest.updatedDate" }
169
+ ]
170
+ }
171
+ ])
172
+ };
173
+ return metadata;
174
+ }
175
+ return __bulkCreateOrderPaymentRequests;
176
+ }
133
177
  function getOrderPaymentRequest(payload) {
134
178
  function __getOrderPaymentRequest({ host }) {
135
179
  const metadata = {
@@ -405,6 +449,52 @@ async function createOrderPaymentRequest2(options) {
405
449
  throw transformedError;
406
450
  }
407
451
  }
452
+ async function bulkCreateOrderPaymentRequests2(orderPaymentRequests, options) {
453
+ const { httpClient, sideEffects } = arguments[2];
454
+ const payload = (0, import_transform_paths2.transformPaths)(
455
+ (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
456
+ orderPaymentRequests,
457
+ returnEntity: options?.returnEntity
458
+ }),
459
+ [
460
+ {
461
+ transformFn: import_image.transformSDKImageToRESTImage,
462
+ paths: [{ path: "orderPaymentRequests.image" }]
463
+ }
464
+ ]
465
+ );
466
+ const reqOpts = bulkCreateOrderPaymentRequests(
467
+ payload
468
+ );
469
+ sideEffects?.onSiteCall?.();
470
+ try {
471
+ const result = await httpClient.request(reqOpts);
472
+ sideEffects?.onSuccess?.(result);
473
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(
474
+ (0, import_transform_paths2.transformPaths)(result.data, [
475
+ {
476
+ transformFn: import_image2.transformRESTImageToSDKImage,
477
+ paths: [{ path: "results.item.orderPaymentRequest.image" }]
478
+ }
479
+ ])
480
+ );
481
+ } catch (err) {
482
+ const transformedError = (0, import_transform_error.transformError)(
483
+ err,
484
+ {
485
+ spreadPathsToArguments: {},
486
+ explicitPathsToArguments: {
487
+ orderPaymentRequests: "$[0]",
488
+ returnEntity: "$[1].returnEntity"
489
+ },
490
+ singleArgumentUnchanged: false
491
+ },
492
+ ["orderPaymentRequests", "options"]
493
+ );
494
+ sideEffects?.onError?.(err);
495
+ throw transformedError;
496
+ }
497
+ }
408
498
  async function getOrderPaymentRequest2(orderPaymentRequestId) {
409
499
  const { httpClient, sideEffects } = arguments[1];
410
500
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
@@ -683,6 +773,7 @@ async function voidOrderPaymentRequest2(orderPaymentRequestId) {
683
773
  SortOrder,
684
774
  Status,
685
775
  WebhookIdentityType,
776
+ bulkCreateOrderPaymentRequests,
686
777
  createOrderPaymentRequest,
687
778
  deleteOrderPaymentRequest,
688
779
  getOrderPaymentRequest,