@adyen/api-library
Version:
The Adyen API Library for NodeJS enables you to work with Adyen APIs.
108 lines • 7.01 kB
JavaScript
;
/*
* The version of the OpenAPI document: v2
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CardOrdersApi = void 0;
const getJsonResponse_1 = __importDefault(require("../../helpers/getJsonResponse"));
const service_1 = __importDefault(require("../../service"));
const resource_1 = __importDefault(require("../resource"));
const objectSerializer_1 = require("../../typings/balancePlatform/objectSerializer");
/**
* API handler for CardOrdersApi
*/
class CardOrdersApi extends service_1.default {
constructor(client) {
super(client);
this.API_BASEPATH = "https://balanceplatform-api-test.adyen.com/bcl/v2";
this.baseUrl = this.createBaseUrl(this.API_BASEPATH);
}
/**
* @summary Get card order items
* @param id {@link string } The unique identifier of the card order.
* @param requestOptions {@link IRequest.Options }
* @param offset {@link number } Specifies the position of an element in a list of card orders. The response includes a list of card order items that starts at the specified offset. **Default:** 0, which means that the response contains all the elements in the list of card order items.
* @param limit {@link number } The number of card order items returned per page. **Default:** 10.
* @return {@link PaginatedGetCardOrderItemResponse }
*/
async getCardOrderItems(id, offset, limit, requestOptions) {
const endpoint = `${this.baseUrl}/cardorders/{id}/items`
.replace("{" + "id" + "}", encodeURIComponent(String(id)));
const resource = new resource_1.default(this, endpoint);
const hasDefinedQueryParams = offset !== null && offset !== void 0 ? offset : limit;
if (hasDefinedQueryParams) {
if (!requestOptions)
requestOptions = {};
if (!requestOptions.params)
requestOptions.params = {};
if (offset)
requestOptions.params["offset"] = offset;
if (limit)
requestOptions.params["limit"] = limit;
}
const response = await (0, getJsonResponse_1.default)(resource, "", { ...requestOptions, method: "GET" });
return objectSerializer_1.ObjectSerializer.deserialize(response, "PaginatedGetCardOrderItemResponse");
}
/**
* @summary Get a list of card orders
* @param requestOptions {@link IRequest.Options }
* @param id {@link string } The unique identifier of the card order.
* @param cardManufacturingProfileId {@link string } The unique identifier of the card manufacturer profile.
* @param status {@link string } The status of the card order.
* @param txVariantCode {@link string } The unique code of the card manufacturer profile. Possible values: **mcmaestro**, **mc**, **visa**, **mcdebit**.
* @param createdSince {@link Date } Only include card orders that have been created on or after this point in time. The value must be in ISO 8601 format. For example, **2021-05-30T15:07:40Z**.
* @param createdUntil {@link Date } Only include card orders that have been created on or before this point in time. The value must be in ISO 8601 format. For example, **2021-05-30T15:07:40Z**.
* @param lockedSince {@link Date } Only include card orders that have been locked on or after this point in time. The value must be in ISO 8601 format. For example, **2021-05-30T15:07:40Z**.
* @param lockedUntil {@link Date } Only include card orders that have been locked on or before this point in time. The value must be in ISO 8601 format. For example, **2021-05-30T15:07:40Z**.
* @param serviceCenter {@link string } The service center at which the card is issued. The value is case-sensitive.
* @param offset {@link number } Specifies the position of an element in a list of card orders. The response includes a list of card orders that starts at the specified offset. **Default:** 0, which means that the response contains all the elements in the list of card orders.
* @param limit {@link number } The number of card orders returned per page. **Default:** 10.
* @return {@link PaginatedGetCardOrderResponse }
*/
async listCardOrders(id, cardManufacturingProfileId, status, txVariantCode, createdSince, createdUntil, lockedSince, lockedUntil, serviceCenter, offset, limit, requestOptions) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
const endpoint = `${this.baseUrl}/cardorders`;
const resource = new resource_1.default(this, endpoint);
const hasDefinedQueryParams = (_j = (_h = (_g = (_f = (_e = (_d = (_c = (_b = (_a = id !== null && id !== void 0 ? id : cardManufacturingProfileId) !== null && _a !== void 0 ? _a : status) !== null && _b !== void 0 ? _b : txVariantCode) !== null && _c !== void 0 ? _c : createdSince) !== null && _d !== void 0 ? _d : createdUntil) !== null && _e !== void 0 ? _e : lockedSince) !== null && _f !== void 0 ? _f : lockedUntil) !== null && _g !== void 0 ? _g : serviceCenter) !== null && _h !== void 0 ? _h : offset) !== null && _j !== void 0 ? _j : limit;
if (hasDefinedQueryParams) {
if (!requestOptions)
requestOptions = {};
if (!requestOptions.params)
requestOptions.params = {};
if (id)
requestOptions.params["id"] = id;
if (cardManufacturingProfileId)
requestOptions.params["cardManufacturingProfileId"] = cardManufacturingProfileId;
if (status)
requestOptions.params["status"] = status;
if (txVariantCode)
requestOptions.params["txVariantCode"] = txVariantCode;
if (createdSince)
requestOptions.params["createdSince"] = createdSince.toISOString();
if (createdUntil)
requestOptions.params["createdUntil"] = createdUntil.toISOString();
if (lockedSince)
requestOptions.params["lockedSince"] = lockedSince.toISOString();
if (lockedUntil)
requestOptions.params["lockedUntil"] = lockedUntil.toISOString();
if (serviceCenter)
requestOptions.params["serviceCenter"] = serviceCenter;
if (offset)
requestOptions.params["offset"] = offset;
if (limit)
requestOptions.params["limit"] = limit;
}
const response = await (0, getJsonResponse_1.default)(resource, "", { ...requestOptions, method: "GET" });
return objectSerializer_1.ObjectSerializer.deserialize(response, "PaginatedGetCardOrderResponse");
}
}
exports.CardOrdersApi = CardOrdersApi;
//# sourceMappingURL=cardOrdersApi.js.map