/** * Render date input element * * @return string */ public function getDateHtml() { if ($this->_payment->getStartDateIsEditable()) { $this->setDateHtmlId('recurring_start_date'); $calendar = $this->getLayout()->createBlock('Magento\\Framework\\View\\Element\\Html\\Date')->setId('recurring_start_date')->setName(\Magento\RecurringPayment\Model\RecurringPayment::BUY_REQUEST_START_DATETIME)->setClass('datetime-picker input-text')->setImage($this->getViewFileUrl('Magento_Core::calendar.gif'))->setDateFormat($this->_localeDate->getDateFormat(TimezoneInterface::FORMAT_TYPE_SHORT))->setTimeFormat($this->_localeDate->getTimeFormat(TimezoneInterface::FORMAT_TYPE_SHORT)); return $calendar->getHtml(); } return ''; }
/** * Manage status * * @param RecurringPayment $payment * @return void */ public function updateStatus(RecurringPayment $payment) { $api = $this->_paymentMethod->getApi(); $action = null; switch ($payment->getNewState()) { case States::CANCELED: $action = 'cancel'; break; case States::SUSPENDED: $action = 'suspend'; break; case States::ACTIVE: $action = 'activate'; break; } $state = $payment->getState(); $api->setRecurringPaymentId($payment->getReferenceId())->setIsAlreadyCanceled($state == States::CANCELED)->setIsAlreadySuspended($state == States::SUSPENDED)->setIsAlreadyActive($state == States::ACTIVE)->setAction($action)->callManageRecurringPaymentStatus(); }
/** * Automatically set "unknown" state if not defined * * @return \Magento\RecurringPayment\Model\RecurringPayment */ protected function _filterValues() { $result = parent::_filterValues(); if (!$this->getState()) { $this->setState(States::UNKNOWN); } return $result; }