@wix/auto_sdk_ecom_order-payment-requests 1.0.62 → 1.0.64

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 (37) hide show
  1. package/build/cjs/index.d.ts +1 -1
  2. package/build/cjs/index.js +59 -0
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/cjs/index.typings.d.ts +58 -1
  5. package/build/cjs/index.typings.js +50 -0
  6. package/build/cjs/index.typings.js.map +1 -1
  7. package/build/cjs/meta.d.ts +53 -2
  8. package/build/cjs/meta.js +40 -0
  9. package/build/cjs/meta.js.map +1 -1
  10. package/build/es/index.d.mts +1 -1
  11. package/build/es/index.mjs +58 -0
  12. package/build/es/index.mjs.map +1 -1
  13. package/build/es/index.typings.d.mts +58 -1
  14. package/build/es/index.typings.mjs +49 -0
  15. package/build/es/index.typings.mjs.map +1 -1
  16. package/build/es/meta.d.mts +53 -2
  17. package/build/es/meta.mjs +39 -0
  18. package/build/es/meta.mjs.map +1 -1
  19. package/build/internal/cjs/index.d.ts +26 -3
  20. package/build/internal/cjs/index.js +59 -0
  21. package/build/internal/cjs/index.js.map +1 -1
  22. package/build/internal/cjs/index.typings.d.ts +115 -1
  23. package/build/internal/cjs/index.typings.js +50 -0
  24. package/build/internal/cjs/index.typings.js.map +1 -1
  25. package/build/internal/cjs/meta.d.ts +135 -3
  26. package/build/internal/cjs/meta.js +40 -0
  27. package/build/internal/cjs/meta.js.map +1 -1
  28. package/build/internal/es/index.d.mts +26 -3
  29. package/build/internal/es/index.mjs +58 -0
  30. package/build/internal/es/index.mjs.map +1 -1
  31. package/build/internal/es/index.typings.d.mts +115 -1
  32. package/build/internal/es/index.typings.mjs +49 -0
  33. package/build/internal/es/index.typings.mjs.map +1 -1
  34. package/build/internal/es/meta.d.mts +135 -3
  35. package/build/internal/es/meta.mjs +39 -0
  36. package/build/internal/es/meta.mjs.map +1 -1
  37. package/package.json +4 -4
