UNPKG

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.

46 lines (45 loc) 1.66 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.OmniCapitalPayment = void 0; // Package Imports const bc_omnicapital_sdk_1 = require("bc-omnicapital-sdk"); const BasePaymentProvider_1 = require("../../base/entity/BasePaymentProvider"); /** * Class {OmniCapitalPayment} is a concrete implementation of a payment provider. * It provides a set of methods that can be used to interact with the OmniCapital payment gateway. * * @class OmniCapitalPayment * @extends {BasePaymentProvider} * @implements {IPaymentProvider} */ class OmniCapitalPayment extends BasePaymentProvider_1.BasePaymentProvider { async initPaymentIntent(data) { try { if (super.initSDK()) { const intentResult = await new bc_omnicapital_sdk_1.Transaction().request(data); return intentResult; } return null; } catch (error) { return { hasError: true, error: error === null || error === void 0 ? void 0 : error.message }; } } requestPayment(data) { throw new Error("Method not implemented."); } async getOrderDetails(data) { try { if (super.initSDK()) { const payment = new bc_omnicapital_sdk_1.Transaction(); const orderDetailsResult = await payment.getDetails(data); return orderDetailsResult; } return null; } catch (error) { return { hasError: true, error: error === null || error === void 0 ? void 0 : error.message }; } } } exports.OmniCapitalPayment = OmniCapitalPayment;