digital-payments-sdk
Version:
The APIs detailed within this SDK will enable Shell's Fleet Solutions Customers to digitalize Shell Card/s and use them to pay to refuel their vehicles at Shell Stations.
58 lines • 3.33 kB
JavaScript
;
/**
* Shell SmartPay APILib
*
* This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
*/
exports.__esModule = true;
exports.ShellAPIPlatformSecurityAuthenticationController = void 0;
var tslib_1 = require("tslib");
var accessTokenResponse_1 = require("../models/accessTokenResponse");
var schema_1 = require("../schema");
var baseController_1 = require("./baseController");
var accessTokenError_1 = require("../errors/accessTokenError");
var ShellAPIPlatformSecurityAuthenticationController = /** @class */ (function (_super) {
tslib_1.__extends(ShellAPIPlatformSecurityAuthenticationController, _super);
function ShellAPIPlatformSecurityAuthenticationController() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* To obtain APIGEE access token
*
* @param grantType In OAuth 2.0, the term grant typee refers to the way an application gets an access
* token. OAuth 2.0 defines several grant types, including the authorization code flow.
* @param clientId After registering your app, you will receive a client ID and a client secret. The
* client ID is considered public information, and is used to build login URLs, or
* included in Javascript source code on a page.
* @param clientSecret After registering your app, you will receive a client ID and a client secret. The
* client ID is considered public information, and is used to build login URLs, or
* included in Javascript source code on a page. The client secret must be kept
* confidential.
* @return Response from the API call
*/
ShellAPIPlatformSecurityAuthenticationController.prototype.oauthTokenPost = function (grantType, clientId, clientSecret, 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', '/oauth/token');
mapped = req.prepareArgs({
grantType: [grantType, (0, schema_1.string)()],
clientId: [clientId, (0, schema_1.string)()],
clientSecret: [clientSecret, (0, schema_1.string)()]
});
req.header('Content-Type', 'application/x-www-form-urlencoded');
req.form({
grant_type: mapped.grantType,
client_id: mapped.clientId,
client_secret: mapped.clientSecret
});
req.throwOn(401, accessTokenError_1.AccessTokenError, 'Unauthorized');
req.authenticate([]);
return [2 /*return*/, req.callAsJson(accessTokenResponse_1.accessTokenResponseSchema, requestOptions)];
});
});
};
return ShellAPIPlatformSecurityAuthenticationController;
}(baseController_1.BaseController));
exports.ShellAPIPlatformSecurityAuthenticationController = ShellAPIPlatformSecurityAuthenticationController;
//# sourceMappingURL=shellAPIPlatformSecurityAuthenticationController.js.map