@wix/auto_sdk_app-management_external-billing 1.0.21 → 1.0.24
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.d.ts +1 -1
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.typings.d.ts +17 -5
- package/build/cjs/index.typings.js.map +1 -1
- package/build/cjs/meta.d.ts +16 -4
- package/build/cjs/meta.js.map +1 -1
- package/build/es/index.d.mts +1 -1
- package/build/es/index.mjs.map +1 -1
- package/build/es/index.typings.d.mts +17 -5
- package/build/es/index.typings.mjs.map +1 -1
- package/build/es/meta.d.mts +16 -4
- package/build/es/meta.mjs.map +1 -1
- package/build/internal/cjs/index.d.ts +1 -1
- package/build/internal/cjs/index.js.map +1 -1
- package/build/internal/cjs/index.typings.d.ts +17 -5
- package/build/internal/cjs/index.typings.js.map +1 -1
- package/build/internal/cjs/meta.d.ts +16 -4
- package/build/internal/cjs/meta.js.map +1 -1
- package/build/internal/es/index.d.mts +1 -1
- package/build/internal/es/index.mjs.map +1 -1
- package/build/internal/es/index.typings.d.mts +17 -5
- package/build/internal/es/index.typings.mjs.map +1 -1
- package/build/internal/es/meta.d.mts +16 -4
- package/build/internal/es/meta.mjs.map +1 -1
- package/package.json +3 -3
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 _: [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\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, such as for adjustments or refunds.\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. Wix subtracts its share from this amount.\n * The value can be negative.\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 * Make sure to adjust the Wix share if it changes, for example after the first year of your partner agreement.\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;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1FO,IAAK,cAAL,kBAAKC,iBAAL;AACL,EAAAA,aAAA,aAAU;AACV,EAAAA,aAAA,YAAS;AACT,EAAAA,aAAA,YAAS;AAHC,SAAAA;AAAA,GAAA;;;ACvBL,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"]}
|
|
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 _: [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\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;A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AHC,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"]}
|
|
@@ -7,7 +7,7 @@ interface ReportExternalBillingEventSignature {
|
|
|
7
7
|
/**
|
|
8
8
|
* Sends an external billing event to Wix.
|
|
9
9
|
* 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).
|
|
10
|
-
* The reported event enables Wix to track revenue, deductions, and Wix's share related to
|
|
10
|
+
* The reported event enables Wix to track revenue, deductions, and Wix's share related to Partner Billed App charges.
|
|
11
11
|
*/
|
|
12
12
|
(options?: NonNullablePaths<ReportExternalBillingEventOptions, `event.billingType` | `event.grossRevenue` | `event.wixShare`, 3>): Promise<NonNullablePaths<ReportExternalBillingEventResponse, `event.grossRevenue` | `event.wixShare` | `event.billingType`, 3> & {
|
|
13
13
|
__applicationErrorsType?: ReportExternalBillingEventApplicationErrors;
|
|
@@ -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, such as for adjustments or refunds.\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. Wix subtracts its share from this amount.\n * The value can be negative.\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 * Make sure to adjust the Wix share if it changes, for example after the first year of your partner agreement.\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 _: [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\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,oC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S,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;;;AE3IO,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"]}
|
|
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 _: [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\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;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AM;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"]}
|
|
@@ -18,14 +18,22 @@ interface ExternalBillingEvent {
|
|
|
18
18
|
instanceId?: string | null;
|
|
19
19
|
/**
|
|
20
20
|
* The total amount of the transaction in USD, not including tax.
|
|
21
|
-
* This value can be negative
|
|
21
|
+
* This value can be negative for refunds or adjustments.
|
|
22
|
+
*
|
|
23
|
+
* Example: "120.50" for a $120.50 charge, or "-120.50" for a $120.50 refund.
|
|
22
24
|
* @format DECIMAL_VALUE
|
|
23
25
|
* @decimalValue options { maxScale:10 }
|
|
24
26
|
*/
|
|
25
27
|
grossRevenue?: string;
|
|
26
28
|
/**
|
|
27
|
-
* The amount charged in USD minus agreed-upon expenses, such as shipping fees
|
|
28
|
-
*
|
|
29
|
+
* The amount charged in USD minus agreed-upon expenses, such as shipping fees or
|
|
30
|
+
* payment processing fees. Wix subtracts its share from this amount.
|
|
31
|
+
* The value can be negative for refunds.
|
|
32
|
+
*
|
|
33
|
+
* Example calculation:
|
|
34
|
+
* - Gross revenue: $120.50
|
|
35
|
+
* - Minus expenses: $20.00 (shipping)
|
|
36
|
+
* - Net revenue: $100.50
|
|
29
37
|
* @format DECIMAL_VALUE
|
|
30
38
|
* @decimalValue options { maxScale:10 }
|
|
31
39
|
*/
|
|
@@ -34,7 +42,11 @@ interface ExternalBillingEvent {
|
|
|
34
42
|
* Wix's share of the transaction in USD, taken from the net revenue.
|
|
35
43
|
* This value can be negative, such as for adjustments or refunds.
|
|
36
44
|
*
|
|
37
|
-
*
|
|
45
|
+
* Calculate based on your Partner Agreement terms. For example, if Wix's share is 20%:
|
|
46
|
+
* - Net revenue: $100.50
|
|
47
|
+
* - Wix share (20%): $20.10
|
|
48
|
+
*
|
|
49
|
+
* Important: Update this value if your revenue share percentage changes.
|
|
38
50
|
* @format DECIMAL_VALUE
|
|
39
51
|
* @decimalValue options { maxScale:10 }
|
|
40
52
|
*/
|
|
@@ -71,7 +83,7 @@ type ReportExternalBillingEventApplicationErrors = {
|
|
|
71
83
|
/**
|
|
72
84
|
* Sends an external billing event to Wix.
|
|
73
85
|
* 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).
|
|
74
|
-
* The reported event enables Wix to track revenue, deductions, and Wix's share related to
|
|
86
|
+
* The reported event enables Wix to track revenue, deductions, and Wix's share related to Partner Billed App charges.
|
|
75
87
|
* @public
|
|
76
88
|
* @documentationMaturity preview
|
|
77
89
|
* @requiredField options.event.billingType
|
|
@@ -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, such as for adjustments or refunds.\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. Wix subtracts its share from this amount.\n * The value can be negative.\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 * Make sure to adjust the Wix share if it changes, for example after the first year of your partner agreement.\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 _: [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\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,MAC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,MACF,CAAC;AAAA,IACL;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ADlFO,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,cAAU,qEAAsC;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,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 _: [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\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;AAA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ACF;","names":["reportExternalBillingEvent","import_timestamp","payload","BillingType","reportExternalBillingEvent","sdkTransformError"]}
|
|
@@ -19,14 +19,22 @@ interface ExternalBillingEvent {
|
|
|
19
19
|
instanceId?: string | null;
|
|
20
20
|
/**
|
|
21
21
|
* The total amount of the transaction in USD, not including tax.
|
|
22
|
-
* This value can be negative
|
|
22
|
+
* This value can be negative for refunds or adjustments.
|
|
23
|
+
*
|
|
24
|
+
* Example: "120.50" for a $120.50 charge, or "-120.50" for a $120.50 refund.
|
|
23
25
|
* @format DECIMAL_VALUE
|
|
24
26
|
* @decimalValue options { maxScale:10 }
|
|
25
27
|
*/
|
|
26
28
|
grossRevenue?: string;
|
|
27
29
|
/**
|
|
28
|
-
* The amount charged in USD minus agreed-upon expenses, such as shipping fees
|
|
29
|
-
*
|
|
30
|
+
* The amount charged in USD minus agreed-upon expenses, such as shipping fees or
|
|
31
|
+
* payment processing fees. Wix subtracts its share from this amount.
|
|
32
|
+
* The value can be negative for refunds.
|
|
33
|
+
*
|
|
34
|
+
* Example calculation:
|
|
35
|
+
* - Gross revenue: $120.50
|
|
36
|
+
* - Minus expenses: $20.00 (shipping)
|
|
37
|
+
* - Net revenue: $100.50
|
|
30
38
|
* @format DECIMAL_VALUE
|
|
31
39
|
* @decimalValue options { maxScale:10 }
|
|
32
40
|
*/
|
|
@@ -35,7 +43,11 @@ interface ExternalBillingEvent {
|
|
|
35
43
|
* Wix's share of the transaction in USD, taken from the net revenue.
|
|
36
44
|
* This value can be negative, such as for adjustments or refunds.
|
|
37
45
|
*
|
|
38
|
-
*
|
|
46
|
+
* Calculate based on your Partner Agreement terms. For example, if Wix's share is 20%:
|
|
47
|
+
* - Net revenue: $100.50
|
|
48
|
+
* - Wix share (20%): $20.10
|
|
49
|
+
*
|
|
50
|
+
* Important: Update this value if your revenue share percentage changes.
|
|
39
51
|
* @format DECIMAL_VALUE
|
|
40
52
|
* @decimalValue options { maxScale:10 }
|
|
41
53
|
*/
|
|
@@ -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 _: [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\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, such as for adjustments or refunds.\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. Wix subtracts its share from this amount.\n * The value can be negative.\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 * Make sure to adjust the Wix share if it changes, for example after the first year of your partner agreement.\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,IAC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E,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;;;AC1FO,IAAK,cAAL,kBAAKC,iBAAL;AACL,EAAAA,aAAA,aAAU;AACV,EAAAA,aAAA,YAAS;AACT,EAAAA,aAAA,YAAS;AAHC,SAAAA;AAAA,GAAA;;;ACvBL,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 _: [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\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;A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Aa;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;;;AC9EO,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"]}
|
|
@@ -7,7 +7,7 @@ interface ReportExternalBillingEventSignature {
|
|
|
7
7
|
/**
|
|
8
8
|
* Sends an external billing event to Wix.
|
|
9
9
|
* 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).
|
|
10
|
-
* The reported event enables Wix to track revenue, deductions, and Wix's share related to
|
|
10
|
+
* The reported event enables Wix to track revenue, deductions, and Wix's share related to Partner Billed App charges.
|
|
11
11
|
*/
|
|
12
12
|
(options?: NonNullablePaths<ReportExternalBillingEventOptions, `event.billingType` | `event.grossRevenue` | `event.wixShare`, 3>): Promise<NonNullablePaths<ReportExternalBillingEventResponse, `event.grossRevenue` | `event.wixShare` | `event.billingType`, 3> & {
|
|
13
13
|
__applicationErrorsType?: ReportExternalBillingEventApplicationErrors;
|
|
@@ -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, such as for adjustments or refunds.\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. Wix subtracts its share from this amount.\n * The value can be negative.\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 * Make sure to adjust the Wix share if it changes, for example after the first year of your partner agreement.\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 _: [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\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,IAC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UACb,OAAO,CAAC,EAAE,MAAM,oBAAoB,CAAC;AAAA,QACvC;AAAA,MACF,CAAC;AAAA,IACL;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ADlFO,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;;;AE3IO,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 _: [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\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;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;AA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AM,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"]}
|
|
@@ -18,14 +18,22 @@ interface ExternalBillingEvent {
|
|
|
18
18
|
instanceId?: string | null;
|
|
19
19
|
/**
|
|
20
20
|
* The total amount of the transaction in USD, not including tax.
|
|
21
|
-
* This value can be negative
|
|
21
|
+
* This value can be negative for refunds or adjustments.
|
|
22
|
+
*
|
|
23
|
+
* Example: "120.50" for a $120.50 charge, or "-120.50" for a $120.50 refund.
|
|
22
24
|
* @format DECIMAL_VALUE
|
|
23
25
|
* @decimalValue options { maxScale:10 }
|
|
24
26
|
*/
|
|
25
27
|
grossRevenue?: string;
|
|
26
28
|
/**
|
|
27
|
-
* The amount charged in USD minus agreed-upon expenses, such as shipping fees
|
|
28
|
-
*
|
|
29
|
+
* The amount charged in USD minus agreed-upon expenses, such as shipping fees or
|
|
30
|
+
* payment processing fees. Wix subtracts its share from this amount.
|
|
31
|
+
* The value can be negative for refunds.
|
|
32
|
+
*
|
|
33
|
+
* Example calculation:
|
|
34
|
+
* - Gross revenue: $120.50
|
|
35
|
+
* - Minus expenses: $20.00 (shipping)
|
|
36
|
+
* - Net revenue: $100.50
|
|
29
37
|
* @format DECIMAL_VALUE
|
|
30
38
|
* @decimalValue options { maxScale:10 }
|
|
31
39
|
*/
|
|
@@ -34,7 +42,11 @@ interface ExternalBillingEvent {
|
|
|
34
42
|
* Wix's share of the transaction in USD, taken from the net revenue.
|
|
35
43
|
* This value can be negative, such as for adjustments or refunds.
|
|
36
44
|
*
|
|
37
|
-
*
|
|
45
|
+
* Calculate based on your Partner Agreement terms. For example, if Wix's share is 20%:
|
|
46
|
+
* - Net revenue: $100.50
|
|
47
|
+
* - Wix share (20%): $20.10
|
|
48
|
+
*
|
|
49
|
+
* Important: Update this value if your revenue share percentage changes.
|
|
38
50
|
* @format DECIMAL_VALUE
|
|
39
51
|
* @decimalValue options { maxScale:10 }
|
|
40
52
|
*/
|
|
@@ -71,7 +83,7 @@ type ReportExternalBillingEventApplicationErrors = {
|
|
|
71
83
|
/**
|
|
72
84
|
* Sends an external billing event to Wix.
|
|
73
85
|
* 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).
|
|
74
|
-
* The reported event enables Wix to track revenue, deductions, and Wix's share related to
|
|
86
|
+
* The reported event enables Wix to track revenue, deductions, and Wix's share related to Partner Billed App charges.
|
|
75
87
|
* @public
|
|
76
88
|
* @documentationMaturity preview
|
|
77
89
|
* @requiredField options.event.billingType
|
|
@@ -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, such as for adjustments or refunds.\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. Wix subtracts its share from this amount.\n * The value can be negative.\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 * Make sure to adjust the Wix share if it changes, for example after the first year of your partner agreement.\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 _: [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\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;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AY;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,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;;;ADlFO,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 _: [\n {\n srcPath: '/devcenter/app-instance/v1/instance',\n destPath: '/v1/instance',\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;AACp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