UNPKG

@maxio-com/advanced-billing-sdk

Version:

Ultimate billing and pricing flexibility for B2B SaaS. Maxio integrates directly into your product, so you can seamlessly manage your product catalog, bill customers, and collect payments.

197 lines 13.8 kB
"use strict"; /** * AdvancedBilling * * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). */ Object.defineProperty(exports, "__esModule", { value: true }); exports.SalesCommissionsController = void 0; var tslib_1 = require("tslib"); var core_js_1 = require("../core.js"); var listSaleRepItem_js_1 = require("../models/listSaleRepItem.js"); var saleRep_js_1 = require("../models/saleRep.js"); var saleRepSettings_js_1 = require("../models/saleRepSettings.js"); var schema_js_1 = require("../schema.js"); var baseController_js_1 = require("./baseController.js"); var SalesCommissionsController = /** @class */ (function (_super) { tslib_1.__extends(SalesCommissionsController, _super); function SalesCommissionsController() { return _super !== null && _super.apply(this, arguments) || this; } /** * Endpoint returns subscriptions with associated sales reps * * ## Modified Authentication Process * * The Sales Commission API differs from other Chargify API endpoints. This resource is associated with * the seller itself. Up to now all available resources were at the level of the site, therefore * creating the API Key per site was a sufficient solution. To share resources at the seller level, a * new authentication method was introduced, which is user authentication. Creating an API Key for a * user is a required step to correctly use the Sales Commission API, more details [here](https: * //developers.chargify.com/docs/developer-docs/ZG9jOjMyNzk5NTg0-2020-04-20-new-api-authentication). * * Access to the Sales Commission API endpoints is available to users with financial access, where the * seller has the Advanced Analytics component enabled. For further information on getting access to * Advanced Analytics contact Maxio support. * * > Note: The request is at seller level, it means `<<subdomain>>` variable will be replaced by `app` * * @param sellerId The Chargify id of your seller account * @param authorization For authorization use user API key. See details [here](https://developers. * chargify.com/docs/developer-docs/ZG9jOjMyNzk5NTg0-2020-04-20-new-api- * authentication). * @param liveMode This parameter indicates if records should be fetched from live mode sites. * Default value is true. * @param page Result records are organized in pages. By default, the first page of results is * displayed. The page parameter specifies a page number of results to fetch. You can * start navigating through the pages to consume the results. You do this by passing * in a page parameter. Retrieve the next page by adding ?page=2 to the query string. * If there are no results to return, then an empty result set will be returned. Use * in query `page=1`. * @param perPage This parameter indicates how many records to fetch in each request. Default value * is 100. * @return Response from the API call */ SalesCommissionsController.prototype.listSalesCommissionSettings = function (_a, requestOptions_1) { return tslib_1.__awaiter(this, arguments, void 0, function (_b, requestOptions) { var req, mapped; var sellerId = _b.sellerId, authorization = _b.authorization, liveMode = _b.liveMode, page = _b.page, perPage = _b.perPage; return tslib_1.__generator(this, function (_c) { req = this.createRequest('GET'); mapped = req.prepareArgs({ sellerId: [sellerId, (0, schema_js_1.string)()], authorization: [authorization, (0, schema_js_1.optional)((0, schema_js_1.string)())], liveMode: [liveMode, (0, schema_js_1.optional)((0, schema_js_1.boolean)())], page: [page, (0, schema_js_1.optional)((0, schema_js_1.number)())], perPage: [perPage, (0, schema_js_1.optional)((0, schema_js_1.number)())], }); req.header('Authorization', mapped.authorization); req.query('live_mode', mapped.liveMode, core_js_1.commaPrefix); req.query('page', mapped.page, core_js_1.commaPrefix); req.query('per_page', mapped.perPage, core_js_1.commaPrefix); req.appendTemplatePath(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["/sellers/", "/sales_commission_settings.json"], ["/sellers/", "/sales_commission_settings.json"])), mapped.sellerId); req.authenticate([{ basicAuth: true }]); return [2 /*return*/, req.callAsJson((0, schema_js_1.array)(saleRepSettings_js_1.saleRepSettingsSchema), requestOptions)]; }); }); }; /** * Endpoint returns sales rep list with details * * ## Modified Authentication Process * * The Sales Commission API differs from other Chargify API endpoints. This resource is associated with * the seller itself. Up to now all available resources were at the level of the site, therefore * creating the API Key per site was a sufficient solution. To share resources at the seller level, a * new authentication method was introduced, which is user authentication. Creating an API Key for a * user is a required step to correctly use the Sales Commission API, more details [here](https: * //developers.chargify.com/docs/developer-docs/ZG9jOjMyNzk5NTg0-2020-04-20-new-api-authentication). * * Access to the Sales Commission API endpoints is available to users with financial access, where the * seller has the Advanced Analytics component enabled. For further information on getting access to * Advanced Analytics contact Maxio support. * * > Note: The request is at seller level, it means `<<subdomain>>` variable will be replaced by `app` * * @param sellerId The Chargify id of your seller account * @param authorization For authorization use user API key. See details [here](https://developers. * chargify.com/docs/developer-docs/ZG9jOjMyNzk5NTg0-2020-04-20-new-api- * authentication). * @param liveMode This parameter indicates if records should be fetched from live mode sites. * Default value is true. * @param page Result records are organized in pages. By default, the first page of results is * displayed. The page parameter specifies a page number of results to fetch. You can * start navigating through the pages to consume the results. You do this by passing * in a page parameter. Retrieve the next page by adding ?page=2 to the query string. * If there are no results to return, then an empty result set will be returned. Use * in query `page=1`. * @param perPage This parameter indicates how many records to fetch in each request. Default value * is 100. * @return Response from the API call */ SalesCommissionsController.prototype.listSalesReps = function (_a, requestOptions_1) { return tslib_1.__awaiter(this, arguments, void 0, function (_b, requestOptions) { var req, mapped; var sellerId = _b.sellerId, authorization = _b.authorization, liveMode = _b.liveMode, page = _b.page, perPage = _b.perPage; return tslib_1.__generator(this, function (_c) { req = this.createRequest('GET'); mapped = req.prepareArgs({ sellerId: [sellerId, (0, schema_js_1.string)()], authorization: [authorization, (0, schema_js_1.optional)((0, schema_js_1.string)())], liveMode: [liveMode, (0, schema_js_1.optional)((0, schema_js_1.boolean)())], page: [page, (0, schema_js_1.optional)((0, schema_js_1.number)())], perPage: [perPage, (0, schema_js_1.optional)((0, schema_js_1.number)())], }); req.header('Authorization', mapped.authorization); req.query('live_mode', mapped.liveMode, core_js_1.commaPrefix); req.query('page', mapped.page, core_js_1.commaPrefix); req.query('per_page', mapped.perPage, core_js_1.commaPrefix); req.appendTemplatePath(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["/sellers/", "/sales_reps.json"], ["/sellers/", "/sales_reps.json"])), mapped.sellerId); req.authenticate([{ basicAuth: true }]); return [2 /*return*/, req.callAsJson((0, schema_js_1.array)(listSaleRepItem_js_1.listSaleRepItemSchema), requestOptions)]; }); }); }; /** * Endpoint returns sales rep and attached subscriptions details. * * ## Modified Authentication Process * * The Sales Commission API differs from other Chargify API endpoints. This resource is associated with * the seller itself. Up to now all available resources were at the level of the site, therefore * creating the API Key per site was a sufficient solution. To share resources at the seller level, a * new authentication method was introduced, which is user authentication. Creating an API Key for a * user is a required step to correctly use the Sales Commission API, more details [here](https: * //developers.chargify.com/docs/developer-docs/ZG9jOjMyNzk5NTg0-2020-04-20-new-api-authentication). * * Access to the Sales Commission API endpoints is available to users with financial access, where the * seller has the Advanced Analytics component enabled. For further information on getting access to * Advanced Analytics contact Maxio support. * * > Note: The request is at seller level, it means `<<subdomain>>` variable will be replaced by `app` * * @param sellerId The Chargify id of your seller account * @param salesRepId The Advanced Billing id of sales rep. * @param authorization For authorization use user API key. See details [here](https://developers. * chargify.com/docs/developer-docs/ZG9jOjMyNzk5NTg0-2020-04-20-new-api- * authentication). * @param liveMode This parameter indicates if records should be fetched from live mode sites. * Default value is true. * @param page Result records are organized in pages. By default, the first page of results is * displayed. The page parameter specifies a page number of results to fetch. You can * start navigating through the pages to consume the results. You do this by passing * in a page parameter. Retrieve the next page by adding ?page=2 to the query string. * If there are no results to return, then an empty result set will be returned. Use * in query `page=1`. * @param perPage This parameter indicates how many records to fetch in each request. Default value * is 100. * @return Response from the API call */ SalesCommissionsController.prototype.readSalesRep = function (sellerId, salesRepId, authorization, liveMode, page, perPage, requestOptions) { return tslib_1.__awaiter(this, void 0, void 0, function () { var req, mapped; return tslib_1.__generator(this, function (_a) { req = this.createRequest('GET'); mapped = req.prepareArgs({ sellerId: [sellerId, (0, schema_js_1.string)()], salesRepId: [salesRepId, (0, schema_js_1.string)()], authorization: [authorization, (0, schema_js_1.optional)((0, schema_js_1.string)())], liveMode: [liveMode, (0, schema_js_1.optional)((0, schema_js_1.boolean)())], page: [page, (0, schema_js_1.optional)((0, schema_js_1.number)())], perPage: [perPage, (0, schema_js_1.optional)((0, schema_js_1.number)())], }); req.header('Authorization', mapped.authorization); req.query('live_mode', mapped.liveMode, core_js_1.commaPrefix); req.query('page', mapped.page, core_js_1.commaPrefix); req.query('per_page', mapped.perPage, core_js_1.commaPrefix); req.appendTemplatePath(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["/sellers/", "/sales_reps/", ".json"], ["/sellers/", "/sales_reps/", ".json"])), mapped.sellerId, mapped.salesRepId); req.authenticate([{ basicAuth: true }]); return [2 /*return*/, req.callAsJson(saleRep_js_1.saleRepSchema, requestOptions)]; }); }); }; return SalesCommissionsController; }(baseController_js_1.BaseController)); exports.SalesCommissionsController = SalesCommissionsController; var templateObject_1, templateObject_2, templateObject_3; //# sourceMappingURL=salesCommissionsController.js.map