UNPKG

react-native-plugpag-nitro

Version:

High-performance React Native library for PagSeguro PlugPag payment terminals with TypeScript-first hooks API, real-time events, and 10x faster performance using Nitro Modules

69 lines 2.24 kB
/** * Utility functions for PlugPag Nitro */ import { PaymentType, InstallmentType, ErrorCode, type PaymentOptions } from './index'; /** * Format amount from cents to currency string * @param amountInCents Amount in cents (e.g., 2500 = R$ 25,00) * @param locale Locale for formatting (default: pt-BR) * @param currency Currency code (default: BRL) */ export declare function formatCurrency(amountInCents: number, locale?: string, currency?: string): string; /** * Convert currency string to cents * @param currencyString Currency string (e.g., "R$ 25,00") * @returns Amount in cents */ export declare function parseCurrency(currencyString: string): number; /** * Create a standardized payment options object * @param amount Amount in cents * @param type Payment type * @param options Additional options */ export declare function createPaymentOptions(amount: number, type: PaymentType, options?: { installments?: number; installmentType?: InstallmentType; printReceipt?: boolean; userReference?: string; }): PaymentOptions; /** * Predefined payment options for common scenarios */ export declare const PaymentPresets: { /** * Create credit card payment options */ credit: (amountInCents: number, installments?: number, userReference?: string) => PaymentOptions; /** * Create debit card payment options */ debit: (amountInCents: number, userReference?: string) => PaymentOptions; /** * Create PIX payment options */ pix: (amountInCents: number, userReference?: string) => PaymentOptions; /** * Create voucher payment options */ voucher: (amountInCents: number, userReference?: string) => PaymentOptions; }; /** * Validate payment result * @param result Transaction result * @returns true if payment was successful */ export declare function isPaymentSuccessful(result: { result?: ErrorCode; }): boolean; /** * Get human-readable error message from result * @param result Transaction result * @returns Error message or null if successful */ export declare function getPaymentErrorMessage(result: { result?: number; message?: string; errorMessage?: string; }): string | null; //# sourceMappingURL=utils.d.ts.map