bc-payments-sdk
Version:
BetterCommerce's Payments NodeJS SDK is a complete solution for storefront clients that integrate payments. `bc-payments-sdk` is a single point interface for storefront clients for interacting with payment gateways.
48 lines (47 loc) • 1.9 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ElavonPayment = void 0;
const bc_elavon_sdk_1 = require("bc-elavon-sdk");
const BasePaymentProvider_1 = require("../../base/entity/BasePaymentProvider");
class ElavonPayment extends BasePaymentProvider_1.BasePaymentProvider {
/**
* Requests a token from the Elavon payment provider.
*
* This method initializes the SDK and attempts to create a session
* with the provided data. If successful, it returns the result of the
* session creation. If the SDK initialization fails, it returns null.
* In case of an error during the process, it returns an object containing
* the error details.
* ______
* ELAVON
* ‾‾‾‾‾‾
* API Reference - https://developer.elavon.com/products/hosted-payment-page/v1/api-reference#tag/Request-Session-Token/operation/session-token
*
* @param data - The data required for creating a session with Elavon.
* @returns A promise that resolves to the result of the session creation
* or an object with error details if an error occurs.
*/
async requestToken(data) {
try {
if (super.initSDK()) {
const session = new bc_elavon_sdk_1.Session();
const requestTokenResult = await session.create(data);
return requestTokenResult;
}
return null;
}
catch (error) {
return { hasError: true, error: error === null || error === void 0 ? void 0 : error.message };
}
}
initPaymentIntent(data) {
throw new Error("Method not implemented.");
}
requestPayment(data) {
throw new Error("Method not implemented.");
}
getOrderDetails(data) {
throw new Error("Method not implemented.");
}
}
exports.ElavonPayment = ElavonPayment;