data-and-reporting-sdk
Version:
Data And Reporting product consists of API's which provides details of transaction and invoice informations about shell cards. The Shell Card Transaction and Invoice API is REST-based and employs Basic authentication in Version 1 and Oauth authentication
642 lines (632 loc) • 23.3 kB
text/typescript
/**
* Shell Data & Reporting APIsLib
*
* This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
*/
import { ApiResponse, RequestOptions } from '../core';
import { AccountRequest, accountRequestSchema } from '../models/accountRequest';
import {
AccountResponse,
accountResponseSchema,
} from '../models/accountResponse';
import { AuditRequest, auditRequestSchema } from '../models/auditRequest';
import { AuditResponse, auditResponseSchema } from '../models/auditResponse';
import {
CardGroupRequest,
cardGroupRequestSchema,
} from '../models/cardGroupRequest';
import {
CardGroupResponse,
cardGroupResponseSchema,
} from '../models/cardGroupResponse';
import {
CardTypeRequest,
cardTypeRequestSchema,
} from '../models/cardTypeRequest';
import {
CardTypeResponse,
cardTypeResponseSchema,
} from '../models/cardTypeResponse';
import {
CustomerDetailRequest,
customerDetailRequestSchema,
} from '../models/customerDetailRequest';
import {
CustomerDetailResponse,
customerDetailResponseSchema,
} from '../models/customerDetailResponse';
import {
CustomerPriceListRequest,
customerPriceListRequestSchema,
} from '../models/customerPriceListRequest';
import {
CustomerPriceListResponse,
customerPriceListResponseSchema,
} from '../models/customerPriceListResponse';
import {
FleetmanagementV1UserLoggedinuserRequest,
fleetmanagementV1UserLoggedinuserRequestSchema,
} from '../models/fleetmanagementV1UserLoggedinuserRequest';
import {
LoggedInUserResponse,
loggedInUserResponseSchema,
} from '../models/loggedInUserResponse';
import { PayerRequest, payerRequestSchema } from '../models/payerRequest';
import { PayerResponse, payerResponseSchema } from '../models/payerResponse';
import { optional, string } from '../schema';
import { BaseController } from './baseController';
import { DefaultError } from '../errors/defaultError';
import { ErrorUserAccessError1Error } from '../errors/errorUserAccessError1Error';
export class CustomerController extends BaseController {
/**
* 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
*/
async loggedinUser(
apikey: string,
requestId: string,
body?: FleetmanagementV1UserLoggedinuserRequest,
requestOptions?: RequestOptions
): Promise<ApiResponse<LoggedInUserResponse>> {
const req = this.createRequest(
'POST',
'/fleetmanagement/v1/user/loggedinuser'
);
const mapped = req.prepareArgs({
apikey: [apikey, string()],
requestId: [requestId, string()],
body: [body, optional(fleetmanagementV1UserLoggedinuserRequestSchema)],
});
req.header('apikey', mapped.apikey);
req.header('RequestId', mapped.requestId);
req.header('Content-Type', 'application/json');
req.json(mapped.body);
req.throwOn(
400,
DefaultError,
'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,
DefaultError,
'The request has not been applied because it lacks valid authentication credentials for the target resource.'
);
req.throwOn(
403,
ErrorUserAccessError1Error,
'The server understood the request but refuses to authorize it.'
);
req.throwOn(
404,
DefaultError,
'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,
DefaultError,
'The server encountered an unexpected condition the prevented it from fulfilling the request.'
);
req.authenticate([{ basicAuth: true }]);
return req.callAsJson(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
*/
async payers(
apikey: string,
requestId: string,
body?: PayerRequest,
requestOptions?: RequestOptions
): Promise<ApiResponse<PayerResponse>> {
const req = this.createRequest(
'POST',
'/fleetmanagement/v1/customer/payers'
);
const mapped = req.prepareArgs({
apikey: [apikey, string()],
requestId: [requestId, string()],
body: [body, optional(payerRequestSchema)],
});
req.header('apikey', mapped.apikey);
req.header('RequestId', mapped.requestId);
req.header('Content-Type', 'application/json');
req.json(mapped.body);
req.throwOn(
400,
DefaultError,
'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,
DefaultError,
'The request has not been applied because it lacks valid authentication credentials for the target resource.'
);
req.throwOn(
403,
ErrorUserAccessError1Error,
'The server understood the request but refuses to authorize it.'
);
req.throwOn(
404,
DefaultError,
'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,
DefaultError,
'The server encountered an unexpected condition the prevented it from fulfilling the request.'
);
req.authenticate([{ basicAuth: true }]);
return req.callAsJson(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
*/
async customer(
apikey: string,
requestId: string,
body?: CustomerDetailRequest,
requestOptions?: RequestOptions
): Promise<ApiResponse<CustomerDetailResponse>> {
const req = this.createRequest(
'POST',
'/fleetmanagement/v1/customer/customer'
);
const mapped = req.prepareArgs({
apikey: [apikey, string()],
requestId: [requestId, string()],
body: [body, optional(customerDetailRequestSchema)],
});
req.header('apikey', mapped.apikey);
req.header('RequestId', mapped.requestId);
req.header('Content-Type', 'application/json');
req.json(mapped.body);
req.throwOn(
400,
DefaultError,
'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,
DefaultError,
'The request has not been applied because it lacks valid authentication credentials for the target resource.'
);
req.throwOn(
403,
ErrorUserAccessError1Error,
'The server understood the request but refuses to authorize it.'
);
req.throwOn(
404,
DefaultError,
'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,
DefaultError,
'The server encountered an unexpected condition the prevented it from fulfilling the request.'
);
req.authenticate([{ basicAuth: true }]);
return req.callAsJson(customerDetailResponseSchema, 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 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
*/
async customerPriceList(
apikey: string,
requestId: string,
body?: CustomerPriceListRequest,
requestOptions?: RequestOptions
): Promise<ApiResponse<CustomerPriceListResponse>> {
const req = this.createRequest(
'POST',
'/fleetmanagement/v2/customer/pricelist'
);
const mapped = req.prepareArgs({
apikey: [apikey, string()],
requestId: [requestId, string()],
body: [body, optional(customerPriceListRequestSchema)],
});
req.header('apikey', mapped.apikey);
req.header('RequestId', mapped.requestId);
req.header('Content-Type', 'application/json');
req.json(mapped.body);
req.throwOn(
400,
DefaultError,
'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,
DefaultError,
'The request has not been applied because it lacks valid authentication credentials for the target resource.'
);
req.throwOn(
403,
ErrorUserAccessError1Error,
'The server understood the request but refuses to authorize it.'
);
req.throwOn(
404,
DefaultError,
'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,
DefaultError,
'The server encountered an unexpected condition the prevented it from fulfilling the request.'
);
req.authenticate([{ basicAuth: true }]);
return req.callAsJson(customerPriceListResponseSchema, 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
*/
async accounts(
apikey: string,
requestId: string,
body?: AccountRequest,
requestOptions?: RequestOptions
): Promise<ApiResponse<AccountResponse>> {
const req = this.createRequest(
'POST',
'/fleetmanagement/v1/customer/accounts'
);
const mapped = req.prepareArgs({
apikey: [apikey, string()],
requestId: [requestId, string()],
body: [body, optional(accountRequestSchema)],
});
req.header('apikey', mapped.apikey);
req.header('RequestId', mapped.requestId);
req.header('Content-Type', 'application/json');
req.json(mapped.body);
req.throwOn(
400,
DefaultError,
'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,
DefaultError,
'The request has not been applied because it lacks valid authentication credentials for the target resource.'
);
req.throwOn(
403,
ErrorUserAccessError1Error,
'The server understood the request but refuses to authorize it.'
);
req.throwOn(
404,
DefaultError,
'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,
DefaultError,
'The server encountered an unexpected condition the prevented it from fulfilling the request.'
);
req.authenticate([{ basicAuth: true }]);
return req.callAsJson(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
*/
async cardType(
apikey: string,
requestId: string,
body?: CardTypeRequest,
requestOptions?: RequestOptions
): Promise<ApiResponse<CardTypeResponse>> {
const req = this.createRequest(
'POST',
'/fleetmanagement/v2/customer/cardtype'
);
const mapped = req.prepareArgs({
apikey: [apikey, string()],
requestId: [requestId, string()],
body: [body, optional(cardTypeRequestSchema)],
});
req.header('apikey', mapped.apikey);
req.header('RequestId', mapped.requestId);
req.header('Content-Type', 'application/json');
req.json(mapped.body);
req.throwOn(
400,
DefaultError,
'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,
DefaultError,
'The request has not been applied because it lacks valid authentication credentials for the target resource.'
);
req.throwOn(
403,
ErrorUserAccessError1Error,
'The server understood the request but refuses to authorize it.'
);
req.throwOn(
404,
DefaultError,
'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,
DefaultError,
'The server encountered an unexpected condition the prevented it from fulfilling the request.'
);
req.authenticate([{ basicAuth: true }]);
return req.callAsJson(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
*/
async cardGroups(
apikey: string,
requestId: string,
body?: CardGroupRequest,
requestOptions?: RequestOptions
): Promise<ApiResponse<CardGroupResponse>> {
const req = this.createRequest(
'POST',
'/fleetmanagement/v1/customer/cardgroups'
);
const mapped = req.prepareArgs({
apikey: [apikey, string()],
requestId: [requestId, string()],
body: [body, optional(cardGroupRequestSchema)],
});
req.header('apikey', mapped.apikey);
req.header('RequestId', mapped.requestId);
req.header('Content-Type', 'application/json');
req.json(mapped.body);
req.throwOn(
400,
DefaultError,
'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,
DefaultError,
'The request has not been applied because it lacks valid authentication credentials for the target resource.'
);
req.throwOn(
403,
ErrorUserAccessError1Error,
'The server understood the request but refuses to authorize it.'
);
req.throwOn(
404,
DefaultError,
'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,
DefaultError,
'The server encountered an unexpected condition the prevented it from fulfilling the request.'
);
req.authenticate([{ basicAuth: true }]);
return req.callAsJson(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
*/
async auditReport(
apikey: string,
requestId: string,
body?: AuditRequest,
requestOptions?: RequestOptions
): Promise<ApiResponse<AuditResponse>> {
const req = this.createRequest(
'POST',
'/fleetmanagement/v1/customer/auditreport'
);
const mapped = req.prepareArgs({
apikey: [apikey, string()],
requestId: [requestId, string()],
body: [body, optional(auditRequestSchema)],
});
req.header('apikey', mapped.apikey);
req.header('RequestId', mapped.requestId);
req.header('Content-Type', 'application/json');
req.json(mapped.body);
req.throwOn(
400,
DefaultError,
'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,
DefaultError,
'The request has not been applied because it lacks valid authentication credentials for the target resource.'
);
req.throwOn(
403,
ErrorUserAccessError1Error,
'The server understood the request but refuses to authorize it.'
);
req.throwOn(
404,
DefaultError,
'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,
DefaultError,
'The server encountered an unexpected condition the prevented it from fulfilling the request.'
);
req.authenticate([{ basicAuth: true }]);
return req.callAsJson(auditResponseSchema, requestOptions);
}
}