Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
EncryptionPaymentDataUpdateCommand.php
Go to the documentation of this file.
1 <?php
7 declare(strict_types=1);
8 
10 
11 use Symfony\Component\Console\Input\InputInterface;
12 use Symfony\Component\Console\Output\OutputInterface;
13 use Symfony\Component\Console\Command\Command;
15 
21 {
23  const NAME = 'encryption:payment-data:update';
24 
28  private $paymentResource;
29 
33  public function __construct(
34  \Magento\Sales\Model\ResourceModel\Order\Payment\EncryptionUpdate $paymentResource
35  ) {
36  $this->paymentResource = $paymentResource;
37  parent::__construct();
38  }
39 
43  protected function configure()
44  {
45  $this->setName(self::NAME)
46  ->setDescription(
47  'Re-encrypts encrypted credit card data with latest encryption cipher.'
48  );
49  parent::configure();
50  }
51 
55  protected function execute(InputInterface $input, OutputInterface $output)
56  {
57  try {
58  $this->paymentResource->reEncryptCreditCardNumbers();
59  } catch (\Exception $e) {
60  $output->writeln('<error>' . $e->getMessage() . '</error>');
61  return Cli::RETURN_FAILURE;
62  }
63 
64  return Cli::RETURN_SUCCESS;
65  }
66 }
__construct(\Magento\Sales\Model\ResourceModel\Order\Payment\EncryptionUpdate $paymentResource)