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

1,054 lines 57.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.CardController = void 0;
var tslib_1 = require("tslib");
var autoRenewCardRequest_1 = require("../models/autoRenewCardRequest");
var autoRenewCardResponse_1 = require("../models/autoRenewCardResponse");
var cancelCardResponse_1 = require("../models/cancelCardResponse");
var cardDetailsRequest_1 = require("../models/cardDetailsRequest");
var cardDetailsResponse_1 = require("../models/cardDetailsResponse");
var cardManagementV1CancelRequest_1 = require("../models/cardManagementV1CancelRequest");
var cardManagementV1OrdercardRequest_1 = require("../models/cardManagementV1OrdercardRequest");
var cardManagementV1PinreminderRequest_1 = require("../models/cardManagementV1PinreminderRequest");
var cardManagementV1UpdatestatusRequest_1 = require("../models/cardManagementV1UpdatestatusRequest");
var cardMoveRequest_1 = require("../models/cardMoveRequest");
var cardMoveResponse_1 = require("../models/cardMoveResponse");
var cardSearchResponse_1 = require("../models/cardSearchResponse");
var cardSummaryRequest_1 = require("../models/cardSummaryRequest");
var cardSummaryResponse_1 = require("../models/cardSummaryResponse");
var deliveryAddressUpdateRequest_1 = require("../models/deliveryAddressUpdateRequest");
var deliveryAddressUpdateResponse_1 = require("../models/deliveryAddressUpdateResponse");
var generatePINKeyResponse_1 = require("../models/generatePINKeyResponse");
var orderCardEnquiryRequest_1 = require("../models/orderCardEnquiryRequest");
var orderCardEnquiryResponse_1 = require("../models/orderCardEnquiryResponse");
var orderCardResponse_1 = require("../models/orderCardResponse");
var pINReminderResponse_1 = require("../models/pINReminderResponse");
var purchaseCategoryRequest_1 = require("../models/purchaseCategoryRequest");
var purchaseCategoryResponse_1 = require("../models/purchaseCategoryResponse");
var scheduleCardBlockRequest_1 = require("../models/scheduleCardBlockRequest");
var scheduleCardBlockResponse_1 = require("../models/scheduleCardBlockResponse");
var searchCardRequest_1 = require("../models/searchCardRequest");
var updateCardStatusResponse_1 = require("../models/updateCardStatusResponse");
var updateMPayRegStatusRequest_1 = require("../models/updateMPayRegStatusRequest");
var updateMPayRegStatusResponse_1 = require("../models/updateMPayRegStatusResponse");
var schema_1 = require("../schema");
var baseController_1 = require("./baseController");
var core_1 = require("@apimatic/core");
var errorObjectError_1 = require("../errors/errorObjectError");
var CardController = /** @class */ (function (_super) {
    tslib_1.__extends(CardController, _super);
    function CardController() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /**
     * This API allows to search for Shell Cards in the Shell Card Platform. It provides flexible search
     * criteria and supports paging.
     * #### New version updates
     *
     * * Oauth authentication to access the API
     *
     * * New parameters have been added in the response. Below are the list of parameters added
     *
     * * IsEMVContact
     *
     * * IsEMVContactless
     *
     * * IsRFID
     *
     * * RFIDUID
     *
     * * EMAID
     *
     * * EVPrintedNumber
     *
     * * CardMediaCode
     *
     * #### Supported operations
     *
     * * Search cards by card id or PAN
     *
     * * Search cards by card status
     *
     * * Search cards by excluding card status
     *
     * * Search cards by date fields
     *
     * * Search cards by embossed fields
     *
     * * Search cards by card configuration fields
     *
     * * Search cards by included/excluded list of cards
     *
     * * Search cards by excluding card bundle Id
     *
     * @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         requestbody
     * @return Response from the API call
     */
    CardController.prototype.searchCard = 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-management/v1/search');
                mapped = req.prepareArgs({
                    requestId: [requestId, (0, schema_1.string)()],
                    body: [body, (0, schema_1.optional)(searchCardRequest_1.searchCardRequestSchema)]
                });
                req.header('RequestId', mapped.requestId);
                req.header('Content-Type', 'application/json');
                req.json(mapped.body);
                req.throwOn(400, errorObjectError_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_1.ErrorObjectError, 'The request has not been applied because it lacks valid  authentication credentials for the target resource.');
                req.throwOn(403, errorObjectError_1.ErrorObjectError, 'Forbidden');
                req.throwOn(404, errorObjectError_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_1.ErrorObjectError, 'The server encountered an unexpected condition that  prevented it from fulfilling the request.');
                req.authenticate([{ bearerToken: true }]);
                return [2 /*return*/, req.callAsJson(cardSearchResponse_1.cardSearchResponseSchema, requestOptions)];
            });
        });
    };
    /**
     * This API allows to search for fuel cards in the Shell Card Platform and returns a high-level summary
     * count. It provides flexible search criteria.
     *
     * #### New version updates
     *
     * * Oauth authentication to access the API
     *
     * * Minor change in response structure with addition of Status parameter
     *
     *
     *
     * #### Supported operations
     *
     * * Search cards by card id or PAN
     *
     * * Search cards by card status
     *
     * * Search cards by excluding card status
     *
     * * Search cards by date fields
     *
     * * Search cards by embossed fields
     *
     * * Search cards by card configuration fields
     *
     * * Search cards by included/excluded list of cards
     *
     * @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 request body
     * @return Response from the API call
     */
    CardController.prototype.cardSummary = 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-management/v1/summary');
                mapped = req.prepareArgs({
                    requestId: [requestId, (0, schema_1.string)()],
                    body: [body, (0, schema_1.optional)(cardSummaryRequest_1.cardSummaryRequestSchema)]
                });
                req.header('RequestId', mapped.requestId);
                req.header('Content-Type', 'application/json');
                req.json(mapped.body);
                req.throwOn(400, errorObjectError_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, 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, 'Forbidden');
                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, errorObjectError_1.ErrorObjectError, 'The server encountered an unexpected condition that  prevented it from fulfilling the request.');
                req.authenticate([{ bearerToken: true }]);
                return [2 /*return*/, req.callAsJson(cardSummaryResponse_1.cardSummaryResponseSchema, requestOptions)];
            });
        });
    };
    /**
     * This API allows ordering one or more fuel cards (up to 50). If the API call succeeds, the API will
     * return a reference number and queue the request for asynchronous processing.
     *
     * #### New version updates
     *
     * * Oauth authentication to access the API
     *
     * * New parameters have been added in the response for the new PIN management changes. Below
     * parameters needs to be derived from the new PIN encryption method explained in our Mobility Card PIN
     * Management product.
     *
     * * SelfSelectedEncryptedPIN
     *
     * * SelfSelectedPINKeyID
     *
     * * SelfSelectedPINSessionKey
     *
     * * New parameters have been added in the response for card and pin delivery mechanism which gives
     * the opportunity to deliver card & pin by email, SMS or post.
     *
     * Also the possibility to deliver card and pin to different address if the use case demands.
     *
     * * CardDeliveryType
     *
     * * PINDeliveryAddressType
     *
     * * PINAdviceType
     *
     * * PINContact
     *
     * * CardContact
     *
     * #### Supported operations
     *
     * * Order one or more cards (up to 50)
     *
     * * Order card with self selected PIN
     *
     * * Order card with vehicle registration number
     *
     * * Order card and add to new or exisitng card group
     *
     * * Order card and enable fleetId or odemeter input
     *
     * * Order card and specify product groups
     *
     *
     *
     * #### Validation rules
     *
     * * Number of cards per request does not exceed 50
     *
     *
     *
     * #### API response
     *
     * * A main reference number for the API request (**OrderReference**)
     *
     * * Individual reference numbers (**OrderCardReference**) for each new card
     *
     * @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         Order card request body
     * @return Response from the API call
     */
    CardController.prototype.orderCard = 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-management/v1/ordercard');
                mapped = req.prepareArgs({
                    requestId: [requestId, (0, schema_1.string)()],
                    body: [body, (0, schema_1.optional)(cardManagementV1OrdercardRequest_1.cardManagementV1OrdercardRequestSchema)]
                });
                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 error (e.g., malformed request syntax, invalid 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, 'Forbidden');
                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 that  prevented it from fulfilling the request.');
                req.authenticate([{ bearerToken: true }]);
                return [2 /*return*/, req.callAsJson(orderCardResponse_1.orderCardResponseSchema, requestOptions)];
            });
        });
    };
    /**
     * This API retrieves the card order status from the Shell Card Platform based on the given reference
     * numbers.
     *
     * #### New version updates
     *
     * * Oauth authentication to access the API
     *
     * * Minor change in response structure with addition of Status parameter
     *
     *
     *
     * #### Supported operations
     *
     * * Get order status by Bulk Card Order Reference
     *
     * * Get order status by Order Reference (main reference for the order)
     *
     * * Get order status by Card Reference (individual card reference belonging to an order
     * reference)
     *
     *
     * @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         Order Card Enquiry request body
     * @return Response from the API call
     */
    CardController.prototype.orderCardEnquiry = 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-management/v1/ordercardenquiry');
                mapped = req.prepareArgs({
                    requestId: [requestId, (0, schema_1.string)()],
                    body: [body, (0, schema_1.optional)(orderCardEnquiryRequest_1.orderCardEnquiryRequestSchema)]
                });
                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 error (e.g., malformed request syntax, invalid 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, 'Forbidden');
                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 that  prevented it from fulfilling the request.');
                req.authenticate([{ bearerToken: true }]);
                return [2 /*return*/, req.callAsJson(orderCardEnquiryResponse_1.orderCardEnquiryResponseSchema, requestOptions)];
            });
        });
    };
    /**
     * This API allows cancelling one or multiple cards (up to 500) within a single API call. This API
     * allows updating of
     *
     * the card to the following status-
     *
     * *  Block (Cancelled)
     *
     *
     *
     * #### New version updates
     *
     * * Oauth authentication to access the API
     *
     * * Change in the request body
     *
     * * PIN delivery address details have been added along with Email and Phone number for card and
     * PIN delivery.
     *
     *
     *
     * Requests that passed the below validations are queued-
     *
     * * All Mandatory fields are passed.
     *
     * *  Card is present in the Shell Card Platform.
     *
     * *  Only one matching card is available in the cards platform for the given PAN and expiry date for
     * Block requests.
     *
     * *  Card is allowed to be moved to proposed state as per the card status transition configuration
     * in cards platform.
     *
     * *  A valid Reason Id or Reason Text is provided. The reason for card cancellation can be “Damaged”
     * or “NoLongerRequired”.
     *
     * *  For the given card, there is no Cancel request already submitted via this API and is being
     * processed.
     *
     * *  ‘IsReplacementChargeable’ is set to ‘False’ only to the configured customer, other customers
     * need to set it as ‘True’ only. If other customers pass this value as ‘False’.
     *
     *
     *
     * Note- Shell Card Platform will maintain the list of   customers, to whom ‘IsReplacementChargeable’
     * can be set as ‘False’.
     *
     *
     *
     * If all validations are passed, the request will be accepted and the API will return reference
     * numbers for tracking purpose. If any of the validations fail, the API will return the appropriate
     * error details on response.  The API response will include-
     *
     * *  A main reference number for the API request.
     *
     * *  A list of successfully validated and accepted cards along with the individual reference numbers
     * for each of the successful requests.
     *
     * *  A list of cards for which at least validation has failed along with the appropriate error code
     * and details.
     *
     *
     *
     * A permanent block (cancelled) request for the card will be queued in Shell Card Platform after the
     * configured damaged card active period (configured as number of days).
     *
     *
     *
     * When a card is requested to be Blocked permanently (cancelled) for which a request has already
     * been submitted to report as Damaged and the damaged card active period is not yet completed, the
     * damaged card request will be marked as superseded and the new Block (cancelled) request will be
     * processed.
     *
     * @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 status request body
     * @return Response from the API call
     */
    CardController.prototype.cardCancel = 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-management/v1/cancel');
                mapped = req.prepareArgs({
                    requestId: [requestId, (0, schema_1.string)()],
                    body: [body, (0, schema_1.optional)(cardManagementV1CancelRequest_1.cardManagementV1CancelRequestSchema)]
                });
                req.header('RequestId', mapped.requestId);
                req.header('Content-Type', 'application/json');
                req.json(mapped.body);
                req.throwOn(400, errorObjectError_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, 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, 'Forbidden');
                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 that  prevented it from fulfilling the request.');
                req.authenticate([{ bearerToken: true }]);
                return [2 /*return*/, req.callAsJson(cancelCardResponse_1.cancelCardResponseSchema, requestOptions)];
            });
        });
    };
    /**
     * This API allows updating of the card status for one or more cards (up to 500) within a single API
     * call.  If the API call succeeds, the API will return a reference number and queue the request for
     * asynchronous processing.
     *
     *
     *
     * #### New version updates
     *
     * * Oauth authentication to access the API
     *
     * * Change in the request body
     *
     * * Pin change related parameters - SelfSelectedEncryptedPIN, SelfSelectedPINKeyID,
     * SelfSelectedPINSessionKey
     *
     * * PIN delivery address details have been added along with Email and Phone number for card and
     * PIN delivery.
     *
     * * SaveForPINReminder - The given address will be used for sending PIN reminders in future when
     * requested.
     *
     * * SaveForCardReissue - If this is specified, the contact address will be saved in cards platform
     * for card reissue processing.
     *
     *
     *
     * #### Supported operations
     *
     * * Updating a card status to Temporary block, Unblock, Block (Cancelled)
     *
     * or Damaged
     *
     * * Requesting a replacement card when status is set to Block or Damaged
     *
     *
     *
     * #### Validation rules
     *
     * * Number of cards per request does not exceed 500
     *
     * * A card can be changed to proposed status as per the card status transition configuration in the
     * Shell Card Platform
     *
     * * Locating a card -
     *
     * * If target status set to **TemporaryBlock**, then only one matching active card should exist in
     * the Shell Card Platform for the given **PAN** and **CardExpiryDate**
     *
     * * If target status set to **Unblock** or **Block**, then only one matching card should exist in
     * the Shell Card Platform for the given **PAN** and **CardExpiryDate**
     *
     * * A valid Reason Id or Reason Text is provided
     *
     * * If target status set to **Block** or **Damaged** and a **ReasonText** is provided, the value
     * must be from the fixed list - *'Lost'*, *'Stolen'* or *'Card no longer required'*
     *
     * * For the given card, there is no Status Update request already submitted via this API and is
     * being processed
     *
     * * The **OrderReplacementCard** field is set to True only for cards with a target status set to
     * Block or Damaged
     *
     *
     *
     * #### API response
     *
     * * A main reference number for the API request (**OrderReplacementReference**)
     *
     * * A list of successfully validated and accepted cards along with the individual reference numbers
     * (**UpdateCardReference**) for each of the successful  request
     *
     * * A list of cards (**ErrorCards**) that failed validation along with the appropriate error code
     * and message
     *
     *
     *
     * #### Asynchronous processing of valid API request
     *
     * * Replacement cards
     *
     * * Request for a replacement card will be placed only when the Block card or Block damaged card
     * request is successfully placed.
     *
     * * The Replacement card request will be processed only when the permanent Block card request is
     * successfully processed. In case of damaged card request, the replacement card request will be
     * processed immediately.
     *
     * * Damaged cards
     *
     * * Setting a card to Damaged will automatically trigger a request to permanently block the card.
     * This will only take effect once the ‘Damaged Active’ period has passed.
     *
     * * The Damaged card active period is the number of days after which a "Damaged" card request will
     * be processed. This value is configured at ColCo level.
     *
     * * If a card is reported as damaged at 10pm local time on 1st Nov and the damaged card period is
     * set to 10 days, then the block request will be submitted to the Shell Card Platform on 11th Nov 00-
     * 01 local time.
     *
     * * If during the damage card active period another request is made to set the card to Temporarily
     * Blocked or Blocked permanently (cancelled), then the damaged card request will be marked as
     * superseded and the new Temporary Block or Block (cancelled) will be processed.
     *
     * @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 status request body
     * @return Response from the API call
     */
    CardController.prototype.cardUpdateStatus = 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-management/v1/updatestatus');
                mapped = req.prepareArgs({
                    requestId: [requestId, (0, schema_1.string)()],
                    body: [body, (0, schema_1.optional)(cardManagementV1UpdatestatusRequest_1.cardManagementV1UpdatestatusRequestSchema)]
                });
                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 error (e.g., malformed request syntax, invalid 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, 'Forbidden');
                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 that  prevented it from fulfilling the request.');
                req.authenticate([{ bearerToken: true }]);
                return [2 /*return*/, req.callAsJson(updateCardStatusResponse_1.updateCardStatusResponseSchema, requestOptions)];
            });
        });
    };
    /**
     * This API will allow querying the purchase categories of Card
     *
     * for the given country and/or card type.
     *
     * It will also include the below data associated with each of the purchase categories on it’s
     * response.
     *
     * *  List of fuel and non-fuel product sets associated.
     *
     * *  List of products configured in each product set
     *
     * @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         PurchaseCategory request body
     * @return Response from the API call
     */
    CardController.prototype.purchaseCategory = 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/master/purchasecategory');
                mapped = req.prepareArgs({
                    apikey: [apikey, (0, schema_1.string)()],
                    requestId: [requestId, (0, schema_1.string)()],
                    body: [body, (0, schema_1.optional)(purchaseCategoryRequest_1.purchaseCategoryRequestSchema)]
                });
                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([{ bearerToken: true }]);
                return [2 /*return*/, req.callAsJson(purchaseCategoryResponse_1.purchaseCategoryResponseSchema, requestOptions)];
            });
        });
    };
    /**
     * This API allows to fetch details of a single fuel card from the Shell Card Platform. If a **CardId**
     * request parameter is provided, this will return a single card.  If a **PAN** request parameter is
     * provided, this may result in multiple fuel cards matching the search criteria. The card details of
     * the most recently issued card will be returned.
     *
     *
     *
     * #### Supported operations
     *
     * * Get card by card id or PAN
     *
     * @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         Card details request body
     * @return Response from the API call
     */
    CardController.prototype.cardDetails = 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/card/card');
                mapped = req.prepareArgs({
                    apikey: [apikey, (0, schema_1.string)()],
                    requestId: [requestId, (0, schema_1.string)()],
                    body: [body, (0, schema_1.optional)(cardDetailsRequest_1.cardDetailsRequestSchema)]
                });
                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([{ bearerToken: true }]);
                return [2 /*return*/, req.callAsJson(cardDetailsResponse_1.cardDetailsResponseSchema, requestOptions)];
            });
        });
    };
    /**
     * This API allows to move one or more fuel cards (up to 500) across card groups within a single
     * account or across accounts under the same payer. If the API call succeeds, the API will return a
     * reference number and queue the request for asynchronous processing.
     *
     * #### Supported operations
     *
     * * Moving card to exisitng card group
     *
     * * Moving card to new card group
     *
     * * Removing a card from a card group
     *
     *
     *
     * #### Validation rules
     *
     * * Number of cards per request does not exceed 500
     *
     * * Given **PAN** for a card matches with only one card
     *
     * * A card is allowed to be moved to the **TargetCardGroupId** or **TargetAccountNumber**
     *
     * * A pending move request does not exist in the queue for a card submitted on the same date
     * (customers local)
     *
     * * A card has not been moved as part of a previous request on the same date (customers local)
     *
     *
     *
     * #### API response
     *
     * * A main reference number for the API request (**MoveCardRequestReference**)
     *
     * * Individual reference numbers (**MoveCardReference**) for each card move request that passes
     * validation
     *
     * * A list of cards (**ErrorCards**) that failed validation along with the appropriate error code
     * and message
     *
     *
     *
     * #### Asynchronous processing of valid API request
     *
     * * Move card requests that have been submitted and processed will be reflected after midnight
     * according to the customers local date
     *
     *
     *
     * @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         Move cards request body.
     * @return Response from the API call
     */
    CardController.prototype.cardMove = 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/card/move');
                mapped = req.prepareArgs({
                    apikey: [apikey, (0, schema_1.string)()],
                    requestId: [requestId, (0, schema_1.string)()],
                    body: [body, (0, schema_1.optional)(cardMoveRequest_1.cardMoveRequestSchema)]
                });
                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([{ bearerToken: true }]);
                return [2 /*return*/, req.callAsJson(cardMoveResponse_1.cardMoveResponseSchema, requestOptions)];
            });
        });
    };
    /**
     * This API allows requesting a PIN reminder for a fuel card. If the API call succeeds, the API will
     * return a reference number and queue the request for asynchronous processing.
     *
     * #### New version updates
     *
     * * Oauth authentication to access the API
     *
     * * Change in request body where PIN delivery type can be requested via Email, SMS or Post. PIN
     * delivery contact can be set to different values based on previous contact details of card or pin
     * delivery or can set specific contact details for this request.
     *
     * * PINAdviceType
     *
     * * PINContactType
     *
     * * PINDeliverTo
     *
     * * Please note that we have a **savePINReminder** parameter in order to save the contact details
     * for future such requests.
     *
     * * Change in response body where Card details are also provided along with expiry date and PAN
     * details.
     *
     *
     *
     * #### Supported operations
     *
     * * Request a pin reminder by card Id or PAN
     *
     *
     *
     * #### Validation rules
     *
     * * Given **PAN** or **CardId** is active
     *
     * * Given **PAN** matches only one active card
     *
     * * Requested card has PIN
     *
     * * There is no pending PIN Reminder request in the queue awaiting to be processed for the card
     *
     * * A PIN reminder request has not been successfully processed in the last 48 hours for the card
     *
     * @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         PIN reminder request body
     * @return Response from the API call
     */
    CardController.prototype.cardPinReminder = 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-management/v1/pinreminder');
                mapped = req.prepareArgs({
                    requestId: [requestId, (0, schema_1.string)()],
                    body: [body, (0, schema_1.optional)(cardManagementV1PinreminderRequest_1.cardManagementV1PinreminderRequestSchema)]
                });
                req.header('RequestId', mapped.requestId);
                req.header('Content-Type', 'application/json');
                req.json(mapped.body);
                req.throwOn(400, errorObjectError_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_1.ErrorObjectError, 'The request has not been applied because it lacks valid  authentication credentials for the target resource.');
                req.throwOn(403, errorObjectError_1.ErrorObjectError, 'Forbidden');
                req.throwOn(404, errorObjectError_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_1.ErrorObjectError, 'The server encountered an unexpected condition that  prevented it from fulfilling the request.');
                req.authenticate([{ bearerToken: true }]);
                return [2 /*return*/, req.callAsJson(pINReminderResponse_1.pINReminderResponseSchema, requestOptions)];
            });
        });
    };
    /**
     * This API allows scheduling Card Block / Unblock requests for one or multiple cards (up to 500
     * (configurable)) within a single API call. This API is used to perform the following Actions:
     *
     *
     *
     * >
     *
     * *  AddOrUpdate (Schedule a new request or update an existing     scheduled request for the
     * overlapping period.
     *
     * *  AddAndOverwriteAll (all the existing requests of the given card will be removed and a new
     * request with the specified FromDate and ToDate will be added.)
     *
     * *  Delete (Deletes the scheduled request for the same From and To date)
     *
     * *  DeleteAll (Deletes all the scheduled requests for the given card)
     *
     *
     *
     * > Requests that passed the below validations are queue:
     *
     * *  All Mandatory fields are passed in the request.
     *
     * *  Card is present in the Shell Card Platform. Only one matching card is available in the cards
     * platform for the given PAN and expiry date for the requests
     *
     * *  The scheduled period start date or end date should be later than or equal to the current date.
     *
     *
     *
     * > If all validations are passed, the request will be accepted and saved in the intermediate queue
     * and the API will return reference numbers for tracking purpose.
     *
     *
     *
     * > A background service will execute the block/unblock requests on a daily basis, based on the
     * scheduled block or unblock date.
     *
     *
     *
     *
     *
     * *  The newly added block/unblock request will have a status ‘A’ when it is yet to be moved to the
     * actual queue.
     *
     * *  When the request is moved to the actual queue table, the status will be updated as ‘P’ if the
     * request has a value for ‘ToDate’, else, the status will be updated as ‘S’ or ‘F’ based on whether
     * the request has been successfully moved to the actual queue table or if an error is encountered
     * during processing.
     *
     *
     *
     * *  When the unblock request is moved to the actual queue table, the status of the request will be
     * changed from ‘P’ to ‘S’ or ‘F’ based on whether the request has been successfully moved to the
     * actual queue table or if an error has occurred during processing.
     *
     *
     *
     *
     *
     * > If any of the validations fail, the API will return the appropriate error details in the response.
     *
     * > The API response will include:
     *
     * *  An error entity holding the details of any error encountered.
     *
     * * A list of submitted cards along with the individual reference numbers for each of the request.
     *
     * @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
     */
    CardController.prototype.scheduleCardBlock = 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-management/v1/schedulecardblock');
                mapped = req.prepareArgs({
                    requestId: [requestId, (0, schema_1.string)()],
                    body: [body, (0, schema_1.optional)(scheduleCardBlockRequest_1.scheduleCardBlockRequestSchema)]
                });
                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 error (e.g., malformed request syntax, invalid 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, 'Forbidden');
                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 that  prevented it from fulfilling the request.');
                req.authenticate([{ bearerToken: true }]);
                return [2 /*return*/, req.callAsJson(scheduleCardBlockResponse_1.scheduleCardBlockResponseSchema, requestOptions)];
            });
        });
    };
    /**
     * This API allows to update the reissue indicator of a single card. If the API call succeeds, the API
     * will return a reference number for tracking purposes and queue the request for asynchronous
     * processing.
     *
     * #### Supported operations
     *
     * * Update the reissue indicator of a card to enable auto renewal
     *
     * * Update the reissue indicator of a card to disable auto renewal
     *
     *
     *
     * #### Validation rules
     *
     * * Card status must be either Active, Temporary Block (Customer), Temporary Block (Shell) or
     * Pending Renewal, otherwise an error code 9016 is returned
     *
     *
     *
     * #### API response
     *
     * * Returns a reference number for the API request (**AutoRenewReference**)
     *
     *
     *
     * #### Asynchronous processing of valid API request
     *
     * * If the provided card is superseded i.e. a replacement/new card is already issued, then the
     * latest card's reissue indicator should be updated in the Shell Card Platform.
     *
     * * Providing a **PAN** request paramter may result in multiple fuel cards being located in the
     * Shell Card Platform. The card details of the most recently issued card will be considered.
     *
     * @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         Auto renew request body
     * @return Response from the API call
     */
    CardController.prototype.autoRenew = 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-management/v1/autorenew');
                mapped = req.prepareArgs({
                    requestId: [requestId, (0, schema_1.string)()],
                    body: [body, (0, schema_1.optional)(autoRenewCardRequest_1.autoRenewCardRequestSchema)]
                });
                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 error (e.g., malformed request syntax, invalid 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, 'Forbidden');
                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 that  prevented it from fulfilling the request.');
                req.authenticate([{ bearerToken: true }]);
                return [2 /*return*/, req.callAsJson(autoRenewCardResponse_1.autoRenewCardResponseSchema, requestOptions)];
            });
        });
    };
    /**
     * This operation allows  update the approval status of Mobile Payment Registration requests requiring
     * for Fleet Manager approval.
     *
     * If the approval status is:
     *
     * *    “Approved” then the request status will be changed to Pending for processing.
     *
     * *    “Rejected” then status will be updated to “CI” (Failed) with appropriate error message.
     *
     *
     *
     * @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
     */
    CardController.prototype.updateMobilePaymentRegistrationStatus = 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-management/v1/updatemobilepaymentregistrationstatus');
                mapped = req.prepareArgs({
                    requestId: [requestId, (0, schema_1.string)()],
                    body: [body, (0, schema_1.optional)(updateMPayRegStatusRequest_1.updateMPayRegStatusRequestSchema)]
                });
                req.header('RequestId', mapped.requestId);
                req.header('Content-Type', 'application/json');
                req.json(mapped.body);
                req.throwOn(400, errorObjectError_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, 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, 'Forbidden');
                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 that  prevented it from fulfilling the request.');
                req.authenticate([{ bearerToken: true }]);
                return [2 /*return*/, req.callAsJson(updateMPayRegStatusResponse_1.updateMPayRegStatusResponseSchema, requestOptions)];
            });
        });
    };
    /**
     * Get a new public key that will be used to encrypt data for selected PIN process when ordering new
     * Shell Card. This encrypted data is used for further processing.
     *
     * @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 fleet     If the public key will be used a long time for multiple files this parameter will be
     *                             true. If the parameter is true then public Key will be valid for 90 days. If the
     *                             parameter is false then the key will be valid for one time. default value will be
     *                             false.
     * @return Response from the API call
     */
    CardController.prototype.getKey = function (requestId, fleet, requestOptions) {
        return tslib_1.__awaiter(this, void 0, void 0, function () {
            var req, mapped;
            return tslib_1.__generator(this, function (_a) {
                req = this.createRequest('GET', '/pin-management/v1/generatepinkeys');
                mapped = req.prepareArgs({
                    requestId: [requestId, (0, schema_1.string)()],
                    fleet: [fleet, (0, schema_1.optional)((0, schema_1.boolean)())]
                });
                req.header('RequestId', mapped.requestId);
                req.query('fleet', mapped.fleet);
                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([{ bearerToken: true }]);
                return [2 /*return*/, req.callAsJson(generatePINKeyResponse_1.generatePINKeyResponseSchema, requestOptions)];
            });
        });
    };
    /**
     * This API allows users to update the card’s delivery addresses (card delivery address used for card
     * re-issue and PIN delivery address used when PIN reminder is requested)
     * #### Supported operations
     *
     * * card delivery address update
     *
     * @param apikey       This is the API key of the specific environment which
     *                                                            needs to be passed by the client.
     * @param body         Delivery Address Update Request Body
     * @return Response from the API call
     */
    CardController.prototype.deliveryAddressUpdate = function (apikey, 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/card/deliveryaddressupdate');
                mapped = req.prepareArgs({
                    apikey: [apikey, (0, schema_1.string)()],
                    body: [body, (0, schema_1.optional)(deliveryAddressUpdateRequest_1.deliveryAddressUpdateRequestSchema)]
                });
                req.header('apikey', mapped.apikey);
                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(deliveryAddressUpdateResponse_1.deliveryAddressUpdateResponseSchema, requestOptions)];
            });
        });
    };
    return CardController;
}(baseController_1.BaseController));
exports.CardController = CardController;
//# sourceMappingURL=cardController.js.map