Version Notes
In this version the following things were already tested successfully on 1.4.2.0,1.5.0.1,1.5.1.0,1.6.0.0,1.6.1.0,1.6.2.0,1.7.0.0,1.7.0.1,1.7.0.2
Download this release
Release Info
Developer | Magento Core Team |
Extension | ZerebroInternet_Barzahlen |
Version | 1.2.0 |
Comparing to | |
See all releases |
Code changes from version 1.1.9 to 1.2.0
- app/code/community/ZerebroInternet/Barzahlen/Block/Adminhtml/Sales/Order/Creditmemo/View.php +19 -21
- app/code/community/ZerebroInternet/Barzahlen/Block/Adminhtml/Sales/Order/View.php +19 -21
- app/code/community/ZerebroInternet/Barzahlen/Block/Form.php +19 -15
- app/code/community/ZerebroInternet/Barzahlen/Block/Info.php +12 -9
- app/code/community/ZerebroInternet/Barzahlen/Helper/Data.php +17 -14
- app/code/community/ZerebroInternet/Barzahlen/Model/Adminexceptions/Allspecificcountries.php +18 -19
- app/code/community/ZerebroInternet/Barzahlen/Model/Adminexceptions/Maxordertotal.php +24 -26
- app/code/community/ZerebroInternet/Barzahlen/Model/Adminexceptions/Notificationkey.php +19 -20
- app/code/community/ZerebroInternet/Barzahlen/Model/Adminexceptions/Paymentkey.php +19 -21
- app/code/community/ZerebroInternet/Barzahlen/Model/Adminexceptions/Shopid.php +19 -20
- app/code/community/ZerebroInternet/Barzahlen/Model/Adminexceptions/Specificcountry.php +19 -20
- app/code/community/ZerebroInternet/Barzahlen/Model/Adminexceptions/Title.php +19 -20
- app/code/community/ZerebroInternet/Barzahlen/Model/Api.php +110 -113
- app/code/community/ZerebroInternet/Barzahlen/Model/Api/Abstract.php +69 -70
- app/code/community/ZerebroInternet/Barzahlen/Model/Api/Notification.php +274 -264
- app/code/community/ZerebroInternet/Barzahlen/Model/Api/Request/Abstract.php +99 -100
- app/code/community/ZerebroInternet/Barzahlen/Model/Api/Request/Cancel.php +43 -43
- app/code/community/ZerebroInternet/Barzahlen/Model/Api/Request/Payment.php +118 -115
- app/code/community/ZerebroInternet/Barzahlen/Model/Api/Request/Refund.php +58 -58
- app/code/community/ZerebroInternet/Barzahlen/Model/Api/Request/Resend.php +43 -44
- app/code/community/ZerebroInternet/Barzahlen/Model/Api/Request/Update.php +45 -46
- app/code/community/ZerebroInternet/Barzahlen/Model/Barzahlen.php +93 -56
- app/code/community/ZerebroInternet/Barzahlen/Model/Cancel.php +26 -26
- app/code/community/ZerebroInternet/Barzahlen/Model/Check.php +127 -0
- app/code/community/ZerebroInternet/Barzahlen/Model/Ipn.php +236 -225
- app/code/community/ZerebroInternet/Barzahlen/Model/Payment.php +157 -163
- app/code/community/ZerebroInternet/Barzahlen/Model/Refund.php +42 -46
- app/code/community/ZerebroInternet/Barzahlen/Model/Resend.php +18 -21
- app/code/community/ZerebroInternet/Barzahlen/controllers/CheckoutController.php +16 -18
- app/code/community/ZerebroInternet/Barzahlen/controllers/IpnController.php +23 -26
- app/code/community/ZerebroInternet/Barzahlen/controllers/ResendController.php +34 -38
- app/code/community/ZerebroInternet/Barzahlen/etc/config.xml +12 -3
- app/code/community/ZerebroInternet/Barzahlen/etc/system.xml +1 -1
- app/design/adminhtml/default/default/template/barzahlen/info.phtml +1 -1
- app/design/frontend/base/default/layout/barzahlen.xml +2 -2
- app/etc/modules/ZerebroInternet_Barzahlen.xml +1 -1
- app/locale/de_DE/ZerebroInternet_Barzahlen_Admin.csv +4 -1
- app/locale/en_US/ZerebroInternet_Barzahlen_Admin.csv +4 -1
- package.xml +4 -4
app/code/community/ZerebroInternet/Barzahlen/Block/Adminhtml/Sales/Order/Creditmemo/View.php
CHANGED
@@ -14,33 +14,31 @@
|
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
-
class ZerebroInternet_Barzahlen_Block_Adminhtml_Sales_Order_Creditmemo_View extends Mage_Adminhtml_Block_Sales_Order_Creditmemo_View
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
$message = Mage::helper('sales')->__('bz_adm_resend_refund_slip_question');
|
33 |
-
$this->_addButton('refund_slip_resend', array(
|
34 |
-
'label' => Mage::helper('barzahlen')->__('bz_adm_resend_refund_slip'),
|
35 |
-
'onclick' => "confirmSetLocation('{$message}', '{$this->getResendPaymentUrl($creditMemo->getId())}')"
|
36 |
-
), 0, 100, 'header');
|
37 |
}
|
38 |
-
}
|
39 |
-
|
40 |
-
public function getResendPaymentUrl($creditMemoId) {
|
41 |
|
42 |
-
|
43 |
-
|
|
|
|
|
44 |
}
|
45 |
-
|
46 |
-
?>
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
+
* @copyright Copyright (c) 2013 Zerebro Internet GmbH (http://www.barzahlen.de)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
+
class ZerebroInternet_Barzahlen_Block_Adminhtml_Sales_Order_Creditmemo_View extends Mage_Adminhtml_Block_Sales_Order_Creditmemo_View
|
24 |
+
{
|
25 |
+
public function __construct()
|
26 |
+
{
|
27 |
+
parent::__construct();
|
28 |
+
$creditMemo = $this->getCreditmemo();
|
29 |
+
$paymentMethod = $creditMemo->getOrder()->getPayment()->getMethodInstance()->getCode();
|
30 |
|
31 |
+
if ($creditMemo->getId() && $creditMemo->getState() == $creditMemo::STATE_OPEN && $paymentMethod == 'barzahlen') {
|
32 |
+
$message = Mage::helper('sales')->__('bz_adm_resend_refund_slip_question');
|
33 |
+
$this->_addButton('refund_slip_resend', array(
|
34 |
+
'label' => Mage::helper('barzahlen')->__('bz_adm_resend_refund_slip'),
|
35 |
+
'onclick' => "confirmSetLocation('{$message}', '{$this->getResendPaymentUrl($creditMemo->getId())}')"
|
36 |
+
), 0, 100, 'header');
|
37 |
+
}
|
|
|
|
|
|
|
|
|
|
|
38 |
}
|
|
|
|
|
|
|
39 |
|
40 |
+
public function getResendPaymentUrl($creditMemoId)
|
41 |
+
{
|
42 |
+
return $this->getUrl('barzahlen/resend/refund', array('creditmemo_id' => $creditMemoId));
|
43 |
+
}
|
44 |
}
|
|
|
|
app/code/community/ZerebroInternet/Barzahlen/Block/Adminhtml/Sales/Order/View.php
CHANGED
@@ -14,33 +14,31 @@
|
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
-
class ZerebroInternet_Barzahlen_Block_Adminhtml_Sales_Order_View extends Mage_Adminhtml_Block_Sales_Order_View
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
$message = Mage::helper('sales')->__('bz_adm_resend_payment_slip_question');
|
33 |
-
$this->_addButton('payment_slip_resend', array(
|
34 |
-
'label' => Mage::helper('barzahlen')->__('bz_adm_resend_payment_slip'),
|
35 |
-
'onclick' => "confirmSetLocation('{$message}', '{$this->getResendPaymentUrl($order->getId())}')"
|
36 |
-
), 0, 100, 'header');
|
37 |
}
|
38 |
-
}
|
39 |
-
|
40 |
-
public function getResendPaymentUrl($orderId) {
|
41 |
|
42 |
-
|
43 |
-
|
|
|
|
|
44 |
}
|
45 |
-
|
46 |
-
?>
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
+
* @copyright Copyright (c) 2013 Zerebro Internet GmbH (http://www.barzahlen.de)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
+
class ZerebroInternet_Barzahlen_Block_Adminhtml_Sales_Order_View extends Mage_Adminhtml_Block_Sales_Order_View
|
24 |
+
{
|
25 |
+
public function __construct()
|
26 |
+
{
|
27 |
+
parent::__construct();
|
28 |
+
$order = $this->getOrder();
|
29 |
+
$paymentMethod = $order->getPayment()->getMethodInstance()->getCode();
|
30 |
|
31 |
+
if ($order->getId() && $order->canInvoice() && $paymentMethod == 'barzahlen') {
|
32 |
+
$message = Mage::helper('sales')->__('bz_adm_resend_payment_slip_question');
|
33 |
+
$this->_addButton('payment_slip_resend', array(
|
34 |
+
'label' => Mage::helper('barzahlen')->__('bz_adm_resend_payment_slip'),
|
35 |
+
'onclick' => "confirmSetLocation('{$message}', '{$this->getResendPaymentUrl($order->getId())}')"
|
36 |
+
), 0, 100, 'header');
|
37 |
+
}
|
|
|
|
|
|
|
|
|
|
|
38 |
}
|
|
|
|
|
|
|
39 |
|
40 |
+
public function getResendPaymentUrl($orderId)
|
41 |
+
{
|
42 |
+
return $this->getUrl('barzahlen/resend/payment', array('order_id' => $orderId));
|
43 |
+
}
|
44 |
}
|
|
|
|
app/code/community/ZerebroInternet/Barzahlen/Block/Form.php
CHANGED
@@ -14,24 +14,28 @@
|
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
-
class ZerebroInternet_Barzahlen_Block_Form extends Mage_Payment_Block_Form
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
$mark = Mage::getConfig()->getBlockClassName('core/template');
|
29 |
-
$mark = new $mark;
|
30 |
-
$mark->setTemplate('barzahlen/mark.phtml');
|
31 |
-
$this->setTemplate('barzahlen/form.phtml')
|
32 |
-
->setMethodTitle('')
|
33 |
-
->setMethodLabelAfterHtml($mark->toHtml());
|
34 |
-
|
35 |
-
return parent::_construct();
|
36 |
-
}
|
37 |
-
}
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
+
* @copyright Copyright (c) 2013 Zerebro Internet GmbH (http://www.barzahlen.de)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
+
class ZerebroInternet_Barzahlen_Block_Form extends Mage_Payment_Block_Form
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Create the Form Block (Checkout Onepage) and assign the template to it.
|
27 |
+
*
|
28 |
+
* @return null
|
29 |
+
*/
|
30 |
+
protected function _construct()
|
31 |
+
{
|
32 |
+
$mark = Mage::getConfig()->getBlockClassName('core/template');
|
33 |
+
$mark = new $mark;
|
34 |
+
$mark->setTemplate('barzahlen/mark.phtml');
|
35 |
+
$this->setTemplate('barzahlen/form.phtml')
|
36 |
+
->setMethodTitle('')
|
37 |
+
->setMethodLabelAfterHtml($mark->toHtml());
|
38 |
|
39 |
+
return parent::_construct();
|
40 |
+
}
|
41 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/ZerebroInternet/Barzahlen/Block/Info.php
CHANGED
@@ -14,17 +14,20 @@
|
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
-
class ZerebroInternet_Barzahlen_Block_Info extends Mage_Payment_Block_Info
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
|
|
|
|
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
+
* @copyright Copyright (c) 2013 Zerebro Internet GmbH (http://www.barzahlen.de)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
+
class ZerebroInternet_Barzahlen_Block_Info extends Mage_Payment_Block_Info
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Create the info block (Checkout Onepage Sidebar) and assign the template to it.
|
27 |
+
*/
|
28 |
+
protected function _construct()
|
29 |
+
{
|
30 |
+
parent::_construct();
|
31 |
+
$this->setTemplate('barzahlen/info.phtml');
|
32 |
+
}
|
33 |
+
}
|
app/code/community/ZerebroInternet/Barzahlen/Helper/Data.php
CHANGED
@@ -14,24 +14,27 @@
|
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
-
class ZerebroInternet_Barzahlen_Helper_Data extends Mage_Core_Helper_Abstract
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
}
|
36 |
}
|
37 |
-
?>
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
+
* @copyright Copyright (c) 2013 Zerebro Internet GmbH (http://www.barzahlen.de)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
+
class ZerebroInternet_Barzahlen_Helper_Data extends Mage_Core_Helper_Abstract
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* @const file for all log and debug data
|
27 |
+
*/
|
28 |
+
const DEFAULT_LOG_FILE = 'barzahlen.log';
|
29 |
|
30 |
+
/**
|
31 |
+
* Logs errors to the given log file.
|
32 |
+
*
|
33 |
+
* @param string $error_msg explaination of the occurred error
|
34 |
+
* @param array $error_data corresponding data
|
35 |
+
*/
|
36 |
+
public function bzLog($error_msg, array $error_data = array())
|
37 |
+
{
|
38 |
+
Mage::log($error_msg . " - " . serialize($error_data) . "\r\r", null, self::DEFAULT_LOG_FILE);
|
39 |
+
}
|
|
|
40 |
}
|
|
app/code/community/ZerebroInternet/Barzahlen/Model/Adminexceptions/Allspecificcountries.php
CHANGED
@@ -14,30 +14,29 @@
|
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
-
class ZerebroInternet_Barzahlen_Model_Adminexceptions_Allspecificcountries extends Mage_Core_Model_Config_Data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
-
|
26 |
-
* Checks the entered value before saving it to the configuration. Setting to default (DE only) if
|
27 |
-
* another country than Germany was choosen.
|
28 |
-
*
|
29 |
-
* @return Mage_Core_Model_Abstract
|
30 |
-
*/
|
31 |
-
public function save() {
|
32 |
-
|
33 |
-
if ($this->getValue() != '1') {
|
34 |
-
$translateMessage = Mage::helper('barzahlen')->__('bz_adm_specificcountry_exception');
|
35 |
-
Mage::getSingleton('adminhtml/session')->addError($translateMessage);
|
36 |
-
Mage::helper('barzahlen')->bzLog('adminexceptions/country: Setting DE as allowed country');
|
37 |
-
$this->setValue(1);
|
38 |
}
|
39 |
-
|
40 |
-
return parent::save();
|
41 |
-
}
|
42 |
}
|
43 |
-
?>
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
+
* @copyright Copyright (c) 2013 Zerebro Internet GmbH (http://www.barzahlen.de)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
+
class ZerebroInternet_Barzahlen_Model_Adminexceptions_Allspecificcountries extends Mage_Core_Model_Config_Data
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Checks the entered value before saving it to the configuration. Setting to default (DE only) if
|
27 |
+
* another country than Germany was choosen.
|
28 |
+
*
|
29 |
+
* @return Mage_Core_Model_Abstract
|
30 |
+
*/
|
31 |
+
public function save()
|
32 |
+
{
|
33 |
+
if ($this->getValue() != '1') {
|
34 |
+
$translateMessage = Mage::helper('barzahlen')->__('bz_adm_specificcountry_exception');
|
35 |
+
Mage::getSingleton('adminhtml/session')->addError($translateMessage);
|
36 |
+
Mage::helper('barzahlen')->bzLog('adminexceptions/country: Setting DE as allowed country');
|
37 |
+
$this->setValue(1);
|
38 |
+
}
|
39 |
|
40 |
+
return parent::save();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
}
|
|
|
|
|
|
|
42 |
}
|
|
app/code/community/ZerebroInternet/Barzahlen/Model/Adminexceptions/Maxordertotal.php
CHANGED
@@ -14,38 +14,36 @@
|
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
-
class ZerebroInternet_Barzahlen_Model_Adminexceptions_Maxordertotal extends Mage_Core_Model_Config_Data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
|
|
|
|
|
|
|
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
if ($maxordertotal >= 1000) {
|
36 |
-
$translateMessage = Mage::helper('barzahlen')->__('bz_adm_maxordertotal_exception');
|
37 |
-
Mage::getSingleton('adminhtml/session')->addError($translateMessage);
|
38 |
-
Mage::helper('barzahlen')->bzLog('adminexceptions/maxordertotal: Value too high. Setting default.');
|
39 |
-
$this->setValue('999.99');
|
40 |
-
}
|
41 |
-
elseif ($maxordertotal < 0) {
|
42 |
-
$translateMessage = Mage::helper('barzahlen')->__('bz_adm_maxordertotal_exception');
|
43 |
-
Mage::getSingleton('adminhtml/session')->addError($translateMessage);
|
44 |
-
Mage::helper('barzahlen')->bzLog('adminexceptions/maxordertotal: Value too low. Setting default.');
|
45 |
-
$this->setValue('999.99');
|
46 |
}
|
47 |
-
|
48 |
-
return parent::_beforeSave();
|
49 |
-
}
|
50 |
}
|
51 |
-
?>
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
+
* @copyright Copyright (c) 2013 Zerebro Internet GmbH (http://www.barzahlen.de)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
+
class ZerebroInternet_Barzahlen_Model_Adminexceptions_Maxordertotal extends Mage_Core_Model_Config_Data
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Checks the entered value before saving it to the configuration. Setting to default if an amount
|
27 |
+
* greater than 1000 Euros was choosen.
|
28 |
+
*
|
29 |
+
* @return Mage_Core_Model_Abstract
|
30 |
+
*/
|
31 |
+
public function _beforeSave()
|
32 |
+
{
|
33 |
+
$maxordertotal = (double) $this->getValue();
|
34 |
|
35 |
+
if ($maxordertotal >= 1000) {
|
36 |
+
$translateMessage = Mage::helper('barzahlen')->__('bz_adm_maxordertotal_exception');
|
37 |
+
Mage::getSingleton('adminhtml/session')->addError($translateMessage);
|
38 |
+
Mage::helper('barzahlen')->bzLog('adminexceptions/maxordertotal: Value too high. Setting default.');
|
39 |
+
$this->setValue('999.99');
|
40 |
+
} elseif ($maxordertotal < 0) {
|
41 |
+
$translateMessage = Mage::helper('barzahlen')->__('bz_adm_maxordertotal_exception');
|
42 |
+
Mage::getSingleton('adminhtml/session')->addError($translateMessage);
|
43 |
+
Mage::helper('barzahlen')->bzLog('adminexceptions/maxordertotal: Value too low. Setting default.');
|
44 |
+
$this->setValue('999.99');
|
45 |
+
}
|
46 |
|
47 |
+
return parent::_beforeSave();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
}
|
|
|
|
|
|
|
49 |
}
|
|
app/code/community/ZerebroInternet/Barzahlen/Model/Adminexceptions/Notificationkey.php
CHANGED
@@ -14,32 +14,31 @@
|
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
-
class ZerebroInternet_Barzahlen_Model_Adminexceptions_Notificationkey extends Mage_Core_Model_Config_Data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
public function _beforeSave() {
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
if (strlen($notificationkey) < 1) {
|
36 |
-
$translateMessage = Mage::helper('barzahlen')->__('bz_adm_notificationkey_exception');
|
37 |
-
Mage::getSingleton('adminhtml/session')->addError($translateMessage);
|
38 |
-
Mage::helper('barzahlen')->bzLog('adminexceptions/notificationkey: Notification key too small. Setting last one');
|
39 |
-
$this->setValue($this->getOldValue());
|
40 |
}
|
41 |
-
|
42 |
-
return parent::_beforeSave();
|
43 |
-
}
|
44 |
}
|
45 |
-
?>
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
+
* @copyright Copyright (c) 2013 Zerebro Internet GmbH (http://www.barzahlen.de)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
+
class ZerebroInternet_Barzahlen_Model_Adminexceptions_Notificationkey extends Mage_Core_Model_Config_Data
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Checks the entered value before saving it to the configuration. Setting to old value if string
|
27 |
+
* length is lower than 1.
|
28 |
+
*
|
29 |
+
* @return Mage_Core_Model_Abstract
|
30 |
+
*/
|
31 |
+
public function _beforeSave()
|
32 |
+
{
|
33 |
+
$notificationkey = $this->getValue();
|
34 |
|
35 |
+
if (strlen($notificationkey) < 1) {
|
36 |
+
$translateMessage = Mage::helper('barzahlen')->__('bz_adm_notificationkey_exception');
|
37 |
+
Mage::getSingleton('adminhtml/session')->addError($translateMessage);
|
38 |
+
Mage::helper('barzahlen')->bzLog('adminexceptions/notificationkey: Notification key too small. Setting last one');
|
39 |
+
$this->setValue($this->getOldValue());
|
40 |
+
}
|
|
|
41 |
|
42 |
+
return parent::_beforeSave();
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
}
|
|
|
|
|
|
|
44 |
}
|
|
app/code/community/ZerebroInternet/Barzahlen/Model/Adminexceptions/Paymentkey.php
CHANGED
@@ -14,32 +14,30 @@
|
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
-
class ZerebroInternet_Barzahlen_Model_Adminexceptions_Paymentkey extends Mage_Core_Model_Config_Data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
$paymentkey = $this->getValue();
|
34 |
-
|
35 |
-
if (strlen($paymentkey) < 1) {
|
36 |
-
$translateMessage = Mage::helper('barzahlen')->__('bz_adm_paymentkey_exception');
|
37 |
-
Mage::getSingleton('adminhtml/session')->addError($translateMessage);
|
38 |
-
Mage::helper('barzahlen')->bzLog('adminexceptions/paymentkey: Payment key too small. Setting last one.');
|
39 |
-
$this->setValue(($this->getOldValue()));
|
40 |
}
|
41 |
-
|
42 |
-
return parent::_beforeSave();
|
43 |
-
}
|
44 |
}
|
45 |
-
?>
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
+
* @copyright Copyright (c) 2013 Zerebro Internet GmbH (http://www.barzahlen.de)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
+
class ZerebroInternet_Barzahlen_Model_Adminexceptions_Paymentkey extends Mage_Core_Model_Config_Data
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Checks the entered value before saving it to the configuration. Setting to old value if string
|
27 |
+
* length is lower than 1.
|
28 |
+
*
|
29 |
+
* @return Mage_Core_Model_Abstract
|
30 |
+
*/
|
31 |
+
public function _beforeSave()
|
32 |
+
{
|
33 |
+
$paymentkey = $this->getValue();
|
34 |
|
35 |
+
if (strlen($paymentkey) < 1) {
|
36 |
+
$translateMessage = Mage::helper('barzahlen')->__('bz_adm_paymentkey_exception');
|
37 |
+
Mage::getSingleton('adminhtml/session')->addError($translateMessage);
|
38 |
+
Mage::helper('barzahlen')->bzLog('adminexceptions/paymentkey: Payment key too small. Setting last one.');
|
39 |
+
$this->setValue(($this->getOldValue()));
|
40 |
+
}
|
41 |
+
return parent::_beforeSave();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
}
|
|
|
|
|
|
|
43 |
}
|
|
app/code/community/ZerebroInternet/Barzahlen/Model/Adminexceptions/Shopid.php
CHANGED
@@ -14,32 +14,31 @@
|
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
-
class ZerebroInternet_Barzahlen_Model_Adminexceptions_Shopid extends Mage_Core_Model_Config_Data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
public function _beforeSave() {
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
if (strlen($shopid) < 1) {
|
36 |
-
$translateMessage = Mage::helper('barzahlen')->__('bz_adm_shopid_exception');
|
37 |
-
Mage::getSingleton('adminhtml/session')->addError($translateMessage);
|
38 |
-
Mage::helper('barzahlen')->bzLog('adminexceptions/shopid: Shop ID too small. Setting last one');
|
39 |
-
$this->setValue(($this->getOldValue()));
|
40 |
}
|
41 |
-
|
42 |
-
return parent::_beforeSave();
|
43 |
-
}
|
44 |
}
|
45 |
-
?>
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
+
* @copyright Copyright (c) 2013 Zerebro Internet GmbH (http://www.barzahlen.de)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
+
class ZerebroInternet_Barzahlen_Model_Adminexceptions_Shopid extends Mage_Core_Model_Config_Data
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Checks the entered value before saving it to the configuration. Setting to old value if string
|
27 |
+
* length is lower than 1.
|
28 |
+
*
|
29 |
+
* @return Mage_Core_Model_Abstract
|
30 |
+
*/
|
31 |
+
public function _beforeSave()
|
32 |
+
{
|
33 |
+
$shopid = $this->getValue();
|
34 |
|
35 |
+
if (strlen($shopid) < 1) {
|
36 |
+
$translateMessage = Mage::helper('barzahlen')->__('bz_adm_shopid_exception');
|
37 |
+
Mage::getSingleton('adminhtml/session')->addError($translateMessage);
|
38 |
+
Mage::helper('barzahlen')->bzLog('adminexceptions/shopid: Shop ID too small. Setting last one');
|
39 |
+
$this->setValue(($this->getOldValue()));
|
40 |
+
}
|
|
|
41 |
|
42 |
+
return parent::_beforeSave();
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
}
|
|
|
|
|
|
|
44 |
}
|
|
app/code/community/ZerebroInternet/Barzahlen/Model/Adminexceptions/Specificcountry.php
CHANGED
@@ -14,32 +14,31 @@
|
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
-
class ZerebroInternet_Barzahlen_Model_Adminexceptions_Specificcountry extends Mage_Core_Model_Config_Data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
public function save() {
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
if ($specificcountry != 'DE') {
|
36 |
-
$translateMessage = Mage::helper('barzahlen')->__('bz_adm_specificcountry_exception');
|
37 |
-
Mage::getSingleton('adminhtml/session')->addError($translateMessage);
|
38 |
-
Mage::helper('barzahlen')->bzLog('adminexceptions/country: Setting DE as allowed country');
|
39 |
-
$this->setValue(array('DE'));
|
40 |
}
|
41 |
-
|
42 |
-
return parent::save();
|
43 |
-
}
|
44 |
}
|
45 |
-
?>
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
+
* @copyright Copyright (c) 2013 Zerebro Internet GmbH (http://www.barzahlen.de)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
+
class ZerebroInternet_Barzahlen_Model_Adminexceptions_Specificcountry extends Mage_Core_Model_Config_Data
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Checks the entered value before saving it to the configuration. Setting to default (DE only) if
|
27 |
+
* another country than Germany was choosen.
|
28 |
+
*
|
29 |
+
* @return Mage_Core_Model_Abstract
|
30 |
+
*/
|
31 |
+
public function save()
|
32 |
+
{
|
33 |
+
$specificcountry = implode(($this->getValue()));
|
34 |
|
35 |
+
if ($specificcountry != 'DE') {
|
36 |
+
$translateMessage = Mage::helper('barzahlen')->__('bz_adm_specificcountry_exception');
|
37 |
+
Mage::getSingleton('adminhtml/session')->addError($translateMessage);
|
38 |
+
Mage::helper('barzahlen')->bzLog('adminexceptions/country: Setting DE as allowed country');
|
39 |
+
$this->setValue(array('DE'));
|
40 |
+
}
|
|
|
41 |
|
42 |
+
return parent::save();
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
}
|
|
|
|
|
|
|
44 |
}
|
|
app/code/community/ZerebroInternet/Barzahlen/Model/Adminexceptions/Title.php
CHANGED
@@ -14,32 +14,31 @@
|
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
-
class ZerebroInternet_Barzahlen_Model_Adminexceptions_Title extends Mage_Core_Model_Config_Data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
public function save() {
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
if (strlen($title) < 1) {
|
36 |
-
$translateMessage = Mage::helper('barzahlen')->__('bz_adm_co_exception');
|
37 |
-
Mage::getSingleton('adminhtml/session')->addError($translateMessage);
|
38 |
-
Mage::helper('barzahlen')->bzLog('adminexceptions/title: Empty string given. Setting default title.');
|
39 |
-
$this->setValue('Barzahlen');
|
40 |
}
|
41 |
-
|
42 |
-
return parent::save();
|
43 |
-
}
|
44 |
}
|
45 |
-
?>
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
+
* @copyright Copyright (c) 2013 Zerebro Internet GmbH (http://www.barzahlen.de)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
+
class ZerebroInternet_Barzahlen_Model_Adminexceptions_Title extends Mage_Core_Model_Config_Data
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Checks the entered value before saving it to the configuration. Setting to default if string
|
27 |
+
* length is lower than 1.
|
28 |
+
*
|
29 |
+
* @return Mage_Core_Model_Abstract
|
30 |
+
*/
|
31 |
+
public function save()
|
32 |
+
{
|
33 |
+
$title = $this->getValue();
|
34 |
|
35 |
+
if (strlen($title) < 1) {
|
36 |
+
$translateMessage = Mage::helper('barzahlen')->__('bz_adm_co_exception');
|
37 |
+
Mage::getSingleton('adminhtml/session')->addError($translateMessage);
|
38 |
+
Mage::helper('barzahlen')->bzLog('adminexceptions/title: Empty string given. Setting default title.');
|
39 |
+
$this->setValue('Barzahlen');
|
40 |
+
}
|
|
|
41 |
|
42 |
+
return parent::save();
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
}
|
|
|
|
|
|
|
44 |
}
|
|
app/code/community/ZerebroInternet/Barzahlen/Model/Api.php
CHANGED
@@ -14,129 +14,126 @@
|
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @author Alexander Diebler
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
20 |
*/
|
21 |
|
22 |
-
class ZerebroInternet_Barzahlen_Model_Api extends ZerebroInternet_Barzahlen_Model_Api_Abstract
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
}
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Sets the language for payment / refund slip.
|
45 |
-
*
|
46 |
-
* @param string $language Langauge Code (ISO 639-1)
|
47 |
-
*/
|
48 |
-
public function setLanguage($language = 'de') {
|
49 |
-
|
50 |
-
if(in_array($language, $this->_allowLanguages)) {
|
51 |
-
$this->_language = $language;
|
52 |
}
|
53 |
-
else {
|
54 |
-
$this->_language = $this->_allowLanguages[0];
|
55 |
-
}
|
56 |
-
}
|
57 |
-
|
58 |
-
/**
|
59 |
-
* Handles request of all kinds.
|
60 |
-
*
|
61 |
-
* @param Barzahlen_Request $request request that should be made
|
62 |
-
*/
|
63 |
-
public function handleRequest($request) {
|
64 |
-
|
65 |
-
$requestArray = $request->buildRequestArray($this->_shopId, $this->_paymentKey, $this->_language);
|
66 |
-
$this->_debug("API: Sending request array to Barzahlen.", $requestArray);
|
67 |
-
$xmlResponse = $this->_connectToApi($requestArray, $request->getRequestType());
|
68 |
-
$this->_debug("API: Received XML response from Barzahlen.", $xmlResponse);
|
69 |
-
$request->parseXml($xmlResponse, $this->_paymentKey);
|
70 |
-
$this->_debug("API: Parsed XML response and returned it to request object.", $request->getXmlArray());
|
71 |
-
}
|
72 |
-
|
73 |
-
/**
|
74 |
-
* Connects to Barzahlen Api as long as there's a xml response or maximum attempts are reached.
|
75 |
-
*
|
76 |
-
* @param array $requestArray array with the information which shall be send via POST
|
77 |
-
* @param string $requestType type for request
|
78 |
-
* @return xml response from Barzahlen
|
79 |
-
*/
|
80 |
-
protected function _connectToApi(array $requestArray, $requestType) {
|
81 |
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
|
|
93 |
}
|
94 |
-
}
|
95 |
-
|
96 |
-
/**
|
97 |
-
* Prepares the curl request.
|
98 |
-
*
|
99 |
-
* @param array $requestArray array with the information which shall be send via POST
|
100 |
-
* @param string $requestType type of request
|
101 |
-
* @return cURL handle object
|
102 |
-
*/
|
103 |
-
protected function _prepareRequest(array $requestArray, $requestType) {
|
104 |
-
|
105 |
-
$callDomain = $this->_sandbox ? self::APIDOMAINSANDBOX.$requestType : self::APIDOMAIN.$requestType;
|
106 |
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
/**
|
123 |
-
* Send the information via HTTP POST to the given domain. A xml as anwser is expected.
|
124 |
-
* SSL is required for a connection to Barzahlen.
|
125 |
-
*
|
126 |
-
* @return cURL handle object
|
127 |
-
* @return xml response from Barzahlen
|
128 |
-
*/
|
129 |
-
protected function _sendRequest($curl) {
|
130 |
|
131 |
-
|
132 |
-
|
133 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
|
135 |
-
|
136 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
}
|
138 |
|
139 |
-
|
140 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
}
|
142 |
-
?>
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
+
* @copyright Copyright (c) 2013 Zerebro Internet GmbH (http://www.barzahlen.de)
|
18 |
* @author Alexander Diebler
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
20 |
*/
|
21 |
|
22 |
+
class ZerebroInternet_Barzahlen_Model_Api extends ZerebroInternet_Barzahlen_Model_Api_Abstract
|
23 |
+
{
|
24 |
+
protected $_shopId; //!< merchants shop id
|
25 |
+
protected $_paymentKey; //!< merchants payment key
|
26 |
+
protected $_language = 'de'; //!< langauge code
|
27 |
+
protected $_allowLanguages = array('de', 'en'); //!< allowed languages for requests
|
28 |
+
protected $_sandbox = false; //!< sandbox settings
|
29 |
+
protected $_madeAttempts = 0; //!< performed attempts
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Constructor. Sets basic settings. Adjusted for Magento
|
33 |
+
*
|
34 |
+
* @param array $arguements array with settings
|
35 |
+
*/
|
36 |
+
public function __construct(array $arguements)
|
37 |
+
{
|
38 |
+
$this->_shopId = $arguements['shopId'];
|
39 |
+
$this->_paymentKey = $arguements['paymentKey'];
|
40 |
+
$this->_sandbox = $arguements['sandbox'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
+
/**
|
44 |
+
* Sets the language for payment / refund slip.
|
45 |
+
*
|
46 |
+
* @param string $language Langauge Code (ISO 639-1)
|
47 |
+
*/
|
48 |
+
public function setLanguage($language = 'de')
|
49 |
+
{
|
50 |
+
if (in_array($language, $this->_allowLanguages)) {
|
51 |
+
$this->_language = $language;
|
52 |
+
} else {
|
53 |
+
$this->_language = $this->_allowLanguages[0];
|
54 |
+
}
|
55 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
|
57 |
+
/**
|
58 |
+
* Handles request of all kinds.
|
59 |
+
*
|
60 |
+
* @param Barzahlen_Request $request request that should be made
|
61 |
+
*/
|
62 |
+
public function handleRequest($request)
|
63 |
+
{
|
64 |
+
$requestArray = $request->buildRequestArray($this->_shopId, $this->_paymentKey, $this->_language);
|
65 |
+
$this->_debug("API: Sending request array to Barzahlen.", $requestArray);
|
66 |
+
$xmlResponse = $this->_connectToApi($requestArray, $request->getRequestType());
|
67 |
+
$this->_debug("API: Received XML response from Barzahlen.", $xmlResponse);
|
68 |
+
$request->parseXml($xmlResponse, $this->_paymentKey);
|
69 |
+
$this->_debug("API: Parsed XML response and returned it to request object.", $request->getXmlArray());
|
70 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
|
72 |
+
/**
|
73 |
+
* Connects to Barzahlen Api as long as there's a xml response or maximum attempts are reached.
|
74 |
+
*
|
75 |
+
* @param array $requestArray array with the information which shall be send via POST
|
76 |
+
* @param string $requestType type for request
|
77 |
+
* @return xml response from Barzahlen
|
78 |
+
*/
|
79 |
+
protected function _connectToApi(array $requestArray, $requestType)
|
80 |
+
{
|
81 |
+
$this->_madeAttempts++;
|
82 |
+
$curl = $this->_prepareRequest($requestArray, $requestType);
|
83 |
+
|
84 |
+
try {
|
85 |
+
return $this->_sendRequest($curl);
|
86 |
+
} catch (Exception $e) {
|
87 |
+
if ($this->_madeAttempts >= self::MAXATTEMPTS) {
|
88 |
+
Mage::throwException($e->getMessage());
|
89 |
+
}
|
90 |
+
return $this->_connectToApi($requestArray, $requestType);
|
91 |
+
}
|
92 |
+
}
|
93 |
|
94 |
+
/**
|
95 |
+
* Prepares the curl request.
|
96 |
+
*
|
97 |
+
* @param array $requestArray array with the information which shall be send via POST
|
98 |
+
* @param string $requestType type of request
|
99 |
+
* @return cURL handle object
|
100 |
+
*/
|
101 |
+
protected function _prepareRequest(array $requestArray, $requestType)
|
102 |
+
{
|
103 |
+
$callDomain = $this->_sandbox ? self::APIDOMAINSANDBOX . $requestType : self::APIDOMAIN . $requestType;
|
104 |
+
|
105 |
+
$curl = curl_init();
|
106 |
+
curl_setopt($curl, CURLOPT_URL, $callDomain);
|
107 |
+
curl_setopt($curl, CURLOPT_POST, count($requestArray));
|
108 |
+
curl_setopt($curl, CURLOPT_POSTFIELDS, $requestArray);
|
109 |
+
curl_setopt($curl, CURLOPT_HEADER, 0);
|
110 |
+
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
111 |
+
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);
|
112 |
+
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
|
113 |
+
curl_setopt($curl, CURLOPT_CAINFO, Mage::getRoot() . '/code/community/ZerebroInternet/Barzahlen/Model/Api/certs/ca-bundle.crt');
|
114 |
+
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
|
115 |
+
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 15);
|
116 |
+
curl_setopt($curl, CURLOPT_HTTP_VERSION, 1.1);
|
117 |
+
return $curl;
|
118 |
}
|
119 |
|
120 |
+
/**
|
121 |
+
* Send the information via HTTP POST to the given domain. A xml as anwser is expected.
|
122 |
+
* SSL is required for a connection to Barzahlen.
|
123 |
+
*
|
124 |
+
* @return cURL handle object
|
125 |
+
* @return xml response from Barzahlen
|
126 |
+
*/
|
127 |
+
protected function _sendRequest($curl)
|
128 |
+
{
|
129 |
+
$return = curl_exec($curl);
|
130 |
+
$error = curl_error($curl);
|
131 |
+
curl_close($curl);
|
132 |
+
|
133 |
+
if ($error != '') {
|
134 |
+
Mage::throwException('Error during cURL: ' . $error);
|
135 |
+
}
|
136 |
+
|
137 |
+
return $return;
|
138 |
+
}
|
139 |
}
|
|
app/code/community/ZerebroInternet/Barzahlen/Model/Api/Abstract.php
CHANGED
@@ -14,88 +14,87 @@
|
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @author Alexander Diebler
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
20 |
*/
|
21 |
|
22 |
-
abstract class ZerebroInternet_Barzahlen_Model_Api_Abstract
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
-
|
25 |
-
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
* @param boolean $debug debug mode on / off
|
38 |
-
* @param string $logFile position of log file
|
39 |
-
*/
|
40 |
-
public function setDebug($debug, $logFile) {
|
41 |
-
$this->_debug = $debug;
|
42 |
-
$this->_logFile = $logFile;
|
43 |
-
}
|
44 |
-
|
45 |
-
/**
|
46 |
-
* Write debug message to log file. Adjusted for Magento
|
47 |
-
*
|
48 |
-
* @param string $message debug message
|
49 |
-
* @param array $data related data (optional)
|
50 |
-
*/
|
51 |
-
protected function _debug($message, $data = array()) {
|
52 |
-
|
53 |
-
if($this->_debug == true) {
|
54 |
-
Mage::log($message.' - '.serialize($data), null, $this->_logFile);
|
55 |
}
|
56 |
-
}
|
57 |
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
}
|
71 |
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
}
|
84 |
-
}
|
85 |
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
|
|
|
|
|
|
|
|
93 |
|
94 |
-
|
95 |
-
$string = utf8_encode($string);
|
96 |
}
|
97 |
-
|
98 |
-
return $string;
|
99 |
-
}
|
100 |
}
|
101 |
-
?>
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
+
* @copyright Copyright (c) 2013 Zerebro Internet GmbH (http://www.barzahlen.de)
|
18 |
* @author Alexander Diebler
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
20 |
*/
|
21 |
|
22 |
+
abstract class ZerebroInternet_Barzahlen_Model_Api_Abstract
|
23 |
+
{
|
24 |
+
const APIDOMAIN = 'https://api.barzahlen.de/v1/transactions/'; //!< call domain (productive use)
|
25 |
+
const APIDOMAINSANDBOX = 'https://api-sandbox.barzahlen.de/v1/transactions/'; //!< sandbox call domain
|
26 |
+
const HASHALGO = 'sha512'; //!< hash algorithm
|
27 |
+
const SEPARATOR = ';'; //!< separator character
|
28 |
+
const MAXATTEMPTS = 2; //!< maximum of allowed connection attempts
|
29 |
|
30 |
+
protected $_debug = false; //!< debug mode on / off
|
31 |
+
protected $_logFile; //!< log file for debug output
|
32 |
|
33 |
+
/**
|
34 |
+
* Sets debug settings.
|
35 |
+
*
|
36 |
+
* @param boolean $debug debug mode on / off
|
37 |
+
* @param string $logFile position of log file
|
38 |
+
*/
|
39 |
+
public function setDebug($debug, $logFile)
|
40 |
+
{
|
41 |
+
$this->_debug = $debug;
|
42 |
+
$this->_logFile = $logFile;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
}
|
|
|
44 |
|
45 |
+
/**
|
46 |
+
* Write debug message to log file. Adjusted for Magento
|
47 |
+
*
|
48 |
+
* @param string $message debug message
|
49 |
+
* @param array $data related data (optional)
|
50 |
+
*/
|
51 |
+
protected function _debug($message, $data = array())
|
52 |
+
{
|
53 |
+
if ($this->_debug == true) {
|
54 |
+
Mage::log($message . ' - ' . serialize($data), null, $this->_logFile);
|
55 |
+
}
|
56 |
+
}
|
|
|
57 |
|
58 |
+
/**
|
59 |
+
* Generates the hash for the request array.
|
60 |
+
*
|
61 |
+
* @param array $requestArray array from which hash is requested
|
62 |
+
* @param string $key private key depending on hash type
|
63 |
+
* @return hash sum
|
64 |
+
*/
|
65 |
+
protected function _createHash(array $hashArray, $key)
|
66 |
+
{
|
67 |
+
$hashArray[] = $key;
|
68 |
+
$hashString = implode(self::SEPARATOR, $hashArray);
|
69 |
+
return hash(self::HASHALGO, $hashString);
|
70 |
+
}
|
71 |
|
72 |
+
/**
|
73 |
+
* Removes empty values from arrays.
|
74 |
+
*
|
75 |
+
* @param array $array array with (empty) values
|
76 |
+
*/
|
77 |
+
protected function _removeEmptyValues(array &$array)
|
78 |
+
{
|
79 |
+
foreach ($array as $key => $value) {
|
80 |
+
if ($value == '') {
|
81 |
+
unset($array[$key]);
|
82 |
+
}
|
83 |
+
}
|
84 |
}
|
|
|
85 |
|
86 |
+
/**
|
87 |
+
* Converts ISO-8859-1 strings to UTF-8 if necessary.
|
88 |
+
*
|
89 |
+
* @param string $string text which is to check
|
90 |
+
* @return string with utf-8 encoding
|
91 |
+
*/
|
92 |
+
public function isoConvert($string)
|
93 |
+
{
|
94 |
+
if (!preg_match('/\S/u', $string)) {
|
95 |
+
$string = utf8_encode($string);
|
96 |
+
}
|
97 |
|
98 |
+
return $string;
|
|
|
99 |
}
|
|
|
|
|
|
|
100 |
}
|
|
app/code/community/ZerebroInternet/Barzahlen/Model/Api/Notification.php
CHANGED
@@ -14,303 +14,313 @@
|
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @author Alexander Diebler
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
20 |
*/
|
21 |
|
22 |
-
class ZerebroInternet_Barzahlen_Model_Api_Notification extends ZerebroInternet_Barzahlen_Model_Api_Abstract
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
$this->_notificationKey = $arguments['notificationKey'];
|
44 |
-
$this->_receivedData = $arguments['receivedData'];
|
45 |
-
}
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Validates the received data. Throws exception when an error occurrs.
|
49 |
-
*/
|
50 |
-
public function validate() {
|
51 |
-
|
52 |
-
$this->_checkExistence();
|
53 |
-
$this->_checkValues();
|
54 |
-
$this->_checkHash();
|
55 |
-
$this->_isValid = true;
|
56 |
-
}
|
57 |
-
|
58 |
-
/**
|
59 |
-
* Gets state of validity.
|
60 |
-
*
|
61 |
-
* @return boolean if notification is valid
|
62 |
-
*/
|
63 |
-
public function isValid() {
|
64 |
-
return $this->_isValid;
|
65 |
-
}
|
66 |
-
|
67 |
-
/**
|
68 |
-
* Checks that all attributes are available.
|
69 |
-
*/
|
70 |
-
protected function _checkExistence() {
|
71 |
-
|
72 |
-
if(array_key_exists('refund_transaction_id', $this->_receivedData)) {
|
73 |
-
$this->_notificationType = 'refund';
|
74 |
-
foreach ($this->_originData as $attribute) {
|
75 |
-
$this->_notficationData = str_replace($attribute, 'origin_' . $attribute, $this->_notficationData);
|
76 |
-
$this->_notficationData[] = 'refund_transaction_id';
|
77 |
-
}
|
78 |
}
|
79 |
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
|
|
|
|
|
|
|
|
|
|
84 |
}
|
85 |
-
}
|
86 |
-
|
87 |
-
/**
|
88 |
-
* Checks that attribute values are as expected.
|
89 |
-
*/
|
90 |
-
protected function _checkValues() {
|
91 |
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
else {
|
101 |
-
if(!is_numeric($this->_receivedData['transaction_id'])) {
|
102 |
-
Mage::throwException('Transaction id is not numeric.');
|
103 |
-
}
|
104 |
}
|
105 |
|
106 |
-
|
107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
}
|
109 |
|
110 |
-
|
111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
}
|
113 |
-
}
|
114 |
-
|
115 |
-
/**
|
116 |
-
* Checks that received hash is valid.
|
117 |
-
*/
|
118 |
-
protected function _checkHash() {
|
119 |
-
|
120 |
-
$receivedHash = $this->_receivedData['hash'];
|
121 |
-
$hashArray = $this->_sortAttributes();
|
122 |
-
$generatedHash = $this->_createHash($hashArray, $this->_notificationKey);
|
123 |
|
124 |
-
|
125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
}
|
127 |
-
}
|
128 |
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
|
|
|
|
|
|
|
|
154 |
}
|
155 |
-
$hashArray[] = isset($this->_receivedData['custom_var_0']) ? $this->_receivedData['custom_var_0'] : '';
|
156 |
-
$hashArray[] = isset($this->_receivedData['custom_var_1']) ? $this->_receivedData['custom_var_1'] : '';
|
157 |
-
$hashArray[] = isset($this->_receivedData['custom_var_2']) ? $this->_receivedData['custom_var_2'] : '';
|
158 |
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
|
|
|
|
|
|
|
|
172 |
}
|
173 |
|
174 |
-
|
175 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
}
|
177 |
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
return $this->_isValid ? $this->_notificationType : null;
|
188 |
-
}
|
189 |
-
|
190 |
-
/**
|
191 |
-
* Returns notification state.
|
192 |
-
*
|
193 |
-
* @return string with state
|
194 |
-
*/
|
195 |
-
public function getState() {
|
196 |
-
return $this->getNotificationArray('state');
|
197 |
-
}
|
198 |
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
|
|
207 |
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
|
|
216 |
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
|
|
225 |
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
|
|
234 |
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
|
|
243 |
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
|
|
252 |
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
|
|
261 |
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
|
|
270 |
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
|
|
279 |
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
|
|
288 |
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
|
|
297 |
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
|
|
306 |
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
|
|
315 |
}
|
316 |
-
?>
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
+
* @copyright Copyright (c) 2013 Zerebro Internet GmbH (http://www.barzahlen.de)
|
18 |
* @author Alexander Diebler
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
20 |
*/
|
21 |
|
22 |
+
class ZerebroInternet_Barzahlen_Model_Api_Notification extends ZerebroInternet_Barzahlen_Model_Api_Abstract
|
23 |
+
{
|
24 |
+
protected $_isValid = false; //!< state of validity
|
25 |
+
protected $_shopId; //!< merchants shop id
|
26 |
+
protected $_notificationKey; //!< merchants notification key
|
27 |
+
protected $_receivedData; //!< data which were send by Barzahlen
|
28 |
+
protected $_notificationType = 'payment'; //!< type of notification (payment or refund)
|
29 |
+
protected $_notficationData = array('state', 'transaction_id', 'shop_id', 'customer_email', 'amount',
|
30 |
+
'currency', 'hash'); //!< all necessary attributes for a valid notification
|
31 |
+
protected $_originData = array('transaction_id', 'order_id'); //!< origin values for refund notifications
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Constructor. Sets basic settings. Adjusted for Magento
|
35 |
+
*
|
36 |
+
* @param array $arguements array with settings
|
37 |
+
*/
|
38 |
+
public function __construct(array $arguments)
|
39 |
+
{
|
40 |
+
$this->_shopId = $arguments['shopId'];
|
41 |
+
$this->_notificationKey = $arguments['notificationKey'];
|
42 |
+
$this->_receivedData = $arguments['receivedData'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
}
|
44 |
|
45 |
+
/**
|
46 |
+
* Validates the received data. Throws exception when an error occurrs.
|
47 |
+
*/
|
48 |
+
public function validate()
|
49 |
+
{
|
50 |
+
$this->_checkExistence();
|
51 |
+
$this->_checkValues();
|
52 |
+
$this->_checkHash();
|
53 |
+
$this->_isValid = true;
|
54 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
+
/**
|
57 |
+
* Gets state of validity.
|
58 |
+
*
|
59 |
+
* @return boolean if notification is valid
|
60 |
+
*/
|
61 |
+
public function isValid()
|
62 |
+
{
|
63 |
+
return $this->_isValid;
|
|
|
|
|
|
|
|
|
64 |
}
|
65 |
|
66 |
+
/**
|
67 |
+
* Checks that all attributes are available.
|
68 |
+
*/
|
69 |
+
protected function _checkExistence()
|
70 |
+
{
|
71 |
+
if (array_key_exists('refund_transaction_id', $this->_receivedData)) {
|
72 |
+
$this->_notificationType = 'refund';
|
73 |
+
foreach ($this->_originData as $attribute) {
|
74 |
+
$this->_notficationData = str_replace($attribute, 'origin_' . $attribute, $this->_notficationData);
|
75 |
+
$this->_notficationData[] = 'refund_transaction_id';
|
76 |
+
}
|
77 |
+
}
|
78 |
+
|
79 |
+
foreach ($this->_notficationData as $attribute) {
|
80 |
+
if (!array_key_exists($attribute, $this->_receivedData)) {
|
81 |
+
Mage::throwException('Notification array not complete, at least ' . $attribute . ' is missing.');
|
82 |
+
}
|
83 |
+
}
|
84 |
}
|
85 |
|
86 |
+
/**
|
87 |
+
* Checks that attribute values are as expected.
|
88 |
+
*/
|
89 |
+
protected function _checkValues()
|
90 |
+
{
|
91 |
+
if ($this->_notificationType == 'refund') {
|
92 |
+
if (!is_numeric($this->_receivedData['refund_transaction_id'])) {
|
93 |
+
Mage::throwException('Refund transaction id is not numeric.');
|
94 |
+
}
|
95 |
+
if (!is_numeric($this->_receivedData['origin_transaction_id'])) {
|
96 |
+
Mage::throwException('Origin transaction id is not numeric.');
|
97 |
+
}
|
98 |
+
} else {
|
99 |
+
if (!is_numeric($this->_receivedData['transaction_id'])) {
|
100 |
+
Mage::throwException('Transaction id is not numeric.');
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
if ($this->_shopId != $this->_receivedData['shop_id']) {
|
105 |
+
Mage::throwException('Shop id doesn\'t match the given value.');
|
106 |
+
}
|
107 |
+
|
108 |
+
if (!preg_match('/^\d{1,3}(\.\d\d?)?$/', $this->_receivedData['amount'])) {
|
109 |
+
Mage::throwException('Amount is no valid value.');
|
110 |
+
}
|
111 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
|
113 |
+
/**
|
114 |
+
* Checks that received hash is valid.
|
115 |
+
*/
|
116 |
+
protected function _checkHash()
|
117 |
+
{
|
118 |
+
$receivedHash = $this->_receivedData['hash'];
|
119 |
+
$hashArray = $this->_sortAttributes();
|
120 |
+
$generatedHash = $this->_createHash($hashArray, $this->_notificationKey);
|
121 |
+
|
122 |
+
if ($receivedHash != $generatedHash) {
|
123 |
+
Mage::throwException('Notification hash is not valid.');
|
124 |
+
}
|
125 |
}
|
|
|
126 |
|
127 |
+
/**
|
128 |
+
* Puts $_GET attributes in the right order.
|
129 |
+
*
|
130 |
+
* @return array for hash generation
|
131 |
+
*/
|
132 |
+
protected function _sortAttributes()
|
133 |
+
{
|
134 |
+
$hashArray = array();
|
135 |
+
$hashArray[] = $this->_receivedData['state'];
|
136 |
+
if ($this->_notificationType == 'refund') {
|
137 |
+
$hashArray[] = $this->_receivedData['refund_transaction_id'];
|
138 |
+
$hashArray[] = $this->_receivedData['origin_transaction_id'];
|
139 |
+
} else {
|
140 |
+
$hashArray[] = $this->_receivedData['transaction_id'];
|
141 |
+
}
|
142 |
+
$hashArray[] = $this->_receivedData['shop_id'];
|
143 |
+
$hashArray[] = $this->_receivedData['customer_email'];
|
144 |
+
$hashArray[] = $this->_receivedData['amount'];
|
145 |
+
$hashArray[] = $this->_receivedData['currency'];
|
146 |
+
if ($this->_notificationType == 'refund') {
|
147 |
+
$hashArray[] = isset($this->_receivedData['origin_order_id']) ? $this->_receivedData['origin_order_id'] : '';
|
148 |
+
} else {
|
149 |
+
$hashArray[] = isset($this->_receivedData['order_id']) ? $this->_receivedData['order_id'] : '';
|
150 |
+
}
|
151 |
+
$hashArray[] = isset($this->_receivedData['custom_var_0']) ? $this->_receivedData['custom_var_0'] : '';
|
152 |
+
$hashArray[] = isset($this->_receivedData['custom_var_1']) ? $this->_receivedData['custom_var_1'] : '';
|
153 |
+
$hashArray[] = isset($this->_receivedData['custom_var_2']) ? $this->_receivedData['custom_var_2'] : '';
|
154 |
+
|
155 |
+
return $hashArray;
|
156 |
}
|
|
|
|
|
|
|
157 |
|
158 |
+
/**
|
159 |
+
* Returns a single value from the notification array or the whole array.
|
160 |
+
*
|
161 |
+
* @param string $attribute single attribute, that shall be returned
|
162 |
+
* @return single value if exists (else: null) or whole array
|
163 |
+
*/
|
164 |
+
public function getNotificationArray($attribute = '')
|
165 |
+
{
|
166 |
+
if (!$this->_isValid) {
|
167 |
+
return null;
|
168 |
+
}
|
169 |
+
|
170 |
+
if ($attribute != '') {
|
171 |
+
return array_key_exists($attribute, $this->_receivedData) ? $this->_receivedData[$attribute] : null;
|
172 |
+
}
|
173 |
+
|
174 |
+
return $this->_receivedData;
|
175 |
}
|
176 |
|
177 |
+
/**
|
178 |
+
* Returns notification type.
|
179 |
+
*
|
180 |
+
* @return string with notification type
|
181 |
+
*/
|
182 |
+
public function getNotificationType()
|
183 |
+
{
|
184 |
+
return $this->_isValid ? $this->_notificationType : null;
|
185 |
}
|
186 |
|
187 |
+
/**
|
188 |
+
* Returns notification state.
|
189 |
+
*
|
190 |
+
* @return string with state
|
191 |
+
*/
|
192 |
+
public function getState()
|
193 |
+
{
|
194 |
+
return $this->getNotificationArray('state');
|
195 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
196 |
|
197 |
+
/**
|
198 |
+
* Returns refund transaction id.
|
199 |
+
*
|
200 |
+
* @return string with refund transaction id
|
201 |
+
*/
|
202 |
+
public function getRefundTransactionId()
|
203 |
+
{
|
204 |
+
return $this->getNotificationArray('refund_transaction_id');
|
205 |
+
}
|
206 |
|
207 |
+
/**
|
208 |
+
* Returns transaction id.
|
209 |
+
*
|
210 |
+
* @return string with transaction id
|
211 |
+
*/
|
212 |
+
public function getTransactionId()
|
213 |
+
{
|
214 |
+
return $this->getNotificationArray('transaction_id');
|
215 |
+
}
|
216 |
|
217 |
+
/**
|
218 |
+
* Returns origin transaction id.
|
219 |
+
*
|
220 |
+
* @return string with origin transaction id
|
221 |
+
*/
|
222 |
+
public function getOriginTransactionId()
|
223 |
+
{
|
224 |
+
return $this->getNotificationArray('origin_transaction_id');
|
225 |
+
}
|
226 |
|
227 |
+
/**
|
228 |
+
* Returns shop id.
|
229 |
+
*
|
230 |
+
* @return string with shop id
|
231 |
+
*/
|
232 |
+
public function getShopId()
|
233 |
+
{
|
234 |
+
return $this->getNotificationArray('shop_id');
|
235 |
+
}
|
236 |
|
237 |
+
/**
|
238 |
+
* Returns customer e-mail.
|
239 |
+
*
|
240 |
+
* @return string with customer e-mail
|
241 |
+
*/
|
242 |
+
public function getCustomerEmail()
|
243 |
+
{
|
244 |
+
return $this->getNotificationArray('customer_email');
|
245 |
+
}
|
246 |
|
247 |
+
/**
|
248 |
+
* Returns amount.
|
249 |
+
*
|
250 |
+
* @return string with amount
|
251 |
+
*/
|
252 |
+
public function getAmount()
|
253 |
+
{
|
254 |
+
return $this->getNotificationArray('amount');
|
255 |
+
}
|
256 |
|
257 |
+
/**
|
258 |
+
* Returns currency.
|
259 |
+
*
|
260 |
+
* @return string with currency
|
261 |
+
*/
|
262 |
+
public function getCurrency()
|
263 |
+
{
|
264 |
+
return $this->getNotificationArray('currency');
|
265 |
+
}
|
266 |
|
267 |
+
/**
|
268 |
+
* Returns order id.
|
269 |
+
*
|
270 |
+
* @return string with order id
|
271 |
+
*/
|
272 |
+
public function getOrderId()
|
273 |
+
{
|
274 |
+
return $this->getNotificationArray('order_id');
|
275 |
+
}
|
276 |
|
277 |
+
/**
|
278 |
+
* Returns origin order id.
|
279 |
+
*
|
280 |
+
* @return string with origin order id
|
281 |
+
*/
|
282 |
+
public function getOriginOrderId()
|
283 |
+
{
|
284 |
+
return $this->getNotificationArray('origin_order_id');
|
285 |
+
}
|
286 |
|
287 |
+
/**
|
288 |
+
* Returns customer var 0.
|
289 |
+
*
|
290 |
+
* @return string with custom var
|
291 |
+
*/
|
292 |
+
public function getCustomVar0()
|
293 |
+
{
|
294 |
+
return $this->getNotificationArray('custom_var_0');
|
295 |
+
}
|
296 |
|
297 |
+
/**
|
298 |
+
* Returns customer var 1.
|
299 |
+
*
|
300 |
+
* @return string with custom var
|
301 |
+
*/
|
302 |
+
public function getCustomVar1()
|
303 |
+
{
|
304 |
+
return $this->getNotificationArray('custom_var_1');
|
305 |
+
}
|
306 |
|
307 |
+
/**
|
308 |
+
* Returns customer var 2.
|
309 |
+
*
|
310 |
+
* @return string with custom var
|
311 |
+
*/
|
312 |
+
public function getCustomVar2()
|
313 |
+
{
|
314 |
+
return $this->getNotificationArray('custom_var_2');
|
315 |
+
}
|
316 |
|
317 |
+
/**
|
318 |
+
* Returns customer var as array.
|
319 |
+
*
|
320 |
+
* @return array with custom variables
|
321 |
+
*/
|
322 |
+
public function getCustomVar()
|
323 |
+
{
|
324 |
+
return array($this->getCustomVar0(), $this->getCustomVar1(), $this->getCustomVar2());
|
325 |
+
}
|
326 |
}
|
|
app/code/community/ZerebroInternet/Barzahlen/Model/Api/Request/Abstract.php
CHANGED
@@ -14,120 +14,119 @@
|
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @author Alexander Diebler
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
20 |
*/
|
21 |
|
22 |
-
abstract class ZerebroInternet_Barzahlen_Model_Api_Request_Abstract extends ZerebroInternet_Barzahlen_Model_Api_Abstract
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
}
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Gets state of validity.
|
43 |
-
*
|
44 |
-
* @return boolean if request response is valid
|
45 |
-
*/
|
46 |
-
public function isValid() {
|
47 |
-
return $this->_isValid;
|
48 |
-
}
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Returns a single value from the xml array or the whole array.
|
52 |
-
*
|
53 |
-
* @param string $attribute single attribute, that shall be returned
|
54 |
-
* @return single value if exists (else: null) or whole array
|
55 |
-
*/
|
56 |
-
public function getXmlArray($attribute = '') {
|
57 |
-
|
58 |
-
if($attribute != '') {
|
59 |
-
return array_key_exists($attribute, $this->_xmlData) ? $this->_xmlData[$attribute] : null;
|
60 |
}
|
61 |
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
* @return array with parsed xml data
|
71 |
-
*/
|
72 |
-
public function parseXml($xmlResponse, $paymentKey) {
|
73 |
-
|
74 |
-
if(!is_string($xmlResponse) || $xmlResponse == '') {
|
75 |
-
Mage::throwException('No valid xml response received.');
|
76 |
}
|
77 |
|
78 |
-
|
79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
}
|
81 |
-
catch(Exception $e) {
|
82 |
-
Mage::throwException($e->getMessage());
|
83 |
-
}
|
84 |
-
|
85 |
-
$this->_getXmlError();
|
86 |
-
$this->_getXmlAttributes();
|
87 |
-
$this->_checkXmlHash($paymentKey);
|
88 |
-
$this->_isValid = true;
|
89 |
-
}
|
90 |
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
}
|
99 |
-
}
|
100 |
-
|
101 |
-
/**
|
102 |
-
* Gets attributes from xml object depending on its type.
|
103 |
-
*
|
104 |
-
* @param string $responseType type for xml response
|
105 |
-
*/
|
106 |
-
protected function _getXmlAttributes() {
|
107 |
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
|
|
|
|
|
|
|
|
112 |
}
|
113 |
-
}
|
114 |
-
|
115 |
-
/**
|
116 |
-
* Checks if hash is valid.
|
117 |
-
*
|
118 |
-
* @param string $paymentKey merchants payment key
|
119 |
-
*/
|
120 |
-
protected function _checkXmlHash($paymentKey) {
|
121 |
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
}
|
129 |
|
130 |
-
|
131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
}
|
133 |
-
?>
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
+
* @copyright Copyright (c) 2013 Zerebro Internet GmbH (http://www.barzahlen.de)
|
18 |
* @author Alexander Diebler
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
20 |
*/
|
21 |
|
22 |
+
abstract class ZerebroInternet_Barzahlen_Model_Api_Request_Abstract extends ZerebroInternet_Barzahlen_Model_Api_Abstract
|
23 |
+
{
|
24 |
+
protected $_isValid = false; //!< requests validity
|
25 |
+
protected $_type; //!< request type
|
26 |
+
protected $_xmlObj; //!< SimpleXMLElement
|
27 |
+
protected $_xmlAttributes = array(); //!< expected xml nodes
|
28 |
+
protected $_xmlData = array(); //!< array with parsed xml data
|
29 |
+
|
30 |
+
abstract public function buildRequestArray($shopId, $paymentKey, $language);
|
31 |
+
/**
|
32 |
+
* Returns request type.
|
33 |
+
*
|
34 |
+
* @return type of request
|
35 |
+
*/
|
36 |
+
public function getRequestType()
|
37 |
+
{
|
38 |
+
return $this->_type;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
}
|
40 |
|
41 |
+
/**
|
42 |
+
* Gets state of validity.
|
43 |
+
*
|
44 |
+
* @return boolean if request response is valid
|
45 |
+
*/
|
46 |
+
public function isValid()
|
47 |
+
{
|
48 |
+
return $this->_isValid;
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
}
|
50 |
|
51 |
+
/**
|
52 |
+
* Returns a single value from the xml array or the whole array.
|
53 |
+
*
|
54 |
+
* @param string $attribute single attribute, that shall be returned
|
55 |
+
* @return single value if exists (else: null) or whole array
|
56 |
+
*/
|
57 |
+
public function getXmlArray($attribute = '')
|
58 |
+
{
|
59 |
+
if ($attribute != '') {
|
60 |
+
return array_key_exists($attribute, $this->_xmlData) ? $this->_xmlData[$attribute] : null;
|
61 |
+
}
|
62 |
+
|
63 |
+
return $this->_xmlData;
|
64 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
|
66 |
+
/**
|
67 |
+
* Function to get response data out of received xml string.
|
68 |
+
*
|
69 |
+
* @param array $xmlResponse array with the response from the server
|
70 |
+
* @param string $paymentKey merchants payment key
|
71 |
+
* @return array with parsed xml data
|
72 |
+
*/
|
73 |
+
public function parseXml($xmlResponse, $paymentKey)
|
74 |
+
{
|
75 |
+
if (!is_string($xmlResponse) || $xmlResponse == '') {
|
76 |
+
Mage::throwException('No valid xml response received.');
|
77 |
+
}
|
78 |
+
|
79 |
+
try {
|
80 |
+
$this->_xmlObj = new SimpleXMLElement($xmlResponse);
|
81 |
+
} catch (Exception $e) {
|
82 |
+
Mage::throwException($e->getMessage());
|
83 |
+
}
|
84 |
+
|
85 |
+
$this->_getXmlError();
|
86 |
+
$this->_getXmlAttributes();
|
87 |
+
$this->_checkXmlHash($paymentKey);
|
88 |
+
$this->_isValid = true;
|
89 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
|
91 |
+
/**
|
92 |
+
* Checks if an error occurred.
|
93 |
+
*/
|
94 |
+
protected function _getXmlError()
|
95 |
+
{
|
96 |
+
if ($this->_xmlObj->{'result'} != 0) {
|
97 |
+
Mage::throwException('XML response contains an error: ' . $this->_xmlObj->{'error-message'});
|
98 |
+
}
|
99 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
|
101 |
+
/**
|
102 |
+
* Gets attributes from xml object depending on its type.
|
103 |
+
*
|
104 |
+
* @param string $responseType type for xml response
|
105 |
+
*/
|
106 |
+
protected function _getXmlAttributes()
|
107 |
+
{
|
108 |
+
$this->_xmlData = array();
|
109 |
+
|
110 |
+
foreach ($this->_xmlAttributes as $attribute) {
|
111 |
+
$this->_xmlData[$attribute] = (string) $this->_xmlObj->{$attribute};
|
112 |
+
}
|
113 |
}
|
114 |
|
115 |
+
/**
|
116 |
+
* Checks if hash is valid.
|
117 |
+
*
|
118 |
+
* @param string $paymentKey merchants payment key
|
119 |
+
*/
|
120 |
+
protected function _checkXmlHash($paymentKey)
|
121 |
+
{
|
122 |
+
$receivedHash = $this->_xmlData['hash'];
|
123 |
+
unset($this->_xmlData['hash']);
|
124 |
+
$generatedHash = $this->_createHash($this->_xmlData, $paymentKey);
|
125 |
+
|
126 |
+
if ($receivedHash != $generatedHash) {
|
127 |
+
Mage::throwException('response - xml hash not valid');
|
128 |
+
}
|
129 |
+
|
130 |
+
unset($this->_xmlData['result']);
|
131 |
+
}
|
132 |
}
|
|
app/code/community/ZerebroInternet/Barzahlen/Model/Api/Request/Cancel.php
CHANGED
@@ -14,56 +14,56 @@
|
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @author Alexander Diebler
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
20 |
*/
|
21 |
|
22 |
-
class ZerebroInternet_Barzahlen_Model_Api_Request_Cancel extends ZerebroInternet_Barzahlen_Model_Api_Request_Abstract
|
|
|
|
|
|
|
|
|
23 |
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
26 |
|
27 |
-
|
|
|
|
|
|
|
28 |
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
-
|
37 |
-
|
|
|
38 |
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
public function buildRequestArray($shopId, $paymentKey, $language) {
|
49 |
-
|
50 |
-
$requestArray = array();
|
51 |
-
$requestArray['shop_id'] = $shopId;
|
52 |
-
$requestArray['transaction_id'] = $this->_transactionId;
|
53 |
-
$requestArray['language'] = $language;
|
54 |
-
$requestArray['hash'] = $this->_createHash($requestArray, $paymentKey);
|
55 |
-
|
56 |
-
$this->_removeEmptyValues($requestArray);
|
57 |
-
return $requestArray;
|
58 |
-
}
|
59 |
-
|
60 |
-
/**
|
61 |
-
* Returns transaction id from xml array.
|
62 |
-
*
|
63 |
-
* @return received transaction id
|
64 |
-
*/
|
65 |
-
public function getTransactionId() {
|
66 |
-
return $this->getXmlArray('transaction-id');
|
67 |
-
}
|
68 |
}
|
69 |
-
?>
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
+
* @copyright Copyright (c) 2013 Zerebro Internet GmbH (http://www.barzahlen.de)
|
18 |
* @author Alexander Diebler
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
20 |
*/
|
21 |
|
22 |
+
class ZerebroInternet_Barzahlen_Model_Api_Request_Cancel extends ZerebroInternet_Barzahlen_Model_Api_Request_Abstract
|
23 |
+
{
|
24 |
+
protected $_type = 'cancel'; //!< request type
|
25 |
+
protected $_transactionId; //!< transaction id
|
26 |
+
protected $_xmlAttributes = array('transaction-id', 'result', 'hash'); //!< cancel xml content
|
27 |
|
28 |
+
/**
|
29 |
+
* Construtor to set variable request settings. Adjusted for Magento
|
30 |
+
*
|
31 |
+
* @param array $arguements array with settings
|
32 |
+
*/
|
33 |
|
34 |
+
public function __construct(array $arguments)
|
35 |
+
{
|
36 |
+
$this->_transactionId = $arguments['transactionId'];
|
37 |
+
}
|
38 |
|
39 |
+
/**
|
40 |
+
* Builds array for request.
|
41 |
+
*
|
42 |
+
* @param string $shopId merchants shop id
|
43 |
+
* @param string $paymentKey merchants payment key
|
44 |
+
* @param string $language langauge code (ISO 639-1)
|
45 |
+
* @param array $customVar custom variables from merchant
|
46 |
+
* @return array for resend request
|
47 |
+
*/
|
48 |
+
public function buildRequestArray($shopId, $paymentKey, $language)
|
49 |
+
{
|
50 |
+
$requestArray = array();
|
51 |
+
$requestArray['shop_id'] = $shopId;
|
52 |
+
$requestArray['transaction_id'] = $this->_transactionId;
|
53 |
+
$requestArray['language'] = $language;
|
54 |
+
$requestArray['hash'] = $this->_createHash($requestArray, $paymentKey);
|
55 |
|
56 |
+
$this->_removeEmptyValues($requestArray);
|
57 |
+
return $requestArray;
|
58 |
+
}
|
59 |
|
60 |
+
/**
|
61 |
+
* Returns transaction id from xml array.
|
62 |
+
*
|
63 |
+
* @return received transaction id
|
64 |
+
*/
|
65 |
+
public function getTransactionId()
|
66 |
+
{
|
67 |
+
return $this->getXmlArray('transaction-id');
|
68 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
}
|
|
app/code/community/ZerebroInternet/Barzahlen/Model/Api/Request/Payment.php
CHANGED
@@ -14,132 +14,135 @@
|
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @author Alexander Diebler
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
20 |
*/
|
21 |
|
22 |
-
class ZerebroInternet_Barzahlen_Model_Api_Request_Payment extends ZerebroInternet_Barzahlen_Model_Api_Request_Abstract
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
-
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
$this->_customerCity = $this->isoConvert($arguments['customerCity']);
|
49 |
-
$this->_customerCountry = $arguments['customerCountry'];
|
50 |
-
$this->_amount = round($arguments['amount'], 2);
|
51 |
-
$this->_currency = $arguments['currency'];
|
52 |
-
$this->_orderId = $arguments['orderId'];
|
53 |
-
}
|
54 |
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
|
|
63 |
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
|
|
|
|
|
|
|
|
|
|
68 |
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
public function buildRequestArray($shopId, $paymentKey, $language) {
|
79 |
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
$requestArray['customer_city'] = $this->_customerCity;
|
90 |
-
$requestArray['customer_country'] = $this->_customerCountry;
|
91 |
-
$requestArray['custom_var_0'] = $this->_customVar[0];
|
92 |
-
$requestArray['custom_var_1'] = $this->_customVar[1];
|
93 |
-
$requestArray['custom_var_2'] = $this->_customVar[2];
|
94 |
-
$requestArray['hash'] = $this->_createHash($requestArray, $paymentKey);
|
95 |
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
public function getTransactionId() {
|
106 |
-
return $this->getXmlArray('transaction-id');
|
107 |
-
}
|
108 |
-
|
109 |
-
/**
|
110 |
-
* Returns payment slip link from xml array.
|
111 |
-
*
|
112 |
-
* @return received payment slip link
|
113 |
-
*/
|
114 |
-
public function getPaymentSlipLink() {
|
115 |
-
return $this->getXmlArray('payment-slip-link');
|
116 |
-
}
|
117 |
-
|
118 |
-
/**
|
119 |
-
* Returns expiration notice from xml array.
|
120 |
-
*
|
121 |
-
* @return received expiration notice
|
122 |
-
*/
|
123 |
-
public function getExpirationNotice() {
|
124 |
-
return $this->getXmlArray('expiration-notice');
|
125 |
-
}
|
126 |
-
|
127 |
-
/**
|
128 |
-
* Returns infotext 1 from xml array.
|
129 |
-
*
|
130 |
-
* @return received infotext 1
|
131 |
-
*/
|
132 |
-
public function getInfotext1() {
|
133 |
-
return $this->getXmlArray('infotext-1');
|
134 |
-
}
|
135 |
-
|
136 |
-
/**
|
137 |
-
* Returns infotext 2 from xml array.
|
138 |
-
*
|
139 |
-
* @return received infotext 2
|
140 |
-
*/
|
141 |
-
public function getInfotext2() {
|
142 |
-
return $this->getXmlArray('infotext-2');
|
143 |
-
}
|
144 |
}
|
145 |
-
?>
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
+
* @copyright Copyright (c) 2013 Zerebro Internet GmbH (http://www.barzahlen.de)
|
18 |
* @author Alexander Diebler
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
20 |
*/
|
21 |
|
22 |
+
class ZerebroInternet_Barzahlen_Model_Api_Request_Payment extends ZerebroInternet_Barzahlen_Model_Api_Request_Abstract
|
23 |
+
{
|
24 |
+
protected $_type = 'create'; //!< request type
|
25 |
+
protected $_customerEmail; //!< customers e-mail address
|
26 |
+
protected $_customerStreetNr; //!< customers street and street number
|
27 |
+
protected $_customerZipcode; //!< customers zipcode
|
28 |
+
protected $_customerCity; //!< customers city
|
29 |
+
protected $_customerCountry; //!< customers country (ISO 3166-1 alpha-2)
|
30 |
+
protected $_orderId; //!< order id
|
31 |
+
protected $_amount; //!< payment amount
|
32 |
+
protected $_currency; //!< currency of payment (ISO 4217)
|
33 |
+
protected $_customVar = array('', '', ''); //!< custom variables
|
34 |
+
protected $_xmlAttributes = array('transaction-id', 'payment-slip-link', 'expiration-notice',
|
35 |
+
'infotext-1', 'infotext-2', 'result', 'hash'); //!< payment xml content
|
36 |
|
37 |
+
/**
|
38 |
+
* Construtor to set variable request settings. Adjusted for Magento
|
39 |
+
*
|
40 |
+
* @param array $arguements array with settings
|
41 |
+
*/
|
42 |
+
public function __construct(array $arguments)
|
43 |
+
{
|
44 |
+
$this->_customerEmail = $arguments['customerEmail'];
|
45 |
+
$this->_customerStreetNr = $this->isoConvert($arguments['customerStreetNr']);
|
46 |
+
$this->_customerZipcode = $arguments['customerZipcode'];
|
47 |
+
$this->_customerCity = $this->isoConvert($arguments['customerCity']);
|
48 |
+
$this->_customerCountry = $arguments['customerCountry'];
|
49 |
+
$this->_amount = round($arguments['amount'], 2);
|
50 |
+
$this->_currency = $arguments['currency'];
|
51 |
+
$this->_orderId = $arguments['orderId'];
|
52 |
+
}
|
53 |
|
54 |
+
/**
|
55 |
+
* Lets the merchant sets custom variables.
|
56 |
+
*
|
57 |
+
* @param string $var0 First Custom Variable
|
58 |
+
* @param string $var1 Second Custom Variable
|
59 |
+
* @param string $var2 Third Custom Variable
|
60 |
+
*/
|
61 |
+
public function setCustomVar($var0 = '', $var1 = '', $var2 = '')
|
62 |
+
{
|
63 |
+
$this->_customVar[0] = $var0;
|
64 |
+
$this->_customVar[1] = $var1;
|
65 |
+
$this->_customVar[2] = $var2;
|
66 |
+
}
|
67 |
|
68 |
+
/**
|
69 |
+
* Builds array for request.
|
70 |
+
*
|
71 |
+
* @param string $shopId merchants shop id
|
72 |
+
* @param string $paymentKey merchants payment key
|
73 |
+
* @param string $language langauge code (ISO 639-1)
|
74 |
+
* @param array $customVar custom variables from merchant
|
75 |
+
* @return array for payment request
|
76 |
+
*/
|
77 |
+
public function buildRequestArray($shopId, $paymentKey, $language)
|
78 |
+
{
|
79 |
+
$requestArray = array();
|
80 |
+
$requestArray['shop_id'] = $shopId;
|
81 |
+
$requestArray['customer_email'] = $this->_customerEmail;
|
82 |
+
$requestArray['amount'] = $this->_amount;
|
83 |
+
$requestArray['currency'] = $this->_currency;
|
84 |
+
$requestArray['language'] = $language;
|
85 |
+
$requestArray['order_id'] = $this->_orderId;
|
86 |
+
$requestArray['customer_street_nr'] = $this->_customerStreetNr;
|
87 |
+
$requestArray['customer_zipcode'] = $this->_customerZipcode;
|
88 |
+
$requestArray['customer_city'] = $this->_customerCity;
|
89 |
+
$requestArray['customer_country'] = $this->_customerCountry;
|
90 |
+
$requestArray['custom_var_0'] = $this->_customVar[0];
|
91 |
+
$requestArray['custom_var_1'] = $this->_customVar[1];
|
92 |
+
$requestArray['custom_var_2'] = $this->_customVar[2];
|
93 |
+
$requestArray['hash'] = $this->_createHash($requestArray, $paymentKey);
|
94 |
|
95 |
+
$this->_removeEmptyValues($requestArray);
|
96 |
+
return $requestArray;
|
97 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
|
99 |
+
/**
|
100 |
+
* Returns transaction id from xml array.
|
101 |
+
*
|
102 |
+
* @return received transaction id
|
103 |
+
*/
|
104 |
+
public function getTransactionId()
|
105 |
+
{
|
106 |
+
return $this->getXmlArray('transaction-id');
|
107 |
+
}
|
108 |
|
109 |
+
/**
|
110 |
+
* Returns payment slip link from xml array.
|
111 |
+
*
|
112 |
+
* @return received payment slip link
|
113 |
+
*/
|
114 |
+
public function getPaymentSlipLink()
|
115 |
+
{
|
116 |
+
return $this->getXmlArray('payment-slip-link');
|
117 |
+
}
|
118 |
|
119 |
+
/**
|
120 |
+
* Returns expiration notice from xml array.
|
121 |
+
*
|
122 |
+
* @return received expiration notice
|
123 |
+
*/
|
124 |
+
public function getExpirationNotice()
|
125 |
+
{
|
126 |
+
return $this->getXmlArray('expiration-notice');
|
127 |
+
}
|
|
|
128 |
|
129 |
+
/**
|
130 |
+
* Returns infotext 1 from xml array.
|
131 |
+
*
|
132 |
+
* @return received infotext 1
|
133 |
+
*/
|
134 |
+
public function getInfotext1()
|
135 |
+
{
|
136 |
+
return $this->getXmlArray('infotext-1');
|
137 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
|
139 |
+
/**
|
140 |
+
* Returns infotext 2 from xml array.
|
141 |
+
*
|
142 |
+
* @return received infotext 2
|
143 |
+
*/
|
144 |
+
public function getInfotext2()
|
145 |
+
{
|
146 |
+
return $this->getXmlArray('infotext-2');
|
147 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
}
|
|
app/code/community/ZerebroInternet/Barzahlen/Model/Api/Request/Refund.php
CHANGED
@@ -14,71 +14,71 @@
|
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @author Alexander Diebler
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
20 |
*/
|
21 |
|
22 |
-
class ZerebroInternet_Barzahlen_Model_Api_Request_Refund extends ZerebroInternet_Barzahlen_Model_Api_Request_Abstract
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
* @param array $arguements array with settings
|
35 |
-
*/
|
36 |
-
public function __construct(array $arguments) {
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
public function buildRequestArray($shopId, $paymentKey, $language) {
|
53 |
-
|
54 |
-
$requestArray = array();
|
55 |
-
$requestArray['shop_id'] = $shopId;
|
56 |
-
$requestArray['transaction_id'] = $this->_transactionId;
|
57 |
-
$requestArray['amount'] = $this->_amount;
|
58 |
-
$requestArray['currency'] = $this->_currency;
|
59 |
-
$requestArray['language'] = $language;
|
60 |
-
$requestArray['hash'] = $this->_createHash($requestArray, $paymentKey);
|
61 |
-
|
62 |
-
$this->_removeEmptyValues($requestArray);
|
63 |
-
return $requestArray;
|
64 |
-
}
|
65 |
-
|
66 |
-
/**
|
67 |
-
* Returns origin transaction id from xml array.
|
68 |
-
*
|
69 |
-
* @return received origin transaction id
|
70 |
-
*/
|
71 |
-
public function getOriginTransactionId() {
|
72 |
-
return $this->getXmlArray('origin-transaction-id');
|
73 |
-
}
|
74 |
-
|
75 |
-
/**
|
76 |
-
* Returns refund transaction id from xml array.
|
77 |
-
*
|
78 |
-
* @return received refund transaction id
|
79 |
-
*/
|
80 |
-
public function getRefundTransactionId() {
|
81 |
-
return $this->getXmlArray('refund-transaction-id');
|
82 |
-
}
|
83 |
}
|
84 |
-
?>
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
+
* @copyright Copyright (c) 2013 Zerebro Internet GmbH (http://www.barzahlen.de)
|
18 |
* @author Alexander Diebler
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
20 |
*/
|
21 |
|
22 |
+
class ZerebroInternet_Barzahlen_Model_Api_Request_Refund extends ZerebroInternet_Barzahlen_Model_Api_Request_Abstract
|
23 |
+
{
|
24 |
+
protected $_type = 'refund'; //!< request type
|
25 |
+
protected $_transactionId; //!< origin transaction id
|
26 |
+
protected $_amount; //!< refund amount
|
27 |
+
protected $_currency; //!< currency of refund (ISO 4217)
|
28 |
+
protected $_xmlAttributes = array('origin-transaction-id', 'refund-transaction-id', 'result', 'hash'); //!< refund xml content
|
29 |
|
30 |
+
/**
|
31 |
+
* Construtor to set variable request settings. Adjusted for Magento
|
32 |
+
*
|
33 |
+
* @param array $arguements array with settings
|
34 |
+
*/
|
35 |
+
public function __construct(array $arguments)
|
36 |
+
{
|
37 |
+
$this->_transactionId = $arguments['transactionId'];
|
38 |
+
$this->_amount = round($arguments['amount'], 2);
|
39 |
+
$this->_currency = $arguments['currency'];
|
40 |
+
}
|
41 |
|
42 |
+
/**
|
43 |
+
* Builds array for request.
|
44 |
+
*
|
45 |
+
* @param string $shopId merchants shop id
|
46 |
+
* @param string $paymentKey merchants payment key
|
47 |
+
* @param string $language langauge code (ISO 639-1)
|
48 |
+
* @param array $customVar custom variables from merchant
|
49 |
+
* @return array for refund request
|
50 |
+
*/
|
51 |
+
public function buildRequestArray($shopId, $paymentKey, $language)
|
52 |
+
{
|
53 |
+
$requestArray = array();
|
54 |
+
$requestArray['shop_id'] = $shopId;
|
55 |
+
$requestArray['transaction_id'] = $this->_transactionId;
|
56 |
+
$requestArray['amount'] = $this->_amount;
|
57 |
+
$requestArray['currency'] = $this->_currency;
|
58 |
+
$requestArray['language'] = $language;
|
59 |
+
$requestArray['hash'] = $this->_createHash($requestArray, $paymentKey);
|
60 |
|
61 |
+
$this->_removeEmptyValues($requestArray);
|
62 |
+
return $requestArray;
|
63 |
+
}
|
|
|
|
|
|
|
64 |
|
65 |
+
/**
|
66 |
+
* Returns origin transaction id from xml array.
|
67 |
+
*
|
68 |
+
* @return received origin transaction id
|
69 |
+
*/
|
70 |
+
public function getOriginTransactionId()
|
71 |
+
{
|
72 |
+
return $this->getXmlArray('origin-transaction-id');
|
73 |
+
}
|
74 |
|
75 |
+
/**
|
76 |
+
* Returns refund transaction id from xml array.
|
77 |
+
*
|
78 |
+
* @return received refund transaction id
|
79 |
+
*/
|
80 |
+
public function getRefundTransactionId()
|
81 |
+
{
|
82 |
+
return $this->getXmlArray('refund-transaction-id');
|
83 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
}
|
|
app/code/community/ZerebroInternet/Barzahlen/Model/Api/Request/Resend.php
CHANGED
@@ -14,56 +14,55 @@
|
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @author Alexander Diebler
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
20 |
*/
|
21 |
|
22 |
-
class ZerebroInternet_Barzahlen_Model_Api_Request_Resend extends ZerebroInternet_Barzahlen_Model_Api_Request_Abstract
|
|
|
|
|
|
|
|
|
23 |
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
* @param array $arguements array with settings
|
33 |
-
*/
|
34 |
-
public function __construct(array $arguments) {
|
35 |
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
* @param array $customVar custom variables from merchant
|
46 |
-
* @return array for resend request
|
47 |
-
*/
|
48 |
-
public function buildRequestArray($shopId, $paymentKey, $language) {
|
49 |
-
|
50 |
-
$requestArray = array();
|
51 |
-
$requestArray['shop_id'] = $shopId;
|
52 |
-
$requestArray['transaction_id'] = $this->_transactionId;
|
53 |
-
$requestArray['language'] = $language;
|
54 |
-
$requestArray['hash'] = $this->_createHash($requestArray, $paymentKey);
|
55 |
-
|
56 |
-
$this->_removeEmptyValues($requestArray);
|
57 |
-
return $requestArray;
|
58 |
-
}
|
59 |
-
|
60 |
-
/**
|
61 |
-
* Returns transaction id from xml array.
|
62 |
-
*
|
63 |
-
* @return received transaction id
|
64 |
-
*/
|
65 |
-
public function getTransactionId() {
|
66 |
-
return $this->getXmlArray('transaction-id');
|
67 |
-
}
|
68 |
}
|
69 |
-
?>
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
+
* @copyright Copyright (c) 2013 Zerebro Internet GmbH (http://www.barzahlen.de)
|
18 |
* @author Alexander Diebler
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
20 |
*/
|
21 |
|
22 |
+
class ZerebroInternet_Barzahlen_Model_Api_Request_Resend extends ZerebroInternet_Barzahlen_Model_Api_Request_Abstract
|
23 |
+
{
|
24 |
+
protected $_type = 'resend_email'; //!< request type
|
25 |
+
protected $_transactionId; //!< origin transaction id
|
26 |
+
protected $_xmlAttributes = array('transaction-id', 'result', 'hash'); //!< resend xml content
|
27 |
|
28 |
+
/**
|
29 |
+
* Construtor to set variable request settings. Adjusted for Magento
|
30 |
+
*
|
31 |
+
* @param array $arguements array with settings
|
32 |
+
*/
|
33 |
+
public function __construct(array $arguments)
|
34 |
+
{
|
35 |
+
$this->_transactionId = $arguments['transactionId'];
|
36 |
+
}
|
37 |
|
38 |
+
/**
|
39 |
+
* Builds array for request.
|
40 |
+
*
|
41 |
+
* @param string $shopId merchants shop id
|
42 |
+
* @param string $paymentKey merchants payment key
|
43 |
+
* @param string $language langauge code (ISO 639-1)
|
44 |
+
* @param array $customVar custom variables from merchant
|
45 |
+
* @return array for resend request
|
46 |
+
*/
|
47 |
+
public function buildRequestArray($shopId, $paymentKey, $language)
|
48 |
+
{
|
49 |
+
$requestArray = array();
|
50 |
+
$requestArray['shop_id'] = $shopId;
|
51 |
+
$requestArray['transaction_id'] = $this->_transactionId;
|
52 |
+
$requestArray['language'] = $language;
|
53 |
+
$requestArray['hash'] = $this->_createHash($requestArray, $paymentKey);
|
54 |
|
55 |
+
$this->_removeEmptyValues($requestArray);
|
56 |
+
return $requestArray;
|
57 |
+
}
|
|
|
|
|
|
|
58 |
|
59 |
+
/**
|
60 |
+
* Returns transaction id from xml array.
|
61 |
+
*
|
62 |
+
* @return received transaction id
|
63 |
+
*/
|
64 |
+
public function getTransactionId()
|
65 |
+
{
|
66 |
+
return $this->getXmlArray('transaction-id');
|
67 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
}
|
|
app/code/community/ZerebroInternet/Barzahlen/Model/Api/Request/Update.php
CHANGED
@@ -14,58 +14,57 @@
|
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @author Alexander Diebler
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
20 |
*/
|
21 |
|
22 |
-
class ZerebroInternet_Barzahlen_Model_Api_Request_Update extends ZerebroInternet_Barzahlen_Model_Api_Request_Abstract
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
* @param array $arguements array with settings
|
34 |
-
*/
|
35 |
-
public function __construct(array $arguments) {
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
* @param string $language langauge code (ISO 639-1)
|
47 |
-
* @param array $customVar custom variables from merchant
|
48 |
-
* @return array for update request
|
49 |
-
*/
|
50 |
-
public function buildRequestArray($shopId, $paymentKey, $language) {
|
51 |
-
|
52 |
-
$requestArray = array();
|
53 |
-
$requestArray['shop_id'] = $shopId;
|
54 |
-
$requestArray['transaction_id'] = $this->_transactionId;
|
55 |
-
$requestArray['order_id'] = $this->_orderId;
|
56 |
-
$requestArray['hash'] = $this->_createHash($requestArray, $paymentKey);
|
57 |
-
|
58 |
-
$this->_removeEmptyValues($requestArray);
|
59 |
-
return $requestArray;
|
60 |
-
}
|
61 |
-
|
62 |
-
/**
|
63 |
-
* Returns transaction id from xml array.
|
64 |
-
*
|
65 |
-
* @return received transaction id
|
66 |
-
*/
|
67 |
-
public function getTransactionId() {
|
68 |
-
return $this->getXmlArray('transaction-id');
|
69 |
-
}
|
70 |
}
|
71 |
-
?>
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
+
* @copyright Copyright (c) 2013 Zerebro Internet GmbH (http://www.barzahlen.de)
|
18 |
* @author Alexander Diebler
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
20 |
*/
|
21 |
|
22 |
+
class ZerebroInternet_Barzahlen_Model_Api_Request_Update extends ZerebroInternet_Barzahlen_Model_Api_Request_Abstract
|
23 |
+
{
|
24 |
+
protected $_type = 'update'; //!< request type
|
25 |
+
protected $_transactionId; //!< origin transaction id
|
26 |
+
protected $_orderId; //!< order id
|
27 |
+
protected $_xmlAttributes = array('transaction-id', 'result', 'hash'); //!< update xml content
|
28 |
|
29 |
+
/**
|
30 |
+
* Construtor to set variable request settings. Adjusted for Magento
|
31 |
+
*
|
32 |
+
* @param array $arguements array with settings
|
33 |
+
*/
|
34 |
+
public function __construct(array $arguments)
|
35 |
+
{
|
36 |
+
$this->_transactionId = $arguments['transactionId'];
|
37 |
+
$this->_orderId = $arguments['orderId'];
|
38 |
+
}
|
39 |
|
40 |
+
/**
|
41 |
+
* Builds array for request.
|
42 |
+
*
|
43 |
+
* @param string $shopId merchants shop id
|
44 |
+
* @param string $paymentKey merchants payment key
|
45 |
+
* @param string $language langauge code (ISO 639-1)
|
46 |
+
* @param array $customVar custom variables from merchant
|
47 |
+
* @return array for update request
|
48 |
+
*/
|
49 |
+
public function buildRequestArray($shopId, $paymentKey, $language)
|
50 |
+
{
|
51 |
+
$requestArray = array();
|
52 |
+
$requestArray['shop_id'] = $shopId;
|
53 |
+
$requestArray['transaction_id'] = $this->_transactionId;
|
54 |
+
$requestArray['order_id'] = $this->_orderId;
|
55 |
+
$requestArray['hash'] = $this->_createHash($requestArray, $paymentKey);
|
56 |
|
57 |
+
$this->_removeEmptyValues($requestArray);
|
58 |
+
return $requestArray;
|
59 |
+
}
|
|
|
|
|
|
|
60 |
|
61 |
+
/**
|
62 |
+
* Returns transaction id from xml array.
|
63 |
+
*
|
64 |
+
* @return received transaction id
|
65 |
+
*/
|
66 |
+
public function getTransactionId()
|
67 |
+
{
|
68 |
+
return $this->getXmlArray('transaction-id');
|
69 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
}
|
|
app/code/community/ZerebroInternet/Barzahlen/Model/Barzahlen.php
CHANGED
@@ -14,73 +14,110 @@
|
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
-
class ZerebroInternet_Barzahlen_Model_Barzahlen extends Mage_Payment_Model_Method_Abstract
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
protected $_formBlockType = 'barzahlen/form'; //!< formular block
|
30 |
-
protected $_infoBlockType = 'barzahlen/info'; //!< information block
|
31 |
-
protected $_redirectProcessingUrl = 'barzahlen/checkout/processing'; //!< processing url
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
protected $_canRefundInvoicePartial = true; //!< refunds can be done partial
|
40 |
-
protected $_canUseInternal = true; //!< can be used in admin panel checkout
|
41 |
-
protected $_canUseCheckout = true; //!< can be used as method on onepage checkout
|
42 |
-
protected $_canUseForMultishipping = true; //!< can be used as method on multipage checkout
|
43 |
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
const PAYMENTSTATE_PAID = 'paid'; //!< paid state (processing order)
|
51 |
-
const PAYMENTSTATE_EXPIRED = 'expired'; //!< expired state (canceled order)
|
52 |
-
const PAYMENTSTATE_REFUND_PENDING = 'refund_pending'; //!< refund pending state (credit memo OPEN)
|
53 |
-
const PAYMENTSTATE_REFUND_COMPLETED = 'refund_completed'; //!< refund completed state (credit memo REFUNDED)
|
54 |
-
const PAYMENTSTATE_REFUND_EXPIRED = 'refund_expired'; //!< refund expired state (credit memo CANCELED)
|
55 |
-
const PAYMENTSTATE_TEXT_BLOCKS = 'bz_frnt_ipn_'; //!< text block prefix
|
56 |
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
|
|
69 |
|
70 |
-
|
71 |
-
|
72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
|
74 |
-
|
75 |
-
|
|
|
76 |
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
|
|
|
|
|
|
|
|
85 |
}
|
86 |
-
?>
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
+
* @copyright Copyright (c) 2013 Zerebro Internet GmbH (http://www.barzahlen.de)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
+
class ZerebroInternet_Barzahlen_Model_Barzahlen extends Mage_Payment_Model_Method_Abstract
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* @const payment code
|
27 |
+
*/
|
28 |
+
const PAYMENT_CODE = 'barzahlen';
|
29 |
|
30 |
+
/**
|
31 |
+
* @const file for all error log and debug data
|
32 |
+
*/
|
33 |
+
const DEFAULT_LOG_FILE = 'barzahlen.log';
|
|
|
|
|
|
|
34 |
|
35 |
+
/**
|
36 |
+
* module code
|
37 |
+
*
|
38 |
+
* @var string
|
39 |
+
*/
|
40 |
+
protected $_code = 'barzahlen';
|
|
|
|
|
|
|
|
|
41 |
|
42 |
+
/**
|
43 |
+
* payment method name
|
44 |
+
*
|
45 |
+
* @var string
|
46 |
+
*/
|
47 |
+
protected $_paymentMethod = 'barzahlen';
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
+
/**
|
50 |
+
* formular block
|
51 |
+
*
|
52 |
+
* @var string
|
53 |
+
*/
|
54 |
+
protected $_formBlockType = 'barzahlen/form';
|
55 |
|
56 |
+
/**
|
57 |
+
* information block
|
58 |
+
*
|
59 |
+
* @var string
|
60 |
+
*/
|
61 |
+
protected $_infoBlockType = 'barzahlen/info';
|
62 |
|
63 |
+
/**
|
64 |
+
* processing url
|
65 |
+
*
|
66 |
+
* @var string
|
67 |
+
*/
|
68 |
+
protected $_redirectProcessingUrl = 'barzahlen/checkout/processing';
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Availability options
|
72 |
+
*
|
73 |
+
* @var boolean
|
74 |
+
*/
|
75 |
+
protected $_canRefund = true; //!< Barzahlen transactions can be refunded
|
76 |
+
protected $_canRefundInvoicePartial = true; //!< refunds can be done partial
|
77 |
+
protected $_canUseInternal = true; //!< can be used in admin panel checkout
|
78 |
+
protected $_canUseCheckout = true; //!< can be used as method on onepage checkout
|
79 |
+
protected $_canUseForMultishipping = true; //!< can be used as method on multipage checkout
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Barzahlen payment state possible values
|
83 |
+
*
|
84 |
+
* @var string
|
85 |
+
*/
|
86 |
+
const PAYMENTSTATE_PENDING = 'pending'; //!< pending state (new order)
|
87 |
+
const PAYMENTSTATE_PAID = 'paid'; //!< paid state (processing order)
|
88 |
+
const PAYMENTSTATE_EXPIRED = 'expired'; //!< expired state (canceled order)
|
89 |
+
const PAYMENTSTATE_REFUND_PENDING = 'refund_pending'; //!< refund pending state (credit memo OPEN)
|
90 |
+
const PAYMENTSTATE_REFUND_COMPLETED = 'refund_completed'; //!< refund completed state (credit memo REFUNDED)
|
91 |
+
const PAYMENTSTATE_REFUND_EXPIRED = 'refund_expired'; //!< refund expired state (credit memo CANCELED)
|
92 |
+
const PAYMENTSTATE_TEXT_BLOCKS = 'bz_frnt_ipn_'; //!< text block prefix
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Constructs Barzahlen API object.
|
96 |
+
*
|
97 |
+
* @return Barzahlen API object
|
98 |
+
*/
|
99 |
+
public function getBarzahlenApi()
|
100 |
+
{
|
101 |
+
$shopId = $this->getConfigData('shop_id');
|
102 |
+
$paymentKey = $this->getConfigData('payment_key');
|
103 |
+
$sandbox = $this->getConfigData('sandbox');
|
104 |
+
$barzahlenApi = Mage::getModel('barzahlen/api', array('shopId' => $shopId, 'paymentKey' => $paymentKey, 'sandbox' => $sandbox));
|
105 |
+
$barzahlenApi->setLanguage(substr((Mage::getSingleton('core/locale')->getLocaleCode()), 0, 2));
|
106 |
|
107 |
+
if ($this->getConfigData('debug')) {
|
108 |
+
$barzahlenApi->setDebug(true, self::DEFAULT_LOG_FILE);
|
109 |
+
}
|
110 |
|
111 |
+
return $barzahlenApi;
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Redirect URL for checkouts using Barzahlen Payment Method - instead of onepage checkout success page.
|
116 |
+
*
|
117 |
+
* @return string with URL
|
118 |
+
*/
|
119 |
+
public function getOrderPlaceRedirectUrl()
|
120 |
+
{
|
121 |
+
return Mage::getUrl($this->_redirectProcessingUrl);
|
122 |
+
}
|
123 |
}
|
|
app/code/community/ZerebroInternet/Barzahlen/Model/Cancel.php
CHANGED
@@ -14,41 +14,41 @@
|
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
-
class ZerebroInternet_Barzahlen_Model_Cancel extends Mage_Core_Model_Abstract
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
*/
|
29 |
-
public function cancelObserver($order) {
|
30 |
|
31 |
-
|
|
|
|
|
32 |
|
33 |
-
|
34 |
-
Mage::throwException('No valid order choosen.');
|
35 |
-
}
|
36 |
-
|
37 |
-
if($order->getPayment()->getMethod() != ZerebroInternet_Barzahlen_Model_Barzahlen::PAYMENT_CODE) {
|
38 |
-
return;
|
39 |
-
}
|
40 |
|
41 |
-
|
42 |
|
43 |
-
|
|
|
|
|
|
|
|
|
44 |
|
45 |
-
|
46 |
-
Mage::getSingleton('barzahlen/barzahlen')->getBarzahlenApi()->handleRequest($cancel);
|
47 |
}
|
48 |
-
|
49 |
-
Mage::helper('barzahlen')->bzLog($e);
|
50 |
-
}
|
51 |
-
|
52 |
-
return $cancel->isValid();
|
53 |
-
}
|
54 |
-
}
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
+
* @copyright Copyright (c) 2013 Zerebro Internet GmbH (http://www.barzahlen.de)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
+
class ZerebroInternet_Barzahlen_Model_Cancel extends Mage_Core_Model_Abstract
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Cancels pending payment slips together with orders.
|
27 |
+
*
|
28 |
+
* @return boolean
|
29 |
+
*/
|
30 |
+
public function cancelObserver($order)
|
31 |
+
{
|
32 |
+
$order = $order->getOrder();
|
33 |
|
34 |
+
if (!$order->getId()) {
|
35 |
+
Mage::throwException('No valid order choosen.');
|
36 |
+
}
|
|
|
|
|
37 |
|
38 |
+
if ($order->getPayment()->getMethod() != ZerebroInternet_Barzahlen_Model_Barzahlen::PAYMENT_CODE) {
|
39 |
+
return;
|
40 |
+
}
|
41 |
|
42 |
+
$transactionId = $order->getPayment()->getAdditionalInformation('transaction_id');
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
|
44 |
+
$cancel = Mage::getModel('barzahlen/api_request_cancel', array('transactionId' => $transactionId));
|
45 |
|
46 |
+
try {
|
47 |
+
Mage::getSingleton('barzahlen/barzahlen')->getBarzahlenApi()->handleRequest($cancel);
|
48 |
+
} catch (Exception $e) {
|
49 |
+
Mage::helper('barzahlen')->bzLog($e);
|
50 |
+
}
|
51 |
|
52 |
+
return $cancel->isValid();
|
|
|
53 |
}
|
54 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/ZerebroInternet/Barzahlen/Model/Check.php
ADDED
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Barzahlen Payment Module
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to info@barzahlen.de so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category ZerebroInternet
|
16 |
+
* @package ZerebroInternet_Barzahlen
|
17 |
+
* @copyright Copyright (c) 2013 Zerebro Internet GmbH (http://www.barzahlen.de)
|
18 |
+
* @author Martin Seener
|
19 |
+
* @author Alexander Diebler
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
+
*/
|
22 |
+
|
23 |
+
class ZerebroInternet_Barzahlen_Model_Check extends ZerebroInternet_Barzahlen_Model_Api_Abstract
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Checks if a update request is necessary and performs it if so.
|
27 |
+
*
|
28 |
+
* @param Varien_Event_Observer $observer
|
29 |
+
*/
|
30 |
+
public function checkObserver($observer)
|
31 |
+
{
|
32 |
+
$user = $observer->getUser();
|
33 |
+
$extra = unserialize($user->getExtra());
|
34 |
+
|
35 |
+
$lastCheck = Mage::getStoreConfig('payment/barzahlen/last_check');
|
36 |
+
|
37 |
+
if (isset($extra['configState']['payment_barzahlen']) && $extra['configState']['payment_barzahlen'] == 1) {
|
38 |
+
if ($lastCheck == null || $lastCheck < strtotime("-1 week")) {
|
39 |
+
$config = new Mage_Core_Model_Config();
|
40 |
+
$config->saveConfig('payment/barzahlen/last_check', time(), 'default', 0);
|
41 |
+
Mage::getConfig()->cleanCache();
|
42 |
+
$barzahlen = Mage::getSingleton('barzahlen/barzahlen');
|
43 |
+
$transArray['shop_id'] = $barzahlen->getConfigData('shop_id');
|
44 |
+
$transArray['shopsystem'] = 'Magento';
|
45 |
+
$transArray['shopsystem_version'] = Mage::getVersion();
|
46 |
+
$transArray['plugin_version'] = (string) Mage::getConfig()->getNode()->modules->ZerebroInternet_Barzahlen->version;
|
47 |
+
$transArray['hash'] = $this->_createHash($transArray, $barzahlen->getConfigData('payment_key'));
|
48 |
+
|
49 |
+
$currentVersion = $this->_requestVersion($transArray);
|
50 |
+
if ($currentVersion != false) {
|
51 |
+
if ($currentVersion != $transArray['plugin_version']) {
|
52 |
+
Mage::getSingleton('core/session')->addNotice('Barzahlen-Update:' . Mage::helper('barzahlen')->__('bz_adm_now_available') . $currentVersion . Mage::helper('barzahlen')->__('bz_adm_over') . '<a href="' . Mage::helper("adminhtml")->getUrl('adminhtml/extension_local/index') . '">Magento Connect Manager</a>' . Mage::helper('barzahlen')->__('bz_adm_or') . '<a href="http://www.barzahlen.de/partner/integration/shopsysteme/2/magento">Barzahlen Homepage</a>.');
|
53 |
+
}
|
54 |
+
}
|
55 |
+
}
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Requests the current version and parses the xml.
|
61 |
+
*
|
62 |
+
* @param array $transArray
|
63 |
+
* @return boolean | string
|
64 |
+
*/
|
65 |
+
protected function _requestVersion(array $transArray)
|
66 |
+
{
|
67 |
+
$xmlResponse = $this->_curlRequest($transArray);
|
68 |
+
if ($xmlResponse === false) {
|
69 |
+
return false;
|
70 |
+
}
|
71 |
+
|
72 |
+
if (!is_string($xmlResponse) || $xmlResponse == '') {
|
73 |
+
Mage::helper('barzahlen')->bzLog('PluginCheck: No valid xml response received.');
|
74 |
+
return false;
|
75 |
+
}
|
76 |
+
|
77 |
+
try {
|
78 |
+
$xmlObj = new SimpleXMLElement($xmlResponse);
|
79 |
+
} catch (Exception $e) {
|
80 |
+
Mage::helper('barzahlen')->bzLog('PluginCheck: ' . $e);
|
81 |
+
return false;
|
82 |
+
}
|
83 |
+
|
84 |
+
if ($xmlObj->{'result'} != 0) {
|
85 |
+
Mage::helper('barzahlen')->bzLog('PluginCheck: XML response contains an error: ' . $xmlObj->{'error-message'});
|
86 |
+
return false;
|
87 |
+
}
|
88 |
+
|
89 |
+
return $xmlObj->{'plugin-version'};
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Sends the cURL request.
|
94 |
+
*
|
95 |
+
* @param array $transArray
|
96 |
+
* @return boolean | string
|
97 |
+
*/
|
98 |
+
protected function _curlRequest(array $transArray)
|
99 |
+
{
|
100 |
+
try {
|
101 |
+
$curl = curl_init();
|
102 |
+
curl_setopt($curl, CURLOPT_URL, 'https://plugincheck.barzahlen.de/check');
|
103 |
+
curl_setopt($curl, CURLOPT_POST, count($transArray));
|
104 |
+
curl_setopt($curl, CURLOPT_POSTFIELDS, $transArray);
|
105 |
+
curl_setopt($curl, CURLOPT_HEADER, 0);
|
106 |
+
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
107 |
+
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);
|
108 |
+
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
|
109 |
+
curl_setopt($curl, CURLOPT_CAINFO, Mage::getRoot() . '/code/community/ZerebroInternet/Barzahlen/Model/Api/certs/ca-bundle.crt');
|
110 |
+
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
|
111 |
+
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 15);
|
112 |
+
curl_setopt($curl, CURLOPT_HTTP_VERSION, 1.1);
|
113 |
+
$return = curl_exec($curl);
|
114 |
+
$error = curl_error($curl);
|
115 |
+
curl_close($curl);
|
116 |
+
|
117 |
+
if ($error != '') {
|
118 |
+
Mage::helper('barzahlen')->bzLog('PluginCheck: ' . $error);
|
119 |
+
}
|
120 |
+
|
121 |
+
return $return;
|
122 |
+
} catch (Exception $e) {
|
123 |
+
Mage::helper('barzahlen')->bzLog('PluginCheck: ' . $e);
|
124 |
+
return false;
|
125 |
+
}
|
126 |
+
}
|
127 |
+
}
|
app/code/community/ZerebroInternet/Barzahlen/Model/Ipn.php
CHANGED
@@ -14,265 +14,276 @@
|
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
-
class ZerebroInternet_Barzahlen_Model_Ipn
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
$notification = Mage::getModel('barzahlen/api_notification', array('shopId' => $shopId, 'notificationKey' => $notificationKey, 'receivedData' => $ipnData));
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
}
|
46 |
-
catch (Exception $e) {
|
47 |
-
Mage::helper('barzahlen')->bzLog($e, $ipnData);
|
48 |
}
|
49 |
|
50 |
-
|
51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
}
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
62 |
|
63 |
-
|
64 |
-
|
65 |
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
}
|
71 |
-
}
|
72 |
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
|
|
80 |
|
81 |
-
|
82 |
-
Mage::helper('barzahlen')->bzLog('controller/ipn: Unable to find the given order', $this->_receivedData);
|
83 |
-
return false;
|
84 |
}
|
85 |
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
return false;
|
94 |
-
}
|
95 |
}
|
96 |
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
}
|
102 |
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
|
|
|
|
|
|
|
|
|
|
110 |
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
$this->
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
return false;
|
127 |
}
|
128 |
-
}
|
129 |
-
|
130 |
-
/**
|
131 |
-
* Creates invoice and sets order state for paid transactions.
|
132 |
-
*/
|
133 |
-
protected function _processTransactionPaid() {
|
134 |
|
135 |
-
|
136 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
}
|
138 |
|
139 |
-
|
140 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
|
142 |
-
|
143 |
-
* Cancels an order after the period of ten days elasped.
|
144 |
-
*/
|
145 |
-
protected function _processTransactionExpired() {
|
146 |
-
|
147 |
-
$this->_order->registerCancellation($this->_createIpnComment(), false)->save();
|
148 |
-
$this->_order->sendOrderUpdateEmail(true, $this->_createIpnComment());
|
149 |
-
}
|
150 |
-
|
151 |
-
/**
|
152 |
-
* Update order state after refund was completed successful.
|
153 |
-
*/
|
154 |
-
protected function _processRefundCompleted() {
|
155 |
-
if($this->_getCreditmemo()) {
|
156 |
-
$this->_creditmemo->setState(Mage_Sales_Model_Order_Creditmemo::STATE_REFUNDED);
|
157 |
-
$this->_creditmemo->addComment($this->_createIpnComment(), false, true);
|
158 |
-
$this->_creditmemo->save();
|
159 |
}
|
160 |
-
}
|
161 |
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
}
|
172 |
-
}
|
173 |
-
|
174 |
-
/**
|
175 |
-
* Get requested credit memo from the database.
|
176 |
-
*
|
177 |
-
* @return TURE if credit memo was found with refund_transaction_id
|
178 |
-
* @return FALSE if no credit memo was found
|
179 |
-
*/
|
180 |
-
protected function _getCreditmemo() {
|
181 |
-
|
182 |
-
$creditmemos = $this->_order->getCreditmemosCollection();
|
183 |
-
|
184 |
-
foreach($creditmemos as $creditmemo)
|
185 |
-
if($creditmemo->getTransactionId() == $this->_receivedData['refund_transaction_id']) {
|
186 |
-
if($creditmemo->getState() != Mage_Sales_Model_Order_Creditmemo::STATE_OPEN) {
|
187 |
-
Mage::helper('barzahlen')->bzLog('controller/ipn: credit memo already refunded / closed', $this->_receivedData);
|
188 |
-
return false;
|
189 |
-
}
|
190 |
-
if($creditmemo->getGrandTotal() != $this->_receivedData['amount']) {
|
191 |
-
Mage::helper('barzahlen')->bzLog('controller/ipn: credit memo total amount doesn\'t match', $this->_receivedData);
|
192 |
-
return false;
|
193 |
-
}
|
194 |
-
if($creditmemo->getOrderCurrencyCode() != $this->_receivedData['currency']) {
|
195 |
-
Mage::helper('barzahlen')->bzLog('controller/ipn: credit memo currency doesn\'t match', $this->_receivedData);
|
196 |
-
return false;
|
197 |
}
|
198 |
-
$this->_creditmemo
|
199 |
-
return true;
|
200 |
-
}
|
201 |
-
|
202 |
-
Mage::helper('barzahlen')->bzLog('controller/ipn: Unable to find requested creditmemo by refund_transaction_id', $this->_receivedData);
|
203 |
-
return false;
|
204 |
-
}
|
205 |
-
|
206 |
-
/**
|
207 |
-
* Creates the comment for the ipn according to store language.
|
208 |
-
*
|
209 |
-
* @return string with the ipn comment message
|
210 |
-
*/
|
211 |
-
protected function _createIpnComment() {
|
212 |
-
$paymentState = $this->_receivedData['state'];
|
213 |
-
$message = Mage::helper('barzahlen')->__('bz_frnt_ipn_'.$paymentState);
|
214 |
-
return $message;
|
215 |
-
}
|
216 |
-
|
217 |
-
/**
|
218 |
-
* Performs rollback process when a refund is expired.
|
219 |
-
*/
|
220 |
-
protected function _rollbackCreditmemo() {
|
221 |
-
|
222 |
-
$this->_rollbackOrderItems();
|
223 |
-
$this->_rollbackOrderStats();
|
224 |
-
$this->_setNullforZero();
|
225 |
-
|
226 |
-
$this->_order->getPayment()->cancelCreditmemo($this->_creditmemo);
|
227 |
-
}
|
228 |
-
|
229 |
-
/**
|
230 |
-
* Sets back the quantity of the order items after a refund expired. Imitates
|
231 |
-
* Mage_Sales_Model_Order_Item->cancel() since that function doesn't work the expected way.
|
232 |
-
* (Magento v.1.6.1.0)
|
233 |
-
*/
|
234 |
-
protected function _rollbackOrderItems() {
|
235 |
-
foreach ($this->_creditmemo->getAllItems() as $item) {
|
236 |
-
$item->getOrderItem()->setQtyRefunded($item->getOrderItem()->getQtyRefunded() - $item->getQty())->save();
|
237 |
}
|
238 |
-
$this->_creditmemo->save();
|
239 |
-
}
|
240 |
-
|
241 |
-
/**
|
242 |
-
* Sets back order information to the state before the credit memo. Imitates
|
243 |
-
* Mage_Sales_Model_Order_Creditmemo->cancel() since that function doesn't work the expected way.
|
244 |
-
* (Magento v.1.6.1.0)
|
245 |
-
*/
|
246 |
-
protected function _rollbackOrderStats() {
|
247 |
-
|
248 |
-
$this->_order->setTotalOfflineRefunded($this->_order->getTotalOfflineRefunded() - $this->_creditmemo->getGrandTotal());
|
249 |
-
$this->_order->setBaseTotalOfflineRefunded($this->_order->getBaseTotalOfflineRefunded() - $this->_creditmemo->getBaseGrandTotal());
|
250 |
-
$this->_order->setTotalRefunded($this->_order->getTotalOfflineRefunded() + $this->_order->getTotalOnlineRefunded());
|
251 |
-
$this->_order->setBaseTotalRefunded($this->_order->getBaseTotalOfflineRefunded() + $this->_order->getBaseTotalOnlineRefunded());
|
252 |
-
$this->_order->setBaseSubtotalRefunded($this->_order->getBaseSubtotalRefunded() - $this->_creditmemo->getBaseSubtotal());
|
253 |
-
$this->_order->setSubtotalRefunded($this->_order->getSubtotalRefunded() - $this->_creditmemo->getSubtotal());
|
254 |
-
$this->_order->setBaseTaxRefunded($this->_order->getBaseTaxRefunded() - $this->_creditmemo->getBaseTaxAmount());
|
255 |
-
$this->_order->setTaxRefunded($this->_order->getTaxRefunded() - $this->_creditmemo->getTaxAmount());
|
256 |
-
$this->_order->setBaseShippingRefunded($this->_order->getBaseShippingRefunded() - $this->_creditmemo->getBaseShippingAmount());
|
257 |
-
$this->_order->setShippingRefunded($this->_order->getShippingRefunded() - $this->_creditmemo->getShippingAmount());
|
258 |
-
}
|
259 |
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
265 |
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
277 |
}
|
278 |
-
?>
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
+
* @copyright Copyright (c) 2013 Zerebro Internet GmbH (http://www.barzahlen.de)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
+
class ZerebroInternet_Barzahlen_Model_Ipn
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Received data from the server.
|
27 |
+
*
|
28 |
+
* @var array
|
29 |
+
*/
|
30 |
+
protected $_receivedData = array();
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Corresponding Order
|
34 |
+
*
|
35 |
+
* @var Mage_Sales_Model_Order
|
36 |
+
*/
|
37 |
+
protected $_order;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Corresponding Credit Memo
|
41 |
+
*
|
42 |
+
* @var Mage_Sales_Model_Order_Creditmemo
|
43 |
+
*/
|
44 |
+
protected $_creditmemo;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Checks received data and validates hash.
|
48 |
+
*
|
49 |
+
* @param string $uncleanData received data
|
50 |
+
* @return TRUE if received get array is valid and hash could be confirmed
|
51 |
+
* @return FALSE if an error occurred
|
52 |
+
*/
|
53 |
+
|
54 |
+
public function sendResponseHeader($ipnData)
|
55 |
+
{
|
56 |
+
$barzahlen = Mage::getModel('barzahlen/barzahlen');
|
57 |
+
$shopId = $barzahlen->getConfigData('shop_id');
|
58 |
+
$notificationKey = $barzahlen->getConfigData('notification_key');
|
59 |
+
$notification = Mage::getModel('barzahlen/api_notification', array('shopId' => $shopId, 'notificationKey' => $notificationKey, 'receivedData' => $ipnData));
|
60 |
+
|
61 |
+
try {
|
62 |
+
$notification->validate();
|
63 |
+
} catch (Exception $e) {
|
64 |
+
Mage::helper('barzahlen')->bzLog($e, $ipnData);
|
65 |
+
}
|
66 |
|
67 |
+
if (!$notification->isValid()) {
|
68 |
+
return false;
|
69 |
+
}
|
|
|
70 |
|
71 |
+
$this->_receivedData = $notification->getNotificationArray();
|
72 |
+
return true;
|
|
|
|
|
|
|
73 |
}
|
74 |
|
75 |
+
/**
|
76 |
+
* Parent function to update the database with all information.
|
77 |
+
*/
|
78 |
+
public function updateDatabase()
|
79 |
+
{
|
80 |
+
$orderId = isset($this->_receivedData['origin_order_id']) ? $this->_receivedData['origin_order_id'] : $this->_receivedData['order_id'];
|
81 |
+
$this->_order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
|
82 |
+
|
83 |
+
if ($this->_checkOrderInformation()) {
|
84 |
+
if ($this->_handleStateChange()) {
|
85 |
+
$this->_order->save();
|
86 |
+
}
|
87 |
+
}
|
88 |
}
|
89 |
|
90 |
+
/**
|
91 |
+
* Checks that there's an valid transaction id for the requested order.
|
92 |
+
*
|
93 |
+
* @return TRUE if transaction id was found and validated
|
94 |
+
* @return FALSE if transaction id was not found or could not be validated
|
95 |
+
*/
|
96 |
+
protected function _checkOrderInformation()
|
97 |
+
{
|
98 |
+
if (!$this->_order->getId()) {
|
99 |
+
Mage::helper('barzahlen')->bzLog('controller/ipn: Unable to find the given order', $this->_receivedData);
|
100 |
+
return false;
|
101 |
+
}
|
102 |
|
103 |
+
$transactionId = isset($this->_receivedData['origin_transaction_id']) ? $this->_receivedData['origin_transaction_id'] : $this->_receivedData['transaction_id'];
|
104 |
+
if ($transactionId != $this->_order->getPayment()->getAdditionalInformation('transaction_id')) {
|
105 |
+
Mage::helper('barzahlen')->bzLog('controller/ipn: Unable to find the transaction id in the given order', $this->_receivedData);
|
106 |
+
return false;
|
107 |
+
}
|
108 |
|
109 |
+
return true;
|
110 |
+
}
|
111 |
|
112 |
+
/**
|
113 |
+
* Calls the necessary method for the send state.
|
114 |
+
*/
|
115 |
+
protected function _handleStateChange()
|
116 |
+
{
|
117 |
+
switch ($this->_receivedData['state']) {
|
118 |
+
case ZerebroInternet_Barzahlen_Model_Barzahlen::PAYMENTSTATE_PAID:
|
119 |
+
$this->_processTransactionPaid();
|
120 |
+
return true;
|
121 |
+
case ZerebroInternet_Barzahlen_Model_Barzahlen::PAYMENTSTATE_EXPIRED:
|
122 |
+
$this->_processTransactionExpired();
|
123 |
+
return true;
|
124 |
+
case ZerebroInternet_Barzahlen_Model_Barzahlen::PAYMENTSTATE_REFUND_COMPLETED:
|
125 |
+
$this->_processRefundCompleted();
|
126 |
+
return true;
|
127 |
+
case ZerebroInternet_Barzahlen_Model_Barzahlen::PAYMENTSTATE_REFUND_EXPIRED:
|
128 |
+
$this->_processRefundExpired();
|
129 |
+
return true;
|
130 |
+
default:
|
131 |
+
Mage::helper('barzahlen')->bzLog('controller/ipn: Cannot handle payment state', $this->_receivedData);
|
132 |
+
return false;
|
133 |
+
}
|
134 |
}
|
|
|
135 |
|
136 |
+
/**
|
137 |
+
* Creates invoice and sets order state for paid transactions.
|
138 |
+
*/
|
139 |
+
protected function _processTransactionPaid()
|
140 |
+
{
|
141 |
+
if (!$this->_order->canInvoice()) {
|
142 |
+
return;
|
143 |
+
}
|
144 |
|
145 |
+
Mage::getModel('sales/order_invoice_api')->create($this->_order->getIncrementId(), array(), $this->_createIpnComment(), true, true);
|
|
|
|
|
146 |
}
|
147 |
|
148 |
+
/**
|
149 |
+
* Cancels an order after the period of ten days elasped.
|
150 |
+
*/
|
151 |
+
protected function _processTransactionExpired()
|
152 |
+
{
|
153 |
+
$this->_order->registerCancellation($this->_createIpnComment(), false)->save();
|
154 |
+
$this->_order->sendOrderUpdateEmail(true, $this->_createIpnComment());
|
|
|
|
|
155 |
}
|
156 |
|
157 |
+
/**
|
158 |
+
* Update order state after refund was completed successful.
|
159 |
+
*/
|
160 |
+
protected function _processRefundCompleted()
|
161 |
+
{
|
162 |
+
if ($this->_getCreditmemo()) {
|
163 |
+
$this->_creditmemo->setState(Mage_Sales_Model_Order_Creditmemo::STATE_REFUNDED);
|
164 |
+
$this->_creditmemo->addComment($this->_createIpnComment(), false, true);
|
165 |
+
$this->_creditmemo->save();
|
166 |
+
}
|
167 |
}
|
168 |
|
169 |
+
/**
|
170 |
+
* Sets an order be to completed after the period of thrity days for the refund elasped.
|
171 |
+
*/
|
172 |
+
protected function _processRefundExpired()
|
173 |
+
{
|
174 |
+
if ($this->_getCreditmemo()) {
|
175 |
+
$this->_creditmemo->setState(Mage_Sales_Model_Order_Creditmemo::STATE_CANCELED);
|
176 |
+
$this->_creditmemo->addComment($this->_createIpnComment(), false, true);
|
177 |
+
$this->_rollbackCreditmemo();
|
178 |
+
$this->_creditmemo->save();
|
179 |
+
}
|
180 |
+
}
|
181 |
|
182 |
+
/**
|
183 |
+
* Get requested credit memo from the database.
|
184 |
+
*
|
185 |
+
* @return TURE if credit memo was found with refund_transaction_id
|
186 |
+
* @return FALSE if no credit memo was found
|
187 |
+
*/
|
188 |
+
protected function _getCreditmemo()
|
189 |
+
{
|
190 |
+
$creditmemos = $this->_order->getCreditmemosCollection();
|
191 |
+
|
192 |
+
foreach ($creditmemos as $creditmemo)
|
193 |
+
if ($creditmemo->getTransactionId() == $this->_receivedData['refund_transaction_id']) {
|
194 |
+
if ($creditmemo->getState() != Mage_Sales_Model_Order_Creditmemo::STATE_OPEN) {
|
195 |
+
Mage::helper('barzahlen')->bzLog('controller/ipn: credit memo already refunded / closed', $this->_receivedData);
|
196 |
+
return false;
|
197 |
+
}
|
198 |
+
$this->_creditmemo = $creditmemo;
|
199 |
+
return true;
|
200 |
+
}
|
201 |
+
|
202 |
+
Mage::helper('barzahlen')->bzLog('controller/ipn: Unable to find requested creditmemo by refund_transaction_id', $this->_receivedData);
|
203 |
return false;
|
204 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
205 |
|
206 |
+
/**
|
207 |
+
* Creates the comment for the ipn according to store language.
|
208 |
+
*
|
209 |
+
* @return string with the ipn comment message
|
210 |
+
*/
|
211 |
+
protected function _createIpnComment()
|
212 |
+
{
|
213 |
+
$paymentState = $this->_receivedData['state'];
|
214 |
+
$message = Mage::helper('barzahlen')->__('bz_frnt_ipn_' . $paymentState);
|
215 |
+
return $message;
|
216 |
}
|
217 |
|
218 |
+
/**
|
219 |
+
* Performs rollback process when a refund is expired.
|
220 |
+
*/
|
221 |
+
protected function _rollbackCreditmemo()
|
222 |
+
{
|
223 |
+
$this->_rollbackOrderItems();
|
224 |
+
$this->_rollbackOrderStats();
|
225 |
+
$this->_setNullforZero();
|
226 |
|
227 |
+
$this->_order->getPayment()->cancelCreditmemo($this->_creditmemo);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
}
|
|
|
229 |
|
230 |
+
/**
|
231 |
+
* Sets back the quantity of the order items after a refund expired. Imitates
|
232 |
+
* Mage_Sales_Model_Order_Item->cancel() since that function doesn't work the expected way.
|
233 |
+
* (Magento v.1.6.1.0)
|
234 |
+
*/
|
235 |
+
protected function _rollbackOrderItems()
|
236 |
+
{
|
237 |
+
foreach ($this->_creditmemo->getAllItems() as $item) {
|
238 |
+
$item->getOrderItem()->setQtyRefunded($item->getOrderItem()->getQtyRefunded() - $item->getQty())->save();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
}
|
240 |
+
$this->_creditmemo->save();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
|
243 |
+
/**
|
244 |
+
* Sets back order information to the state before the credit memo. Imitates
|
245 |
+
* Mage_Sales_Model_Order_Creditmemo->cancel() since that function doesn't work the expected way.
|
246 |
+
* (Magento v.1.6.1.0)
|
247 |
+
*/
|
248 |
+
protected function _rollbackOrderStats()
|
249 |
+
{
|
250 |
+
$this->_order->setTotalOfflineRefunded($this->_order->getTotalOfflineRefunded() - $this->_creditmemo->getGrandTotal());
|
251 |
+
$this->_order->setBaseTotalOfflineRefunded($this->_order->getBaseTotalOfflineRefunded() - $this->_creditmemo->getBaseGrandTotal());
|
252 |
+
$this->_order->setTotalRefunded($this->_order->getTotalOfflineRefunded() + $this->_order->getTotalOnlineRefunded());
|
253 |
+
$this->_order->setBaseTotalRefunded($this->_order->getBaseTotalOfflineRefunded() + $this->_order->getBaseTotalOnlineRefunded());
|
254 |
+
$this->_order->setBaseSubtotalRefunded($this->_order->getBaseSubtotalRefunded() - $this->_creditmemo->getBaseSubtotal());
|
255 |
+
$this->_order->setSubtotalRefunded($this->_order->getSubtotalRefunded() - $this->_creditmemo->getSubtotal());
|
256 |
+
$this->_order->setBaseTaxRefunded($this->_order->getBaseTaxRefunded() - $this->_creditmemo->getBaseTaxAmount());
|
257 |
+
$this->_order->setTaxRefunded($this->_order->getTaxRefunded() - $this->_creditmemo->getTaxAmount());
|
258 |
+
$this->_order->setBaseShippingRefunded($this->_order->getBaseShippingRefunded() - $this->_creditmemo->getBaseShippingAmount());
|
259 |
+
$this->_order->setShippingRefunded($this->_order->getShippingRefunded() - $this->_creditmemo->getShippingAmount());
|
260 |
+
}
|
261 |
|
262 |
+
/**
|
263 |
+
* Replaces 0 by null to avoid automatic state setting by Mage_Sales_Model_Order after complete
|
264 |
+
* refund rollback.
|
265 |
+
*/
|
266 |
+
protected function _setNullforZero()
|
267 |
+
{
|
268 |
+
if ($this->_order->getTotalOfflineRefunded() <= 0)
|
269 |
+
$this->_order->setTotalOfflineRefunded(null);
|
270 |
+
if ($this->_order->getBaseTotalOfflineRefunded() <= 0)
|
271 |
+
$this->_order->setBaseTotalOfflineRefunded(null);
|
272 |
+
if ($this->_order->getTotalOfflineRefunded() <= 0)
|
273 |
+
$this->_order->setTotalRefunded(null);
|
274 |
+
if ($this->_order->getBaseTotalOfflineRefunded() <= 0)
|
275 |
+
$this->_order->setBaseTotalRefunded(null);
|
276 |
+
if ($this->_order->getBaseSubtotalRefunded() <= 0)
|
277 |
+
$this->_order->setBaseSubtotalRefunded(null);
|
278 |
+
if ($this->_order->getSubtotalRefunded() <= 0)
|
279 |
+
$this->_order->setSubtotalRefunded(null);
|
280 |
+
if ($this->_order->getBaseTaxRefunded() <= 0)
|
281 |
+
$this->_order->setBaseTaxRefunded(null);
|
282 |
+
if ($this->_order->getTaxRefunded() <= 0)
|
283 |
+
$this->_order->setTaxRefunded(null);
|
284 |
+
if ($this->_order->getBaseShippingRefunded() <= 0)
|
285 |
+
$this->_order->setBaseShippingRefunded(null);
|
286 |
+
if ($this->_order->getShippingRefunded() <= 0)
|
287 |
+
$this->_order->setShippingRefunded(null);
|
288 |
+
}
|
289 |
}
|
|
app/code/community/ZerebroInternet/Barzahlen/Model/Payment.php
CHANGED
@@ -14,183 +14,177 @@
|
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
-
class ZerebroInternet_Barzahlen_Model_Payment extends ZerebroInternet_Barzahlen_Model_Barzahlen
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
}
|
51 |
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
}
|
59 |
-
}
|
60 |
-
|
61 |
-
/**
|
62 |
-
* Performs payment handling and order update.
|
63 |
-
*/
|
64 |
-
public function getTransactionId() {
|
65 |
-
|
66 |
-
$orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
|
67 |
-
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
|
68 |
|
69 |
-
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
}
|
72 |
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
$currency = $order->getOrderCurrencyCode();
|
108 |
-
$payment = Mage::getModel('barzahlen/api_request_payment',
|
109 |
-
array('customerEmail' => $customerEmail, 'customerStreetNr' => $customerStreetNr,
|
110 |
-
'customerZipcode' => $customerZipcode, 'customerCity' => $customerCity,
|
111 |
-
'customerCountry' => $customerCountry, 'orderId' => $order->getRealOrderId(), 'amount' => $amount, 'currency' => $currency));
|
112 |
-
|
113 |
-
// filter the 3 custom vars and escape them for HTML compliance
|
114 |
-
$tcHelper = Mage::getModel('core/email_template_filter');
|
115 |
-
$customVar0 = $tcHelper->filter($this->getConfigData('custom_var_0'));
|
116 |
-
$customVar1 = $tcHelper->filter($this->getConfigData('custom_var_1'));
|
117 |
-
$customVar2 = $tcHelper->filter($this->getConfigData('custom_var_2'));
|
118 |
-
$payment->setCustomVar($customVar0, $customVar1, $customVar2);
|
119 |
-
|
120 |
-
return $payment;
|
121 |
-
}
|
122 |
-
|
123 |
-
/**
|
124 |
-
* Validates, that the order exists, Barzahlen was choosen and the order wasn't paid yet.
|
125 |
-
*
|
126 |
-
* @param Mage_Sales_Model_Order $order
|
127 |
-
* @return boolean
|
128 |
-
*/
|
129 |
-
protected function _validateOrder($order) {
|
130 |
-
|
131 |
-
// check if order exisits
|
132 |
-
if (!$order->getId()) {
|
133 |
-
Mage::helper('barzahlen')->bzLog('controllers/checkout: order not existing, aborting/redirecting');
|
134 |
-
return false;
|
135 |
-
}
|
136 |
-
|
137 |
-
// get order payment and its information
|
138 |
-
$payment = $order->getPayment();
|
139 |
-
$code = $payment->getMethod();
|
140 |
-
$transactionId = $payment->getAdditionalInformation('transaction_id');
|
141 |
-
|
142 |
-
// check that Barzahlen was choosen
|
143 |
-
if($code != self::PAYMENT_CODE) {
|
144 |
-
$errorData = array($order->getId(), $code);
|
145 |
-
Mage::helper('barzahlen')->bzLog('controllers/checkout: Barzahlen was not choosen as payment method', $errorData);
|
146 |
-
return false;
|
147 |
}
|
148 |
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
}
|
155 |
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
/**
|
176 |
-
* Sets all information for the success page.
|
177 |
-
*
|
178 |
-
* @param Mage_Sales_Model_Order $order
|
179 |
-
* @param array $xmlArray array with xml response information
|
180 |
-
*/
|
181 |
-
protected function _registerSuccess($order, array $xmlArray, $admin = false) {
|
182 |
-
|
183 |
-
$session = Mage::getSingleton('checkout/session');
|
184 |
-
$session->setResponse('200');
|
185 |
-
$session->setBzInfotext1($xmlArray['infotext-1']);
|
186 |
-
$session->getQuote()->setIsActive(false)->save();
|
187 |
-
|
188 |
-
$order->getPayment()->setAdditionalInformation('transaction_id', $xmlArray['transaction-id']);
|
189 |
-
if(!$admin) {
|
190 |
-
$order->sendNewOrderEmail();
|
191 |
}
|
192 |
-
$order->addStatusHistoryComment(Mage::helper('barzahlen')->__('bz_frnt_ipn_pending'), Mage::getModel('barzahlen/barzahlen')->getConfigData('order_status'));
|
193 |
-
$order->save();
|
194 |
-
}
|
195 |
}
|
196 |
-
?>
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
+
* @copyright Copyright (c) 2013 Zerebro Internet GmbH (http://www.barzahlen.de)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
+
class ZerebroInternet_Barzahlen_Model_Payment extends ZerebroInternet_Barzahlen_Model_Barzahlen
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Observer action if Barzahlen was choosen as payment method for backend
|
27 |
+
* order creation.
|
28 |
+
*
|
29 |
+
* @param Mage_Sales_Model_Order $order
|
30 |
+
* @param Mage_Sales_Model_Quote $quote
|
31 |
+
* @return null
|
32 |
+
*/
|
33 |
+
public function adminObserver($order, $quote)
|
34 |
+
{
|
35 |
+
$order = $order->getOrder();
|
36 |
+
|
37 |
+
if ($order->getPayment()->getMethod() != ZerebroInternet_Barzahlen_Model_Barzahlen::PAYMENT_CODE) {
|
38 |
+
return;
|
39 |
+
}
|
40 |
+
|
41 |
+
$payment = $this->_createPayment($order);
|
42 |
+
|
43 |
+
try {
|
44 |
+
Mage::getSingleton('barzahlen/barzahlen')->getBarzahlenApi()->handleRequest($payment);
|
45 |
+
} catch (Exception $e) {
|
46 |
+
Mage::helper('barzahlen')->bzLog($e);
|
47 |
+
$this->_registerFailure($order);
|
48 |
+
Mage::throwException(Mage::helper('barzahlen')->__('bz_adm_resend_error'));
|
49 |
+
}
|
50 |
+
|
51 |
+
if ($payment->isValid()) {
|
52 |
+
$this->_registerSuccess($order, $payment->getXmlArray(), true);
|
53 |
+
} else {
|
54 |
+
$this->_registerFailure($order);
|
55 |
+
Mage::throwException(Mage::helper('barzahlen')->__('bz_adm_resend_error'));
|
56 |
+
}
|
57 |
}
|
58 |
|
59 |
+
/**
|
60 |
+
* Performs payment handling and order update.
|
61 |
+
*/
|
62 |
+
public function getTransactionId()
|
63 |
+
{
|
64 |
+
$orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
|
65 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
|
66 |
+
|
67 |
+
if (!$this->_validateOrder($order)) {
|
68 |
+
return;
|
69 |
+
}
|
70 |
+
|
71 |
+
$payment = $this->_createPayment($order);
|
72 |
+
|
73 |
+
try {
|
74 |
+
Mage::getSingleton('barzahlen/barzahlen')->getBarzahlenApi()->handleRequest($payment);
|
75 |
+
} catch (Exception $e) {
|
76 |
+
Mage::helper('barzahlen')->bzLog($e);
|
77 |
+
$this->_registerFailure($order);
|
78 |
+
throw $e;
|
79 |
+
}
|
80 |
+
|
81 |
+
if ($payment->isValid()) {
|
82 |
+
$this->_registerSuccess($order, $payment->getXmlArray());
|
83 |
+
} else {
|
84 |
+
$this->_registerFailure($order);
|
85 |
+
}
|
86 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
|
88 |
+
/**
|
89 |
+
* Generates Barzahlen_Payment_Request from order details.
|
90 |
+
*
|
91 |
+
* @param Mage_Sales_Model_Order $order
|
92 |
+
* @return Barzahlen_Request_Payment
|
93 |
+
*/
|
94 |
+
protected function _createPayment(Mage_Sales_Model_Order $order)
|
95 |
+
{
|
96 |
+
$orderAddress = $order->getBillingAddress();
|
97 |
+
$customerEmail = $order->getCustomerEmail();
|
98 |
+
$customerStreetNr = $orderAddress->getData("street");
|
99 |
+
$customerZipcode = $orderAddress->getData("postcode");
|
100 |
+
$customerCity = $orderAddress->getData("city");
|
101 |
+
$customerCountry = $orderAddress->getData("country_id");
|
102 |
+
$amount = Mage::getSingleton('core/store')->roundPrice($order->getGrandTotal(), 2);
|
103 |
+
$currency = $order->getOrderCurrencyCode();
|
104 |
+
$payment = Mage::getModel('barzahlen/api_request_payment', array('customerEmail' => $customerEmail, 'customerStreetNr' => $customerStreetNr,
|
105 |
+
'customerZipcode' => $customerZipcode, 'customerCity' => $customerCity,
|
106 |
+
'customerCountry' => $customerCountry, 'orderId' => $order->getRealOrderId(), 'amount' => $amount, 'currency' => $currency));
|
107 |
+
|
108 |
+
// filter the 3 custom vars and escape them for HTML compliance
|
109 |
+
$tcHelper = Mage::getModel('core/email_template_filter');
|
110 |
+
$customVar0 = $tcHelper->filter($this->getConfigData('custom_var_0'));
|
111 |
+
$customVar1 = $tcHelper->filter($this->getConfigData('custom_var_1'));
|
112 |
+
$customVar2 = $tcHelper->filter($this->getConfigData('custom_var_2'));
|
113 |
+
$payment->setCustomVar($customVar0, $customVar1, $customVar2);
|
114 |
+
|
115 |
+
return $payment;
|
116 |
}
|
117 |
|
118 |
+
/**
|
119 |
+
* Validates, that the order exists, Barzahlen was choosen and the order wasn't paid yet.
|
120 |
+
*
|
121 |
+
* @param Mage_Sales_Model_Order $order
|
122 |
+
* @return boolean
|
123 |
+
*/
|
124 |
+
protected function _validateOrder($order)
|
125 |
+
{
|
126 |
+
// check if order exisits
|
127 |
+
if (!$order->getId()) {
|
128 |
+
Mage::helper('barzahlen')->bzLog('controllers/checkout: order not existing, aborting/redirecting');
|
129 |
+
return false;
|
130 |
+
}
|
131 |
+
|
132 |
+
// get order payment and its information
|
133 |
+
$payment = $order->getPayment();
|
134 |
+
$code = $payment->getMethod();
|
135 |
+
$transactionId = $payment->getAdditionalInformation('transaction_id');
|
136 |
+
|
137 |
+
// check that Barzahlen was choosen
|
138 |
+
if ($code != self::PAYMENT_CODE) {
|
139 |
+
$errorData = array($order->getId(), $code);
|
140 |
+
Mage::helper('barzahlen')->bzLog('controllers/checkout: Barzahlen was not choosen as payment method', $errorData);
|
141 |
+
return false;
|
142 |
+
}
|
143 |
+
|
144 |
+
// check that order isn't paid yet and is still payable
|
145 |
+
if ($transactionId != '' || $order->getState() == Mage_Sales_Model_Order::STATE_CANCELED) {
|
146 |
+
$errorData = array($order->getId(), $transactionId);
|
147 |
+
Mage::helper('barzahlen')->bzLog('controllers/checkout: order already got an transaction id', $errorData);
|
148 |
+
return false;
|
149 |
+
}
|
150 |
+
|
151 |
+
return true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
}
|
153 |
|
154 |
+
/**
|
155 |
+
* Sets all information for the failure page.
|
156 |
+
*
|
157 |
+
* @param Mage_Sales_Model_Order $order
|
158 |
+
*/
|
159 |
+
protected function _registerFailure($order)
|
160 |
+
{
|
161 |
+
$session = Mage::getSingleton('checkout/session');
|
162 |
+
$session->setResponse('400');
|
163 |
+
$session->getQuote()->setIsActive(false)->save();
|
164 |
+
|
165 |
+
$errorMsg = Mage::helper('barzahlen')->__('bz_frnt_ipn_denied');
|
166 |
+
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, true, $errorMsg);
|
167 |
+
$order->save();
|
168 |
}
|
169 |
|
170 |
+
/**
|
171 |
+
* Sets all information for the success page.
|
172 |
+
*
|
173 |
+
* @param Mage_Sales_Model_Order $order
|
174 |
+
* @param array $xmlArray array with xml response information
|
175 |
+
*/
|
176 |
+
protected function _registerSuccess($order, array $xmlArray, $admin = false)
|
177 |
+
{
|
178 |
+
$session = Mage::getSingleton('checkout/session');
|
179 |
+
$session->setResponse('200');
|
180 |
+
$session->setBzInfotext1($xmlArray['infotext-1']);
|
181 |
+
$session->getQuote()->setIsActive(false)->save();
|
182 |
+
|
183 |
+
$order->getPayment()->setAdditionalInformation('transaction_id', $xmlArray['transaction-id']);
|
184 |
+
if (!$admin) {
|
185 |
+
$order->sendNewOrderEmail();
|
186 |
+
}
|
187 |
+
$order->addStatusHistoryComment(Mage::helper('barzahlen')->__('bz_frnt_ipn_pending'), Mage::getModel('barzahlen/barzahlen')->getConfigData('order_status'));
|
188 |
+
$order->save();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
}
|
|
|
|
|
|
|
190 |
}
|
|
app/code/community/ZerebroInternet/Barzahlen/Model/Refund.php
CHANGED
@@ -14,61 +14,57 @@
|
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
-
class ZerebroInternet_Barzahlen_Model_Refund extends Mage_Core_Model_Abstract
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
* @return Varien_Event_Observer with updated data
|
30 |
-
*/
|
31 |
-
public function refundObserver($observer) {
|
32 |
|
33 |
-
|
34 |
-
|
|
|
35 |
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
if($order->getPayment()->getMethod() != ZerebroInternet_Barzahlen_Model_Barzahlen::PAYMENT_CODE) {
|
42 |
-
return $observer;
|
43 |
-
}
|
44 |
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
|
|
|
|
|
|
|
|
|
|
57 |
|
58 |
-
|
59 |
-
$creditmemo->setState(Mage_Sales_Model_Order_Creditmemo::STATE_OPEN);
|
60 |
-
$creditmemo->setTransactionId($refund->getRefundTransactionId());
|
61 |
-
$creditmemo->addComment(Mage::helper('barzahlen')->__('bz_adm_refund_success'), false, true);
|
62 |
-
$creditmemo->save();
|
63 |
-
}
|
64 |
-
elseif($refund->getOriginTransactionId() != $transactionId) {
|
65 |
-
Mage::helper('barzahlen')->bzLog('model/refund: refund transaction id doesn\'t match origin transaction id');
|
66 |
-
Mage::throwException(Mage::helper('barzahlen')->__('bz_adm_refund_error'));
|
67 |
}
|
68 |
-
|
69 |
-
Mage::throwException(Mage::helper('barzahlen')->__('bz_adm_refund_error'));
|
70 |
-
}
|
71 |
-
|
72 |
-
return $observer;
|
73 |
-
}
|
74 |
-
}
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
+
* @copyright Copyright (c) 2013 Zerebro Internet GmbH (http://www.barzahlen.de)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
+
class ZerebroInternet_Barzahlen_Model_Refund extends Mage_Core_Model_Abstract
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Catches the credit memo process and requests a refund by connecting to Barzahlen.
|
27 |
+
*
|
28 |
+
* @param Varien_Event_Observer $observer
|
29 |
+
* @return Varien_Event_Observer with updated data
|
30 |
+
*/
|
31 |
+
public function refundObserver($observer)
|
32 |
+
{
|
33 |
+
$creditmemo = $observer->getEvent()->getcreditmemo();
|
34 |
+
$order = $creditmemo->getOrder();
|
35 |
|
36 |
+
if (!$order->getId()) {
|
37 |
+
Mage::helper('barzahlen')->bzLog('model/refund: no valid order choosen');
|
38 |
+
Mage::throwException(Mage::helper('barzahlen')->__('bz_adm_refund_error'));
|
39 |
+
}
|
|
|
|
|
|
|
40 |
|
41 |
+
if ($order->getPayment()->getMethod() != ZerebroInternet_Barzahlen_Model_Barzahlen::PAYMENT_CODE) {
|
42 |
+
return $observer;
|
43 |
+
}
|
44 |
|
45 |
+
$transactionId = $order->getPayment()->getAdditionalInformation('transaction_id');
|
46 |
+
$amount = round($creditmemo->getGrandTotal(), 2);
|
47 |
+
$currency = $order->getOrderCurrencyCode();
|
48 |
+
$refund = Mage::getModel('barzahlen/api_request_refund', array('transactionId' => $transactionId, 'amount' => $amount, 'currency' => $currency));
|
|
|
|
|
|
|
|
|
49 |
|
50 |
+
try {
|
51 |
+
Mage::getSingleton('barzahlen/barzahlen')->getBarzahlenApi()->handleRequest($refund);
|
52 |
+
} catch (Exception $e) {
|
53 |
+
Mage::helper('barzahlen')->bzLog($e);
|
54 |
+
}
|
55 |
|
56 |
+
if ($refund->isValid() && $refund->getOriginTransactionId() == $transactionId) {
|
57 |
+
$creditmemo->setState(Mage_Sales_Model_Order_Creditmemo::STATE_OPEN);
|
58 |
+
$creditmemo->setTransactionId($refund->getRefundTransactionId());
|
59 |
+
$creditmemo->addComment(Mage::helper('barzahlen')->__('bz_adm_refund_success'), false, true);
|
60 |
+
$creditmemo->save();
|
61 |
+
} elseif ($refund->getOriginTransactionId() != $transactionId) {
|
62 |
+
Mage::helper('barzahlen')->bzLog('model/refund: refund transaction id doesn\'t match origin transaction id');
|
63 |
+
Mage::throwException(Mage::helper('barzahlen')->__('bz_adm_refund_error'));
|
64 |
+
} else {
|
65 |
+
Mage::throwException(Mage::helper('barzahlen')->__('bz_adm_refund_error'));
|
66 |
+
}
|
67 |
|
68 |
+
return $observer;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
}
|
70 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/ZerebroInternet/Barzahlen/Model/Resend.php
CHANGED
@@ -14,33 +14,30 @@
|
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
-
class ZerebroInternet_Barzahlen_Model_Resend extends ZerebroInternet_Barzahlen_Model_Barzahlen
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
*/
|
31 |
-
public function resend($transactionId) {
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
try {
|
36 |
-
Mage::getSingleton('barzahlen/barzahlen')->getBarzahlenApi()->handleRequest($resend);
|
37 |
-
}
|
38 |
-
catch(Exception $e) {
|
39 |
-
Mage::helper('barzahlen')->bzLog($e);
|
40 |
}
|
41 |
-
|
42 |
-
return $resend->isValid();
|
43 |
-
}
|
44 |
}
|
45 |
-
|
46 |
-
?>
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
+
* @copyright Copyright (c) 2013 Zerebro Internet GmbH (http://www.barzahlen.de)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
+
class ZerebroInternet_Barzahlen_Model_Resend extends ZerebroInternet_Barzahlen_Model_Barzahlen
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Sends resend request to Barzahlen and returns if request was successful.
|
27 |
+
*
|
28 |
+
* @param integer $transactionId Barzahlen Transaction ID
|
29 |
+
* @return boolean
|
30 |
+
*/
|
31 |
+
public function resend($transactionId)
|
32 |
+
{
|
33 |
+
$resend = Mage::getModel('barzahlen/api_request_resend', array('transactionId' => $transactionId));
|
34 |
|
35 |
+
try {
|
36 |
+
Mage::getSingleton('barzahlen/barzahlen')->getBarzahlenApi()->handleRequest($resend);
|
37 |
+
} catch (Exception $e) {
|
38 |
+
Mage::helper('barzahlen')->bzLog($e);
|
39 |
+
}
|
|
|
|
|
40 |
|
41 |
+
return $resend->isValid();
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
}
|
|
|
|
|
|
|
43 |
}
|
|
|
|
app/code/community/ZerebroInternet/Barzahlen/controllers/CheckoutController.php
CHANGED
@@ -14,29 +14,27 @@
|
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
-
class ZerebroInternet_Barzahlen_CheckoutController extends Mage_Core_Controller_Front_Action
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
public function processingAction() {
|
29 |
-
|
30 |
-
try {
|
31 |
-
Mage::getSingleton('barzahlen/payment')->getTransactionId();
|
32 |
-
}
|
33 |
-
catch (Exception $e) {
|
34 |
-
Mage::logException($e);
|
35 |
}
|
36 |
-
|
37 |
-
// load success / failure page (final checkout page)
|
38 |
-
$this->loadLayout();
|
39 |
-
$this->renderLayout();
|
40 |
-
}
|
41 |
}
|
42 |
-
?>
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
+
* @copyright Copyright (c) 2013 Zerebro Internet GmbH (http://www.barzahlen.de)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
+
class ZerebroInternet_Barzahlen_CheckoutController extends Mage_Core_Controller_Front_Action
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Checkout function for the Magento shop system.
|
27 |
+
*/
|
28 |
+
public function processingAction()
|
29 |
+
{
|
30 |
+
try {
|
31 |
+
Mage::getSingleton('barzahlen/payment')->getTransactionId();
|
32 |
+
} catch (Exception $e) {
|
33 |
+
Mage::logException($e);
|
34 |
+
}
|
35 |
|
36 |
+
// load success / failure page (final checkout page)
|
37 |
+
$this->loadLayout();
|
38 |
+
$this->renderLayout();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
}
|
|
|
|
|
|
|
|
|
|
|
40 |
}
|
|
app/code/community/ZerebroInternet/Barzahlen/controllers/IpnController.php
CHANGED
@@ -14,37 +14,34 @@
|
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
-
class ZerebroInternet_Barzahlen_IpnController extends Mage_Core_Controller_Front_Action
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
header("HTTP/1.1 200 OK");
|
37 |
-
header("Status: 200 OK");
|
38 |
-
$ipnModel->updateDatabase();
|
39 |
-
}
|
40 |
-
else {
|
41 |
-
header("HTTP/1.1 400 Bad Request");
|
42 |
-
header("Status: 400 Bad Request");
|
43 |
-
}
|
44 |
-
}
|
45 |
-
catch (Exception $e) {
|
46 |
-
Mage::logException($e);
|
47 |
}
|
48 |
-
}
|
49 |
}
|
50 |
-
?>
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
+
* @copyright Copyright (c) 2013 Zerebro Internet GmbH (http://www.barzahlen.de)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
+
class ZerebroInternet_Barzahlen_IpnController extends Mage_Core_Controller_Front_Action
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Instantiate IPN model and pass IPN request to it. After successful hash validation HTTP header
|
27 |
+
* 200 is send first before the database is updated.
|
28 |
+
*/
|
29 |
+
public function indexAction()
|
30 |
+
{
|
31 |
+
try {
|
32 |
+
$data = $this->getRequest()->getQuery();
|
33 |
+
$ipnModel = Mage::getModel('barzahlen/ipn');
|
34 |
|
35 |
+
if ($ipnModel->sendResponseHeader($data)) {
|
36 |
+
header("HTTP/1.1 200 OK");
|
37 |
+
header("Status: 200 OK");
|
38 |
+
$ipnModel->updateDatabase();
|
39 |
+
} else {
|
40 |
+
header("HTTP/1.1 400 Bad Request");
|
41 |
+
header("Status: 400 Bad Request");
|
42 |
+
}
|
43 |
+
} catch (Exception $e) {
|
44 |
+
Mage::logException($e);
|
45 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
}
|
|
|
47 |
}
|
|
app/code/community/ZerebroInternet/Barzahlen/controllers/ResendController.php
CHANGED
@@ -14,53 +14,49 @@
|
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
-
class ZerebroInternet_Barzahlen_ResendController extends Mage_Adminhtml_Controller_Action
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
|
|
|
|
40 |
}
|
41 |
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
-
|
46 |
-
* Handles refund slip resend requests.
|
47 |
-
*/
|
48 |
-
public function refundAction() {
|
49 |
|
50 |
-
|
51 |
-
|
|
|
|
|
|
|
52 |
|
53 |
-
|
54 |
-
|
55 |
-
if(Mage::getSingleton('barzahlen/resend')->resend($transactionId)) {
|
56 |
-
$this->_getSession()->addSuccess($this->__('bz_adm_resend_refund_success'));
|
57 |
-
}
|
58 |
-
else {
|
59 |
-
$this->_getSession()->addError($this->__('bz_adm_resend_error'));
|
60 |
}
|
61 |
-
|
62 |
-
$this->_redirect('adminhtml/sales_creditmemo/view', array('creditmemo_id' => $id));
|
63 |
-
}
|
64 |
}
|
65 |
-
|
66 |
-
?>
|
14 |
*
|
15 |
* @category ZerebroInternet
|
16 |
* @package ZerebroInternet_Barzahlen
|
17 |
+
* @copyright Copyright (c) 2013 Zerebro Internet GmbH (http://www.barzahlen.de)
|
18 |
* @author Martin Seener
|
19 |
* @author Alexander Diebler
|
20 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
21 |
*/
|
22 |
|
23 |
+
class ZerebroInternet_Barzahlen_ResendController extends Mage_Adminhtml_Controller_Action
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Handles payment slip resend requests.
|
27 |
+
*/
|
28 |
+
public function paymentAction()
|
29 |
+
{
|
30 |
+
$id = $this->getRequest()->getParam('order_id');
|
31 |
+
$order = Mage::getModel('sales/order')->load($id);
|
32 |
+
|
33 |
+
$transactionId = $order->getPayment()->getAdditionalInformation('transaction_id');
|
34 |
+
|
35 |
+
if (Mage::getSingleton('barzahlen/resend')->resend($transactionId)) {
|
36 |
+
$this->_getSession()->addSuccess($this->__('bz_adm_resend_payment_success'));
|
37 |
+
} else {
|
38 |
+
$this->_getSession()->addError($this->__('bz_adm_resend_error'));
|
39 |
+
}
|
40 |
+
|
41 |
+
$this->_redirect('adminhtml/sales_order/view', array('order_id' => $id));
|
42 |
}
|
43 |
|
44 |
+
/**
|
45 |
+
* Handles refund slip resend requests.
|
46 |
+
*/
|
47 |
+
public function refundAction()
|
48 |
+
{
|
49 |
+
$id = $this->getRequest()->getParam('creditmemo_id');
|
50 |
+
$creditmemo = Mage::getModel('sales/order_creditmemo')->load($id);
|
51 |
|
52 |
+
$transactionId = $creditmemo->getTransactionId();
|
|
|
|
|
|
|
53 |
|
54 |
+
if (Mage::getSingleton('barzahlen/resend')->resend($transactionId)) {
|
55 |
+
$this->_getSession()->addSuccess($this->__('bz_adm_resend_refund_success'));
|
56 |
+
} else {
|
57 |
+
$this->_getSession()->addError($this->__('bz_adm_resend_error'));
|
58 |
+
}
|
59 |
|
60 |
+
$this->_redirect('adminhtml/sales_creditmemo/view', array('creditmemo_id' => $id));
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
}
|
|
|
|
|
|
|
62 |
}
|
|
|
|
app/code/community/ZerebroInternet/Barzahlen/etc/config.xml
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
*
|
16 |
* @category ZerebroInternet
|
17 |
* @package ZerebroInternet_Barzahlen
|
18 |
-
* @copyright Copyright (c)
|
19 |
* @author Martin Seener
|
20 |
* @author Alexander Diebler
|
21 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
@@ -25,7 +25,7 @@
|
|
25 |
|
26 |
<modules>
|
27 |
<ZerebroInternet_Barzahlen>
|
28 |
-
<version>1.
|
29 |
</ZerebroInternet_Barzahlen>
|
30 |
</modules>
|
31 |
|
@@ -132,7 +132,7 @@
|
|
132 |
<method>cancelObserver</method>
|
133 |
</barzahlen_observer>
|
134 |
</observers>
|
135 |
-
</order_cancel_after>
|
136 |
<sales_order_creditmemo_refund>
|
137 |
<observers>
|
138 |
<barzahlen_observer>
|
@@ -142,6 +142,15 @@
|
|
142 |
</barzahlen_observer>
|
143 |
</observers>
|
144 |
</sales_order_creditmemo_refund>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
</events>
|
146 |
</adminhtml>
|
147 |
|
15 |
*
|
16 |
* @category ZerebroInternet
|
17 |
* @package ZerebroInternet_Barzahlen
|
18 |
+
* @copyright Copyright (c) 2013 Zerebro Internet GmbH (http://www.barzahlen.de)
|
19 |
* @author Martin Seener
|
20 |
* @author Alexander Diebler
|
21 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
25 |
|
26 |
<modules>
|
27 |
<ZerebroInternet_Barzahlen>
|
28 |
+
<version>1.2.0</version>
|
29 |
</ZerebroInternet_Barzahlen>
|
30 |
</modules>
|
31 |
|
132 |
<method>cancelObserver</method>
|
133 |
</barzahlen_observer>
|
134 |
</observers>
|
135 |
+
</order_cancel_after>admin_session_user_login_success
|
136 |
<sales_order_creditmemo_refund>
|
137 |
<observers>
|
138 |
<barzahlen_observer>
|
142 |
</barzahlen_observer>
|
143 |
</observers>
|
144 |
</sales_order_creditmemo_refund>
|
145 |
+
<admin_session_user_login_success>
|
146 |
+
<observers>
|
147 |
+
<barzahlen_observer>
|
148 |
+
<type>singleton</type>
|
149 |
+
<class>barzahlen/check</class>
|
150 |
+
<method>checkObserver</method>
|
151 |
+
</barzahlen_observer>
|
152 |
+
</observers>
|
153 |
+
</admin_session_user_login_success>
|
154 |
</events>
|
155 |
</adminhtml>
|
156 |
|
app/code/community/ZerebroInternet/Barzahlen/etc/system.xml
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
*
|
16 |
* @category ZerebroInternet
|
17 |
* @package ZerebroInternet_Barzahlen
|
18 |
-
* @copyright Copyright (c)
|
19 |
* @author Martin Seener
|
20 |
* @author Alexander Diebler
|
21 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
15 |
*
|
16 |
* @category ZerebroInternet
|
17 |
* @package ZerebroInternet_Barzahlen
|
18 |
+
* @copyright Copyright (c) 2013 Zerebro Internet GmbH (http://www.barzahlen.de)
|
19 |
* @author Martin Seener
|
20 |
* @author Alexander Diebler
|
21 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
app/design/adminhtml/default/default/template/barzahlen/info.phtml
CHANGED
@@ -21,4 +21,4 @@
|
|
21 |
*/
|
22 |
?>
|
23 |
|
24 |
-
<a href="
|
21 |
*/
|
22 |
?>
|
23 |
|
24 |
+
<a href="https://partner.barzahlen.de"><img id="payment_form_<?php echo $this->getMethodCode() ?>" src="https://cdn.barzahlen.de/images/barzahlen_logo.png" height="45" width="133" alt="Barzahlen" /></a>
|
app/design/frontend/base/default/layout/barzahlen.xml
CHANGED
@@ -15,13 +15,13 @@
|
|
15 |
*
|
16 |
* @category ZerebroInternet
|
17 |
* @package ZerebroInternet_Barzahlen
|
18 |
-
* @copyright Copyright (c)
|
19 |
* @author Martin Seener
|
20 |
* @author Alexander Diebler
|
21 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
22 |
*/
|
23 |
-->
|
24 |
-
<layout version="1.
|
25 |
<barzahlen_checkout_processing>
|
26 |
<reference name="root">
|
27 |
<action method="setTemplate"><template>page/1column.phtml</template></action>
|
15 |
*
|
16 |
* @category ZerebroInternet
|
17 |
* @package ZerebroInternet_Barzahlen
|
18 |
+
* @copyright Copyright (c) 2013 Zerebro Internet GmbH (http://www.barzahlen.de)
|
19 |
* @author Martin Seener
|
20 |
* @author Alexander Diebler
|
21 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
22 |
*/
|
23 |
-->
|
24 |
+
<layout version="1.2.0">
|
25 |
<barzahlen_checkout_processing>
|
26 |
<reference name="root">
|
27 |
<action method="setTemplate"><template>page/1column.phtml</template></action>
|
app/etc/modules/ZerebroInternet_Barzahlen.xml
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
*
|
16 |
* @category ZerebroInternet
|
17 |
* @package ZerebroInternet_Barzahlen
|
18 |
-
* @copyright Copyright (c)
|
19 |
* @author Martin Seener
|
20 |
* @author Alexander Diebler
|
21 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
15 |
*
|
16 |
* @category ZerebroInternet
|
17 |
* @package ZerebroInternet_Barzahlen
|
18 |
+
* @copyright Copyright (c) 2013 Zerebro Internet GmbH (http://www.barzahlen.de)
|
19 |
* @author Martin Seener
|
20 |
* @author Alexander Diebler
|
21 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL-3.0)
|
app/locale/de_DE/ZerebroInternet_Barzahlen_Admin.csv
CHANGED
@@ -45,4 +45,7 @@
|
|
45 |
"bz_adm_resend_error", "Es ist ein Fehler aufgetreten. Prüfen Sie barzahlen.log für weitere Informationen."
|
46 |
"bz_adm_partner","<b>Bezahlen möglich bei:</b>"
|
47 |
"bz_adm_sandbox","Der <strong>Sandbox Modus</strong> ist aktiv. Allen getätigten Zahlungen wird ein Test-Zahlschein zugewiesen. Dieser kann nicht von unseren Einzelhandelspartnern verarbeitet werden."
|
48 |
-
"bz_frnt_ipn_pending","Barzahlen: Zahlschein erfolgreich angefordert und versendet."
|
|
|
|
|
|
45 |
"bz_adm_resend_error", "Es ist ein Fehler aufgetreten. Prüfen Sie barzahlen.log für weitere Informationen."
|
46 |
"bz_adm_partner","<b>Bezahlen möglich bei:</b>"
|
47 |
"bz_adm_sandbox","Der <strong>Sandbox Modus</strong> ist aktiv. Allen getätigten Zahlungen wird ein Test-Zahlschein zugewiesen. Dieser kann nicht von unseren Einzelhandelspartnern verarbeitet werden."
|
48 |
+
"bz_frnt_ipn_pending","Barzahlen: Zahlschein erfolgreich angefordert und versendet."
|
49 |
+
"bz_adm_now_available"," Jetzt verfügbar "
|
50 |
+
"bz_adm_over"," über "
|
51 |
+
"bz_adm_or"," oder "
|
app/locale/en_US/ZerebroInternet_Barzahlen_Admin.csv
CHANGED
@@ -45,4 +45,7 @@
|
|
45 |
"bz_adm_resend_error", "An error occurred. Please check barzahlen.log for further information."
|
46 |
"bz_adm_partner","<b>Payment possible at:</b>"
|
47 |
"bz_adm_sandbox","The <strong>Sandbox Mode</strong> is active. All placed orders receive a test payment slip. Test payment slips cannot be handled by our retail partners."
|
48 |
-
"bz_frnt_ipn_pending","Barzahlen: Payment slip requested and sent successfully."
|
|
|
|
|
|
45 |
"bz_adm_resend_error", "An error occurred. Please check barzahlen.log for further information."
|
46 |
"bz_adm_partner","<b>Payment possible at:</b>"
|
47 |
"bz_adm_sandbox","The <strong>Sandbox Mode</strong> is active. All placed orders receive a test payment slip. Test payment slips cannot be handled by our retail partners."
|
48 |
+
"bz_frnt_ipn_pending","Barzahlen: Payment slip requested and sent successfully."
|
49 |
+
"bz_adm_now_available"," Now available "
|
50 |
+
"bz_adm_over"," over "
|
51 |
+
"bz_adm_or"," or "
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>ZerebroInternet_Barzahlen</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Source License (OSL) 3.0</license>
|
7 |
<channel>community</channel>
|
@@ -14,9 +14,9 @@
|
|
14 |
Barzahlen let's your customers pay cash online. You get a payment confirmation in real-time and you benefit from our payment guarantee and new customer groups. See how Barzahlen works: http://www.barzahlen.de/partner/funktionsweise</description>
|
15 |
<notes>In this version the following things were already tested successfully on 1.4.2.0,1.5.0.1,1.5.1.0,1.6.0.0,1.6.1.0,1.6.2.0,1.7.0.0,1.7.0.1,1.7.0.2</notes>
|
16 |
<authors><author><name>Martin Seener</name><user>auto-converted</user><email>support@barzahlen.de</email></author><author><name>Alexander Diebler</name><user>auto-converted</user><email>support@barzahlen.de</email></author></authors>
|
17 |
-
<date>2013-
|
18 |
-
<time>
|
19 |
-
<contents><target name="magecommunity"><dir name="ZerebroInternet"><dir name="Barzahlen"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><file name="View.php" hash="
|
20 |
<compatible/>
|
21 |
<dependencies/>
|
22 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>ZerebroInternet_Barzahlen</name>
|
4 |
+
<version>1.2.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Source License (OSL) 3.0</license>
|
7 |
<channel>community</channel>
|
14 |
Barzahlen let's your customers pay cash online. You get a payment confirmation in real-time and you benefit from our payment guarantee and new customer groups. See how Barzahlen works: http://www.barzahlen.de/partner/funktionsweise</description>
|
15 |
<notes>In this version the following things were already tested successfully on 1.4.2.0,1.5.0.1,1.5.1.0,1.6.0.0,1.6.1.0,1.6.2.0,1.7.0.0,1.7.0.1,1.7.0.2</notes>
|
16 |
<authors><author><name>Martin Seener</name><user>auto-converted</user><email>support@barzahlen.de</email></author><author><name>Alexander Diebler</name><user>auto-converted</user><email>support@barzahlen.de</email></author></authors>
|
17 |
+
<date>2013-05-06</date>
|
18 |
+
<time>10:16:41</time>
|
19 |
+
<contents><target name="magecommunity"><dir name="ZerebroInternet"><dir name="Barzahlen"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><file name="View.php" hash="ed34c5974f780caae8597af54dab5f10"/></dir><file name="View.php" hash="69e2ec7e15a7020363035f5bd44cc72f"/></dir></dir></dir><file name="Form.php" hash="bb19aebff7b6df230a736969d56c3824"/><file name="Info.php" hash="c8957f90e34f2148f9f18ddfd30b9549"/></dir><dir name="Helper"><file name="Data.php" hash="76418bc156cbe5ea9b80b8d0b6930003"/></dir><dir name="Model"><dir name="Adminexceptions"><file name="Allspecificcountries.php" hash="f8250081f964940755620a78d0a34759"/><file name="Maxordertotal.php" hash="847c5dfa19c386e07bab438007fb4ed0"/><file name="Notificationkey.php" hash="444e60cd86e21c63cebec46433036af1"/><file name="Paymentkey.php" hash="5c8dbb4a24a006843528921ae8408c6f"/><file name="Shopid.php" hash="4bf52f9fab2b85e8dd97159ae8cae868"/><file name="Specificcountry.php" hash="5b64217fdd81d1c25b97a1aea935e961"/><file name="Title.php" hash="b4ed0a701c1e7afff4d5349946aee93a"/></dir><dir name="Api"><dir name="Request"><file name="Abstract.php" hash="b0673b637619bf66d412a73cc7fc1f96"/><file name="Cancel.php" hash="30b16b5c838206262332808519379819"/><file name="Payment.php" hash="b6408794692541a0476f50f369f29647"/><file name="Refund.php" hash="68485f173d147e5f7412c673f87a0f1c"/><file name="Resend.php" hash="bcdb1cc3bc630bd7a910b894999a4feb"/><file name="Update.php" hash="c823a9157e5afbd41ed98f9687b62745"/></dir><dir name="certs"><file name="ca-bundle.crt" hash="7e78dcc7f5a3aefffbb327141dd7ddcf"/></dir><file name="Abstract.php" hash="a7bd0bce3d4ee08eaebcf153396d0d9a"/><file name="Notification.php" hash="4ebab86f0dfd41ad9f625d9573225669"/></dir><file name="Api.php" hash="06fbc9bec0f8a6dbb22a87d48bd98f0f"/><file name="Barzahlen.php" hash="e1e76fc47ac6aa1067a97fba8b73ca7d"/><file name="Cancel.php" hash="dd5dafa4f7c1eabca9205fb204784c36"/><file name="Check.php" hash="e9e70dcd2094ee81d8e3d6aa5a9f179d"/><file name="Ipn.php" hash="0fc9e193c2d23be08a2790f2729489ac"/><file name="Payment.php" hash="405e04ddab9d31893b2938dc72d3f93f"/><file name="Refund.php" hash="6f8aa14279682f8a9c6cbed5a7402c46"/><file name="Resend.php" hash="08d258616935fd00690440e4f9db2424"/></dir><dir name="controllers"><file name="CheckoutController.php" hash="dea3cbe0437554bd7b9f98ad6fb96e52"/><file name="IpnController.php" hash="95e6e5c47f70adbf7188c5d15b976574"/><file name="ResendController.php" hash="ab6108dd5fa8e0ccfc8edcf8c99f639d"/></dir><dir name="etc"><file name="config.xml" hash="97f02506cf06c4a66dbbd43235ccae19"/><file name="system.xml" hash="a9a17c3c88d65f51ea30e8589c34a07c"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="ZerebroInternet_Barzahlen.xml" hash="e06f159c8c6b298ea2bd8d360fd50904"/></dir></target><target name="magelocale"><dir name="de_DE"><file name="ZerebroInternet_Barzahlen_Admin.csv" hash="d0471ec8a3ba4d84eae8b3b6937b40cc"/><file name="ZerebroInternet_Barzahlen_Frontend.csv" hash="eca00f201a8a75063a90b69e12586596"/></dir><dir name="en_US"><file name="ZerebroInternet_Barzahlen_Admin.csv" hash="ba87e1f265f920303da24988a73b7efb"/><file name="ZerebroInternet_Barzahlen_Frontend.csv" hash="ba4c7050219ab94072c1acc567db96dd"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="barzahlen"><file name="info.phtml" hash="28b7003181c7334ae06cea890164fcf2"/></dir></dir></dir></dir><dir name="base"><dir name="default"><dir name="template"><dir name="barzahlen"><file name="form.phtml" hash="424b059387d5c4314ce710a498141498"/><file name="info.phtml" hash="74d5570ff6cc50fbd94ebed0e709435a"/><file name="mark.phtml" hash="e5180d493829dcd1c58837eec9d6e989"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="barzahlen.xml" hash="abe2c5604b460dbddc16c99eaf52539c"/></dir><dir name="template"><dir name="barzahlen"><file name="form.phtml" hash="cd4c65c40c68a70050ab1f43c9db1e89"/><file name="info.phtml" hash="74d5570ff6cc50fbd94ebed0e709435a"/><file name="mark.phtml" hash="e5180d493829dcd1c58837eec9d6e989"/><file name="processing.phtml" hash="7cbfff204dfec836d69d7a8ab7790488"/></dir></dir></dir></dir></dir></target></contents>
|
20 |
<compatible/>
|
21 |
<dependencies/>
|
22 |
</package>
|