scheduled blind drop
That was my spy themed title. Like it? The feature I am working on is
a daily file drop to dropbox at a given store (Its the daily income) is uploaded to our accounting software
I wrote a script to grab the file and upload it to our account software.
public function handle() {
// (because the local software is stupid and makes the user name the file.
// So we dont want to depend on a specific name)
if (! $this->path = $this->getFileName()) {
// will be dynamic of course...
Mail::to('[email protected]')->bcc('[email protected]')
->send(new StoresDailyReportIssue($this->store, 'NotInDropbox'));
return -1;
}
if (! $this->getAndConfirmItsTheCorrectReport()) {
Mail::to('[email protected]')->bcc('[email protected]')
->send(new StoresDailyReportIssue($this->store, 'WrongReport', $this->reportName));
return -1;
}
$this
->getWaveRelatedAccounts()
->prepareAndSendToWave()
->moveAndRenameFile();
// return you're a stud!
}
At this point I was feeling pretty clever. Happy path and all. GREEN baby. Then I started to reconsider edge cases.
- wrong file is dropped.
- no file is dropped, so we notify them... but each store has different open days
- no file was dropped before... so now they drop two
- ...
Have you built something similar?
I had originally thought to run this on a schedule, daily at night. Now it seems it should process all files in the box and know the stores open days, and not notify if there aren't files.
So... maybe instead I use separate log to track that the days are uploaded, and a separate notifications script to check the log to confirm files were processed then notify store managers accordingly.
Thoughts, Critiques, Insights?
Please or to participate in this conversation.