Form.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. declare(strict_types=1);
  7. namespace Magento\AuthorizenetAcceptjs\Block;
  8. use Magento\AuthorizenetAcceptjs\Gateway\Config;
  9. use Magento\Backend\Model\Session\Quote;
  10. use Magento\Framework\View\Element\Template\Context;
  11. use Magento\Payment\Block\Form\Cc;
  12. use Magento\Payment\Model\Config as PaymentConfig;
  13. /**
  14. * Block for representing the payment form
  15. *
  16. * @api
  17. * @since 100.3.0
  18. */
  19. class Form extends Cc
  20. {
  21. /**
  22. * @var Config
  23. */
  24. private $config;
  25. /**
  26. * @var Quote
  27. */
  28. private $sessionQuote;
  29. /**
  30. * @param Context $context
  31. * @param PaymentConfig $paymentConfig
  32. * @param Config $config
  33. * @param Quote $sessionQuote
  34. * @param array $data
  35. */
  36. public function __construct(
  37. Context $context,
  38. PaymentConfig $paymentConfig,
  39. Config $config,
  40. Quote $sessionQuote,
  41. array $data = []
  42. ) {
  43. parent::__construct($context, $paymentConfig, $data);
  44. $this->config = $config;
  45. $this->sessionQuote = $sessionQuote;
  46. }
  47. /**
  48. * Check if cvv validation is available
  49. *
  50. * @return boolean
  51. * @since 100.3.0
  52. */
  53. public function isCvvEnabled(): bool
  54. {
  55. return $this->config->isCvvEnabled($this->sessionQuote->getStoreId());
  56. }
  57. }