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.

95 lines (94 loc) 5.38 kB
import { IGetGooglePayMerchantInfoJwtResponse, IGetTransactionDetailsResponse } from "bc-nuvei-sdk"; import { INuveiPaymentProvider } from "../../base/contracts/GatewayProviders/INuveiPaymentProvider"; import { IPaymentProvider } from "../../base/contracts/IPaymentProvider"; import { BasePaymentProvider } from "../../base/entity/BasePaymentProvider"; export declare class NuveiPayment extends BasePaymentProvider implements IPaymentProvider, INuveiPaymentProvider { /** * Requests a token from the Nuvei payment provider. * * This method receives a merchant’s authentication details * and returns a unique session token (sessionToken). * sessionToken is used throughout the payment session as an authentication token. * _____ * Nuvei * ‾‾‾‾‾ * API Reference - https://docs.nuvei.com/api/main/indexMain_v1_0.html?json#getSessionToken * * @param data - The data required for creating a session with Nuvei. * @returns A promise that resolves to the result of the session creation * or an object with error details if an error occurs. */ requestToken(data: any): Promise<any>; /** * Requests a token from the Nuvei payment provider. * * Calling the server-side /openOrder API request is the first step in a Web SDK or Simply Connect flow. * /openOrder authenticates your Nuvei merchant credentials, sets up an order in the Nuvei system, and returns a sessionToken. * * sessionToken must be included in all subsequent Web SDK and Simply Connect method calls in that session, * such as for createPayment() or checkout(). * * /openOrder also allows you to set user-related parameters such as shipping details and billing details. * Using the preventOverride parameter either allows or prevents subsequent Web SDK and Simply Connect * method calls from overriding these user-related parameters. * * API Reference - https://docs.nuvei.com/api/main/indexMain_v1_0.html?json#openorder * * @param data - The data required for creating a session with Nuvei. * @returns A promise that resolves to the result of the session creation * or an object with error details if an error occurs. */ initPaymentIntent(data: any): Promise<any>; requestPayment(data: any): void; /** * This method retrieves the status of a payment recently performed. It receives the session ID and queries if a payment was performed. * If a payment was performed, the method returns the status of this payment. * * Use /getPaymentStatus when you need to retrieve the status of a payment to verify a payment response or * to check if the response was not received or was not received correctly or completely. * * API Reference - https://docs.nuvei.com/api/main/indexMain_v1_0.html?json#getPaymentStatus * * @param data - The order ID for which details should be retrieved. * @returns A promise that resolves to the result of the order details retrieval * or an object with error details if an error occurs. */ getOrderDetails(data: any): Promise<any>; /** * Gets detailed information about a specific transaction. * Can query by either transactionId or clientUniqueId. * If multiple transactions share the same clientUniqueId, only the most recent is returned. * * API Reference - https://docs.nuvei.com/api/main/indexMain_v1_0.html?json#getTransactionDetails * * @param {Object} params The query parameters * @param {string} params.transactionId - The Gateway transaction ID (conditional - either this or clientUniqueId required) * @param {string} params.clientUniqueId - The unique transaction ID in merchant system (conditional - either this or transactionId required) * @returns {Promise<IGetTransactionDetailsResponse>} A promise resolving to the transaction details */ getTransactionDetails(data: any): Promise<IGetTransactionDetailsResponse | any>; requestGooglePayToken(data: any): Promise<IGetGooglePayMerchantInfoJwtResponse | any>; /** * Gets the list of registered Google Pay domains for the merchant. * This endpoint retrieves all domains that are currently registered for Google Pay processing. * * API Reference - https://docs.nuvei.com/api/advanced/indexAdvanced.html?json#getRegisteredGooglePayDomains * * @param {Object} params The parameters for retrieving registered domains * @param {string[]} params.domainNames - Optional array of specific domains to query. If not provided, returns all registered domains. * @returns {Promise<IGetRegisteredGooglePayDomainsResponse>} A promise resolving to the response with the list of registered domains * * @example * // Get all registered domains * const result = await transaction.getRegisteredGooglePayDomains(); * console.log('Registered domains:', result.domainNames); * * @example * // Query specific domains * const result = await transaction.getRegisteredGooglePayDomains({ * domainNames: ["www.example.com", "mobile.example.com"] * }); * console.log('Queried domains:', result.domainNames); */ getRegisteredDomains(data: any): Promise<IGetGooglePayMerchantInfoJwtResponse | any>; }