Skip to content

Commit

Permalink
[MGNT-220] add missing block files
Browse files Browse the repository at this point in the history
  • Loading branch information
rpWelschlau committed May 23, 2017
1 parent 99a2735 commit 21d6867
Show file tree
Hide file tree
Showing 2 changed files with 135 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@magentocommerce.com so we can send you a copy immediately.
*
* @category RatePAY
* @package RatePAY_Ratepaypayment
* @copyright Copyright (c) 2015 RatePAY GmbH (https://www.ratepay.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

class RatePAY_Ratepaypayment_Block_Payment_Form_DirectdebitAbstract extends RatePAY_Ratepaypayment_Block_Payment_Form_Abstract
{

/**
* Retrieve bank data from customer
*
* @return array
*/
public function getBankData()
{
return Mage::helper('ratepaypayment')->getBankData();
}

/**
* Retrieve customer name from billing address
*
* @return string
*/
public function getAccountOwner()
{
return $this->getQuote()->getBillingAddress()->getFirstname() . " " . $this->getQuote()->getBillingAddress()->getLastname();
}

/**
* Check if iban only is set
*
* @return boolean
*/
public function isIbanOnly()
{
return ((bool) Mage::helper('ratepaypayment')->getRpConfigData($this->getQuote(), $this->_code, 'iban_only') || $this->getCountryCode() != 'de');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@magentocommerce.com so we can send you a copy immediately.
*
* @category RatePAY
* @package RatePAY_Ratepaypayment
* @copyright Copyright (c) 2015 RatePAY GmbH (https://www.ratepay.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

abstract class RatePAY_Ratepaypayment_Block_Payment_Form_RateAbstract extends RatePAY_Ratepaypayment_Block_Payment_Form_DirectdebitAbstract
{

/**
* Construct
*/
protected function _construct()
{
parent::_construct();
$this->setTemplate('ratepay/payment/form/rate.phtml');
}

/**
* Return Grand Total Amount
*
* @return string
*/
public function getAmount()
{
return $this->getQuote()->getGrandTotal();
}

/**
* Is dynamic due
*
* @return boolean
*/
public function isDynamicDue()
{
return Mage::helper('ratepaypayment/mapping')->isDynamicDue();
}

/**
* Retrieve bank data from customer
*
* @return array
*/
public function getBankData()
{
return Mage::helper('ratepaypayment')->getBankData();
}

/**
* Is invoice for ratepay rate allowed
*
* @return type
*/
public function isInvoiceAllowed()
{
if(Mage::app()->getStore()->isAdmin()){
$quote = Mage::getSingleton('adminhtml/session_quote')->getQuote();
}
else {
$quote = Mage::getSingleton('checkout/session')->getQuote();
}
$storeId = $quote->getStoreId();
$country = strtolower($quote->getBillingAddress()->getCountryId());

//$return = (bool) Mage::getStoreConfig('payment/ratepay_rate_' . $country . '/rate_invoice', $storeId);
return (bool) Mage::getStoreConfig('payment/ratepay_rate_' . $country . '/rate_invoice', $storeId);
}
}

0 comments on commit 21d6867

Please sign in to comment.