@wix/auto_sdk_app-management_external-billing 1.0.25 → 1.0.26
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 +8 -0
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.typings.js +8 -0
- package/build/cjs/index.typings.js.map +1 -1
- package/build/cjs/meta.js +8 -0
- package/build/cjs/meta.js.map +1 -1
- package/build/es/index.mjs +8 -0
- package/build/es/index.mjs.map +1 -1
- package/build/es/index.typings.mjs +8 -0
- package/build/es/index.typings.mjs.map +1 -1
- package/build/es/meta.mjs +8 -0
- package/build/es/meta.mjs.map +1 -1
- package/build/internal/cjs/index.js +8 -0
- package/build/internal/cjs/index.js.map +1 -1
- package/build/internal/cjs/index.typings.js +8 -0
- package/build/internal/cjs/index.typings.js.map +1 -1
- package/build/internal/cjs/meta.js +8 -0
- package/build/internal/cjs/meta.js.map +1 -1
- package/build/internal/es/index.mjs +8 -0
- package/build/internal/es/index.mjs.map +1 -1
- package/build/internal/es/index.typings.mjs +8 -0
- package/build/internal/es/index.typings.mjs.map +1 -1
- package/build/internal/es/meta.mjs +8 -0
- package/build/internal/es/meta.mjs.map +1 -1
- package/package.json +2 -2
package/build/cjs/index.js
CHANGED
|
@@ -106,6 +106,10 @@ function resolveComWixpressMarketAimApiExternalBillingBiServiceUrl(opts) {
|
|
|
106
106
|
{
|
|
107
107
|
srcPath: "/devcenter/checkout/v1/checkout",
|
|
108
108
|
destPath: "/v1/checkout"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
srcPath: "/devcenter/checkout/v1/metered-billing-charges",
|
|
112
|
+
destPath: "/v1/metered-billing-charges"
|
|
109
113
|
}
|
|
110
114
|
],
|
|
111
115
|
_: [
|
|
@@ -116,6 +120,10 @@ function resolveComWixpressMarketAimApiExternalBillingBiServiceUrl(opts) {
|
|
|
116
120
|
{
|
|
117
121
|
srcPath: "/devcenter/checkout/v1/checkout",
|
|
118
122
|
destPath: "/v1/checkout"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
srcPath: "/devcenter/checkout/v1/metered-billing-charges",
|
|
126
|
+
destPath: "/v1/metered-billing-charges"
|
|
119
127
|
}
|
|
120
128
|
]
|
|
121
129
|
};
|
package/build/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts","../../src/market-aim-v1-external-billing-event-external-billing.universal.ts","../../src/market-aim-v1-external-billing-event-external-billing.http.ts","../../src/market-aim-v1-external-billing-event-external-billing.public.ts","../../src/market-aim-v1-external-billing-event-external-billing.context.ts"],"sourcesContent":["export * from './src/market-aim-v1-external-billing-event-external-billing.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 ambassadorWixMarketAimV1ExternalBillingEvent from './market-aim-v1-external-billing-event-external-billing.http.js';\n\nexport interface ExternalBillingEvent {\n /**\n * The app ID linked to this transaction. This field is only relevant if using an API key for authorization,\n * in which case you're required to pass the app ID.\n * @format GUID\n */\n appId?: string | null;\n /**\n * The app instance ID linked to this transaction. This field is only relevant if using an API key for authorization,\n * in which case you can optionally pass the instance ID.\n *\n * This connects the transaction to a specific instance of your app installed on a Wix site.\n * Learn more [about app instances](https://dev.wix.com/docs/build-apps/develop-your-app/access/app-instances/about-app-instances).\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * The total amount of the transaction in USD, not including tax.\n * This value can be negative for refunds or adjustments.\n *\n * Example: \"120.50\" for a $120.50 charge, or \"-120.50\" for a $120.50 refund.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:10 }\n */\n grossRevenue?: string;\n /**\n * The amount charged in USD minus agreed-upon expenses, such as shipping fees or\n * payment processing fees. Wix subtracts its share from this amount.\n * The value can be negative for refunds.\n *\n * Example calculation:\n * - Gross revenue: $120.50\n * - Minus expenses: $20.00 (shipping)\n * - Net revenue: $100.50\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:10 }\n */\n netRevenue?: string | null;\n /**\n * Wix's share of the transaction in USD, taken from the net revenue.\n * This value can be negative, such as for adjustments or refunds.\n *\n * Calculate based on your Partner Agreement terms. For example, if Wix's share is 20%:\n * - Net revenue: $100.50\n * - Wix share (20%): $20.10\n *\n * Important: Update this value if your revenue share percentage changes.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:10 }\n */\n wixShare?: string;\n /** The date and time of the transaction. */\n _createdDate?: Date | null;\n /** The type of billing event, either charge or refund. */\n billingType?: BillingTypeWithLiterals;\n}\n\nexport enum BillingType {\n UNKNOWN = 'UNKNOWN',\n CHARGE = 'CHARGE',\n REFUND = 'REFUND',\n}\n\n/** @enumType */\nexport type BillingTypeWithLiterals =\n | BillingType\n | 'UNKNOWN'\n | 'CHARGE'\n | 'REFUND';\n\nexport interface ReportExternalBillingEventRequest {\n /**\n * The billing event with details of the external transaction, including the gross revenue,\n * net revenue, and billing type (charge or refund).\n */\n event?: ExternalBillingEvent;\n}\n\nexport interface ReportExternalBillingEventResponse {\n /** The billing event that was processed. */\n event?: ExternalBillingEvent;\n}\n\n/** @docsIgnore */\nexport type ReportExternalBillingEventApplicationErrors = {\n code?: 'FAILED_PRECONDITION';\n description?: string;\n data?: Record<string, any>;\n};\n\n/**\n * Sends an external billing event to Wix.\n * Use this to report charges or refunds for your [Partner Billed App](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/partner-billed-apps-reporting).\n * The reported event enables Wix to track revenue, deductions, and Wix's share related to Partner Billed App charges.\n * @public\n * @documentationMaturity preview\n * @requiredField options.event.billingType\n * @requiredField options.event.grossRevenue\n * @requiredField options.event.wixShare\n * @permissionId WIX_DEVELOPERS.MANAGE_APP_INSTANCE\n * @applicableIdentity APP\n * @fqn com.wixpress.market.aim.api.ExternalBillingBIService.ReportExternalBillingEvent\n */\nexport async function reportExternalBillingEvent(\n options?: NonNullablePaths<\n ReportExternalBillingEventOptions,\n `event.billingType` | `event.grossRevenue` | `event.wixShare`,\n 3\n >\n): Promise<\n NonNullablePaths<\n ReportExternalBillingEventResponse,\n `event.grossRevenue` | `event.wixShare` | `event.billingType`,\n 3\n > & {\n __applicationErrorsType?: ReportExternalBillingEventApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n event: options?.event,\n });\n\n const reqOpts =\n ambassadorWixMarketAimV1ExternalBillingEvent.reportExternalBillingEvent(\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: { event: '$[0].event' },\n singleArgumentUnchanged: false,\n },\n ['options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface ReportExternalBillingEventOptions {\n /**\n * The billing event with details of the external transaction, including the gross revenue,\n * net revenue, and billing type (charge or refund).\n */\n event?: ExternalBillingEvent;\n}\n","import { transformSDKTimestampToRESTTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressMarketAimApiExternalBillingBiServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/app-instance-manager-webapp',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/apps',\n destPath: '',\n },\n ],\n 'wixapis.com': [\n {\n srcPath: '/apps',\n destPath: '',\n },\n ],\n 'dev._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n {\n srcPath: '/api/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/api/v1/scripts',\n destPath: '/v1/scripts',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'editor._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'blocks._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'create.editorx': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n '*.dev.wix-code.com': [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/devcenter/checkout/v1/checkout',\n destPath: '/v1/checkout',\n },\n ],\n _: [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/devcenter/checkout/v1/checkout',\n destPath: '/v1/checkout',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_app-management_external-billing';\n\n/**\n * Sends an external billing event to Wix.\n * Use this to report charges or refunds for your [Partner Billed App](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/partner-billed-apps-reporting).\n * The reported event enables Wix to track revenue, deductions, and Wix's share related to Partner Billed App charges.\n */\nexport function reportExternalBillingEvent(\n payload: object\n): RequestOptionsFactory<any> {\n function __reportExternalBillingEvent({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKTimestampToRESTTimestamp,\n paths: [{ path: 'event.createdDate' }],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.market.aim.v1.external_billing_event',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.market.aim.api.ExternalBillingBIService.ReportExternalBillingEvent',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressMarketAimApiExternalBillingBiServiceUrl({\n protoPath: '/v1/billing-event',\n data: serializedData,\n host,\n }),\n data: serializedData,\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [{ path: 'event.createdDate' }],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __reportExternalBillingEvent;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n ReportExternalBillingEventApplicationErrors,\n ReportExternalBillingEventOptions,\n ReportExternalBillingEventResponse,\n reportExternalBillingEvent as universalReportExternalBillingEvent,\n} from './market-aim-v1-external-billing-event-external-billing.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/app-management' };\n\nexport function reportExternalBillingEvent(\n httpClient: HttpClient\n): ReportExternalBillingEventSignature {\n return (\n options?: NonNullablePaths<\n ReportExternalBillingEventOptions,\n `event.billingType` | `event.grossRevenue` | `event.wixShare`,\n 3\n >\n ) =>\n universalReportExternalBillingEvent(\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface ReportExternalBillingEventSignature {\n /**\n * Sends an external billing event to Wix.\n * Use this to report charges or refunds for your [Partner Billed App](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/partner-billed-apps-reporting).\n * The reported event enables Wix to track revenue, deductions, and Wix's share related to Partner Billed App charges.\n */\n (\n options?: NonNullablePaths<\n ReportExternalBillingEventOptions,\n `event.billingType` | `event.grossRevenue` | `event.wixShare`,\n 3\n >\n ): Promise<\n NonNullablePaths<\n ReportExternalBillingEventResponse,\n `event.grossRevenue` | `event.wixShare` | `event.billingType`,\n 3\n > & {\n __applicationErrorsType?: ReportExternalBillingEventApplicationErrors;\n }\n >;\n}\n\nexport {\n BillingType,\n ExternalBillingEvent,\n ReportExternalBillingEventOptions,\n ReportExternalBillingEventRequest,\n ReportExternalBillingEventResponse,\n} from './market-aim-v1-external-billing-event-external-billing.universal.js';\n","import { reportExternalBillingEvent as publicReportExternalBillingEvent } from './market-aim-v1-external-billing-event-external-billing.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const reportExternalBillingEvent: MaybeContext<\n BuildRESTFunction<typeof publicReportExternalBillingEvent> &\n typeof publicReportExternalBillingEvent\n> = /*#__PURE__*/ createRESTModule(publicReportExternalBillingEvent);\n\nexport { BillingType } from './market-aim-v1-external-billing-event-external-billing.universal.js';\nexport {\n ExternalBillingEvent,\n ReportExternalBillingEventRequest,\n ReportExternalBillingEventResponse,\n ReportExternalBillingEventOptions,\n} from './market-aim-v1-external-billing-event-external-billing.universal.js';\nexport {\n BillingTypeWithLiterals,\n ReportExternalBillingEventApplicationErrors,\n} from './market-aim-v1-external-billing-event-external-billing.universal.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,oCAAAA;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAGO;;;ACJP,uBAAqD;AACrD,IAAAC,oBAAqD;AACrD,6BAA+B;AAC/B,0BAA2B;AAI3B,SAAS,0DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,eAAe;AAAA,MACb;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAA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A;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;ACxBA,IAAAC,uBAAiC;AAG1B,IAAMC,8BAGK,2DAAiBA,2BAAgC;","names":["reportExternalBillingEvent","import_timestamp","payload","BillingType","reportExternalBillingEvent","sdkTransformError","reportExternalBillingEvent","import_rest_modules","reportExternalBillingEvent"]}
|
|
1
|
+
{"version":3,"sources":["../../index.ts","../../src/market-aim-v1-external-billing-event-external-billing.universal.ts","../../src/market-aim-v1-external-billing-event-external-billing.http.ts","../../src/market-aim-v1-external-billing-event-external-billing.public.ts","../../src/market-aim-v1-external-billing-event-external-billing.context.ts"],"sourcesContent":["export * from './src/market-aim-v1-external-billing-event-external-billing.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 ambassadorWixMarketAimV1ExternalBillingEvent from './market-aim-v1-external-billing-event-external-billing.http.js';\n\nexport interface ExternalBillingEvent {\n /**\n * The app ID linked to this transaction. This field is only relevant if using an API key for authorization,\n * in which case you're required to pass the app ID.\n * @format GUID\n */\n appId?: string | null;\n /**\n * The app instance ID linked to this transaction. This field is only relevant if using an API key for authorization,\n * in which case you can optionally pass the instance ID.\n *\n * This connects the transaction to a specific instance of your app installed on a Wix site.\n * Learn more [about app instances](https://dev.wix.com/docs/build-apps/develop-your-app/access/app-instances/about-app-instances).\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * The total amount of the transaction in USD, not including tax.\n * This value can be negative for refunds or adjustments.\n *\n * Example: \"120.50\" for a $120.50 charge, or \"-120.50\" for a $120.50 refund.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:10 }\n */\n grossRevenue?: string;\n /**\n * The amount charged in USD minus agreed-upon expenses, such as shipping fees or\n * payment processing fees. Wix subtracts its share from this amount.\n * The value can be negative for refunds.\n *\n * Example calculation:\n * - Gross revenue: $120.50\n * - Minus expenses: $20.00 (shipping)\n * - Net revenue: $100.50\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:10 }\n */\n netRevenue?: string | null;\n /**\n * Wix's share of the transaction in USD, taken from the net revenue.\n * This value can be negative, such as for adjustments or refunds.\n *\n * Calculate based on your Partner Agreement terms. For example, if Wix's share is 20%:\n * - Net revenue: $100.50\n * - Wix share (20%): $20.10\n *\n * Important: Update this value if your revenue share percentage changes.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:10 }\n */\n wixShare?: string;\n /** The date and time of the transaction. */\n _createdDate?: Date | null;\n /** The type of billing event, either charge or refund. */\n billingType?: BillingTypeWithLiterals;\n}\n\nexport enum BillingType {\n UNKNOWN = 'UNKNOWN',\n CHARGE = 'CHARGE',\n REFUND = 'REFUND',\n}\n\n/** @enumType */\nexport type BillingTypeWithLiterals =\n | BillingType\n | 'UNKNOWN'\n | 'CHARGE'\n | 'REFUND';\n\nexport interface ReportExternalBillingEventRequest {\n /**\n * The billing event with details of the external transaction, including the gross revenue,\n * net revenue, and billing type (charge or refund).\n */\n event?: ExternalBillingEvent;\n}\n\nexport interface ReportExternalBillingEventResponse {\n /** The billing event that was processed. */\n event?: ExternalBillingEvent;\n}\n\n/** @docsIgnore */\nexport type ReportExternalBillingEventApplicationErrors = {\n code?: 'FAILED_PRECONDITION';\n description?: string;\n data?: Record<string, any>;\n};\n\n/**\n * Sends an external billing event to Wix.\n * Use this to report charges or refunds for your [Partner Billed App](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/partner-billed-apps-reporting).\n * The reported event enables Wix to track revenue, deductions, and Wix's share related to Partner Billed App charges.\n * @public\n * @documentationMaturity preview\n * @requiredField options.event.billingType\n * @requiredField options.event.grossRevenue\n * @requiredField options.event.wixShare\n * @permissionId WIX_DEVELOPERS.MANAGE_APP_INSTANCE\n * @applicableIdentity APP\n * @fqn com.wixpress.market.aim.api.ExternalBillingBIService.ReportExternalBillingEvent\n */\nexport async function reportExternalBillingEvent(\n options?: NonNullablePaths<\n ReportExternalBillingEventOptions,\n `event.billingType` | `event.grossRevenue` | `event.wixShare`,\n 3\n >\n): Promise<\n NonNullablePaths<\n ReportExternalBillingEventResponse,\n `event.grossRevenue` | `event.wixShare` | `event.billingType`,\n 3\n > & {\n __applicationErrorsType?: ReportExternalBillingEventApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n event: options?.event,\n });\n\n const reqOpts =\n ambassadorWixMarketAimV1ExternalBillingEvent.reportExternalBillingEvent(\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: { event: '$[0].event' },\n singleArgumentUnchanged: false,\n },\n ['options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface ReportExternalBillingEventOptions {\n /**\n * The billing event with details of the external transaction, including the gross revenue,\n * net revenue, and billing type (charge or refund).\n */\n event?: ExternalBillingEvent;\n}\n","import { transformSDKTimestampToRESTTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressMarketAimApiExternalBillingBiServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/app-instance-manager-webapp',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/apps',\n destPath: '',\n },\n ],\n 'wixapis.com': [\n {\n srcPath: '/apps',\n destPath: '',\n },\n ],\n 'dev._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n {\n srcPath: '/api/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/api/v1/scripts',\n destPath: '/v1/scripts',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'editor._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'blocks._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'create.editorx': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n '*.dev.wix-code.com': [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/devcenter/checkout/v1/checkout',\n destPath: '/v1/checkout',\n },\n {\n srcPath: '/devcenter/checkout/v1/metered-billing-charges',\n destPath: '/v1/metered-billing-charges',\n },\n ],\n _: [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/devcenter/checkout/v1/checkout',\n destPath: '/v1/checkout',\n },\n {\n srcPath: '/devcenter/checkout/v1/metered-billing-charges',\n destPath: '/v1/metered-billing-charges',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_app-management_external-billing';\n\n/**\n * Sends an external billing event to Wix.\n * Use this to report charges or refunds for your [Partner Billed App](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/partner-billed-apps-reporting).\n * The reported event enables Wix to track revenue, deductions, and Wix's share related to Partner Billed App charges.\n */\nexport function reportExternalBillingEvent(\n payload: object\n): RequestOptionsFactory<any> {\n function __reportExternalBillingEvent({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKTimestampToRESTTimestamp,\n paths: [{ path: 'event.createdDate' }],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.market.aim.v1.external_billing_event',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.market.aim.api.ExternalBillingBIService.ReportExternalBillingEvent',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressMarketAimApiExternalBillingBiServiceUrl({\n protoPath: '/v1/billing-event',\n data: serializedData,\n host,\n }),\n data: serializedData,\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [{ path: 'event.createdDate' }],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __reportExternalBillingEvent;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n ReportExternalBillingEventApplicationErrors,\n ReportExternalBillingEventOptions,\n ReportExternalBillingEventResponse,\n reportExternalBillingEvent as universalReportExternalBillingEvent,\n} from './market-aim-v1-external-billing-event-external-billing.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/app-management' };\n\nexport function reportExternalBillingEvent(\n httpClient: HttpClient\n): ReportExternalBillingEventSignature {\n return (\n options?: NonNullablePaths<\n ReportExternalBillingEventOptions,\n `event.billingType` | `event.grossRevenue` | `event.wixShare`,\n 3\n >\n ) =>\n universalReportExternalBillingEvent(\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface ReportExternalBillingEventSignature {\n /**\n * Sends an external billing event to Wix.\n * Use this to report charges or refunds for your [Partner Billed App](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/partner-billed-apps-reporting).\n * The reported event enables Wix to track revenue, deductions, and Wix's share related to Partner Billed App charges.\n */\n (\n options?: NonNullablePaths<\n ReportExternalBillingEventOptions,\n `event.billingType` | `event.grossRevenue` | `event.wixShare`,\n 3\n >\n ): Promise<\n NonNullablePaths<\n ReportExternalBillingEventResponse,\n `event.grossRevenue` | `event.wixShare` | `event.billingType`,\n 3\n > & {\n __applicationErrorsType?: ReportExternalBillingEventApplicationErrors;\n }\n >;\n}\n\nexport {\n BillingType,\n ExternalBillingEvent,\n ReportExternalBillingEventOptions,\n ReportExternalBillingEventRequest,\n ReportExternalBillingEventResponse,\n} from './market-aim-v1-external-billing-event-external-billing.universal.js';\n","import { reportExternalBillingEvent as publicReportExternalBillingEvent } from './market-aim-v1-external-billing-event-external-billing.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const reportExternalBillingEvent: MaybeContext<\n BuildRESTFunction<typeof publicReportExternalBillingEvent> &\n typeof publicReportExternalBillingEvent\n> = /*#__PURE__*/ createRESTModule(publicReportExternalBillingEvent);\n\nexport { BillingType } from './market-aim-v1-external-billing-event-external-billing.universal.js';\nexport {\n ExternalBillingEvent,\n ReportExternalBillingEventRequest,\n ReportExternalBillingEventResponse,\n ReportExternalBillingEventOptions,\n} from './market-aim-v1-external-billing-event-external-billing.universal.js';\nexport {\n BillingTypeWithLiterals,\n ReportExternalBillingEventApplicationErrors,\n} from './market-aim-v1-external-billing-event-external-billing.universal.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,oCAAAA;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAGO;;;ACJP,uBAAqD;AACrD,IAAAC,oBAAqD;AACrD,6BAA+B;AAC/B,0BAA2B;AAI3B,SAAS,0DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;A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BAAwB,CAAC;AAAA,QACzB,0BAA0B,EAAE,OAAO,aAAa;AAAA,QAChD,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,SAAS;AAAA,IACZ;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;;;AEvJO,SAASC,4BACd,YACqC;AACrC,SAAO,CACL,YAMAA;AAAA,IACE;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;ACxBA,IAAAC,uBAAiC;AAG1B,IAAMC,8BAGK,2DAAiBA,2BAAgC;","names":["reportExternalBillingEvent","import_timestamp","payload","BillingType","reportExternalBillingEvent","sdkTransformError","reportExternalBillingEvent","import_rest_modules","reportExternalBillingEvent"]}
|
|
@@ -106,6 +106,10 @@ function resolveComWixpressMarketAimApiExternalBillingBiServiceUrl(opts) {
|
|
|
106
106
|
{
|
|
107
107
|
srcPath: "/devcenter/checkout/v1/checkout",
|
|
108
108
|
destPath: "/v1/checkout"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
srcPath: "/devcenter/checkout/v1/metered-billing-charges",
|
|
112
|
+
destPath: "/v1/metered-billing-charges"
|
|
109
113
|
}
|
|
110
114
|
],
|
|
111
115
|
_: [
|
|
@@ -116,6 +120,10 @@ function resolveComWixpressMarketAimApiExternalBillingBiServiceUrl(opts) {
|
|
|
116
120
|
{
|
|
117
121
|
srcPath: "/devcenter/checkout/v1/checkout",
|
|
118
122
|
destPath: "/v1/checkout"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
srcPath: "/devcenter/checkout/v1/metered-billing-charges",
|
|
126
|
+
destPath: "/v1/metered-billing-charges"
|
|
119
127
|
}
|
|
120
128
|
]
|
|
121
129
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.typings.ts","../../src/market-aim-v1-external-billing-event-external-billing.universal.ts","../../src/market-aim-v1-external-billing-event-external-billing.http.ts"],"sourcesContent":["export * from './src/market-aim-v1-external-billing-event-external-billing.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 ambassadorWixMarketAimV1ExternalBillingEvent from './market-aim-v1-external-billing-event-external-billing.http.js';\n\nexport interface ExternalBillingEvent {\n /**\n * The app ID linked to this transaction. This field is only relevant if using an API key for authorization,\n * in which case you're required to pass the app ID.\n * @format GUID\n */\n appId?: string | null;\n /**\n * The app instance ID linked to this transaction. This field is only relevant if using an API key for authorization,\n * in which case you can optionally pass the instance ID.\n *\n * This connects the transaction to a specific instance of your app installed on a Wix site.\n * Learn more [about app instances](https://dev.wix.com/docs/build-apps/develop-your-app/access/app-instances/about-app-instances).\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * The total amount of the transaction in USD, not including tax.\n * This value can be negative for refunds or adjustments.\n *\n * Example: \"120.50\" for a $120.50 charge, or \"-120.50\" for a $120.50 refund.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:10 }\n */\n grossRevenue?: string;\n /**\n * The amount charged in USD minus agreed-upon expenses, such as shipping fees or\n * payment processing fees. Wix subtracts its share from this amount.\n * The value can be negative for refunds.\n *\n * Example calculation:\n * - Gross revenue: $120.50\n * - Minus expenses: $20.00 (shipping)\n * - Net revenue: $100.50\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:10 }\n */\n netRevenue?: string | null;\n /**\n * Wix's share of the transaction in USD, taken from the net revenue.\n * This value can be negative, such as for adjustments or refunds.\n *\n * Calculate based on your Partner Agreement terms. For example, if Wix's share is 20%:\n * - Net revenue: $100.50\n * - Wix share (20%): $20.10\n *\n * Important: Update this value if your revenue share percentage changes.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:10 }\n */\n wixShare?: string;\n /** The date and time of the transaction. */\n _createdDate?: Date | null;\n /** The type of billing event, either charge or refund. */\n billingType?: BillingTypeWithLiterals;\n}\n\nexport enum BillingType {\n UNKNOWN = 'UNKNOWN',\n CHARGE = 'CHARGE',\n REFUND = 'REFUND',\n}\n\n/** @enumType */\nexport type BillingTypeWithLiterals =\n | BillingType\n | 'UNKNOWN'\n | 'CHARGE'\n | 'REFUND';\n\nexport interface ReportExternalBillingEventRequest {\n /**\n * The billing event with details of the external transaction, including the gross revenue,\n * net revenue, and billing type (charge or refund).\n */\n event?: ExternalBillingEvent;\n}\n\nexport interface ReportExternalBillingEventResponse {\n /** The billing event that was processed. */\n event?: ExternalBillingEvent;\n}\n\n/** @docsIgnore */\nexport type ReportExternalBillingEventApplicationErrors = {\n code?: 'FAILED_PRECONDITION';\n description?: string;\n data?: Record<string, any>;\n};\n\n/**\n * Sends an external billing event to Wix.\n * Use this to report charges or refunds for your [Partner Billed App](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/partner-billed-apps-reporting).\n * The reported event enables Wix to track revenue, deductions, and Wix's share related to Partner Billed App charges.\n * @public\n * @documentationMaturity preview\n * @requiredField options.event.billingType\n * @requiredField options.event.grossRevenue\n * @requiredField options.event.wixShare\n * @permissionId WIX_DEVELOPERS.MANAGE_APP_INSTANCE\n * @applicableIdentity APP\n * @fqn com.wixpress.market.aim.api.ExternalBillingBIService.ReportExternalBillingEvent\n */\nexport async function reportExternalBillingEvent(\n options?: NonNullablePaths<\n ReportExternalBillingEventOptions,\n `event.billingType` | `event.grossRevenue` | `event.wixShare`,\n 3\n >\n): Promise<\n NonNullablePaths<\n ReportExternalBillingEventResponse,\n `event.grossRevenue` | `event.wixShare` | `event.billingType`,\n 3\n > & {\n __applicationErrorsType?: ReportExternalBillingEventApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n event: options?.event,\n });\n\n const reqOpts =\n ambassadorWixMarketAimV1ExternalBillingEvent.reportExternalBillingEvent(\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: { event: '$[0].event' },\n singleArgumentUnchanged: false,\n },\n ['options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface ReportExternalBillingEventOptions {\n /**\n * The billing event with details of the external transaction, including the gross revenue,\n * net revenue, and billing type (charge or refund).\n */\n event?: ExternalBillingEvent;\n}\n","import { transformSDKTimestampToRESTTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressMarketAimApiExternalBillingBiServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/app-instance-manager-webapp',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/apps',\n destPath: '',\n },\n ],\n 'wixapis.com': [\n {\n srcPath: '/apps',\n destPath: '',\n },\n ],\n 'dev._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n {\n srcPath: '/api/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/api/v1/scripts',\n destPath: '/v1/scripts',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'editor._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'blocks._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'create.editorx': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n '*.dev.wix-code.com': [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/devcenter/checkout/v1/checkout',\n destPath: '/v1/checkout',\n },\n ],\n _: [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/devcenter/checkout/v1/checkout',\n destPath: '/v1/checkout',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_app-management_external-billing';\n\n/**\n * Sends an external billing event to Wix.\n * Use this to report charges or refunds for your [Partner Billed App](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/partner-billed-apps-reporting).\n * The reported event enables Wix to track revenue, deductions, and Wix's share related to Partner Billed App charges.\n */\nexport function reportExternalBillingEvent(\n payload: object\n): RequestOptionsFactory<any> {\n function __reportExternalBillingEvent({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKTimestampToRESTTimestamp,\n paths: [{ path: 'event.createdDate' }],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.market.aim.v1.external_billing_event',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.market.aim.api.ExternalBillingBIService.ReportExternalBillingEvent',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressMarketAimApiExternalBillingBiServiceUrl({\n protoPath: '/v1/billing-event',\n data: serializedData,\n host,\n }),\n data: serializedData,\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [{ path: 'event.createdDate' }],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __reportExternalBillingEvent;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,oCAAAA;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAGO;;;ACJP,uBAAqD;AACrD,IAAAC,oBAAqD;AACrD,6BAA+B;AAC/B,0BAA2B;AAI3B,SAAS,0DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,eAAe;AAAA,MACb;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,kBAAkB;AAAA,MAChB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,sBAAsB;AAAA,MACpB;AAAA,QACE,SAAS;AAAA,QACT,UA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,OAAO,SAAS;AAAA,EAClB,CAAC;AAED,QAAM,UACyC;AAAA,IAC3C;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,EAAE,OAAO,aAAa;AAAA,QAChD,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,SAAS;AAAA,IACZ;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["reportExternalBillingEvent","import_timestamp","payload","BillingType","reportExternalBillingEvent","sdkTransformError"]}
|
|
1
|
+
{"version":3,"sources":["../../index.typings.ts","../../src/market-aim-v1-external-billing-event-external-billing.universal.ts","../../src/market-aim-v1-external-billing-event-external-billing.http.ts"],"sourcesContent":["export * from './src/market-aim-v1-external-billing-event-external-billing.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 ambassadorWixMarketAimV1ExternalBillingEvent from './market-aim-v1-external-billing-event-external-billing.http.js';\n\nexport interface ExternalBillingEvent {\n /**\n * The app ID linked to this transaction. This field is only relevant if using an API key for authorization,\n * in which case you're required to pass the app ID.\n * @format GUID\n */\n appId?: string | null;\n /**\n * The app instance ID linked to this transaction. This field is only relevant if using an API key for authorization,\n * in which case you can optionally pass the instance ID.\n *\n * This connects the transaction to a specific instance of your app installed on a Wix site.\n * Learn more [about app instances](https://dev.wix.com/docs/build-apps/develop-your-app/access/app-instances/about-app-instances).\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * The total amount of the transaction in USD, not including tax.\n * This value can be negative for refunds or adjustments.\n *\n * Example: \"120.50\" for a $120.50 charge, or \"-120.50\" for a $120.50 refund.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:10 }\n */\n grossRevenue?: string;\n /**\n * The amount charged in USD minus agreed-upon expenses, such as shipping fees or\n * payment processing fees. Wix subtracts its share from this amount.\n * The value can be negative for refunds.\n *\n * Example calculation:\n * - Gross revenue: $120.50\n * - Minus expenses: $20.00 (shipping)\n * - Net revenue: $100.50\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:10 }\n */\n netRevenue?: string | null;\n /**\n * Wix's share of the transaction in USD, taken from the net revenue.\n * This value can be negative, such as for adjustments or refunds.\n *\n * Calculate based on your Partner Agreement terms. For example, if Wix's share is 20%:\n * - Net revenue: $100.50\n * - Wix share (20%): $20.10\n *\n * Important: Update this value if your revenue share percentage changes.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:10 }\n */\n wixShare?: string;\n /** The date and time of the transaction. */\n _createdDate?: Date | null;\n /** The type of billing event, either charge or refund. */\n billingType?: BillingTypeWithLiterals;\n}\n\nexport enum BillingType {\n UNKNOWN = 'UNKNOWN',\n CHARGE = 'CHARGE',\n REFUND = 'REFUND',\n}\n\n/** @enumType */\nexport type BillingTypeWithLiterals =\n | BillingType\n | 'UNKNOWN'\n | 'CHARGE'\n | 'REFUND';\n\nexport interface ReportExternalBillingEventRequest {\n /**\n * The billing event with details of the external transaction, including the gross revenue,\n * net revenue, and billing type (charge or refund).\n */\n event?: ExternalBillingEvent;\n}\n\nexport interface ReportExternalBillingEventResponse {\n /** The billing event that was processed. */\n event?: ExternalBillingEvent;\n}\n\n/** @docsIgnore */\nexport type ReportExternalBillingEventApplicationErrors = {\n code?: 'FAILED_PRECONDITION';\n description?: string;\n data?: Record<string, any>;\n};\n\n/**\n * Sends an external billing event to Wix.\n * Use this to report charges or refunds for your [Partner Billed App](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/partner-billed-apps-reporting).\n * The reported event enables Wix to track revenue, deductions, and Wix's share related to Partner Billed App charges.\n * @public\n * @documentationMaturity preview\n * @requiredField options.event.billingType\n * @requiredField options.event.grossRevenue\n * @requiredField options.event.wixShare\n * @permissionId WIX_DEVELOPERS.MANAGE_APP_INSTANCE\n * @applicableIdentity APP\n * @fqn com.wixpress.market.aim.api.ExternalBillingBIService.ReportExternalBillingEvent\n */\nexport async function reportExternalBillingEvent(\n options?: NonNullablePaths<\n ReportExternalBillingEventOptions,\n `event.billingType` | `event.grossRevenue` | `event.wixShare`,\n 3\n >\n): Promise<\n NonNullablePaths<\n ReportExternalBillingEventResponse,\n `event.grossRevenue` | `event.wixShare` | `event.billingType`,\n 3\n > & {\n __applicationErrorsType?: ReportExternalBillingEventApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n event: options?.event,\n });\n\n const reqOpts =\n ambassadorWixMarketAimV1ExternalBillingEvent.reportExternalBillingEvent(\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: { event: '$[0].event' },\n singleArgumentUnchanged: false,\n },\n ['options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface ReportExternalBillingEventOptions {\n /**\n * The billing event with details of the external transaction, including the gross revenue,\n * net revenue, and billing type (charge or refund).\n */\n event?: ExternalBillingEvent;\n}\n","import { transformSDKTimestampToRESTTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressMarketAimApiExternalBillingBiServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/app-instance-manager-webapp',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/apps',\n destPath: '',\n },\n ],\n 'wixapis.com': [\n {\n srcPath: '/apps',\n destPath: '',\n },\n ],\n 'dev._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n {\n srcPath: '/api/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/api/v1/scripts',\n destPath: '/v1/scripts',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'editor._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'blocks._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'create.editorx': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n '*.dev.wix-code.com': [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/devcenter/checkout/v1/checkout',\n destPath: '/v1/checkout',\n },\n {\n srcPath: '/devcenter/checkout/v1/metered-billing-charges',\n destPath: '/v1/metered-billing-charges',\n },\n ],\n _: [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/devcenter/checkout/v1/checkout',\n destPath: '/v1/checkout',\n },\n {\n srcPath: '/devcenter/checkout/v1/metered-billing-charges',\n destPath: '/v1/metered-billing-charges',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_app-management_external-billing';\n\n/**\n * Sends an external billing event to Wix.\n * Use this to report charges or refunds for your [Partner Billed App](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/partner-billed-apps-reporting).\n * The reported event enables Wix to track revenue, deductions, and Wix's share related to Partner Billed App charges.\n */\nexport function reportExternalBillingEvent(\n payload: object\n): RequestOptionsFactory<any> {\n function __reportExternalBillingEvent({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKTimestampToRESTTimestamp,\n paths: [{ path: 'event.createdDate' }],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.market.aim.v1.external_billing_event',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.market.aim.api.ExternalBillingBIService.ReportExternalBillingEvent',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressMarketAimApiExternalBillingBiServiceUrl({\n protoPath: '/v1/billing-event',\n data: serializedData,\n host,\n }),\n data: serializedData,\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [{ path: 'event.createdDate' }],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __reportExternalBillingEvent;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,oCAAAA;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAGO;;;ACJP,uBAAqD;AACrD,IAAAC,oBAAqD;AACrD,6BAA+B;AAC/B,0BAA2B;AAI3B,SAAS,0DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;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AA,QACzB,0BAA0B,EAAE,OAAO,aAAa;AAAA,QAChD,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,SAAS;AAAA,IACZ;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["reportExternalBillingEvent","import_timestamp","payload","BillingType","reportExternalBillingEvent","sdkTransformError"]}
|
package/build/cjs/meta.js
CHANGED
|
@@ -102,6 +102,10 @@ function resolveComWixpressMarketAimApiExternalBillingBiServiceUrl(opts) {
|
|
|
102
102
|
{
|
|
103
103
|
srcPath: "/devcenter/checkout/v1/checkout",
|
|
104
104
|
destPath: "/v1/checkout"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
srcPath: "/devcenter/checkout/v1/metered-billing-charges",
|
|
108
|
+
destPath: "/v1/metered-billing-charges"
|
|
105
109
|
}
|
|
106
110
|
],
|
|
107
111
|
_: [
|
|
@@ -112,6 +116,10 @@ function resolveComWixpressMarketAimApiExternalBillingBiServiceUrl(opts) {
|
|
|
112
116
|
{
|
|
113
117
|
srcPath: "/devcenter/checkout/v1/checkout",
|
|
114
118
|
destPath: "/v1/checkout"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
srcPath: "/devcenter/checkout/v1/metered-billing-charges",
|
|
122
|
+
destPath: "/v1/metered-billing-charges"
|
|
115
123
|
}
|
|
116
124
|
]
|
|
117
125
|
};
|
package/build/cjs/meta.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../meta.ts","../../src/market-aim-v1-external-billing-event-external-billing.http.ts","../../src/market-aim-v1-external-billing-event-external-billing.types.ts","../../src/market-aim-v1-external-billing-event-external-billing.meta.ts"],"sourcesContent":["export * from './src/market-aim-v1-external-billing-event-external-billing.meta.js';\n","import { transformSDKTimestampToRESTTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressMarketAimApiExternalBillingBiServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/app-instance-manager-webapp',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/apps',\n destPath: '',\n },\n ],\n 'wixapis.com': [\n {\n srcPath: '/apps',\n destPath: '',\n },\n ],\n 'dev._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n {\n srcPath: '/api/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/api/v1/scripts',\n destPath: '/v1/scripts',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'editor._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'blocks._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'create.editorx': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n '*.dev.wix-code.com': [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/devcenter/checkout/v1/checkout',\n destPath: '/v1/checkout',\n },\n ],\n _: [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/devcenter/checkout/v1/checkout',\n destPath: '/v1/checkout',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_app-management_external-billing';\n\n/**\n * Sends an external billing event to Wix.\n * Use this to report charges or refunds for your [Partner Billed App](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/partner-billed-apps-reporting).\n * The reported event enables Wix to track revenue, deductions, and Wix's share related to Partner Billed App charges.\n */\nexport function reportExternalBillingEvent(\n payload: object\n): RequestOptionsFactory<any> {\n function __reportExternalBillingEvent({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKTimestampToRESTTimestamp,\n paths: [{ path: 'event.createdDate' }],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.market.aim.v1.external_billing_event',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.market.aim.api.ExternalBillingBIService.ReportExternalBillingEvent',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressMarketAimApiExternalBillingBiServiceUrl({\n protoPath: '/v1/billing-event',\n data: serializedData,\n host,\n }),\n data: serializedData,\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [{ path: 'event.createdDate' }],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __reportExternalBillingEvent;\n}\n","export interface ExternalBillingEvent {\n /**\n * The app ID linked to this transaction. This field is only relevant if using an API key for authorization,\n * in which case you're required to pass the app ID.\n * @format GUID\n */\n appId?: string | null;\n /**\n * The app instance ID linked to this transaction. This field is only relevant if using an API key for authorization,\n * in which case you can optionally pass the instance ID.\n *\n * This connects the transaction to a specific instance of your app installed on a Wix site.\n * Learn more [about app instances](https://dev.wix.com/docs/build-apps/develop-your-app/access/app-instances/about-app-instances).\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * The total amount of the transaction in USD, not including tax.\n * This value can be negative for refunds or adjustments.\n *\n * Example: \"120.50\" for a $120.50 charge, or \"-120.50\" for a $120.50 refund.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:10 }\n */\n grossRevenue?: string;\n /**\n * The amount charged in USD minus agreed-upon expenses, such as shipping fees or\n * payment processing fees. Wix subtracts its share from this amount.\n * The value can be negative for refunds.\n *\n * Example calculation:\n * - Gross revenue: $120.50\n * - Minus expenses: $20.00 (shipping)\n * - Net revenue: $100.50\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:10 }\n */\n netRevenue?: string | null;\n /**\n * Wix's share of the transaction in USD, taken from the net revenue.\n * This value can be negative, such as for adjustments or refunds.\n *\n * Calculate based on your Partner Agreement terms. For example, if Wix's share is 20%:\n * - Net revenue: $100.50\n * - Wix share (20%): $20.10\n *\n * Important: Update this value if your revenue share percentage changes.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:10 }\n */\n wixShare?: string;\n /** The date and time of the transaction. */\n createdDate?: Date | null;\n /** The type of billing event, either charge or refund. */\n billingType?: BillingTypeWithLiterals;\n}\n\nexport enum BillingType {\n UNKNOWN = 'UNKNOWN',\n CHARGE = 'CHARGE',\n REFUND = 'REFUND',\n}\n\n/** @enumType */\nexport type BillingTypeWithLiterals =\n | BillingType\n | 'UNKNOWN'\n | 'CHARGE'\n | 'REFUND';\n\nexport interface ReportExternalBillingEventRequest {\n /**\n * The billing event with details of the external transaction, including the gross revenue,\n * net revenue, and billing type (charge or refund).\n */\n event?: ExternalBillingEvent;\n}\n\nexport interface ReportExternalBillingEventResponse {\n /** The billing event that was processed. */\n event?: ExternalBillingEvent;\n}\n\n/** @docsIgnore */\nexport type ReportExternalBillingEventApplicationErrors = {\n code?: 'FAILED_PRECONDITION';\n description?: string;\n data?: Record<string, any>;\n};\n","import * as ambassadorWixMarketAimV1ExternalBillingEvent from './market-aim-v1-external-billing-event-external-billing.http.js';\nimport * as ambassadorWixMarketAimV1ExternalBillingEventTypes from './market-aim-v1-external-billing-event-external-billing.types.js';\nimport * as ambassadorWixMarketAimV1ExternalBillingEventUniversalTypes from './market-aim-v1-external-billing-event-external-billing.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 reportExternalBillingEvent(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixMarketAimV1ExternalBillingEventUniversalTypes.ReportExternalBillingEventRequest,\n ambassadorWixMarketAimV1ExternalBillingEventTypes.ReportExternalBillingEventRequest,\n ambassadorWixMarketAimV1ExternalBillingEventUniversalTypes.ReportExternalBillingEventResponse,\n ambassadorWixMarketAimV1ExternalBillingEventTypes.ReportExternalBillingEventResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixMarketAimV1ExternalBillingEvent.reportExternalBillingEvent(\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/billing-event',\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 ExternalBillingEvent as ExternalBillingEventOriginal,\n BillingType as BillingTypeOriginal,\n BillingTypeWithLiterals as BillingTypeWithLiteralsOriginal,\n ReportExternalBillingEventRequest as ReportExternalBillingEventRequestOriginal,\n ReportExternalBillingEventResponse as ReportExternalBillingEventResponseOriginal,\n ReportExternalBillingEventApplicationErrors as ReportExternalBillingEventApplicationErrorsOriginal,\n} from './market-aim-v1-external-billing-event-external-billing.types.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,oCAAAA;AAAA;AAAA;;;ACAA,uBAAqD;AACrD,IAAAC,oBAAqD;AACrD,6BAA+B;AAC/B,0BAA2B;AAI3B,SAAS,0DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAm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,KAAK,GAAQ;AACnD,UAAM,qBAAiB,uCAAe,SAAS;AAAA,MAC7C;AAAA,QACE,aAAa;AAAA,QACb,OAAO,CAAC,EAAE,MAAM,oBAAoB,CAAC;AAAA,MACvC;AAAA,IACF,CAAC;AACD,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,0DAA0D;AAAA,QAC7D,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,MACN,mBAAmB,CAACC,iBAClB,uCAAeA,UAAS;AAAA,QACtB;AAAA,UACE,aAAa;AAAA,UACb,OAAO,CAAC,EAAE,MAAM,oBAAoB,CAAC;AAAA,QACvC;AAAA,MACF,CAAC;AAAA,IACL;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ACtFO,IAAK,cAAL,kBAAKC,iBAAL;AACL,EAAAA,aAAA,aAAU;AACV,EAAAA,aAAA,YAAS;AACT,EAAAA,aAAA,YAAS;AAHC,SAAAA;AAAA,GAAA;;;ACnCL,SAASC,8BAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBACyC;AAAA,IAC3C;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":["reportExternalBillingEvent","import_timestamp","payload","BillingType","reportExternalBillingEvent"]}
|
|
1
|
+
{"version":3,"sources":["../../meta.ts","../../src/market-aim-v1-external-billing-event-external-billing.http.ts","../../src/market-aim-v1-external-billing-event-external-billing.types.ts","../../src/market-aim-v1-external-billing-event-external-billing.meta.ts"],"sourcesContent":["export * from './src/market-aim-v1-external-billing-event-external-billing.meta.js';\n","import { transformSDKTimestampToRESTTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressMarketAimApiExternalBillingBiServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/app-instance-manager-webapp',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/apps',\n destPath: '',\n },\n ],\n 'wixapis.com': [\n {\n srcPath: '/apps',\n destPath: '',\n },\n ],\n 'dev._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n {\n srcPath: '/api/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/api/v1/scripts',\n destPath: '/v1/scripts',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'editor._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'blocks._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'create.editorx': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n '*.dev.wix-code.com': [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/devcenter/checkout/v1/checkout',\n destPath: '/v1/checkout',\n },\n {\n srcPath: '/devcenter/checkout/v1/metered-billing-charges',\n destPath: '/v1/metered-billing-charges',\n },\n ],\n _: [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/devcenter/checkout/v1/checkout',\n destPath: '/v1/checkout',\n },\n {\n srcPath: '/devcenter/checkout/v1/metered-billing-charges',\n destPath: '/v1/metered-billing-charges',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_app-management_external-billing';\n\n/**\n * Sends an external billing event to Wix.\n * Use this to report charges or refunds for your [Partner Billed App](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/partner-billed-apps-reporting).\n * The reported event enables Wix to track revenue, deductions, and Wix's share related to Partner Billed App charges.\n */\nexport function reportExternalBillingEvent(\n payload: object\n): RequestOptionsFactory<any> {\n function __reportExternalBillingEvent({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKTimestampToRESTTimestamp,\n paths: [{ path: 'event.createdDate' }],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.market.aim.v1.external_billing_event',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.market.aim.api.ExternalBillingBIService.ReportExternalBillingEvent',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressMarketAimApiExternalBillingBiServiceUrl({\n protoPath: '/v1/billing-event',\n data: serializedData,\n host,\n }),\n data: serializedData,\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [{ path: 'event.createdDate' }],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __reportExternalBillingEvent;\n}\n","export interface ExternalBillingEvent {\n /**\n * The app ID linked to this transaction. This field is only relevant if using an API key for authorization,\n * in which case you're required to pass the app ID.\n * @format GUID\n */\n appId?: string | null;\n /**\n * The app instance ID linked to this transaction. This field is only relevant if using an API key for authorization,\n * in which case you can optionally pass the instance ID.\n *\n * This connects the transaction to a specific instance of your app installed on a Wix site.\n * Learn more [about app instances](https://dev.wix.com/docs/build-apps/develop-your-app/access/app-instances/about-app-instances).\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * The total amount of the transaction in USD, not including tax.\n * This value can be negative for refunds or adjustments.\n *\n * Example: \"120.50\" for a $120.50 charge, or \"-120.50\" for a $120.50 refund.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:10 }\n */\n grossRevenue?: string;\n /**\n * The amount charged in USD minus agreed-upon expenses, such as shipping fees or\n * payment processing fees. Wix subtracts its share from this amount.\n * The value can be negative for refunds.\n *\n * Example calculation:\n * - Gross revenue: $120.50\n * - Minus expenses: $20.00 (shipping)\n * - Net revenue: $100.50\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:10 }\n */\n netRevenue?: string | null;\n /**\n * Wix's share of the transaction in USD, taken from the net revenue.\n * This value can be negative, such as for adjustments or refunds.\n *\n * Calculate based on your Partner Agreement terms. For example, if Wix's share is 20%:\n * - Net revenue: $100.50\n * - Wix share (20%): $20.10\n *\n * Important: Update this value if your revenue share percentage changes.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:10 }\n */\n wixShare?: string;\n /** The date and time of the transaction. */\n createdDate?: Date | null;\n /** The type of billing event, either charge or refund. */\n billingType?: BillingTypeWithLiterals;\n}\n\nexport enum BillingType {\n UNKNOWN = 'UNKNOWN',\n CHARGE = 'CHARGE',\n REFUND = 'REFUND',\n}\n\n/** @enumType */\nexport type BillingTypeWithLiterals =\n | BillingType\n | 'UNKNOWN'\n | 'CHARGE'\n | 'REFUND';\n\nexport interface ReportExternalBillingEventRequest {\n /**\n * The billing event with details of the external transaction, including the gross revenue,\n * net revenue, and billing type (charge or refund).\n */\n event?: ExternalBillingEvent;\n}\n\nexport interface ReportExternalBillingEventResponse {\n /** The billing event that was processed. */\n event?: ExternalBillingEvent;\n}\n\n/** @docsIgnore */\nexport type ReportExternalBillingEventApplicationErrors = {\n code?: 'FAILED_PRECONDITION';\n description?: string;\n data?: Record<string, any>;\n};\n","import * as ambassadorWixMarketAimV1ExternalBillingEvent from './market-aim-v1-external-billing-event-external-billing.http.js';\nimport * as ambassadorWixMarketAimV1ExternalBillingEventTypes from './market-aim-v1-external-billing-event-external-billing.types.js';\nimport * as ambassadorWixMarketAimV1ExternalBillingEventUniversalTypes from './market-aim-v1-external-billing-event-external-billing.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 reportExternalBillingEvent(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixMarketAimV1ExternalBillingEventUniversalTypes.ReportExternalBillingEventRequest,\n ambassadorWixMarketAimV1ExternalBillingEventTypes.ReportExternalBillingEventRequest,\n ambassadorWixMarketAimV1ExternalBillingEventUniversalTypes.ReportExternalBillingEventResponse,\n ambassadorWixMarketAimV1ExternalBillingEventTypes.ReportExternalBillingEventResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixMarketAimV1ExternalBillingEvent.reportExternalBillingEvent(\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/billing-event',\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 ExternalBillingEvent as ExternalBillingEventOriginal,\n BillingType as BillingTypeOriginal,\n BillingTypeWithLiterals as BillingTypeWithLiteralsOriginal,\n ReportExternalBillingEventRequest as ReportExternalBillingEventRequestOriginal,\n ReportExternalBillingEventResponse as ReportExternalBillingEventResponseOriginal,\n ReportExternalBillingEventApplicationErrors as ReportExternalBillingEventApplicationErrorsOriginal,\n} from './market-aim-v1-external-billing-event-external-billing.types.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,oCAAAA;AAAA;AAAA;;;ACAA,uBAAqD;AACrD,IAAAC,oBAAqD;AACrD,6BAA+B;AAC/B,0BAA2B;AAI3B,SAAS,0DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,eAAe;AAAA,MACb;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,kBAAkB;AAAA,MAChB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,sBAAsB;AAAA,MACpB;AAAA,QACE,SAAS;AAAA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AAA;;;ACnCL,SAASC,8BAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBACyC;AAAA,IAC3C;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":["reportExternalBillingEvent","import_timestamp","payload","BillingType","reportExternalBillingEvent"]}
|
package/build/es/index.mjs
CHANGED
|
@@ -82,6 +82,10 @@ function resolveComWixpressMarketAimApiExternalBillingBiServiceUrl(opts) {
|
|
|
82
82
|
{
|
|
83
83
|
srcPath: "/devcenter/checkout/v1/checkout",
|
|
84
84
|
destPath: "/v1/checkout"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
srcPath: "/devcenter/checkout/v1/metered-billing-charges",
|
|
88
|
+
destPath: "/v1/metered-billing-charges"
|
|
85
89
|
}
|
|
86
90
|
],
|
|
87
91
|
_: [
|
|
@@ -92,6 +96,10 @@ function resolveComWixpressMarketAimApiExternalBillingBiServiceUrl(opts) {
|
|
|
92
96
|
{
|
|
93
97
|
srcPath: "/devcenter/checkout/v1/checkout",
|
|
94
98
|
destPath: "/v1/checkout"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
srcPath: "/devcenter/checkout/v1/metered-billing-charges",
|
|
102
|
+
destPath: "/v1/metered-billing-charges"
|
|
95
103
|
}
|
|
96
104
|
]
|
|
97
105
|
};
|
package/build/es/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/market-aim-v1-external-billing-event-external-billing.universal.ts","../../src/market-aim-v1-external-billing-event-external-billing.http.ts","../../src/market-aim-v1-external-billing-event-external-billing.public.ts","../../src/market-aim-v1-external-billing-event-external-billing.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 ambassadorWixMarketAimV1ExternalBillingEvent from './market-aim-v1-external-billing-event-external-billing.http.js';\n\nexport interface ExternalBillingEvent {\n /**\n * The app ID linked to this transaction. This field is only relevant if using an API key for authorization,\n * in which case you're required to pass the app ID.\n * @format GUID\n */\n appId?: string | null;\n /**\n * The app instance ID linked to this transaction. This field is only relevant if using an API key for authorization,\n * in which case you can optionally pass the instance ID.\n *\n * This connects the transaction to a specific instance of your app installed on a Wix site.\n * Learn more [about app instances](https://dev.wix.com/docs/build-apps/develop-your-app/access/app-instances/about-app-instances).\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * The total amount of the transaction in USD, not including tax.\n * This value can be negative for refunds or adjustments.\n *\n * Example: \"120.50\" for a $120.50 charge, or \"-120.50\" for a $120.50 refund.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:10 }\n */\n grossRevenue?: string;\n /**\n * The amount charged in USD minus agreed-upon expenses, such as shipping fees or\n * payment processing fees. Wix subtracts its share from this amount.\n * The value can be negative for refunds.\n *\n * Example calculation:\n * - Gross revenue: $120.50\n * - Minus expenses: $20.00 (shipping)\n * - Net revenue: $100.50\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:10 }\n */\n netRevenue?: string | null;\n /**\n * Wix's share of the transaction in USD, taken from the net revenue.\n * This value can be negative, such as for adjustments or refunds.\n *\n * Calculate based on your Partner Agreement terms. For example, if Wix's share is 20%:\n * - Net revenue: $100.50\n * - Wix share (20%): $20.10\n *\n * Important: Update this value if your revenue share percentage changes.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:10 }\n */\n wixShare?: string;\n /** The date and time of the transaction. */\n _createdDate?: Date | null;\n /** The type of billing event, either charge or refund. */\n billingType?: BillingTypeWithLiterals;\n}\n\nexport enum BillingType {\n UNKNOWN = 'UNKNOWN',\n CHARGE = 'CHARGE',\n REFUND = 'REFUND',\n}\n\n/** @enumType */\nexport type BillingTypeWithLiterals =\n | BillingType\n | 'UNKNOWN'\n | 'CHARGE'\n | 'REFUND';\n\nexport interface ReportExternalBillingEventRequest {\n /**\n * The billing event with details of the external transaction, including the gross revenue,\n * net revenue, and billing type (charge or refund).\n */\n event?: ExternalBillingEvent;\n}\n\nexport interface ReportExternalBillingEventResponse {\n /** The billing event that was processed. */\n event?: ExternalBillingEvent;\n}\n\n/** @docsIgnore */\nexport type ReportExternalBillingEventApplicationErrors = {\n code?: 'FAILED_PRECONDITION';\n description?: string;\n data?: Record<string, any>;\n};\n\n/**\n * Sends an external billing event to Wix.\n * Use this to report charges or refunds for your [Partner Billed App](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/partner-billed-apps-reporting).\n * The reported event enables Wix to track revenue, deductions, and Wix's share related to Partner Billed App charges.\n * @public\n * @documentationMaturity preview\n * @requiredField options.event.billingType\n * @requiredField options.event.grossRevenue\n * @requiredField options.event.wixShare\n * @permissionId WIX_DEVELOPERS.MANAGE_APP_INSTANCE\n * @applicableIdentity APP\n * @fqn com.wixpress.market.aim.api.ExternalBillingBIService.ReportExternalBillingEvent\n */\nexport async function reportExternalBillingEvent(\n options?: NonNullablePaths<\n ReportExternalBillingEventOptions,\n `event.billingType` | `event.grossRevenue` | `event.wixShare`,\n 3\n >\n): Promise<\n NonNullablePaths<\n ReportExternalBillingEventResponse,\n `event.grossRevenue` | `event.wixShare` | `event.billingType`,\n 3\n > & {\n __applicationErrorsType?: ReportExternalBillingEventApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n event: options?.event,\n });\n\n const reqOpts =\n ambassadorWixMarketAimV1ExternalBillingEvent.reportExternalBillingEvent(\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: { event: '$[0].event' },\n singleArgumentUnchanged: false,\n },\n ['options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface ReportExternalBillingEventOptions {\n /**\n * The billing event with details of the external transaction, including the gross revenue,\n * net revenue, and billing type (charge or refund).\n */\n event?: ExternalBillingEvent;\n}\n","import { transformSDKTimestampToRESTTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressMarketAimApiExternalBillingBiServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/app-instance-manager-webapp',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/apps',\n destPath: '',\n },\n ],\n 'wixapis.com': [\n {\n srcPath: '/apps',\n destPath: '',\n },\n ],\n 'dev._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n {\n srcPath: '/api/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/api/v1/scripts',\n destPath: '/v1/scripts',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'editor._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'blocks._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'create.editorx': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n '*.dev.wix-code.com': [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/devcenter/checkout/v1/checkout',\n destPath: '/v1/checkout',\n },\n ],\n _: [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/devcenter/checkout/v1/checkout',\n destPath: '/v1/checkout',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_app-management_external-billing';\n\n/**\n * Sends an external billing event to Wix.\n * Use this to report charges or refunds for your [Partner Billed App](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/partner-billed-apps-reporting).\n * The reported event enables Wix to track revenue, deductions, and Wix's share related to Partner Billed App charges.\n */\nexport function reportExternalBillingEvent(\n payload: object\n): RequestOptionsFactory<any> {\n function __reportExternalBillingEvent({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKTimestampToRESTTimestamp,\n paths: [{ path: 'event.createdDate' }],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.market.aim.v1.external_billing_event',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.market.aim.api.ExternalBillingBIService.ReportExternalBillingEvent',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressMarketAimApiExternalBillingBiServiceUrl({\n protoPath: '/v1/billing-event',\n data: serializedData,\n host,\n }),\n data: serializedData,\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [{ path: 'event.createdDate' }],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __reportExternalBillingEvent;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n ReportExternalBillingEventApplicationErrors,\n ReportExternalBillingEventOptions,\n ReportExternalBillingEventResponse,\n reportExternalBillingEvent as universalReportExternalBillingEvent,\n} from './market-aim-v1-external-billing-event-external-billing.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/app-management' };\n\nexport function reportExternalBillingEvent(\n httpClient: HttpClient\n): ReportExternalBillingEventSignature {\n return (\n options?: NonNullablePaths<\n ReportExternalBillingEventOptions,\n `event.billingType` | `event.grossRevenue` | `event.wixShare`,\n 3\n >\n ) =>\n universalReportExternalBillingEvent(\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface ReportExternalBillingEventSignature {\n /**\n * Sends an external billing event to Wix.\n * Use this to report charges or refunds for your [Partner Billed App](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/partner-billed-apps-reporting).\n * The reported event enables Wix to track revenue, deductions, and Wix's share related to Partner Billed App charges.\n */\n (\n options?: NonNullablePaths<\n ReportExternalBillingEventOptions,\n `event.billingType` | `event.grossRevenue` | `event.wixShare`,\n 3\n >\n ): Promise<\n NonNullablePaths<\n ReportExternalBillingEventResponse,\n `event.grossRevenue` | `event.wixShare` | `event.billingType`,\n 3\n > & {\n __applicationErrorsType?: ReportExternalBillingEventApplicationErrors;\n }\n >;\n}\n\nexport {\n BillingType,\n ExternalBillingEvent,\n ReportExternalBillingEventOptions,\n ReportExternalBillingEventRequest,\n ReportExternalBillingEventResponse,\n} from './market-aim-v1-external-billing-event-external-billing.universal.js';\n","import { reportExternalBillingEvent as publicReportExternalBillingEvent } from './market-aim-v1-external-billing-event-external-billing.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const reportExternalBillingEvent: MaybeContext<\n BuildRESTFunction<typeof publicReportExternalBillingEvent> &\n typeof publicReportExternalBillingEvent\n> = /*#__PURE__*/ createRESTModule(publicReportExternalBillingEvent);\n\nexport { BillingType } from './market-aim-v1-external-billing-event-external-billing.universal.js';\nexport {\n ExternalBillingEvent,\n ReportExternalBillingEventRequest,\n ReportExternalBillingEventResponse,\n ReportExternalBillingEventOptions,\n} from './market-aim-v1-external-billing-event-external-billing.universal.js';\nexport {\n BillingTypeWithLiterals,\n ReportExternalBillingEventApplicationErrors,\n} from './market-aim-v1-external-billing-event-external-billing.universal.js';\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,4CAA4C;AACrD,SAAS,4CAA4C;AACrD,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAI3B,SAAS,0DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,eAAe;AAAA,MACb;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB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AEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;AD9EO,IAAK,cAAL,kBAAKC,iBAAL;AACL,EAAAA,aAAA,aAAU;AACV,EAAAA,aAAA,YAAS;AACT,EAAAA,aAAA,YAAS;AAHC,SAAAA;AAAA,GAAA;AA8CZ,eAAsBC,4BACpB,SAaA;AAEA,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,UAAU,sCAAsC;AAAA,IACpD,OAAO,SAAS;AAAA,EAClB,CAAC;AAED,QAAM,UACyC;AAAA,IAC3C;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,EAAE,OAAO,aAAa;AAAA,QAChD,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,SAAS;AAAA,IACZ;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;;;AEvJO,SAASC,4BACd,YACqC;AACrC,SAAO,CACL,YAMAA;AAAA,IACE;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;ACxBA,SAAS,wBAAwB;AAG1B,IAAMC,8BAGK,iCAAiBA,2BAAgC;","names":["payload","BillingType","reportExternalBillingEvent","reportExternalBillingEvent","reportExternalBillingEvent"]}
|
|
1
|
+
{"version":3,"sources":["../../src/market-aim-v1-external-billing-event-external-billing.universal.ts","../../src/market-aim-v1-external-billing-event-external-billing.http.ts","../../src/market-aim-v1-external-billing-event-external-billing.public.ts","../../src/market-aim-v1-external-billing-event-external-billing.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 ambassadorWixMarketAimV1ExternalBillingEvent from './market-aim-v1-external-billing-event-external-billing.http.js';\n\nexport interface ExternalBillingEvent {\n /**\n * The app ID linked to this transaction. This field is only relevant if using an API key for authorization,\n * in which case you're required to pass the app ID.\n * @format GUID\n */\n appId?: string | null;\n /**\n * The app instance ID linked to this transaction. This field is only relevant if using an API key for authorization,\n * in which case you can optionally pass the instance ID.\n *\n * This connects the transaction to a specific instance of your app installed on a Wix site.\n * Learn more [about app instances](https://dev.wix.com/docs/build-apps/develop-your-app/access/app-instances/about-app-instances).\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * The total amount of the transaction in USD, not including tax.\n * This value can be negative for refunds or adjustments.\n *\n * Example: \"120.50\" for a $120.50 charge, or \"-120.50\" for a $120.50 refund.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:10 }\n */\n grossRevenue?: string;\n /**\n * The amount charged in USD minus agreed-upon expenses, such as shipping fees or\n * payment processing fees. Wix subtracts its share from this amount.\n * The value can be negative for refunds.\n *\n * Example calculation:\n * - Gross revenue: $120.50\n * - Minus expenses: $20.00 (shipping)\n * - Net revenue: $100.50\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:10 }\n */\n netRevenue?: string | null;\n /**\n * Wix's share of the transaction in USD, taken from the net revenue.\n * This value can be negative, such as for adjustments or refunds.\n *\n * Calculate based on your Partner Agreement terms. For example, if Wix's share is 20%:\n * - Net revenue: $100.50\n * - Wix share (20%): $20.10\n *\n * Important: Update this value if your revenue share percentage changes.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:10 }\n */\n wixShare?: string;\n /** The date and time of the transaction. */\n _createdDate?: Date | null;\n /** The type of billing event, either charge or refund. */\n billingType?: BillingTypeWithLiterals;\n}\n\nexport enum BillingType {\n UNKNOWN = 'UNKNOWN',\n CHARGE = 'CHARGE',\n REFUND = 'REFUND',\n}\n\n/** @enumType */\nexport type BillingTypeWithLiterals =\n | BillingType\n | 'UNKNOWN'\n | 'CHARGE'\n | 'REFUND';\n\nexport interface ReportExternalBillingEventRequest {\n /**\n * The billing event with details of the external transaction, including the gross revenue,\n * net revenue, and billing type (charge or refund).\n */\n event?: ExternalBillingEvent;\n}\n\nexport interface ReportExternalBillingEventResponse {\n /** The billing event that was processed. */\n event?: ExternalBillingEvent;\n}\n\n/** @docsIgnore */\nexport type ReportExternalBillingEventApplicationErrors = {\n code?: 'FAILED_PRECONDITION';\n description?: string;\n data?: Record<string, any>;\n};\n\n/**\n * Sends an external billing event to Wix.\n * Use this to report charges or refunds for your [Partner Billed App](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/partner-billed-apps-reporting).\n * The reported event enables Wix to track revenue, deductions, and Wix's share related to Partner Billed App charges.\n * @public\n * @documentationMaturity preview\n * @requiredField options.event.billingType\n * @requiredField options.event.grossRevenue\n * @requiredField options.event.wixShare\n * @permissionId WIX_DEVELOPERS.MANAGE_APP_INSTANCE\n * @applicableIdentity APP\n * @fqn com.wixpress.market.aim.api.ExternalBillingBIService.ReportExternalBillingEvent\n */\nexport async function reportExternalBillingEvent(\n options?: NonNullablePaths<\n ReportExternalBillingEventOptions,\n `event.billingType` | `event.grossRevenue` | `event.wixShare`,\n 3\n >\n): Promise<\n NonNullablePaths<\n ReportExternalBillingEventResponse,\n `event.grossRevenue` | `event.wixShare` | `event.billingType`,\n 3\n > & {\n __applicationErrorsType?: ReportExternalBillingEventApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n event: options?.event,\n });\n\n const reqOpts =\n ambassadorWixMarketAimV1ExternalBillingEvent.reportExternalBillingEvent(\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: { event: '$[0].event' },\n singleArgumentUnchanged: false,\n },\n ['options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface ReportExternalBillingEventOptions {\n /**\n * The billing event with details of the external transaction, including the gross revenue,\n * net revenue, and billing type (charge or refund).\n */\n event?: ExternalBillingEvent;\n}\n","import { transformSDKTimestampToRESTTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressMarketAimApiExternalBillingBiServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/app-instance-manager-webapp',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/apps',\n destPath: '',\n },\n ],\n 'wixapis.com': [\n {\n srcPath: '/apps',\n destPath: '',\n },\n ],\n 'dev._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n {\n srcPath: '/api/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/api/v1/scripts',\n destPath: '/v1/scripts',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'editor._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'blocks._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'create.editorx': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n '*.dev.wix-code.com': [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/devcenter/checkout/v1/checkout',\n destPath: '/v1/checkout',\n },\n {\n srcPath: '/devcenter/checkout/v1/metered-billing-charges',\n destPath: '/v1/metered-billing-charges',\n },\n ],\n _: [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/devcenter/checkout/v1/checkout',\n destPath: '/v1/checkout',\n },\n {\n srcPath: '/devcenter/checkout/v1/metered-billing-charges',\n destPath: '/v1/metered-billing-charges',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_app-management_external-billing';\n\n/**\n * Sends an external billing event to Wix.\n * Use this to report charges or refunds for your [Partner Billed App](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/partner-billed-apps-reporting).\n * The reported event enables Wix to track revenue, deductions, and Wix's share related to Partner Billed App charges.\n */\nexport function reportExternalBillingEvent(\n payload: object\n): RequestOptionsFactory<any> {\n function __reportExternalBillingEvent({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKTimestampToRESTTimestamp,\n paths: [{ path: 'event.createdDate' }],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.market.aim.v1.external_billing_event',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.market.aim.api.ExternalBillingBIService.ReportExternalBillingEvent',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressMarketAimApiExternalBillingBiServiceUrl({\n protoPath: '/v1/billing-event',\n data: serializedData,\n host,\n }),\n data: serializedData,\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [{ path: 'event.createdDate' }],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __reportExternalBillingEvent;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n ReportExternalBillingEventApplicationErrors,\n ReportExternalBillingEventOptions,\n ReportExternalBillingEventResponse,\n reportExternalBillingEvent as universalReportExternalBillingEvent,\n} from './market-aim-v1-external-billing-event-external-billing.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/app-management' };\n\nexport function reportExternalBillingEvent(\n httpClient: HttpClient\n): ReportExternalBillingEventSignature {\n return (\n options?: NonNullablePaths<\n ReportExternalBillingEventOptions,\n `event.billingType` | `event.grossRevenue` | `event.wixShare`,\n 3\n >\n ) =>\n universalReportExternalBillingEvent(\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface ReportExternalBillingEventSignature {\n /**\n * Sends an external billing event to Wix.\n * Use this to report charges or refunds for your [Partner Billed App](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/partner-billed-apps-reporting).\n * The reported event enables Wix to track revenue, deductions, and Wix's share related to Partner Billed App charges.\n */\n (\n options?: NonNullablePaths<\n ReportExternalBillingEventOptions,\n `event.billingType` | `event.grossRevenue` | `event.wixShare`,\n 3\n >\n ): Promise<\n NonNullablePaths<\n ReportExternalBillingEventResponse,\n `event.grossRevenue` | `event.wixShare` | `event.billingType`,\n 3\n > & {\n __applicationErrorsType?: ReportExternalBillingEventApplicationErrors;\n }\n >;\n}\n\nexport {\n BillingType,\n ExternalBillingEvent,\n ReportExternalBillingEventOptions,\n ReportExternalBillingEventRequest,\n ReportExternalBillingEventResponse,\n} from './market-aim-v1-external-billing-event-external-billing.universal.js';\n","import { reportExternalBillingEvent as publicReportExternalBillingEvent } from './market-aim-v1-external-billing-event-external-billing.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const reportExternalBillingEvent: MaybeContext<\n BuildRESTFunction<typeof publicReportExternalBillingEvent> &\n typeof publicReportExternalBillingEvent\n> = /*#__PURE__*/ createRESTModule(publicReportExternalBillingEvent);\n\nexport { BillingType } from './market-aim-v1-external-billing-event-external-billing.universal.js';\nexport {\n ExternalBillingEvent,\n ReportExternalBillingEventRequest,\n ReportExternalBillingEventResponse,\n ReportExternalBillingEventOptions,\n} from './market-aim-v1-external-billing-event-external-billing.universal.js';\nexport {\n BillingTypeWithLiterals,\n ReportExternalBillingEventApplicationErrors,\n} from './market-aim-v1-external-billing-event-external-billing.universal.js';\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,4CAA4C;AACrD,SAAS,4CAA4C;AACrD,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAI3B,SAAS,0DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,eAAe;AAAA,MACb;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AA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S;AAAA,QACtB;AAAA,UACE,aAAa;AAAA,UACb,OAAO,CAAC,EAAE,MAAM,oBAAoB,CAAC;AAAA,QACvC;AAAA,MACF,CAAC;AAAA,IACL;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ADtFO,IAAK,cAAL,kBAAKC,iBAAL;AACL,EAAAA,aAAA,aAAU;AACV,EAAAA,aAAA,YAAS;AACT,EAAAA,aAAA,YAAS;AAHC,SAAAA;AAAA,GAAA;AA8CZ,eAAsBC,4BACpB,SAaA;AAEA,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,UAAU,sCAAsC;AAAA,IACpD,OAAO,SAAS;AAAA,EAClB,CAAC;AAED,QAAM,UACyC;AAAA,IAC3C;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,EAAE,OAAO,aAAa;AAAA,QAChD,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,SAAS;AAAA,IACZ;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;;;AEvJO,SAASC,4BACd,YACqC;AACrC,SAAO,CACL,YAMAA;AAAA,IACE;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;ACxBA,SAAS,wBAAwB;AAG1B,IAAMC,8BAGK,iCAAiBA,2BAAgC;","names":["payload","BillingType","reportExternalBillingEvent","reportExternalBillingEvent","reportExternalBillingEvent"]}
|
|
@@ -82,6 +82,10 @@ function resolveComWixpressMarketAimApiExternalBillingBiServiceUrl(opts) {
|
|
|
82
82
|
{
|
|
83
83
|
srcPath: "/devcenter/checkout/v1/checkout",
|
|
84
84
|
destPath: "/v1/checkout"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
srcPath: "/devcenter/checkout/v1/metered-billing-charges",
|
|
88
|
+
destPath: "/v1/metered-billing-charges"
|
|
85
89
|
}
|
|
86
90
|
],
|
|
87
91
|
_: [
|
|
@@ -92,6 +96,10 @@ function resolveComWixpressMarketAimApiExternalBillingBiServiceUrl(opts) {
|
|
|
92
96
|
{
|
|
93
97
|
srcPath: "/devcenter/checkout/v1/checkout",
|
|
94
98
|
destPath: "/v1/checkout"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
srcPath: "/devcenter/checkout/v1/metered-billing-charges",
|
|
102
|
+
destPath: "/v1/metered-billing-charges"
|
|
95
103
|
}
|
|
96
104
|
]
|
|
97
105
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/market-aim-v1-external-billing-event-external-billing.universal.ts","../../src/market-aim-v1-external-billing-event-external-billing.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 ambassadorWixMarketAimV1ExternalBillingEvent from './market-aim-v1-external-billing-event-external-billing.http.js';\n\nexport interface ExternalBillingEvent {\n /**\n * The app ID linked to this transaction. This field is only relevant if using an API key for authorization,\n * in which case you're required to pass the app ID.\n * @format GUID\n */\n appId?: string | null;\n /**\n * The app instance ID linked to this transaction. This field is only relevant if using an API key for authorization,\n * in which case you can optionally pass the instance ID.\n *\n * This connects the transaction to a specific instance of your app installed on a Wix site.\n * Learn more [about app instances](https://dev.wix.com/docs/build-apps/develop-your-app/access/app-instances/about-app-instances).\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * The total amount of the transaction in USD, not including tax.\n * This value can be negative for refunds or adjustments.\n *\n * Example: \"120.50\" for a $120.50 charge, or \"-120.50\" for a $120.50 refund.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:10 }\n */\n grossRevenue?: string;\n /**\n * The amount charged in USD minus agreed-upon expenses, such as shipping fees or\n * payment processing fees. Wix subtracts its share from this amount.\n * The value can be negative for refunds.\n *\n * Example calculation:\n * - Gross revenue: $120.50\n * - Minus expenses: $20.00 (shipping)\n * - Net revenue: $100.50\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:10 }\n */\n netRevenue?: string | null;\n /**\n * Wix's share of the transaction in USD, taken from the net revenue.\n * This value can be negative, such as for adjustments or refunds.\n *\n * Calculate based on your Partner Agreement terms. For example, if Wix's share is 20%:\n * - Net revenue: $100.50\n * - Wix share (20%): $20.10\n *\n * Important: Update this value if your revenue share percentage changes.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:10 }\n */\n wixShare?: string;\n /** The date and time of the transaction. */\n _createdDate?: Date | null;\n /** The type of billing event, either charge or refund. */\n billingType?: BillingTypeWithLiterals;\n}\n\nexport enum BillingType {\n UNKNOWN = 'UNKNOWN',\n CHARGE = 'CHARGE',\n REFUND = 'REFUND',\n}\n\n/** @enumType */\nexport type BillingTypeWithLiterals =\n | BillingType\n | 'UNKNOWN'\n | 'CHARGE'\n | 'REFUND';\n\nexport interface ReportExternalBillingEventRequest {\n /**\n * The billing event with details of the external transaction, including the gross revenue,\n * net revenue, and billing type (charge or refund).\n */\n event?: ExternalBillingEvent;\n}\n\nexport interface ReportExternalBillingEventResponse {\n /** The billing event that was processed. */\n event?: ExternalBillingEvent;\n}\n\n/** @docsIgnore */\nexport type ReportExternalBillingEventApplicationErrors = {\n code?: 'FAILED_PRECONDITION';\n description?: string;\n data?: Record<string, any>;\n};\n\n/**\n * Sends an external billing event to Wix.\n * Use this to report charges or refunds for your [Partner Billed App](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/partner-billed-apps-reporting).\n * The reported event enables Wix to track revenue, deductions, and Wix's share related to Partner Billed App charges.\n * @public\n * @documentationMaturity preview\n * @requiredField options.event.billingType\n * @requiredField options.event.grossRevenue\n * @requiredField options.event.wixShare\n * @permissionId WIX_DEVELOPERS.MANAGE_APP_INSTANCE\n * @applicableIdentity APP\n * @fqn com.wixpress.market.aim.api.ExternalBillingBIService.ReportExternalBillingEvent\n */\nexport async function reportExternalBillingEvent(\n options?: NonNullablePaths<\n ReportExternalBillingEventOptions,\n `event.billingType` | `event.grossRevenue` | `event.wixShare`,\n 3\n >\n): Promise<\n NonNullablePaths<\n ReportExternalBillingEventResponse,\n `event.grossRevenue` | `event.wixShare` | `event.billingType`,\n 3\n > & {\n __applicationErrorsType?: ReportExternalBillingEventApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n event: options?.event,\n });\n\n const reqOpts =\n ambassadorWixMarketAimV1ExternalBillingEvent.reportExternalBillingEvent(\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: { event: '$[0].event' },\n singleArgumentUnchanged: false,\n },\n ['options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface ReportExternalBillingEventOptions {\n /**\n * The billing event with details of the external transaction, including the gross revenue,\n * net revenue, and billing type (charge or refund).\n */\n event?: ExternalBillingEvent;\n}\n","import { transformSDKTimestampToRESTTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressMarketAimApiExternalBillingBiServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/app-instance-manager-webapp',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/apps',\n destPath: '',\n },\n ],\n 'wixapis.com': [\n {\n srcPath: '/apps',\n destPath: '',\n },\n ],\n 'dev._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n {\n srcPath: '/api/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/api/v1/scripts',\n destPath: '/v1/scripts',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'editor._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'blocks._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'create.editorx': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n '*.dev.wix-code.com': [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/devcenter/checkout/v1/checkout',\n destPath: '/v1/checkout',\n },\n ],\n _: [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/devcenter/checkout/v1/checkout',\n destPath: '/v1/checkout',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_app-management_external-billing';\n\n/**\n * Sends an external billing event to Wix.\n * Use this to report charges or refunds for your [Partner Billed App](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/partner-billed-apps-reporting).\n * The reported event enables Wix to track revenue, deductions, and Wix's share related to Partner Billed App charges.\n */\nexport function reportExternalBillingEvent(\n payload: object\n): RequestOptionsFactory<any> {\n function __reportExternalBillingEvent({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKTimestampToRESTTimestamp,\n paths: [{ path: 'event.createdDate' }],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.market.aim.v1.external_billing_event',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.market.aim.api.ExternalBillingBIService.ReportExternalBillingEvent',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressMarketAimApiExternalBillingBiServiceUrl({\n protoPath: '/v1/billing-event',\n data: serializedData,\n host,\n }),\n data: serializedData,\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [{ path: 'event.createdDate' }],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __reportExternalBillingEvent;\n}\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,4CAA4C;AACrD,SAAS,4CAA4C;AACrD,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAI3B,SAAS,0DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,eAAe;AAAA,MACb;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QAC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B,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,0DAA0D;AAAA,QAC7D,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,MACN,mBAAmB,CAACA,aAClB,eAAeA,UAAS;AAAA,QACtB;AAAA,UACE,aAAa;AAAA,UACb,OAAO,CAAC,EAAE,MAAM,oBAAoB,CAAC;AAAA,QACvC;AAAA,MACF,CAAC;AAAA,IACL;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;AD9EO,IAAK,cAAL,kBAAKC,iBAAL;AACL,EAAAA,aAAA,aAAU;AACV,EAAAA,aAAA,YAAS;AACT,EAAAA,aAAA,YAAS;AAHC,SAAAA;AAAA,GAAA;AA8CZ,eAAsBC,4BACpB,SAaA;AAEA,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,UAAU,sCAAsC;AAAA,IACpD,OAAO,SAAS;AAAA,EAClB,CAAC;AAED,QAAM,UACyC;AAAA,IAC3C;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,EAAE,OAAO,aAAa;AAAA,QAChD,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,SAAS;AAAA,IACZ;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["payload","BillingType","reportExternalBillingEvent"]}
|
|
1
|
+
{"version":3,"sources":["../../src/market-aim-v1-external-billing-event-external-billing.universal.ts","../../src/market-aim-v1-external-billing-event-external-billing.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 ambassadorWixMarketAimV1ExternalBillingEvent from './market-aim-v1-external-billing-event-external-billing.http.js';\n\nexport interface ExternalBillingEvent {\n /**\n * The app ID linked to this transaction. This field is only relevant if using an API key for authorization,\n * in which case you're required to pass the app ID.\n * @format GUID\n */\n appId?: string | null;\n /**\n * The app instance ID linked to this transaction. This field is only relevant if using an API key for authorization,\n * in which case you can optionally pass the instance ID.\n *\n * This connects the transaction to a specific instance of your app installed on a Wix site.\n * Learn more [about app instances](https://dev.wix.com/docs/build-apps/develop-your-app/access/app-instances/about-app-instances).\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * The total amount of the transaction in USD, not including tax.\n * This value can be negative for refunds or adjustments.\n *\n * Example: \"120.50\" for a $120.50 charge, or \"-120.50\" for a $120.50 refund.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:10 }\n */\n grossRevenue?: string;\n /**\n * The amount charged in USD minus agreed-upon expenses, such as shipping fees or\n * payment processing fees. Wix subtracts its share from this amount.\n * The value can be negative for refunds.\n *\n * Example calculation:\n * - Gross revenue: $120.50\n * - Minus expenses: $20.00 (shipping)\n * - Net revenue: $100.50\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:10 }\n */\n netRevenue?: string | null;\n /**\n * Wix's share of the transaction in USD, taken from the net revenue.\n * This value can be negative, such as for adjustments or refunds.\n *\n * Calculate based on your Partner Agreement terms. For example, if Wix's share is 20%:\n * - Net revenue: $100.50\n * - Wix share (20%): $20.10\n *\n * Important: Update this value if your revenue share percentage changes.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:10 }\n */\n wixShare?: string;\n /** The date and time of the transaction. */\n _createdDate?: Date | null;\n /** The type of billing event, either charge or refund. */\n billingType?: BillingTypeWithLiterals;\n}\n\nexport enum BillingType {\n UNKNOWN = 'UNKNOWN',\n CHARGE = 'CHARGE',\n REFUND = 'REFUND',\n}\n\n/** @enumType */\nexport type BillingTypeWithLiterals =\n | BillingType\n | 'UNKNOWN'\n | 'CHARGE'\n | 'REFUND';\n\nexport interface ReportExternalBillingEventRequest {\n /**\n * The billing event with details of the external transaction, including the gross revenue,\n * net revenue, and billing type (charge or refund).\n */\n event?: ExternalBillingEvent;\n}\n\nexport interface ReportExternalBillingEventResponse {\n /** The billing event that was processed. */\n event?: ExternalBillingEvent;\n}\n\n/** @docsIgnore */\nexport type ReportExternalBillingEventApplicationErrors = {\n code?: 'FAILED_PRECONDITION';\n description?: string;\n data?: Record<string, any>;\n};\n\n/**\n * Sends an external billing event to Wix.\n * Use this to report charges or refunds for your [Partner Billed App](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/partner-billed-apps-reporting).\n * The reported event enables Wix to track revenue, deductions, and Wix's share related to Partner Billed App charges.\n * @public\n * @documentationMaturity preview\n * @requiredField options.event.billingType\n * @requiredField options.event.grossRevenue\n * @requiredField options.event.wixShare\n * @permissionId WIX_DEVELOPERS.MANAGE_APP_INSTANCE\n * @applicableIdentity APP\n * @fqn com.wixpress.market.aim.api.ExternalBillingBIService.ReportExternalBillingEvent\n */\nexport async function reportExternalBillingEvent(\n options?: NonNullablePaths<\n ReportExternalBillingEventOptions,\n `event.billingType` | `event.grossRevenue` | `event.wixShare`,\n 3\n >\n): Promise<\n NonNullablePaths<\n ReportExternalBillingEventResponse,\n `event.grossRevenue` | `event.wixShare` | `event.billingType`,\n 3\n > & {\n __applicationErrorsType?: ReportExternalBillingEventApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n event: options?.event,\n });\n\n const reqOpts =\n ambassadorWixMarketAimV1ExternalBillingEvent.reportExternalBillingEvent(\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: { event: '$[0].event' },\n singleArgumentUnchanged: false,\n },\n ['options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface ReportExternalBillingEventOptions {\n /**\n * The billing event with details of the external transaction, including the gross revenue,\n * net revenue, and billing type (charge or refund).\n */\n event?: ExternalBillingEvent;\n}\n","import { transformSDKTimestampToRESTTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressMarketAimApiExternalBillingBiServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/app-instance-manager-webapp',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/apps',\n destPath: '',\n },\n ],\n 'wixapis.com': [\n {\n srcPath: '/apps',\n destPath: '',\n },\n ],\n 'dev._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n {\n srcPath: '/api/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/api/v1/scripts',\n destPath: '/v1/scripts',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'editor._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'blocks._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'create.editorx': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n '*.dev.wix-code.com': [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/devcenter/checkout/v1/checkout',\n destPath: '/v1/checkout',\n },\n {\n srcPath: '/devcenter/checkout/v1/metered-billing-charges',\n destPath: '/v1/metered-billing-charges',\n },\n ],\n _: [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/devcenter/checkout/v1/checkout',\n destPath: '/v1/checkout',\n },\n {\n srcPath: '/devcenter/checkout/v1/metered-billing-charges',\n destPath: '/v1/metered-billing-charges',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_app-management_external-billing';\n\n/**\n * Sends an external billing event to Wix.\n * Use this to report charges or refunds for your [Partner Billed App](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/partner-billed-apps-reporting).\n * The reported event enables Wix to track revenue, deductions, and Wix's share related to Partner Billed App charges.\n */\nexport function reportExternalBillingEvent(\n payload: object\n): RequestOptionsFactory<any> {\n function __reportExternalBillingEvent({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKTimestampToRESTTimestamp,\n paths: [{ path: 'event.createdDate' }],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.market.aim.v1.external_billing_event',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.market.aim.api.ExternalBillingBIService.ReportExternalBillingEvent',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressMarketAimApiExternalBillingBiServiceUrl({\n protoPath: '/v1/billing-event',\n data: serializedData,\n host,\n }),\n data: serializedData,\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [{ path: 'event.createdDate' }],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __reportExternalBillingEvent;\n}\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,4CAA4C;AACrD,SAAS,4CAA4C;AACrD,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAI3B,SAAS,0DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,eAAe;AAAA,MACb;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,kBAAkB;AAAA,MAChB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IAC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EAAAA,aAAA,YAAS;AAHC,SAAAA;AAAA,GAAA;AA8CZ,eAAsBC,4BACpB,SAaA;AAEA,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,UAAU,sCAAsC;AAAA,IACpD,OAAO,SAAS;AAAA,EAClB,CAAC;AAED,QAAM,UACyC;AAAA,IAC3C;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,EAAE,OAAO,aAAa;AAAA,QAChD,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,SAAS;AAAA,IACZ;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["payload","BillingType","reportExternalBillingEvent"]}
|
package/build/es/meta.mjs
CHANGED
|
@@ -75,6 +75,10 @@ function resolveComWixpressMarketAimApiExternalBillingBiServiceUrl(opts) {
|
|
|
75
75
|
{
|
|
76
76
|
srcPath: "/devcenter/checkout/v1/checkout",
|
|
77
77
|
destPath: "/v1/checkout"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
srcPath: "/devcenter/checkout/v1/metered-billing-charges",
|
|
81
|
+
destPath: "/v1/metered-billing-charges"
|
|
78
82
|
}
|
|
79
83
|
],
|
|
80
84
|
_: [
|
|
@@ -85,6 +89,10 @@ function resolveComWixpressMarketAimApiExternalBillingBiServiceUrl(opts) {
|
|
|
85
89
|
{
|
|
86
90
|
srcPath: "/devcenter/checkout/v1/checkout",
|
|
87
91
|
destPath: "/v1/checkout"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
srcPath: "/devcenter/checkout/v1/metered-billing-charges",
|
|
95
|
+
destPath: "/v1/metered-billing-charges"
|
|
88
96
|
}
|
|
89
97
|
]
|
|
90
98
|
};
|
package/build/es/meta.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/market-aim-v1-external-billing-event-external-billing.http.ts","../../src/market-aim-v1-external-billing-event-external-billing.types.ts","../../src/market-aim-v1-external-billing-event-external-billing.meta.ts"],"sourcesContent":["import { transformSDKTimestampToRESTTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressMarketAimApiExternalBillingBiServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/app-instance-manager-webapp',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/apps',\n destPath: '',\n },\n ],\n 'wixapis.com': [\n {\n srcPath: '/apps',\n destPath: '',\n },\n ],\n 'dev._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n {\n srcPath: '/api/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/api/v1/scripts',\n destPath: '/v1/scripts',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'editor._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'blocks._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'create.editorx': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n '*.dev.wix-code.com': [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/devcenter/checkout/v1/checkout',\n destPath: '/v1/checkout',\n },\n ],\n _: [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/devcenter/checkout/v1/checkout',\n destPath: '/v1/checkout',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_app-management_external-billing';\n\n/**\n * Sends an external billing event to Wix.\n * Use this to report charges or refunds for your [Partner Billed App](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/partner-billed-apps-reporting).\n * The reported event enables Wix to track revenue, deductions, and Wix's share related to Partner Billed App charges.\n */\nexport function reportExternalBillingEvent(\n payload: object\n): RequestOptionsFactory<any> {\n function __reportExternalBillingEvent({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKTimestampToRESTTimestamp,\n paths: [{ path: 'event.createdDate' }],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.market.aim.v1.external_billing_event',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.market.aim.api.ExternalBillingBIService.ReportExternalBillingEvent',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressMarketAimApiExternalBillingBiServiceUrl({\n protoPath: '/v1/billing-event',\n data: serializedData,\n host,\n }),\n data: serializedData,\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [{ path: 'event.createdDate' }],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __reportExternalBillingEvent;\n}\n","export interface ExternalBillingEvent {\n /**\n * The app ID linked to this transaction. This field is only relevant if using an API key for authorization,\n * in which case you're required to pass the app ID.\n * @format GUID\n */\n appId?: string | null;\n /**\n * The app instance ID linked to this transaction. This field is only relevant if using an API key for authorization,\n * in which case you can optionally pass the instance ID.\n *\n * This connects the transaction to a specific instance of your app installed on a Wix site.\n * Learn more [about app instances](https://dev.wix.com/docs/build-apps/develop-your-app/access/app-instances/about-app-instances).\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * The total amount of the transaction in USD, not including tax.\n * This value can be negative for refunds or adjustments.\n *\n * Example: \"120.50\" for a $120.50 charge, or \"-120.50\" for a $120.50 refund.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:10 }\n */\n grossRevenue?: string;\n /**\n * The amount charged in USD minus agreed-upon expenses, such as shipping fees or\n * payment processing fees. Wix subtracts its share from this amount.\n * The value can be negative for refunds.\n *\n * Example calculation:\n * - Gross revenue: $120.50\n * - Minus expenses: $20.00 (shipping)\n * - Net revenue: $100.50\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:10 }\n */\n netRevenue?: string | null;\n /**\n * Wix's share of the transaction in USD, taken from the net revenue.\n * This value can be negative, such as for adjustments or refunds.\n *\n * Calculate based on your Partner Agreement terms. For example, if Wix's share is 20%:\n * - Net revenue: $100.50\n * - Wix share (20%): $20.10\n *\n * Important: Update this value if your revenue share percentage changes.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:10 }\n */\n wixShare?: string;\n /** The date and time of the transaction. */\n createdDate?: Date | null;\n /** The type of billing event, either charge or refund. */\n billingType?: BillingTypeWithLiterals;\n}\n\nexport enum BillingType {\n UNKNOWN = 'UNKNOWN',\n CHARGE = 'CHARGE',\n REFUND = 'REFUND',\n}\n\n/** @enumType */\nexport type BillingTypeWithLiterals =\n | BillingType\n | 'UNKNOWN'\n | 'CHARGE'\n | 'REFUND';\n\nexport interface ReportExternalBillingEventRequest {\n /**\n * The billing event with details of the external transaction, including the gross revenue,\n * net revenue, and billing type (charge or refund).\n */\n event?: ExternalBillingEvent;\n}\n\nexport interface ReportExternalBillingEventResponse {\n /** The billing event that was processed. */\n event?: ExternalBillingEvent;\n}\n\n/** @docsIgnore */\nexport type ReportExternalBillingEventApplicationErrors = {\n code?: 'FAILED_PRECONDITION';\n description?: string;\n data?: Record<string, any>;\n};\n","import * as ambassadorWixMarketAimV1ExternalBillingEvent from './market-aim-v1-external-billing-event-external-billing.http.js';\nimport * as ambassadorWixMarketAimV1ExternalBillingEventTypes from './market-aim-v1-external-billing-event-external-billing.types.js';\nimport * as ambassadorWixMarketAimV1ExternalBillingEventUniversalTypes from './market-aim-v1-external-billing-event-external-billing.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 reportExternalBillingEvent(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixMarketAimV1ExternalBillingEventUniversalTypes.ReportExternalBillingEventRequest,\n ambassadorWixMarketAimV1ExternalBillingEventTypes.ReportExternalBillingEventRequest,\n ambassadorWixMarketAimV1ExternalBillingEventUniversalTypes.ReportExternalBillingEventResponse,\n ambassadorWixMarketAimV1ExternalBillingEventTypes.ReportExternalBillingEventResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixMarketAimV1ExternalBillingEvent.reportExternalBillingEvent(\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/billing-event',\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 ExternalBillingEvent as ExternalBillingEventOriginal,\n BillingType as BillingTypeOriginal,\n BillingTypeWithLiterals as BillingTypeWithLiteralsOriginal,\n ReportExternalBillingEventRequest as ReportExternalBillingEventRequestOriginal,\n ReportExternalBillingEventResponse as ReportExternalBillingEventResponseOriginal,\n ReportExternalBillingEventApplicationErrors as ReportExternalBillingEventApplicationErrorsOriginal,\n} from './market-aim-v1-external-billing-event-external-billing.types.js';\n"],"mappings":";AAAA,SAAS,4CAA4C;AACrD,SAAS,4CAA4C;AACrD,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAI3B,SAAS,0DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,eAAe;AAAA,MACb;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,kBAAkB;AAAA,MAChB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,sBAAsB;AAAA,MACpB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA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C,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":["payload","BillingType","reportExternalBillingEvent"]}
|
|
1
|
+
{"version":3,"sources":["../../src/market-aim-v1-external-billing-event-external-billing.http.ts","../../src/market-aim-v1-external-billing-event-external-billing.types.ts","../../src/market-aim-v1-external-billing-event-external-billing.meta.ts"],"sourcesContent":["import { transformSDKTimestampToRESTTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressMarketAimApiExternalBillingBiServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/app-instance-manager-webapp',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/apps',\n destPath: '',\n },\n ],\n 'wixapis.com': [\n {\n srcPath: '/apps',\n destPath: '',\n },\n ],\n 'dev._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n {\n srcPath: '/api/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/api/v1/scripts',\n destPath: '/v1/scripts',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'editor._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'blocks._base_domain_': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n 'create.editorx': [\n {\n srcPath: '/_api/app-instance-manager',\n destPath: '',\n },\n ],\n '*.dev.wix-code.com': [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/devcenter/checkout/v1/checkout',\n destPath: '/v1/checkout',\n },\n {\n srcPath: '/devcenter/checkout/v1/metered-billing-charges',\n destPath: '/v1/metered-billing-charges',\n },\n ],\n _: [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\n },\n {\n srcPath: '/devcenter/checkout/v1/checkout',\n destPath: '/v1/checkout',\n },\n {\n srcPath: '/devcenter/checkout/v1/metered-billing-charges',\n destPath: '/v1/metered-billing-charges',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_app-management_external-billing';\n\n/**\n * Sends an external billing event to Wix.\n * Use this to report charges or refunds for your [Partner Billed App](https://dev.wix.com/docs/build-apps/launch-your-app/pricing-and-billing/partner-billed-apps-reporting).\n * The reported event enables Wix to track revenue, deductions, and Wix's share related to Partner Billed App charges.\n */\nexport function reportExternalBillingEvent(\n payload: object\n): RequestOptionsFactory<any> {\n function __reportExternalBillingEvent({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKTimestampToRESTTimestamp,\n paths: [{ path: 'event.createdDate' }],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.market.aim.v1.external_billing_event',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.market.aim.api.ExternalBillingBIService.ReportExternalBillingEvent',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixpressMarketAimApiExternalBillingBiServiceUrl({\n protoPath: '/v1/billing-event',\n data: serializedData,\n host,\n }),\n data: serializedData,\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [{ path: 'event.createdDate' }],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __reportExternalBillingEvent;\n}\n","export interface ExternalBillingEvent {\n /**\n * The app ID linked to this transaction. This field is only relevant if using an API key for authorization,\n * in which case you're required to pass the app ID.\n * @format GUID\n */\n appId?: string | null;\n /**\n * The app instance ID linked to this transaction. This field is only relevant if using an API key for authorization,\n * in which case you can optionally pass the instance ID.\n *\n * This connects the transaction to a specific instance of your app installed on a Wix site.\n * Learn more [about app instances](https://dev.wix.com/docs/build-apps/develop-your-app/access/app-instances/about-app-instances).\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * The total amount of the transaction in USD, not including tax.\n * This value can be negative for refunds or adjustments.\n *\n * Example: \"120.50\" for a $120.50 charge, or \"-120.50\" for a $120.50 refund.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:10 }\n */\n grossRevenue?: string;\n /**\n * The amount charged in USD minus agreed-upon expenses, such as shipping fees or\n * payment processing fees. Wix subtracts its share from this amount.\n * The value can be negative for refunds.\n *\n * Example calculation:\n * - Gross revenue: $120.50\n * - Minus expenses: $20.00 (shipping)\n * - Net revenue: $100.50\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:10 }\n */\n netRevenue?: string | null;\n /**\n * Wix's share of the transaction in USD, taken from the net revenue.\n * This value can be negative, such as for adjustments or refunds.\n *\n * Calculate based on your Partner Agreement terms. For example, if Wix's share is 20%:\n * - Net revenue: $100.50\n * - Wix share (20%): $20.10\n *\n * Important: Update this value if your revenue share percentage changes.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:10 }\n */\n wixShare?: string;\n /** The date and time of the transaction. */\n createdDate?: Date | null;\n /** The type of billing event, either charge or refund. */\n billingType?: BillingTypeWithLiterals;\n}\n\nexport enum BillingType {\n UNKNOWN = 'UNKNOWN',\n CHARGE = 'CHARGE',\n REFUND = 'REFUND',\n}\n\n/** @enumType */\nexport type BillingTypeWithLiterals =\n | BillingType\n | 'UNKNOWN'\n | 'CHARGE'\n | 'REFUND';\n\nexport interface ReportExternalBillingEventRequest {\n /**\n * The billing event with details of the external transaction, including the gross revenue,\n * net revenue, and billing type (charge or refund).\n */\n event?: ExternalBillingEvent;\n}\n\nexport interface ReportExternalBillingEventResponse {\n /** The billing event that was processed. */\n event?: ExternalBillingEvent;\n}\n\n/** @docsIgnore */\nexport type ReportExternalBillingEventApplicationErrors = {\n code?: 'FAILED_PRECONDITION';\n description?: string;\n data?: Record<string, any>;\n};\n","import * as ambassadorWixMarketAimV1ExternalBillingEvent from './market-aim-v1-external-billing-event-external-billing.http.js';\nimport * as ambassadorWixMarketAimV1ExternalBillingEventTypes from './market-aim-v1-external-billing-event-external-billing.types.js';\nimport * as ambassadorWixMarketAimV1ExternalBillingEventUniversalTypes from './market-aim-v1-external-billing-event-external-billing.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 reportExternalBillingEvent(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixMarketAimV1ExternalBillingEventUniversalTypes.ReportExternalBillingEventRequest,\n ambassadorWixMarketAimV1ExternalBillingEventTypes.ReportExternalBillingEventRequest,\n ambassadorWixMarketAimV1ExternalBillingEventUniversalTypes.ReportExternalBillingEventResponse,\n ambassadorWixMarketAimV1ExternalBillingEventTypes.ReportExternalBillingEventResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixMarketAimV1ExternalBillingEvent.reportExternalBillingEvent(\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/billing-event',\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 ExternalBillingEvent as ExternalBillingEventOriginal,\n BillingType as BillingTypeOriginal,\n BillingTypeWithLiterals as BillingTypeWithLiteralsOriginal,\n ReportExternalBillingEventRequest as ReportExternalBillingEventRequestOriginal,\n ReportExternalBillingEventResponse as ReportExternalBillingEventResponseOriginal,\n ReportExternalBillingEventApplicationErrors as ReportExternalBillingEventApplicationErrorsOriginal,\n} from './market-aim-v1-external-billing-event-external-billing.types.js';\n"],"mappings":";AAAA,SAAS,4CAA4C;AACrD,SAAS,4CAA4C;AACrD,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAI3B,SAAS,0DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,eAAe;AAAA,MACb;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;A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MACF,CAAC;AAAA,IACL;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;AC9FO,IAAK,cAAL,kBAAKC,iBAAL;AACL,EAAAA,aAAA,aAAU;AACV,EAAAA,aAAA,YAAS;AACT,EAAAA,aAAA,YAAS;AAHC,SAAAA;AAAA,GAAA;;;ACnCL,SAASC,8BAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBACyC;AAAA,IAC3C;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":["payload","BillingType","reportExternalBillingEvent"]}
|
|
@@ -106,6 +106,10 @@ function resolveComWixpressMarketAimApiExternalBillingBiServiceUrl(opts) {
|
|
|
106
106
|
{
|
|
107
107
|
srcPath: "/devcenter/checkout/v1/checkout",
|
|
108
108
|
destPath: "/v1/checkout"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
srcPath: "/devcenter/checkout/v1/metered-billing-charges",
|
|
112
|
+
destPath: "/v1/metered-billing-charges"
|
|
109
113
|
}
|
|
110
114
|
],
|
|
111
115
|
_: [
|
|
@@ -116,6 +120,10 @@ function resolveComWixpressMarketAimApiExternalBillingBiServiceUrl(opts) {
|
|
|
116
120
|
{
|
|
117
121
|
srcPath: "/devcenter/checkout/v1/checkout",
|
|
118
122
|
destPath: "/v1/checkout"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
srcPath: "/devcenter/checkout/v1/metered-billing-charges",
|
|
126
|
+
destPath: "/v1/metered-billing-charges"
|
|
119
127
|
}
|
|
120
128
|
]
|
|
121
129
|
};
|