UNPKG

@bunq-community/bunq-js-client

Version:

[![NPM Version](https://img.shields.io/npm/v/@bunq-community/bunq-js-client.svg) ](https://github.com/@bunq-community/bunq-js-client) [![NPM Downloads](https://img.shields.io/npm/dt/@bunq-community/bunq-js-client.svg) ](https://www.npmjs.com/package/@bun

48 lines (47 loc) 1.85 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class CardCvc2 { /** * @param {ApiAdapter} ApiAdapter */ constructor(ApiAdapter) { this.ApiAdapter = ApiAdapter; this.Session = ApiAdapter.Session; } /** * @param {number} userId * @param {number} monetaryAccountId * @param {number} requestResponseId * @returns {Promise<any>} */ async get(userId, cardId, cvc2Id) { const limiter = this.ApiAdapter.RequestLimitFactory.create("/generated-cvc2", "GET"); const response = await limiter.run(async (axiosClient) => this.ApiAdapter.get(`/v1/user/${userId}/card/${cardId}/generated-cvc2/${cvc2Id}`, {}, {}, axiosClient)); return response.Response[0]; } /** * @param {number} userId * @param {number} cardId * @param {any} options * @returns {Promise<any>} */ async list(userId, cardId, options = {}) { const limiter = this.ApiAdapter.RequestLimitFactory.create("/generated-cvc2", "LIST"); const response = await limiter.run(async (axiosClient) => this.ApiAdapter.get(`/v1/user/${userId}/card/${cardId}/generated-cvc2`, {}, {}, axiosClient)); return response.Response; } /** * @param {number} userId * @param {number} cardId * @param {"STATIC" | "GENERATED"} type * @returns {Promise<void>} */ async post(userId, cardId, type = "GENERATED", options = {}) { const limiter = this.ApiAdapter.RequestLimitFactory.create("/generated-cvc2", "POST"); const response = await limiter.run(async (axiosClient) => this.ApiAdapter.post(`/v1/user/${userId}/card/${cardId}/generated-cvc2`, { type: type }, {}, { isEncrypted: true }, axiosClient)); return response.Response[0]; } } exports.default = CardCvc2;