All files / src/apis/wallet limits.api.ts

100% Statements 4/4
100% Branches 0/0
100% Functions 1/1
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 385x 5x                     5x                                   1x              
import { url } from "../shared/url";
import { WalletApi } from "./api";
import type { LimitsResponse, LimitTypeAny } from "./wallet.types";
 
/**
 * # Лимиты QIWI Кошелька
 * [Документация QIWI](https://developer.qiwi.com/ru/qiwi-wallet-personal/#limits)
 *
 * @export
 * @class WalletLimitsApi
 * @extends {WalletApi}
 */
export class WalletLimitsApi extends WalletApi {
  /**
   * ## Лимиты QIWI Кошелька
   *
   * Запрос возвращает текущие уровни лимитов по операциям в
   * вашем QIWI кошельке. Лимиты действуют как ограничения на
   * сумму определенных операций.
   *
   * **Этот метод требует наличия валидного `walletId` (номера телефона привязанного к кошельку) в конфигурации API.**
   *
   * @template {LimitTypeAny[]} Limits
   * @param {Limits} limits
   * @return {Promise<LimitsResponse>} Promise<LimitsResponse<Limits[number]>>
   * @memberof WalletLimitsApi
   */
  async get<Limits extends LimitTypeAny[] = LimitTypeAny[]>(
    limits: Limits
  ): Promise<LimitsResponse<Limits[number]>> {
    return await this.http.get(
      url`qw-limits/v1/persons/${this.walletId}/actual-limits`({
        types: limits
      })
    );
  }
}