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.

49 lines (48 loc) 1.94 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ApplePayPayment = void 0; // Package Imports const bc_apple_pay_sdk_1 = require("bc-apple-pay-sdk"); const BasePaymentProvider_1 = require("../../base/entity/BasePaymentProvider"); /** * Class {ApplePayPayment} extends {BasePaymentProvider} and implements {IPaymentProvider} and {IApplePayPaymentProvider}. * It provides the concrete implementation of the Apple Pay payment provider. * * @class ApplePayPayment * @extends BasePaymentProvider * @implements {IPaymentProvider} * @implements {IApplePayPaymentProvider} * * @remark * This class is responsible for initializing the Apple Pay SDK and providing the concrete implementation of the Apple Pay payment provider methods. */ class ApplePayPayment extends BasePaymentProvider_1.BasePaymentProvider { /** * Validates the payment session using the Apple Pay SDK. * * @param data The Apple Pay session validation data. * @returns The result of the payment session validation. If the validation is successful, the result is the validated session object. Otherwise, the result is an error object with the error message. */ async validatePaymentSession(data) { try { if (super.initSDK()) { const validateResult = await new bc_apple_pay_sdk_1.Payment().validateSession(data); return validateResult; } return null; } catch (error) { return { hasError: true, error: error === null || error === void 0 ? void 0 : error.message }; } } async initPaymentIntent(data) { throw new Error("Method not implemented."); } async requestPayment(data) { throw new Error("Method not implemented."); } async getOrderDetails(data) { throw new Error("Method not implemented."); } } exports.ApplePayPayment = ApplePayPayment;