public function __construct(\Magento\Framework\Registry $registry, \Magento\Framework\View\Element\Template\Context $context, \Magento\Payment\Helper\Data $paymentHelper, \Magento\Payment\Model\Checks\SpecificationFactory $methodSpecificationFactory, array $data = [], \Magento\Framework\Module\Manager $moduleManager, \Magento\Framework\ObjectManagerInterface $objectManagerInterface)
 {
     $this->_registry = $registry;
     $this->_objectId = 'creditmemo_id';
     $this->_controller = 'sales_order_creditmemo';
     $this->_mode = 'view';
     parent::__construct($context, $paymentHelper, $methodSpecificationFactory, $data);
     $this->_removeButton('save');
     $this->_removeButton('reset');
     $this->_removeButton('delete');
     if ($this->getCreditmemo()->canCancel()) {
         $this->_addButton('cancel', array('label' => __('Cancel'), 'class' => 'delete', 'onclick' => 'setLocation(\'' . $this->getCancelUrl() . '\')'));
     }
     if ($this->_isAllowedAction('emails')) {
         $this->addButton('send_notification', array('label' => __('Send Email'), 'onclick' => 'confirmSetLocation(\'' . __('Are you sure you want to send Creditmemo email to customer?') . '\', \'' . $this->getEmailUrl() . '\')'));
     }
     if ($this->getCreditmemo()->canRefund()) {
         $this->_addButton('refund', array('label' => __('Refund'), 'class' => 'save', 'onclick' => 'setLocation(\'' . $this->getRefundUrl() . '\')'));
     }
     if ($this->getCreditmemo()->canVoid()) {
         $this->_addButton('void', array('label' => __('Void'), 'class' => 'save', 'onclick' => 'setLocation(\'' . $this->getVoidUrl() . '\')'));
     }
     if ($this->getCreditmemo()->getId()) {
         $this->_addButton('print', array('label' => __('Print'), 'class' => 'save', 'onclick' => 'setLocation(\'' . $this->getPrintUrl() . '\')'));
     }
 }
Exemple #2
0
 /**
  * Check payment method model
  *
  * @param \Magento\Payment\Model\MethodInterface $method
  * @return bool
  */
 protected function _canUseMethod($method)
 {
     return $method && $method->canUseCheckout() && parent::_canUseMethod($method);
 }
Exemple #3
0
 /**
  * Check payment method model
  *
  * @param \Magento\Payment\Model\MethodInterface|null $method
  * @return bool
  */
 protected function _canUseMethod($method)
 {
     return $method && $method->canUseInternal() && parent::_canUseMethod($method);
 }
Exemple #4
0
 /**
  * Check payment method model
  *
  * @param \Magento\Payment\Model\Method\AbstractMethod|null $method
  * @return bool
  */
 protected function _canUseMethod($method)
 {
     return $method && $this->paymentSpecification->isSatisfiedBy($method->getCode()) && parent::_canUseMethod($method);
 }