/** * Shell Data & Reporting APIsLib * * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). */ import { ApiResponse, RequestOptions } from '../core.js'; import { AccountReq, accountReqSchema } from '../models/accountReq.js'; import { AccountRes, accountResSchema } from '../models/accountRes.js'; import { AuditReq, auditReqSchema } from '../models/auditReq.js'; import { AuditResponse, auditResponseSchema } from '../models/auditResponse.js'; import { CardGroupReq, cardGroupReqSchema } from '../models/cardGroupReq.js'; import { CardGroupRes, cardGroupResSchema } from '../models/cardGroupRes.js'; import { CardTypeReq, cardTypeReqSchema } from '../models/cardTypeReq.js'; import { CardTypeRes, cardTypeResSchema } from '../models/cardTypeRes.js'; import { CustomerPriceListReq, customerPriceListReqSchema, } from '../models/customerPriceListReq.js'; import { CustomerPriceListRes, customerPriceListResSchema, } from '../models/customerPriceListRes.js'; import { CustomerReq, customerReqSchema } from '../models/customerReq.js'; import { CustomerRes, customerResSchema } from '../models/customerRes.js'; import { LoggedInUserReq, loggedInUserReqSchema, } from '../models/loggedInUserReq.js'; import { LoggedInUserRes, loggedInUserResSchema, } from '../models/loggedInUserRes.js'; import { PayerReq, payerReqSchema } from '../models/payerReq.js'; import { PayerRes, payerResSchema } from '../models/payerRes.js'; import { optional, string } from '../schema.js'; import { BaseController } from './baseController.js'; import { CustomerManagementV1Accounts400Error } from '../errors/customerManagementV1Accounts400Error.js'; import { CustomerManagementV1Accounts401Error } from '../errors/customerManagementV1Accounts401Error.js'; import { CustomerManagementV1Accounts403Error } from '../errors/customerManagementV1Accounts403Error.js'; import { CustomerManagementV1Accounts404Error } from '../errors/customerManagementV1Accounts404Error.js'; import { CustomerManagementV1Accounts500Error } from '../errors/customerManagementV1Accounts500Error.js'; import { CustomerManagementV1Auditreport400Error } from '../errors/customerManagementV1Auditreport400Error.js'; import { CustomerManagementV1Auditreport401Error } from '../errors/customerManagementV1Auditreport401Error.js'; import { CustomerManagementV1Auditreport403Error } from '../errors/customerManagementV1Auditreport403Error.js'; import { CustomerManagementV1Auditreport404Error } from '../errors/customerManagementV1Auditreport404Error.js'; import { CustomerManagementV1Auditreport500Error } from '../errors/customerManagementV1Auditreport500Error.js'; import { CustomerManagementV1Cardgroups400Error } from '../errors/customerManagementV1Cardgroups400Error.js'; import { CustomerManagementV1Cardgroups401Error } from '../errors/customerManagementV1Cardgroups401Error.js'; import { CustomerManagementV1Cardgroups403Error } from '../errors/customerManagementV1Cardgroups403Error.js'; import { CustomerManagementV1Cardgroups404Error } from '../errors/customerManagementV1Cardgroups404Error.js'; import { CustomerManagementV1Cardgroups500Error } from '../errors/customerManagementV1Cardgroups500Error.js'; import { CustomerManagementV1Customer400Error } from '../errors/customerManagementV1Customer400Error.js'; import { CustomerManagementV1Customer401Error } from '../errors/customerManagementV1Customer401Error.js'; import { CustomerManagementV1Customer403Error } from '../errors/customerManagementV1Customer403Error.js'; import { CustomerManagementV1Customer404Error } from '../errors/customerManagementV1Customer404Error.js'; import { CustomerManagementV1Customer500Error } from '../errors/customerManagementV1Customer500Error.js'; import { CustomerManagementV1Payers400Error } from '../errors/customerManagementV1Payers400Error.js'; import { CustomerManagementV1Payers401Error } from '../errors/customerManagementV1Payers401Error.js'; import { CustomerManagementV1Payers403Error } from '../errors/customerManagementV1Payers403Error.js'; import { CustomerManagementV1Payers404Error } from '../errors/customerManagementV1Payers404Error.js'; import { CustomerManagementV1Payers500Error } from '../errors/customerManagementV1Payers500Error.js'; import { CustomerManagementV1Pricelist400Error } from '../errors/customerManagementV1Pricelist400Error.js'; import { CustomerManagementV1Pricelist401Error } from '../errors/customerManagementV1Pricelist401Error.js'; import { CustomerManagementV1Pricelist403Error } from '../errors/customerManagementV1Pricelist403Error.js'; import { CustomerManagementV1Pricelist404Error } from '../errors/customerManagementV1Pricelist404Error.js'; import { CustomerManagementV1Pricelist500Error } from '../errors/customerManagementV1Pricelist500Error.js'; import { CustomerManagementV2Cardtype400Error } from '../errors/customerManagementV2Cardtype400Error.js'; import { CustomerManagementV2Cardtype401Error } from '../errors/customerManagementV2Cardtype401Error.js'; import { CustomerManagementV2Cardtype403Error } from '../errors/customerManagementV2Cardtype403Error.js'; import { CustomerManagementV2Cardtype404Error } from '../errors/customerManagementV2Cardtype404Error.js'; import { CustomerManagementV2Cardtype500Error } from '../errors/customerManagementV2Cardtype500Error.js'; import { UserManagementV1Loggedinuser400Error } from '../errors/userManagementV1Loggedinuser400Error.js'; import { UserManagementV1Loggedinuser401Error } from '../errors/userManagementV1Loggedinuser401Error.js'; import { UserManagementV1Loggedinuser403Error } from '../errors/userManagementV1Loggedinuser403Error.js'; import { UserManagementV1Loggedinuser404Error } from '../errors/userManagementV1Loggedinuser404Error.js'; import { UserManagementV1Loggedinuser500Error } from '../errors/userManagementV1Loggedinuser500Error.js'; export class CustomerController extends BaseController { /** * This operation allows querying the user data of the logged in user. * This operation should be called only after successful authentication of the end user in client * application. This operation will return the user access details such as payers and/or accounts. * This operation will also validate that logged in user has access to the requested operation, on * failure it will return HasAPIAccess flag as false in the response. * * @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 */ async userLoggedinuser( requestId: string, body: LoggedInUserReq, requestOptions?: RequestOptions ): Promise> { const req = this.createRequest('POST', '/user-management/v1/loggedinuser'); const mapped = req.prepareArgs({ requestId: [requestId, string()], body: [body, loggedInUserReqSchema], }); req.header('RequestId', mapped.requestId); req.header('Content-Type', 'application/json'); req.json(mapped.body); req.throwOn( 400, UserManagementV1Loggedinuser400Error, '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, UserManagementV1Loggedinuser401Error, 'The request has not been applied because it lacks valid authentication credentials for the target resource.' ); req.throwOn(403, UserManagementV1Loggedinuser403Error, 'Forbidden'); req.throwOn( 404, UserManagementV1Loggedinuser404Error, '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, UserManagementV1Loggedinuser500Error, 'The server encountered an unexpected condition that prevented it from fulfilling the request.' ); req.authenticate([{ bearerToken: true }]); return req.callAsJson(loggedInUserResSchema, 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 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 */ async customerpayers( requestId: string, body: PayerReq, requestOptions?: RequestOptions ): Promise> { const req = this.createRequest('POST', '/customer-management/v1/payers'); const mapped = req.prepareArgs({ requestId: [requestId, string()], body: [body, payerReqSchema], }); req.header('RequestId', mapped.requestId); req.header('Content-Type', 'application/json'); req.json(mapped.body); req.throwOn( 400, CustomerManagementV1Payers400Error, '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, CustomerManagementV1Payers401Error, 'The request has not been applied because it lacks valid authentication credentials for the target resource.' ); req.throwOn(403, CustomerManagementV1Payers403Error, 'Forbidden'); req.throwOn( 404, CustomerManagementV1Payers404Error, '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, CustomerManagementV1Payers500Error, 'The server encountered an unexpected condition that prevented it from fulfilling the request.' ); req.authenticate([{ bearerToken: true }]); return req.callAsJson(payerResSchema, 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 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 */ async customerdetail( requestId: string, body: CustomerReq, requestOptions?: RequestOptions ): Promise> { const req = this.createRequest('POST', '/customer-management/v1/customer'); const mapped = req.prepareArgs({ requestId: [requestId, string()], body: [body, customerReqSchema], }); req.header('RequestId', mapped.requestId); req.header('Content-Type', 'application/json'); req.json(mapped.body); req.throwOn( 400, CustomerManagementV1Customer400Error, '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, CustomerManagementV1Customer401Error, 'The request has not been applied because it lacks valid authentication credentials for the target resource.' ); req.throwOn(403, CustomerManagementV1Customer403Error, 'Forbidden'); req.throwOn( 404, CustomerManagementV1Customer404Error, '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, CustomerManagementV1Customer500Error, 'The server encountered an unexpected condition that prevented it from fulfilling the request.' ); req.authenticate([{ bearerToken: true }]); return req.callAsJson(customerResSchema, requestOptions); } /** * This API allows querying the customer account details from the Shell Cards Platform. It provides a * flexible search criterion and supports pagination. * * @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 */ async postCardAccounts( requestId: string, body: AccountReq, requestOptions?: RequestOptions ): Promise> { const req = this.createRequest('POST', '/customer-management/v1/accounts'); const mapped = req.prepareArgs({ requestId: [requestId, string()], body: [body, accountReqSchema], }); req.header('RequestId', mapped.requestId); req.header('Content-Type', 'application/json'); req.json(mapped.body); req.throwOn( 400, CustomerManagementV1Accounts400Error, '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, CustomerManagementV1Accounts401Error, 'The request has not been applied because it lacks valid authentication credentials for the target resource.' ); req.throwOn(403, CustomerManagementV1Accounts403Error, 'Forbidden'); req.throwOn( 404, CustomerManagementV1Accounts404Error, '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, CustomerManagementV1Accounts500Error, 'The server encountered an unexpected condition that prevented it from fulfilling the request.' ); req.authenticate([{ bearerToken: true }]); return req.callAsJson(accountResSchema, requestOptions); } /** * * This API provides allows querying the active card types that are associated to the given account. * * The API returns the card type configurations, purchase categories associated with the card type and * the card type restriction limits. * * * @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 */ async customercardtypev( requestId: string, body: CardTypeReq, requestOptions?: RequestOptions ): Promise> { const req = this.createRequest('POST', '/customer-management/v2/cardtype'); const mapped = req.prepareArgs({ requestId: [requestId, string()], body: [body, cardTypeReqSchema], }); req.header('RequestId', mapped.requestId); req.header('Content-Type', 'application/json'); req.json(mapped.body); req.throwOn( 400, CustomerManagementV2Cardtype400Error, '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, CustomerManagementV2Cardtype401Error, 'The request has not been applied because it lacks valid authentication credentials for the target resource.' ); req.throwOn(403, CustomerManagementV2Cardtype403Error, 'Forbidden'); req.throwOn( 404, CustomerManagementV2Cardtype404Error, '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, CustomerManagementV2Cardtype500Error, 'The server encountered an unexpected condition that prevented it from fulfilling the request.' ); req.authenticate([{ bearerToken: true }]); return req.callAsJson(cardTypeResSchema, requestOptions); } /** * This API allows querying the card group details from the Shell Cards * Platform. It provides flexible search criteria and supports paging. * * When the account is not passed in the input and card group type is configured as * ‘Vertical’ in the cards platform, this API will return all card groups from * the payer as well as from all the accounts under the payer. * * When the account is not passed in the input and card group type is configured as * ‘Horizontal’ in cards platform, this API will return all card groups * configured directly under the payer. * * * @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 */ async cardgroups( requestId: string, body: CardGroupReq, requestOptions?: RequestOptions ): Promise> { const req = this.createRequest( 'POST', '/customer-management/v1/cardgroups' ); const mapped = req.prepareArgs({ requestId: [requestId, string()], body: [body, cardGroupReqSchema], }); req.header('RequestId', mapped.requestId); req.header('Content-Type', 'application/json'); req.json(mapped.body); req.throwOn( 400, CustomerManagementV1Cardgroups400Error, '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, CustomerManagementV1Cardgroups401Error, 'The request has not been applied because it lacks valid authentication credentials for the target resource.' ); req.throwOn(403, CustomerManagementV1Cardgroups403Error, 'Forbidden'); req.throwOn( 404, CustomerManagementV1Cardgroups404Error, '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, CustomerManagementV1Cardgroups500Error, 'The server encountered an unexpected condition that prevented it from fulfilling the request.' ); req.authenticate([{ bearerToken: true }]); return req.callAsJson(cardGroupResSchema, 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 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 */ async auditReport( requestId: string, body?: AuditReq, requestOptions?: RequestOptions ): Promise> { const req = this.createRequest( 'POST', '/customer-management/v1/auditreport' ); const mapped = req.prepareArgs({ requestId: [requestId, string()], body: [body, optional(auditReqSchema)], }); req.header('RequestId', mapped.requestId); req.header('Content-Type', 'application/json'); req.json(mapped.body); req.throwOn( 400, CustomerManagementV1Auditreport400Error, '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, CustomerManagementV1Auditreport401Error, 'The request has not been applied because it lacks valid authentication credentials for the target resource.' ); req.throwOn(403, CustomerManagementV1Auditreport403Error, 'Forbidden'); req.throwOn( 404, CustomerManagementV1Auditreport404Error, '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, CustomerManagementV1Auditreport500Error, 'The server encountered an unexpected condition that prevented it from fulfilling the request.' ); req.authenticate([{ bearerToken: true }]); return req.callAsJson(auditResponseSchema, requestOptions); } /** * - This operation fetches the International and National Price List and discount values set on pump * prices & List Prices * * - It allows searching price list and discount values set on pump prices that are applicable for a * given customer * * * * **Note**: Accounts with cancelled status will not be considered for this operation for the * configured * * * * - When the search is based on customer specific price list then the customer price list is returned * based on the associated pricing customer. * * - The discount values set on pump prices, which are returned by the operation are always customer * specific values based on the customer associated price rules. * * * * * * @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 */ async customerPriceList( requestId: string, body?: CustomerPriceListReq, requestOptions?: RequestOptions ): Promise> { const req = this.createRequest('POST', '/customer-management/v1/pricelist'); const mapped = req.prepareArgs({ requestId: [requestId, string()], body: [body, optional(customerPriceListReqSchema)], }); req.header('RequestId', mapped.requestId); req.header('Content-Type', 'application/json'); req.json(mapped.body); req.throwOn( 400, CustomerManagementV1Pricelist400Error, '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, CustomerManagementV1Pricelist401Error, 'The request has not been applied because it lacks valid authentication credentials for the target resource.' ); req.throwOn(403, CustomerManagementV1Pricelist403Error, 'Forbidden'); req.throwOn( 404, CustomerManagementV1Pricelist404Error, '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, CustomerManagementV1Pricelist500Error, 'The server encountered an unexpected condition that prevented it from fulfilling the request.' ); req.authenticate([{ bearerToken: true }]); return req.callAsJson(customerPriceListResSchema, requestOptions); } }