diff --git a/src/Command/ProcessLatePaymongoTransactionsCommand.php b/src/Command/ProcessLatePaymongoTransactionsCommand.php
index 2c86d3ab..f3bc0312 100644
--- a/src/Command/ProcessLatePaymongoTransactionsCommand.php
+++ b/src/Command/ProcessLatePaymongoTransactionsCommand.php
@@ -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,24 +35,30 @@ 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)
{
- $output->writeln('Checking webhook status...');
+ $force = $input->getOption('force');
- // check if webhook is disabled
- $webhook = $this->paymongo->getWebhook($this->webhook_id);
+ // if we aren't forcing, check webhook status first
+ if (!$force) {
+ $output->writeln('Checking webhook status...');
- if ($webhook['success'] && $webhook['response']['data']['attributes']['status'] === 'enabled') {
- $output->writeln('Webhook is enabled, no need to do anything.');
+ // check if webhook is disabled
+ $webhook = $this->paymongo->getWebhook($this->webhook_id);
- return 0;
- } else {
- $output->writeln('Webhook is disabled! Logging event and proceeding...');
+ if ($webhook['success'] && $webhook['response']['data']['attributes']['status'] === 'enabled') {
+ $output->writeln('Webhook is enabled, no need to do anything.');
- $this->paymongo->log('WEBHOOK', "[]", json_encode($webhook['response'], JSON_PRETTY_PRINT), 'webhook');
+ return 0;
+ } else {
+ $output->writeln('Webhook is disabled! Logging event and proceeding...');
+
+ $this->paymongo->log('WEBHOOK', "[]", json_encode($webhook['response'], JSON_PRETTY_PRINT), 'webhook');
+ }
}
$output->writeln('Fetching all late pending transactions...');