UNPKG

@hyperse/paypal-node-sdk

Version:

NodeJS SDK for PayPal Checkout APIs

48 lines (47 loc) 1.84 kB
import paypalhttp, { type HttpRequest } from '@paypal/paypalhttp'; import { AccessToken } from './AccessToken.js'; import { type HttpRequestBase } from './HttpRequestBase.js'; import { type PayPalEnvironment } from './PayPalEnvironment.js'; /** * PayPal Http client * Documentation * * @see {@link https://github.com/hyperse-io/paypal-node-sdk/tree/main/src/core/PayPalHttpClient.ts} */ export declare class PayPalHttpClient extends paypalhttp.HttpClient { private _cache; refreshToken?: string; private package; /** * @param environment - The environment for this client * @param refreshToken - The refreshToken to be used to generate the access Token. */ constructor(environment: PayPalEnvironment, refreshToken?: string); /** * An injector that fetches token when the client has no token or is expired and queues calls if the token is refreshing * @param {Object} request - The current request for the client * @return {Promise.<any>} Promise that fetches a new access Token */ private authInjector; /** * Returns the user agent for this client implementation * @override * @return {string} - The user agent string */ getUserAgent(): string; /** * Executes a request and returns a Promise * @param request Request Instance of HttpRequest * @returns */ execute<T = any>(request: HttpRequestBase<any, any>): Promise<paypalhttp.HttpResponse<T>>; _retryRequest(request: HttpRequest): Promise<paypalhttp.HttpResponse<any>>; fetchAccessToken(): Promise<AccessToken>; /** * Sets the Authorization header for this request based on the client token * @param {Object} request - The request to modify * @private * @return {void} */ _setAuthHeader(request: HttpRequest): void; }