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

485 lines 30.2 kB
"use strict"; /** * Shell Card Management APIsLib * * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). */ exports.__esModule = true; exports.CustomerController = void 0; var tslib_1 = require("tslib"); var accountRequest_1 = require("../models/accountRequest"); var accountResponse_1 = require("../models/accountResponse"); var auditRequest_1 = require("../models/auditRequest"); var auditResponse_1 = require("../models/auditResponse"); var cardGroupRequest_1 = require("../models/cardGroupRequest"); var cardGroupResponse_1 = require("../models/cardGroupResponse"); var cardTypeRequest_1 = require("../models/cardTypeRequest"); var cardTypeResponse_1 = require("../models/cardTypeResponse"); var createCardGroupRequest_1 = require("../models/createCardGroupRequest"); var createCardGroupResponse_1 = require("../models/createCardGroupResponse"); var customerDetailRequest_1 = require("../models/customerDetailRequest"); var customerDetailResponse_1 = require("../models/customerDetailResponse"); var fleetmanagementV1UserLoggedinuserRequest_1 = require("../models/fleetmanagementV1UserLoggedinuserRequest"); var loggedInUserResponse_1 = require("../models/loggedInUserResponse"); var payerRequest_1 = require("../models/payerRequest"); var payerResponse_1 = require("../models/payerResponse"); var updateCardGroupRequest_1 = require("../models/updateCardGroupRequest"); var updateCardGroupResponse_1 = require("../models/updateCardGroupResponse"); var schema_1 = require("../schema"); var baseController_1 = require("./baseController"); var core_1 = require("@apimatic/core"); var fleetmanagementV1CustomerCustomer403Error_1 = require("../errors/fleetmanagementV1CustomerCustomer403Error"); var fleetmanagementV1CustomerPayers400Error_1 = require("../errors/fleetmanagementV1CustomerPayers400Error"); var fleetmanagementV1CustomerPayers404Error_1 = require("../errors/fleetmanagementV1CustomerPayers404Error"); var fleetmanagementV1UserLoggedinuser400Error_1 = require("../errors/fleetmanagementV1UserLoggedinuser400Error"); var fleetmanagementV1UserLoggedinuser401Error_1 = require("../errors/fleetmanagementV1UserLoggedinuser401Error"); var fleetmanagementV1UserLoggedinuser403Error_1 = require("../errors/fleetmanagementV1UserLoggedinuser403Error"); var fleetmanagementV1UserLoggedinuser404Error_1 = require("../errors/fleetmanagementV1UserLoggedinuser404Error"); var fleetmanagementV1UserLoggedinuser500Error_1 = require("../errors/fleetmanagementV1UserLoggedinuser500Error"); var CustomerController = /** @class */ (function (_super) { tslib_1.__extends(CustomerController, _super); function CustomerController() { return _super !== null && _super.apply(this, arguments) || this; } /** * This API allows querying the user data of the logged in user.</br> * This API will return the user access details such as payers and/or accounts. </br> * This API will also validate that logged in user has access to the requested API, on failure it will * return HasAPIAccess flag as false in response.</br> * * @param apikey This is the API key of the specific * environment which needs to be passed by the * client. * @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 Logged in user request body * @return Response from the API call */ CustomerController.prototype.loggedinUser = function (apikey, 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', '/fleetmanagement/v1/user/loggedinuser'); mapped = req.prepareArgs({ apikey: [apikey, (0, schema_1.string)()], requestId: [requestId, (0, schema_1.string)()], body: [body, (0, schema_1.optional)(fleetmanagementV1UserLoggedinuserRequest_1.fleetmanagementV1UserLoggedinuserRequestSchema)] }); req.header('apikey', mapped.apikey); req.header('RequestId', mapped.requestId); req.header('Content-Type', 'application/json'); req.json(mapped.body); req.throwOn(400, fleetmanagementV1UserLoggedinuser400Error_1.FleetmanagementV1UserLoggedinuser400Error, 'The server cannot or will not process the request due to something that is perceived to be a client\r\n error (e.g., malformed request syntax, invalid \r\n request message framing, or deceptive request routing).'); req.throwOn(401, fleetmanagementV1UserLoggedinuser401Error_1.FleetmanagementV1UserLoggedinuser401Error, 'The request has not been applied because it lacks valid authentication credentials for the target resource.'); req.throwOn(403, fleetmanagementV1UserLoggedinuser403Error_1.FleetmanagementV1UserLoggedinuser403Error, 'The server understood the request but refuses to authorize it.'); req.throwOn(404, fleetmanagementV1UserLoggedinuser404Error_1.FleetmanagementV1UserLoggedinuser404Error, '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, fleetmanagementV1UserLoggedinuser500Error_1.FleetmanagementV1UserLoggedinuser500Error, 'The server encountered an unexpected condition the prevented it from fulfilling the request.'); req.authenticate([{ basicAuth: true }]); return [2 /*return*/, req.callAsJson(loggedInUserResponse_1.loggedInUserResponseSchema, requestOptions)]; }); }); }; /** * This API allows querying the payer accounts details from the Shell Cards * * Platform. It provides flexible search criteria for searching payer * * information and supports paging. * * * * Paging is applicable only when all the * * payers passed in the input are from the same ColCo. * * * * However, paging will * * be ignored and the API will return all the matching data by merging the * * data queried from each ColCo when payers passed in the input are from * * multiple ColCos. * * * * @param apikey This is the API key of the specific environment which needs to be * passed by the client. * @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 Serach payers request body * @return Response from the API call */ CustomerController.prototype.payers = function (apikey, 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', '/fleetmanagement/v1/customer/payers'); mapped = req.prepareArgs({ apikey: [apikey, (0, schema_1.string)()], requestId: [requestId, (0, schema_1.string)()], body: [body, (0, schema_1.optional)(payerRequest_1.payerRequestSchema)] }); req.header('apikey', mapped.apikey); req.header('RequestId', mapped.requestId); req.header('Content-Type', 'application/json'); req.json(mapped.body); req.throwOn(400, fleetmanagementV1CustomerPayers400Error_1.FleetmanagementV1CustomerPayers400Error, 'The server cannot or will not process the request due to something that is perceived to be a client\r\n error (e.g., malformed request syntax, invalid \r\n request message framing, or deceptive request routing).'); req.throwOn(401, core_1.ApiError, 'The request has not been applied because it lacks valid authentication credentials for the target resource.'); req.throwOn(403, core_1.ApiError, 'The server understood the request but refuses to authorize it.'); req.throwOn(404, fleetmanagementV1CustomerPayers404Error_1.FleetmanagementV1CustomerPayers404Error, '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, core_1.ApiError, 'The server encountered an unexpected condition the prevented it from fulfilling the request.'); req.authenticate([{ basicAuth: true }]); return [2 /*return*/, req.callAsJson(payerResponse_1.payerResponseSchema, requestOptions)]; }); }); }; /** * This API allows querying the card delivery addresses of a given account from the Shell Cards * Platform. * * Only active delivery addresses will be returned. * * * * @param apikey This is the API key of the specific environment which needs * to be passed by the client. * @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 Customerdetails request body * @return Response from the API call */ CustomerController.prototype.customer = function (apikey, 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', '/fleetmanagement/v1/customer/customer'); mapped = req.prepareArgs({ apikey: [apikey, (0, schema_1.string)()], requestId: [requestId, (0, schema_1.string)()], body: [body, (0, schema_1.optional)(customerDetailRequest_1.customerDetailRequestSchema)] }); req.header('apikey', mapped.apikey); req.header('RequestId', mapped.requestId); req.header('Content-Type', 'application/json'); req.json(mapped.body); req.throwOn(400, core_1.ApiError, 'The server cannot or will not process the request due to something that is perceived to be a client\r\n error (e.g., malformed request syntax, invalid \r\n request message framing, or deceptive request routing).'); req.throwOn(401, core_1.ApiError, 'The request has not been applied because it lacks valid authentication credentials for the target resource.'); req.throwOn(403, fleetmanagementV1CustomerCustomer403Error_1.FleetmanagementV1CustomerCustomer403Error, 'The server understood the request but refuses to authorize it.'); req.throwOn(404, core_1.ApiError, '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, core_1.ApiError, 'The server encountered an unexpected condition the prevented it from fulfilling the request.'); req.authenticate([{ basicAuth: true }]); return [2 /*return*/, req.callAsJson(customerDetailResponse_1.customerDetailResponseSchema, requestOptions)]; }); }); }; /** * This API allows querying the customer account details from the Shell Cards Platform. * * It provides a flexible search criterion and supports paging". * * @param apikey This is the API key of the specific environment which needs to be * passed by the client. * @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 * @return Response from the API call */ CustomerController.prototype.accounts = function (apikey, 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', '/fleetmanagement/v1/customer/accounts'); mapped = req.prepareArgs({ apikey: [apikey, (0, schema_1.string)()], requestId: [requestId, (0, schema_1.string)()], body: [body, (0, schema_1.optional)(accountRequest_1.accountRequestSchema)] }); req.header('apikey', mapped.apikey); req.header('RequestId', mapped.requestId); req.header('Content-Type', 'application/json'); req.json(mapped.body); req.throwOn(400, core_1.ApiError, 'The server cannot or will not process the request due to something that is perceived to be a client\r\n error (e.g., malformed request syntax, invalid \r\n request message framing, or deceptive request routing).'); req.throwOn(401, core_1.ApiError, 'The request has not been applied because it lacks valid authentication credentials for the target resource.'); req.throwOn(403, core_1.ApiError, 'The server understood the request but refuses to authorize it.'); req.throwOn(404, core_1.ApiError, '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, core_1.ApiError, 'The server encountered an unexpected condition the prevented it from fulfilling the request.'); req.authenticate([{ basicAuth: true }]); return [2 /*return*/, req.callAsJson(accountResponse_1.accountResponseSchema, requestOptions)]; }); }); }; /** * This operation allows querying card types that are associated to the given account and are allowed * to be shown to users. * * @param apikey This is the API key of the specific environment which needs to be * passed by the client. * @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 Get CardType Request Body * @return Response from the API call */ CustomerController.prototype.cardType = function (apikey, 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', '/fleetmanagement/v2/customer/cardtype'); mapped = req.prepareArgs({ apikey: [apikey, (0, schema_1.string)()], requestId: [requestId, (0, schema_1.string)()], body: [body, (0, schema_1.optional)(cardTypeRequest_1.cardTypeRequestSchema)] }); req.header('apikey', mapped.apikey); req.header('RequestId', mapped.requestId); req.header('Content-Type', 'application/json'); req.json(mapped.body); req.throwOn(400, core_1.ApiError, 'The server cannot or will not process the request due to something that is perceived to be a client\r\n error (e.g., malformed request syntax, invalid \r\n request message framing, or deceptive request routing).'); req.throwOn(401, core_1.ApiError, 'The request has not been applied because it lacks valid authentication credentials for the target resource.'); req.throwOn(403, core_1.ApiError, 'The server understood the request but refuses to authorize it.'); req.throwOn(404, core_1.ApiError, '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, core_1.ApiError, 'The server encountered an unexpected condition the prevented it from fulfilling the request.'); req.authenticate([{ basicAuth: true }]); return [2 /*return*/, req.callAsJson(cardTypeResponse_1.cardTypeResponseSchema, requestOptions)]; }); }); }; /** * This operation allows querying the card group details . It provides flexible search criteria and * supports paging.\ * * * When the card group type is configured as ‘Vertical’ in cards platform, this operation will return * all card groups from the given account or if no account is passed in the input, then will return * card groups from all the accounts under the payer. * * * When the card group type is configured as ‘Horizontal’ in cards platform, this API will return all * card groups configured directly under the payer. * * * Accounts with cancelled status will not be considered for cardgroups search for the configured (E.g., * SFH) set of client apps. * * * @param apikey This is the API key of the specific environment which needs to be * passed by the client. * @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 Request Body * @return Response from the API call */ CustomerController.prototype.cardGroups = function (apikey, 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', '/fleetmanagement/v1/customer/cardgroups'); mapped = req.prepareArgs({ apikey: [apikey, (0, schema_1.string)()], requestId: [requestId, (0, schema_1.string)()], body: [body, (0, schema_1.optional)(cardGroupRequest_1.cardGroupRequestSchema)] }); req.header('apikey', mapped.apikey); req.header('RequestId', mapped.requestId); req.header('Content-Type', 'application/json'); req.json(mapped.body); req.throwOn(400, core_1.ApiError, 'The server cannot or will not process the request due to something that is perceived to be a client\r\n error (e.g., malformed request syntax, invalid \r\n request message framing, or deceptive request routing).'); req.throwOn(401, core_1.ApiError, 'The request has not been applied because it lacks valid authentication credentials for the target resource.'); req.throwOn(403, core_1.ApiError, 'The server understood the request but refuses to authorize it.'); req.throwOn(404, core_1.ApiError, '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, core_1.ApiError, 'The server encountered an unexpected condition the prevented it from fulfilling the request.'); req.authenticate([{ basicAuth: true }]); return [2 /*return*/, req.callAsJson(cardGroupResponse_1.cardGroupResponseSchema, requestOptions)]; }); }); }; /** * This operation allows users to fetch audit data of account or card operations performed by users of * a given customer * * The audit data includes details of below API operations * * * * * Order Card * * * Create Card Group * * * PIN reminder * * * Move Cards * * * Update Card Status * * * Update Card Group * * * Auto renew * * * Bulk card order * * * Bulk card block * * * Bulk Card Order (Multi Account) * * * BCOSummary * * * BCOMultiAccountSummary * * * BCBSummary * * * Mobile Payment Registration * * * Fund Transfer (Scheduled & Realtime) * * * Delivery Address Update. * * @param apikey This is the API key of the specific environment which needs to be * passed by the client. * @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 request body * @return Response from the API call */ CustomerController.prototype.auditReport = function (apikey, 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', '/fleetmanagement/v1/customer/auditreport'); mapped = req.prepareArgs({ apikey: [apikey, (0, schema_1.string)()], requestId: [requestId, (0, schema_1.string)()], body: [body, (0, schema_1.optional)(auditRequest_1.auditRequestSchema)] }); req.header('apikey', mapped.apikey); req.header('RequestId', mapped.requestId); req.header('Content-Type', 'application/json'); req.json(mapped.body); req.throwOn(400, core_1.ApiError, 'The server cannot or will not process the request due to something that is perceived to be a client\r\n error (e.g., malformed request syntax, invalid \r\n request message framing, or deceptive request routing).'); req.throwOn(401, core_1.ApiError, 'The request has not been applied because it lacks valid authentication credentials for the target resource.'); req.throwOn(403, core_1.ApiError, 'The server understood the request but refuses to authorize it.'); req.throwOn(404, core_1.ApiError, '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, core_1.ApiError, 'The server encountered an unexpected condition the prevented it from fulfilling the request.'); req.authenticate([{ basicAuth: true }]); return [2 /*return*/, req.callAsJson(auditResponse_1.auditResponseSchema, requestOptions)]; }); }); }; /** * This API allows creating a new Card Group in the Shell Cards Platform. It will * * also allow moving of cards (up to 500 cards) into the newly created * * card-group. * * * * ### Move Card requests are queued after passing the below validations * * * * * Given PAN matches with only one card. * * * Card is allowed to be moved to the Target Card Group and/or * * * Target account requested. * * * There is no pending Move Card request for the same card in the queue which is submitted on the * same date * * and is yet to be processed or has been processed * * successfully * * * * @param apikey This is the API key of the specific environment which needs * to be passed by the client. * @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 CreateCardGroup request body * @return Response from the API call */ CustomerController.prototype.createCardGroup = function (apikey, 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', '/fleetmanagement/v1/customer/createcardgroup'); mapped = req.prepareArgs({ apikey: [apikey, (0, schema_1.string)()], requestId: [requestId, (0, schema_1.string)()], body: [body, (0, schema_1.optional)(createCardGroupRequest_1.createCardGroupRequestSchema)] }); req.header('apikey', mapped.apikey); req.header('RequestId', mapped.requestId); req.header('Content-Type', 'application/json'); req.json(mapped.body); req.throwOn(400, core_1.ApiError, 'The server cannot or will not process the request due to something that is perceived to be a client\r\n error (e.g., malformed request syntax, invalid \r\n request message framing, or deceptive request routing).'); req.throwOn(401, core_1.ApiError, 'The request has not been applied because it lacks valid authentication credentials for the target resource.'); req.throwOn(403, core_1.ApiError, 'The server understood the request but refuses to authorize it.'); req.throwOn(404, core_1.ApiError, '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, core_1.ApiError, 'The server encountered an unexpected condition the prevented it from fulfilling the request.'); req.authenticate([{ basicAuth: true }]); return [2 /*return*/, req.callAsJson(createCardGroupResponse_1.createCardGroupResponseSchema, requestOptions)]; }); }); }; /** * This API allows updating or removing a Card Group in the Shell Cards Platform. * * * * It also allows moving of cards out of a card group or from one card group to another existing card * group. * * * * The request for updating or removing of the card group, creationg of a new card group (where- * applicable) and moving of card into another card group will be queued at Microservices after passing * the basic * * validations. * * * * @param apikey This is the API key of the specific environment which needs * to be passed by the client. * @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 request body of customer card group * @return Response from the API call */ CustomerController.prototype.updateCardGroup = function (apikey, 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', '/fleetmanagement/v1/customer/updatecardgroup'); mapped = req.prepareArgs({ apikey: [apikey, (0, schema_1.string)()], requestId: [requestId, (0, schema_1.string)()], body: [body, (0, schema_1.optional)(updateCardGroupRequest_1.updateCardGroupRequestSchema)] }); req.header('apikey', mapped.apikey); req.header('RequestId', mapped.requestId); req.header('Content-Type', 'application/json'); req.json(mapped.body); req.throwOn(400, core_1.ApiError, 'The server cannot or will not process the request due to something that is perceived to be a client\r\n error (e.g., malformed request syntax, invalid \r\n request message framing, or deceptive request routing).'); req.throwOn(401, core_1.ApiError, 'The request has not been applied because it lacks valid authentication credentials for the target resource.'); req.throwOn(403, core_1.ApiError, 'The server understood the request but refuses to authorize it.'); req.throwOn(404, core_1.ApiError, '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, core_1.ApiError, 'The server encountered an unexpected condition the prevented it from fulfilling the request.'); req.authenticate([{ basicAuth: true }]); return [2 /*return*/, req.callAsJson(updateCardGroupResponse_1.updateCardGroupResponseSchema, requestOptions)]; }); }); }; return CustomerController; }(baseController_1.BaseController)); exports.CustomerController = CustomerController; //# sourceMappingURL=customerController.js.map