Add force option to enable or disable webhook status checking, defaults to false #801

This commit is contained in:
Ramon Gutierrez 2024-05-31 18:51:55 +08:00
parent 3846ad5a43
commit 08084f682c

View file

@ -5,6 +5,7 @@ namespace App\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputOption;
use Doctrine\ORM\EntityManagerInterface;
@ -34,11 +35,16 @@ class ProcessLatePaymongoTransactionsCommand extends Command
{
$this->setName('paymongo:checkpending')
->setDescription('Check for any late PayMongo transactions and process if needed.')
->setHelp('Check for any late PayMongo transactions and process if needed.');
->setHelp('Check for any late PayMongo transactions and process if needed.')
->addOption('force', 'f', InputOption::VALUE_NONE, 'Ignore webhook status and process anyway.');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$force = $input->getOption('force');
// if we aren't forcing, check webhook status first
if (!$force) {
$output->writeln('Checking webhook status...');
// check if webhook is disabled
@ -53,6 +59,7 @@ class ProcessLatePaymongoTransactionsCommand extends Command
$this->paymongo->log('WEBHOOK', "[]", json_encode($webhook['response'], JSON_PRETTY_PRINT), 'webhook');
}
}
$output->writeln('Fetching all late pending transactions...');