This commit is contained in:
Duhan BALCI
2026-01-01 18:30:21 +03:00
commit c65195d26d
44 changed files with 8715 additions and 0 deletions

28
src/utils.ts Normal file
View File

@@ -0,0 +1,28 @@
/**
* Utility functions
*/
/**
* Generates a random number between min and max (inclusive)
* @param min - Minimum value (default: 0)
* @param max - Maximum value (default: 100)
* @returns Random number between min and max
*/
export function generateRandomNumber(min: number = 0, max: number = 100): number {
if (min > max) {
throw new Error('Min value cannot be greater than max value');
}
return Math.floor(Math.random() * (max - min + 1)) + min;
}
/**
* Generates a random key for İyzico API requests
* Uses timestamp + random number combination
* @returns Random key string
*/
export function generateRandomKey(): string {
const timestamp = Date.now();
const random = generateRandomNumber(100000, 999999);
return `${timestamp}${random}`;
}