UNPKG

sdksio-postnl-ecommerce-apis-sdk

Version:

Collection of PostNL API's for ecommerce processes

49 lines 2.72 kB
"use strict"; /** * PostNL Ecommerce APIsLib * * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). */ exports.__esModule = true; exports.CheckoutController = void 0; var tslib_1 = require("tslib"); var checkoutResponseError_1 = require("../errors/checkoutResponseError"); var checkoutResponseInvalidError_1 = require("../errors/checkoutResponseInvalidError"); var postCIFCheckoutServiceMethodNotAllowedError_1 = require("../errors/postCIFCheckoutServiceMethodNotAllowedError"); var postCIFCheckoutServiceTooManyRequestError_1 = require("../errors/postCIFCheckoutServiceTooManyRequestError"); var postCIFCheckoutServiceUnauthorizedError_1 = require("../errors/postCIFCheckoutServiceUnauthorizedError"); var checkoutRequest_1 = require("../models/checkoutRequest"); var checkoutResponse_1 = require("../models/checkoutResponse"); var baseController_1 = require("./baseController"); var CheckoutController = /** @class */ (function (_super) { tslib_1.__extends(CheckoutController, _super); function CheckoutController() { return _super !== null && _super.apply(this, arguments) || this; } /** * Checkout * * @param body * @return Response from the API call */ CheckoutController.prototype.checkout = function (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', '/shipment/v1/checkout'); mapped = req.prepareArgs({ body: [body, checkoutRequest_1.checkoutRequestSchema] }); req.header('Content-Type', 'application/json'); req.json(mapped.body); req.throwOn(400, checkoutResponseInvalidError_1.CheckoutResponseInvalidError, 'Invalid request'); req.throwOn(401, postCIFCheckoutServiceUnauthorizedError_1.PostCIFCheckoutServiceUnauthorizedError, 'Invalid apikey'); req.throwOn(405, postCIFCheckoutServiceMethodNotAllowedError_1.PostCIFCheckoutServiceMethodNotAllowedError, 'Method not allowed'); req.throwOn(429, postCIFCheckoutServiceTooManyRequestError_1.PostCIFCheckoutServiceTooManyRequestError, 'Too many requests'); req.throwOn(500, checkoutResponseError_1.CheckoutResponseError, 'Internal server error'); return [2 /*return*/, req.callAsJson(checkoutResponse_1.checkoutResponseSchema, requestOptions)]; }); }); }; return CheckoutController; }(baseController_1.BaseController)); exports.CheckoutController = CheckoutController; //# sourceMappingURL=checkoutController.js.map