@wix/auto_sdk_ecom_order-payment-requests 1.0.62 → 1.0.63

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 +50 -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 +45 -2
  8. package/build/cjs/meta.js +39 -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 +50 -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 +45 -2
  17. package/build/es/meta.mjs +38 -0
  18. package/build/es/meta.mjs.map +1 -1
  19. package/build/internal/cjs/index.d.ts +28 -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 +74 -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 +45 -2
  26. package/build/internal/cjs/meta.js +39 -0
  27. package/build/internal/cjs/meta.js.map +1 -1
  28. package/build/internal/es/index.d.mts +28 -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 +74 -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 +45 -2
  35. package/build/internal/es/meta.mjs +38 -0
  36. package/build/internal/es/meta.mjs.map +1 -1
  37. package/package.json +2 -2
@@ -458,6 +458,26 @@ interface VoidOrderPaymentRequestRequest {
458
458
  }
459
459
  interface VoidOrderPaymentRequestResponse {
460
460
  }
461
+ interface ChargeOrderPaymentRequestRequest {
462
+ /**
463
+ * ID of the order payment request to charge.
464
+ * @format GUID
465
+ */
466
+ orderPaymentRequestId: string;
467
+ /**
468
+ * 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.
469
+ * @maxLength 100
470
+ */
471
+ paymentToken?: string | null;
472
+ }
473
+ interface ChargeOrderPaymentRequestResponse {
474
+ /**
475
+ * Token for completing a payment that requires an additional step from the customer, such as 3D Secure verification or an off-site redirect. Returned only when such a step is required. Pass it to `paymentsApi.continuePayment()` in the Wix Cashier payments client SDK.
476
+ * @minLength 1
477
+ * @maxLength 1000
478
+ */
479
+ paymentResponseToken?: string | null;
480
+ }
461
481
  interface DomainEvent extends DomainEventBodyOneOf {
462
482
  createdEvent?: EntityCreatedEvent;
463
483
  updatedEvent?: EntityUpdatedEvent;
@@ -685,6 +705,28 @@ type VoidOrderPaymentRequestApplicationErrors = {
685
705
  description?: string;
686
706
  data?: Record<string, any>;
687
707
  };
708
+ /** @docsIgnore */
709
+ type ChargeOrderPaymentRequestApplicationErrors = {
710
+ code?: 'ORDER_PAYMENT_REQUEST_NOT_FOUND';
711
+ description?: string;
712
+ data?: Record<string, any>;
713
+ } | {
714
+ code?: 'CANNOT_CHARGE_PAID_ORDER_PAYMENT_REQUEST';
715
+ description?: string;
716
+ data?: Record<string, any>;
717
+ } | {
718
+ code?: 'CANNOT_CHARGE_EXPIRED_ORDER_PAYMENT_REQUEST';
719
+ description?: string;
720
+ data?: Record<string, any>;
721
+ } | {
722
+ code?: 'CANNOT_CHARGE_VOIDED_ORDER_PAYMENT_REQUEST';
723
+ description?: string;
724
+ data?: Record<string, any>;
725
+ } | {
726
+ code?: 'PAYMENT_IN_PROGRESS';
727
+ description?: string;
728
+ data?: Record<string, any>;
729
+ };
688
730
  interface BaseEventMetadata {
689
731
  /**
690
732
  * App instance ID.
@@ -1298,5 +1340,36 @@ interface UpdateExtendedFieldsOptions {
1298
1340
  declare function voidOrderPaymentRequest(orderPaymentRequestId: string): Promise<void & {
1299
1341
  __applicationErrorsType?: VoidOrderPaymentRequestApplicationErrors;
1300
1342
  }>;
1343
+ /**
1344
+ * Charges an order payment request.
1345
+ *
1346
+ * 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`.
1347
+ *
1348
+ * A successful response doesn't mean the payment was collected:
1349
+ * - If `paymentResponseToken` is returned, the customer must complete an additional step, such as 3D Secure verification or an off-site redirect. Pass the token to `paymentsApi.continuePayment()` to complete the payment.
1350
+ * - If `paymentResponseToken` isn't returned, no further step is needed. The payment was either collected or declined by the payment provider.
1351
+ *
1352
+ * 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).
1353
+ *
1354
+ * 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.
1355
+ *
1356
+ * 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.
1357
+ * @param orderPaymentRequestId - ID of the order payment request to charge.
1358
+ * @internal
1359
+ * @documentationMaturity preview
1360
+ * @requiredField orderPaymentRequestId
1361
+ * @permissionId ecom:v1:order_payment_request:charge_order_payment_request
1362
+ * @fqn wix.ecom.order_payment_request.api.v1.OrderPaymentRequestsService.ChargeOrderPaymentRequest
1363
+ */
1364
+ declare function chargeOrderPaymentRequest(orderPaymentRequestId: string, options?: ChargeOrderPaymentRequestOptions): Promise<ChargeOrderPaymentRequestResponse & {
1365
+ __applicationErrorsType?: ChargeOrderPaymentRequestApplicationErrors;
1366
+ }>;
1367
+ interface ChargeOrderPaymentRequestOptions {
1368
+ /**
1369
+ * 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.
1370
+ * @maxLength 100
1371
+ */
1372
+ paymentToken?: string | null;
1373
+ }
1301
1374
 
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 };
1375
+ 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 };
@@ -340,6 +340,25 @@ function voidOrderPaymentRequest(payload) {
340
340
  }
