UNPKG

expresscheckout-nodejs

Version:

Juspay's official expresscheckout-nodejs sdk

53 lines (52 loc) 2.07 kB
/// <reference types="node" /> /// <reference types="node" /> import * as http from 'http'; import * as https from 'https'; import { JuspayEnvironment } from './JuspayEnvironment.js'; import * as Types from './types/index.js'; declare namespace JuspayResource { type AuthMethod = 'JWE' | 'SIGNATURE' | 'BASIC'; } declare abstract class JuspayResource { private logger; protected juspayEnvironment: JuspayEnvironment; constructor(juspayEnv: JuspayEnvironment); protected makeServiceCall({ method, path, headers, body, timeout, query, juspayOverrideConfig, auth, opts, }: { method: 'POST' | 'GET' | 'DELETE' | 'PUT'; path: string; headers?: Types.RequestHeaders; query?: Types.RequestEntity; body?: Types.RequestEntity; timeout?: number; juspayOverrideConfig?: Types.JuspayConfig; /** * Array to specify auth methods * even if BASIC is not there and authPriority is not ordered in auth list it defaults to BASIC * @default if authPriority is 'default': then 'BASIC' else any * @example ['BASIC', 'JWE', 'SIGNATURE'] */ auth?: JuspayResource.AuthMethod[]; opts?: { /** * send this if jwe path differs from default path * @default /v4 + path */ jwePath?: string; /** * ordered:- priority is given by order of auth array * default:- priority is JWE > SIGNATURE > BASIC * auth decider will always fallback on BASIC * @default default */ authPriority?: 'ordered' | 'default'; agent?: http.Agent | https.Agent | undefined; }; }): Promise<Types.HttpResponse>; protected authDecider(juspayEnvironment: JuspayEnvironment, auth: JuspayResource.AuthMethod[], opts: { jwePath?: string | undefined; authPriority?: 'ordered' | 'default' | undefined; }): JuspayResource.AuthMethod; } export default JuspayResource;