INNER CODE UNIT · TypeScript
fetchAllNotificationHistory
argus-sight/refund-swatter-lite · supabase/functions/apple-notification-history/index.ts:162
async function fetchAllNotificationHistory(
jwt: string,
environment: string,
requestBody: any,
supabase: any,
requestId: string
): Promise<any[]> {
// Normalize environment for consistent comparison
const normalizedEnv = normalizeEnvironment(environment)
const apiBase = normalizedEnv === AppleEnvironment.SANDBOX ? APPLE_API_BASE_SANDBOX : APPLE_API_BASE_PRODUCTION
const allNotifications: any[] = []
let hasMore = true
let paginationToken: string | null = null
let pageNumber = 1
while (hasMore && pageNumber <= MAX_PAGES) {
try {
// Add delay between API calls (except for the first call)