UNPKG

nimbbl-mobile-react-native-sdk

Version:

Nimbbl React Native SDK for payment integration

109 lines 3.43 kB
/** * @fileoverview Main Nimbbl SDK for React Native * @version 1.0.0 * @author Nimbbl Tech * * This is a wrapper around the native Android and iOS SDKs */ import { SDKConfig } from './types'; /** * Main Nimbbl SDK Class * Provides the primary interface for integrating Nimbbl payment functionality * This wrapper matches the native iOS/Android SDK patterns */ export default class NimbblSDK { private static shared; private config; private isInitialized; private eventEmitter; private eventListeners; private eventSubscriptions; constructor(); /** * Get shared instance (matching iOS pattern) */ static getSharedInstance(): NimbblSDK; /** * Test native module availability */ testNativeModule(): Promise<any>; /** * Initialize the SDK with configuration * @param config - SDK configuration object * @returns Promise resolving to initialization result */ initialize(config: SDKConfig): Promise<{ success: boolean; message: string; }>; /** * Set environment URL for the SDK * @param url - Environment URL to set */ setEnvironmentUrl(url: string): void; /** * Create shop order (matching iOS SDK pattern) * @param currency - Currency code * @param amount - Order amount * @param productId - Product ID for header customization * @param orderLineItems - Whether to enable order line items * @param checkoutExperience - Checkout experience type * @param paymentMode - Payment mode code * @param subPaymentMode - Sub payment mode code * @param user - User details object * @returns Promise resolving to order response */ createShopOrder(currency: string, amount: string, productId: string, orderLineItems: boolean, checkoutExperience: string, paymentMode: string, subPaymentMode: string, user?: Record<string, any>): Promise<{ success: boolean; data?: any; error?: any; }>; /** * Checkout with options (matching iOS SDK pattern) * @param options - Checkout options * @returns Promise resolving to checkout result */ checkout(options: { orderToken: string; paymentModeCode?: string; bankCode?: string; walletCode?: string; paymentFlow?: string; }): Promise<{ success: boolean; message?: string; }>; /** * Add event listener for native events * @param eventName - Event name to listen for * @param listener - Event listener function */ addEventListener(eventName: string, listener: (event: any) => void): void; /** * Remove event listener * @param eventName - Event name * @param listener - Event listener function to remove */ removeEventListener(eventName: string, listener: (event: any) => void): void; /** * Remove all event listeners */ removeAllEventListeners(): void; /** * Get SDK configuration * @returns Current SDK configuration */ getConfig(): SDKConfig | null; /** * Get initialization status * @returns Whether the SDK is initialized */ isSDKInitialized(): boolean; /** * Validate SDK configuration * @param config - Configuration to validate */ private validateConfig; } export declare const nimbblSDK: NimbblSDK; //# sourceMappingURL=NimbblSDK.d.ts.map