Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 1.3.2 #21

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 58 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,62 @@ BankPayment
The module allows you to enter one or more bank accounts in the payment configuration which are displayed to the customer during the checkout and the order email to notify him where to transfer the money.

This extension is maintained by PHOENIX MEDIA, Magento Enterprise Partner in Stuttgart and Vienna.


This is a fork from [PHOENIX-MEDIA/Magento-BankPayment](https://github.com/PHOENIX-MEDIA/Magento-BankPayment).


Features
--------

* prepayment payment method
* SEPA ready
* allow to display multiple bank accounts
* show bank accounts dependent on order currency
* define minimum order total
* define maximum order total
* show bank accounts in PDF
* show custom text in order confirmation emails
* show custom text in order confirmation emails for specific billing countries
* pay within X days
* show custom text in checkout
* show custom text in PDF
* show link to CMS-Page instead of displaying account details in checkout


Compatibility
-------------

In older versions of Magento there may be also a Mage_BankPayment core extension which is not compatible.


Changelog
---------

From 1.1.0 see changelog in Release Notes tab.
1.4.0:
- Add 'show bank accounts dependent on order currency' (Thanks to [arosenhagen](https://github.com/ffuenf/Ffuenf_BankPayment/commit/7bad3ff4850cb8e4991c06f87c0b58304a2335f0))

1.3.3:
- Improved design details in admin sector, modified displayed messages.
- Fixing frontend model html of bank accounts data including localization issues.

1.3.2:
- Add 'show custom text in order confirmation emails' (Thanks to [arosenhagen](https://github.com/ffuenf/Ffuenf_BankPayment/commits/cacea40890a2c2d9bbe5c784b4a0bc5fe058fac9/app/design/frontend/base/default/template/bankpayment/email/message.phtml))

1.3.1:
- Fix localization issues
- Fix poor representation of account data in admin section

1.3.0:
- Re-added (optional) account number and sort code for non SEPA countries as fallback
- add locale 'pt_PT'
- Fix issues #13 (Multi Store Problem)
- Added backend model for serialized array to fix magento core bug resulting in a catched exception
- Some refactoring, clean up source code

1.2.0:
- IBAN ready (as in [PHOENIX-MEDIA Version 1.2.0](https://github.com/PHOENIX-MEDIA/Magento-BankPayment/releases/tag/1.2.0))

From 1.1.0 see changelog in [Release Notes tab](https://github.com/PHOENIX-MEDIA/Magento-BankPayment/releases).

1.0.0:
- version 0.3.4 is considered as stable
Expand All @@ -32,26 +82,26 @@ From 1.1.0 see changelog in Release Notes tab.
- Support for CMS notification page (adopts idea from Market Ready Germany package (symmetrics))
- Min/max order total configuration option
- Additional translations for DK, ES, FR (thanks to the community)
- Configurable on store view level </span></span>
- Configurable on store view level

0.2.5:
- added Polish locale</span>
- added Polish locale

0.2.4:
- added Greek and Italian locales</span></span>
- added Greek and Italian locales

0.2.3:
- added Dutch and Portuguese (Brazil) locales</span></span>
- added Dutch and Portuguese (Brazil) locales

0.2.2:
- custom text field converted to custom text area (multiline)
- bank data is now aligned in a table</span></span>
- bank data is now aligned in a table

0.2.1:
- custom text field added
- added Norwegian Bokmål locale
- moved from local to community code space
Important: <span>As the code was moved from local to community code space, you have to remove the folder manually /app/code/local/Mage/BankPayment to clean up your existing Magento installation.</span></span></span>
Important: As the code was moved from local to community code space, you have to remove the folder manually /app/code/local/Mage/BankPayment to clean up your existing Magento installation.

0.2.0:
- first public release
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@
*
* @category Mage
* @package Phoenix_BankPayment
* @copyright Copyright (c) 2008 Andrej Sinicyn
* @copyright Copyright (c) 2010-2018 Phoenix Media GmbH & Co. KG (http://www.phoenix-media.eu)
* @copyright Copyright (c) 2008-2009 Andrej Sinicyn
* @copyright Copyright (c) 2010-2016 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
* @copyright Copyright (c) 2017-2018 Phoenix Media GmbH & Co. KG (http://www.phoenix-media.eu)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*
* @author Achim Rosenhagen <[email protected]>
* @copyright Copyright (c) 2015 ffuenf (http://www.ffuenf.de)
* @license http://opensource.org/licenses/mit-license.php MIT License
*/

class Phoenix_BankPayment_Block_Adminhtml_System_Config_Form_Bankaccount extends Mage_Adminhtml_Block_System_Config_Form_Field
Expand All @@ -33,8 +38,8 @@ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
$html .= '</div>';

$html .= '<ul id="bank_account_container">';
if ($this->_getValue('account_holder')) {
foreach ($this->_getValue('account_holder') as $i=>$f) {
if ($accountHolder = $this->_getValue('account_holder')) {
foreach ($accountHolder as $i => $f) {
if ($i) {
$html .= $this->_getRowTemplateHtml($i);
}
Expand All @@ -51,26 +56,47 @@ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
* @param int $i
* @return string
*/
protected function _getRowTemplateHtml($i=0)
protected function _getRowTemplateHtml($i = 0)
{
$allowedCurrencies = Mage::getModel('directory/currency')->getConfigAllowCurrencies();
$html = '<li><fieldset>';
$html .= '<label>'.$this->__('Account holder').'</label>';
$html .= '<input class="input-text" type="text" name="'.$this->getElement()->getName().'[account_holder][]" value="' . $this->_getValue('account_holder/'.$i) . '" '.$this->_getDisabled().' />';
$html .= '<label>'.$this->__('Bank name').'</label>';
$html .= '<input class="input-text" type="text" name="'.$this->getElement()->getName().'[bank_name][]" value="' . $this->_getValue('bank_name/'.$i) . '" '.$this->_getDisabled().' />';
$html .= '<br />&nbsp;<br />';
$html .= '<label>'.$this->__('IBAN').'</label>';
$html .= '<input class="input-text" type="text" name="'.$this->getElement()->getName().'[iban][]" value="' . $this->_getValue('iban/'.$i) . '" '.$this->_getDisabled().' />';
$html .= '<label>'.$this->__('BIC').'</label>';
$html .= '<input class="input-text" type="text" name="'.$this->getElement()->getName().'[bic][]" value="' . $this->_getValue('bic/'.$i) . '" '.$this->_getDisabled().' />';
$html .= '<br />&nbsp;<br />';
$html .= '<strong>'.$this->__('Account data for non SEPA countries').'</strong>';
$html .= '<br />&nbsp;<br />';
$html .= '<label>'.$this->__('Account number').'</label>';
$html .= '<input class="input-text" type="text" name="'.$this->getElement()->getName().'[account_number][]" value="' . $this->_getValue('account_number/'.$i) . '" '.$this->_getDisabled().' />';
$html .= '<label>'.$this->__('Sort code').'</label>';
$html .= '<input class="input-text" type="text" name="'.$this->getElement()->getName().'[sort_code][]" value="' . $this->_getValue('sort_code/'.$i) . '" '.$this->_getDisabled().' />';
$html .= '<br />&nbsp;<br />';
$html .= '<p>';
$html .= '<label>' . $this->__('Account holder') . '</label><br />';
$html .= '<input class="input-text" type="text" name="' . $this->getElement()->getName() . '[account_holder][]" value="' . $this->_getValue('account_holder/' . $i) . '" ' . $this->_getDisabled() . ' />';
$html .= '</p>';
$html .= '<p>';
$html .= '<label>' . $this->__('Bank name') . '</label><br />';
$html .= '<input class="input-text" type="text" name="' . $this->getElement()->getName() . '[bank_name][]" value="' . $this->_getValue('bank_name/' . $i) . '" ' . $this->_getDisabled() . ' />';
$html .= '</p>';
$html .= '<p>&nbsp;</p>';
$html .= '<p>';
$html .= '<label>' . $this->__('IBAN') . '</label><br />';
$html .= '<input class="input-text" type="text" name="' . $this->getElement()->getName() . '[iban][]" value="' . $this->_getValue('iban/' . $i) . '" ' . $this->_getDisabled() . ' />';
$html .= '</p>';
$html .= '<p>';
$html .= '<label>' . $this->__('BIC') . '</label><br />';
$html .= '<input class="input-text" type="text" name="' . $this->getElement()->getName() . '[bic][]" value="' . $this->_getValue('bic/' . $i) . '" ' . $this->_getDisabled() . ' />';
$html .= '</p>';
$html .= '<p>&nbsp;</p>';
$html .= '<p>';
$html .= '<strong>' . $this->__('Account data for non SEPA countries') . '</strong>';
$html .= '</p>';
$html .= '<p>';
$html .= '<label>' . $this->__('Account number') . '</label><br />';
$html .= '<input class="input-text" type="text" name="' . $this->getElement()->getName() . '[account_number][]" value="' . $this->_getValue('account_number/' . $i) . '" ' . $this->_getDisabled() . ' />';
$html .= '</p>';
$html .= '<p>';
$html .= '<label>' . $this->__('Sort code') . '</label><br />';
$html .= '<input class="input-text" type="text" name="' . $this->getElement()->getName() . '[sort_code][]" value="' . $this->_getValue('sort_code/' . $i) . '" ' . $this->_getDisabled() . ' />';
$html .= '</p>';
$html .= '<p>&nbsp;</p>';
$html .= '<p>';
$html .= '<label>' . $this->__('Allowed Currencies') . '</label>:';
$html .= '</p><p>';
foreach ($allowedCurrencies as $k => $v) {
$html .= '&nbsp; &nbsp;<input type="checkbox" name="' . $this->getElement()->getName() . '[currencies][' . $i . '][]" value="' . $v . '" ' . (is_array($this->_getValue('currencies/' . $i)) ? in_array($v, $this->_getValue('currencies/' . $i)) ? 'checked=checked' : '' : '') . ' /> ' . $v . '<br />';
}
$html .= '</p>';
$html .= $this->_getRemoveRowButtonHtml();
$html .= '</fieldset></li>';

Expand All @@ -86,38 +112,38 @@ protected function _getDisabled()
}

/**
* @param $key
* @return mixed
* @param string $key
* @return string
*/
protected function _getValue($key)
{
return $this->getElement()->getData('value/'.$key);
return $this->getElement()->getData('value/' . $key);
}

/**
* @param $key
* @param $value
* @param string $key
* @param string $value
* @return string
*/
protected function _getSelected($key, $value)
{
return $this->getElement()->getData('value/'.$key)==$value ? 'selected="selected"' : '';
return $this->getElement()->getData('value/' . $key) == $value ? 'selected="selected"' : '';
}

/**
* @param $container
* @param $template
* @param string $title
* @return mixed
* @return array
*/
protected function _getAddRowButtonHtml($container, $template, $title='Add')
protected function _getAddRowButtonHtml($container, $template, $title = 'Add')
{
if (!isset($this->_addRowButtonHtml[$container])) {
$this->_addRowButtonHtml[$container] = $this->getLayout()->createBlock('adminhtml/widget_button')
->setType('button')
->setClass('add '.$this->_getDisabled())
->setClass('add ' . $this->_getDisabled())
->setLabel($this->__($title))
->setOnClick("Element.insert($('".$container."'), {bottom: $('".$template."').innerHTML})")
->setOnClick("Element.insert($('" . $container . "'), {bottom: $('" . $template . "').innerHTML})")
->toHtml();
}
return $this->_addRowButtonHtml[$container];
Expand All @@ -128,14 +154,14 @@ protected function _getAddRowButtonHtml($container, $template, $title='Add')
* @param string $title
* @return array
*/
protected function _getRemoveRowButtonHtml($selector='li', $title='Delete Account')
protected function _getRemoveRowButtonHtml($selector = 'li', $title = 'Delete Account')
{
if (!$this->_removeRowButtonHtml) {
$this->_removeRowButtonHtml = $this->getLayout()->createBlock('adminhtml/widget_button')
->setType('button')
->setClass('delete v-middle '.$this->_getDisabled())
->setClass('delete v-middle ' . $this->_getDisabled())
->setLabel($this->__($title))
->setOnClick("Element.remove($(this).up('".$selector."'))")
->setOnClick("Element.remove($(this).up('" . $selector . "'))")
->toHtml();
}
return $this->_removeRowButtonHtml;
Expand Down
5 changes: 3 additions & 2 deletions app/code/community/Phoenix/BankPayment/Block/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
*
* @category Mage
* @package Phoenix_BankPayment
* @copyright Copyright (c) 2008 Andrej Sinicyn
* @copyright Copyright (c) 2010-2018 Phoenix Media GmbH & Co. KG (http://www.phoenix-media.eu)
* @copyright Copyright (c) 2008-2009 Andrej Sinicyn
* @copyright Copyright (c) 2010-2016 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
* @copyright Copyright (c) 2017-2018 Phoenix Media GmbH & Co. KG (http://www.phoenix-media.eu)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

Expand Down
5 changes: 3 additions & 2 deletions app/code/community/Phoenix/BankPayment/Block/Info.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
*
* @category Mage
* @package Phoenix_BankPayment
* @copyright Copyright (c) 2008 Andrej Sinicyn
* @copyright Copyright (c) 2010-2018 Phoenix Media GmbH & Co. KG (http://www.phoenix-media.eu)
* @copyright Copyright (c) 2008-2009 Andrej Sinicyn, Mik3e
* @copyright Copyright (c) 2010-2016 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
* @copyright Copyright (c) 2017-2018 Phoenix Media GmbH & Co. KG (http://www.phoenix-media.eu)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

Expand Down
47 changes: 47 additions & 0 deletions app/code/community/Phoenix/BankPayment/Helper/Core.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
*
* @category Phoenix
* @package Phoenix_BankPayment
*
* @author Achim Rosenhagen <[email protected]>
* @copyright Copyright (c) 2015 ffuenf (http://www.ffuenf.de)
* @license http://opensource.org/licenses/mit-license.php MIT License
*/

class Phoenix_BankPayment_Helper_Core extends Mage_Core_Helper_Abstract {

/**
* Get a store flag value and set to against the object.
*
* @param string $sStoreFlagPath
* @param string $sStoreFlagAttribute
*
* @return bool
*/
public function getStoreFlag($sStoreFlagPath, $sStoreFlagAttribute) {
return (bool) $this->getStoreConfig($sStoreFlagPath, $sStoreFlagAttribute);
}

/**
* Get a store config value and set against the object.
*
* @param string $sStoreConfigPath
* @param string $sStoreConfigAttribute
*
* @return string
*/
public function getStoreConfig($sStoreConfigPath, $sStoreConfigAttribute) {
if ($this->$sStoreConfigAttribute === null) {
$this->$sStoreConfigAttribute = Mage::getStoreConfig($sStoreConfigPath);
}
return $this->$sStoreConfigAttribute;
}
}
39 changes: 32 additions & 7 deletions app/code/community/Phoenix/BankPayment/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,44 @@
*
* @category Mage
* @package Phoenix_BankPayment
* @copyright Copyright (c) 2008 Andrej Sinicyn
* @copyright Copyright (c) 2010-2018 Phoenix Media GmbH & Co. KG (http://www.phoenix-media.eu)
* @copyright Copyright (c) 2008-2009 Andrej Sinicyn
* @copyright Copyright (c) 2010-2016 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
* @copyright Copyright (c) 2017-2018 Phoenix Media GmbH & Co. KG (http://www.phoenix-media.eu)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*
* @author Achim Rosenhagen <[email protected]>
* @copyright Copyright (c) 2015 ffuenf (http://www.ffuenf.de)
* @license http://opensource.org/licenses/mit-license.php MIT License
*/

class Phoenix_BankPayment_Helper_Data extends Mage_Core_Helper_Abstract {
class Phoenix_BankPayment_Helper_Data extends Phoenix_BankPayment_Helper_Core {

const CONFIG_EXTENSION_ACTIVE = 'payment/bankpayment/enable';

/**
* @param Varien_Object $account
* Variable for if the extension is active.
*
* @var bool
*/
protected $_bExtensionActive;

/**
* Check to see if the extension is active.
*
* @return bool
*/
public function isExtensionActive() {
return $this->getStoreFlag(self::CONFIG_EXTENSION_ACTIVE, '_bExtensionActive');
}

/**
* @param Varien_Object $account, array $quoteCurrencyCode
* @return bool
*/
public function displayFullAccountData($account) {
return ($this->displaySepaAccountData($account) && $this->displayNonSepaAccountData($account));
public function displayAccountData($account, $quoteCurrencyCode) {
$validCurrencyCode = ($quoteCurrencyCode != '') && in_array($quoteCurrencyCode, $account->getCurrencies());
$validAccountData = (($account->getIban() && $account->getBic()) || ($account->getAccountNumber() && $account->getSortCode()));
return ($validCurrencyCode && $validAccountData);
}

/**
Expand All @@ -38,6 +63,6 @@ public function displayNonSepaAccountData($account) {
* @return bool
*/
public function displaySepaAccountData($account) {
return ($account->getIban());
return ($account->getIban() && $account->getBic());
}
}
Loading