Commit 99168bdd authored by Emiliano Balbuena's avatar Emiliano Balbuena

(chore): Lifecycle tweaks

1 merge request!235WIP: Boost Campaigns (&24)
Pipeline #69075370 failed with stages
in 3 minutes and 12 seconds
......@@ -82,7 +82,7 @@ class BudgetDelegate
*/
public function onStateChange(Campaign $campaign)
{
// TODO: Check that campaign is in a final incomplete status (revoked/rejected)
// TODO: Check that campaign is in a final complete or incomplete status (revoked/rejected)
// TODO: Refund!
// TODO: Store refund info onto Campaign/Boost metadata
......
......@@ -150,6 +150,7 @@ class Manager
// Validate checksum
// TODO: Check checksum!
if (!$campaign->getChecksum()) {
throw new CampaignException('Invalid checksum value');
}
......@@ -259,11 +260,8 @@ class Manager
// Update
$now = time() * 1000;
$campaign
->setStart($now) // Update start date so we can calculate distribution correctly
->setReviewedTimestamp($now);
->setReviewedTimestamp(time() * 1000);
// Write
......@@ -399,6 +397,10 @@ class Manager
$this->repository->update($campaign);
$this->elasticRepository->update($campaign);
// Budget update
$this->budgetDelegate->onStateChange($campaign);
return $campaign;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment