/** * Set data to block * * @return string */ protected function _toHtml() { $this->_loadPaymentMethods(); $this->setBackUrl($this->getUrl('*/billing_agreement/')); if ($this->_billingAgreementInstance) { $this->setReferenceId($this->_billingAgreementInstance->getReferenceId()); $this->setCanCancel($this->_billingAgreementInstance->canCancel()); $this->setCancelUrl($this->getUrl('*/billing_agreement/cancel', array('_current' => true, 'payment_method' => $this->_billingAgreementInstance->getMethodCode()))); $paymentMethodTitle = $this->_billingAgreementInstance->getAgreementLabel(); $this->setPaymentMethodTitle($paymentMethodTitle); $createdAt = $this->_billingAgreementInstance->getCreatedAt(); $updatedAt = $this->_billingAgreementInstance->getUpdatedAt(); $this->setAgreementCreatedAt($createdAt ? $this->helper('core')->formatDate($createdAt, 'short', true) : $this->__('N/A')); if ($updatedAt) { $this->setAgreementUpdatedAt($this->helper('core')->formatDate($updatedAt, 'short', true)); } $this->setAgreementStatus($this->_billingAgreementInstance->getStatusLabel()); } return parent::_toHtml(); }
public function setBillingAgreement(Mage_Sales_Model_Billing_Agreement $billingAgreement, $validate = false) { if ($validate) { $billingAgreement->isValid(); $billingAgreement->verifyToken(); if ($billingAgreement->getStatus() !== $billingAgreement::STATUS_ACTIVE) { Adyen_Subscription_Exception::throwException(Mage::helper('adyen_subscription')->__('Billing Agreement %s not active', $billingAgreement->getReferenceId())); } } $this->setBillingAgreementId($billingAgreement->getId()); $this->setData('_billing_agreement', $billingAgreement); return $this; }