Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/app/code/Cnc/StripePayment/Console/Command/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/app/code/Cnc/StripePayment/Console/Command/UpdatePaymentIntentDescriptions.php
<?php
/**
 * @license http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 * @author Radosław Łańcucki <[email protected]>
 * @copyright Copyright (c) 2022 KDC (https://digitalcommerce.kaliop.com)
 */
declare(strict_types=1);

namespace Cnc\StripePayment\Console\Command;

use Cnc\StripePayment\Model\PaymentIntent\DescriptionProcessor;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class UpdatePaymentIntentDescriptions extends Command
{
    private const ARGUMENT_DRY_RUN = 'dry-run';

    /**
     * @var DescriptionProcessor
     */
    private $processor;

    /**
     * @param DescriptionProcessor $processor
     * @param string|null $name
     */
    public function __construct(DescriptionProcessor $processor, string $name = null)
    {
        parent::__construct($name);
        $this->processor = $processor;
    }

    /**
     * @inheritDoc
     */
    protected function configure()
    {
        $this->setName('stripe:update:payment-intent-description');
        $this->setDescription('Stripe update Payment Intent description');
        $this->addOption(
            self::ARGUMENT_DRY_RUN,
            'd',
            InputOption::VALUE_OPTIONAL,
            'Dry run',
            false
        );
        parent::configure();
    }

    /**
     * @param InputInterface $input
     * @param OutputInterface $output
     *
     * @return void
     */
    protected function execute(InputInterface $input, OutputInterface $output): void
    {
        $isDryRun = (bool)$input->getOption(self::ARGUMENT_DRY_RUN);

        $output->writeln('<info>Started processing Stripe Payment Intents</info>');
        $paymentIntents = $this->processor->updateAllPaymentIntents($isDryRun);
        $count = count($paymentIntents);

        if (!$isDryRun) {
            $output->writeln("<info>Updated total {$count} Stripe Payment Intents. Details:</info>");
        } else {
            $output->writeln("<info>DRY RUN total {$count} Stripe Payment Intents. Details:</info>");
        }
        foreach ($paymentIntents as $id => $description) {
            $output->writeln("<info>{$id} with description: '{$description}'.</info>");
        }

        $output->writeln('<info>Finished processing Stripe Payment Intents</info>');
    }
}

Spamworldpro Mini