UNPKG

card-management-sdk

Version:

The Shell Card Management API is REST-based and employs OAUTH 2.0,Basic and ApiKey authentication. The API endpoints accept JSON-encoded request bodies, return JSON-encoded responses and use standard HTTP response codes. All resources are located in the S

508 lines 32.7 kB
"use strict"; /** * Shell Card Management APIsLib * * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). */ Object.defineProperty(exports, "__esModule", { value: true }); exports.RestrictionController = void 0; var tslib_1 = require("tslib"); var accountRestrictionRequest_js_1 = require("../models/accountRestrictionRequest.js"); var accountRestrictionRes_js_1 = require("../models/accountRestrictionRes.js"); var budleDetailsReq_js_1 = require("../models/budleDetailsReq.js"); var bundleDetails_js_1 = require("../models/bundleDetails.js"); var cardRestrictionReq_js_1 = require("../models/cardRestrictionReq.js"); var cardRestrictionRes_js_1 = require("../models/cardRestrictionRes.js"); var createBundleRequest_js_1 = require("../models/createBundleRequest.js"); var createBundleRes_js_1 = require("../models/createBundleRes.js"); var deleteBundleRequest_js_1 = require("../models/deleteBundleRequest.js"); var deleteBundleResponse_js_1 = require("../models/deleteBundleResponse.js"); var searchAccountLimitRequest_js_1 = require("../models/searchAccountLimitRequest.js"); var searchAccountLimitRes_js_1 = require("../models/searchAccountLimitRes.js"); var searchCardRestrictionReq1_js_1 = require("../models/searchCardRestrictionReq1.js"); var searchCardRestrictionRes1_js_1 = require("../models/searchCardRestrictionRes1.js"); var summaryofbundleRes_js_1 = require("../models/summaryofbundleRes.js"); var summaryofbundlerRequest_js_1 = require("../models/summaryofbundlerRequest.js"); var updateBundleRequest_js_1 = require("../models/updateBundleRequest.js"); var updateBundleRes_js_1 = require("../models/updateBundleRes.js"); var schema_js_1 = require("../schema.js"); var baseController_js_1 = require("./baseController.js"); var errorObjectError_js_1 = require("../errors/errorObjectError.js"); var RestrictionController = /** @class */ (function (_super) { tslib_1.__extends(RestrictionController, _super); function RestrictionController() { return _super !== null && _super.apply(this, arguments) || this; } /** * This API will allows querying card details including the day/time and product restrictions. * #### Supported operations * * * Search by list of cards or bundle * * * Include card bundle details (optional) * * * * @param requestId Mandatory UUID (according to RFC 4122 standards) for * requests and responses. This will be played back in the * response from the request. * @param body Restriction search card request body * @return Response from the API call */ RestrictionController.prototype.searchCardRestriction = function (requestId, body, requestOptions) { return tslib_1.__awaiter(this, void 0, void 0, function () { var req, mapped; return tslib_1.__generator(this, function (_a) { req = this.createRequest('POST', '/card-restrictions/v1/search'); mapped = req.prepareArgs({ requestId: [requestId, (0, schema_js_1.string)()], body: [body, (0, schema_js_1.optional)(searchCardRestrictionReq1_js_1.searchCardRestrictionReq1Schema)], }); req.header('RequestId', mapped.requestId); req.header('Content-Type', 'application/json'); req.json(mapped.body); req.throwOn(400, errorObjectError_js_1.ErrorObjectError, 'The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).'); req.throwOn(401, errorObjectError_js_1.ErrorObjectError, 'The request has not been applied because it lacks valid authentication credentials for the target resource.'); req.throwOn(403, errorObjectError_js_1.ErrorObjectError, 'Forbidden'); req.throwOn(404, errorObjectError_js_1.ErrorObjectError, 'The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.'); req.throwOn(500, errorObjectError_js_1.ErrorObjectError, 'The server encountered an unexpected condition that prevented it from fulfilling the request.'); req.authenticate([{ bearerToken: true }]); return [2 /*return*/, req.callAsJson(searchCardRestrictionRes1_js_1.searchCardRestrictionRes1Schema, requestOptions)]; }); }); }; /** * The Card Limit and Restriction API is REST-based and employs Basic and ApiKey authentication. The * API endpoints accept JSON-encoded request bodies, return JSON-encoded responses and use standard * HTTP response codes. * * * * All resources are located in the Shell Card Platform. The Shell Card Platform is the overall * platform that encompasses all the internal Shell systems used to manage resources. The internal * workings of the platform are not important when interacting with the API. However, it is worth * noting that the platform uses to communicate with various backend systems and some API calls are * processed asynchronously. * * * * All endpoints use the `POST` verb for retrieving, updating, creating and deleting resources in the * Shell Card Platform. The endpoints that retrieve resources from the Shell Card Platform allow * flexible search parameters in the API request body. * * * * **Important Note** - This operation allows setting or updating the restrictions on existing cards. * (For up to 3 cards in a single call). * * * * All restrictions of the cards are submitted and executed after successful below condition. * * • The card exists. * * • Day time restriction cannot be set to restrict the use of a card on all days of the week i.e., * the values for all the days in the restriction cannot be set to false. * * • Either of the usage, daytime, location or product restriction ‘Reset’ is set to ‘True’ or * applied on the card. * * • All the limits in the usage restriction profile for a card is not set to ‘0’/null. * * • If IsVelocityCeiling is ‘true’, API will validate below condition: * * Usage restrictions for a card are lower than Customer Card Type level limits, if there are no * customer level overrides available then lower than OU card type limits. * * • In usage restrictions, the limits per transaction should be less than or equal to Daily, Daily * should be less than or equal to Weekly, Weekly should be less than or equal to Monthly, Monthly * should be less than or equal to Yearly (Annually). Exception being null/blank will be skipped. i.e., * Daily value should be less than equal to Monthly value if Weekly value is null/blank. Lifetime limit * is not considered for usage restrictions limits validation. * * • Apply the card type limit to Gateway when a value is NULL in the input. However, if the card * type limit is NULL for the same field, then no limit will be applied in Gateway. * * • If ‘SetDefaultOnVelocityUpdate’ is ‘true’ then the operation will apply customer cardtype or OU * level velocity limits on existing cards when restrictions are modified without providing custom * values for all fields. * * * * @param requestId Mandatory UUID (according to RFC 4122 standards) for requests * and responses. This will be played back in the response from the * request. * @param body Card Restriction request body * @return Response from the API call */ RestrictionController.prototype.applyRestriction = function (requestId, body, requestOptions) { return tslib_1.__awaiter(this, void 0, void 0, function () { var req, mapped; return tslib_1.__generator(this, function (_a) { req = this.createRequest('POST', '/card-restrictions/v1/update'); mapped = req.prepareArgs({ requestId: [requestId, (0, schema_js_1.string)()], body: [body, (0, schema_js_1.optional)(cardRestrictionReq_js_1.cardRestrictionReqSchema)], }); req.header('RequestId', mapped.requestId); req.header('Content-Type', 'application/json'); req.json(mapped.body); req.throwOn(400, errorObjectError_js_1.ErrorObjectError, 'The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).'); req.throwOn(401, errorObjectError_js_1.ErrorObjectError, 'The request has not been applied because it lacks valid authentication credentials for the target resource.'); req.throwOn(403, errorObjectError_js_1.ErrorObjectError, 'Forbidden'); req.throwOn(404, errorObjectError_js_1.ErrorObjectError, 'The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.'); req.throwOn(500, errorObjectError_js_1.ErrorObjectError, 'The server encountered an unexpected condition that prevented it from fulfilling the request.'); req.authenticate([{ bearerToken: true }]); return [2 /*return*/, req.callAsJson(cardRestrictionRes_js_1.cardRestrictionResSchema, requestOptions)]; }); }); }; /** * This API enables clients to create a new card bundle and apply restrictions. * * #### Supported operations * * * Create bundle and include mandatory - * * * Usage, day/time, product and location restrictions * * * List of cards to add to bundle * * * Create bundle and include optional identifier of bundle in external system * * #### Validation rules * * The following are the key validation rules with the associated error codes for failed validation- * * * `7012` - At least one card must be added to the bundle * * * `7011` - The total number of cards passed in the input must be 500 or less. * * * `7014` - All the cards passed in the input are part of the selected account. * * * `7013` - At least one restriction must be applied to the bundle i.e. either of usage, day/time, * location or product restriction. * * * `7005` - Day time restriction cannot be set to restrict the use of a card on all days of the * week. * * * `7000` - Usage restriction of the bundle is not open ended i.e. all the limits within the usage * restriction must not be set to 0/null. * * * `7004` - In the usage restrictions, the limits per transaction should be less than or equal to * Daily, Daily should be less than or equal to Weekly, Weekly should be less than or equal to Monthly. * Exception being 0/blank will be skipped, i.e. Daily value should be less than equal to Monthly value * if Weekly value is 0/blank. * * * `0007` - Error returned if request parameters fail validation e.g. mandatory check. * * @param requestId Mandatory UUID (according to RFC 4122 standards) for requests * and responses. This will be played back in the response from the * request. * @param body CreateBundle request body * @return Response from the API call */ RestrictionController.prototype.createBundle = function (requestId, body, requestOptions) { return tslib_1.__awaiter(this, void 0, void 0, function () { var req, mapped; return tslib_1.__generator(this, function (_a) { req = this.createRequest('POST', '/card-restrictions/v1/createbundle'); mapped = req.prepareArgs({ requestId: [requestId, (0, schema_js_1.string)()], body: [body, (0, schema_js_1.optional)(createBundleRequest_js_1.createBundleRequestSchema)], }); req.header('RequestId', mapped.requestId); req.header('Content-Type', 'application/json'); req.json(mapped.body); req.throwOn(400, errorObjectError_js_1.ErrorObjectError, 'The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).'); req.throwOn(401, errorObjectError_js_1.ErrorObjectError, 'The request has not been applied because it lacks valid authentication credentials for the target resource.'); req.throwOn(403, errorObjectError_js_1.ErrorObjectError, 'Forbidden'); req.throwOn(404, errorObjectError_js_1.ErrorObjectError, 'The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.'); req.throwOn(500, errorObjectError_js_1.ErrorObjectError, 'The server encountered an unexpected condition that prevented it from fulfilling the request.'); req.authenticate([{ bearerToken: true }]); return [2 /*return*/, req.callAsJson(createBundleRes_js_1.createBundleResSchema, requestOptions)]; }); }); }; /** * This API enables clients to update an existing card bundle and its associated restrictions. * * #### Supported operations * * * Add new cards to an existing bundle * * * Remove cards from existing bundle * * * Update restrictions applied to existing bundle * * * * The following are the key validation rules with the associated error codes for failed validation- * * * #### Validation rules * * * `9007` - The cards must exist in the cards platform for adding or removing cards. * * * `7014` - All the cards passed in the input are part of the selected account. * * * `7018` - All the cards passed in the input are part of the selected bundle. * * * `7011` - The total number of cards passed in the input must be 500 or less. * * * `7012` - The action to remove cards should not result in removing all the cards from the bundle. * * * `7016` - At least one restriction must be modified for “Update†request action. * * * `7013` - All restrictions cannot be marked for “Reset†for “Update†request action. * * * `7005` - Day time restriction cannot be set to restrict the use of a card on all days of the * week. This validation is applicable for Update request action. * * * `7000` - Usage restriction of the bundle is not open ended i.e., all the limits within the * usage restriction must not be set to 0/null. This validation is applicable for Update request action. * * * `7004` - In the usage restrictions, the limits per transaction should be less than or equal to * Daily, Daily should be less than or equal to Weekly, Weekly should be less than or equal to Monthly. * Exception being 0/blank will be skipped, i.e., Daily value should be less than equal to Monthly * value if Weekly value is 0/blank. This validation is applicable for Update request action. * * * `0007` - Error returned if request parameters fail validation e.g. at least one card must be * provided in the input. * * @param requestId Mandatory UUID (according to RFC 4122 standards) for requests * and responses. This will be played back in the response from the * request. * @param body Update Bundle request body * @return Response from the API call */ RestrictionController.prototype.updateBundle = function (requestId, body, requestOptions) { return tslib_1.__awaiter(this, void 0, void 0, function () { var req, mapped; return tslib_1.__generator(this, function (_a) { req = this.createRequest('POST', '/card-restrictions/v1/updatebundle'); mapped = req.prepareArgs({ requestId: [requestId, (0, schema_js_1.string)()], body: [body, (0, schema_js_1.optional)(updateBundleRequest_js_1.updateBundleRequestSchema)], }); req.header('RequestId', mapped.requestId); req.header('Content-Type', 'application/json'); req.json(mapped.body); req.throwOn(400, errorObjectError_js_1.ErrorObjectError, 'The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).'); req.throwOn(401, errorObjectError_js_1.ErrorObjectError, 'The request has not been applied because it lacks valid authentication credentials for the target resource.'); req.throwOn(403, errorObjectError_js_1.ErrorObjectError, 'Forbidden'); req.throwOn(404, errorObjectError_js_1.ErrorObjectError, 'The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.'); req.throwOn(500, errorObjectError_js_1.ErrorObjectError, 'The server encountered an unexpected condition that prevented it from fulfilling the request.'); req.authenticate([{ bearerToken: true }]); return [2 /*return*/, req.callAsJson(updateBundleRes_js_1.updateBundleResSchema, requestOptions)]; }); }); }; /** * This API enables clients to delete an existing card bundle in the Shell Card Platform. Once the card * bundle is deleted the usage and product restrictions of the cards that were present in the bundle * will be reset based on the request. * * #### Supported operations * * * Delete card bundle by bundle Id * * #### Validation rules * * The following are the key validation rules with the associated error codes for failed validation- * * * `7019` - The given card bundle is not available in the Shell Card Platform. * * * `0007` - Error returned if request parameters fail validation e.g. mandatory check. * * @param requestId Mandatory UUID (according to RFC 4122 standards) for requests * and responses. This will be played back in the response from the * request. * @param body Update Bundle request body * @return Response from the API call */ RestrictionController.prototype.deleteBundle = function (requestId, body, requestOptions) { return tslib_1.__awaiter(this, void 0, void 0, function () { var req, mapped; return tslib_1.__generator(this, function (_a) { req = this.createRequest('POST', '/card-restrictions/v1/deletebundle'); mapped = req.prepareArgs({ requestId: [requestId, (0, schema_js_1.string)()], body: [body, (0, schema_js_1.optional)(deleteBundleRequest_js_1.deleteBundleRequestSchema)], }); req.header('RequestId', mapped.requestId); req.header('Content-Type', 'application/json'); req.json(mapped.body); req.throwOn(400, errorObjectError_js_1.ErrorObjectError, 'The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).'); req.throwOn(401, errorObjectError_js_1.ErrorObjectError, 'The request has not been applied because it lacks valid authentication credentials for the target resource.'); req.throwOn(403, errorObjectError_js_1.ErrorObjectError, 'Forbidden'); req.throwOn(404, errorObjectError_js_1.ErrorObjectError, 'The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.'); req.throwOn(500, errorObjectError_js_1.ErrorObjectError, 'The server encountered an unexpected condition that prevented it from fulfilling the request.'); req.authenticate([{ bearerToken: true }]); return [2 /*return*/, req.callAsJson(deleteBundleResponse_js_1.deleteBundleResponseSchema, requestOptions)]; }); }); }; /** * This API allows clients to get a summary of card bundles associated with Payer/Account. This API * will return the basic bundle details including card and restriction details. Optionally the API will * also include a count of cards that are not associated with the bundle but returned by the search * criteria. * * * Note - to include count of cards of an account that are not associated with any bundles, in the * input parameter SearchCardBundles either pass all the bundles of the account in the list or pass * only account with bundle id left blank/null. * * * #### Supported operations * * * Get summary of bundles by list of bundle Ids * * @param requestId Mandatory UUID (according to RFC 4122 standards) for * requests and responses. This will be played back in the * response from the request. * @param body Summary of Bundle request body * @return Response from the API call */ RestrictionController.prototype.summaryOfBundles = function (requestId, body, requestOptions) { return tslib_1.__awaiter(this, void 0, void 0, function () { var req, mapped; return tslib_1.__generator(this, function (_a) { req = this.createRequest('POST', '/card-restrictions/v1/summaryofbundles'); mapped = req.prepareArgs({ requestId: [requestId, (0, schema_js_1.string)()], body: [body, (0, schema_js_1.optional)(summaryofbundlerRequest_js_1.summaryofbundlerRequestSchema)], }); req.header('RequestId', mapped.requestId); req.header('Content-Type', 'application/json'); req.json(mapped.body); req.throwOn(400, errorObjectError_js_1.ErrorObjectError, 'The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).'); req.throwOn(401, errorObjectError_js_1.ErrorObjectError, 'The request has not been applied because it lacks valid authentication credentials for the target resource.'); req.throwOn(403, errorObjectError_js_1.ErrorObjectError, 'Forbidden'); req.throwOn(404, errorObjectError_js_1.ErrorObjectError, 'The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.'); req.throwOn(500, errorObjectError_js_1.ErrorObjectError, 'The server encountered an unexpected condition that prevented it from fulfilling the request.'); req.authenticate([{ bearerToken: true }]); return [2 /*return*/, req.callAsJson(summaryofbundleRes_js_1.summaryofbundleResSchema, requestOptions)]; }); }); }; /** * This API allows setting or updating the usage restrictions of an existing account. * * * * Then validation rules applied for this API. * * * * • The account exists. * * • Day time restriction cannot be set to restrict the use of a card, under the account, on all * days of the week. * * • Either of the usage, daytime or location is either marked for reset or new restriction values * provided for the account. * * • In usage restrictions, the limits per transaction should be less than or equal to Daily, Daily * should be less than or equal to Weekly, Weekly should be less than or equal to Monthly. Exception * being 0/blank will be skipped, i.e., Daily value should be less than equal to Monthly value if * Weekly value is 0/blank. * * * * @param requestId Mandatory UUID (according to RFC 4122 standards) for * requests and responses. This will be played back in the * response from the request. * @param body Account Restriction request body * @return Response from the API call */ RestrictionController.prototype.restrictionAccount = function (requestId, body, requestOptions) { return tslib_1.__awaiter(this, void 0, void 0, function () { var req, mapped; return tslib_1.__generator(this, function (_a) { req = this.createRequest('POST', '/card-restrictions/v1/account'); mapped = req.prepareArgs({ requestId: [requestId, (0, schema_js_1.string)()], body: [body, (0, schema_js_1.optional)(accountRestrictionRequest_js_1.accountRestrictionRequestSchema)], }); req.header('RequestId', mapped.requestId); req.header('Content-Type', 'application/json'); req.json(mapped.body); req.throwOn(400, errorObjectError_js_1.ErrorObjectError, 'The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).'); req.throwOn(401, errorObjectError_js_1.ErrorObjectError, 'The request has not been applied because it lacks valid authentication credentials for the target resource.'); req.throwOn(403, errorObjectError_js_1.ErrorObjectError, 'Forbidden'); req.throwOn(404, errorObjectError_js_1.ErrorObjectError, 'The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.'); req.throwOn(500, errorObjectError_js_1.ErrorObjectError, 'The server encountered an unexpected condition that prevented it from fulfilling the request.'); req.authenticate([{ bearerToken: true }]); return [2 /*return*/, req.callAsJson(accountRestrictionRes_js_1.accountRestrictionResSchema, requestOptions)]; }); }); }; /** * This API will allow user to get account level limits for the given account. It returns the velocity * limits if its overridden at the account else the values will be null/empty. * * @param requestId Mandatory UUID (according to RFC 4122 standards) for * requests and responses. This will be played back in the * response from the request. * @param body Search Account Limit RequestBody * @return Response from the API call */ RestrictionController.prototype.searchAccountLimit = function (requestId, body, requestOptions) { return tslib_1.__awaiter(this, void 0, void 0, function () { var req, mapped; return tslib_1.__generator(this, function (_a) { req = this.createRequest('POST', '/card-restrictions/v1/searchaccountlimit'); mapped = req.prepareArgs({ requestId: [requestId, (0, schema_js_1.string)()], body: [body, (0, schema_js_1.optional)(searchAccountLimitRequest_js_1.searchAccountLimitRequestSchema)], }); req.header('RequestId', mapped.requestId); req.header('Content-Type', 'application/json'); req.json(mapped.body); req.throwOn(400, errorObjectError_js_1.ErrorObjectError, 'The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).'); req.throwOn(401, errorObjectError_js_1.ErrorObjectError, 'The request has not been applied because it lacks valid authentication credentials for the target resource.'); req.throwOn(403, errorObjectError_js_1.ErrorObjectError, 'Forbidden'); req.throwOn(404, errorObjectError_js_1.ErrorObjectError, 'The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.'); req.throwOn(500, errorObjectError_js_1.ErrorObjectError, 'The server encountered an unexpected condition that prevented it from fulfilling the request.'); req.authenticate([{ bearerToken: true }]); return [2 /*return*/, req.callAsJson(searchAccountLimitRes_js_1.searchAccountLimitResSchema, requestOptions)]; }); }); }; /** * This API allows to get the details of a specific card bundle. It returns the bundle basic details * along with the cards in the bundle and restrictions applied on them. * * @param requestId Mandatory UUID (according to RFC 4122 standards) for requests and * responses. This will be played back in the response from the request. * @param body Bundle Details Request body * @return Response from the API call */ RestrictionController.prototype.bundleDetails = function (requestId, body, requestOptions) { return tslib_1.__awaiter(this, void 0, void 0, function () { var req, mapped; return tslib_1.__generator(this, function (_a) { req = this.createRequest('POST', '/card-restrictions/v1/bundledetails'); mapped = req.prepareArgs({ requestId: [requestId, (0, schema_js_1.string)()], body: [body, (0, schema_js_1.optional)(budleDetailsReq_js_1.budleDetailsReqSchema)], }); req.header('RequestId', mapped.requestId); req.header('Content-Type', 'application/json'); req.json(mapped.body); req.throwOn(400, errorObjectError_js_1.ErrorObjectError, 'The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).'); req.throwOn(401, errorObjectError_js_1.ErrorObjectError, 'The request has not been applied because it lacks valid authentication credentials for the target resource.'); req.throwOn(403, errorObjectError_js_1.ErrorObjectError, 'Forbidden'); req.throwOn(404, errorObjectError_js_1.ErrorObjectError, 'The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.'); req.throwOn(500, errorObjectError_js_1.ErrorObjectError, 'The server encountered an unexpected condition that prevented it from fulfilling the request.'); req.authenticate([{ bearerToken: true }]); return [2 /*return*/, req.callAsJson(bundleDetails_js_1.bundleDetailsSchema, requestOptions)]; }); }); }; return RestrictionController; }(baseController_js_1.BaseController)); exports.RestrictionController = RestrictionController; //# sourceMappingURL=restrictionController.js.map