mirror of
https://github.com/duhanbalci/iyzico.git
synced 2026-03-03 20:29:18 +00:00
50 lines
1.4 KiB
TypeScript
50 lines
1.4 KiB
TypeScript
/**
|
|
* Card storage test fixtures with randomized personal data
|
|
*/
|
|
|
|
import { faker } from '@faker-js/faker';
|
|
import type { Card, CardCreateRequest, CardCreateWithUserKeyRequest } from '../../src/types';
|
|
|
|
/**
|
|
* Generates a test card with randomized holder name
|
|
* Card number is fixed to iyzico sandbox test card
|
|
*/
|
|
export function createTestCard(): Card {
|
|
return {
|
|
cardAlias: faker.helpers.arrayElement(['My Card', 'Personal Card', 'Main Card', 'Default Card']),
|
|
cardNumber: '5528790000000008', // iyzico sandbox test card
|
|
expireYear: '2030',
|
|
expireMonth: '12',
|
|
cardHolderName: faker.person.fullName(),
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Generates a test card create request with randomized data
|
|
*/
|
|
export function createTestCardCreateRequest(): CardCreateRequest {
|
|
return {
|
|
locale: 'tr',
|
|
conversationId: faker.string.uuid(),
|
|
email: faker.internet.email().toLowerCase(),
|
|
externalId: `external-${faker.string.alphanumeric(10)}`,
|
|
card: createTestCard(),
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Generates a test card create request with user key
|
|
*/
|
|
export function createCardCreateWithUserKeyRequest(cardUserKey: string): CardCreateWithUserKeyRequest {
|
|
return {
|
|
locale: 'tr',
|
|
conversationId: faker.string.uuid(),
|
|
cardUserKey,
|
|
card: createTestCard(),
|
|
};
|
|
}
|
|
|
|
// Legacy exports for backward compatibility (static versions that generate once)
|
|
export const testCard = createTestCard();
|
|
export const testCardCreateRequest = createTestCardCreateRequest();
|