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

100% Statements 4/4
100% Branches 0/0
50% Functions 1/2
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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 535x 5x                     5x                                                                     1x          
import { url } from "../shared/url";
import { WalletApi } from "./api";
import type { IdentificationBase, IdentificationResponse } from "./wallet.types";
 
/**
 * # Идентификация
 * [Документация QIWI] (https://developer.qiwi.com/ru/qiwi-wallet-personal/#identification)
 *
 * @export
 * @class WalletIdentificationApi
 * @extends {WalletApi}
 */
export class WalletIdentificationApi extends WalletApi {
  /**
   * # Идентификация пользователя
   *
   * Данный запрос позволяет отправить данные для идентификации
   * вашего QIWI кошелька.
   *
   * **Этот метод требует наличия валидного `walletId` (номера телефона привязанного к кошельку) в конфигурации API.**
   *
   * @param {IdentificationBase} data
   * @return {Promise<IdentificationResponse>} Promise<IdentificationResponse>
   * @memberof WalletIdentificationApi
   */
  async set(data: IdentificationBase): Promise<IdentificationResponse> {
    // Тесты не могут покрыть этот метод. Он - деструктивный
    // Он не может быть вызван много раз
    /* istanbul ignore next */
    return await this.http.post(
      url`identification/v1/persons/${this.walletId}/identification`(),
      data
    );
  }
 
  /**
   * # Данные идентификации
   *
   * Данный запрос позволяет выгрузить маскированные данные и
   * статус идентификации своего QIWI кошелька.
   *
   * **Этот метод требует наличия валидного `walletId` (номера телефона привязанного к кошельку) в конфигурации API.**
   *
   * @return {Promise<IdentificationResponse>} Promise<IdentificationResponse>
   * @memberof WalletIdentificationApi
   */
  async get(): Promise<IdentificationResponse> {
    return await this.http.get(
      url`identification/v1/persons/${this.walletId}/identification`()
    );
  }
}