import { AxiosInstance, AxiosRequestConfig } from 'axios'; import { RateLimitedAxiosInstance } from 'axios-rate-limit'; import { YooKassaErrResponse } from '../types/api.types'; /** * Данные для подключения к API YooKassa */ export type ConnectorOpts = { /** * Идентификатор магазина */ shop_id: string; /** * Секретный ключ */ secret_key: string; /** * Эндпоинт API * @default "https://api.yookassa.ru/v3/" */ endpoint?: string; /** Отладочный режим */ debug: boolean; /** URL для редиректа */ redirect_url?: string; /** Количество запросов в секунду * @default 5 */ maxRPS?: number; }; export declare const endpoints: { refunds: { create: { method: string; endpoint: string; description: string; }; list: { method: string; endpoint: string; description: string; }; info: { method: string; endpoint: string; description: string; }; }; payments: { create: { method: string; endpoint: string; }; list: { method: string; endpoint: string; }; info: { method: string; endpoint: string; }; capture: { method: string; endpoint: string; }; cancel: { method: string; endpoint: string; }; }; receipts: { create: { method: string; endpoint: string; description: string; }; list: { method: string; endpoint: string; description: string; }; info: { method: string; endpoint: string; description: string; }; }; }; interface IGenReqOpts
{ method: 'GET' | 'POST' | 'DELETE'; endpoint: string; params?: P; maxRPS?: number; requestId?: string; debug?: boolean; } export type GetRequestOpts
> = IGenReqOpts
& { method: 'GET'; }; export type PostRequestOpts
, D = Record & {
method: 'POST';
data: D;
};
export type RequestOpts , D = Record | PostRequestOpts ;
type BadApiResponse = {
success: 'NO_OK';
errorData: YooKassaErrResponse;
requestId: string;
};
type GoodApiResponse