341
341
  return __voidOrderPaymentRequest;
342
342
  }
343
+ function chargeOrderPaymentRequest(payload) {
344
+ function __chargeOrderPaymentRequest({ host }) {
345
+ const metadata = {
346
+ entityFqdn: "wix.ecom.v1.order_payment_request",
347
+ method: "POST",
348
+ methodFqn: "wix.ecom.order_payment_request.api.v1.OrderPaymentRequestsService.ChargeOrderPaymentRequest",
349
+ packageName: PACKAGE_NAME,
350
+ migrationOptions: {
351
+ optInTransformResponse: true
352
+ },
353
+ url: resolveWixEcomOrderPaymentRequestApiV1OrderPaymentRequestsServiceUrl(
354
+ { protoPath: "/v1/order-payment-requests/charge", data: payload, host }
355
+ ),
356
+ data: payload
357
+ };
358
+ return metadata;
359
+ }
360
+ return __chargeOrderPaymentRequest;
361
+ }
343
362
 
344
363
  // src/ecom-v1-order-payment-request-order-payment-requests.universal.ts
345
364
  import { transformSDKImageToRESTImage } from "@wix/sdk-runtime/transformations/image";
@@ -730,12 +749,42 @@ async function voidOrderPaymentRequest2(orderPaymentRequestId) {
730
749
  throw transformedError;
731
750
  }
732
751
  }
752
+ async function chargeOrderPaymentRequest2(orderPaymentRequestId, options) {
753
+ const { httpClient, sideEffects } = arguments[2];
754
+ const payload = renameKeysFromSDKRequestToRESTRequest({
755
+ orderPaymentRequestId,
756
+ paymentToken: options?.paymentToken
757
+ });
758
+ const reqOpts = chargeOrderPaymentRequest(payload);
759
+ sideEffects?.onSiteCall?.();
760
+ try {
761
+ const result = await httpClient.request(reqOpts);
762
+ sideEffects?.onSuccess?.(result);
763
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
764
+ } catch (err) {
765
+ const transformedError = sdkTransformError(
766
+ err,
767
+ {
768
+ spreadPathsToArguments: {},
769
+ explicitPathsToArguments: {
770
+ orderPaymentRequestId: "$[0]",
771
+ paymentToken: "$[1].paymentToken"
772
+ },
773
+ singleArgumentUnchanged: false
774
+ },
775
+ ["orderPaymentRequestId", "options"]
776
+ );
777
+ sideEffects?.onError?.(err);
778
+ throw transformedError;
779
+ }
780
+ }
733
781
  export {
734
782
  PaymentMethod,
735
783
  SortOrder,
736
784
  Status,
737
785
  WebhookIdentityType,
738
786
  bulkCreateOrderPaymentRequests2 as bulkCreateOrderPaymentRequests,
787
+ chargeOrderPaymentRequest2 as chargeOrderPaymentRequest,
739
788
  createOrderPaymentRequest2 as createOrderPaymentRequest,
740
789
  deleteOrderPaymentRequest2 as deleteOrderPaymentRequest,
741
790
  getOrderPaymentRequest2 as getOrderPaymentRequest,