@wix/auto_sdk_payments_checkout-sessions 1.0.6 → 1.0.8
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.
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.typings.d.ts +2 -2
- package/build/cjs/index.typings.js.map +1 -1
- package/build/cjs/meta.d.ts +2 -2
- package/build/cjs/meta.js.map +1 -1
- package/build/es/index.mjs.map +1 -1
- package/build/es/index.typings.d.mts +2 -2
- package/build/es/index.typings.mjs.map +1 -1
- package/build/es/meta.d.mts +2 -2
- package/build/es/meta.mjs.map +1 -1
- package/build/internal/cjs/index.js.map +1 -1
- package/build/internal/cjs/index.typings.d.ts +2 -2
- package/build/internal/cjs/index.typings.js.map +1 -1
- package/build/internal/cjs/meta.d.ts +2 -2
- package/build/internal/cjs/meta.js.map +1 -1
- package/build/internal/es/index.mjs.map +1 -1
- package/build/internal/es/index.typings.d.mts +2 -2
- package/build/internal/es/index.typings.mjs.map +1 -1
- package/build/internal/es/meta.d.mts +2 -2
- package/build/internal/es/meta.mjs.map +1 -1
- package/package.json +4 -4
package/build/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.universal.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.http.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.public.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.context.ts"],"sourcesContent":["export * from './src/payments-platform-v1-checkout-session-checkout-sessions.context.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSession from './payments-platform-v1-checkout-session-checkout-sessions.http.js';\n\n/** A CheckoutSession is a simple entity used for demonstration purposes. */\nexport interface CheckoutSession {\n /**\n * Cart ID (from ecom cart service).\n * @readonly\n * @format GUID\n */\n _id?: string | null;\n /**\n * URL to redirect buyer.\n * @format WEB_URL\n */\n redirectUrl?: string | null;\n}\n\n/** Request to construct a checkout session. */\nexport interface ConstructCheckoutSessionRequest {\n /** Cart details including line items to be checked out. */\n cart: Cart;\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/** Subscription display and settings for a recurring line item. */\nexport interface SubscriptionInfo {\n /** Subscription settings such as frequency and billing cycles. */\n subscriptionSettings?: SubscriptionSettings;\n /**\n * Subscription title shown to the buyer.\n * @maxLength 150\n */\n title?: string | null;\n /**\n * Subscription description shown to the buyer.\n * @maxLength 500\n */\n description?: string | null;\n}\n\n/** Configuration for recurring subscription charges. */\nexport interface SubscriptionSettings {\n /** Frequency unit for recurring charges. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Number of frequency units between charges. Default: 1.\n * @min 1\n * @max 3650\n */\n interval?: number | null;\n /** Whether the subscription renews automatically. */\n autoRenewal?: boolean | null;\n /**\n * Number of billing cycles. If not provided and `auto_renewal` is not set, the subscription renews indefinitely.\n * @min 1\n */\n billingCycles?: number | null;\n /** Free trial period before the first charge. */\n freeTrialPeriod?: FreeTrialPeriod;\n}\n\n/** Frequency unit for subscription billing and trial periods. */\nexport enum SubscriptionFrequency {\n UNDEFINED = 'UNDEFINED',\n DAY = 'DAY',\n WEEK = 'WEEK',\n MONTH = 'MONTH',\n YEAR = 'YEAR',\n}\n\n/** @enumType */\nexport type SubscriptionFrequencyWithLiterals =\n | SubscriptionFrequency\n | 'UNDEFINED'\n | 'DAY'\n | 'WEEK'\n | 'MONTH'\n | 'YEAR';\n\n/** Free trial period before the first subscription charge. */\nexport interface FreeTrialPeriod {\n /** Frequency unit for the trial period. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Duration in frequency units (e.g., 14 with DAY = 14-day trial).\n * @min 1\n * @max 999\n */\n interval?: number;\n}\n\nexport interface LineItem {\n /**\n * Name or title of the item.\n * @minLength 1\n * @maxLength 255\n */\n name?: string | null;\n /**\n * Quantity of this item in the cart.\n * @min 1\n */\n quantity?: number | null;\n /**\n * Price of the item as a string (e.g., \"19.99\").\n * @minLength 1\n * @maxLength 50\n */\n price?: string | null;\n /** Optional. When provided, the item becomes a recurring subscription. */\n subscriptionInfo?: SubscriptionInfo;\n}\n\n/** Customer information for pre-filling checkout details. */\nexport interface CustomerInfo {\n /**\n * Customer's first name.\n * @maxLength 100\n */\n firstName?: string | null;\n /**\n * Customer's last name.\n * @maxLength 100\n */\n lastName?: string | null;\n /**\n * Customer's phone number.\n * @format PHONE\n */\n phone?: string | null;\n /**\n * Customer's email address.\n * @format EMAIL\n */\n email?: string | null;\n}\n\nexport interface Cart {\n /**\n * List of items in the cart.\n * @maxSize 100\n */\n items?: LineItem[];\n /** Optional customer information to pre-fill checkout form. */\n customerInfo?: CustomerInfo;\n}\n\nexport interface CallbackUrls {\n /**\n * URL to redirect after the checkout flow completes.\n * @format WEB_URL\n */\n postFlowUrl?: string | null;\n /**\n * URL for the thank you page after successful payment.\n * @format WEB_URL\n */\n thankYouPageUrl?: string | null;\n}\n\n/** Response after constructing a checkout session. */\nexport interface ConstructCheckoutSessionResponse {\n /** The constructed checkout session. */\n checkoutSession?: CheckoutSession;\n}\n\n/** Request to register a webhook URL. */\nexport interface RegisterCheckoutSessionWebhookRequest {\n /**\n * The URL to receive webhook notifications.\n * @format WEB_URL\n */\n url?: string | null;\n /**\n * Webhook event types to register. When empty, defaults to [ORDER_APPROVED].\n * @maxSize 10\n */\n webhookTypes?: WebhookTypeWithLiterals[];\n}\n\n/** Type of webhook event to register. */\nexport enum WebhookType {\n /** Registers wix.ecom.v1.order_approved webhook. */\n ORDER_APPROVED = 'ORDER_APPROVED',\n /** Registers wix.billing.v1.subscription_canceled webhook. */\n SUBSCRIPTION_CANCELED = 'SUBSCRIPTION_CANCELED',\n /** Registers wix.billing.v1.subscription_ended webhook. */\n SUBSCRIPTION_ENDED = 'SUBSCRIPTION_ENDED',\n}\n\n/** @enumType */\nexport type WebhookTypeWithLiterals =\n | WebhookType\n | 'ORDER_APPROVED'\n | 'SUBSCRIPTION_CANCELED'\n | 'SUBSCRIPTION_ENDED';\n\n/** Response after registering a webhook. */\nexport interface RegisterCheckoutSessionWebhookResponse {\n /**\n * The webhook public key used for verifying webhook payloads.\n * @maxLength 1000\n */\n publicKey?: string | null;\n}\n\n/**\n * Constructs a new checkout session.\n * @param cart - Cart details including line items to be checked out.\n * @public\n * @documentationMaturity preview\n * @requiredField cart\n * @requiredField cart.items\n * @requiredField cart.items.name\n * @requiredField cart.items.price\n * @requiredField cart.items.quantity\n * @requiredField options\n * @requiredField options.callbackUrls\n * @requiredField options.callbackUrls.postFlowUrl\n * @requiredField options.callbackUrls.thankYouPageUrl\n * @permissionId payments:platform:v1:checkout_session:construct_checkout_session\n * @returns Response after constructing a checkout session.\n * @fqn wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession\n */\nexport async function constructCheckoutSession(\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n): Promise<ConstructCheckoutSessionResponse> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n cart: cart,\n callbackUrls: options?.callbackUrls,\n });\n\n const reqOpts =\n ambassadorWixPaymentsPlatformV1CheckoutSession.constructCheckoutSession(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n cart: '$[0]',\n callbackUrls: '$[1].callbackUrls',\n },\n singleArgumentUnchanged: false,\n },\n ['cart', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface ConstructCheckoutSessionOptions {\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixPaymentsPlatformV1CheckoutSessionsUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/payments/platform/v1/checkout-sessions',\n destPath: '/v1/checkout-sessions',\n },\n {\n srcPath: '/payments/base44/v1/subscriptions',\n destPath: '/v1/subscriptions',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_payments_checkout-sessions';\n\n/** Constructs a new checkout session. */\nexport function constructCheckoutSession(\n payload: object\n): RequestOptionsFactory<any> {\n function __constructCheckoutSession({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.payments.platform.v1.checkout_session',\n method: 'POST' as any,\n methodFqn:\n 'wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/construct',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __constructCheckoutSession;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n Cart,\n ConstructCheckoutSessionOptions,\n ConstructCheckoutSessionResponse,\n constructCheckoutSession as universalConstructCheckoutSession,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/payments' };\n\nexport function constructCheckoutSession(\n httpClient: HttpClient\n): ConstructCheckoutSessionSignature {\n return (\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n ) =>\n universalConstructCheckoutSession(\n cart,\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface ConstructCheckoutSessionSignature {\n /**\n * Constructs a new checkout session.\n * @param - Cart details including line items to be checked out.\n * @returns Response after constructing a checkout session.\n */\n (\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n ): Promise<ConstructCheckoutSessionResponse>;\n}\n\nexport {\n CallbackUrls,\n Cart,\n CheckoutSession,\n ConstructCheckoutSessionOptions,\n ConstructCheckoutSessionRequest,\n ConstructCheckoutSessionResponse,\n CustomerInfo,\n FreeTrialPeriod,\n LineItem,\n RegisterCheckoutSessionWebhookRequest,\n RegisterCheckoutSessionWebhookResponse,\n SubscriptionFrequency,\n SubscriptionInfo,\n SubscriptionSettings,\n WebhookType,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n","import { constructCheckoutSession as publicConstructCheckoutSession } from './payments-platform-v1-checkout-session-checkout-sessions.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const constructCheckoutSession: MaybeContext<\n BuildRESTFunction<typeof publicConstructCheckoutSession> &\n typeof publicConstructCheckoutSession\n> = /*#__PURE__*/ createRESTModule(publicConstructCheckoutSession);\n\nexport {\n SubscriptionFrequency,\n WebhookType,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\nexport {\n CheckoutSession,\n ConstructCheckoutSessionRequest,\n SubscriptionInfo,\n SubscriptionSettings,\n FreeTrialPeriod,\n LineItem,\n CustomerInfo,\n Cart,\n CallbackUrls,\n ConstructCheckoutSessionResponse,\n RegisterCheckoutSessionWebhookRequest,\n RegisterCheckoutSessionWebhookResponse,\n ConstructCheckoutSessionOptions,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\nexport {\n SubscriptionFrequencyWithLiterals,\n WebhookTypeWithLiterals,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA,kCAAAA;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAGO;;;ACJP,0BAA2B;AAI3B,SAAS,gDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,gCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAGd,SAAS,yBACd,SAC4B;AAC5B,WAAS,2BAA2B,EAAE,KAAK,GAAQ;AACjD,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,gDAAgD;AAAA,QACnD,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ADkBO,IAAK,wBAAL,kBAAKC,2BAAL;AACL,EAAAA,uBAAA,eAAY;AACZ,EAAAA,uBAAA,SAAM;AACN,EAAAA,uBAAA,UAAO;AACP,EAAAA,uBAAA,WAAQ;AACR,EAAAA,uBAAA,UAAO;AALG,SAAAA;AAAA,GAAA;AAuHL,IAAK,cAAL,kBAAKC,iBAAL;AAEL,EAAAA,aAAA,oBAAiB;AAEjB,EAAAA,aAAA,2BAAwB;AAExB,EAAAA,aAAA,wBAAqB;AANX,SAAAA;AAAA,GAAA;AA2CZ,eAAsBC,0BACpB,MAQA,SAO2C;AAE3C,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,cAAU,qEAAsC;AAAA,IACpD;AAAA,IACA,cAAc,SAAS;AAAA,EACzB,CAAC;AAED,QAAM,UAC2C;AAAA,IAC7C;AAAA,EACF;AAEF,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,eAAO,uEAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAC;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,MAAM;AAAA,UACN,cAAc;AAAA,QAChB;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,QAAQ,SAAS;AAAA,IACpB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;;;AErRO,SAASC,0BACd,YACmC;AACnC,SAAO,CACL,MAQA,YAQAA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;ACnCA,IAAAC,uBAAiC;AAG1B,IAAMC,4BAGK,2DAAiBA,yBAA8B;","names":["constructCheckoutSession","SubscriptionFrequency","WebhookType","constructCheckoutSession","sdkTransformError","constructCheckoutSession","import_rest_modules","constructCheckoutSession"]}
|
|
1
|
+
{"version":3,"sources":["../../index.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.universal.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.http.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.public.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.context.ts"],"sourcesContent":["export * from './src/payments-platform-v1-checkout-session-checkout-sessions.context.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSession from './payments-platform-v1-checkout-session-checkout-sessions.http.js';\n\n/** A CheckoutSession is a simple entity used for demonstration purposes. */\nexport interface CheckoutSession {\n /**\n * Cart ID (from ecom cart service).\n * @readonly\n * @format GUID\n */\n _id?: string | null;\n /**\n * URL to redirect buyer.\n * @format WEB_URL\n */\n redirectUrl?: string | null;\n}\n\n/** Request to construct a checkout session. */\nexport interface ConstructCheckoutSessionRequest {\n /** Cart details including line items to be checked out. */\n cart: Cart;\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/** Subscription display and settings for a recurring line item. */\nexport interface SubscriptionInfo {\n /** Subscription settings such as frequency and billing cycles. */\n subscriptionSettings?: SubscriptionSettings;\n /**\n * Subscription title shown to the buyer.\n * @maxLength 150\n */\n title?: string | null;\n /**\n * Subscription description shown to the buyer.\n * @maxLength 500\n */\n description?: string | null;\n}\n\n/** Configuration for recurring subscription charges. */\nexport interface SubscriptionSettings {\n /** Frequency unit for recurring charges. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Number of frequency units between charges. Default: 1.\n * @min 1\n * @max 3650\n */\n interval?: number | null;\n /** Whether the subscription renews automatically. */\n autoRenewal?: boolean | null;\n /**\n * Number of billing cycles. If not provided and `auto_renewal` is not set, the subscription renews indefinitely.\n * @min 1\n */\n billingCycles?: number | null;\n /** Free trial period before the first charge. */\n freeTrialPeriod?: FreeTrialPeriod;\n}\n\n/** Frequency unit for subscription billing and trial periods. */\nexport enum SubscriptionFrequency {\n UNDEFINED = 'UNDEFINED',\n DAY = 'DAY',\n WEEK = 'WEEK',\n MONTH = 'MONTH',\n YEAR = 'YEAR',\n}\n\n/** @enumType */\nexport type SubscriptionFrequencyWithLiterals =\n | SubscriptionFrequency\n | 'UNDEFINED'\n | 'DAY'\n | 'WEEK'\n | 'MONTH'\n | 'YEAR';\n\n/** Free trial period before the first subscription charge. */\nexport interface FreeTrialPeriod {\n /** Frequency unit for the trial period. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Duration in frequency units (e.g., 14 with DAY = 14-day trial).\n * @min 1\n * @max 999\n */\n interval?: number;\n}\n\nexport interface LineItem {\n /**\n * Name or title of the item.\n * @minLength 1\n * @maxLength 255\n */\n name?: string | null;\n /**\n * Quantity of this item in the cart.\n * @min 1\n */\n quantity?: number | null;\n /**\n * Price of the item as a string (e.g., \"19.99\").\n * @minLength 1\n * @maxLength 50\n */\n price?: string | null;\n /** Optional. When provided, the item becomes a recurring subscription. */\n subscriptionInfo?: SubscriptionInfo;\n}\n\n/** Customer information for pre-filling checkout details. */\nexport interface CustomerInfo {\n /**\n * Customer's first name.\n * @maxLength 100\n */\n firstName?: string | null;\n /**\n * Customer's last name.\n * @maxLength 100\n */\n lastName?: string | null;\n /**\n * Customer's phone number.\n * @format PHONE\n */\n phone?: string | null;\n /**\n * Customer's email address.\n * @format EMAIL\n */\n email?: string | null;\n}\n\nexport interface Cart {\n /**\n * List of items in the cart.\n * @maxSize 100\n */\n items?: LineItem[];\n /** Optional customer information to pre-fill checkout form. */\n customerInfo?: CustomerInfo;\n}\n\nexport interface CallbackUrls {\n /**\n * URL to redirect after the checkout flow completes.\n * @format WEB_URL\n */\n postFlowUrl?: string | null;\n /**\n * URL for the thank you page after successful payment.\n * @format WEB_URL\n */\n thankYouPageUrl?: string | null;\n}\n\n/** Response after constructing a checkout session. */\nexport interface ConstructCheckoutSessionResponse {\n /** The constructed checkout session. */\n checkoutSession?: CheckoutSession;\n}\n\n/** Request to register a webhook URL. */\nexport interface RegisterCheckoutSessionWebhookRequest {\n /**\n * The URL to receive webhook notifications.\n * @format WEB_URL\n */\n url?: string | null;\n /**\n * Webhook event types to register. When empty, defaults to [ORDER_APPROVED].\n * @maxSize 10\n */\n webhookTypes?: WebhookTypeWithLiterals[];\n}\n\n/** Type of webhook event to register. */\nexport enum WebhookType {\n /** Registers wix.ecom.v1.order_approved webhook. */\n ORDER_APPROVED = 'ORDER_APPROVED',\n /** Registers wix.ecom.subscription_contracts.v1.subscription_contract_canceled webhook. */\n SUBSCRIPTION_CANCELED = 'SUBSCRIPTION_CANCELED',\n /** Registers wix.ecom.subscription_contracts.v1.subscription_contract_expired webhook. */\n SUBSCRIPTION_ENDED = 'SUBSCRIPTION_ENDED',\n}\n\n/** @enumType */\nexport type WebhookTypeWithLiterals =\n | WebhookType\n | 'ORDER_APPROVED'\n | 'SUBSCRIPTION_CANCELED'\n | 'SUBSCRIPTION_ENDED';\n\n/** Response after registering a webhook. */\nexport interface RegisterCheckoutSessionWebhookResponse {\n /**\n * The webhook public key used for verifying webhook payloads.\n * @maxLength 1000\n */\n publicKey?: string | null;\n}\n\n/**\n * Constructs a new checkout session.\n * @param cart - Cart details including line items to be checked out.\n * @public\n * @documentationMaturity preview\n * @requiredField cart\n * @requiredField cart.items\n * @requiredField cart.items.name\n * @requiredField cart.items.price\n * @requiredField cart.items.quantity\n * @requiredField options\n * @requiredField options.callbackUrls\n * @requiredField options.callbackUrls.postFlowUrl\n * @requiredField options.callbackUrls.thankYouPageUrl\n * @permissionId payments:platform:v1:checkout_session:construct_checkout_session\n * @returns Response after constructing a checkout session.\n * @fqn wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession\n */\nexport async function constructCheckoutSession(\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n): Promise<ConstructCheckoutSessionResponse> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n cart: cart,\n callbackUrls: options?.callbackUrls,\n });\n\n const reqOpts =\n ambassadorWixPaymentsPlatformV1CheckoutSession.constructCheckoutSession(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n cart: '$[0]',\n callbackUrls: '$[1].callbackUrls',\n },\n singleArgumentUnchanged: false,\n },\n ['cart', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface ConstructCheckoutSessionOptions {\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixPaymentsPlatformV1CheckoutSessionsUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/payments/platform/v1/checkout-sessions',\n destPath: '/v1/checkout-sessions',\n },\n {\n srcPath: '/payments/base44/v1/subscriptions',\n destPath: '/v1/subscriptions',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_payments_checkout-sessions';\n\n/** Constructs a new checkout session. */\nexport function constructCheckoutSession(\n payload: object\n): RequestOptionsFactory<any> {\n function __constructCheckoutSession({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.payments.platform.v1.checkout_session',\n method: 'POST' as any,\n methodFqn:\n 'wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/construct',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __constructCheckoutSession;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n Cart,\n ConstructCheckoutSessionOptions,\n ConstructCheckoutSessionResponse,\n constructCheckoutSession as universalConstructCheckoutSession,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/payments' };\n\nexport function constructCheckoutSession(\n httpClient: HttpClient\n): ConstructCheckoutSessionSignature {\n return (\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n ) =>\n universalConstructCheckoutSession(\n cart,\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface ConstructCheckoutSessionSignature {\n /**\n * Constructs a new checkout session.\n * @param - Cart details including line items to be checked out.\n * @returns Response after constructing a checkout session.\n */\n (\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n ): Promise<ConstructCheckoutSessionResponse>;\n}\n\nexport {\n CallbackUrls,\n Cart,\n CheckoutSession,\n ConstructCheckoutSessionOptions,\n ConstructCheckoutSessionRequest,\n ConstructCheckoutSessionResponse,\n CustomerInfo,\n FreeTrialPeriod,\n LineItem,\n RegisterCheckoutSessionWebhookRequest,\n RegisterCheckoutSessionWebhookResponse,\n SubscriptionFrequency,\n SubscriptionInfo,\n SubscriptionSettings,\n WebhookType,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n","import { constructCheckoutSession as publicConstructCheckoutSession } from './payments-platform-v1-checkout-session-checkout-sessions.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const constructCheckoutSession: MaybeContext<\n BuildRESTFunction<typeof publicConstructCheckoutSession> &\n typeof publicConstructCheckoutSession\n> = /*#__PURE__*/ createRESTModule(publicConstructCheckoutSession);\n\nexport {\n SubscriptionFrequency,\n WebhookType,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\nexport {\n CheckoutSession,\n ConstructCheckoutSessionRequest,\n SubscriptionInfo,\n SubscriptionSettings,\n FreeTrialPeriod,\n LineItem,\n CustomerInfo,\n Cart,\n CallbackUrls,\n ConstructCheckoutSessionResponse,\n RegisterCheckoutSessionWebhookRequest,\n RegisterCheckoutSessionWebhookResponse,\n ConstructCheckoutSessionOptions,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\nexport {\n SubscriptionFrequencyWithLiterals,\n WebhookTypeWithLiterals,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA,kCAAAA;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAGO;;;ACJP,0BAA2B;AAI3B,SAAS,gDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,gCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAGd,SAAS,yBACd,SAC4B;AAC5B,WAAS,2BAA2B,EAAE,KAAK,GAAQ;AACjD,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,gDAAgD;AAAA,QACnD,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ADkBO,IAAK,wBAAL,kBAAKC,2BAAL;AACL,EAAAA,uBAAA,eAAY;AACZ,EAAAA,uBAAA,SAAM;AACN,EAAAA,uBAAA,UAAO;AACP,EAAAA,uBAAA,WAAQ;AACR,EAAAA,uBAAA,UAAO;AALG,SAAAA;AAAA,GAAA;AAuHL,IAAK,cAAL,kBAAKC,iBAAL;AAEL,EAAAA,aAAA,oBAAiB;AAEjB,EAAAA,aAAA,2BAAwB;AAExB,EAAAA,aAAA,wBAAqB;AANX,SAAAA;AAAA,GAAA;AA2CZ,eAAsBC,0BACpB,MAQA,SAO2C;AAE3C,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,cAAU,qEAAsC;AAAA,IACpD;AAAA,IACA,cAAc,SAAS;AAAA,EACzB,CAAC;AAED,QAAM,UAC2C;AAAA,IAC7C;AAAA,EACF;AAEF,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,eAAO,uEAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAC;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,MAAM;AAAA,UACN,cAAc;AAAA,QAChB;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,QAAQ,SAAS;AAAA,IACpB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;;;AErRO,SAASC,0BACd,YACmC;AACnC,SAAO,CACL,MAQA,YAQAA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;ACnCA,IAAAC,uBAAiC;AAG1B,IAAMC,4BAGK,2DAAiBA,yBAA8B;","names":["constructCheckoutSession","SubscriptionFrequency","WebhookType","constructCheckoutSession","sdkTransformError","constructCheckoutSession","import_rest_modules","constructCheckoutSession"]}
|
|
@@ -164,9 +164,9 @@ interface RegisterCheckoutSessionWebhookRequest {
|
|
|
164
164
|
declare enum WebhookType {
|
|
165
165
|
/** Registers wix.ecom.v1.order_approved webhook. */
|
|
166
166
|
ORDER_APPROVED = "ORDER_APPROVED",
|
|
167
|
-
/** Registers wix.
|
|
167
|
+
/** Registers wix.ecom.subscription_contracts.v1.subscription_contract_canceled webhook. */
|
|
168
168
|
SUBSCRIPTION_CANCELED = "SUBSCRIPTION_CANCELED",
|
|
169
|
-
/** Registers wix.
|
|
169
|
+
/** Registers wix.ecom.subscription_contracts.v1.subscription_contract_expired webhook. */
|
|
170
170
|
SUBSCRIPTION_ENDED = "SUBSCRIPTION_ENDED"
|
|
171
171
|
}
|
|
172
172
|
/** @enumType */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.typings.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.universal.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.http.ts"],"sourcesContent":["export * from './src/payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSession from './payments-platform-v1-checkout-session-checkout-sessions.http.js';\n\n/** A CheckoutSession is a simple entity used for demonstration purposes. */\nexport interface CheckoutSession {\n /**\n * Cart ID (from ecom cart service).\n * @readonly\n * @format GUID\n */\n _id?: string | null;\n /**\n * URL to redirect buyer.\n * @format WEB_URL\n */\n redirectUrl?: string | null;\n}\n\n/** Request to construct a checkout session. */\nexport interface ConstructCheckoutSessionRequest {\n /** Cart details including line items to be checked out. */\n cart: Cart;\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/** Subscription display and settings for a recurring line item. */\nexport interface SubscriptionInfo {\n /** Subscription settings such as frequency and billing cycles. */\n subscriptionSettings?: SubscriptionSettings;\n /**\n * Subscription title shown to the buyer.\n * @maxLength 150\n */\n title?: string | null;\n /**\n * Subscription description shown to the buyer.\n * @maxLength 500\n */\n description?: string | null;\n}\n\n/** Configuration for recurring subscription charges. */\nexport interface SubscriptionSettings {\n /** Frequency unit for recurring charges. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Number of frequency units between charges. Default: 1.\n * @min 1\n * @max 3650\n */\n interval?: number | null;\n /** Whether the subscription renews automatically. */\n autoRenewal?: boolean | null;\n /**\n * Number of billing cycles. If not provided and `auto_renewal` is not set, the subscription renews indefinitely.\n * @min 1\n */\n billingCycles?: number | null;\n /** Free trial period before the first charge. */\n freeTrialPeriod?: FreeTrialPeriod;\n}\n\n/** Frequency unit for subscription billing and trial periods. */\nexport enum SubscriptionFrequency {\n UNDEFINED = 'UNDEFINED',\n DAY = 'DAY',\n WEEK = 'WEEK',\n MONTH = 'MONTH',\n YEAR = 'YEAR',\n}\n\n/** @enumType */\nexport type SubscriptionFrequencyWithLiterals =\n | SubscriptionFrequency\n | 'UNDEFINED'\n | 'DAY'\n | 'WEEK'\n | 'MONTH'\n | 'YEAR';\n\n/** Free trial period before the first subscription charge. */\nexport interface FreeTrialPeriod {\n /** Frequency unit for the trial period. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Duration in frequency units (e.g., 14 with DAY = 14-day trial).\n * @min 1\n * @max 999\n */\n interval?: number;\n}\n\nexport interface LineItem {\n /**\n * Name or title of the item.\n * @minLength 1\n * @maxLength 255\n */\n name?: string | null;\n /**\n * Quantity of this item in the cart.\n * @min 1\n */\n quantity?: number | null;\n /**\n * Price of the item as a string (e.g., \"19.99\").\n * @minLength 1\n * @maxLength 50\n */\n price?: string | null;\n /** Optional. When provided, the item becomes a recurring subscription. */\n subscriptionInfo?: SubscriptionInfo;\n}\n\n/** Customer information for pre-filling checkout details. */\nexport interface CustomerInfo {\n /**\n * Customer's first name.\n * @maxLength 100\n */\n firstName?: string | null;\n /**\n * Customer's last name.\n * @maxLength 100\n */\n lastName?: string | null;\n /**\n * Customer's phone number.\n * @format PHONE\n */\n phone?: string | null;\n /**\n * Customer's email address.\n * @format EMAIL\n */\n email?: string | null;\n}\n\nexport interface Cart {\n /**\n * List of items in the cart.\n * @maxSize 100\n */\n items?: LineItem[];\n /** Optional customer information to pre-fill checkout form. */\n customerInfo?: CustomerInfo;\n}\n\nexport interface CallbackUrls {\n /**\n * URL to redirect after the checkout flow completes.\n * @format WEB_URL\n */\n postFlowUrl?: string | null;\n /**\n * URL for the thank you page after successful payment.\n * @format WEB_URL\n */\n thankYouPageUrl?: string | null;\n}\n\n/** Response after constructing a checkout session. */\nexport interface ConstructCheckoutSessionResponse {\n /** The constructed checkout session. */\n checkoutSession?: CheckoutSession;\n}\n\n/** Request to register a webhook URL. */\nexport interface RegisterCheckoutSessionWebhookRequest {\n /**\n * The URL to receive webhook notifications.\n * @format WEB_URL\n */\n url?: string | null;\n /**\n * Webhook event types to register. When empty, defaults to [ORDER_APPROVED].\n * @maxSize 10\n */\n webhookTypes?: WebhookTypeWithLiterals[];\n}\n\n/** Type of webhook event to register. */\nexport enum WebhookType {\n /** Registers wix.ecom.v1.order_approved webhook. */\n ORDER_APPROVED = 'ORDER_APPROVED',\n /** Registers wix.billing.v1.subscription_canceled webhook. */\n SUBSCRIPTION_CANCELED = 'SUBSCRIPTION_CANCELED',\n /** Registers wix.billing.v1.subscription_ended webhook. */\n SUBSCRIPTION_ENDED = 'SUBSCRIPTION_ENDED',\n}\n\n/** @enumType */\nexport type WebhookTypeWithLiterals =\n | WebhookType\n | 'ORDER_APPROVED'\n | 'SUBSCRIPTION_CANCELED'\n | 'SUBSCRIPTION_ENDED';\n\n/** Response after registering a webhook. */\nexport interface RegisterCheckoutSessionWebhookResponse {\n /**\n * The webhook public key used for verifying webhook payloads.\n * @maxLength 1000\n */\n publicKey?: string | null;\n}\n\n/**\n * Constructs a new checkout session.\n * @param cart - Cart details including line items to be checked out.\n * @public\n * @documentationMaturity preview\n * @requiredField cart\n * @requiredField cart.items\n * @requiredField cart.items.name\n * @requiredField cart.items.price\n * @requiredField cart.items.quantity\n * @requiredField options\n * @requiredField options.callbackUrls\n * @requiredField options.callbackUrls.postFlowUrl\n * @requiredField options.callbackUrls.thankYouPageUrl\n * @permissionId payments:platform:v1:checkout_session:construct_checkout_session\n * @returns Response after constructing a checkout session.\n * @fqn wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession\n */\nexport async function constructCheckoutSession(\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n): Promise<ConstructCheckoutSessionResponse> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n cart: cart,\n callbackUrls: options?.callbackUrls,\n });\n\n const reqOpts =\n ambassadorWixPaymentsPlatformV1CheckoutSession.constructCheckoutSession(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n cart: '$[0]',\n callbackUrls: '$[1].callbackUrls',\n },\n singleArgumentUnchanged: false,\n },\n ['cart', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface ConstructCheckoutSessionOptions {\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixPaymentsPlatformV1CheckoutSessionsUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/payments/platform/v1/checkout-sessions',\n destPath: '/v1/checkout-sessions',\n },\n {\n srcPath: '/payments/base44/v1/subscriptions',\n destPath: '/v1/subscriptions',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_payments_checkout-sessions';\n\n/** Constructs a new checkout session. */\nexport function constructCheckoutSession(\n payload: object\n): RequestOptionsFactory<any> {\n function __constructCheckoutSession({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.payments.platform.v1.checkout_session',\n method: 'POST' as any,\n methodFqn:\n 'wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/construct',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __constructCheckoutSession;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA,kCAAAA;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAGO;;;ACJP,0BAA2B;AAI3B,SAAS,gDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,gCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAGd,SAAS,yBACd,SAC4B;AAC5B,WAAS,2BAA2B,EAAE,KAAK,GAAQ;AACjD,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,gDAAgD;AAAA,QACnD,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ADkBO,IAAK,wBAAL,kBAAKC,2BAAL;AACL,EAAAA,uBAAA,eAAY;AACZ,EAAAA,uBAAA,SAAM;AACN,EAAAA,uBAAA,UAAO;AACP,EAAAA,uBAAA,WAAQ;AACR,EAAAA,uBAAA,UAAO;AALG,SAAAA;AAAA,GAAA;AAuHL,IAAK,cAAL,kBAAKC,iBAAL;AAEL,EAAAA,aAAA,oBAAiB;AAEjB,EAAAA,aAAA,2BAAwB;AAExB,EAAAA,aAAA,wBAAqB;AANX,SAAAA;AAAA,GAAA;AA2CZ,eAAsBC,0BACpB,MAQA,SAO2C;AAE3C,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,cAAU,qEAAsC;AAAA,IACpD;AAAA,IACA,cAAc,SAAS;AAAA,EACzB,CAAC;AAED,QAAM,UAC2C;AAAA,IAC7C;AAAA,EACF;AAEF,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,eAAO,uEAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAC;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,MAAM;AAAA,UACN,cAAc;AAAA,QAChB;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,QAAQ,SAAS;AAAA,IACpB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["constructCheckoutSession","SubscriptionFrequency","WebhookType","constructCheckoutSession","sdkTransformError"]}
|
|
1
|
+
{"version":3,"sources":["../../index.typings.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.universal.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.http.ts"],"sourcesContent":["export * from './src/payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSession from './payments-platform-v1-checkout-session-checkout-sessions.http.js';\n\n/** A CheckoutSession is a simple entity used for demonstration purposes. */\nexport interface CheckoutSession {\n /**\n * Cart ID (from ecom cart service).\n * @readonly\n * @format GUID\n */\n _id?: string | null;\n /**\n * URL to redirect buyer.\n * @format WEB_URL\n */\n redirectUrl?: string | null;\n}\n\n/** Request to construct a checkout session. */\nexport interface ConstructCheckoutSessionRequest {\n /** Cart details including line items to be checked out. */\n cart: Cart;\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/** Subscription display and settings for a recurring line item. */\nexport interface SubscriptionInfo {\n /** Subscription settings such as frequency and billing cycles. */\n subscriptionSettings?: SubscriptionSettings;\n /**\n * Subscription title shown to the buyer.\n * @maxLength 150\n */\n title?: string | null;\n /**\n * Subscription description shown to the buyer.\n * @maxLength 500\n */\n description?: string | null;\n}\n\n/** Configuration for recurring subscription charges. */\nexport interface SubscriptionSettings {\n /** Frequency unit for recurring charges. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Number of frequency units between charges. Default: 1.\n * @min 1\n * @max 3650\n */\n interval?: number | null;\n /** Whether the subscription renews automatically. */\n autoRenewal?: boolean | null;\n /**\n * Number of billing cycles. If not provided and `auto_renewal` is not set, the subscription renews indefinitely.\n * @min 1\n */\n billingCycles?: number | null;\n /** Free trial period before the first charge. */\n freeTrialPeriod?: FreeTrialPeriod;\n}\n\n/** Frequency unit for subscription billing and trial periods. */\nexport enum SubscriptionFrequency {\n UNDEFINED = 'UNDEFINED',\n DAY = 'DAY',\n WEEK = 'WEEK',\n MONTH = 'MONTH',\n YEAR = 'YEAR',\n}\n\n/** @enumType */\nexport type SubscriptionFrequencyWithLiterals =\n | SubscriptionFrequency\n | 'UNDEFINED'\n | 'DAY'\n | 'WEEK'\n | 'MONTH'\n | 'YEAR';\n\n/** Free trial period before the first subscription charge. */\nexport interface FreeTrialPeriod {\n /** Frequency unit for the trial period. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Duration in frequency units (e.g., 14 with DAY = 14-day trial).\n * @min 1\n * @max 999\n */\n interval?: number;\n}\n\nexport interface LineItem {\n /**\n * Name or title of the item.\n * @minLength 1\n * @maxLength 255\n */\n name?: string | null;\n /**\n * Quantity of this item in the cart.\n * @min 1\n */\n quantity?: number | null;\n /**\n * Price of the item as a string (e.g., \"19.99\").\n * @minLength 1\n * @maxLength 50\n */\n price?: string | null;\n /** Optional. When provided, the item becomes a recurring subscription. */\n subscriptionInfo?: SubscriptionInfo;\n}\n\n/** Customer information for pre-filling checkout details. */\nexport interface CustomerInfo {\n /**\n * Customer's first name.\n * @maxLength 100\n */\n firstName?: string | null;\n /**\n * Customer's last name.\n * @maxLength 100\n */\n lastName?: string | null;\n /**\n * Customer's phone number.\n * @format PHONE\n */\n phone?: string | null;\n /**\n * Customer's email address.\n * @format EMAIL\n */\n email?: string | null;\n}\n\nexport interface Cart {\n /**\n * List of items in the cart.\n * @maxSize 100\n */\n items?: LineItem[];\n /** Optional customer information to pre-fill checkout form. */\n customerInfo?: CustomerInfo;\n}\n\nexport interface CallbackUrls {\n /**\n * URL to redirect after the checkout flow completes.\n * @format WEB_URL\n */\n postFlowUrl?: string | null;\n /**\n * URL for the thank you page after successful payment.\n * @format WEB_URL\n */\n thankYouPageUrl?: string | null;\n}\n\n/** Response after constructing a checkout session. */\nexport interface ConstructCheckoutSessionResponse {\n /** The constructed checkout session. */\n checkoutSession?: CheckoutSession;\n}\n\n/** Request to register a webhook URL. */\nexport interface RegisterCheckoutSessionWebhookRequest {\n /**\n * The URL to receive webhook notifications.\n * @format WEB_URL\n */\n url?: string | null;\n /**\n * Webhook event types to register. When empty, defaults to [ORDER_APPROVED].\n * @maxSize 10\n */\n webhookTypes?: WebhookTypeWithLiterals[];\n}\n\n/** Type of webhook event to register. */\nexport enum WebhookType {\n /** Registers wix.ecom.v1.order_approved webhook. */\n ORDER_APPROVED = 'ORDER_APPROVED',\n /** Registers wix.ecom.subscription_contracts.v1.subscription_contract_canceled webhook. */\n SUBSCRIPTION_CANCELED = 'SUBSCRIPTION_CANCELED',\n /** Registers wix.ecom.subscription_contracts.v1.subscription_contract_expired webhook. */\n SUBSCRIPTION_ENDED = 'SUBSCRIPTION_ENDED',\n}\n\n/** @enumType */\nexport type WebhookTypeWithLiterals =\n | WebhookType\n | 'ORDER_APPROVED'\n | 'SUBSCRIPTION_CANCELED'\n | 'SUBSCRIPTION_ENDED';\n\n/** Response after registering a webhook. */\nexport interface RegisterCheckoutSessionWebhookResponse {\n /**\n * The webhook public key used for verifying webhook payloads.\n * @maxLength 1000\n */\n publicKey?: string | null;\n}\n\n/**\n * Constructs a new checkout session.\n * @param cart - Cart details including line items to be checked out.\n * @public\n * @documentationMaturity preview\n * @requiredField cart\n * @requiredField cart.items\n * @requiredField cart.items.name\n * @requiredField cart.items.price\n * @requiredField cart.items.quantity\n * @requiredField options\n * @requiredField options.callbackUrls\n * @requiredField options.callbackUrls.postFlowUrl\n * @requiredField options.callbackUrls.thankYouPageUrl\n * @permissionId payments:platform:v1:checkout_session:construct_checkout_session\n * @returns Response after constructing a checkout session.\n * @fqn wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession\n */\nexport async function constructCheckoutSession(\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n): Promise<ConstructCheckoutSessionResponse> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n cart: cart,\n callbackUrls: options?.callbackUrls,\n });\n\n const reqOpts =\n ambassadorWixPaymentsPlatformV1CheckoutSession.constructCheckoutSession(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n cart: '$[0]',\n callbackUrls: '$[1].callbackUrls',\n },\n singleArgumentUnchanged: false,\n },\n ['cart', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface ConstructCheckoutSessionOptions {\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixPaymentsPlatformV1CheckoutSessionsUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/payments/platform/v1/checkout-sessions',\n destPath: '/v1/checkout-sessions',\n },\n {\n srcPath: '/payments/base44/v1/subscriptions',\n destPath: '/v1/subscriptions',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_payments_checkout-sessions';\n\n/** Constructs a new checkout session. */\nexport function constructCheckoutSession(\n payload: object\n): RequestOptionsFactory<any> {\n function __constructCheckoutSession({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.payments.platform.v1.checkout_session',\n method: 'POST' as any,\n methodFqn:\n 'wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/construct',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __constructCheckoutSession;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA,kCAAAA;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAGO;;;ACJP,0BAA2B;AAI3B,SAAS,gDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,gCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAGd,SAAS,yBACd,SAC4B;AAC5B,WAAS,2BAA2B,EAAE,KAAK,GAAQ;AACjD,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,gDAAgD;AAAA,QACnD,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ADkBO,IAAK,wBAAL,kBAAKC,2BAAL;AACL,EAAAA,uBAAA,eAAY;AACZ,EAAAA,uBAAA,SAAM;AACN,EAAAA,uBAAA,UAAO;AACP,EAAAA,uBAAA,WAAQ;AACR,EAAAA,uBAAA,UAAO;AALG,SAAAA;AAAA,GAAA;AAuHL,IAAK,cAAL,kBAAKC,iBAAL;AAEL,EAAAA,aAAA,oBAAiB;AAEjB,EAAAA,aAAA,2BAAwB;AAExB,EAAAA,aAAA,wBAAqB;AANX,SAAAA;AAAA,GAAA;AA2CZ,eAAsBC,0BACpB,MAQA,SAO2C;AAE3C,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,cAAU,qEAAsC;AAAA,IACpD;AAAA,IACA,cAAc,SAAS;AAAA,EACzB,CAAC;AAED,QAAM,UAC2C;AAAA,IAC7C;AAAA,EACF;AAEF,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,eAAO,uEAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAC;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,MAAM;AAAA,UACN,cAAc;AAAA,QAChB;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,QAAQ,SAAS;AAAA,IACpB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["constructCheckoutSession","SubscriptionFrequency","WebhookType","constructCheckoutSession","sdkTransformError"]}
|
package/build/cjs/meta.d.ts
CHANGED
|
@@ -165,9 +165,9 @@ interface RegisterCheckoutSessionWebhookRequest {
|
|
|
165
165
|
declare enum WebhookType {
|
|
166
166
|
/** Registers wix.ecom.v1.order_approved webhook. */
|
|
167
167
|
ORDER_APPROVED = "ORDER_APPROVED",
|
|
168
|
-
/** Registers wix.
|
|
168
|
+
/** Registers wix.ecom.subscription_contracts.v1.subscription_contract_canceled webhook. */
|
|
169
169
|
SUBSCRIPTION_CANCELED = "SUBSCRIPTION_CANCELED",
|
|
170
|
-
/** Registers wix.
|
|
170
|
+
/** Registers wix.ecom.subscription_contracts.v1.subscription_contract_expired webhook. */
|
|
171
171
|
SUBSCRIPTION_ENDED = "SUBSCRIPTION_ENDED"
|
|
172
172
|
}
|
|
173
173
|
/** @enumType */
|
package/build/cjs/meta.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../meta.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.http.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.types.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.meta.ts"],"sourcesContent":["export * from './src/payments-platform-v1-checkout-session-checkout-sessions.meta.js';\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixPaymentsPlatformV1CheckoutSessionsUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/payments/platform/v1/checkout-sessions',\n destPath: '/v1/checkout-sessions',\n },\n {\n srcPath: '/payments/base44/v1/subscriptions',\n destPath: '/v1/subscriptions',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_payments_checkout-sessions';\n\n/** Constructs a new checkout session. */\nexport function constructCheckoutSession(\n payload: object\n): RequestOptionsFactory<any> {\n function __constructCheckoutSession({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.payments.platform.v1.checkout_session',\n method: 'POST' as any,\n methodFqn:\n 'wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/construct',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __constructCheckoutSession;\n}\n","/** A CheckoutSession is a simple entity used for demonstration purposes. */\nexport interface CheckoutSession {\n /**\n * Cart ID (from ecom cart service).\n * @readonly\n * @format GUID\n */\n id?: string | null;\n /**\n * URL to redirect buyer.\n * @format WEB_URL\n */\n redirectUrl?: string | null;\n}\n\n/** Request to construct a checkout session. */\nexport interface ConstructCheckoutSessionRequest {\n /** Cart details including line items to be checked out. */\n cart: Cart;\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/** Subscription display and settings for a recurring line item. */\nexport interface SubscriptionInfo {\n /** Subscription settings such as frequency and billing cycles. */\n subscriptionSettings?: SubscriptionSettings;\n /**\n * Subscription title shown to the buyer.\n * @maxLength 150\n */\n title?: string | null;\n /**\n * Subscription description shown to the buyer.\n * @maxLength 500\n */\n description?: string | null;\n}\n\n/** Configuration for recurring subscription charges. */\nexport interface SubscriptionSettings {\n /** Frequency unit for recurring charges. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Number of frequency units between charges. Default: 1.\n * @min 1\n * @max 3650\n */\n interval?: number | null;\n /** Whether the subscription renews automatically. */\n autoRenewal?: boolean | null;\n /**\n * Number of billing cycles. If not provided and `auto_renewal` is not set, the subscription renews indefinitely.\n * @min 1\n */\n billingCycles?: number | null;\n /** Free trial period before the first charge. */\n freeTrialPeriod?: FreeTrialPeriod;\n}\n\n/** Frequency unit for subscription billing and trial periods. */\nexport enum SubscriptionFrequency {\n UNDEFINED = 'UNDEFINED',\n DAY = 'DAY',\n WEEK = 'WEEK',\n MONTH = 'MONTH',\n YEAR = 'YEAR',\n}\n\n/** @enumType */\nexport type SubscriptionFrequencyWithLiterals =\n | SubscriptionFrequency\n | 'UNDEFINED'\n | 'DAY'\n | 'WEEK'\n | 'MONTH'\n | 'YEAR';\n\n/** Free trial period before the first subscription charge. */\nexport interface FreeTrialPeriod {\n /** Frequency unit for the trial period. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Duration in frequency units (e.g., 14 with DAY = 14-day trial).\n * @min 1\n * @max 999\n */\n interval?: number;\n}\n\nexport interface LineItem {\n /**\n * Name or title of the item.\n * @minLength 1\n * @maxLength 255\n */\n name?: string | null;\n /**\n * Quantity of this item in the cart.\n * @min 1\n */\n quantity?: number | null;\n /**\n * Price of the item as a string (e.g., \"19.99\").\n * @minLength 1\n * @maxLength 50\n */\n price?: string | null;\n /** Optional. When provided, the item becomes a recurring subscription. */\n subscriptionInfo?: SubscriptionInfo;\n}\n\n/** Customer information for pre-filling checkout details. */\nexport interface CustomerInfo {\n /**\n * Customer's first name.\n * @maxLength 100\n */\n firstName?: string | null;\n /**\n * Customer's last name.\n * @maxLength 100\n */\n lastName?: string | null;\n /**\n * Customer's phone number.\n * @format PHONE\n */\n phone?: string | null;\n /**\n * Customer's email address.\n * @format EMAIL\n */\n email?: string | null;\n}\n\nexport interface Cart {\n /**\n * List of items in the cart.\n * @maxSize 100\n */\n items?: LineItem[];\n /** Optional customer information to pre-fill checkout form. */\n customerInfo?: CustomerInfo;\n}\n\nexport interface CallbackUrls {\n /**\n * URL to redirect after the checkout flow completes.\n * @format WEB_URL\n */\n postFlowUrl?: string | null;\n /**\n * URL for the thank you page after successful payment.\n * @format WEB_URL\n */\n thankYouPageUrl?: string | null;\n}\n\n/** Response after constructing a checkout session. */\nexport interface ConstructCheckoutSessionResponse {\n /** The constructed checkout session. */\n checkoutSession?: CheckoutSession;\n}\n\n/** Request to register a webhook URL. */\nexport interface RegisterCheckoutSessionWebhookRequest {\n /**\n * The URL to receive webhook notifications.\n * @format WEB_URL\n */\n url?: string | null;\n /**\n * Webhook event types to register. When empty, defaults to [ORDER_APPROVED].\n * @maxSize 10\n */\n webhookTypes?: WebhookTypeWithLiterals[];\n}\n\n/** Type of webhook event to register. */\nexport enum WebhookType {\n /** Registers wix.ecom.v1.order_approved webhook. */\n ORDER_APPROVED = 'ORDER_APPROVED',\n /** Registers wix.billing.v1.subscription_canceled webhook. */\n SUBSCRIPTION_CANCELED = 'SUBSCRIPTION_CANCELED',\n /** Registers wix.billing.v1.subscription_ended webhook. */\n SUBSCRIPTION_ENDED = 'SUBSCRIPTION_ENDED',\n}\n\n/** @enumType */\nexport type WebhookTypeWithLiterals =\n | WebhookType\n | 'ORDER_APPROVED'\n | 'SUBSCRIPTION_CANCELED'\n | 'SUBSCRIPTION_ENDED';\n\n/** Response after registering a webhook. */\nexport interface RegisterCheckoutSessionWebhookResponse {\n /**\n * The webhook public key used for verifying webhook payloads.\n * @maxLength 1000\n */\n publicKey?: string | null;\n}\n","import * as ambassadorWixPaymentsPlatformV1CheckoutSession from './payments-platform-v1-checkout-session-checkout-sessions.http.js';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSessionTypes from './payments-platform-v1-checkout-session-checkout-sessions.types.js';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n\nexport type __PublicMethodMetaInfo<\n K = string,\n M = unknown,\n T = unknown,\n S = unknown,\n Q = unknown,\n R = unknown\n> = {\n getUrl: (context: any) => string;\n httpMethod: K;\n path: string;\n pathParams: M;\n __requestType: T;\n __originalRequestType: S;\n __responseType: Q;\n __originalResponseType: R;\n};\n\nexport function constructCheckoutSession(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes.ConstructCheckoutSessionRequest,\n ambassadorWixPaymentsPlatformV1CheckoutSessionTypes.ConstructCheckoutSessionRequest,\n ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes.ConstructCheckoutSessionResponse,\n ambassadorWixPaymentsPlatformV1CheckoutSessionTypes.ConstructCheckoutSessionResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixPaymentsPlatformV1CheckoutSession.constructCheckoutSession(\n payload\n );\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v1/checkout-sessions/construct',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport {\n CheckoutSession as CheckoutSessionOriginal,\n ConstructCheckoutSessionRequest as ConstructCheckoutSessionRequestOriginal,\n SubscriptionInfo as SubscriptionInfoOriginal,\n SubscriptionSettings as SubscriptionSettingsOriginal,\n SubscriptionFrequency as SubscriptionFrequencyOriginal,\n SubscriptionFrequencyWithLiterals as SubscriptionFrequencyWithLiteralsOriginal,\n FreeTrialPeriod as FreeTrialPeriodOriginal,\n LineItem as LineItemOriginal,\n CustomerInfo as CustomerInfoOriginal,\n Cart as CartOriginal,\n CallbackUrls as CallbackUrlsOriginal,\n ConstructCheckoutSessionResponse as ConstructCheckoutSessionResponseOriginal,\n RegisterCheckoutSessionWebhookRequest as RegisterCheckoutSessionWebhookRequestOriginal,\n WebhookType as WebhookTypeOriginal,\n WebhookTypeWithLiterals as WebhookTypeWithLiteralsOriginal,\n RegisterCheckoutSessionWebhookResponse as RegisterCheckoutSessionWebhookResponseOriginal,\n} from './payments-platform-v1-checkout-session-checkout-sessions.types.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA,kCAAAA;AAAA;AAAA;;;ACAA,0BAA2B;AAI3B,SAAS,gDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,gCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAGd,SAAS,yBACd,SAC4B;AAC5B,WAAS,2BAA2B,EAAE,KAAK,GAAQ;AACjD,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,gDAAgD;AAAA,QACnD,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ACUO,IAAK,wBAAL,kBAAKC,2BAAL;AACL,EAAAA,uBAAA,eAAY;AACZ,EAAAA,uBAAA,SAAM;AACN,EAAAA,uBAAA,UAAO;AACP,EAAAA,uBAAA,WAAQ;AACR,EAAAA,uBAAA,UAAO;AALG,SAAAA;AAAA,GAAA;AAuHL,IAAK,cAAL,kBAAKC,iBAAL;AAEL,EAAAA,aAAA,oBAAiB;AAEjB,EAAAA,aAAA,2BAAwB;AAExB,EAAAA,aAAA,wBAAqB;AANX,SAAAA;AAAA,GAAA;;;AC9JL,SAASC,4BAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBAC2C;AAAA,IAC7C;AAAA,EACF;AAEF,QAAM,SAAS,CAAC,YAAyB;AACvC,UAAM,EAAE,IAAI,IAAI,kBAAkB,OAAO;AACzC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,YAAY,CAAC;AAAA,IACb,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;","names":["constructCheckoutSession","SubscriptionFrequency","WebhookType","constructCheckoutSession"]}
|
|
1
|
+
{"version":3,"sources":["../../meta.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.http.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.types.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.meta.ts"],"sourcesContent":["export * from './src/payments-platform-v1-checkout-session-checkout-sessions.meta.js';\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixPaymentsPlatformV1CheckoutSessionsUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/payments/platform/v1/checkout-sessions',\n destPath: '/v1/checkout-sessions',\n },\n {\n srcPath: '/payments/base44/v1/subscriptions',\n destPath: '/v1/subscriptions',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_payments_checkout-sessions';\n\n/** Constructs a new checkout session. */\nexport function constructCheckoutSession(\n payload: object\n): RequestOptionsFactory<any> {\n function __constructCheckoutSession({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.payments.platform.v1.checkout_session',\n method: 'POST' as any,\n methodFqn:\n 'wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/construct',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __constructCheckoutSession;\n}\n","/** A CheckoutSession is a simple entity used for demonstration purposes. */\nexport interface CheckoutSession {\n /**\n * Cart ID (from ecom cart service).\n * @readonly\n * @format GUID\n */\n id?: string | null;\n /**\n * URL to redirect buyer.\n * @format WEB_URL\n */\n redirectUrl?: string | null;\n}\n\n/** Request to construct a checkout session. */\nexport interface ConstructCheckoutSessionRequest {\n /** Cart details including line items to be checked out. */\n cart: Cart;\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/** Subscription display and settings for a recurring line item. */\nexport interface SubscriptionInfo {\n /** Subscription settings such as frequency and billing cycles. */\n subscriptionSettings?: SubscriptionSettings;\n /**\n * Subscription title shown to the buyer.\n * @maxLength 150\n */\n title?: string | null;\n /**\n * Subscription description shown to the buyer.\n * @maxLength 500\n */\n description?: string | null;\n}\n\n/** Configuration for recurring subscription charges. */\nexport interface SubscriptionSettings {\n /** Frequency unit for recurring charges. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Number of frequency units between charges. Default: 1.\n * @min 1\n * @max 3650\n */\n interval?: number | null;\n /** Whether the subscription renews automatically. */\n autoRenewal?: boolean | null;\n /**\n * Number of billing cycles. If not provided and `auto_renewal` is not set, the subscription renews indefinitely.\n * @min 1\n */\n billingCycles?: number | null;\n /** Free trial period before the first charge. */\n freeTrialPeriod?: FreeTrialPeriod;\n}\n\n/** Frequency unit for subscription billing and trial periods. */\nexport enum SubscriptionFrequency {\n UNDEFINED = 'UNDEFINED',\n DAY = 'DAY',\n WEEK = 'WEEK',\n MONTH = 'MONTH',\n YEAR = 'YEAR',\n}\n\n/** @enumType */\nexport type SubscriptionFrequencyWithLiterals =\n | SubscriptionFrequency\n | 'UNDEFINED'\n | 'DAY'\n | 'WEEK'\n | 'MONTH'\n | 'YEAR';\n\n/** Free trial period before the first subscription charge. */\nexport interface FreeTrialPeriod {\n /** Frequency unit for the trial period. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Duration in frequency units (e.g., 14 with DAY = 14-day trial).\n * @min 1\n * @max 999\n */\n interval?: number;\n}\n\nexport interface LineItem {\n /**\n * Name or title of the item.\n * @minLength 1\n * @maxLength 255\n */\n name?: string | null;\n /**\n * Quantity of this item in the cart.\n * @min 1\n */\n quantity?: number | null;\n /**\n * Price of the item as a string (e.g., \"19.99\").\n * @minLength 1\n * @maxLength 50\n */\n price?: string | null;\n /** Optional. When provided, the item becomes a recurring subscription. */\n subscriptionInfo?: SubscriptionInfo;\n}\n\n/** Customer information for pre-filling checkout details. */\nexport interface CustomerInfo {\n /**\n * Customer's first name.\n * @maxLength 100\n */\n firstName?: string | null;\n /**\n * Customer's last name.\n * @maxLength 100\n */\n lastName?: string | null;\n /**\n * Customer's phone number.\n * @format PHONE\n */\n phone?: string | null;\n /**\n * Customer's email address.\n * @format EMAIL\n */\n email?: string | null;\n}\n\nexport interface Cart {\n /**\n * List of items in the cart.\n * @maxSize 100\n */\n items?: LineItem[];\n /** Optional customer information to pre-fill checkout form. */\n customerInfo?: CustomerInfo;\n}\n\nexport interface CallbackUrls {\n /**\n * URL to redirect after the checkout flow completes.\n * @format WEB_URL\n */\n postFlowUrl?: string | null;\n /**\n * URL for the thank you page after successful payment.\n * @format WEB_URL\n */\n thankYouPageUrl?: string | null;\n}\n\n/** Response after constructing a checkout session. */\nexport interface ConstructCheckoutSessionResponse {\n /** The constructed checkout session. */\n checkoutSession?: CheckoutSession;\n}\n\n/** Request to register a webhook URL. */\nexport interface RegisterCheckoutSessionWebhookRequest {\n /**\n * The URL to receive webhook notifications.\n * @format WEB_URL\n */\n url?: string | null;\n /**\n * Webhook event types to register. When empty, defaults to [ORDER_APPROVED].\n * @maxSize 10\n */\n webhookTypes?: WebhookTypeWithLiterals[];\n}\n\n/** Type of webhook event to register. */\nexport enum WebhookType {\n /** Registers wix.ecom.v1.order_approved webhook. */\n ORDER_APPROVED = 'ORDER_APPROVED',\n /** Registers wix.ecom.subscription_contracts.v1.subscription_contract_canceled webhook. */\n SUBSCRIPTION_CANCELED = 'SUBSCRIPTION_CANCELED',\n /** Registers wix.ecom.subscription_contracts.v1.subscription_contract_expired webhook. */\n SUBSCRIPTION_ENDED = 'SUBSCRIPTION_ENDED',\n}\n\n/** @enumType */\nexport type WebhookTypeWithLiterals =\n | WebhookType\n | 'ORDER_APPROVED'\n | 'SUBSCRIPTION_CANCELED'\n | 'SUBSCRIPTION_ENDED';\n\n/** Response after registering a webhook. */\nexport interface RegisterCheckoutSessionWebhookResponse {\n /**\n * The webhook public key used for verifying webhook payloads.\n * @maxLength 1000\n */\n publicKey?: string | null;\n}\n","import * as ambassadorWixPaymentsPlatformV1CheckoutSession from './payments-platform-v1-checkout-session-checkout-sessions.http.js';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSessionTypes from './payments-platform-v1-checkout-session-checkout-sessions.types.js';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n\nexport type __PublicMethodMetaInfo<\n K = string,\n M = unknown,\n T = unknown,\n S = unknown,\n Q = unknown,\n R = unknown\n> = {\n getUrl: (context: any) => string;\n httpMethod: K;\n path: string;\n pathParams: M;\n __requestType: T;\n __originalRequestType: S;\n __responseType: Q;\n __originalResponseType: R;\n};\n\nexport function constructCheckoutSession(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes.ConstructCheckoutSessionRequest,\n ambassadorWixPaymentsPlatformV1CheckoutSessionTypes.ConstructCheckoutSessionRequest,\n ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes.ConstructCheckoutSessionResponse,\n ambassadorWixPaymentsPlatformV1CheckoutSessionTypes.ConstructCheckoutSessionResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixPaymentsPlatformV1CheckoutSession.constructCheckoutSession(\n payload\n );\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v1/checkout-sessions/construct',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport {\n CheckoutSession as CheckoutSessionOriginal,\n ConstructCheckoutSessionRequest as ConstructCheckoutSessionRequestOriginal,\n SubscriptionInfo as SubscriptionInfoOriginal,\n SubscriptionSettings as SubscriptionSettingsOriginal,\n SubscriptionFrequency as SubscriptionFrequencyOriginal,\n SubscriptionFrequencyWithLiterals as SubscriptionFrequencyWithLiteralsOriginal,\n FreeTrialPeriod as FreeTrialPeriodOriginal,\n LineItem as LineItemOriginal,\n CustomerInfo as CustomerInfoOriginal,\n Cart as CartOriginal,\n CallbackUrls as CallbackUrlsOriginal,\n ConstructCheckoutSessionResponse as ConstructCheckoutSessionResponseOriginal,\n RegisterCheckoutSessionWebhookRequest as RegisterCheckoutSessionWebhookRequestOriginal,\n WebhookType as WebhookTypeOriginal,\n WebhookTypeWithLiterals as WebhookTypeWithLiteralsOriginal,\n RegisterCheckoutSessionWebhookResponse as RegisterCheckoutSessionWebhookResponseOriginal,\n} from './payments-platform-v1-checkout-session-checkout-sessions.types.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA,kCAAAA;AAAA;AAAA;;;ACAA,0BAA2B;AAI3B,SAAS,gDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,gCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAGd,SAAS,yBACd,SAC4B;AAC5B,WAAS,2BAA2B,EAAE,KAAK,GAAQ;AACjD,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,gDAAgD;AAAA,QACnD,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ACUO,IAAK,wBAAL,kBAAKC,2BAAL;AACL,EAAAA,uBAAA,eAAY;AACZ,EAAAA,uBAAA,SAAM;AACN,EAAAA,uBAAA,UAAO;AACP,EAAAA,uBAAA,WAAQ;AACR,EAAAA,uBAAA,UAAO;AALG,SAAAA;AAAA,GAAA;AAuHL,IAAK,cAAL,kBAAKC,iBAAL;AAEL,EAAAA,aAAA,oBAAiB;AAEjB,EAAAA,aAAA,2BAAwB;AAExB,EAAAA,aAAA,wBAAqB;AANX,SAAAA;AAAA,GAAA;;;AC9JL,SAASC,4BAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBAC2C;AAAA,IAC7C;AAAA,EACF;AAEF,QAAM,SAAS,CAAC,YAAyB;AACvC,UAAM,EAAE,IAAI,IAAI,kBAAkB,OAAO;AACzC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,YAAY,CAAC;AAAA,IACb,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;","names":["constructCheckoutSession","SubscriptionFrequency","WebhookType","constructCheckoutSession"]}
|
package/build/es/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/payments-platform-v1-checkout-session-checkout-sessions.universal.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.http.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.public.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.context.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSession from './payments-platform-v1-checkout-session-checkout-sessions.http.js';\n\n/** A CheckoutSession is a simple entity used for demonstration purposes. */\nexport interface CheckoutSession {\n /**\n * Cart ID (from ecom cart service).\n * @readonly\n * @format GUID\n */\n _id?: string | null;\n /**\n * URL to redirect buyer.\n * @format WEB_URL\n */\n redirectUrl?: string | null;\n}\n\n/** Request to construct a checkout session. */\nexport interface ConstructCheckoutSessionRequest {\n /** Cart details including line items to be checked out. */\n cart: Cart;\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/** Subscription display and settings for a recurring line item. */\nexport interface SubscriptionInfo {\n /** Subscription settings such as frequency and billing cycles. */\n subscriptionSettings?: SubscriptionSettings;\n /**\n * Subscription title shown to the buyer.\n * @maxLength 150\n */\n title?: string | null;\n /**\n * Subscription description shown to the buyer.\n * @maxLength 500\n */\n description?: string | null;\n}\n\n/** Configuration for recurring subscription charges. */\nexport interface SubscriptionSettings {\n /** Frequency unit for recurring charges. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Number of frequency units between charges. Default: 1.\n * @min 1\n * @max 3650\n */\n interval?: number | null;\n /** Whether the subscription renews automatically. */\n autoRenewal?: boolean | null;\n /**\n * Number of billing cycles. If not provided and `auto_renewal` is not set, the subscription renews indefinitely.\n * @min 1\n */\n billingCycles?: number | null;\n /** Free trial period before the first charge. */\n freeTrialPeriod?: FreeTrialPeriod;\n}\n\n/** Frequency unit for subscription billing and trial periods. */\nexport enum SubscriptionFrequency {\n UNDEFINED = 'UNDEFINED',\n DAY = 'DAY',\n WEEK = 'WEEK',\n MONTH = 'MONTH',\n YEAR = 'YEAR',\n}\n\n/** @enumType */\nexport type SubscriptionFrequencyWithLiterals =\n | SubscriptionFrequency\n | 'UNDEFINED'\n | 'DAY'\n | 'WEEK'\n | 'MONTH'\n | 'YEAR';\n\n/** Free trial period before the first subscription charge. */\nexport interface FreeTrialPeriod {\n /** Frequency unit for the trial period. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Duration in frequency units (e.g., 14 with DAY = 14-day trial).\n * @min 1\n * @max 999\n */\n interval?: number;\n}\n\nexport interface LineItem {\n /**\n * Name or title of the item.\n * @minLength 1\n * @maxLength 255\n */\n name?: string | null;\n /**\n * Quantity of this item in the cart.\n * @min 1\n */\n quantity?: number | null;\n /**\n * Price of the item as a string (e.g., \"19.99\").\n * @minLength 1\n * @maxLength 50\n */\n price?: string | null;\n /** Optional. When provided, the item becomes a recurring subscription. */\n subscriptionInfo?: SubscriptionInfo;\n}\n\n/** Customer information for pre-filling checkout details. */\nexport interface CustomerInfo {\n /**\n * Customer's first name.\n * @maxLength 100\n */\n firstName?: string | null;\n /**\n * Customer's last name.\n * @maxLength 100\n */\n lastName?: string | null;\n /**\n * Customer's phone number.\n * @format PHONE\n */\n phone?: string | null;\n /**\n * Customer's email address.\n * @format EMAIL\n */\n email?: string | null;\n}\n\nexport interface Cart {\n /**\n * List of items in the cart.\n * @maxSize 100\n */\n items?: LineItem[];\n /** Optional customer information to pre-fill checkout form. */\n customerInfo?: CustomerInfo;\n}\n\nexport interface CallbackUrls {\n /**\n * URL to redirect after the checkout flow completes.\n * @format WEB_URL\n */\n postFlowUrl?: string | null;\n /**\n * URL for the thank you page after successful payment.\n * @format WEB_URL\n */\n thankYouPageUrl?: string | null;\n}\n\n/** Response after constructing a checkout session. */\nexport interface ConstructCheckoutSessionResponse {\n /** The constructed checkout session. */\n checkoutSession?: CheckoutSession;\n}\n\n/** Request to register a webhook URL. */\nexport interface RegisterCheckoutSessionWebhookRequest {\n /**\n * The URL to receive webhook notifications.\n * @format WEB_URL\n */\n url?: string | null;\n /**\n * Webhook event types to register. When empty, defaults to [ORDER_APPROVED].\n * @maxSize 10\n */\n webhookTypes?: WebhookTypeWithLiterals[];\n}\n\n/** Type of webhook event to register. */\nexport enum WebhookType {\n /** Registers wix.ecom.v1.order_approved webhook. */\n ORDER_APPROVED = 'ORDER_APPROVED',\n /** Registers wix.billing.v1.subscription_canceled webhook. */\n SUBSCRIPTION_CANCELED = 'SUBSCRIPTION_CANCELED',\n /** Registers wix.billing.v1.subscription_ended webhook. */\n SUBSCRIPTION_ENDED = 'SUBSCRIPTION_ENDED',\n}\n\n/** @enumType */\nexport type WebhookTypeWithLiterals =\n | WebhookType\n | 'ORDER_APPROVED'\n | 'SUBSCRIPTION_CANCELED'\n | 'SUBSCRIPTION_ENDED';\n\n/** Response after registering a webhook. */\nexport interface RegisterCheckoutSessionWebhookResponse {\n /**\n * The webhook public key used for verifying webhook payloads.\n * @maxLength 1000\n */\n publicKey?: string | null;\n}\n\n/**\n * Constructs a new checkout session.\n * @param cart - Cart details including line items to be checked out.\n * @public\n * @documentationMaturity preview\n * @requiredField cart\n * @requiredField cart.items\n * @requiredField cart.items.name\n * @requiredField cart.items.price\n * @requiredField cart.items.quantity\n * @requiredField options\n * @requiredField options.callbackUrls\n * @requiredField options.callbackUrls.postFlowUrl\n * @requiredField options.callbackUrls.thankYouPageUrl\n * @permissionId payments:platform:v1:checkout_session:construct_checkout_session\n * @returns Response after constructing a checkout session.\n * @fqn wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession\n */\nexport async function constructCheckoutSession(\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n): Promise<ConstructCheckoutSessionResponse> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n cart: cart,\n callbackUrls: options?.callbackUrls,\n });\n\n const reqOpts =\n ambassadorWixPaymentsPlatformV1CheckoutSession.constructCheckoutSession(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n cart: '$[0]',\n callbackUrls: '$[1].callbackUrls',\n },\n singleArgumentUnchanged: false,\n },\n ['cart', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface ConstructCheckoutSessionOptions {\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixPaymentsPlatformV1CheckoutSessionsUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/payments/platform/v1/checkout-sessions',\n destPath: '/v1/checkout-sessions',\n },\n {\n srcPath: '/payments/base44/v1/subscriptions',\n destPath: '/v1/subscriptions',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_payments_checkout-sessions';\n\n/** Constructs a new checkout session. */\nexport function constructCheckoutSession(\n payload: object\n): RequestOptionsFactory<any> {\n function __constructCheckoutSession({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.payments.platform.v1.checkout_session',\n method: 'POST' as any,\n methodFqn:\n 'wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/construct',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __constructCheckoutSession;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n Cart,\n ConstructCheckoutSessionOptions,\n ConstructCheckoutSessionResponse,\n constructCheckoutSession as universalConstructCheckoutSession,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/payments' };\n\nexport function constructCheckoutSession(\n httpClient: HttpClient\n): ConstructCheckoutSessionSignature {\n return (\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n ) =>\n universalConstructCheckoutSession(\n cart,\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface ConstructCheckoutSessionSignature {\n /**\n * Constructs a new checkout session.\n * @param - Cart details including line items to be checked out.\n * @returns Response after constructing a checkout session.\n */\n (\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n ): Promise<ConstructCheckoutSessionResponse>;\n}\n\nexport {\n CallbackUrls,\n Cart,\n CheckoutSession,\n ConstructCheckoutSessionOptions,\n ConstructCheckoutSessionRequest,\n ConstructCheckoutSessionResponse,\n CustomerInfo,\n FreeTrialPeriod,\n LineItem,\n RegisterCheckoutSessionWebhookRequest,\n RegisterCheckoutSessionWebhookResponse,\n SubscriptionFrequency,\n SubscriptionInfo,\n SubscriptionSettings,\n WebhookType,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n","import { constructCheckoutSession as publicConstructCheckoutSession } from './payments-platform-v1-checkout-session-checkout-sessions.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const constructCheckoutSession: MaybeContext<\n BuildRESTFunction<typeof publicConstructCheckoutSession> &\n typeof publicConstructCheckoutSession\n> = /*#__PURE__*/ createRESTModule(publicConstructCheckoutSession);\n\nexport {\n SubscriptionFrequency,\n WebhookType,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\nexport {\n CheckoutSession,\n ConstructCheckoutSessionRequest,\n SubscriptionInfo,\n SubscriptionSettings,\n FreeTrialPeriod,\n LineItem,\n CustomerInfo,\n Cart,\n CallbackUrls,\n ConstructCheckoutSessionResponse,\n RegisterCheckoutSessionWebhookRequest,\n RegisterCheckoutSessionWebhookResponse,\n ConstructCheckoutSessionOptions,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\nexport {\n SubscriptionFrequencyWithLiterals,\n WebhookTypeWithLiterals,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,kBAAkB;AAI3B,SAAS,gDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAGd,SAAS,yBACd,SAC4B;AAC5B,WAAS,2BAA2B,EAAE,KAAK,GAAQ;AACjD,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,gDAAgD;AAAA,QACnD,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ADkBO,IAAK,wBAAL,kBAAKA,2BAAL;AACL,EAAAA,uBAAA,eAAY;AACZ,EAAAA,uBAAA,SAAM;AACN,EAAAA,uBAAA,UAAO;AACP,EAAAA,uBAAA,WAAQ;AACR,EAAAA,uBAAA,UAAO;AALG,SAAAA;AAAA,GAAA;AAuHL,IAAK,cAAL,kBAAKC,iBAAL;AAEL,EAAAA,aAAA,oBAAiB;AAEjB,EAAAA,aAAA,2BAAwB;AAExB,EAAAA,aAAA,wBAAqB;AANX,SAAAA;AAAA,GAAA;AA2CZ,eAAsBC,0BACpB,MAQA,SAO2C;AAE3C,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,UAAU,sCAAsC;AAAA,IACpD;AAAA,IACA,cAAc,SAAS;AAAA,EACzB,CAAC;AAED,QAAM,UAC2C;AAAA,IAC7C;AAAA,EACF;AAEF,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,WAAO,wCAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,mBAAmB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,MAAM;AAAA,UACN,cAAc;AAAA,QAChB;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,QAAQ,SAAS;AAAA,IACpB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;;;AErRO,SAASC,0BACd,YACmC;AACnC,SAAO,CACL,MAQA,YAQAA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;ACnCA,SAAS,wBAAwB;AAG1B,IAAMC,4BAGK,iCAAiBA,yBAA8B;","names":["SubscriptionFrequency","WebhookType","constructCheckoutSession","constructCheckoutSession","constructCheckoutSession"]}
|
|
1
|
+
{"version":3,"sources":["../../src/payments-platform-v1-checkout-session-checkout-sessions.universal.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.http.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.public.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.context.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSession from './payments-platform-v1-checkout-session-checkout-sessions.http.js';\n\n/** A CheckoutSession is a simple entity used for demonstration purposes. */\nexport interface CheckoutSession {\n /**\n * Cart ID (from ecom cart service).\n * @readonly\n * @format GUID\n */\n _id?: string | null;\n /**\n * URL to redirect buyer.\n * @format WEB_URL\n */\n redirectUrl?: string | null;\n}\n\n/** Request to construct a checkout session. */\nexport interface ConstructCheckoutSessionRequest {\n /** Cart details including line items to be checked out. */\n cart: Cart;\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/** Subscription display and settings for a recurring line item. */\nexport interface SubscriptionInfo {\n /** Subscription settings such as frequency and billing cycles. */\n subscriptionSettings?: SubscriptionSettings;\n /**\n * Subscription title shown to the buyer.\n * @maxLength 150\n */\n title?: string | null;\n /**\n * Subscription description shown to the buyer.\n * @maxLength 500\n */\n description?: string | null;\n}\n\n/** Configuration for recurring subscription charges. */\nexport interface SubscriptionSettings {\n /** Frequency unit for recurring charges. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Number of frequency units between charges. Default: 1.\n * @min 1\n * @max 3650\n */\n interval?: number | null;\n /** Whether the subscription renews automatically. */\n autoRenewal?: boolean | null;\n /**\n * Number of billing cycles. If not provided and `auto_renewal` is not set, the subscription renews indefinitely.\n * @min 1\n */\n billingCycles?: number | null;\n /** Free trial period before the first charge. */\n freeTrialPeriod?: FreeTrialPeriod;\n}\n\n/** Frequency unit for subscription billing and trial periods. */\nexport enum SubscriptionFrequency {\n UNDEFINED = 'UNDEFINED',\n DAY = 'DAY',\n WEEK = 'WEEK',\n MONTH = 'MONTH',\n YEAR = 'YEAR',\n}\n\n/** @enumType */\nexport type SubscriptionFrequencyWithLiterals =\n | SubscriptionFrequency\n | 'UNDEFINED'\n | 'DAY'\n | 'WEEK'\n | 'MONTH'\n | 'YEAR';\n\n/** Free trial period before the first subscription charge. */\nexport interface FreeTrialPeriod {\n /** Frequency unit for the trial period. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Duration in frequency units (e.g., 14 with DAY = 14-day trial).\n * @min 1\n * @max 999\n */\n interval?: number;\n}\n\nexport interface LineItem {\n /**\n * Name or title of the item.\n * @minLength 1\n * @maxLength 255\n */\n name?: string | null;\n /**\n * Quantity of this item in the cart.\n * @min 1\n */\n quantity?: number | null;\n /**\n * Price of the item as a string (e.g., \"19.99\").\n * @minLength 1\n * @maxLength 50\n */\n price?: string | null;\n /** Optional. When provided, the item becomes a recurring subscription. */\n subscriptionInfo?: SubscriptionInfo;\n}\n\n/** Customer information for pre-filling checkout details. */\nexport interface CustomerInfo {\n /**\n * Customer's first name.\n * @maxLength 100\n */\n firstName?: string | null;\n /**\n * Customer's last name.\n * @maxLength 100\n */\n lastName?: string | null;\n /**\n * Customer's phone number.\n * @format PHONE\n */\n phone?: string | null;\n /**\n * Customer's email address.\n * @format EMAIL\n */\n email?: string | null;\n}\n\nexport interface Cart {\n /**\n * List of items in the cart.\n * @maxSize 100\n */\n items?: LineItem[];\n /** Optional customer information to pre-fill checkout form. */\n customerInfo?: CustomerInfo;\n}\n\nexport interface CallbackUrls {\n /**\n * URL to redirect after the checkout flow completes.\n * @format WEB_URL\n */\n postFlowUrl?: string | null;\n /**\n * URL for the thank you page after successful payment.\n * @format WEB_URL\n */\n thankYouPageUrl?: string | null;\n}\n\n/** Response after constructing a checkout session. */\nexport interface ConstructCheckoutSessionResponse {\n /** The constructed checkout session. */\n checkoutSession?: CheckoutSession;\n}\n\n/** Request to register a webhook URL. */\nexport interface RegisterCheckoutSessionWebhookRequest {\n /**\n * The URL to receive webhook notifications.\n * @format WEB_URL\n */\n url?: string | null;\n /**\n * Webhook event types to register. When empty, defaults to [ORDER_APPROVED].\n * @maxSize 10\n */\n webhookTypes?: WebhookTypeWithLiterals[];\n}\n\n/** Type of webhook event to register. */\nexport enum WebhookType {\n /** Registers wix.ecom.v1.order_approved webhook. */\n ORDER_APPROVED = 'ORDER_APPROVED',\n /** Registers wix.ecom.subscription_contracts.v1.subscription_contract_canceled webhook. */\n SUBSCRIPTION_CANCELED = 'SUBSCRIPTION_CANCELED',\n /** Registers wix.ecom.subscription_contracts.v1.subscription_contract_expired webhook. */\n SUBSCRIPTION_ENDED = 'SUBSCRIPTION_ENDED',\n}\n\n/** @enumType */\nexport type WebhookTypeWithLiterals =\n | WebhookType\n | 'ORDER_APPROVED'\n | 'SUBSCRIPTION_CANCELED'\n | 'SUBSCRIPTION_ENDED';\n\n/** Response after registering a webhook. */\nexport interface RegisterCheckoutSessionWebhookResponse {\n /**\n * The webhook public key used for verifying webhook payloads.\n * @maxLength 1000\n */\n publicKey?: string | null;\n}\n\n/**\n * Constructs a new checkout session.\n * @param cart - Cart details including line items to be checked out.\n * @public\n * @documentationMaturity preview\n * @requiredField cart\n * @requiredField cart.items\n * @requiredField cart.items.name\n * @requiredField cart.items.price\n * @requiredField cart.items.quantity\n * @requiredField options\n * @requiredField options.callbackUrls\n * @requiredField options.callbackUrls.postFlowUrl\n * @requiredField options.callbackUrls.thankYouPageUrl\n * @permissionId payments:platform:v1:checkout_session:construct_checkout_session\n * @returns Response after constructing a checkout session.\n * @fqn wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession\n */\nexport async function constructCheckoutSession(\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n): Promise<ConstructCheckoutSessionResponse> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n cart: cart,\n callbackUrls: options?.callbackUrls,\n });\n\n const reqOpts =\n ambassadorWixPaymentsPlatformV1CheckoutSession.constructCheckoutSession(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n cart: '$[0]',\n callbackUrls: '$[1].callbackUrls',\n },\n singleArgumentUnchanged: false,\n },\n ['cart', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface ConstructCheckoutSessionOptions {\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixPaymentsPlatformV1CheckoutSessionsUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/payments/platform/v1/checkout-sessions',\n destPath: '/v1/checkout-sessions',\n },\n {\n srcPath: '/payments/base44/v1/subscriptions',\n destPath: '/v1/subscriptions',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_payments_checkout-sessions';\n\n/** Constructs a new checkout session. */\nexport function constructCheckoutSession(\n payload: object\n): RequestOptionsFactory<any> {\n function __constructCheckoutSession({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.payments.platform.v1.checkout_session',\n method: 'POST' as any,\n methodFqn:\n 'wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/construct',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __constructCheckoutSession;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n Cart,\n ConstructCheckoutSessionOptions,\n ConstructCheckoutSessionResponse,\n constructCheckoutSession as universalConstructCheckoutSession,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/payments' };\n\nexport function constructCheckoutSession(\n httpClient: HttpClient\n): ConstructCheckoutSessionSignature {\n return (\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n ) =>\n universalConstructCheckoutSession(\n cart,\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface ConstructCheckoutSessionSignature {\n /**\n * Constructs a new checkout session.\n * @param - Cart details including line items to be checked out.\n * @returns Response after constructing a checkout session.\n */\n (\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n ): Promise<ConstructCheckoutSessionResponse>;\n}\n\nexport {\n CallbackUrls,\n Cart,\n CheckoutSession,\n ConstructCheckoutSessionOptions,\n ConstructCheckoutSessionRequest,\n ConstructCheckoutSessionResponse,\n CustomerInfo,\n FreeTrialPeriod,\n LineItem,\n RegisterCheckoutSessionWebhookRequest,\n RegisterCheckoutSessionWebhookResponse,\n SubscriptionFrequency,\n SubscriptionInfo,\n SubscriptionSettings,\n WebhookType,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n","import { constructCheckoutSession as publicConstructCheckoutSession } from './payments-platform-v1-checkout-session-checkout-sessions.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const constructCheckoutSession: MaybeContext<\n BuildRESTFunction<typeof publicConstructCheckoutSession> &\n typeof publicConstructCheckoutSession\n> = /*#__PURE__*/ createRESTModule(publicConstructCheckoutSession);\n\nexport {\n SubscriptionFrequency,\n WebhookType,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\nexport {\n CheckoutSession,\n ConstructCheckoutSessionRequest,\n SubscriptionInfo,\n SubscriptionSettings,\n FreeTrialPeriod,\n LineItem,\n CustomerInfo,\n Cart,\n CallbackUrls,\n ConstructCheckoutSessionResponse,\n RegisterCheckoutSessionWebhookRequest,\n RegisterCheckoutSessionWebhookResponse,\n ConstructCheckoutSessionOptions,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\nexport {\n SubscriptionFrequencyWithLiterals,\n WebhookTypeWithLiterals,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,kBAAkB;AAI3B,SAAS,gDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAGd,SAAS,yBACd,SAC4B;AAC5B,WAAS,2BAA2B,EAAE,KAAK,GAAQ;AACjD,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,gDAAgD;AAAA,QACnD,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ADkBO,IAAK,wBAAL,kBAAKA,2BAAL;AACL,EAAAA,uBAAA,eAAY;AACZ,EAAAA,uBAAA,SAAM;AACN,EAAAA,uBAAA,UAAO;AACP,EAAAA,uBAAA,WAAQ;AACR,EAAAA,uBAAA,UAAO;AALG,SAAAA;AAAA,GAAA;AAuHL,IAAK,cAAL,kBAAKC,iBAAL;AAEL,EAAAA,aAAA,oBAAiB;AAEjB,EAAAA,aAAA,2BAAwB;AAExB,EAAAA,aAAA,wBAAqB;AANX,SAAAA;AAAA,GAAA;AA2CZ,eAAsBC,0BACpB,MAQA,SAO2C;AAE3C,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,UAAU,sCAAsC;AAAA,IACpD;AAAA,IACA,cAAc,SAAS;AAAA,EACzB,CAAC;AAED,QAAM,UAC2C;AAAA,IAC7C;AAAA,EACF;AAEF,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,WAAO,wCAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,mBAAmB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,MAAM;AAAA,UACN,cAAc;AAAA,QAChB;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,QAAQ,SAAS;AAAA,IACpB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;;;AErRO,SAASC,0BACd,YACmC;AACnC,SAAO,CACL,MAQA,YAQAA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;ACnCA,SAAS,wBAAwB;AAG1B,IAAMC,4BAGK,iCAAiBA,yBAA8B;","names":["SubscriptionFrequency","WebhookType","constructCheckoutSession","constructCheckoutSession","constructCheckoutSession"]}
|
|
@@ -164,9 +164,9 @@ interface RegisterCheckoutSessionWebhookRequest {
|
|
|
164
164
|
declare enum WebhookType {
|
|
165
165
|
/** Registers wix.ecom.v1.order_approved webhook. */
|
|
166
166
|
ORDER_APPROVED = "ORDER_APPROVED",
|
|
167
|
-
/** Registers wix.
|
|
167
|
+
/** Registers wix.ecom.subscription_contracts.v1.subscription_contract_canceled webhook. */
|
|
168
168
|
SUBSCRIPTION_CANCELED = "SUBSCRIPTION_CANCELED",
|
|
169
|
-
/** Registers wix.
|
|
169
|
+
/** Registers wix.ecom.subscription_contracts.v1.subscription_contract_expired webhook. */
|
|
170
170
|
SUBSCRIPTION_ENDED = "SUBSCRIPTION_ENDED"
|
|
171
171
|
}
|
|
172
172
|
/** @enumType */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/payments-platform-v1-checkout-session-checkout-sessions.universal.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.http.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSession from './payments-platform-v1-checkout-session-checkout-sessions.http.js';\n\n/** A CheckoutSession is a simple entity used for demonstration purposes. */\nexport interface CheckoutSession {\n /**\n * Cart ID (from ecom cart service).\n * @readonly\n * @format GUID\n */\n _id?: string | null;\n /**\n * URL to redirect buyer.\n * @format WEB_URL\n */\n redirectUrl?: string | null;\n}\n\n/** Request to construct a checkout session. */\nexport interface ConstructCheckoutSessionRequest {\n /** Cart details including line items to be checked out. */\n cart: Cart;\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/** Subscription display and settings for a recurring line item. */\nexport interface SubscriptionInfo {\n /** Subscription settings such as frequency and billing cycles. */\n subscriptionSettings?: SubscriptionSettings;\n /**\n * Subscription title shown to the buyer.\n * @maxLength 150\n */\n title?: string | null;\n /**\n * Subscription description shown to the buyer.\n * @maxLength 500\n */\n description?: string | null;\n}\n\n/** Configuration for recurring subscription charges. */\nexport interface SubscriptionSettings {\n /** Frequency unit for recurring charges. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Number of frequency units between charges. Default: 1.\n * @min 1\n * @max 3650\n */\n interval?: number | null;\n /** Whether the subscription renews automatically. */\n autoRenewal?: boolean | null;\n /**\n * Number of billing cycles. If not provided and `auto_renewal` is not set, the subscription renews indefinitely.\n * @min 1\n */\n billingCycles?: number | null;\n /** Free trial period before the first charge. */\n freeTrialPeriod?: FreeTrialPeriod;\n}\n\n/** Frequency unit for subscription billing and trial periods. */\nexport enum SubscriptionFrequency {\n UNDEFINED = 'UNDEFINED',\n DAY = 'DAY',\n WEEK = 'WEEK',\n MONTH = 'MONTH',\n YEAR = 'YEAR',\n}\n\n/** @enumType */\nexport type SubscriptionFrequencyWithLiterals =\n | SubscriptionFrequency\n | 'UNDEFINED'\n | 'DAY'\n | 'WEEK'\n | 'MONTH'\n | 'YEAR';\n\n/** Free trial period before the first subscription charge. */\nexport interface FreeTrialPeriod {\n /** Frequency unit for the trial period. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Duration in frequency units (e.g., 14 with DAY = 14-day trial).\n * @min 1\n * @max 999\n */\n interval?: number;\n}\n\nexport interface LineItem {\n /**\n * Name or title of the item.\n * @minLength 1\n * @maxLength 255\n */\n name?: string | null;\n /**\n * Quantity of this item in the cart.\n * @min 1\n */\n quantity?: number | null;\n /**\n * Price of the item as a string (e.g., \"19.99\").\n * @minLength 1\n * @maxLength 50\n */\n price?: string | null;\n /** Optional. When provided, the item becomes a recurring subscription. */\n subscriptionInfo?: SubscriptionInfo;\n}\n\n/** Customer information for pre-filling checkout details. */\nexport interface CustomerInfo {\n /**\n * Customer's first name.\n * @maxLength 100\n */\n firstName?: string | null;\n /**\n * Customer's last name.\n * @maxLength 100\n */\n lastName?: string | null;\n /**\n * Customer's phone number.\n * @format PHONE\n */\n phone?: string | null;\n /**\n * Customer's email address.\n * @format EMAIL\n */\n email?: string | null;\n}\n\nexport interface Cart {\n /**\n * List of items in the cart.\n * @maxSize 100\n */\n items?: LineItem[];\n /** Optional customer information to pre-fill checkout form. */\n customerInfo?: CustomerInfo;\n}\n\nexport interface CallbackUrls {\n /**\n * URL to redirect after the checkout flow completes.\n * @format WEB_URL\n */\n postFlowUrl?: string | null;\n /**\n * URL for the thank you page after successful payment.\n * @format WEB_URL\n */\n thankYouPageUrl?: string | null;\n}\n\n/** Response after constructing a checkout session. */\nexport interface ConstructCheckoutSessionResponse {\n /** The constructed checkout session. */\n checkoutSession?: CheckoutSession;\n}\n\n/** Request to register a webhook URL. */\nexport interface RegisterCheckoutSessionWebhookRequest {\n /**\n * The URL to receive webhook notifications.\n * @format WEB_URL\n */\n url?: string | null;\n /**\n * Webhook event types to register. When empty, defaults to [ORDER_APPROVED].\n * @maxSize 10\n */\n webhookTypes?: WebhookTypeWithLiterals[];\n}\n\n/** Type of webhook event to register. */\nexport enum WebhookType {\n /** Registers wix.ecom.v1.order_approved webhook. */\n ORDER_APPROVED = 'ORDER_APPROVED',\n /** Registers wix.billing.v1.subscription_canceled webhook. */\n SUBSCRIPTION_CANCELED = 'SUBSCRIPTION_CANCELED',\n /** Registers wix.billing.v1.subscription_ended webhook. */\n SUBSCRIPTION_ENDED = 'SUBSCRIPTION_ENDED',\n}\n\n/** @enumType */\nexport type WebhookTypeWithLiterals =\n | WebhookType\n | 'ORDER_APPROVED'\n | 'SUBSCRIPTION_CANCELED'\n | 'SUBSCRIPTION_ENDED';\n\n/** Response after registering a webhook. */\nexport interface RegisterCheckoutSessionWebhookResponse {\n /**\n * The webhook public key used for verifying webhook payloads.\n * @maxLength 1000\n */\n publicKey?: string | null;\n}\n\n/**\n * Constructs a new checkout session.\n * @param cart - Cart details including line items to be checked out.\n * @public\n * @documentationMaturity preview\n * @requiredField cart\n * @requiredField cart.items\n * @requiredField cart.items.name\n * @requiredField cart.items.price\n * @requiredField cart.items.quantity\n * @requiredField options\n * @requiredField options.callbackUrls\n * @requiredField options.callbackUrls.postFlowUrl\n * @requiredField options.callbackUrls.thankYouPageUrl\n * @permissionId payments:platform:v1:checkout_session:construct_checkout_session\n * @returns Response after constructing a checkout session.\n * @fqn wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession\n */\nexport async function constructCheckoutSession(\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n): Promise<ConstructCheckoutSessionResponse> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n cart: cart,\n callbackUrls: options?.callbackUrls,\n });\n\n const reqOpts =\n ambassadorWixPaymentsPlatformV1CheckoutSession.constructCheckoutSession(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n cart: '$[0]',\n callbackUrls: '$[1].callbackUrls',\n },\n singleArgumentUnchanged: false,\n },\n ['cart', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface ConstructCheckoutSessionOptions {\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixPaymentsPlatformV1CheckoutSessionsUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/payments/platform/v1/checkout-sessions',\n destPath: '/v1/checkout-sessions',\n },\n {\n srcPath: '/payments/base44/v1/subscriptions',\n destPath: '/v1/subscriptions',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_payments_checkout-sessions';\n\n/** Constructs a new checkout session. */\nexport function constructCheckoutSession(\n payload: object\n): RequestOptionsFactory<any> {\n function __constructCheckoutSession({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.payments.platform.v1.checkout_session',\n method: 'POST' as any,\n methodFqn:\n 'wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/construct',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __constructCheckoutSession;\n}\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,kBAAkB;AAI3B,SAAS,gDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAGd,SAAS,yBACd,SAC4B;AAC5B,WAAS,2BAA2B,EAAE,KAAK,GAAQ;AACjD,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,gDAAgD;AAAA,QACnD,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ADkBO,IAAK,wBAAL,kBAAKA,2BAAL;AACL,EAAAA,uBAAA,eAAY;AACZ,EAAAA,uBAAA,SAAM;AACN,EAAAA,uBAAA,UAAO;AACP,EAAAA,uBAAA,WAAQ;AACR,EAAAA,uBAAA,UAAO;AALG,SAAAA;AAAA,GAAA;AAuHL,IAAK,cAAL,kBAAKC,iBAAL;AAEL,EAAAA,aAAA,oBAAiB;AAEjB,EAAAA,aAAA,2BAAwB;AAExB,EAAAA,aAAA,wBAAqB;AANX,SAAAA;AAAA,GAAA;AA2CZ,eAAsBC,0BACpB,MAQA,SAO2C;AAE3C,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,UAAU,sCAAsC;AAAA,IACpD;AAAA,IACA,cAAc,SAAS;AAAA,EACzB,CAAC;AAED,QAAM,UAC2C;AAAA,IAC7C;AAAA,EACF;AAEF,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,WAAO,wCAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,mBAAmB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,MAAM;AAAA,UACN,cAAc;AAAA,QAChB;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,QAAQ,SAAS;AAAA,IACpB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["SubscriptionFrequency","WebhookType","constructCheckoutSession"]}
|
|
1
|
+
{"version":3,"sources":["../../src/payments-platform-v1-checkout-session-checkout-sessions.universal.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.http.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSession from './payments-platform-v1-checkout-session-checkout-sessions.http.js';\n\n/** A CheckoutSession is a simple entity used for demonstration purposes. */\nexport interface CheckoutSession {\n /**\n * Cart ID (from ecom cart service).\n * @readonly\n * @format GUID\n */\n _id?: string | null;\n /**\n * URL to redirect buyer.\n * @format WEB_URL\n */\n redirectUrl?: string | null;\n}\n\n/** Request to construct a checkout session. */\nexport interface ConstructCheckoutSessionRequest {\n /** Cart details including line items to be checked out. */\n cart: Cart;\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/** Subscription display and settings for a recurring line item. */\nexport interface SubscriptionInfo {\n /** Subscription settings such as frequency and billing cycles. */\n subscriptionSettings?: SubscriptionSettings;\n /**\n * Subscription title shown to the buyer.\n * @maxLength 150\n */\n title?: string | null;\n /**\n * Subscription description shown to the buyer.\n * @maxLength 500\n */\n description?: string | null;\n}\n\n/** Configuration for recurring subscription charges. */\nexport interface SubscriptionSettings {\n /** Frequency unit for recurring charges. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Number of frequency units between charges. Default: 1.\n * @min 1\n * @max 3650\n */\n interval?: number | null;\n /** Whether the subscription renews automatically. */\n autoRenewal?: boolean | null;\n /**\n * Number of billing cycles. If not provided and `auto_renewal` is not set, the subscription renews indefinitely.\n * @min 1\n */\n billingCycles?: number | null;\n /** Free trial period before the first charge. */\n freeTrialPeriod?: FreeTrialPeriod;\n}\n\n/** Frequency unit for subscription billing and trial periods. */\nexport enum SubscriptionFrequency {\n UNDEFINED = 'UNDEFINED',\n DAY = 'DAY',\n WEEK = 'WEEK',\n MONTH = 'MONTH',\n YEAR = 'YEAR',\n}\n\n/** @enumType */\nexport type SubscriptionFrequencyWithLiterals =\n | SubscriptionFrequency\n | 'UNDEFINED'\n | 'DAY'\n | 'WEEK'\n | 'MONTH'\n | 'YEAR';\n\n/** Free trial period before the first subscription charge. */\nexport interface FreeTrialPeriod {\n /** Frequency unit for the trial period. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Duration in frequency units (e.g., 14 with DAY = 14-day trial).\n * @min 1\n * @max 999\n */\n interval?: number;\n}\n\nexport interface LineItem {\n /**\n * Name or title of the item.\n * @minLength 1\n * @maxLength 255\n */\n name?: string | null;\n /**\n * Quantity of this item in the cart.\n * @min 1\n */\n quantity?: number | null;\n /**\n * Price of the item as a string (e.g., \"19.99\").\n * @minLength 1\n * @maxLength 50\n */\n price?: string | null;\n /** Optional. When provided, the item becomes a recurring subscription. */\n subscriptionInfo?: SubscriptionInfo;\n}\n\n/** Customer information for pre-filling checkout details. */\nexport interface CustomerInfo {\n /**\n * Customer's first name.\n * @maxLength 100\n */\n firstName?: string | null;\n /**\n * Customer's last name.\n * @maxLength 100\n */\n lastName?: string | null;\n /**\n * Customer's phone number.\n * @format PHONE\n */\n phone?: string | null;\n /**\n * Customer's email address.\n * @format EMAIL\n */\n email?: string | null;\n}\n\nexport interface Cart {\n /**\n * List of items in the cart.\n * @maxSize 100\n */\n items?: LineItem[];\n /** Optional customer information to pre-fill checkout form. */\n customerInfo?: CustomerInfo;\n}\n\nexport interface CallbackUrls {\n /**\n * URL to redirect after the checkout flow completes.\n * @format WEB_URL\n */\n postFlowUrl?: string | null;\n /**\n * URL for the thank you page after successful payment.\n * @format WEB_URL\n */\n thankYouPageUrl?: string | null;\n}\n\n/** Response after constructing a checkout session. */\nexport interface ConstructCheckoutSessionResponse {\n /** The constructed checkout session. */\n checkoutSession?: CheckoutSession;\n}\n\n/** Request to register a webhook URL. */\nexport interface RegisterCheckoutSessionWebhookRequest {\n /**\n * The URL to receive webhook notifications.\n * @format WEB_URL\n */\n url?: string | null;\n /**\n * Webhook event types to register. When empty, defaults to [ORDER_APPROVED].\n * @maxSize 10\n */\n webhookTypes?: WebhookTypeWithLiterals[];\n}\n\n/** Type of webhook event to register. */\nexport enum WebhookType {\n /** Registers wix.ecom.v1.order_approved webhook. */\n ORDER_APPROVED = 'ORDER_APPROVED',\n /** Registers wix.ecom.subscription_contracts.v1.subscription_contract_canceled webhook. */\n SUBSCRIPTION_CANCELED = 'SUBSCRIPTION_CANCELED',\n /** Registers wix.ecom.subscription_contracts.v1.subscription_contract_expired webhook. */\n SUBSCRIPTION_ENDED = 'SUBSCRIPTION_ENDED',\n}\n\n/** @enumType */\nexport type WebhookTypeWithLiterals =\n | WebhookType\n | 'ORDER_APPROVED'\n | 'SUBSCRIPTION_CANCELED'\n | 'SUBSCRIPTION_ENDED';\n\n/** Response after registering a webhook. */\nexport interface RegisterCheckoutSessionWebhookResponse {\n /**\n * The webhook public key used for verifying webhook payloads.\n * @maxLength 1000\n */\n publicKey?: string | null;\n}\n\n/**\n * Constructs a new checkout session.\n * @param cart - Cart details including line items to be checked out.\n * @public\n * @documentationMaturity preview\n * @requiredField cart\n * @requiredField cart.items\n * @requiredField cart.items.name\n * @requiredField cart.items.price\n * @requiredField cart.items.quantity\n * @requiredField options\n * @requiredField options.callbackUrls\n * @requiredField options.callbackUrls.postFlowUrl\n * @requiredField options.callbackUrls.thankYouPageUrl\n * @permissionId payments:platform:v1:checkout_session:construct_checkout_session\n * @returns Response after constructing a checkout session.\n * @fqn wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession\n */\nexport async function constructCheckoutSession(\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n): Promise<ConstructCheckoutSessionResponse> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n cart: cart,\n callbackUrls: options?.callbackUrls,\n });\n\n const reqOpts =\n ambassadorWixPaymentsPlatformV1CheckoutSession.constructCheckoutSession(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n cart: '$[0]',\n callbackUrls: '$[1].callbackUrls',\n },\n singleArgumentUnchanged: false,\n },\n ['cart', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface ConstructCheckoutSessionOptions {\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixPaymentsPlatformV1CheckoutSessionsUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/payments/platform/v1/checkout-sessions',\n destPath: '/v1/checkout-sessions',\n },\n {\n srcPath: '/payments/base44/v1/subscriptions',\n destPath: '/v1/subscriptions',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_payments_checkout-sessions';\n\n/** Constructs a new checkout session. */\nexport function constructCheckoutSession(\n payload: object\n): RequestOptionsFactory<any> {\n function __constructCheckoutSession({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.payments.platform.v1.checkout_session',\n method: 'POST' as any,\n methodFqn:\n 'wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/construct',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __constructCheckoutSession;\n}\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,kBAAkB;AAI3B,SAAS,gDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAGd,SAAS,yBACd,SAC4B;AAC5B,WAAS,2BAA2B,EAAE,KAAK,GAAQ;AACjD,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,gDAAgD;AAAA,QACnD,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ADkBO,IAAK,wBAAL,kBAAKA,2BAAL;AACL,EAAAA,uBAAA,eAAY;AACZ,EAAAA,uBAAA,SAAM;AACN,EAAAA,uBAAA,UAAO;AACP,EAAAA,uBAAA,WAAQ;AACR,EAAAA,uBAAA,UAAO;AALG,SAAAA;AAAA,GAAA;AAuHL,IAAK,cAAL,kBAAKC,iBAAL;AAEL,EAAAA,aAAA,oBAAiB;AAEjB,EAAAA,aAAA,2BAAwB;AAExB,EAAAA,aAAA,wBAAqB;AANX,SAAAA;AAAA,GAAA;AA2CZ,eAAsBC,0BACpB,MAQA,SAO2C;AAE3C,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,UAAU,sCAAsC;AAAA,IACpD;AAAA,IACA,cAAc,SAAS;AAAA,EACzB,CAAC;AAED,QAAM,UAC2C;AAAA,IAC7C;AAAA,EACF;AAEF,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,WAAO,wCAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,mBAAmB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,MAAM;AAAA,UACN,cAAc;AAAA,QAChB;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,QAAQ,SAAS;AAAA,IACpB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["SubscriptionFrequency","WebhookType","constructCheckoutSession"]}
|
package/build/es/meta.d.mts
CHANGED
|
@@ -165,9 +165,9 @@ interface RegisterCheckoutSessionWebhookRequest {
|
|
|
165
165
|
declare enum WebhookType {
|
|
166
166
|
/** Registers wix.ecom.v1.order_approved webhook. */
|
|
167
167
|
ORDER_APPROVED = "ORDER_APPROVED",
|
|
168
|
-
/** Registers wix.
|
|
168
|
+
/** Registers wix.ecom.subscription_contracts.v1.subscription_contract_canceled webhook. */
|
|
169
169
|
SUBSCRIPTION_CANCELED = "SUBSCRIPTION_CANCELED",
|
|
170
|
-
/** Registers wix.
|
|
170
|
+
/** Registers wix.ecom.subscription_contracts.v1.subscription_contract_expired webhook. */
|
|
171
171
|
SUBSCRIPTION_ENDED = "SUBSCRIPTION_ENDED"
|
|
172
172
|
}
|
|
173
173
|
/** @enumType */
|
package/build/es/meta.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/payments-platform-v1-checkout-session-checkout-sessions.http.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.types.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.meta.ts"],"sourcesContent":["import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixPaymentsPlatformV1CheckoutSessionsUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/payments/platform/v1/checkout-sessions',\n destPath: '/v1/checkout-sessions',\n },\n {\n srcPath: '/payments/base44/v1/subscriptions',\n destPath: '/v1/subscriptions',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_payments_checkout-sessions';\n\n/** Constructs a new checkout session. */\nexport function constructCheckoutSession(\n payload: object\n): RequestOptionsFactory<any> {\n function __constructCheckoutSession({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.payments.platform.v1.checkout_session',\n method: 'POST' as any,\n methodFqn:\n 'wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/construct',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __constructCheckoutSession;\n}\n","/** A CheckoutSession is a simple entity used for demonstration purposes. */\nexport interface CheckoutSession {\n /**\n * Cart ID (from ecom cart service).\n * @readonly\n * @format GUID\n */\n id?: string | null;\n /**\n * URL to redirect buyer.\n * @format WEB_URL\n */\n redirectUrl?: string | null;\n}\n\n/** Request to construct a checkout session. */\nexport interface ConstructCheckoutSessionRequest {\n /** Cart details including line items to be checked out. */\n cart: Cart;\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/** Subscription display and settings for a recurring line item. */\nexport interface SubscriptionInfo {\n /** Subscription settings such as frequency and billing cycles. */\n subscriptionSettings?: SubscriptionSettings;\n /**\n * Subscription title shown to the buyer.\n * @maxLength 150\n */\n title?: string | null;\n /**\n * Subscription description shown to the buyer.\n * @maxLength 500\n */\n description?: string | null;\n}\n\n/** Configuration for recurring subscription charges. */\nexport interface SubscriptionSettings {\n /** Frequency unit for recurring charges. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Number of frequency units between charges. Default: 1.\n * @min 1\n * @max 3650\n */\n interval?: number | null;\n /** Whether the subscription renews automatically. */\n autoRenewal?: boolean | null;\n /**\n * Number of billing cycles. If not provided and `auto_renewal` is not set, the subscription renews indefinitely.\n * @min 1\n */\n billingCycles?: number | null;\n /** Free trial period before the first charge. */\n freeTrialPeriod?: FreeTrialPeriod;\n}\n\n/** Frequency unit for subscription billing and trial periods. */\nexport enum SubscriptionFrequency {\n UNDEFINED = 'UNDEFINED',\n DAY = 'DAY',\n WEEK = 'WEEK',\n MONTH = 'MONTH',\n YEAR = 'YEAR',\n}\n\n/** @enumType */\nexport type SubscriptionFrequencyWithLiterals =\n | SubscriptionFrequency\n | 'UNDEFINED'\n | 'DAY'\n | 'WEEK'\n | 'MONTH'\n | 'YEAR';\n\n/** Free trial period before the first subscription charge. */\nexport interface FreeTrialPeriod {\n /** Frequency unit for the trial period. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Duration in frequency units (e.g., 14 with DAY = 14-day trial).\n * @min 1\n * @max 999\n */\n interval?: number;\n}\n\nexport interface LineItem {\n /**\n * Name or title of the item.\n * @minLength 1\n * @maxLength 255\n */\n name?: string | null;\n /**\n * Quantity of this item in the cart.\n * @min 1\n */\n quantity?: number | null;\n /**\n * Price of the item as a string (e.g., \"19.99\").\n * @minLength 1\n * @maxLength 50\n */\n price?: string | null;\n /** Optional. When provided, the item becomes a recurring subscription. */\n subscriptionInfo?: SubscriptionInfo;\n}\n\n/** Customer information for pre-filling checkout details. */\nexport interface CustomerInfo {\n /**\n * Customer's first name.\n * @maxLength 100\n */\n firstName?: string | null;\n /**\n * Customer's last name.\n * @maxLength 100\n */\n lastName?: string | null;\n /**\n * Customer's phone number.\n * @format PHONE\n */\n phone?: string | null;\n /**\n * Customer's email address.\n * @format EMAIL\n */\n email?: string | null;\n}\n\nexport interface Cart {\n /**\n * List of items in the cart.\n * @maxSize 100\n */\n items?: LineItem[];\n /** Optional customer information to pre-fill checkout form. */\n customerInfo?: CustomerInfo;\n}\n\nexport interface CallbackUrls {\n /**\n * URL to redirect after the checkout flow completes.\n * @format WEB_URL\n */\n postFlowUrl?: string | null;\n /**\n * URL for the thank you page after successful payment.\n * @format WEB_URL\n */\n thankYouPageUrl?: string | null;\n}\n\n/** Response after constructing a checkout session. */\nexport interface ConstructCheckoutSessionResponse {\n /** The constructed checkout session. */\n checkoutSession?: CheckoutSession;\n}\n\n/** Request to register a webhook URL. */\nexport interface RegisterCheckoutSessionWebhookRequest {\n /**\n * The URL to receive webhook notifications.\n * @format WEB_URL\n */\n url?: string | null;\n /**\n * Webhook event types to register. When empty, defaults to [ORDER_APPROVED].\n * @maxSize 10\n */\n webhookTypes?: WebhookTypeWithLiterals[];\n}\n\n/** Type of webhook event to register. */\nexport enum WebhookType {\n /** Registers wix.ecom.v1.order_approved webhook. */\n ORDER_APPROVED = 'ORDER_APPROVED',\n /** Registers wix.billing.v1.subscription_canceled webhook. */\n SUBSCRIPTION_CANCELED = 'SUBSCRIPTION_CANCELED',\n /** Registers wix.billing.v1.subscription_ended webhook. */\n SUBSCRIPTION_ENDED = 'SUBSCRIPTION_ENDED',\n}\n\n/** @enumType */\nexport type WebhookTypeWithLiterals =\n | WebhookType\n | 'ORDER_APPROVED'\n | 'SUBSCRIPTION_CANCELED'\n | 'SUBSCRIPTION_ENDED';\n\n/** Response after registering a webhook. */\nexport interface RegisterCheckoutSessionWebhookResponse {\n /**\n * The webhook public key used for verifying webhook payloads.\n * @maxLength 1000\n */\n publicKey?: string | null;\n}\n","import * as ambassadorWixPaymentsPlatformV1CheckoutSession from './payments-platform-v1-checkout-session-checkout-sessions.http.js';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSessionTypes from './payments-platform-v1-checkout-session-checkout-sessions.types.js';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n\nexport type __PublicMethodMetaInfo<\n K = string,\n M = unknown,\n T = unknown,\n S = unknown,\n Q = unknown,\n R = unknown\n> = {\n getUrl: (context: any) => string;\n httpMethod: K;\n path: string;\n pathParams: M;\n __requestType: T;\n __originalRequestType: S;\n __responseType: Q;\n __originalResponseType: R;\n};\n\nexport function constructCheckoutSession(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes.ConstructCheckoutSessionRequest,\n ambassadorWixPaymentsPlatformV1CheckoutSessionTypes.ConstructCheckoutSessionRequest,\n ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes.ConstructCheckoutSessionResponse,\n ambassadorWixPaymentsPlatformV1CheckoutSessionTypes.ConstructCheckoutSessionResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixPaymentsPlatformV1CheckoutSession.constructCheckoutSession(\n payload\n );\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v1/checkout-sessions/construct',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport {\n CheckoutSession as CheckoutSessionOriginal,\n ConstructCheckoutSessionRequest as ConstructCheckoutSessionRequestOriginal,\n SubscriptionInfo as SubscriptionInfoOriginal,\n SubscriptionSettings as SubscriptionSettingsOriginal,\n SubscriptionFrequency as SubscriptionFrequencyOriginal,\n SubscriptionFrequencyWithLiterals as SubscriptionFrequencyWithLiteralsOriginal,\n FreeTrialPeriod as FreeTrialPeriodOriginal,\n LineItem as LineItemOriginal,\n CustomerInfo as CustomerInfoOriginal,\n Cart as CartOriginal,\n CallbackUrls as CallbackUrlsOriginal,\n ConstructCheckoutSessionResponse as ConstructCheckoutSessionResponseOriginal,\n RegisterCheckoutSessionWebhookRequest as RegisterCheckoutSessionWebhookRequestOriginal,\n WebhookType as WebhookTypeOriginal,\n WebhookTypeWithLiterals as WebhookTypeWithLiteralsOriginal,\n RegisterCheckoutSessionWebhookResponse as RegisterCheckoutSessionWebhookResponseOriginal,\n} from './payments-platform-v1-checkout-session-checkout-sessions.types.js';\n"],"mappings":";AAAA,SAAS,kBAAkB;AAI3B,SAAS,gDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAGd,SAAS,yBACd,SAC4B;AAC5B,WAAS,2BAA2B,EAAE,KAAK,GAAQ;AACjD,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,gDAAgD;AAAA,QACnD,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ACUO,IAAK,wBAAL,kBAAKA,2BAAL;AACL,EAAAA,uBAAA,eAAY;AACZ,EAAAA,uBAAA,SAAM;AACN,EAAAA,uBAAA,UAAO;AACP,EAAAA,uBAAA,WAAQ;AACR,EAAAA,uBAAA,UAAO;AALG,SAAAA;AAAA,GAAA;AAuHL,IAAK,cAAL,kBAAKC,iBAAL;AAEL,EAAAA,aAAA,oBAAiB;AAEjB,EAAAA,aAAA,2BAAwB;AAExB,EAAAA,aAAA,wBAAqB;AANX,SAAAA;AAAA,GAAA;;;AC9JL,SAASC,4BAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBAC2C;AAAA,IAC7C;AAAA,EACF;AAEF,QAAM,SAAS,CAAC,YAAyB;AACvC,UAAM,EAAE,IAAI,IAAI,kBAAkB,OAAO;AACzC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,YAAY,CAAC;AAAA,IACb,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;","names":["SubscriptionFrequency","WebhookType","constructCheckoutSession"]}
|
|
1
|
+
{"version":3,"sources":["../../src/payments-platform-v1-checkout-session-checkout-sessions.http.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.types.ts","../../src/payments-platform-v1-checkout-session-checkout-sessions.meta.ts"],"sourcesContent":["import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixPaymentsPlatformV1CheckoutSessionsUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/payments/platform/v1/checkout-sessions',\n destPath: '/v1/checkout-sessions',\n },\n {\n srcPath: '/payments/base44/v1/subscriptions',\n destPath: '/v1/subscriptions',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_payments_checkout-sessions';\n\n/** Constructs a new checkout session. */\nexport function constructCheckoutSession(\n payload: object\n): RequestOptionsFactory<any> {\n function __constructCheckoutSession({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.payments.platform.v1.checkout_session',\n method: 'POST' as any,\n methodFqn:\n 'wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/construct',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __constructCheckoutSession;\n}\n","/** A CheckoutSession is a simple entity used for demonstration purposes. */\nexport interface CheckoutSession {\n /**\n * Cart ID (from ecom cart service).\n * @readonly\n * @format GUID\n */\n id?: string | null;\n /**\n * URL to redirect buyer.\n * @format WEB_URL\n */\n redirectUrl?: string | null;\n}\n\n/** Request to construct a checkout session. */\nexport interface ConstructCheckoutSessionRequest {\n /** Cart details including line items to be checked out. */\n cart: Cart;\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/** Subscription display and settings for a recurring line item. */\nexport interface SubscriptionInfo {\n /** Subscription settings such as frequency and billing cycles. */\n subscriptionSettings?: SubscriptionSettings;\n /**\n * Subscription title shown to the buyer.\n * @maxLength 150\n */\n title?: string | null;\n /**\n * Subscription description shown to the buyer.\n * @maxLength 500\n */\n description?: string | null;\n}\n\n/** Configuration for recurring subscription charges. */\nexport interface SubscriptionSettings {\n /** Frequency unit for recurring charges. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Number of frequency units between charges. Default: 1.\n * @min 1\n * @max 3650\n */\n interval?: number | null;\n /** Whether the subscription renews automatically. */\n autoRenewal?: boolean | null;\n /**\n * Number of billing cycles. If not provided and `auto_renewal` is not set, the subscription renews indefinitely.\n * @min 1\n */\n billingCycles?: number | null;\n /** Free trial period before the first charge. */\n freeTrialPeriod?: FreeTrialPeriod;\n}\n\n/** Frequency unit for subscription billing and trial periods. */\nexport enum SubscriptionFrequency {\n UNDEFINED = 'UNDEFINED',\n DAY = 'DAY',\n WEEK = 'WEEK',\n MONTH = 'MONTH',\n YEAR = 'YEAR',\n}\n\n/** @enumType */\nexport type SubscriptionFrequencyWithLiterals =\n | SubscriptionFrequency\n | 'UNDEFINED'\n | 'DAY'\n | 'WEEK'\n | 'MONTH'\n | 'YEAR';\n\n/** Free trial period before the first subscription charge. */\nexport interface FreeTrialPeriod {\n /** Frequency unit for the trial period. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Duration in frequency units (e.g., 14 with DAY = 14-day trial).\n * @min 1\n * @max 999\n */\n interval?: number;\n}\n\nexport interface LineItem {\n /**\n * Name or title of the item.\n * @minLength 1\n * @maxLength 255\n */\n name?: string | null;\n /**\n * Quantity of this item in the cart.\n * @min 1\n */\n quantity?: number | null;\n /**\n * Price of the item as a string (e.g., \"19.99\").\n * @minLength 1\n * @maxLength 50\n */\n price?: string | null;\n /** Optional. When provided, the item becomes a recurring subscription. */\n subscriptionInfo?: SubscriptionInfo;\n}\n\n/** Customer information for pre-filling checkout details. */\nexport interface CustomerInfo {\n /**\n * Customer's first name.\n * @maxLength 100\n */\n firstName?: string | null;\n /**\n * Customer's last name.\n * @maxLength 100\n */\n lastName?: string | null;\n /**\n * Customer's phone number.\n * @format PHONE\n */\n phone?: string | null;\n /**\n * Customer's email address.\n * @format EMAIL\n */\n email?: string | null;\n}\n\nexport interface Cart {\n /**\n * List of items in the cart.\n * @maxSize 100\n */\n items?: LineItem[];\n /** Optional customer information to pre-fill checkout form. */\n customerInfo?: CustomerInfo;\n}\n\nexport interface CallbackUrls {\n /**\n * URL to redirect after the checkout flow completes.\n * @format WEB_URL\n */\n postFlowUrl?: string | null;\n /**\n * URL for the thank you page after successful payment.\n * @format WEB_URL\n */\n thankYouPageUrl?: string | null;\n}\n\n/** Response after constructing a checkout session. */\nexport interface ConstructCheckoutSessionResponse {\n /** The constructed checkout session. */\n checkoutSession?: CheckoutSession;\n}\n\n/** Request to register a webhook URL. */\nexport interface RegisterCheckoutSessionWebhookRequest {\n /**\n * The URL to receive webhook notifications.\n * @format WEB_URL\n */\n url?: string | null;\n /**\n * Webhook event types to register. When empty, defaults to [ORDER_APPROVED].\n * @maxSize 10\n */\n webhookTypes?: WebhookTypeWithLiterals[];\n}\n\n/** Type of webhook event to register. */\nexport enum WebhookType {\n /** Registers wix.ecom.v1.order_approved webhook. */\n ORDER_APPROVED = 'ORDER_APPROVED',\n /** Registers wix.ecom.subscription_contracts.v1.subscription_contract_canceled webhook. */\n SUBSCRIPTION_CANCELED = 'SUBSCRIPTION_CANCELED',\n /** Registers wix.ecom.subscription_contracts.v1.subscription_contract_expired webhook. */\n SUBSCRIPTION_ENDED = 'SUBSCRIPTION_ENDED',\n}\n\n/** @enumType */\nexport type WebhookTypeWithLiterals =\n | WebhookType\n | 'ORDER_APPROVED'\n | 'SUBSCRIPTION_CANCELED'\n | 'SUBSCRIPTION_ENDED';\n\n/** Response after registering a webhook. */\nexport interface RegisterCheckoutSessionWebhookResponse {\n /**\n * The webhook public key used for verifying webhook payloads.\n * @maxLength 1000\n */\n publicKey?: string | null;\n}\n","import * as ambassadorWixPaymentsPlatformV1CheckoutSession from './payments-platform-v1-checkout-session-checkout-sessions.http.js';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSessionTypes from './payments-platform-v1-checkout-session-checkout-sessions.types.js';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n\nexport type __PublicMethodMetaInfo<\n K = string,\n M = unknown,\n T = unknown,\n S = unknown,\n Q = unknown,\n R = unknown\n> = {\n getUrl: (context: any) => string;\n httpMethod: K;\n path: string;\n pathParams: M;\n __requestType: T;\n __originalRequestType: S;\n __responseType: Q;\n __originalResponseType: R;\n};\n\nexport function constructCheckoutSession(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes.ConstructCheckoutSessionRequest,\n ambassadorWixPaymentsPlatformV1CheckoutSessionTypes.ConstructCheckoutSessionRequest,\n ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes.ConstructCheckoutSessionResponse,\n ambassadorWixPaymentsPlatformV1CheckoutSessionTypes.ConstructCheckoutSessionResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixPaymentsPlatformV1CheckoutSession.constructCheckoutSession(\n payload\n );\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v1/checkout-sessions/construct',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport {\n CheckoutSession as CheckoutSessionOriginal,\n ConstructCheckoutSessionRequest as ConstructCheckoutSessionRequestOriginal,\n SubscriptionInfo as SubscriptionInfoOriginal,\n SubscriptionSettings as SubscriptionSettingsOriginal,\n SubscriptionFrequency as SubscriptionFrequencyOriginal,\n SubscriptionFrequencyWithLiterals as SubscriptionFrequencyWithLiteralsOriginal,\n FreeTrialPeriod as FreeTrialPeriodOriginal,\n LineItem as LineItemOriginal,\n CustomerInfo as CustomerInfoOriginal,\n Cart as CartOriginal,\n CallbackUrls as CallbackUrlsOriginal,\n ConstructCheckoutSessionResponse as ConstructCheckoutSessionResponseOriginal,\n RegisterCheckoutSessionWebhookRequest as RegisterCheckoutSessionWebhookRequestOriginal,\n WebhookType as WebhookTypeOriginal,\n WebhookTypeWithLiterals as WebhookTypeWithLiteralsOriginal,\n RegisterCheckoutSessionWebhookResponse as RegisterCheckoutSessionWebhookResponseOriginal,\n} from './payments-platform-v1-checkout-session-checkout-sessions.types.js';\n"],"mappings":";AAAA,SAAS,kBAAkB;AAI3B,SAAS,gDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAGd,SAAS,yBACd,SAC4B;AAC5B,WAAS,2BAA2B,EAAE,KAAK,GAAQ;AACjD,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,gDAAgD;AAAA,QACnD,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ACUO,IAAK,wBAAL,kBAAKA,2BAAL;AACL,EAAAA,uBAAA,eAAY;AACZ,EAAAA,uBAAA,SAAM;AACN,EAAAA,uBAAA,UAAO;AACP,EAAAA,uBAAA,WAAQ;AACR,EAAAA,uBAAA,UAAO;AALG,SAAAA;AAAA,GAAA;AAuHL,IAAK,cAAL,kBAAKC,iBAAL;AAEL,EAAAA,aAAA,oBAAiB;AAEjB,EAAAA,aAAA,2BAAwB;AAExB,EAAAA,aAAA,wBAAqB;AANX,SAAAA;AAAA,GAAA;;;AC9JL,SAASC,4BAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBAC2C;AAAA,IAC7C;AAAA,EACF;AAEF,QAAM,SAAS,CAAC,YAAyB;AACvC,UAAM,EAAE,IAAI,IAAI,kBAAkB,OAAO;AACzC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,YAAY,CAAC;AAAA,IACb,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;","names":["SubscriptionFrequency","WebhookType","constructCheckoutSession"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../index.ts","../../../src/payments-platform-v1-checkout-session-checkout-sessions.universal.ts","../../../src/payments-platform-v1-checkout-session-checkout-sessions.http.ts","../../../src/payments-platform-v1-checkout-session-checkout-sessions.public.ts","../../../src/payments-platform-v1-checkout-session-checkout-sessions.context.ts"],"sourcesContent":["export * from './src/payments-platform-v1-checkout-session-checkout-sessions.context.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSession from './payments-platform-v1-checkout-session-checkout-sessions.http.js';\n\n/** A CheckoutSession is a simple entity used for demonstration purposes. */\nexport interface CheckoutSession {\n /**\n * Cart ID (from ecom cart service).\n * @readonly\n * @format GUID\n */\n _id?: string | null;\n /**\n * URL to redirect buyer.\n * @format WEB_URL\n */\n redirectUrl?: string | null;\n}\n\n/** Request to construct a checkout session. */\nexport interface ConstructCheckoutSessionRequest {\n /** Cart details including line items to be checked out. */\n cart: Cart;\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/** Subscription display and settings for a recurring line item. */\nexport interface SubscriptionInfo {\n /** Subscription settings such as frequency and billing cycles. */\n subscriptionSettings?: SubscriptionSettings;\n /**\n * Subscription title shown to the buyer.\n * @maxLength 150\n */\n title?: string | null;\n /**\n * Subscription description shown to the buyer.\n * @maxLength 500\n */\n description?: string | null;\n}\n\n/** Configuration for recurring subscription charges. */\nexport interface SubscriptionSettings {\n /** Frequency unit for recurring charges. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Number of frequency units between charges. Default: 1.\n * @min 1\n * @max 3650\n */\n interval?: number | null;\n /** Whether the subscription renews automatically. */\n autoRenewal?: boolean | null;\n /**\n * Number of billing cycles. If not provided and `auto_renewal` is not set, the subscription renews indefinitely.\n * @min 1\n */\n billingCycles?: number | null;\n /** Free trial period before the first charge. */\n freeTrialPeriod?: FreeTrialPeriod;\n}\n\n/** Frequency unit for subscription billing and trial periods. */\nexport enum SubscriptionFrequency {\n UNDEFINED = 'UNDEFINED',\n DAY = 'DAY',\n WEEK = 'WEEK',\n MONTH = 'MONTH',\n YEAR = 'YEAR',\n}\n\n/** @enumType */\nexport type SubscriptionFrequencyWithLiterals =\n | SubscriptionFrequency\n | 'UNDEFINED'\n | 'DAY'\n | 'WEEK'\n | 'MONTH'\n | 'YEAR';\n\n/** Free trial period before the first subscription charge. */\nexport interface FreeTrialPeriod {\n /** Frequency unit for the trial period. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Duration in frequency units (e.g., 14 with DAY = 14-day trial).\n * @min 1\n * @max 999\n */\n interval?: number;\n}\n\nexport interface LineItem {\n /**\n * Name or title of the item.\n * @minLength 1\n * @maxLength 255\n */\n name?: string | null;\n /**\n * Quantity of this item in the cart.\n * @min 1\n */\n quantity?: number | null;\n /**\n * Price of the item as a string (e.g., \"19.99\").\n * @minLength 1\n * @maxLength 50\n */\n price?: string | null;\n /** Optional. When provided, the item becomes a recurring subscription. */\n subscriptionInfo?: SubscriptionInfo;\n}\n\n/** Customer information for pre-filling checkout details. */\nexport interface CustomerInfo {\n /**\n * Customer's first name.\n * @maxLength 100\n */\n firstName?: string | null;\n /**\n * Customer's last name.\n * @maxLength 100\n */\n lastName?: string | null;\n /**\n * Customer's phone number.\n * @format PHONE\n */\n phone?: string | null;\n /**\n * Customer's email address.\n * @format EMAIL\n */\n email?: string | null;\n}\n\nexport interface Cart {\n /**\n * List of items in the cart.\n * @maxSize 100\n */\n items?: LineItem[];\n /** Optional customer information to pre-fill checkout form. */\n customerInfo?: CustomerInfo;\n}\n\nexport interface CallbackUrls {\n /**\n * URL to redirect after the checkout flow completes.\n * @format WEB_URL\n */\n postFlowUrl?: string | null;\n /**\n * URL for the thank you page after successful payment.\n * @format WEB_URL\n */\n thankYouPageUrl?: string | null;\n}\n\n/** Response after constructing a checkout session. */\nexport interface ConstructCheckoutSessionResponse {\n /** The constructed checkout session. */\n checkoutSession?: CheckoutSession;\n}\n\n/** Request to register a webhook URL. */\nexport interface RegisterCheckoutSessionWebhookRequest {\n /**\n * The URL to receive webhook notifications.\n * @format WEB_URL\n */\n url?: string | null;\n /**\n * Webhook event types to register. When empty, defaults to [ORDER_APPROVED].\n * @maxSize 10\n */\n webhookTypes?: WebhookTypeWithLiterals[];\n}\n\n/** Type of webhook event to register. */\nexport enum WebhookType {\n /** Registers wix.ecom.v1.order_approved webhook. */\n ORDER_APPROVED = 'ORDER_APPROVED',\n /** Registers wix.billing.v1.subscription_canceled webhook. */\n SUBSCRIPTION_CANCELED = 'SUBSCRIPTION_CANCELED',\n /** Registers wix.billing.v1.subscription_ended webhook. */\n SUBSCRIPTION_ENDED = 'SUBSCRIPTION_ENDED',\n}\n\n/** @enumType */\nexport type WebhookTypeWithLiterals =\n | WebhookType\n | 'ORDER_APPROVED'\n | 'SUBSCRIPTION_CANCELED'\n | 'SUBSCRIPTION_ENDED';\n\n/** Response after registering a webhook. */\nexport interface RegisterCheckoutSessionWebhookResponse {\n /**\n * The webhook public key used for verifying webhook payloads.\n * @maxLength 1000\n */\n publicKey?: string | null;\n}\n\n/**\n * Constructs a new checkout session.\n * @param cart - Cart details including line items to be checked out.\n * @public\n * @documentationMaturity preview\n * @requiredField cart\n * @requiredField cart.items\n * @requiredField cart.items.name\n * @requiredField cart.items.price\n * @requiredField cart.items.quantity\n * @requiredField options\n * @requiredField options.callbackUrls\n * @requiredField options.callbackUrls.postFlowUrl\n * @requiredField options.callbackUrls.thankYouPageUrl\n * @permissionId payments:platform:v1:checkout_session:construct_checkout_session\n * @returns Response after constructing a checkout session.\n * @fqn wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession\n */\nexport async function constructCheckoutSession(\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n): Promise<ConstructCheckoutSessionResponse> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n cart: cart,\n callbackUrls: options?.callbackUrls,\n });\n\n const reqOpts =\n ambassadorWixPaymentsPlatformV1CheckoutSession.constructCheckoutSession(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n cart: '$[0]',\n callbackUrls: '$[1].callbackUrls',\n },\n singleArgumentUnchanged: false,\n },\n ['cart', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface ConstructCheckoutSessionOptions {\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixPaymentsPlatformV1CheckoutSessionsUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/payments/platform/v1/checkout-sessions',\n destPath: '/v1/checkout-sessions',\n },\n {\n srcPath: '/payments/base44/v1/subscriptions',\n destPath: '/v1/subscriptions',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_payments_checkout-sessions';\n\n/** Constructs a new checkout session. */\nexport function constructCheckoutSession(\n payload: object\n): RequestOptionsFactory<any> {\n function __constructCheckoutSession({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.payments.platform.v1.checkout_session',\n method: 'POST' as any,\n methodFqn:\n 'wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/construct',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __constructCheckoutSession;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n Cart,\n ConstructCheckoutSessionOptions,\n ConstructCheckoutSessionResponse,\n constructCheckoutSession as universalConstructCheckoutSession,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/payments' };\n\nexport function constructCheckoutSession(\n httpClient: HttpClient\n): ConstructCheckoutSessionSignature {\n return (\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n ) =>\n universalConstructCheckoutSession(\n cart,\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface ConstructCheckoutSessionSignature {\n /**\n * Constructs a new checkout session.\n * @param - Cart details including line items to be checked out.\n * @returns Response after constructing a checkout session.\n */\n (\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n ): Promise<ConstructCheckoutSessionResponse>;\n}\n\nexport {\n CallbackUrls,\n Cart,\n CheckoutSession,\n ConstructCheckoutSessionOptions,\n ConstructCheckoutSessionRequest,\n ConstructCheckoutSessionResponse,\n CustomerInfo,\n FreeTrialPeriod,\n LineItem,\n RegisterCheckoutSessionWebhookRequest,\n RegisterCheckoutSessionWebhookResponse,\n SubscriptionFrequency,\n SubscriptionInfo,\n SubscriptionSettings,\n WebhookType,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n","import { constructCheckoutSession as publicConstructCheckoutSession } from './payments-platform-v1-checkout-session-checkout-sessions.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const constructCheckoutSession: MaybeContext<\n BuildRESTFunction<typeof publicConstructCheckoutSession> &\n typeof publicConstructCheckoutSession\n> = /*#__PURE__*/ createRESTModule(publicConstructCheckoutSession);\n\nexport {\n SubscriptionFrequency,\n WebhookType,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\nexport {\n CheckoutSession,\n ConstructCheckoutSessionRequest,\n SubscriptionInfo,\n SubscriptionSettings,\n FreeTrialPeriod,\n LineItem,\n CustomerInfo,\n Cart,\n CallbackUrls,\n ConstructCheckoutSessionResponse,\n RegisterCheckoutSessionWebhookRequest,\n RegisterCheckoutSessionWebhookResponse,\n ConstructCheckoutSessionOptions,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\nexport {\n SubscriptionFrequencyWithLiterals,\n WebhookTypeWithLiterals,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA,kCAAAA;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAGO;;;ACJP,0BAA2B;AAI3B,SAAS,gDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,gCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAGd,SAAS,yBACd,SAC4B;AAC5B,WAAS,2BAA2B,EAAE,KAAK,GAAQ;AACjD,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,gDAAgD;AAAA,QACnD,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ADkBO,IAAK,wBAAL,kBAAKC,2BAAL;AACL,EAAAA,uBAAA,eAAY;AACZ,EAAAA,uBAAA,SAAM;AACN,EAAAA,uBAAA,UAAO;AACP,EAAAA,uBAAA,WAAQ;AACR,EAAAA,uBAAA,UAAO;AALG,SAAAA;AAAA,GAAA;AAuHL,IAAK,cAAL,kBAAKC,iBAAL;AAEL,EAAAA,aAAA,oBAAiB;AAEjB,EAAAA,aAAA,2BAAwB;AAExB,EAAAA,aAAA,wBAAqB;AANX,SAAAA;AAAA,GAAA;AA2CZ,eAAsBC,0BACpB,MAQA,SAO2C;AAE3C,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,cAAU,qEAAsC;AAAA,IACpD;AAAA,IACA,cAAc,SAAS;AAAA,EACzB,CAAC;AAED,QAAM,UAC2C;AAAA,IAC7C;AAAA,EACF;AAEF,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,eAAO,uEAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAC;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,MAAM;AAAA,UACN,cAAc;AAAA,QAChB;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,QAAQ,SAAS;AAAA,IACpB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;;;AErRO,SAASC,0BACd,YACmC;AACnC,SAAO,CACL,MAQA,YAQAA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;ACnCA,IAAAC,uBAAiC;AAG1B,IAAMC,4BAGK,2DAAiBA,yBAA8B;","names":["constructCheckoutSession","SubscriptionFrequency","WebhookType","constructCheckoutSession","sdkTransformError","constructCheckoutSession","import_rest_modules","constructCheckoutSession"]}
|
|
1
|
+
{"version":3,"sources":["../../../index.ts","../../../src/payments-platform-v1-checkout-session-checkout-sessions.universal.ts","../../../src/payments-platform-v1-checkout-session-checkout-sessions.http.ts","../../../src/payments-platform-v1-checkout-session-checkout-sessions.public.ts","../../../src/payments-platform-v1-checkout-session-checkout-sessions.context.ts"],"sourcesContent":["export * from './src/payments-platform-v1-checkout-session-checkout-sessions.context.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSession from './payments-platform-v1-checkout-session-checkout-sessions.http.js';\n\n/** A CheckoutSession is a simple entity used for demonstration purposes. */\nexport interface CheckoutSession {\n /**\n * Cart ID (from ecom cart service).\n * @readonly\n * @format GUID\n */\n _id?: string | null;\n /**\n * URL to redirect buyer.\n * @format WEB_URL\n */\n redirectUrl?: string | null;\n}\n\n/** Request to construct a checkout session. */\nexport interface ConstructCheckoutSessionRequest {\n /** Cart details including line items to be checked out. */\n cart: Cart;\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/** Subscription display and settings for a recurring line item. */\nexport interface SubscriptionInfo {\n /** Subscription settings such as frequency and billing cycles. */\n subscriptionSettings?: SubscriptionSettings;\n /**\n * Subscription title shown to the buyer.\n * @maxLength 150\n */\n title?: string | null;\n /**\n * Subscription description shown to the buyer.\n * @maxLength 500\n */\n description?: string | null;\n}\n\n/** Configuration for recurring subscription charges. */\nexport interface SubscriptionSettings {\n /** Frequency unit for recurring charges. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Number of frequency units between charges. Default: 1.\n * @min 1\n * @max 3650\n */\n interval?: number | null;\n /** Whether the subscription renews automatically. */\n autoRenewal?: boolean | null;\n /**\n * Number of billing cycles. If not provided and `auto_renewal` is not set, the subscription renews indefinitely.\n * @min 1\n */\n billingCycles?: number | null;\n /** Free trial period before the first charge. */\n freeTrialPeriod?: FreeTrialPeriod;\n}\n\n/** Frequency unit for subscription billing and trial periods. */\nexport enum SubscriptionFrequency {\n UNDEFINED = 'UNDEFINED',\n DAY = 'DAY',\n WEEK = 'WEEK',\n MONTH = 'MONTH',\n YEAR = 'YEAR',\n}\n\n/** @enumType */\nexport type SubscriptionFrequencyWithLiterals =\n | SubscriptionFrequency\n | 'UNDEFINED'\n | 'DAY'\n | 'WEEK'\n | 'MONTH'\n | 'YEAR';\n\n/** Free trial period before the first subscription charge. */\nexport interface FreeTrialPeriod {\n /** Frequency unit for the trial period. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Duration in frequency units (e.g., 14 with DAY = 14-day trial).\n * @min 1\n * @max 999\n */\n interval?: number;\n}\n\nexport interface LineItem {\n /**\n * Name or title of the item.\n * @minLength 1\n * @maxLength 255\n */\n name?: string | null;\n /**\n * Quantity of this item in the cart.\n * @min 1\n */\n quantity?: number | null;\n /**\n * Price of the item as a string (e.g., \"19.99\").\n * @minLength 1\n * @maxLength 50\n */\n price?: string | null;\n /** Optional. When provided, the item becomes a recurring subscription. */\n subscriptionInfo?: SubscriptionInfo;\n}\n\n/** Customer information for pre-filling checkout details. */\nexport interface CustomerInfo {\n /**\n * Customer's first name.\n * @maxLength 100\n */\n firstName?: string | null;\n /**\n * Customer's last name.\n * @maxLength 100\n */\n lastName?: string | null;\n /**\n * Customer's phone number.\n * @format PHONE\n */\n phone?: string | null;\n /**\n * Customer's email address.\n * @format EMAIL\n */\n email?: string | null;\n}\n\nexport interface Cart {\n /**\n * List of items in the cart.\n * @maxSize 100\n */\n items?: LineItem[];\n /** Optional customer information to pre-fill checkout form. */\n customerInfo?: CustomerInfo;\n}\n\nexport interface CallbackUrls {\n /**\n * URL to redirect after the checkout flow completes.\n * @format WEB_URL\n */\n postFlowUrl?: string | null;\n /**\n * URL for the thank you page after successful payment.\n * @format WEB_URL\n */\n thankYouPageUrl?: string | null;\n}\n\n/** Response after constructing a checkout session. */\nexport interface ConstructCheckoutSessionResponse {\n /** The constructed checkout session. */\n checkoutSession?: CheckoutSession;\n}\n\n/** Request to register a webhook URL. */\nexport interface RegisterCheckoutSessionWebhookRequest {\n /**\n * The URL to receive webhook notifications.\n * @format WEB_URL\n */\n url?: string | null;\n /**\n * Webhook event types to register. When empty, defaults to [ORDER_APPROVED].\n * @maxSize 10\n */\n webhookTypes?: WebhookTypeWithLiterals[];\n}\n\n/** Type of webhook event to register. */\nexport enum WebhookType {\n /** Registers wix.ecom.v1.order_approved webhook. */\n ORDER_APPROVED = 'ORDER_APPROVED',\n /** Registers wix.ecom.subscription_contracts.v1.subscription_contract_canceled webhook. */\n SUBSCRIPTION_CANCELED = 'SUBSCRIPTION_CANCELED',\n /** Registers wix.ecom.subscription_contracts.v1.subscription_contract_expired webhook. */\n SUBSCRIPTION_ENDED = 'SUBSCRIPTION_ENDED',\n}\n\n/** @enumType */\nexport type WebhookTypeWithLiterals =\n | WebhookType\n | 'ORDER_APPROVED'\n | 'SUBSCRIPTION_CANCELED'\n | 'SUBSCRIPTION_ENDED';\n\n/** Response after registering a webhook. */\nexport interface RegisterCheckoutSessionWebhookResponse {\n /**\n * The webhook public key used for verifying webhook payloads.\n * @maxLength 1000\n */\n publicKey?: string | null;\n}\n\n/**\n * Constructs a new checkout session.\n * @param cart - Cart details including line items to be checked out.\n * @public\n * @documentationMaturity preview\n * @requiredField cart\n * @requiredField cart.items\n * @requiredField cart.items.name\n * @requiredField cart.items.price\n * @requiredField cart.items.quantity\n * @requiredField options\n * @requiredField options.callbackUrls\n * @requiredField options.callbackUrls.postFlowUrl\n * @requiredField options.callbackUrls.thankYouPageUrl\n * @permissionId payments:platform:v1:checkout_session:construct_checkout_session\n * @returns Response after constructing a checkout session.\n * @fqn wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession\n */\nexport async function constructCheckoutSession(\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n): Promise<ConstructCheckoutSessionResponse> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n cart: cart,\n callbackUrls: options?.callbackUrls,\n });\n\n const reqOpts =\n ambassadorWixPaymentsPlatformV1CheckoutSession.constructCheckoutSession(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n cart: '$[0]',\n callbackUrls: '$[1].callbackUrls',\n },\n singleArgumentUnchanged: false,\n },\n ['cart', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface ConstructCheckoutSessionOptions {\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixPaymentsPlatformV1CheckoutSessionsUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/payments/platform/v1/checkout-sessions',\n destPath: '/v1/checkout-sessions',\n },\n {\n srcPath: '/payments/base44/v1/subscriptions',\n destPath: '/v1/subscriptions',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_payments_checkout-sessions';\n\n/** Constructs a new checkout session. */\nexport function constructCheckoutSession(\n payload: object\n): RequestOptionsFactory<any> {\n function __constructCheckoutSession({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.payments.platform.v1.checkout_session',\n method: 'POST' as any,\n methodFqn:\n 'wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/construct',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __constructCheckoutSession;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n Cart,\n ConstructCheckoutSessionOptions,\n ConstructCheckoutSessionResponse,\n constructCheckoutSession as universalConstructCheckoutSession,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/payments' };\n\nexport function constructCheckoutSession(\n httpClient: HttpClient\n): ConstructCheckoutSessionSignature {\n return (\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n ) =>\n universalConstructCheckoutSession(\n cart,\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface ConstructCheckoutSessionSignature {\n /**\n * Constructs a new checkout session.\n * @param - Cart details including line items to be checked out.\n * @returns Response after constructing a checkout session.\n */\n (\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n ): Promise<ConstructCheckoutSessionResponse>;\n}\n\nexport {\n CallbackUrls,\n Cart,\n CheckoutSession,\n ConstructCheckoutSessionOptions,\n ConstructCheckoutSessionRequest,\n ConstructCheckoutSessionResponse,\n CustomerInfo,\n FreeTrialPeriod,\n LineItem,\n RegisterCheckoutSessionWebhookRequest,\n RegisterCheckoutSessionWebhookResponse,\n SubscriptionFrequency,\n SubscriptionInfo,\n SubscriptionSettings,\n WebhookType,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n","import { constructCheckoutSession as publicConstructCheckoutSession } from './payments-platform-v1-checkout-session-checkout-sessions.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const constructCheckoutSession: MaybeContext<\n BuildRESTFunction<typeof publicConstructCheckoutSession> &\n typeof publicConstructCheckoutSession\n> = /*#__PURE__*/ createRESTModule(publicConstructCheckoutSession);\n\nexport {\n SubscriptionFrequency,\n WebhookType,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\nexport {\n CheckoutSession,\n ConstructCheckoutSessionRequest,\n SubscriptionInfo,\n SubscriptionSettings,\n FreeTrialPeriod,\n LineItem,\n CustomerInfo,\n Cart,\n CallbackUrls,\n ConstructCheckoutSessionResponse,\n RegisterCheckoutSessionWebhookRequest,\n RegisterCheckoutSessionWebhookResponse,\n ConstructCheckoutSessionOptions,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\nexport {\n SubscriptionFrequencyWithLiterals,\n WebhookTypeWithLiterals,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA,kCAAAA;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAGO;;;ACJP,0BAA2B;AAI3B,SAAS,gDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,gCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAGd,SAAS,yBACd,SAC4B;AAC5B,WAAS,2BAA2B,EAAE,KAAK,GAAQ;AACjD,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,gDAAgD;AAAA,QACnD,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ADkBO,IAAK,wBAAL,kBAAKC,2BAAL;AACL,EAAAA,uBAAA,eAAY;AACZ,EAAAA,uBAAA,SAAM;AACN,EAAAA,uBAAA,UAAO;AACP,EAAAA,uBAAA,WAAQ;AACR,EAAAA,uBAAA,UAAO;AALG,SAAAA;AAAA,GAAA;AAuHL,IAAK,cAAL,kBAAKC,iBAAL;AAEL,EAAAA,aAAA,oBAAiB;AAEjB,EAAAA,aAAA,2BAAwB;AAExB,EAAAA,aAAA,wBAAqB;AANX,SAAAA;AAAA,GAAA;AA2CZ,eAAsBC,0BACpB,MAQA,SAO2C;AAE3C,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,cAAU,qEAAsC;AAAA,IACpD;AAAA,IACA,cAAc,SAAS;AAAA,EACzB,CAAC;AAED,QAAM,UAC2C;AAAA,IAC7C;AAAA,EACF;AAEF,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,eAAO,uEAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAC;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,MAAM;AAAA,UACN,cAAc;AAAA,QAChB;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,QAAQ,SAAS;AAAA,IACpB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;;;AErRO,SAASC,0BACd,YACmC;AACnC,SAAO,CACL,MAQA,YAQAA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;ACnCA,IAAAC,uBAAiC;AAG1B,IAAMC,4BAGK,2DAAiBA,yBAA8B;","names":["constructCheckoutSession","SubscriptionFrequency","WebhookType","constructCheckoutSession","sdkTransformError","constructCheckoutSession","import_rest_modules","constructCheckoutSession"]}
|
|
@@ -164,9 +164,9 @@ interface RegisterCheckoutSessionWebhookRequest {
|
|
|
164
164
|
declare enum WebhookType {
|
|
165
165
|
/** Registers wix.ecom.v1.order_approved webhook. */
|
|
166
166
|
ORDER_APPROVED = "ORDER_APPROVED",
|
|
167
|
-
/** Registers wix.
|
|
167
|
+
/** Registers wix.ecom.subscription_contracts.v1.subscription_contract_canceled webhook. */
|
|
168
168
|
SUBSCRIPTION_CANCELED = "SUBSCRIPTION_CANCELED",
|
|
169
|
-
/** Registers wix.
|
|
169
|
+
/** Registers wix.ecom.subscription_contracts.v1.subscription_contract_expired webhook. */
|
|
170
170
|
SUBSCRIPTION_ENDED = "SUBSCRIPTION_ENDED"
|
|
171
171
|
}
|
|
172
172
|
/** @enumType */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../index.typings.ts","../../../src/payments-platform-v1-checkout-session-checkout-sessions.universal.ts","../../../src/payments-platform-v1-checkout-session-checkout-sessions.http.ts"],"sourcesContent":["export * from './src/payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSession from './payments-platform-v1-checkout-session-checkout-sessions.http.js';\n\n/** A CheckoutSession is a simple entity used for demonstration purposes. */\nexport interface CheckoutSession {\n /**\n * Cart ID (from ecom cart service).\n * @readonly\n * @format GUID\n */\n _id?: string | null;\n /**\n * URL to redirect buyer.\n * @format WEB_URL\n */\n redirectUrl?: string | null;\n}\n\n/** Request to construct a checkout session. */\nexport interface ConstructCheckoutSessionRequest {\n /** Cart details including line items to be checked out. */\n cart: Cart;\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/** Subscription display and settings for a recurring line item. */\nexport interface SubscriptionInfo {\n /** Subscription settings such as frequency and billing cycles. */\n subscriptionSettings?: SubscriptionSettings;\n /**\n * Subscription title shown to the buyer.\n * @maxLength 150\n */\n title?: string | null;\n /**\n * Subscription description shown to the buyer.\n * @maxLength 500\n */\n description?: string | null;\n}\n\n/** Configuration for recurring subscription charges. */\nexport interface SubscriptionSettings {\n /** Frequency unit for recurring charges. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Number of frequency units between charges. Default: 1.\n * @min 1\n * @max 3650\n */\n interval?: number | null;\n /** Whether the subscription renews automatically. */\n autoRenewal?: boolean | null;\n /**\n * Number of billing cycles. If not provided and `auto_renewal` is not set, the subscription renews indefinitely.\n * @min 1\n */\n billingCycles?: number | null;\n /** Free trial period before the first charge. */\n freeTrialPeriod?: FreeTrialPeriod;\n}\n\n/** Frequency unit for subscription billing and trial periods. */\nexport enum SubscriptionFrequency {\n UNDEFINED = 'UNDEFINED',\n DAY = 'DAY',\n WEEK = 'WEEK',\n MONTH = 'MONTH',\n YEAR = 'YEAR',\n}\n\n/** @enumType */\nexport type SubscriptionFrequencyWithLiterals =\n | SubscriptionFrequency\n | 'UNDEFINED'\n | 'DAY'\n | 'WEEK'\n | 'MONTH'\n | 'YEAR';\n\n/** Free trial period before the first subscription charge. */\nexport interface FreeTrialPeriod {\n /** Frequency unit for the trial period. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Duration in frequency units (e.g., 14 with DAY = 14-day trial).\n * @min 1\n * @max 999\n */\n interval?: number;\n}\n\nexport interface LineItem {\n /**\n * Name or title of the item.\n * @minLength 1\n * @maxLength 255\n */\n name?: string | null;\n /**\n * Quantity of this item in the cart.\n * @min 1\n */\n quantity?: number | null;\n /**\n * Price of the item as a string (e.g., \"19.99\").\n * @minLength 1\n * @maxLength 50\n */\n price?: string | null;\n /** Optional. When provided, the item becomes a recurring subscription. */\n subscriptionInfo?: SubscriptionInfo;\n}\n\n/** Customer information for pre-filling checkout details. */\nexport interface CustomerInfo {\n /**\n * Customer's first name.\n * @maxLength 100\n */\n firstName?: string | null;\n /**\n * Customer's last name.\n * @maxLength 100\n */\n lastName?: string | null;\n /**\n * Customer's phone number.\n * @format PHONE\n */\n phone?: string | null;\n /**\n * Customer's email address.\n * @format EMAIL\n */\n email?: string | null;\n}\n\nexport interface Cart {\n /**\n * List of items in the cart.\n * @maxSize 100\n */\n items?: LineItem[];\n /** Optional customer information to pre-fill checkout form. */\n customerInfo?: CustomerInfo;\n}\n\nexport interface CallbackUrls {\n /**\n * URL to redirect after the checkout flow completes.\n * @format WEB_URL\n */\n postFlowUrl?: string | null;\n /**\n * URL for the thank you page after successful payment.\n * @format WEB_URL\n */\n thankYouPageUrl?: string | null;\n}\n\n/** Response after constructing a checkout session. */\nexport interface ConstructCheckoutSessionResponse {\n /** The constructed checkout session. */\n checkoutSession?: CheckoutSession;\n}\n\n/** Request to register a webhook URL. */\nexport interface RegisterCheckoutSessionWebhookRequest {\n /**\n * The URL to receive webhook notifications.\n * @format WEB_URL\n */\n url?: string | null;\n /**\n * Webhook event types to register. When empty, defaults to [ORDER_APPROVED].\n * @maxSize 10\n */\n webhookTypes?: WebhookTypeWithLiterals[];\n}\n\n/** Type of webhook event to register. */\nexport enum WebhookType {\n /** Registers wix.ecom.v1.order_approved webhook. */\n ORDER_APPROVED = 'ORDER_APPROVED',\n /** Registers wix.billing.v1.subscription_canceled webhook. */\n SUBSCRIPTION_CANCELED = 'SUBSCRIPTION_CANCELED',\n /** Registers wix.billing.v1.subscription_ended webhook. */\n SUBSCRIPTION_ENDED = 'SUBSCRIPTION_ENDED',\n}\n\n/** @enumType */\nexport type WebhookTypeWithLiterals =\n | WebhookType\n | 'ORDER_APPROVED'\n | 'SUBSCRIPTION_CANCELED'\n | 'SUBSCRIPTION_ENDED';\n\n/** Response after registering a webhook. */\nexport interface RegisterCheckoutSessionWebhookResponse {\n /**\n * The webhook public key used for verifying webhook payloads.\n * @maxLength 1000\n */\n publicKey?: string | null;\n}\n\n/**\n * Constructs a new checkout session.\n * @param cart - Cart details including line items to be checked out.\n * @public\n * @documentationMaturity preview\n * @requiredField cart\n * @requiredField cart.items\n * @requiredField cart.items.name\n * @requiredField cart.items.price\n * @requiredField cart.items.quantity\n * @requiredField options\n * @requiredField options.callbackUrls\n * @requiredField options.callbackUrls.postFlowUrl\n * @requiredField options.callbackUrls.thankYouPageUrl\n * @permissionId payments:platform:v1:checkout_session:construct_checkout_session\n * @returns Response after constructing a checkout session.\n * @fqn wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession\n */\nexport async function constructCheckoutSession(\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n): Promise<ConstructCheckoutSessionResponse> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n cart: cart,\n callbackUrls: options?.callbackUrls,\n });\n\n const reqOpts =\n ambassadorWixPaymentsPlatformV1CheckoutSession.constructCheckoutSession(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n cart: '$[0]',\n callbackUrls: '$[1].callbackUrls',\n },\n singleArgumentUnchanged: false,\n },\n ['cart', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface ConstructCheckoutSessionOptions {\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixPaymentsPlatformV1CheckoutSessionsUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/payments/platform/v1/checkout-sessions',\n destPath: '/v1/checkout-sessions',\n },\n {\n srcPath: '/payments/base44/v1/subscriptions',\n destPath: '/v1/subscriptions',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_payments_checkout-sessions';\n\n/** Constructs a new checkout session. */\nexport function constructCheckoutSession(\n payload: object\n): RequestOptionsFactory<any> {\n function __constructCheckoutSession({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.payments.platform.v1.checkout_session',\n method: 'POST' as any,\n methodFqn:\n 'wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/construct',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __constructCheckoutSession;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA,kCAAAA;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAGO;;;ACJP,0BAA2B;AAI3B,SAAS,gDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,gCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAGd,SAAS,yBACd,SAC4B;AAC5B,WAAS,2BAA2B,EAAE,KAAK,GAAQ;AACjD,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,gDAAgD;AAAA,QACnD,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ADkBO,IAAK,wBAAL,kBAAKC,2BAAL;AACL,EAAAA,uBAAA,eAAY;AACZ,EAAAA,uBAAA,SAAM;AACN,EAAAA,uBAAA,UAAO;AACP,EAAAA,uBAAA,WAAQ;AACR,EAAAA,uBAAA,UAAO;AALG,SAAAA;AAAA,GAAA;AAuHL,IAAK,cAAL,kBAAKC,iBAAL;AAEL,EAAAA,aAAA,oBAAiB;AAEjB,EAAAA,aAAA,2BAAwB;AAExB,EAAAA,aAAA,wBAAqB;AANX,SAAAA;AAAA,GAAA;AA2CZ,eAAsBC,0BACpB,MAQA,SAO2C;AAE3C,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,cAAU,qEAAsC;AAAA,IACpD;AAAA,IACA,cAAc,SAAS;AAAA,EACzB,CAAC;AAED,QAAM,UAC2C;AAAA,IAC7C;AAAA,EACF;AAEF,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,eAAO,uEAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAC;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,MAAM;AAAA,UACN,cAAc;AAAA,QAChB;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,QAAQ,SAAS;AAAA,IACpB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["constructCheckoutSession","SubscriptionFrequency","WebhookType","constructCheckoutSession","sdkTransformError"]}
|
|
1
|
+
{"version":3,"sources":["../../../index.typings.ts","../../../src/payments-platform-v1-checkout-session-checkout-sessions.universal.ts","../../../src/payments-platform-v1-checkout-session-checkout-sessions.http.ts"],"sourcesContent":["export * from './src/payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSession from './payments-platform-v1-checkout-session-checkout-sessions.http.js';\n\n/** A CheckoutSession is a simple entity used for demonstration purposes. */\nexport interface CheckoutSession {\n /**\n * Cart ID (from ecom cart service).\n * @readonly\n * @format GUID\n */\n _id?: string | null;\n /**\n * URL to redirect buyer.\n * @format WEB_URL\n */\n redirectUrl?: string | null;\n}\n\n/** Request to construct a checkout session. */\nexport interface ConstructCheckoutSessionRequest {\n /** Cart details including line items to be checked out. */\n cart: Cart;\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/** Subscription display and settings for a recurring line item. */\nexport interface SubscriptionInfo {\n /** Subscription settings such as frequency and billing cycles. */\n subscriptionSettings?: SubscriptionSettings;\n /**\n * Subscription title shown to the buyer.\n * @maxLength 150\n */\n title?: string | null;\n /**\n * Subscription description shown to the buyer.\n * @maxLength 500\n */\n description?: string | null;\n}\n\n/** Configuration for recurring subscription charges. */\nexport interface SubscriptionSettings {\n /** Frequency unit for recurring charges. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Number of frequency units between charges. Default: 1.\n * @min 1\n * @max 3650\n */\n interval?: number | null;\n /** Whether the subscription renews automatically. */\n autoRenewal?: boolean | null;\n /**\n * Number of billing cycles. If not provided and `auto_renewal` is not set, the subscription renews indefinitely.\n * @min 1\n */\n billingCycles?: number | null;\n /** Free trial period before the first charge. */\n freeTrialPeriod?: FreeTrialPeriod;\n}\n\n/** Frequency unit for subscription billing and trial periods. */\nexport enum SubscriptionFrequency {\n UNDEFINED = 'UNDEFINED',\n DAY = 'DAY',\n WEEK = 'WEEK',\n MONTH = 'MONTH',\n YEAR = 'YEAR',\n}\n\n/** @enumType */\nexport type SubscriptionFrequencyWithLiterals =\n | SubscriptionFrequency\n | 'UNDEFINED'\n | 'DAY'\n | 'WEEK'\n | 'MONTH'\n | 'YEAR';\n\n/** Free trial period before the first subscription charge. */\nexport interface FreeTrialPeriod {\n /** Frequency unit for the trial period. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Duration in frequency units (e.g., 14 with DAY = 14-day trial).\n * @min 1\n * @max 999\n */\n interval?: number;\n}\n\nexport interface LineItem {\n /**\n * Name or title of the item.\n * @minLength 1\n * @maxLength 255\n */\n name?: string | null;\n /**\n * Quantity of this item in the cart.\n * @min 1\n */\n quantity?: number | null;\n /**\n * Price of the item as a string (e.g., \"19.99\").\n * @minLength 1\n * @maxLength 50\n */\n price?: string | null;\n /** Optional. When provided, the item becomes a recurring subscription. */\n subscriptionInfo?: SubscriptionInfo;\n}\n\n/** Customer information for pre-filling checkout details. */\nexport interface CustomerInfo {\n /**\n * Customer's first name.\n * @maxLength 100\n */\n firstName?: string | null;\n /**\n * Customer's last name.\n * @maxLength 100\n */\n lastName?: string | null;\n /**\n * Customer's phone number.\n * @format PHONE\n */\n phone?: string | null;\n /**\n * Customer's email address.\n * @format EMAIL\n */\n email?: string | null;\n}\n\nexport interface Cart {\n /**\n * List of items in the cart.\n * @maxSize 100\n */\n items?: LineItem[];\n /** Optional customer information to pre-fill checkout form. */\n customerInfo?: CustomerInfo;\n}\n\nexport interface CallbackUrls {\n /**\n * URL to redirect after the checkout flow completes.\n * @format WEB_URL\n */\n postFlowUrl?: string | null;\n /**\n * URL for the thank you page after successful payment.\n * @format WEB_URL\n */\n thankYouPageUrl?: string | null;\n}\n\n/** Response after constructing a checkout session. */\nexport interface ConstructCheckoutSessionResponse {\n /** The constructed checkout session. */\n checkoutSession?: CheckoutSession;\n}\n\n/** Request to register a webhook URL. */\nexport interface RegisterCheckoutSessionWebhookRequest {\n /**\n * The URL to receive webhook notifications.\n * @format WEB_URL\n */\n url?: string | null;\n /**\n * Webhook event types to register. When empty, defaults to [ORDER_APPROVED].\n * @maxSize 10\n */\n webhookTypes?: WebhookTypeWithLiterals[];\n}\n\n/** Type of webhook event to register. */\nexport enum WebhookType {\n /** Registers wix.ecom.v1.order_approved webhook. */\n ORDER_APPROVED = 'ORDER_APPROVED',\n /** Registers wix.ecom.subscription_contracts.v1.subscription_contract_canceled webhook. */\n SUBSCRIPTION_CANCELED = 'SUBSCRIPTION_CANCELED',\n /** Registers wix.ecom.subscription_contracts.v1.subscription_contract_expired webhook. */\n SUBSCRIPTION_ENDED = 'SUBSCRIPTION_ENDED',\n}\n\n/** @enumType */\nexport type WebhookTypeWithLiterals =\n | WebhookType\n | 'ORDER_APPROVED'\n | 'SUBSCRIPTION_CANCELED'\n | 'SUBSCRIPTION_ENDED';\n\n/** Response after registering a webhook. */\nexport interface RegisterCheckoutSessionWebhookResponse {\n /**\n * The webhook public key used for verifying webhook payloads.\n * @maxLength 1000\n */\n publicKey?: string | null;\n}\n\n/**\n * Constructs a new checkout session.\n * @param cart - Cart details including line items to be checked out.\n * @public\n * @documentationMaturity preview\n * @requiredField cart\n * @requiredField cart.items\n * @requiredField cart.items.name\n * @requiredField cart.items.price\n * @requiredField cart.items.quantity\n * @requiredField options\n * @requiredField options.callbackUrls\n * @requiredField options.callbackUrls.postFlowUrl\n * @requiredField options.callbackUrls.thankYouPageUrl\n * @permissionId payments:platform:v1:checkout_session:construct_checkout_session\n * @returns Response after constructing a checkout session.\n * @fqn wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession\n */\nexport async function constructCheckoutSession(\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n): Promise<ConstructCheckoutSessionResponse> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n cart: cart,\n callbackUrls: options?.callbackUrls,\n });\n\n const reqOpts =\n ambassadorWixPaymentsPlatformV1CheckoutSession.constructCheckoutSession(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n cart: '$[0]',\n callbackUrls: '$[1].callbackUrls',\n },\n singleArgumentUnchanged: false,\n },\n ['cart', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface ConstructCheckoutSessionOptions {\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixPaymentsPlatformV1CheckoutSessionsUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/payments/platform/v1/checkout-sessions',\n destPath: '/v1/checkout-sessions',\n },\n {\n srcPath: '/payments/base44/v1/subscriptions',\n destPath: '/v1/subscriptions',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_payments_checkout-sessions';\n\n/** Constructs a new checkout session. */\nexport function constructCheckoutSession(\n payload: object\n): RequestOptionsFactory<any> {\n function __constructCheckoutSession({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.payments.platform.v1.checkout_session',\n method: 'POST' as any,\n methodFqn:\n 'wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/construct',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __constructCheckoutSession;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA,kCAAAA;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAGO;;;ACJP,0BAA2B;AAI3B,SAAS,gDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,gCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAGd,SAAS,yBACd,SAC4B;AAC5B,WAAS,2BAA2B,EAAE,KAAK,GAAQ;AACjD,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,gDAAgD;AAAA,QACnD,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ADkBO,IAAK,wBAAL,kBAAKC,2BAAL;AACL,EAAAA,uBAAA,eAAY;AACZ,EAAAA,uBAAA,SAAM;AACN,EAAAA,uBAAA,UAAO;AACP,EAAAA,uBAAA,WAAQ;AACR,EAAAA,uBAAA,UAAO;AALG,SAAAA;AAAA,GAAA;AAuHL,IAAK,cAAL,kBAAKC,iBAAL;AAEL,EAAAA,aAAA,oBAAiB;AAEjB,EAAAA,aAAA,2BAAwB;AAExB,EAAAA,aAAA,wBAAqB;AANX,SAAAA;AAAA,GAAA;AA2CZ,eAAsBC,0BACpB,MAQA,SAO2C;AAE3C,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,cAAU,qEAAsC;AAAA,IACpD;AAAA,IACA,cAAc,SAAS;AAAA,EACzB,CAAC;AAED,QAAM,UAC2C;AAAA,IAC7C;AAAA,EACF;AAEF,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,eAAO,uEAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAC;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,MAAM;AAAA,UACN,cAAc;AAAA,QAChB;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,QAAQ,SAAS;AAAA,IACpB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["constructCheckoutSession","SubscriptionFrequency","WebhookType","constructCheckoutSession","sdkTransformError"]}
|
|
@@ -165,9 +165,9 @@ interface RegisterCheckoutSessionWebhookRequest {
|
|
|
165
165
|
declare enum WebhookType {
|
|
166
166
|
/** Registers wix.ecom.v1.order_approved webhook. */
|
|
167
167
|
ORDER_APPROVED = "ORDER_APPROVED",
|
|
168
|
-
/** Registers wix.
|
|
168
|
+
/** Registers wix.ecom.subscription_contracts.v1.subscription_contract_canceled webhook. */
|
|
169
169
|
SUBSCRIPTION_CANCELED = "SUBSCRIPTION_CANCELED",
|
|
170
|
-
/** Registers wix.
|
|
170
|
+
/** Registers wix.ecom.subscription_contracts.v1.subscription_contract_expired webhook. */
|
|
171
171
|
SUBSCRIPTION_ENDED = "SUBSCRIPTION_ENDED"
|
|
172
172
|
}
|
|
173
173
|
/** @enumType */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../meta.ts","../../../src/payments-platform-v1-checkout-session-checkout-sessions.http.ts","../../../src/payments-platform-v1-checkout-session-checkout-sessions.types.ts","../../../src/payments-platform-v1-checkout-session-checkout-sessions.meta.ts"],"sourcesContent":["export * from './src/payments-platform-v1-checkout-session-checkout-sessions.meta.js';\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixPaymentsPlatformV1CheckoutSessionsUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/payments/platform/v1/checkout-sessions',\n destPath: '/v1/checkout-sessions',\n },\n {\n srcPath: '/payments/base44/v1/subscriptions',\n destPath: '/v1/subscriptions',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_payments_checkout-sessions';\n\n/** Constructs a new checkout session. */\nexport function constructCheckoutSession(\n payload: object\n): RequestOptionsFactory<any> {\n function __constructCheckoutSession({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.payments.platform.v1.checkout_session',\n method: 'POST' as any,\n methodFqn:\n 'wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/construct',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __constructCheckoutSession;\n}\n","/** A CheckoutSession is a simple entity used for demonstration purposes. */\nexport interface CheckoutSession {\n /**\n * Cart ID (from ecom cart service).\n * @readonly\n * @format GUID\n */\n id?: string | null;\n /**\n * URL to redirect buyer.\n * @format WEB_URL\n */\n redirectUrl?: string | null;\n}\n\n/** Request to construct a checkout session. */\nexport interface ConstructCheckoutSessionRequest {\n /** Cart details including line items to be checked out. */\n cart: Cart;\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/** Subscription display and settings for a recurring line item. */\nexport interface SubscriptionInfo {\n /** Subscription settings such as frequency and billing cycles. */\n subscriptionSettings?: SubscriptionSettings;\n /**\n * Subscription title shown to the buyer.\n * @maxLength 150\n */\n title?: string | null;\n /**\n * Subscription description shown to the buyer.\n * @maxLength 500\n */\n description?: string | null;\n}\n\n/** Configuration for recurring subscription charges. */\nexport interface SubscriptionSettings {\n /** Frequency unit for recurring charges. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Number of frequency units between charges. Default: 1.\n * @min 1\n * @max 3650\n */\n interval?: number | null;\n /** Whether the subscription renews automatically. */\n autoRenewal?: boolean | null;\n /**\n * Number of billing cycles. If not provided and `auto_renewal` is not set, the subscription renews indefinitely.\n * @min 1\n */\n billingCycles?: number | null;\n /** Free trial period before the first charge. */\n freeTrialPeriod?: FreeTrialPeriod;\n}\n\n/** Frequency unit for subscription billing and trial periods. */\nexport enum SubscriptionFrequency {\n UNDEFINED = 'UNDEFINED',\n DAY = 'DAY',\n WEEK = 'WEEK',\n MONTH = 'MONTH',\n YEAR = 'YEAR',\n}\n\n/** @enumType */\nexport type SubscriptionFrequencyWithLiterals =\n | SubscriptionFrequency\n | 'UNDEFINED'\n | 'DAY'\n | 'WEEK'\n | 'MONTH'\n | 'YEAR';\n\n/** Free trial period before the first subscription charge. */\nexport interface FreeTrialPeriod {\n /** Frequency unit for the trial period. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Duration in frequency units (e.g., 14 with DAY = 14-day trial).\n * @min 1\n * @max 999\n */\n interval?: number;\n}\n\nexport interface LineItem {\n /**\n * Name or title of the item.\n * @minLength 1\n * @maxLength 255\n */\n name?: string | null;\n /**\n * Quantity of this item in the cart.\n * @min 1\n */\n quantity?: number | null;\n /**\n * Price of the item as a string (e.g., \"19.99\").\n * @minLength 1\n * @maxLength 50\n */\n price?: string | null;\n /** Optional. When provided, the item becomes a recurring subscription. */\n subscriptionInfo?: SubscriptionInfo;\n}\n\n/** Customer information for pre-filling checkout details. */\nexport interface CustomerInfo {\n /**\n * Customer's first name.\n * @maxLength 100\n */\n firstName?: string | null;\n /**\n * Customer's last name.\n * @maxLength 100\n */\n lastName?: string | null;\n /**\n * Customer's phone number.\n * @format PHONE\n */\n phone?: string | null;\n /**\n * Customer's email address.\n * @format EMAIL\n */\n email?: string | null;\n}\n\nexport interface Cart {\n /**\n * List of items in the cart.\n * @maxSize 100\n */\n items?: LineItem[];\n /** Optional customer information to pre-fill checkout form. */\n customerInfo?: CustomerInfo;\n}\n\nexport interface CallbackUrls {\n /**\n * URL to redirect after the checkout flow completes.\n * @format WEB_URL\n */\n postFlowUrl?: string | null;\n /**\n * URL for the thank you page after successful payment.\n * @format WEB_URL\n */\n thankYouPageUrl?: string | null;\n}\n\n/** Response after constructing a checkout session. */\nexport interface ConstructCheckoutSessionResponse {\n /** The constructed checkout session. */\n checkoutSession?: CheckoutSession;\n}\n\n/** Request to register a webhook URL. */\nexport interface RegisterCheckoutSessionWebhookRequest {\n /**\n * The URL to receive webhook notifications.\n * @format WEB_URL\n */\n url?: string | null;\n /**\n * Webhook event types to register. When empty, defaults to [ORDER_APPROVED].\n * @maxSize 10\n */\n webhookTypes?: WebhookTypeWithLiterals[];\n}\n\n/** Type of webhook event to register. */\nexport enum WebhookType {\n /** Registers wix.ecom.v1.order_approved webhook. */\n ORDER_APPROVED = 'ORDER_APPROVED',\n /** Registers wix.billing.v1.subscription_canceled webhook. */\n SUBSCRIPTION_CANCELED = 'SUBSCRIPTION_CANCELED',\n /** Registers wix.billing.v1.subscription_ended webhook. */\n SUBSCRIPTION_ENDED = 'SUBSCRIPTION_ENDED',\n}\n\n/** @enumType */\nexport type WebhookTypeWithLiterals =\n | WebhookType\n | 'ORDER_APPROVED'\n | 'SUBSCRIPTION_CANCELED'\n | 'SUBSCRIPTION_ENDED';\n\n/** Response after registering a webhook. */\nexport interface RegisterCheckoutSessionWebhookResponse {\n /**\n * The webhook public key used for verifying webhook payloads.\n * @maxLength 1000\n */\n publicKey?: string | null;\n}\n","import * as ambassadorWixPaymentsPlatformV1CheckoutSession from './payments-platform-v1-checkout-session-checkout-sessions.http.js';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSessionTypes from './payments-platform-v1-checkout-session-checkout-sessions.types.js';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n\nexport type __PublicMethodMetaInfo<\n K = string,\n M = unknown,\n T = unknown,\n S = unknown,\n Q = unknown,\n R = unknown\n> = {\n getUrl: (context: any) => string;\n httpMethod: K;\n path: string;\n pathParams: M;\n __requestType: T;\n __originalRequestType: S;\n __responseType: Q;\n __originalResponseType: R;\n};\n\nexport function constructCheckoutSession(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes.ConstructCheckoutSessionRequest,\n ambassadorWixPaymentsPlatformV1CheckoutSessionTypes.ConstructCheckoutSessionRequest,\n ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes.ConstructCheckoutSessionResponse,\n ambassadorWixPaymentsPlatformV1CheckoutSessionTypes.ConstructCheckoutSessionResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixPaymentsPlatformV1CheckoutSession.constructCheckoutSession(\n payload\n );\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v1/checkout-sessions/construct',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport {\n CheckoutSession as CheckoutSessionOriginal,\n ConstructCheckoutSessionRequest as ConstructCheckoutSessionRequestOriginal,\n SubscriptionInfo as SubscriptionInfoOriginal,\n SubscriptionSettings as SubscriptionSettingsOriginal,\n SubscriptionFrequency as SubscriptionFrequencyOriginal,\n SubscriptionFrequencyWithLiterals as SubscriptionFrequencyWithLiteralsOriginal,\n FreeTrialPeriod as FreeTrialPeriodOriginal,\n LineItem as LineItemOriginal,\n CustomerInfo as CustomerInfoOriginal,\n Cart as CartOriginal,\n CallbackUrls as CallbackUrlsOriginal,\n ConstructCheckoutSessionResponse as ConstructCheckoutSessionResponseOriginal,\n RegisterCheckoutSessionWebhookRequest as RegisterCheckoutSessionWebhookRequestOriginal,\n WebhookType as WebhookTypeOriginal,\n WebhookTypeWithLiterals as WebhookTypeWithLiteralsOriginal,\n RegisterCheckoutSessionWebhookResponse as RegisterCheckoutSessionWebhookResponseOriginal,\n} from './payments-platform-v1-checkout-session-checkout-sessions.types.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA,kCAAAA;AAAA;AAAA;;;ACAA,0BAA2B;AAI3B,SAAS,gDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,gCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAGd,SAAS,yBACd,SAC4B;AAC5B,WAAS,2BAA2B,EAAE,KAAK,GAAQ;AACjD,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,gDAAgD;AAAA,QACnD,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ACUO,IAAK,wBAAL,kBAAKC,2BAAL;AACL,EAAAA,uBAAA,eAAY;AACZ,EAAAA,uBAAA,SAAM;AACN,EAAAA,uBAAA,UAAO;AACP,EAAAA,uBAAA,WAAQ;AACR,EAAAA,uBAAA,UAAO;AALG,SAAAA;AAAA,GAAA;AAuHL,IAAK,cAAL,kBAAKC,iBAAL;AAEL,EAAAA,aAAA,oBAAiB;AAEjB,EAAAA,aAAA,2BAAwB;AAExB,EAAAA,aAAA,wBAAqB;AANX,SAAAA;AAAA,GAAA;;;AC9JL,SAASC,4BAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBAC2C;AAAA,IAC7C;AAAA,EACF;AAEF,QAAM,SAAS,CAAC,YAAyB;AACvC,UAAM,EAAE,IAAI,IAAI,kBAAkB,OAAO;AACzC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,YAAY,CAAC;AAAA,IACb,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;","names":["constructCheckoutSession","SubscriptionFrequency","WebhookType","constructCheckoutSession"]}
|
|
1
|
+
{"version":3,"sources":["../../../meta.ts","../../../src/payments-platform-v1-checkout-session-checkout-sessions.http.ts","../../../src/payments-platform-v1-checkout-session-checkout-sessions.types.ts","../../../src/payments-platform-v1-checkout-session-checkout-sessions.meta.ts"],"sourcesContent":["export * from './src/payments-platform-v1-checkout-session-checkout-sessions.meta.js';\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixPaymentsPlatformV1CheckoutSessionsUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/payments/platform/v1/checkout-sessions',\n destPath: '/v1/checkout-sessions',\n },\n {\n srcPath: '/payments/base44/v1/subscriptions',\n destPath: '/v1/subscriptions',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_payments_checkout-sessions';\n\n/** Constructs a new checkout session. */\nexport function constructCheckoutSession(\n payload: object\n): RequestOptionsFactory<any> {\n function __constructCheckoutSession({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.payments.platform.v1.checkout_session',\n method: 'POST' as any,\n methodFqn:\n 'wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/construct',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __constructCheckoutSession;\n}\n","/** A CheckoutSession is a simple entity used for demonstration purposes. */\nexport interface CheckoutSession {\n /**\n * Cart ID (from ecom cart service).\n * @readonly\n * @format GUID\n */\n id?: string | null;\n /**\n * URL to redirect buyer.\n * @format WEB_URL\n */\n redirectUrl?: string | null;\n}\n\n/** Request to construct a checkout session. */\nexport interface ConstructCheckoutSessionRequest {\n /** Cart details including line items to be checked out. */\n cart: Cart;\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/** Subscription display and settings for a recurring line item. */\nexport interface SubscriptionInfo {\n /** Subscription settings such as frequency and billing cycles. */\n subscriptionSettings?: SubscriptionSettings;\n /**\n * Subscription title shown to the buyer.\n * @maxLength 150\n */\n title?: string | null;\n /**\n * Subscription description shown to the buyer.\n * @maxLength 500\n */\n description?: string | null;\n}\n\n/** Configuration for recurring subscription charges. */\nexport interface SubscriptionSettings {\n /** Frequency unit for recurring charges. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Number of frequency units between charges. Default: 1.\n * @min 1\n * @max 3650\n */\n interval?: number | null;\n /** Whether the subscription renews automatically. */\n autoRenewal?: boolean | null;\n /**\n * Number of billing cycles. If not provided and `auto_renewal` is not set, the subscription renews indefinitely.\n * @min 1\n */\n billingCycles?: number | null;\n /** Free trial period before the first charge. */\n freeTrialPeriod?: FreeTrialPeriod;\n}\n\n/** Frequency unit for subscription billing and trial periods. */\nexport enum SubscriptionFrequency {\n UNDEFINED = 'UNDEFINED',\n DAY = 'DAY',\n WEEK = 'WEEK',\n MONTH = 'MONTH',\n YEAR = 'YEAR',\n}\n\n/** @enumType */\nexport type SubscriptionFrequencyWithLiterals =\n | SubscriptionFrequency\n | 'UNDEFINED'\n | 'DAY'\n | 'WEEK'\n | 'MONTH'\n | 'YEAR';\n\n/** Free trial period before the first subscription charge. */\nexport interface FreeTrialPeriod {\n /** Frequency unit for the trial period. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Duration in frequency units (e.g., 14 with DAY = 14-day trial).\n * @min 1\n * @max 999\n */\n interval?: number;\n}\n\nexport interface LineItem {\n /**\n * Name or title of the item.\n * @minLength 1\n * @maxLength 255\n */\n name?: string | null;\n /**\n * Quantity of this item in the cart.\n * @min 1\n */\n quantity?: number | null;\n /**\n * Price of the item as a string (e.g., \"19.99\").\n * @minLength 1\n * @maxLength 50\n */\n price?: string | null;\n /** Optional. When provided, the item becomes a recurring subscription. */\n subscriptionInfo?: SubscriptionInfo;\n}\n\n/** Customer information for pre-filling checkout details. */\nexport interface CustomerInfo {\n /**\n * Customer's first name.\n * @maxLength 100\n */\n firstName?: string | null;\n /**\n * Customer's last name.\n * @maxLength 100\n */\n lastName?: string | null;\n /**\n * Customer's phone number.\n * @format PHONE\n */\n phone?: string | null;\n /**\n * Customer's email address.\n * @format EMAIL\n */\n email?: string | null;\n}\n\nexport interface Cart {\n /**\n * List of items in the cart.\n * @maxSize 100\n */\n items?: LineItem[];\n /** Optional customer information to pre-fill checkout form. */\n customerInfo?: CustomerInfo;\n}\n\nexport interface CallbackUrls {\n /**\n * URL to redirect after the checkout flow completes.\n * @format WEB_URL\n */\n postFlowUrl?: string | null;\n /**\n * URL for the thank you page after successful payment.\n * @format WEB_URL\n */\n thankYouPageUrl?: string | null;\n}\n\n/** Response after constructing a checkout session. */\nexport interface ConstructCheckoutSessionResponse {\n /** The constructed checkout session. */\n checkoutSession?: CheckoutSession;\n}\n\n/** Request to register a webhook URL. */\nexport interface RegisterCheckoutSessionWebhookRequest {\n /**\n * The URL to receive webhook notifications.\n * @format WEB_URL\n */\n url?: string | null;\n /**\n * Webhook event types to register. When empty, defaults to [ORDER_APPROVED].\n * @maxSize 10\n */\n webhookTypes?: WebhookTypeWithLiterals[];\n}\n\n/** Type of webhook event to register. */\nexport enum WebhookType {\n /** Registers wix.ecom.v1.order_approved webhook. */\n ORDER_APPROVED = 'ORDER_APPROVED',\n /** Registers wix.ecom.subscription_contracts.v1.subscription_contract_canceled webhook. */\n SUBSCRIPTION_CANCELED = 'SUBSCRIPTION_CANCELED',\n /** Registers wix.ecom.subscription_contracts.v1.subscription_contract_expired webhook. */\n SUBSCRIPTION_ENDED = 'SUBSCRIPTION_ENDED',\n}\n\n/** @enumType */\nexport type WebhookTypeWithLiterals =\n | WebhookType\n | 'ORDER_APPROVED'\n | 'SUBSCRIPTION_CANCELED'\n | 'SUBSCRIPTION_ENDED';\n\n/** Response after registering a webhook. */\nexport interface RegisterCheckoutSessionWebhookResponse {\n /**\n * The webhook public key used for verifying webhook payloads.\n * @maxLength 1000\n */\n publicKey?: string | null;\n}\n","import * as ambassadorWixPaymentsPlatformV1CheckoutSession from './payments-platform-v1-checkout-session-checkout-sessions.http.js';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSessionTypes from './payments-platform-v1-checkout-session-checkout-sessions.types.js';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n\nexport type __PublicMethodMetaInfo<\n K = string,\n M = unknown,\n T = unknown,\n S = unknown,\n Q = unknown,\n R = unknown\n> = {\n getUrl: (context: any) => string;\n httpMethod: K;\n path: string;\n pathParams: M;\n __requestType: T;\n __originalRequestType: S;\n __responseType: Q;\n __originalResponseType: R;\n};\n\nexport function constructCheckoutSession(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes.ConstructCheckoutSessionRequest,\n ambassadorWixPaymentsPlatformV1CheckoutSessionTypes.ConstructCheckoutSessionRequest,\n ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes.ConstructCheckoutSessionResponse,\n ambassadorWixPaymentsPlatformV1CheckoutSessionTypes.ConstructCheckoutSessionResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixPaymentsPlatformV1CheckoutSession.constructCheckoutSession(\n payload\n );\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v1/checkout-sessions/construct',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport {\n CheckoutSession as CheckoutSessionOriginal,\n ConstructCheckoutSessionRequest as ConstructCheckoutSessionRequestOriginal,\n SubscriptionInfo as SubscriptionInfoOriginal,\n SubscriptionSettings as SubscriptionSettingsOriginal,\n SubscriptionFrequency as SubscriptionFrequencyOriginal,\n SubscriptionFrequencyWithLiterals as SubscriptionFrequencyWithLiteralsOriginal,\n FreeTrialPeriod as FreeTrialPeriodOriginal,\n LineItem as LineItemOriginal,\n CustomerInfo as CustomerInfoOriginal,\n Cart as CartOriginal,\n CallbackUrls as CallbackUrlsOriginal,\n ConstructCheckoutSessionResponse as ConstructCheckoutSessionResponseOriginal,\n RegisterCheckoutSessionWebhookRequest as RegisterCheckoutSessionWebhookRequestOriginal,\n WebhookType as WebhookTypeOriginal,\n WebhookTypeWithLiterals as WebhookTypeWithLiteralsOriginal,\n RegisterCheckoutSessionWebhookResponse as RegisterCheckoutSessionWebhookResponseOriginal,\n} from './payments-platform-v1-checkout-session-checkout-sessions.types.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA,kCAAAA;AAAA;AAAA;;;ACAA,0BAA2B;AAI3B,SAAS,gDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,gCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAGd,SAAS,yBACd,SAC4B;AAC5B,WAAS,2BAA2B,EAAE,KAAK,GAAQ;AACjD,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,gDAAgD;AAAA,QACnD,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ACUO,IAAK,wBAAL,kBAAKC,2BAAL;AACL,EAAAA,uBAAA,eAAY;AACZ,EAAAA,uBAAA,SAAM;AACN,EAAAA,uBAAA,UAAO;AACP,EAAAA,uBAAA,WAAQ;AACR,EAAAA,uBAAA,UAAO;AALG,SAAAA;AAAA,GAAA;AAuHL,IAAK,cAAL,kBAAKC,iBAAL;AAEL,EAAAA,aAAA,oBAAiB;AAEjB,EAAAA,aAAA,2BAAwB;AAExB,EAAAA,aAAA,wBAAqB;AANX,SAAAA;AAAA,GAAA;;;AC9JL,SAASC,4BAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBAC2C;AAAA,IAC7C;AAAA,EACF;AAEF,QAAM,SAAS,CAAC,YAAyB;AACvC,UAAM,EAAE,IAAI,IAAI,kBAAkB,OAAO;AACzC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,YAAY,CAAC;AAAA,IACb,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;","names":["constructCheckoutSession","SubscriptionFrequency","WebhookType","constructCheckoutSession"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/payments-platform-v1-checkout-session-checkout-sessions.universal.ts","../../../src/payments-platform-v1-checkout-session-checkout-sessions.http.ts","../../../src/payments-platform-v1-checkout-session-checkout-sessions.public.ts","../../../src/payments-platform-v1-checkout-session-checkout-sessions.context.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSession from './payments-platform-v1-checkout-session-checkout-sessions.http.js';\n\n/** A CheckoutSession is a simple entity used for demonstration purposes. */\nexport interface CheckoutSession {\n /**\n * Cart ID (from ecom cart service).\n * @readonly\n * @format GUID\n */\n _id?: string | null;\n /**\n * URL to redirect buyer.\n * @format WEB_URL\n */\n redirectUrl?: string | null;\n}\n\n/** Request to construct a checkout session. */\nexport interface ConstructCheckoutSessionRequest {\n /** Cart details including line items to be checked out. */\n cart: Cart;\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/** Subscription display and settings for a recurring line item. */\nexport interface SubscriptionInfo {\n /** Subscription settings such as frequency and billing cycles. */\n subscriptionSettings?: SubscriptionSettings;\n /**\n * Subscription title shown to the buyer.\n * @maxLength 150\n */\n title?: string | null;\n /**\n * Subscription description shown to the buyer.\n * @maxLength 500\n */\n description?: string | null;\n}\n\n/** Configuration for recurring subscription charges. */\nexport interface SubscriptionSettings {\n /** Frequency unit for recurring charges. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Number of frequency units between charges. Default: 1.\n * @min 1\n * @max 3650\n */\n interval?: number | null;\n /** Whether the subscription renews automatically. */\n autoRenewal?: boolean | null;\n /**\n * Number of billing cycles. If not provided and `auto_renewal` is not set, the subscription renews indefinitely.\n * @min 1\n */\n billingCycles?: number | null;\n /** Free trial period before the first charge. */\n freeTrialPeriod?: FreeTrialPeriod;\n}\n\n/** Frequency unit for subscription billing and trial periods. */\nexport enum SubscriptionFrequency {\n UNDEFINED = 'UNDEFINED',\n DAY = 'DAY',\n WEEK = 'WEEK',\n MONTH = 'MONTH',\n YEAR = 'YEAR',\n}\n\n/** @enumType */\nexport type SubscriptionFrequencyWithLiterals =\n | SubscriptionFrequency\n | 'UNDEFINED'\n | 'DAY'\n | 'WEEK'\n | 'MONTH'\n | 'YEAR';\n\n/** Free trial period before the first subscription charge. */\nexport interface FreeTrialPeriod {\n /** Frequency unit for the trial period. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Duration in frequency units (e.g., 14 with DAY = 14-day trial).\n * @min 1\n * @max 999\n */\n interval?: number;\n}\n\nexport interface LineItem {\n /**\n * Name or title of the item.\n * @minLength 1\n * @maxLength 255\n */\n name?: string | null;\n /**\n * Quantity of this item in the cart.\n * @min 1\n */\n quantity?: number | null;\n /**\n * Price of the item as a string (e.g., \"19.99\").\n * @minLength 1\n * @maxLength 50\n */\n price?: string | null;\n /** Optional. When provided, the item becomes a recurring subscription. */\n subscriptionInfo?: SubscriptionInfo;\n}\n\n/** Customer information for pre-filling checkout details. */\nexport interface CustomerInfo {\n /**\n * Customer's first name.\n * @maxLength 100\n */\n firstName?: string | null;\n /**\n * Customer's last name.\n * @maxLength 100\n */\n lastName?: string | null;\n /**\n * Customer's phone number.\n * @format PHONE\n */\n phone?: string | null;\n /**\n * Customer's email address.\n * @format EMAIL\n */\n email?: string | null;\n}\n\nexport interface Cart {\n /**\n * List of items in the cart.\n * @maxSize 100\n */\n items?: LineItem[];\n /** Optional customer information to pre-fill checkout form. */\n customerInfo?: CustomerInfo;\n}\n\nexport interface CallbackUrls {\n /**\n * URL to redirect after the checkout flow completes.\n * @format WEB_URL\n */\n postFlowUrl?: string | null;\n /**\n * URL for the thank you page after successful payment.\n * @format WEB_URL\n */\n thankYouPageUrl?: string | null;\n}\n\n/** Response after constructing a checkout session. */\nexport interface ConstructCheckoutSessionResponse {\n /** The constructed checkout session. */\n checkoutSession?: CheckoutSession;\n}\n\n/** Request to register a webhook URL. */\nexport interface RegisterCheckoutSessionWebhookRequest {\n /**\n * The URL to receive webhook notifications.\n * @format WEB_URL\n */\n url?: string | null;\n /**\n * Webhook event types to register. When empty, defaults to [ORDER_APPROVED].\n * @maxSize 10\n */\n webhookTypes?: WebhookTypeWithLiterals[];\n}\n\n/** Type of webhook event to register. */\nexport enum WebhookType {\n /** Registers wix.ecom.v1.order_approved webhook. */\n ORDER_APPROVED = 'ORDER_APPROVED',\n /** Registers wix.billing.v1.subscription_canceled webhook. */\n SUBSCRIPTION_CANCELED = 'SUBSCRIPTION_CANCELED',\n /** Registers wix.billing.v1.subscription_ended webhook. */\n SUBSCRIPTION_ENDED = 'SUBSCRIPTION_ENDED',\n}\n\n/** @enumType */\nexport type WebhookTypeWithLiterals =\n | WebhookType\n | 'ORDER_APPROVED'\n | 'SUBSCRIPTION_CANCELED'\n | 'SUBSCRIPTION_ENDED';\n\n/** Response after registering a webhook. */\nexport interface RegisterCheckoutSessionWebhookResponse {\n /**\n * The webhook public key used for verifying webhook payloads.\n * @maxLength 1000\n */\n publicKey?: string | null;\n}\n\n/**\n * Constructs a new checkout session.\n * @param cart - Cart details including line items to be checked out.\n * @public\n * @documentationMaturity preview\n * @requiredField cart\n * @requiredField cart.items\n * @requiredField cart.items.name\n * @requiredField cart.items.price\n * @requiredField cart.items.quantity\n * @requiredField options\n * @requiredField options.callbackUrls\n * @requiredField options.callbackUrls.postFlowUrl\n * @requiredField options.callbackUrls.thankYouPageUrl\n * @permissionId payments:platform:v1:checkout_session:construct_checkout_session\n * @returns Response after constructing a checkout session.\n * @fqn wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession\n */\nexport async function constructCheckoutSession(\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n): Promise<ConstructCheckoutSessionResponse> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n cart: cart,\n callbackUrls: options?.callbackUrls,\n });\n\n const reqOpts =\n ambassadorWixPaymentsPlatformV1CheckoutSession.constructCheckoutSession(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n cart: '$[0]',\n callbackUrls: '$[1].callbackUrls',\n },\n singleArgumentUnchanged: false,\n },\n ['cart', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface ConstructCheckoutSessionOptions {\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixPaymentsPlatformV1CheckoutSessionsUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/payments/platform/v1/checkout-sessions',\n destPath: '/v1/checkout-sessions',\n },\n {\n srcPath: '/payments/base44/v1/subscriptions',\n destPath: '/v1/subscriptions',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_payments_checkout-sessions';\n\n/** Constructs a new checkout session. */\nexport function constructCheckoutSession(\n payload: object\n): RequestOptionsFactory<any> {\n function __constructCheckoutSession({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.payments.platform.v1.checkout_session',\n method: 'POST' as any,\n methodFqn:\n 'wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/construct',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __constructCheckoutSession;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n Cart,\n ConstructCheckoutSessionOptions,\n ConstructCheckoutSessionResponse,\n constructCheckoutSession as universalConstructCheckoutSession,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/payments' };\n\nexport function constructCheckoutSession(\n httpClient: HttpClient\n): ConstructCheckoutSessionSignature {\n return (\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n ) =>\n universalConstructCheckoutSession(\n cart,\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface ConstructCheckoutSessionSignature {\n /**\n * Constructs a new checkout session.\n * @param - Cart details including line items to be checked out.\n * @returns Response after constructing a checkout session.\n */\n (\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n ): Promise<ConstructCheckoutSessionResponse>;\n}\n\nexport {\n CallbackUrls,\n Cart,\n CheckoutSession,\n ConstructCheckoutSessionOptions,\n ConstructCheckoutSessionRequest,\n ConstructCheckoutSessionResponse,\n CustomerInfo,\n FreeTrialPeriod,\n LineItem,\n RegisterCheckoutSessionWebhookRequest,\n RegisterCheckoutSessionWebhookResponse,\n SubscriptionFrequency,\n SubscriptionInfo,\n SubscriptionSettings,\n WebhookType,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n","import { constructCheckoutSession as publicConstructCheckoutSession } from './payments-platform-v1-checkout-session-checkout-sessions.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const constructCheckoutSession: MaybeContext<\n BuildRESTFunction<typeof publicConstructCheckoutSession> &\n typeof publicConstructCheckoutSession\n> = /*#__PURE__*/ createRESTModule(publicConstructCheckoutSession);\n\nexport {\n SubscriptionFrequency,\n WebhookType,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\nexport {\n CheckoutSession,\n ConstructCheckoutSessionRequest,\n SubscriptionInfo,\n SubscriptionSettings,\n FreeTrialPeriod,\n LineItem,\n CustomerInfo,\n Cart,\n CallbackUrls,\n ConstructCheckoutSessionResponse,\n RegisterCheckoutSessionWebhookRequest,\n RegisterCheckoutSessionWebhookResponse,\n ConstructCheckoutSessionOptions,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\nexport {\n SubscriptionFrequencyWithLiterals,\n WebhookTypeWithLiterals,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,kBAAkB;AAI3B,SAAS,gDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAGd,SAAS,yBACd,SAC4B;AAC5B,WAAS,2BAA2B,EAAE,KAAK,GAAQ;AACjD,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,gDAAgD;AAAA,QACnD,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ADkBO,IAAK,wBAAL,kBAAKA,2BAAL;AACL,EAAAA,uBAAA,eAAY;AACZ,EAAAA,uBAAA,SAAM;AACN,EAAAA,uBAAA,UAAO;AACP,EAAAA,uBAAA,WAAQ;AACR,EAAAA,uBAAA,UAAO;AALG,SAAAA;AAAA,GAAA;AAuHL,IAAK,cAAL,kBAAKC,iBAAL;AAEL,EAAAA,aAAA,oBAAiB;AAEjB,EAAAA,aAAA,2BAAwB;AAExB,EAAAA,aAAA,wBAAqB;AANX,SAAAA;AAAA,GAAA;AA2CZ,eAAsBC,0BACpB,MAQA,SAO2C;AAE3C,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,UAAU,sCAAsC;AAAA,IACpD;AAAA,IACA,cAAc,SAAS;AAAA,EACzB,CAAC;AAED,QAAM,UAC2C;AAAA,IAC7C;AAAA,EACF;AAEF,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,WAAO,wCAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,mBAAmB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,MAAM;AAAA,UACN,cAAc;AAAA,QAChB;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,QAAQ,SAAS;AAAA,IACpB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;;;AErRO,SAASC,0BACd,YACmC;AACnC,SAAO,CACL,MAQA,YAQAA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;ACnCA,SAAS,wBAAwB;AAG1B,IAAMC,4BAGK,iCAAiBA,yBAA8B;","names":["SubscriptionFrequency","WebhookType","constructCheckoutSession","constructCheckoutSession","constructCheckoutSession"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/payments-platform-v1-checkout-session-checkout-sessions.universal.ts","../../../src/payments-platform-v1-checkout-session-checkout-sessions.http.ts","../../../src/payments-platform-v1-checkout-session-checkout-sessions.public.ts","../../../src/payments-platform-v1-checkout-session-checkout-sessions.context.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSession from './payments-platform-v1-checkout-session-checkout-sessions.http.js';\n\n/** A CheckoutSession is a simple entity used for demonstration purposes. */\nexport interface CheckoutSession {\n /**\n * Cart ID (from ecom cart service).\n * @readonly\n * @format GUID\n */\n _id?: string | null;\n /**\n * URL to redirect buyer.\n * @format WEB_URL\n */\n redirectUrl?: string | null;\n}\n\n/** Request to construct a checkout session. */\nexport interface ConstructCheckoutSessionRequest {\n /** Cart details including line items to be checked out. */\n cart: Cart;\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/** Subscription display and settings for a recurring line item. */\nexport interface SubscriptionInfo {\n /** Subscription settings such as frequency and billing cycles. */\n subscriptionSettings?: SubscriptionSettings;\n /**\n * Subscription title shown to the buyer.\n * @maxLength 150\n */\n title?: string | null;\n /**\n * Subscription description shown to the buyer.\n * @maxLength 500\n */\n description?: string | null;\n}\n\n/** Configuration for recurring subscription charges. */\nexport interface SubscriptionSettings {\n /** Frequency unit for recurring charges. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Number of frequency units between charges. Default: 1.\n * @min 1\n * @max 3650\n */\n interval?: number | null;\n /** Whether the subscription renews automatically. */\n autoRenewal?: boolean | null;\n /**\n * Number of billing cycles. If not provided and `auto_renewal` is not set, the subscription renews indefinitely.\n * @min 1\n */\n billingCycles?: number | null;\n /** Free trial period before the first charge. */\n freeTrialPeriod?: FreeTrialPeriod;\n}\n\n/** Frequency unit for subscription billing and trial periods. */\nexport enum SubscriptionFrequency {\n UNDEFINED = 'UNDEFINED',\n DAY = 'DAY',\n WEEK = 'WEEK',\n MONTH = 'MONTH',\n YEAR = 'YEAR',\n}\n\n/** @enumType */\nexport type SubscriptionFrequencyWithLiterals =\n | SubscriptionFrequency\n | 'UNDEFINED'\n | 'DAY'\n | 'WEEK'\n | 'MONTH'\n | 'YEAR';\n\n/** Free trial period before the first subscription charge. */\nexport interface FreeTrialPeriod {\n /** Frequency unit for the trial period. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Duration in frequency units (e.g., 14 with DAY = 14-day trial).\n * @min 1\n * @max 999\n */\n interval?: number;\n}\n\nexport interface LineItem {\n /**\n * Name or title of the item.\n * @minLength 1\n * @maxLength 255\n */\n name?: string | null;\n /**\n * Quantity of this item in the cart.\n * @min 1\n */\n quantity?: number | null;\n /**\n * Price of the item as a string (e.g., \"19.99\").\n * @minLength 1\n * @maxLength 50\n */\n price?: string | null;\n /** Optional. When provided, the item becomes a recurring subscription. */\n subscriptionInfo?: SubscriptionInfo;\n}\n\n/** Customer information for pre-filling checkout details. */\nexport interface CustomerInfo {\n /**\n * Customer's first name.\n * @maxLength 100\n */\n firstName?: string | null;\n /**\n * Customer's last name.\n * @maxLength 100\n */\n lastName?: string | null;\n /**\n * Customer's phone number.\n * @format PHONE\n */\n phone?: string | null;\n /**\n * Customer's email address.\n * @format EMAIL\n */\n email?: string | null;\n}\n\nexport interface Cart {\n /**\n * List of items in the cart.\n * @maxSize 100\n */\n items?: LineItem[];\n /** Optional customer information to pre-fill checkout form. */\n customerInfo?: CustomerInfo;\n}\n\nexport interface CallbackUrls {\n /**\n * URL to redirect after the checkout flow completes.\n * @format WEB_URL\n */\n postFlowUrl?: string | null;\n /**\n * URL for the thank you page after successful payment.\n * @format WEB_URL\n */\n thankYouPageUrl?: string | null;\n}\n\n/** Response after constructing a checkout session. */\nexport interface ConstructCheckoutSessionResponse {\n /** The constructed checkout session. */\n checkoutSession?: CheckoutSession;\n}\n\n/** Request to register a webhook URL. */\nexport interface RegisterCheckoutSessionWebhookRequest {\n /**\n * The URL to receive webhook notifications.\n * @format WEB_URL\n */\n url?: string | null;\n /**\n * Webhook event types to register. When empty, defaults to [ORDER_APPROVED].\n * @maxSize 10\n */\n webhookTypes?: WebhookTypeWithLiterals[];\n}\n\n/** Type of webhook event to register. */\nexport enum WebhookType {\n /** Registers wix.ecom.v1.order_approved webhook. */\n ORDER_APPROVED = 'ORDER_APPROVED',\n /** Registers wix.ecom.subscription_contracts.v1.subscription_contract_canceled webhook. */\n SUBSCRIPTION_CANCELED = 'SUBSCRIPTION_CANCELED',\n /** Registers wix.ecom.subscription_contracts.v1.subscription_contract_expired webhook. */\n SUBSCRIPTION_ENDED = 'SUBSCRIPTION_ENDED',\n}\n\n/** @enumType */\nexport type WebhookTypeWithLiterals =\n | WebhookType\n | 'ORDER_APPROVED'\n | 'SUBSCRIPTION_CANCELED'\n | 'SUBSCRIPTION_ENDED';\n\n/** Response after registering a webhook. */\nexport interface RegisterCheckoutSessionWebhookResponse {\n /**\n * The webhook public key used for verifying webhook payloads.\n * @maxLength 1000\n */\n publicKey?: string | null;\n}\n\n/**\n * Constructs a new checkout session.\n * @param cart - Cart details including line items to be checked out.\n * @public\n * @documentationMaturity preview\n * @requiredField cart\n * @requiredField cart.items\n * @requiredField cart.items.name\n * @requiredField cart.items.price\n * @requiredField cart.items.quantity\n * @requiredField options\n * @requiredField options.callbackUrls\n * @requiredField options.callbackUrls.postFlowUrl\n * @requiredField options.callbackUrls.thankYouPageUrl\n * @permissionId payments:platform:v1:checkout_session:construct_checkout_session\n * @returns Response after constructing a checkout session.\n * @fqn wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession\n */\nexport async function constructCheckoutSession(\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n): Promise<ConstructCheckoutSessionResponse> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n cart: cart,\n callbackUrls: options?.callbackUrls,\n });\n\n const reqOpts =\n ambassadorWixPaymentsPlatformV1CheckoutSession.constructCheckoutSession(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n cart: '$[0]',\n callbackUrls: '$[1].callbackUrls',\n },\n singleArgumentUnchanged: false,\n },\n ['cart', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface ConstructCheckoutSessionOptions {\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixPaymentsPlatformV1CheckoutSessionsUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/payments/platform/v1/checkout-sessions',\n destPath: '/v1/checkout-sessions',\n },\n {\n srcPath: '/payments/base44/v1/subscriptions',\n destPath: '/v1/subscriptions',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_payments_checkout-sessions';\n\n/** Constructs a new checkout session. */\nexport function constructCheckoutSession(\n payload: object\n): RequestOptionsFactory<any> {\n function __constructCheckoutSession({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.payments.platform.v1.checkout_session',\n method: 'POST' as any,\n methodFqn:\n 'wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/construct',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __constructCheckoutSession;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n Cart,\n ConstructCheckoutSessionOptions,\n ConstructCheckoutSessionResponse,\n constructCheckoutSession as universalConstructCheckoutSession,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/payments' };\n\nexport function constructCheckoutSession(\n httpClient: HttpClient\n): ConstructCheckoutSessionSignature {\n return (\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n ) =>\n universalConstructCheckoutSession(\n cart,\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface ConstructCheckoutSessionSignature {\n /**\n * Constructs a new checkout session.\n * @param - Cart details including line items to be checked out.\n * @returns Response after constructing a checkout session.\n */\n (\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n ): Promise<ConstructCheckoutSessionResponse>;\n}\n\nexport {\n CallbackUrls,\n Cart,\n CheckoutSession,\n ConstructCheckoutSessionOptions,\n ConstructCheckoutSessionRequest,\n ConstructCheckoutSessionResponse,\n CustomerInfo,\n FreeTrialPeriod,\n LineItem,\n RegisterCheckoutSessionWebhookRequest,\n RegisterCheckoutSessionWebhookResponse,\n SubscriptionFrequency,\n SubscriptionInfo,\n SubscriptionSettings,\n WebhookType,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n","import { constructCheckoutSession as publicConstructCheckoutSession } from './payments-platform-v1-checkout-session-checkout-sessions.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const constructCheckoutSession: MaybeContext<\n BuildRESTFunction<typeof publicConstructCheckoutSession> &\n typeof publicConstructCheckoutSession\n> = /*#__PURE__*/ createRESTModule(publicConstructCheckoutSession);\n\nexport {\n SubscriptionFrequency,\n WebhookType,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\nexport {\n CheckoutSession,\n ConstructCheckoutSessionRequest,\n SubscriptionInfo,\n SubscriptionSettings,\n FreeTrialPeriod,\n LineItem,\n CustomerInfo,\n Cart,\n CallbackUrls,\n ConstructCheckoutSessionResponse,\n RegisterCheckoutSessionWebhookRequest,\n RegisterCheckoutSessionWebhookResponse,\n ConstructCheckoutSessionOptions,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\nexport {\n SubscriptionFrequencyWithLiterals,\n WebhookTypeWithLiterals,\n} from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,kBAAkB;AAI3B,SAAS,gDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAGd,SAAS,yBACd,SAC4B;AAC5B,WAAS,2BAA2B,EAAE,KAAK,GAAQ;AACjD,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,gDAAgD;AAAA,QACnD,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ADkBO,IAAK,wBAAL,kBAAKA,2BAAL;AACL,EAAAA,uBAAA,eAAY;AACZ,EAAAA,uBAAA,SAAM;AACN,EAAAA,uBAAA,UAAO;AACP,EAAAA,uBAAA,WAAQ;AACR,EAAAA,uBAAA,UAAO;AALG,SAAAA;AAAA,GAAA;AAuHL,IAAK,cAAL,kBAAKC,iBAAL;AAEL,EAAAA,aAAA,oBAAiB;AAEjB,EAAAA,aAAA,2BAAwB;AAExB,EAAAA,aAAA,wBAAqB;AANX,SAAAA;AAAA,GAAA;AA2CZ,eAAsBC,0BACpB,MAQA,SAO2C;AAE3C,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,UAAU,sCAAsC;AAAA,IACpD;AAAA,IACA,cAAc,SAAS;AAAA,EACzB,CAAC;AAED,QAAM,UAC2C;AAAA,IAC7C;AAAA,EACF;AAEF,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,WAAO,wCAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,mBAAmB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,MAAM;AAAA,UACN,cAAc;AAAA,QAChB;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,QAAQ,SAAS;AAAA,IACpB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;;;AErRO,SAASC,0BACd,YACmC;AACnC,SAAO,CACL,MAQA,YAQAA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;ACnCA,SAAS,wBAAwB;AAG1B,IAAMC,4BAGK,iCAAiBA,yBAA8B;","names":["SubscriptionFrequency","WebhookType","constructCheckoutSession","constructCheckoutSession","constructCheckoutSession"]}
|
|
@@ -164,9 +164,9 @@ interface RegisterCheckoutSessionWebhookRequest {
|
|
|
164
164
|
declare enum WebhookType {
|
|
165
165
|
/** Registers wix.ecom.v1.order_approved webhook. */
|
|
166
166
|
ORDER_APPROVED = "ORDER_APPROVED",
|
|
167
|
-
/** Registers wix.
|
|
167
|
+
/** Registers wix.ecom.subscription_contracts.v1.subscription_contract_canceled webhook. */
|
|
168
168
|
SUBSCRIPTION_CANCELED = "SUBSCRIPTION_CANCELED",
|
|
169
|
-
/** Registers wix.
|
|
169
|
+
/** Registers wix.ecom.subscription_contracts.v1.subscription_contract_expired webhook. */
|
|
170
170
|
SUBSCRIPTION_ENDED = "SUBSCRIPTION_ENDED"
|
|
171
171
|
}
|
|
172
172
|
/** @enumType */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/payments-platform-v1-checkout-session-checkout-sessions.universal.ts","../../../src/payments-platform-v1-checkout-session-checkout-sessions.http.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSession from './payments-platform-v1-checkout-session-checkout-sessions.http.js';\n\n/** A CheckoutSession is a simple entity used for demonstration purposes. */\nexport interface CheckoutSession {\n /**\n * Cart ID (from ecom cart service).\n * @readonly\n * @format GUID\n */\n _id?: string | null;\n /**\n * URL to redirect buyer.\n * @format WEB_URL\n */\n redirectUrl?: string | null;\n}\n\n/** Request to construct a checkout session. */\nexport interface ConstructCheckoutSessionRequest {\n /** Cart details including line items to be checked out. */\n cart: Cart;\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/** Subscription display and settings for a recurring line item. */\nexport interface SubscriptionInfo {\n /** Subscription settings such as frequency and billing cycles. */\n subscriptionSettings?: SubscriptionSettings;\n /**\n * Subscription title shown to the buyer.\n * @maxLength 150\n */\n title?: string | null;\n /**\n * Subscription description shown to the buyer.\n * @maxLength 500\n */\n description?: string | null;\n}\n\n/** Configuration for recurring subscription charges. */\nexport interface SubscriptionSettings {\n /** Frequency unit for recurring charges. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Number of frequency units between charges. Default: 1.\n * @min 1\n * @max 3650\n */\n interval?: number | null;\n /** Whether the subscription renews automatically. */\n autoRenewal?: boolean | null;\n /**\n * Number of billing cycles. If not provided and `auto_renewal` is not set, the subscription renews indefinitely.\n * @min 1\n */\n billingCycles?: number | null;\n /** Free trial period before the first charge. */\n freeTrialPeriod?: FreeTrialPeriod;\n}\n\n/** Frequency unit for subscription billing and trial periods. */\nexport enum SubscriptionFrequency {\n UNDEFINED = 'UNDEFINED',\n DAY = 'DAY',\n WEEK = 'WEEK',\n MONTH = 'MONTH',\n YEAR = 'YEAR',\n}\n\n/** @enumType */\nexport type SubscriptionFrequencyWithLiterals =\n | SubscriptionFrequency\n | 'UNDEFINED'\n | 'DAY'\n | 'WEEK'\n | 'MONTH'\n | 'YEAR';\n\n/** Free trial period before the first subscription charge. */\nexport interface FreeTrialPeriod {\n /** Frequency unit for the trial period. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Duration in frequency units (e.g., 14 with DAY = 14-day trial).\n * @min 1\n * @max 999\n */\n interval?: number;\n}\n\nexport interface LineItem {\n /**\n * Name or title of the item.\n * @minLength 1\n * @maxLength 255\n */\n name?: string | null;\n /**\n * Quantity of this item in the cart.\n * @min 1\n */\n quantity?: number | null;\n /**\n * Price of the item as a string (e.g., \"19.99\").\n * @minLength 1\n * @maxLength 50\n */\n price?: string | null;\n /** Optional. When provided, the item becomes a recurring subscription. */\n subscriptionInfo?: SubscriptionInfo;\n}\n\n/** Customer information for pre-filling checkout details. */\nexport interface CustomerInfo {\n /**\n * Customer's first name.\n * @maxLength 100\n */\n firstName?: string | null;\n /**\n * Customer's last name.\n * @maxLength 100\n */\n lastName?: string | null;\n /**\n * Customer's phone number.\n * @format PHONE\n */\n phone?: string | null;\n /**\n * Customer's email address.\n * @format EMAIL\n */\n email?: string | null;\n}\n\nexport interface Cart {\n /**\n * List of items in the cart.\n * @maxSize 100\n */\n items?: LineItem[];\n /** Optional customer information to pre-fill checkout form. */\n customerInfo?: CustomerInfo;\n}\n\nexport interface CallbackUrls {\n /**\n * URL to redirect after the checkout flow completes.\n * @format WEB_URL\n */\n postFlowUrl?: string | null;\n /**\n * URL for the thank you page after successful payment.\n * @format WEB_URL\n */\n thankYouPageUrl?: string | null;\n}\n\n/** Response after constructing a checkout session. */\nexport interface ConstructCheckoutSessionResponse {\n /** The constructed checkout session. */\n checkoutSession?: CheckoutSession;\n}\n\n/** Request to register a webhook URL. */\nexport interface RegisterCheckoutSessionWebhookRequest {\n /**\n * The URL to receive webhook notifications.\n * @format WEB_URL\n */\n url?: string | null;\n /**\n * Webhook event types to register. When empty, defaults to [ORDER_APPROVED].\n * @maxSize 10\n */\n webhookTypes?: WebhookTypeWithLiterals[];\n}\n\n/** Type of webhook event to register. */\nexport enum WebhookType {\n /** Registers wix.ecom.v1.order_approved webhook. */\n ORDER_APPROVED = 'ORDER_APPROVED',\n /** Registers wix.billing.v1.subscription_canceled webhook. */\n SUBSCRIPTION_CANCELED = 'SUBSCRIPTION_CANCELED',\n /** Registers wix.billing.v1.subscription_ended webhook. */\n SUBSCRIPTION_ENDED = 'SUBSCRIPTION_ENDED',\n}\n\n/** @enumType */\nexport type WebhookTypeWithLiterals =\n | WebhookType\n | 'ORDER_APPROVED'\n | 'SUBSCRIPTION_CANCELED'\n | 'SUBSCRIPTION_ENDED';\n\n/** Response after registering a webhook. */\nexport interface RegisterCheckoutSessionWebhookResponse {\n /**\n * The webhook public key used for verifying webhook payloads.\n * @maxLength 1000\n */\n publicKey?: string | null;\n}\n\n/**\n * Constructs a new checkout session.\n * @param cart - Cart details including line items to be checked out.\n * @public\n * @documentationMaturity preview\n * @requiredField cart\n * @requiredField cart.items\n * @requiredField cart.items.name\n * @requiredField cart.items.price\n * @requiredField cart.items.quantity\n * @requiredField options\n * @requiredField options.callbackUrls\n * @requiredField options.callbackUrls.postFlowUrl\n * @requiredField options.callbackUrls.thankYouPageUrl\n * @permissionId payments:platform:v1:checkout_session:construct_checkout_session\n * @returns Response after constructing a checkout session.\n * @fqn wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession\n */\nexport async function constructCheckoutSession(\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n): Promise<ConstructCheckoutSessionResponse> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n cart: cart,\n callbackUrls: options?.callbackUrls,\n });\n\n const reqOpts =\n ambassadorWixPaymentsPlatformV1CheckoutSession.constructCheckoutSession(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n cart: '$[0]',\n callbackUrls: '$[1].callbackUrls',\n },\n singleArgumentUnchanged: false,\n },\n ['cart', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface ConstructCheckoutSessionOptions {\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixPaymentsPlatformV1CheckoutSessionsUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/payments/platform/v1/checkout-sessions',\n destPath: '/v1/checkout-sessions',\n },\n {\n srcPath: '/payments/base44/v1/subscriptions',\n destPath: '/v1/subscriptions',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_payments_checkout-sessions';\n\n/** Constructs a new checkout session. */\nexport function constructCheckoutSession(\n payload: object\n): RequestOptionsFactory<any> {\n function __constructCheckoutSession({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.payments.platform.v1.checkout_session',\n method: 'POST' as any,\n methodFqn:\n 'wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/construct',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __constructCheckoutSession;\n}\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,kBAAkB;AAI3B,SAAS,gDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAGd,SAAS,yBACd,SAC4B;AAC5B,WAAS,2BAA2B,EAAE,KAAK,GAAQ;AACjD,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,gDAAgD;AAAA,QACnD,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ADkBO,IAAK,wBAAL,kBAAKA,2BAAL;AACL,EAAAA,uBAAA,eAAY;AACZ,EAAAA,uBAAA,SAAM;AACN,EAAAA,uBAAA,UAAO;AACP,EAAAA,uBAAA,WAAQ;AACR,EAAAA,uBAAA,UAAO;AALG,SAAAA;AAAA,GAAA;AAuHL,IAAK,cAAL,kBAAKC,iBAAL;AAEL,EAAAA,aAAA,oBAAiB;AAEjB,EAAAA,aAAA,2BAAwB;AAExB,EAAAA,aAAA,wBAAqB;AANX,SAAAA;AAAA,GAAA;AA2CZ,eAAsBC,0BACpB,MAQA,SAO2C;AAE3C,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,UAAU,sCAAsC;AAAA,IACpD;AAAA,IACA,cAAc,SAAS;AAAA,EACzB,CAAC;AAED,QAAM,UAC2C;AAAA,IAC7C;AAAA,EACF;AAEF,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,WAAO,wCAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,mBAAmB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,MAAM;AAAA,UACN,cAAc;AAAA,QAChB;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,QAAQ,SAAS;AAAA,IACpB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["SubscriptionFrequency","WebhookType","constructCheckoutSession"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/payments-platform-v1-checkout-session-checkout-sessions.universal.ts","../../../src/payments-platform-v1-checkout-session-checkout-sessions.http.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSession from './payments-platform-v1-checkout-session-checkout-sessions.http.js';\n\n/** A CheckoutSession is a simple entity used for demonstration purposes. */\nexport interface CheckoutSession {\n /**\n * Cart ID (from ecom cart service).\n * @readonly\n * @format GUID\n */\n _id?: string | null;\n /**\n * URL to redirect buyer.\n * @format WEB_URL\n */\n redirectUrl?: string | null;\n}\n\n/** Request to construct a checkout session. */\nexport interface ConstructCheckoutSessionRequest {\n /** Cart details including line items to be checked out. */\n cart: Cart;\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/** Subscription display and settings for a recurring line item. */\nexport interface SubscriptionInfo {\n /** Subscription settings such as frequency and billing cycles. */\n subscriptionSettings?: SubscriptionSettings;\n /**\n * Subscription title shown to the buyer.\n * @maxLength 150\n */\n title?: string | null;\n /**\n * Subscription description shown to the buyer.\n * @maxLength 500\n */\n description?: string | null;\n}\n\n/** Configuration for recurring subscription charges. */\nexport interface SubscriptionSettings {\n /** Frequency unit for recurring charges. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Number of frequency units between charges. Default: 1.\n * @min 1\n * @max 3650\n */\n interval?: number | null;\n /** Whether the subscription renews automatically. */\n autoRenewal?: boolean | null;\n /**\n * Number of billing cycles. If not provided and `auto_renewal` is not set, the subscription renews indefinitely.\n * @min 1\n */\n billingCycles?: number | null;\n /** Free trial period before the first charge. */\n freeTrialPeriod?: FreeTrialPeriod;\n}\n\n/** Frequency unit for subscription billing and trial periods. */\nexport enum SubscriptionFrequency {\n UNDEFINED = 'UNDEFINED',\n DAY = 'DAY',\n WEEK = 'WEEK',\n MONTH = 'MONTH',\n YEAR = 'YEAR',\n}\n\n/** @enumType */\nexport type SubscriptionFrequencyWithLiterals =\n | SubscriptionFrequency\n | 'UNDEFINED'\n | 'DAY'\n | 'WEEK'\n | 'MONTH'\n | 'YEAR';\n\n/** Free trial period before the first subscription charge. */\nexport interface FreeTrialPeriod {\n /** Frequency unit for the trial period. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Duration in frequency units (e.g., 14 with DAY = 14-day trial).\n * @min 1\n * @max 999\n */\n interval?: number;\n}\n\nexport interface LineItem {\n /**\n * Name or title of the item.\n * @minLength 1\n * @maxLength 255\n */\n name?: string | null;\n /**\n * Quantity of this item in the cart.\n * @min 1\n */\n quantity?: number | null;\n /**\n * Price of the item as a string (e.g., \"19.99\").\n * @minLength 1\n * @maxLength 50\n */\n price?: string | null;\n /** Optional. When provided, the item becomes a recurring subscription. */\n subscriptionInfo?: SubscriptionInfo;\n}\n\n/** Customer information for pre-filling checkout details. */\nexport interface CustomerInfo {\n /**\n * Customer's first name.\n * @maxLength 100\n */\n firstName?: string | null;\n /**\n * Customer's last name.\n * @maxLength 100\n */\n lastName?: string | null;\n /**\n * Customer's phone number.\n * @format PHONE\n */\n phone?: string | null;\n /**\n * Customer's email address.\n * @format EMAIL\n */\n email?: string | null;\n}\n\nexport interface Cart {\n /**\n * List of items in the cart.\n * @maxSize 100\n */\n items?: LineItem[];\n /** Optional customer information to pre-fill checkout form. */\n customerInfo?: CustomerInfo;\n}\n\nexport interface CallbackUrls {\n /**\n * URL to redirect after the checkout flow completes.\n * @format WEB_URL\n */\n postFlowUrl?: string | null;\n /**\n * URL for the thank you page after successful payment.\n * @format WEB_URL\n */\n thankYouPageUrl?: string | null;\n}\n\n/** Response after constructing a checkout session. */\nexport interface ConstructCheckoutSessionResponse {\n /** The constructed checkout session. */\n checkoutSession?: CheckoutSession;\n}\n\n/** Request to register a webhook URL. */\nexport interface RegisterCheckoutSessionWebhookRequest {\n /**\n * The URL to receive webhook notifications.\n * @format WEB_URL\n */\n url?: string | null;\n /**\n * Webhook event types to register. When empty, defaults to [ORDER_APPROVED].\n * @maxSize 10\n */\n webhookTypes?: WebhookTypeWithLiterals[];\n}\n\n/** Type of webhook event to register. */\nexport enum WebhookType {\n /** Registers wix.ecom.v1.order_approved webhook. */\n ORDER_APPROVED = 'ORDER_APPROVED',\n /** Registers wix.ecom.subscription_contracts.v1.subscription_contract_canceled webhook. */\n SUBSCRIPTION_CANCELED = 'SUBSCRIPTION_CANCELED',\n /** Registers wix.ecom.subscription_contracts.v1.subscription_contract_expired webhook. */\n SUBSCRIPTION_ENDED = 'SUBSCRIPTION_ENDED',\n}\n\n/** @enumType */\nexport type WebhookTypeWithLiterals =\n | WebhookType\n | 'ORDER_APPROVED'\n | 'SUBSCRIPTION_CANCELED'\n | 'SUBSCRIPTION_ENDED';\n\n/** Response after registering a webhook. */\nexport interface RegisterCheckoutSessionWebhookResponse {\n /**\n * The webhook public key used for verifying webhook payloads.\n * @maxLength 1000\n */\n publicKey?: string | null;\n}\n\n/**\n * Constructs a new checkout session.\n * @param cart - Cart details including line items to be checked out.\n * @public\n * @documentationMaturity preview\n * @requiredField cart\n * @requiredField cart.items\n * @requiredField cart.items.name\n * @requiredField cart.items.price\n * @requiredField cart.items.quantity\n * @requiredField options\n * @requiredField options.callbackUrls\n * @requiredField options.callbackUrls.postFlowUrl\n * @requiredField options.callbackUrls.thankYouPageUrl\n * @permissionId payments:platform:v1:checkout_session:construct_checkout_session\n * @returns Response after constructing a checkout session.\n * @fqn wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession\n */\nexport async function constructCheckoutSession(\n cart: NonNullablePaths<\n Cart,\n | `items`\n | `items.${number}.name`\n | `items.${number}.price`\n | `items.${number}.quantity`,\n 4\n >,\n options: NonNullablePaths<\n ConstructCheckoutSessionOptions,\n | `callbackUrls`\n | `callbackUrls.postFlowUrl`\n | `callbackUrls.thankYouPageUrl`,\n 3\n >\n): Promise<ConstructCheckoutSessionResponse> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n cart: cart,\n callbackUrls: options?.callbackUrls,\n });\n\n const reqOpts =\n ambassadorWixPaymentsPlatformV1CheckoutSession.constructCheckoutSession(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n cart: '$[0]',\n callbackUrls: '$[1].callbackUrls',\n },\n singleArgumentUnchanged: false,\n },\n ['cart', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface ConstructCheckoutSessionOptions {\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixPaymentsPlatformV1CheckoutSessionsUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/payments/platform/v1/checkout-sessions',\n destPath: '/v1/checkout-sessions',\n },\n {\n srcPath: '/payments/base44/v1/subscriptions',\n destPath: '/v1/subscriptions',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_payments_checkout-sessions';\n\n/** Constructs a new checkout session. */\nexport function constructCheckoutSession(\n payload: object\n): RequestOptionsFactory<any> {\n function __constructCheckoutSession({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.payments.platform.v1.checkout_session',\n method: 'POST' as any,\n methodFqn:\n 'wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/construct',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __constructCheckoutSession;\n}\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,kBAAkB;AAI3B,SAAS,gDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAGd,SAAS,yBACd,SAC4B;AAC5B,WAAS,2BAA2B,EAAE,KAAK,GAAQ;AACjD,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,gDAAgD;AAAA,QACnD,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ADkBO,IAAK,wBAAL,kBAAKA,2BAAL;AACL,EAAAA,uBAAA,eAAY;AACZ,EAAAA,uBAAA,SAAM;AACN,EAAAA,uBAAA,UAAO;AACP,EAAAA,uBAAA,WAAQ;AACR,EAAAA,uBAAA,UAAO;AALG,SAAAA;AAAA,GAAA;AAuHL,IAAK,cAAL,kBAAKC,iBAAL;AAEL,EAAAA,aAAA,oBAAiB;AAEjB,EAAAA,aAAA,2BAAwB;AAExB,EAAAA,aAAA,wBAAqB;AANX,SAAAA;AAAA,GAAA;AA2CZ,eAAsBC,0BACpB,MAQA,SAO2C;AAE3C,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,UAAU,sCAAsC;AAAA,IACpD;AAAA,IACA,cAAc,SAAS;AAAA,EACzB,CAAC;AAED,QAAM,UAC2C;AAAA,IAC7C;AAAA,EACF;AAEF,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,WAAO,wCAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,mBAAmB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,MAAM;AAAA,UACN,cAAc;AAAA,QAChB;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,QAAQ,SAAS;AAAA,IACpB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["SubscriptionFrequency","WebhookType","constructCheckoutSession"]}
|
|
@@ -165,9 +165,9 @@ interface RegisterCheckoutSessionWebhookRequest {
|
|
|
165
165
|
declare enum WebhookType {
|
|
166
166
|
/** Registers wix.ecom.v1.order_approved webhook. */
|
|
167
167
|
ORDER_APPROVED = "ORDER_APPROVED",
|
|
168
|
-
/** Registers wix.
|
|
168
|
+
/** Registers wix.ecom.subscription_contracts.v1.subscription_contract_canceled webhook. */
|
|
169
169
|
SUBSCRIPTION_CANCELED = "SUBSCRIPTION_CANCELED",
|
|
170
|
-
/** Registers wix.
|
|
170
|
+
/** Registers wix.ecom.subscription_contracts.v1.subscription_contract_expired webhook. */
|
|
171
171
|
SUBSCRIPTION_ENDED = "SUBSCRIPTION_ENDED"
|
|
172
172
|
}
|
|
173
173
|
/** @enumType */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/payments-platform-v1-checkout-session-checkout-sessions.http.ts","../../../src/payments-platform-v1-checkout-session-checkout-sessions.types.ts","../../../src/payments-platform-v1-checkout-session-checkout-sessions.meta.ts"],"sourcesContent":["import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixPaymentsPlatformV1CheckoutSessionsUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/payments/platform/v1/checkout-sessions',\n destPath: '/v1/checkout-sessions',\n },\n {\n srcPath: '/payments/base44/v1/subscriptions',\n destPath: '/v1/subscriptions',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_payments_checkout-sessions';\n\n/** Constructs a new checkout session. */\nexport function constructCheckoutSession(\n payload: object\n): RequestOptionsFactory<any> {\n function __constructCheckoutSession({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.payments.platform.v1.checkout_session',\n method: 'POST' as any,\n methodFqn:\n 'wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/construct',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __constructCheckoutSession;\n}\n","/** A CheckoutSession is a simple entity used for demonstration purposes. */\nexport interface CheckoutSession {\n /**\n * Cart ID (from ecom cart service).\n * @readonly\n * @format GUID\n */\n id?: string | null;\n /**\n * URL to redirect buyer.\n * @format WEB_URL\n */\n redirectUrl?: string | null;\n}\n\n/** Request to construct a checkout session. */\nexport interface ConstructCheckoutSessionRequest {\n /** Cart details including line items to be checked out. */\n cart: Cart;\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/** Subscription display and settings for a recurring line item. */\nexport interface SubscriptionInfo {\n /** Subscription settings such as frequency and billing cycles. */\n subscriptionSettings?: SubscriptionSettings;\n /**\n * Subscription title shown to the buyer.\n * @maxLength 150\n */\n title?: string | null;\n /**\n * Subscription description shown to the buyer.\n * @maxLength 500\n */\n description?: string | null;\n}\n\n/** Configuration for recurring subscription charges. */\nexport interface SubscriptionSettings {\n /** Frequency unit for recurring charges. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Number of frequency units between charges. Default: 1.\n * @min 1\n * @max 3650\n */\n interval?: number | null;\n /** Whether the subscription renews automatically. */\n autoRenewal?: boolean | null;\n /**\n * Number of billing cycles. If not provided and `auto_renewal` is not set, the subscription renews indefinitely.\n * @min 1\n */\n billingCycles?: number | null;\n /** Free trial period before the first charge. */\n freeTrialPeriod?: FreeTrialPeriod;\n}\n\n/** Frequency unit for subscription billing and trial periods. */\nexport enum SubscriptionFrequency {\n UNDEFINED = 'UNDEFINED',\n DAY = 'DAY',\n WEEK = 'WEEK',\n MONTH = 'MONTH',\n YEAR = 'YEAR',\n}\n\n/** @enumType */\nexport type SubscriptionFrequencyWithLiterals =\n | SubscriptionFrequency\n | 'UNDEFINED'\n | 'DAY'\n | 'WEEK'\n | 'MONTH'\n | 'YEAR';\n\n/** Free trial period before the first subscription charge. */\nexport interface FreeTrialPeriod {\n /** Frequency unit for the trial period. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Duration in frequency units (e.g., 14 with DAY = 14-day trial).\n * @min 1\n * @max 999\n */\n interval?: number;\n}\n\nexport interface LineItem {\n /**\n * Name or title of the item.\n * @minLength 1\n * @maxLength 255\n */\n name?: string | null;\n /**\n * Quantity of this item in the cart.\n * @min 1\n */\n quantity?: number | null;\n /**\n * Price of the item as a string (e.g., \"19.99\").\n * @minLength 1\n * @maxLength 50\n */\n price?: string | null;\n /** Optional. When provided, the item becomes a recurring subscription. */\n subscriptionInfo?: SubscriptionInfo;\n}\n\n/** Customer information for pre-filling checkout details. */\nexport interface CustomerInfo {\n /**\n * Customer's first name.\n * @maxLength 100\n */\n firstName?: string | null;\n /**\n * Customer's last name.\n * @maxLength 100\n */\n lastName?: string | null;\n /**\n * Customer's phone number.\n * @format PHONE\n */\n phone?: string | null;\n /**\n * Customer's email address.\n * @format EMAIL\n */\n email?: string | null;\n}\n\nexport interface Cart {\n /**\n * List of items in the cart.\n * @maxSize 100\n */\n items?: LineItem[];\n /** Optional customer information to pre-fill checkout form. */\n customerInfo?: CustomerInfo;\n}\n\nexport interface CallbackUrls {\n /**\n * URL to redirect after the checkout flow completes.\n * @format WEB_URL\n */\n postFlowUrl?: string | null;\n /**\n * URL for the thank you page after successful payment.\n * @format WEB_URL\n */\n thankYouPageUrl?: string | null;\n}\n\n/** Response after constructing a checkout session. */\nexport interface ConstructCheckoutSessionResponse {\n /** The constructed checkout session. */\n checkoutSession?: CheckoutSession;\n}\n\n/** Request to register a webhook URL. */\nexport interface RegisterCheckoutSessionWebhookRequest {\n /**\n * The URL to receive webhook notifications.\n * @format WEB_URL\n */\n url?: string | null;\n /**\n * Webhook event types to register. When empty, defaults to [ORDER_APPROVED].\n * @maxSize 10\n */\n webhookTypes?: WebhookTypeWithLiterals[];\n}\n\n/** Type of webhook event to register. */\nexport enum WebhookType {\n /** Registers wix.ecom.v1.order_approved webhook. */\n ORDER_APPROVED = 'ORDER_APPROVED',\n /** Registers wix.billing.v1.subscription_canceled webhook. */\n SUBSCRIPTION_CANCELED = 'SUBSCRIPTION_CANCELED',\n /** Registers wix.billing.v1.subscription_ended webhook. */\n SUBSCRIPTION_ENDED = 'SUBSCRIPTION_ENDED',\n}\n\n/** @enumType */\nexport type WebhookTypeWithLiterals =\n | WebhookType\n | 'ORDER_APPROVED'\n | 'SUBSCRIPTION_CANCELED'\n | 'SUBSCRIPTION_ENDED';\n\n/** Response after registering a webhook. */\nexport interface RegisterCheckoutSessionWebhookResponse {\n /**\n * The webhook public key used for verifying webhook payloads.\n * @maxLength 1000\n */\n publicKey?: string | null;\n}\n","import * as ambassadorWixPaymentsPlatformV1CheckoutSession from './payments-platform-v1-checkout-session-checkout-sessions.http.js';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSessionTypes from './payments-platform-v1-checkout-session-checkout-sessions.types.js';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n\nexport type __PublicMethodMetaInfo<\n K = string,\n M = unknown,\n T = unknown,\n S = unknown,\n Q = unknown,\n R = unknown\n> = {\n getUrl: (context: any) => string;\n httpMethod: K;\n path: string;\n pathParams: M;\n __requestType: T;\n __originalRequestType: S;\n __responseType: Q;\n __originalResponseType: R;\n};\n\nexport function constructCheckoutSession(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes.ConstructCheckoutSessionRequest,\n ambassadorWixPaymentsPlatformV1CheckoutSessionTypes.ConstructCheckoutSessionRequest,\n ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes.ConstructCheckoutSessionResponse,\n ambassadorWixPaymentsPlatformV1CheckoutSessionTypes.ConstructCheckoutSessionResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixPaymentsPlatformV1CheckoutSession.constructCheckoutSession(\n payload\n );\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v1/checkout-sessions/construct',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport {\n CheckoutSession as CheckoutSessionOriginal,\n ConstructCheckoutSessionRequest as ConstructCheckoutSessionRequestOriginal,\n SubscriptionInfo as SubscriptionInfoOriginal,\n SubscriptionSettings as SubscriptionSettingsOriginal,\n SubscriptionFrequency as SubscriptionFrequencyOriginal,\n SubscriptionFrequencyWithLiterals as SubscriptionFrequencyWithLiteralsOriginal,\n FreeTrialPeriod as FreeTrialPeriodOriginal,\n LineItem as LineItemOriginal,\n CustomerInfo as CustomerInfoOriginal,\n Cart as CartOriginal,\n CallbackUrls as CallbackUrlsOriginal,\n ConstructCheckoutSessionResponse as ConstructCheckoutSessionResponseOriginal,\n RegisterCheckoutSessionWebhookRequest as RegisterCheckoutSessionWebhookRequestOriginal,\n WebhookType as WebhookTypeOriginal,\n WebhookTypeWithLiterals as WebhookTypeWithLiteralsOriginal,\n RegisterCheckoutSessionWebhookResponse as RegisterCheckoutSessionWebhookResponseOriginal,\n} from './payments-platform-v1-checkout-session-checkout-sessions.types.js';\n"],"mappings":";AAAA,SAAS,kBAAkB;AAI3B,SAAS,gDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAGd,SAAS,yBACd,SAC4B;AAC5B,WAAS,2BAA2B,EAAE,KAAK,GAAQ;AACjD,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,gDAAgD;AAAA,QACnD,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ACUO,IAAK,wBAAL,kBAAKA,2BAAL;AACL,EAAAA,uBAAA,eAAY;AACZ,EAAAA,uBAAA,SAAM;AACN,EAAAA,uBAAA,UAAO;AACP,EAAAA,uBAAA,WAAQ;AACR,EAAAA,uBAAA,UAAO;AALG,SAAAA;AAAA,GAAA;AAuHL,IAAK,cAAL,kBAAKC,iBAAL;AAEL,EAAAA,aAAA,oBAAiB;AAEjB,EAAAA,aAAA,2BAAwB;AAExB,EAAAA,aAAA,wBAAqB;AANX,SAAAA;AAAA,GAAA;;;AC9JL,SAASC,4BAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBAC2C;AAAA,IAC7C;AAAA,EACF;AAEF,QAAM,SAAS,CAAC,YAAyB;AACvC,UAAM,EAAE,IAAI,IAAI,kBAAkB,OAAO;AACzC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,YAAY,CAAC;AAAA,IACb,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;","names":["SubscriptionFrequency","WebhookType","constructCheckoutSession"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/payments-platform-v1-checkout-session-checkout-sessions.http.ts","../../../src/payments-platform-v1-checkout-session-checkout-sessions.types.ts","../../../src/payments-platform-v1-checkout-session-checkout-sessions.meta.ts"],"sourcesContent":["import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixPaymentsPlatformV1CheckoutSessionsUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/payments/platform/v1/checkout-sessions',\n destPath: '/v1/checkout-sessions',\n },\n {\n srcPath: '/payments/base44/v1/subscriptions',\n destPath: '/v1/subscriptions',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_payments_checkout-sessions';\n\n/** Constructs a new checkout session. */\nexport function constructCheckoutSession(\n payload: object\n): RequestOptionsFactory<any> {\n function __constructCheckoutSession({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.payments.platform.v1.checkout_session',\n method: 'POST' as any,\n methodFqn:\n 'wix.payments.platform.v1.CheckoutSessions.ConstructCheckoutSession',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixPaymentsPlatformV1CheckoutSessionsUrl({\n protoPath: '/v1/checkout-sessions/construct',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __constructCheckoutSession;\n}\n","/** A CheckoutSession is a simple entity used for demonstration purposes. */\nexport interface CheckoutSession {\n /**\n * Cart ID (from ecom cart service).\n * @readonly\n * @format GUID\n */\n id?: string | null;\n /**\n * URL to redirect buyer.\n * @format WEB_URL\n */\n redirectUrl?: string | null;\n}\n\n/** Request to construct a checkout session. */\nexport interface ConstructCheckoutSessionRequest {\n /** Cart details including line items to be checked out. */\n cart: Cart;\n /** Callback URLs for redirecting the user after checkout flow. */\n callbackUrls: CallbackUrls;\n}\n\n/** Subscription display and settings for a recurring line item. */\nexport interface SubscriptionInfo {\n /** Subscription settings such as frequency and billing cycles. */\n subscriptionSettings?: SubscriptionSettings;\n /**\n * Subscription title shown to the buyer.\n * @maxLength 150\n */\n title?: string | null;\n /**\n * Subscription description shown to the buyer.\n * @maxLength 500\n */\n description?: string | null;\n}\n\n/** Configuration for recurring subscription charges. */\nexport interface SubscriptionSettings {\n /** Frequency unit for recurring charges. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Number of frequency units between charges. Default: 1.\n * @min 1\n * @max 3650\n */\n interval?: number | null;\n /** Whether the subscription renews automatically. */\n autoRenewal?: boolean | null;\n /**\n * Number of billing cycles. If not provided and `auto_renewal` is not set, the subscription renews indefinitely.\n * @min 1\n */\n billingCycles?: number | null;\n /** Free trial period before the first charge. */\n freeTrialPeriod?: FreeTrialPeriod;\n}\n\n/** Frequency unit for subscription billing and trial periods. */\nexport enum SubscriptionFrequency {\n UNDEFINED = 'UNDEFINED',\n DAY = 'DAY',\n WEEK = 'WEEK',\n MONTH = 'MONTH',\n YEAR = 'YEAR',\n}\n\n/** @enumType */\nexport type SubscriptionFrequencyWithLiterals =\n | SubscriptionFrequency\n | 'UNDEFINED'\n | 'DAY'\n | 'WEEK'\n | 'MONTH'\n | 'YEAR';\n\n/** Free trial period before the first subscription charge. */\nexport interface FreeTrialPeriod {\n /** Frequency unit for the trial period. */\n frequency?: SubscriptionFrequencyWithLiterals;\n /**\n * Duration in frequency units (e.g., 14 with DAY = 14-day trial).\n * @min 1\n * @max 999\n */\n interval?: number;\n}\n\nexport interface LineItem {\n /**\n * Name or title of the item.\n * @minLength 1\n * @maxLength 255\n */\n name?: string | null;\n /**\n * Quantity of this item in the cart.\n * @min 1\n */\n quantity?: number | null;\n /**\n * Price of the item as a string (e.g., \"19.99\").\n * @minLength 1\n * @maxLength 50\n */\n price?: string | null;\n /** Optional. When provided, the item becomes a recurring subscription. */\n subscriptionInfo?: SubscriptionInfo;\n}\n\n/** Customer information for pre-filling checkout details. */\nexport interface CustomerInfo {\n /**\n * Customer's first name.\n * @maxLength 100\n */\n firstName?: string | null;\n /**\n * Customer's last name.\n * @maxLength 100\n */\n lastName?: string | null;\n /**\n * Customer's phone number.\n * @format PHONE\n */\n phone?: string | null;\n /**\n * Customer's email address.\n * @format EMAIL\n */\n email?: string | null;\n}\n\nexport interface Cart {\n /**\n * List of items in the cart.\n * @maxSize 100\n */\n items?: LineItem[];\n /** Optional customer information to pre-fill checkout form. */\n customerInfo?: CustomerInfo;\n}\n\nexport interface CallbackUrls {\n /**\n * URL to redirect after the checkout flow completes.\n * @format WEB_URL\n */\n postFlowUrl?: string | null;\n /**\n * URL for the thank you page after successful payment.\n * @format WEB_URL\n */\n thankYouPageUrl?: string | null;\n}\n\n/** Response after constructing a checkout session. */\nexport interface ConstructCheckoutSessionResponse {\n /** The constructed checkout session. */\n checkoutSession?: CheckoutSession;\n}\n\n/** Request to register a webhook URL. */\nexport interface RegisterCheckoutSessionWebhookRequest {\n /**\n * The URL to receive webhook notifications.\n * @format WEB_URL\n */\n url?: string | null;\n /**\n * Webhook event types to register. When empty, defaults to [ORDER_APPROVED].\n * @maxSize 10\n */\n webhookTypes?: WebhookTypeWithLiterals[];\n}\n\n/** Type of webhook event to register. */\nexport enum WebhookType {\n /** Registers wix.ecom.v1.order_approved webhook. */\n ORDER_APPROVED = 'ORDER_APPROVED',\n /** Registers wix.ecom.subscription_contracts.v1.subscription_contract_canceled webhook. */\n SUBSCRIPTION_CANCELED = 'SUBSCRIPTION_CANCELED',\n /** Registers wix.ecom.subscription_contracts.v1.subscription_contract_expired webhook. */\n SUBSCRIPTION_ENDED = 'SUBSCRIPTION_ENDED',\n}\n\n/** @enumType */\nexport type WebhookTypeWithLiterals =\n | WebhookType\n | 'ORDER_APPROVED'\n | 'SUBSCRIPTION_CANCELED'\n | 'SUBSCRIPTION_ENDED';\n\n/** Response after registering a webhook. */\nexport interface RegisterCheckoutSessionWebhookResponse {\n /**\n * The webhook public key used for verifying webhook payloads.\n * @maxLength 1000\n */\n publicKey?: string | null;\n}\n","import * as ambassadorWixPaymentsPlatformV1CheckoutSession from './payments-platform-v1-checkout-session-checkout-sessions.http.js';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSessionTypes from './payments-platform-v1-checkout-session-checkout-sessions.types.js';\nimport * as ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes from './payments-platform-v1-checkout-session-checkout-sessions.universal.js';\n\nexport type __PublicMethodMetaInfo<\n K = string,\n M = unknown,\n T = unknown,\n S = unknown,\n Q = unknown,\n R = unknown\n> = {\n getUrl: (context: any) => string;\n httpMethod: K;\n path: string;\n pathParams: M;\n __requestType: T;\n __originalRequestType: S;\n __responseType: Q;\n __originalResponseType: R;\n};\n\nexport function constructCheckoutSession(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes.ConstructCheckoutSessionRequest,\n ambassadorWixPaymentsPlatformV1CheckoutSessionTypes.ConstructCheckoutSessionRequest,\n ambassadorWixPaymentsPlatformV1CheckoutSessionUniversalTypes.ConstructCheckoutSessionResponse,\n ambassadorWixPaymentsPlatformV1CheckoutSessionTypes.ConstructCheckoutSessionResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixPaymentsPlatformV1CheckoutSession.constructCheckoutSession(\n payload\n );\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v1/checkout-sessions/construct',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport {\n CheckoutSession as CheckoutSessionOriginal,\n ConstructCheckoutSessionRequest as ConstructCheckoutSessionRequestOriginal,\n SubscriptionInfo as SubscriptionInfoOriginal,\n SubscriptionSettings as SubscriptionSettingsOriginal,\n SubscriptionFrequency as SubscriptionFrequencyOriginal,\n SubscriptionFrequencyWithLiterals as SubscriptionFrequencyWithLiteralsOriginal,\n FreeTrialPeriod as FreeTrialPeriodOriginal,\n LineItem as LineItemOriginal,\n CustomerInfo as CustomerInfoOriginal,\n Cart as CartOriginal,\n CallbackUrls as CallbackUrlsOriginal,\n ConstructCheckoutSessionResponse as ConstructCheckoutSessionResponseOriginal,\n RegisterCheckoutSessionWebhookRequest as RegisterCheckoutSessionWebhookRequestOriginal,\n WebhookType as WebhookTypeOriginal,\n WebhookTypeWithLiterals as WebhookTypeWithLiteralsOriginal,\n RegisterCheckoutSessionWebhookResponse as RegisterCheckoutSessionWebhookResponseOriginal,\n} from './payments-platform-v1-checkout-session-checkout-sessions.types.js';\n"],"mappings":";AAAA,SAAS,kBAAkB;AAI3B,SAAS,gDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAGd,SAAS,yBACd,SAC4B;AAC5B,WAAS,2BAA2B,EAAE,KAAK,GAAQ;AACjD,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,gDAAgD;AAAA,QACnD,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ACUO,IAAK,wBAAL,kBAAKA,2BAAL;AACL,EAAAA,uBAAA,eAAY;AACZ,EAAAA,uBAAA,SAAM;AACN,EAAAA,uBAAA,UAAO;AACP,EAAAA,uBAAA,WAAQ;AACR,EAAAA,uBAAA,UAAO;AALG,SAAAA;AAAA,GAAA;AAuHL,IAAK,cAAL,kBAAKC,iBAAL;AAEL,EAAAA,aAAA,oBAAiB;AAEjB,EAAAA,aAAA,2BAAwB;AAExB,EAAAA,aAAA,wBAAqB;AANX,SAAAA;AAAA,GAAA;;;AC9JL,SAASC,4BAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBAC2C;AAAA,IAC7C;AAAA,EACF;AAEF,QAAM,SAAS,CAAC,YAAyB;AACvC,UAAM,EAAE,IAAI,IAAI,kBAAkB,OAAO;AACzC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,YAAY,CAAC;AAAA,IACb,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;","names":["SubscriptionFrequency","WebhookType","constructCheckoutSession"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/auto_sdk_payments_checkout-sessions",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"schemas"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@wix/sdk-runtime": "^1.0.
|
|
39
|
-
"@wix/sdk-types": "^1.17.
|
|
38
|
+
"@wix/sdk-runtime": "^1.0.12",
|
|
39
|
+
"@wix/sdk-types": "^1.17.7",
|
|
40
40
|
"zod": "^4.3.6"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"fqdn": "wix.payments.platform.v1.checkout_session"
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
|
-
"falconPackageHash": "
|
|
60
|
+
"falconPackageHash": "1aa448fecafa60671469961fdaec581d3614c5c78f0bc4cc98535627"
|
|
61
61
|
}
|