Last active
June 26, 2023 18:26
-
-
Save Hiestaa/58b1e4f645291e3b06c1c67d8260c55e to your computer and use it in GitHub Desktop.
Dummy Transaction Parser
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let count = 0; | |
const INTERVAL = 120 * 1000; | |
const INTERVAL_VARIATION_RANGE = 120 * 1000; | |
const LAG = Math.round((1 + Math.random() * 10) * 60 * 1000); | |
const LIMIT = 1000; | |
const EMPLOYEES = [ | |
"Mana Kujawa", | |
"Carissa Ledesma", | |
"Beverly Murrow", | |
"Melodi Lovick", | |
"Jesusita Castleman", | |
"Maximina Desir", | |
"Leonard Childs", | |
"Donya Farley", | |
"Fatimah Arp", | |
"Emilie Lembo", | |
"Adelaida Nogle", | |
"Dayle Reddish", | |
"Alden Linhart", | |
"Thomasina Lauderback", | |
"Kandace Barnum", | |
"Matha Gros", | |
"Goldie Mix", | |
"Frida Duncan", | |
"Francoise Montalbano", | |
"Clemencia Flint", | |
"Janita Ishii", | |
"Hannah Lucero", | |
"Rosalba Durrell", | |
"Romona Milliman", | |
"Oma Noyola", | |
"Wendell Englert", | |
"Blair Endres", | |
"Clint Seamons", | |
"Maile Paff", | |
"Neville Brock", | |
"Johnetta Shepperd", | |
"Frederica Blakley", | |
"Krystina Nolte", | |
"Catrice Malan", | |
"Briana Gaudette", | |
"Tyrell Mina", | |
"Adaline Benefiel", | |
"Mercedez Kimes", | |
"Samuel Samuelson", | |
"Dino Riggle", | |
"Dessie Claar", | |
"Cheyenne Cambre", | |
"Jewell Wherry", | |
"Manuel Bluford", | |
"Darron Hout", | |
"Anh Luthy", | |
"Toccara Gattis", | |
"Bart Gobel", | |
"Tayna Darley", | |
"Caitlin Biggers", | |
]; | |
dataReceived = function () { | |
}; | |
function fakeTransaction () { | |
if (count > LIMIT) { | |
console.log(`[Dummy Transactions][fakeTransaction] count limit reached (${count})`); | |
return; | |
} | |
console.log(`[Dummy Transactions][fakeTransaction] current lag: ${Math.round(LAG / 1000)}s`); | |
const employee = EMPLOYEES[Math.floor(Math.random() * EMPLOYEES.length)]; | |
postTransaction({ | |
title: `Fake Transaction #${count++}`, | |
type: 'transaction', | |
subtype: 'dummy', | |
dataSource: 'dummy', | |
startTime: new Date(Date.now() - LAG).toISOString(), | |
endTime: new Date(Date.now() + 120 * 1000 - LAG).toISOString(), | |
details: { | |
"Employee": employee, | |
"Receipt": `Employee: ${employee}\n`, | |
}, | |
}, { | |
postProcessMetadata: metadata.EVENT && metadata.EVENT.postProcessMetadata | |
}); | |
const interval = INTERVAL + Math.random() * INTERVAL_VARIATION_RANGE; | |
console.log(`[Dummy Transactions][fakeTransaction] next post in ${Math.round(interval / 1000)}s`); | |
setTimeout(fakeTransaction, interval); | |
} | |
const interval = Math.random() * INTERVAL_VARIATION_RANGE; | |
console.log(`[Dummy Transactions] first post in ${Math.round(interval / 1000)}s`); | |
setTimeout(fakeTransaction, interval); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment