UNPKG

pesapal-node-sdk

Version:

Node.js SDK for integrating with Pesapal payment gateway. Provides a simple interface for processing payments, checking status, and handling callbacks.

27 lines 925 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.HttpClient = void 0; const axios_1 = __importDefault(require("axios")); class HttpClient { constructor(config) { this.config = config; this.client = axios_1.default.create({ baseURL: this.config.apiUrl, headers: { 'Content-Type': 'application/json' } }); } async post(url, data, token) { const headers = token ? { Authorization: `Bearer ${token}` } : {}; return this.client.post(url, data, { headers }); } async get(url, token) { return this.client.get(url, { headers: { Authorization: `Bearer ${token}` } }); } } exports.HttpClient = HttpClient; //# sourceMappingURL=HttpClient.js.map