ynkap-payment
Version:
Module de paiement Y-Nkap pour Angular - Intégration simple des paiements mobiles (Orange Money, MTN Mobile Money)
81 lines (80 loc) • 1.85 kB
TypeScript
/**
* Interface for Y-Nkap API Error
*/
export interface YnkapError {
/**
* Error code
*/
code: string;
/**
* Human-readable error message
*/
message: string;
/**
* Timestamp when the error occurred
*/
timestamp: Date;
/**
* Detailed information about the error
*/
details?: any;
/**
* Original error object if available
*/
originalError?: any;
/**
* HTTP status code associated with the error
*/
httpStatus?: number;
/**
* Indicates if the operation can be retried
*/
retryable?: boolean;
/**
* Suggested wait time in milliseconds before retrying
*/
retryAfterMs?: number;
}
/**
* Enum for error categories
*/
export declare enum ErrorCategory {
NETWORK = "NETWORK",
AUTHENTICATION = "AUTHENTICATION",
AUTHORIZATION = "AUTHORIZATION",
VALIDATION = "VALIDATION",
PAYMENT_PROCESSING = "PAYMENT_PROCESSING",
SERVER = "SERVER",
UNKNOWN = "UNKNOWN"
}
/**
* Interface for error retry options
*/
export interface RetryOptions {
/**
* Maximum number of retry attempts
*/
maxRetries: number;
/**
* Base time in milliseconds to wait between retries (will be used with exponential backoff)
*/
baseDelayMs: number;
/**
* Maximum time in milliseconds to wait between retries
*/
maxDelayMs: number;
/**
* List of error codes or categories that should not be retried
*/
nonRetryableErrors?: string[];
/**
* Callback function to execute before each retry attempt
*/
onRetry?: (error: YnkapError, attemptNumber: number) => void;
}
export declare class YnkapError extends Error {
code: string;
message: string;
details?: any;
constructor(code: string, message: string, details?: any);
}