@@ -316,6 +316,13 @@ interface GetOrderPaymentRequestResponse {
316
316
  interface UpdateOrderPaymentRequestRequest {
317
317
  /** Order payment request to update. */
318
318
  orderPaymentRequest: OrderPaymentRequest;
319
+ /**
320
+ * Set of fields to update.
321
+ *
322
+ * Fields that aren't included in `fieldMask.paths` are ignored.
323
+ * @internal
324
+ */
325
+ fieldMask?: string[];
319
326
  }
320
327
  interface UpdateOrderPaymentRequestResponse {
321
328
  /** Updated order payment request. */
@@ -366,6 +373,20 @@ interface Sorting {
366
373
  fieldName?: string;
367
374
  /** Sort order. */
368
375
  order?: SortOrderWithLiterals;
376
+ /**
377
+ * When `field_name` is a property of repeated field that is marked as `MATCH_ITEMS` and sort should be done by
378
+ * a specific element from a collection, filter can/should be provided to ensure correct sort value is picked.
379
+ *
380
+ * If multiple filters are provided, they are combined with AND operator.
381
+ *
382
+ * Example:
383
+ * Given we have document like {"id": "1", "nestedField": [{"price": 10, "region": "EU"}, {"price": 20, "region": "US"}]}
384
+ * and `nestedField` is marked as `MATCH_ITEMS`, to ensure that sorting is done by correct region, filter should be
385
+ * { fieldName: "nestedField.price", "select_items_by": [{"nestedField.region": "US"}] }
386
+ * @internal
387
+ * @maxSize 10
388
+ */
389
+ selectItemsBy?: Record<string, any>[] | null;
369
390
  }
370
391
  declare enum SortOrder {
371
392
  ASC = "ASC",
@@ -458,6 +479,26 @@ interface VoidOrderPaymentRequestRequest {
458
479
  }
459
480
  interface VoidOrderPaymentRequestResponse {
460
481
  }
482
+ interface ChargeOrderPaymentRequestRequest {
483
+ /**
484
+ * ID of the order payment request to charge.
485
+ * @format GUID
486
+ */
487
+ orderPaymentRequestId: string;
488
+ /**
489
+ * Token representing the payment details the customer entered, including their card and payment provider. Obtain it by calling `paymentsApi.initializePayment()` on the `paymentsApi` object provided by the Wix Cashier payments client SDK. Valid for a single charge attempt.
490
+ * @maxLength 100
491
+ */
492
+ paymentToken?: string | null;
493
+ }
494
+ interface ChargeOrderPaymentRequestResponse {
495
+ /**
496
+ * Token for completing the payment. Returned for every charge that reaches the payment provider. Pass it to `paymentsApi.continuePayment()` in the Wix Cashier payments client SDK, which completes any remaining step the provider requires from the customer, such as 3D Secure verification or an off-site redirect.
497
+ * @minLength 1
498
+ * @maxLength 1000
499
+ */
500
+ paymentResponseToken?: string | null;
501
+ }
461
502
  interface DomainEvent extends DomainEventBodyOneOf {
462
503
  createdEvent?: EntityCreatedEvent;
463
504
  updatedEvent?: EntityUpdatedEvent;
@@ -685,6 +726,36 @@ type VoidOrderPaymentRequestApplicationErrors = {
685
726
  description?: string;
686
727
  data?: Record<string, any>;
687
728
  };
729
+ /** @docsIgnore */
730
+ type ChargeOrderPaymentRequestApplicationErrors = {
731
+ code?: 'ORDER_PAYMENT_REQUEST_NOT_FOUND';
732
+ description?: string;
733
+ data?: Record<string, any>;
734
+ } | {
735
+ code?: 'CANNOT_CHARGE_PAID_ORDER_PAYMENT_REQUEST';
736
+ description?: string;
737
+ data?: Record<string, any>;
738
+ } | {
739
+ code?: 'CANNOT_CHARGE_EXPIRED_ORDER_PAYMENT_REQUEST';
740
+ description?: string;
741
+ data?: Record<string, any>;
742
+ } | {
743
+ code?: 'CANNOT_CHARGE_VOIDED_ORDER_PAYMENT_REQUEST';
744
+ description?: string;
745
+ data?: Record<string, any>;
746
+ } | {
747
+ code?: 'PAYMENT_IN_PROGRESS';
748
+ description?: string;
749
+ data?: Record<string, any>;
750
+ } | {
751
+ code?: 'PAYMENT_ATTEMPT_EXPIRED';
752
+ description?: string;
753
+ data?: Record<string, any>;
754
+ } | {
755
+ code?: 'PAYMENT_METHOD_UNAVAILABLE';
756
+ description?: string;
757
+ data?: Record<string, any>;
758
+ };
688
759
  interface BaseEventMetadata {
689
760
  /**
690
761
  * App instance ID.
@@ -1242,6 +1313,20 @@ type OrderPaymentRequestQuery = {
1242
1313
  Sort order.
1243
1314
  */
1244
1315
  order?: NonNullable<CommonQueryWithEntityContext['sort']>[number]['order'];
1316
+ /**
1317
+ When `field_name` is a property of repeated field that is marked as `MATCH_ITEMS` and sort should be done by
1318
+ a specific element from a collection, filter can/should be provided to ensure correct sort value is picked.
1319
+
1320
+ If multiple filters are provided, they are combined with AND operator.
1321
+
1322
+ Example:
1323
+ Given we have document like {"id": "1", "nestedField": [{"price": 10, "region": "EU"}, {"price": 20, "region": "US"}]}
1324
+ and `nestedField` is marked as `MATCH_ITEMS`, to ensure that sorting is done by correct region, filter should be
1325
+ { fieldName: "nestedField.price", "select_items_by": [{"nestedField.region": "US"}] }
1326
+ @internal: undefined,
1327
+ @maxSize: 10
1328
+ */
1329
+ selectItemsBy?: NonNullable<CommonQueryWithEntityContext['sort']>[number]['selectItemsBy'] | null;
1245
1330
  }[];
1246
1331
  };
1247
1332
  declare const utils: {
@@ -1298,5 +1383,34 @@ interface UpdateExtendedFieldsOptions {
1298
1383
  declare function voidOrderPaymentRequest(orderPaymentRequestId: string): Promise<void & {
1299
1384
  __applicationErrorsType?: VoidOrderPaymentRequestApplicationErrors;
1300
1385
  }>;
1386
+ /**
1387
+ * Charges an order payment request.
1388
+ *
1389
+ * Collects the order payment request's `amount` from the payment method the customer entered in the Wix Cashier payments widget on your page. Before calling this method, call `paymentsApi.initializePayment()` on the `paymentsApi` object provided by the Wix Cashier payments client SDK to collect the customer's payment details, then pass the token it returns as `paymentToken`.
1390
+ *
1391
+ * A successful response doesn't mean the payment was collected. Always pass the returned `paymentResponseToken` to `paymentsApi.continuePayment()`. The widget then completes any step the payment provider still requires from the customer, such as 3D Secure verification or an off-site redirect, and does nothing when no step is needed.
1392
+ *
1393
+ * Either way, the order payment request's `status` is the authoritative outcome. It changes to `PAID` asynchronously, after the payment provider settles the transaction, which can happen after this method returns. To be notified, listen to the [Order Payment Request Paid](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-payment-requests/order-payment-request-paid) webhook, or poll [Get Order Payment Request](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-payment-requests/get-order-payment-request).
1394
+ *
1395
+ * Charging requires a client-side Wix Cashier payments session, so a backend-only integration can't obtain a `paymentToken` or complete a payment that needs an additional step.
1396
+ *
1397
+ * At most one charge attempt is processed per order payment request, so retrying is safe. While an attempt is still in progress, further calls fail with `PAYMENT_IN_PROGRESS`. Once the payment is collected, further calls fail with `CANNOT_CHARGE_PAID_ORDER_PAYMENT_REQUEST`. The customer isn't charged twice for the same order payment request.
1398
+ * @param orderPaymentRequestId - ID of the order payment request to charge.
1399
+ * @internal
1400
+ * @documentationMaturity preview
1401
+ * @requiredField orderPaymentRequestId
1402
+ * @permissionId ecom:v1:order_payment_request:charge_order_payment_request
1403
+ * @fqn wix.ecom.order_payment_request.api.v1.OrderPaymentRequestsService.ChargeOrderPaymentRequest
1404
+ */
1405
+ declare function chargeOrderPaymentRequest(orderPaymentRequestId: string, options?: ChargeOrderPaymentRequestOptions): Promise<ChargeOrderPaymentRequestResponse & {
1406
+ __applicationErrorsType?: ChargeOrderPaymentRequestApplicationErrors;
1407
+ }>;
1408
+ interface ChargeOrderPaymentRequestOptions {
1409
+ /**
1410
+ * Token representing the payment details the customer entered, including their card and payment provider. Obtain it by calling `paymentsApi.initializePayment()` on the `paymentsApi` object provided by the Wix Cashier payments client SDK. Valid for a single charge attempt.
1411
+ * @maxLength 100
1412
+ */
1413
+ paymentToken?: string | null;
1414
+ }
1301
1415
 
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 };
1416
+ 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 ChargeOrderPaymentRequestApplicationErrors, type ChargeOrderPaymentRequestOptions, type ChargeOrderPaymentRequestRequest, type ChargeOrderPaymentRequestResponse, 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, chargeOrderPaymentRequest, createOrderPaymentRequest, deleteOrderPaymentRequest, getOrderPaymentRequest, getOrderPaymentRequestUrl, onOrderPaymentRequestCreated, onOrderPaymentRequestDeleted, onOrderPaymentRequestExpired, onOrderPaymentRequestPaid, onOrderPaymentRequestUpdated, onOrderPaymentRequestVoided, queryOrderPaymentRequests, typedQueryOrderPaymentRequests, updateExtendedFields, updateOrderPaymentRequest, utils, voidOrderPaymentRequest };
@@ -25,6 +25,7 @@ __export(index_typings_exports, {
25
25
  Status: () => Status,
26
26
  WebhookIdentityType: () => WebhookIdentityType,
27
27
  bulkCreateOrderPaymentRequests: () => bulkCreateOrderPaymentRequests2,
28
+ chargeOrderPaymentRequest: () => chargeOrderPaymentRequest2,
28
29
  createOrderPaymentRequest: () => createOrderPaymentRequest2,
29
30
  deleteOrderPaymentRequest: () => deleteOrderPaymentRequest2,
30
31
  getOrderPaymentRequest: () => getOrderPaymentRequest2,
@@ -377,6 +378,25 @@ function voidOrderPaymentRequest(payload) {
377
378
  }
378
379
  return __voidOrderPaymentRequest;
379
380
  }
381
+ function chargeOrderPaymentRequest(payload) {
382
+ function __chargeOrderPaymentRequest({ host }) {
383
+ const metadata = {
384
+ entityFqdn: "wix.ecom.v1.order_payment_request",
385
+ method: "POST",
386
+ methodFqn: "wix.ecom.order_payment_request.api.v1.OrderPaymentRequestsService.ChargeOrderPaymentRequest",
387
+ packageName: PACKAGE_NAME,
388
+ migrationOptions: {
389
+ optInTransformResponse: true
390
+ },
391
+ url: resolveWixEcomOrderPaymentRequestApiV1OrderPaymentRequestsServiceUrl(
392
+ { protoPath: "/v1/order-payment-requests/charge", data: payload, host }
393
+ ),
394
+ data: payload
395
+ };
396
+ return metadata;
397
+ }
398
+ return __chargeOrderPaymentRequest;
399
+ }
380
400
 
381
401
  // src/ecom-v1-order-payment-request-order-payment-requests.universal.ts
382
402
  var import_image = require("@wix/sdk-runtime/transformations/image");
@@ -767,6 +787,35 @@ async function voidOrderPaymentRequest2(orderPaymentRequestId) {
767
787
  throw transformedError;
768
788
  }
769
789
  }
790
+ async function chargeOrderPaymentRequest2(orderPaymentRequestId, options) {
791
+ const { httpClient, sideEffects } = arguments[2];
792
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
793
+ orderPaymentRequestId,
794
+ paymentToken: options?.paymentToken
795
+ });
796
+ const reqOpts = chargeOrderPaymentRequest(payload);
797
+ sideEffects?.onSiteCall?.();
798
+ try {
799
+ const result = await httpClient.request(reqOpts);
800
+ sideEffects?.onSuccess?.(result);
801
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
802
+ } catch (err) {
803
+ const transformedError = (0, import_transform_error.transformError)(
804
+ err,
805
+ {
806
+ spreadPathsToArguments: {},
807
+ explicitPathsToArguments: {
808
+ orderPaymentRequestId: "$[0]",
809
+ paymentToken: "$[1].paymentToken"
810
+ },
811
+ singleArgumentUnchanged: false
812
+ },
813
+ ["orderPaymentRequestId", "options"]
814
+ );
815
+ sideEffects?.onError?.(err);
816
+ throw transformedError;
817
+ }
818
+ }
770
819
  // Annotate the CommonJS export names for ESM import in node:
771
820
  0 && (module.exports = {
772
821
  PaymentMethod,
@@ -774,6 +823,7 @@ async function voidOrderPaymentRequest2(orderPaymentRequestId) {
774
823
  Status,
775
824
  WebhookIdentityType,
776
825
  bulkCreateOrderPaymentRequests,
826
+ chargeOrderPaymentRequest,
777
827
  createOrderPaymentRequest,
778
828
  deleteOrderPaymentRequest,
779
829
  getOrderPaymentRequest,