-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
99a2735
commit 21d6867
Showing
2 changed files
with
135 additions
and
0 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
app/code/community/RatePAY/Ratepaypayment/Block/Payment/Form/DirectdebitAbstract.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
} | ||
} |
82 changes: 82 additions & 0 deletions
82
app/code/community/RatePAY/Ratepaypayment/Block/Payment/Form/RateAbstract.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |