Version Notes
Mage_Payone-3.0.11
Download this release
Release Info
Developer | Magento Core Team |
Extension | Mage_Payone |
Version | 3.0.11 |
Comparing to | |
See all releases |
Code changes from version 3.0.10 to 3.0.11
- app/code/community/Payone/Core/Block/Adminhtml/System/Config/Form/Payment/Method.php +19 -6
- app/code/community/Payone/Core/Block/Adminhtml/System/Config/Payment/Edit.php +5 -0
- app/code/community/Payone/Core/Block/Adminhtml/System/Config/Payment/Grid.php +280 -262
- app/code/community/Payone/Core/Exception/InvalidScope.php +36 -0
- app/code/community/Payone/Core/Helper/Data.php +2 -2
- app/code/community/Payone/Core/Model/Config/Misc.php +24 -4
- app/code/community/Payone/Core/Model/Config/Misc/Discount.php +73 -0
- app/code/community/Payone/Core/Model/Domain/Config/PaymentMethod.php +73 -8
- app/code/community/Payone/Core/Model/Domain/Resource/Config/PaymentMethod/Collection.php +327 -193
- app/code/community/Payone/Core/Model/Mapper/ApiRequest/Payment/Abstract.php +31 -0
- app/code/community/Payone/Core/Model/Mapper/ApiRequest/Payment/Authorize/Abstract.php +6 -0
- app/code/community/Payone/Core/Model/Mapper/ApiRequest/Payment/Capture.php +7 -0
- app/code/community/Payone/Core/Model/Observer/TransactionStatus/InvoiceCreate.php +11 -1
- app/code/community/Payone/Core/Model/Service/InitializeConfig.php +1 -1
- app/code/community/Payone/Core/Model/Service/TransactionStatus/Process.php +9 -1
- app/code/community/Payone/Core/controllers/Adminhtml/System/Config/PaymentController.php +230 -204
- app/code/community/Payone/Core/etc/config.xml +1 -1
- app/code/community/Payone/Core/etc/system.xml +43 -6
- app/code/community/Payone/Core/sql/payone_core_setup/mysql4-install-3.0.0.php +21 -1
- app/design/adminhtml/default/default/layout/payone/configuration.xml +1 -1
- app/design/adminhtml/default/default/layout/payone/core.xml +1 -1
- app/design/adminhtml/default/default/layout/payone/migrator.xml +1 -1
- app/design/adminhtml/default/default/layout/payone/transaction.xml +1 -1
- app/design/adminhtml/default/default/template/payone/core/sales/order/create/init.phtml +9 -24
- app/design/adminhtml/default/default/template/payone/core/system/config/tooltip/misc/creditmemo.phtml +6 -0
- app/design/adminhtml/default/default/template/payone/core/system/config/tooltip/misc/discount.phtml +34 -0
- app/design/adminhtml/default/default/template/payone/core/system/config/tooltip/misc/shipping_costs.phtml +5 -0
- app/design/adminhtml/default/default/template/payone/core/system/config/tooltip/misc/transaction_status_forwarding.phtml +4 -1
- app/design/adminhtml/default/default/template/payone/core/system/config/tooltip/misc/transactionstatus_forwarding.phtml +3 -0
- app/design/adminhtml/default/default/template/payone/core/system/config/tooltip/misc/transactionstatus_processing.phtml +3 -0
- app/design/frontend/base/default/layout/payone/core.xml +1 -1
- app/design/frontend/base/default/template/payone/core/checkout/onepage/init.phtml +9 -4
- app/locale/de_DE/Payone_Core.csv +8 -2
- js/payone/core/client_api.js +1 -0
- js/payone/core/creditcard.js +109 -73
- lib/Payone/Log4php/LoggerPatternConverterSuperglobal.php +3 -3
- package.xml +8 -8
- skin/adminhtml/default/default/payone/core/boxes.css +9 -2
app/code/community/Payone/Core/Block/Adminhtml/System/Config/Form/Payment/Method.php
CHANGED
@@ -60,14 +60,27 @@ class Payone_Core_Block_Adminhtml_System_Config_Form_Payment_Method
|
|
60 |
|
61 |
/** @var $model Payone_Core_Model_Domain_Config_PaymentMethod */
|
62 |
$model = Mage::registry('payone_core_config_payment_method');
|
|
|
63 |
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
|
|
|
|
|
|
|
|
|
|
70 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
}
|
72 |
}
|
73 |
|
60 |
|
61 |
/** @var $model Payone_Core_Model_Domain_Config_PaymentMethod */
|
62 |
$model = Mage::registry('payone_core_config_payment_method');
|
63 |
+
$parentModel = $model->getParentModel();
|
64 |
|
65 |
+
if ($parentModel) {
|
66 |
+
$grandParentModel = $parentModel->getParentModel();
|
67 |
+
|
68 |
+
foreach ($parentModel->getData() as $key => $parentValue) {
|
69 |
+
$path = self::SECTION_PAYONE_PAYMENT . '/' . self::GROUP_TEMPLATE_PREFIX . $this->getMethodType() . '/' . $key;
|
70 |
+
$modelValue = $model->getData($key);
|
71 |
+
if (isset($modelValue)) {
|
72 |
+
$this->_configRoot->setNode($path, $modelValue, true);
|
73 |
+
}
|
74 |
+
elseif (isset($parentValue)) {
|
75 |
+
$this->_configRoot->setNode($path, $parentValue, true);
|
76 |
}
|
77 |
+
elseif ($grandParentModel) {
|
78 |
+
$grandParentValue = $grandParentModel->getData($key);
|
79 |
+
if (isset($grandParentValue)) {
|
80 |
+
$this->_configRoot->setNode($path, $grandParentValue, true);
|
81 |
+
}
|
82 |
+
}
|
83 |
+
|
84 |
}
|
85 |
}
|
86 |
|
app/code/community/Payone/Core/Block/Adminhtml/System/Config/Payment/Edit.php
CHANGED
@@ -69,6 +69,11 @@ class Payone_Core_Block_Adminhtml_System_Config_Payment_Edit
|
|
69 |
|
70 |
$this->setChild('form', $block);
|
71 |
}
|
|
|
|
|
|
|
|
|
|
|
72 |
|
73 |
return parent::_prepareLayout();
|
74 |
}
|
69 |
|
70 |
$this->setChild('form', $block);
|
71 |
}
|
72 |
+
$activeScope = Mage::registry('payone_core_config_active_scope');
|
73 |
+
if ($activeScope != 'default') {
|
74 |
+
$this->_removeButton('delete'); // Not allowed to delete configs from scopes "websites" or "stores".
|
75 |
+
}
|
76 |
+
|
77 |
|
78 |
return parent::_prepareLayout();
|
79 |
}
|
app/code/community/Payone/Core/Block/Adminhtml/System/Config/Payment/Grid.php
CHANGED
@@ -1,263 +1,281 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
*
|
4 |
-
* NOTICE OF LICENSE
|
5 |
-
*
|
6 |
-
* This source file is subject to the GNU General Public License (GPL 3)
|
7 |
-
* that is bundled with this package in the file LICENSE.txt
|
8 |
-
*
|
9 |
-
* DISCLAIMER
|
10 |
-
*
|
11 |
-
* Do not edit or add to this file if you wish to upgrade Payone_Core to newer
|
12 |
-
* versions in the future. If you wish to customize Payone_Core for your
|
13 |
-
* needs please refer to http://www.payone.de for more information.
|
14 |
-
*
|
15 |
-
* @category Payone
|
16 |
-
* @package Payone_Core_Block
|
17 |
-
* @subpackage Adminhtml_System
|
18 |
-
* @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
|
19 |
-
* @author Matthias Walter <info@noovias.com>
|
20 |
-
* @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
|
21 |
-
* @link http://www.noovias.com
|
22 |
-
*/
|
23 |
-
|
24 |
-
/**
|
25 |
-
*
|
26 |
-
* @category Payone
|
27 |
-
* @package Payone_Core_Block
|
28 |
-
* @subpackage Adminhtml_System
|
29 |
-
* @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
|
30 |
-
* @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
|
31 |
-
* @link http://www.noovias.com
|
32 |
-
*/
|
33 |
-
class Payone_Core_Block_Adminhtml_System_Config_Payment_Grid
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
$this->
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
$this->
|
50 |
-
$this->
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
*
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
$collection
|
61 |
-
$this->
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
$storeCode = $this->getRequest()->getParam('store');
|
74 |
-
$
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
$
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
$methodConfigCollection->addSortOrder('id');
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
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 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
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 |
-
|
156 |
-
|
157 |
-
|
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 |
-
|
188 |
-
|
189 |
-
|
190 |
-
'
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
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 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* NOTICE OF LICENSE
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License (GPL 3)
|
7 |
+
* that is bundled with this package in the file LICENSE.txt
|
8 |
+
*
|
9 |
+
* DISCLAIMER
|
10 |
+
*
|
11 |
+
* Do not edit or add to this file if you wish to upgrade Payone_Core to newer
|
12 |
+
* versions in the future. If you wish to customize Payone_Core for your
|
13 |
+
* needs please refer to http://www.payone.de for more information.
|
14 |
+
*
|
15 |
+
* @category Payone
|
16 |
+
* @package Payone_Core_Block
|
17 |
+
* @subpackage Adminhtml_System
|
18 |
+
* @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
|
19 |
+
* @author Matthias Walter <info@noovias.com>
|
20 |
+
* @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
|
21 |
+
* @link http://www.noovias.com
|
22 |
+
*/
|
23 |
+
|
24 |
+
/**
|
25 |
+
*
|
26 |
+
* @category Payone
|
27 |
+
* @package Payone_Core_Block
|
28 |
+
* @subpackage Adminhtml_System
|
29 |
+
* @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
|
30 |
+
* @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
|
31 |
+
* @link http://www.noovias.com
|
32 |
+
*/
|
33 |
+
class Payone_Core_Block_Adminhtml_System_Config_Payment_Grid
|
34 |
+
extends Mage_Adminhtml_Block_Widget_Grid
|
35 |
+
{
|
36 |
+
|
37 |
+
/**
|
38 |
+
*
|
39 |
+
*/
|
40 |
+
public function __construct()
|
41 |
+
{
|
42 |
+
parent::__construct();
|
43 |
+
$this->setId('payone_core_system_config_payment_grid');
|
44 |
+
$this->setSaveParametersInSession(true);
|
45 |
+
// Enable Ajax
|
46 |
+
$this->setUseAjax(true);
|
47 |
+
|
48 |
+
$this->setPagerVisibility(false);
|
49 |
+
// $this->setHeadersVisibility(false);
|
50 |
+
$this->setMessageBlockVisibility(false);
|
51 |
+
$this->setFilterVisibility(false);
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
*
|
56 |
+
* @return $this
|
57 |
+
*/
|
58 |
+
protected function _prepareCollection()
|
59 |
+
{
|
60 |
+
/** @var $collection Payone_Core_Model_Domain_Resource_Config_PaymentMethod_Collection */
|
61 |
+
$collection = $this->getConfigPaymentCollection();
|
62 |
+
$this->setCollection($collection);
|
63 |
+
|
64 |
+
return parent::_prepareCollection();
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* @return Payone_Core_Model_Domain_Resource_Config_PaymentMethod_Collection
|
69 |
+
*/
|
70 |
+
protected function getConfigPaymentCollection()
|
71 |
+
{
|
72 |
+
if (!Mage::registry('payone_core_adminhtml_system_config_payment_collection')) {
|
73 |
+
$storeCode = $this->getRequest()->getParam('store');
|
74 |
+
$websiteCode = $this->getRequest()->getParam('website');
|
75 |
+
|
76 |
+
/** @var $store Mage_Core_Model_Website */
|
77 |
+
$website = $this->getPayoneFactory()->getModelCoreWebsite();
|
78 |
+
$website->load($websiteCode, 'code');
|
79 |
+
|
80 |
+
/** @var $methodConfigCollection Payone_Core_Model_Domain_Resource_Config_PaymentMethod_Collection */
|
81 |
+
$methodConfigCollection = $this->getPayoneFactory()->getModelDomainConfigPaymentMethod()
|
82 |
+
->getCollection();
|
83 |
+
$methodConfigCollection->addSortOrder('id');
|
84 |
+
|
85 |
+
|
86 |
+
if (empty($storeCode) && $website->hasData()) {
|
87 |
+
|
88 |
+
$methodConfigCollection->getCollectionByScopeIdMerged($website->getId(), 'websites');
|
89 |
+
|
90 |
+
}
|
91 |
+
else {
|
92 |
+
/** @var $store Mage_Core_Model_Store */
|
93 |
+
$store = $this->getPayoneFactory()->getModelCoreStore();
|
94 |
+
$store->load($storeCode, 'code');
|
95 |
+
|
96 |
+
|
97 |
+
if (!$storeCode) {
|
98 |
+
$methodConfigCollection->getCollectionByScopeIdMerged();
|
99 |
+
}
|
100 |
+
else {
|
101 |
+
$methodConfigCollection->getCollectionByScopeIdMerged($store->getId(), 'stores');
|
102 |
+
}
|
103 |
+
}
|
104 |
+
Mage::register('payone_core_adminhtml_system_config_payment_collection', $methodConfigCollection);
|
105 |
+
}
|
106 |
+
return Mage::registry('payone_core_adminhtml_system_config_payment_collection');
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
*
|
111 |
+
* @return Mage_Adminhtml_Block_Widget_Grid
|
112 |
+
*/
|
113 |
+
protected function _prepareColumns()
|
114 |
+
{
|
115 |
+
$this->addColumn(
|
116 |
+
'sort_order',
|
117 |
+
array(
|
118 |
+
'header' => $this->helperPayoneCore()->__('Sort order'),
|
119 |
+
'align' => 'center',
|
120 |
+
'width' => '20px',
|
121 |
+
'index' => 'sort_order',
|
122 |
+
'filter' => false,
|
123 |
+
'sortable' => false
|
124 |
+
)
|
125 |
+
);
|
126 |
+
|
127 |
+
$this->addColumn(
|
128 |
+
'name',
|
129 |
+
array(
|
130 |
+
'header' => $this->helperPayoneCore()->__('Name'),
|
131 |
+
'align' => 'left',
|
132 |
+
'index' => 'name',
|
133 |
+
'filter' => false,
|
134 |
+
'sortable' => false,
|
135 |
+
)
|
136 |
+
);
|
137 |
+
|
138 |
+
$this->addColumn(
|
139 |
+
'type',
|
140 |
+
array(
|
141 |
+
'header' => $this->helperPayoneCore()->__('Type'),
|
142 |
+
'align' => 'left',
|
143 |
+
'index' => 'code',
|
144 |
+
'filter' => false,
|
145 |
+
'sortable' => false,
|
146 |
+
)
|
147 |
+
);
|
148 |
+
|
149 |
+
$this->addColumn(
|
150 |
+
'scope',
|
151 |
+
array(
|
152 |
+
'header' => $this->helperPayoneCore()->__('Scope'),
|
153 |
+
'align' => 'left',
|
154 |
+
'index' => 'scope',
|
155 |
+
'filter' => false,
|
156 |
+
'sortable' => false,
|
157 |
+
)
|
158 |
+
);
|
159 |
+
|
160 |
+
$this->addColumn(
|
161 |
+
'enabled',
|
162 |
+
array(
|
163 |
+
'header' => $this->helperPayoneCore()->__('Enabled'),
|
164 |
+
'align' => 'left',
|
165 |
+
'width' => '80px',
|
166 |
+
'index' => 'enabled',
|
167 |
+
'type' => 'options',
|
168 |
+
'options' => $this->getPayoneFactory()->getModelSystemConfigStatus()->toSelectArray(),
|
169 |
+
'filter' => false,
|
170 |
+
'sortable' => false,
|
171 |
+
)
|
172 |
+
);
|
173 |
+
|
174 |
+
$this->addColumn(
|
175 |
+
'created_at',
|
176 |
+
array(
|
177 |
+
'header' => $this->helperPayoneCore()->__('Created At'),
|
178 |
+
'index' => 'created_at',
|
179 |
+
'type' => 'datetime',
|
180 |
+
'width' => '50px',
|
181 |
+
'renderer' => 'payone_core/adminhtml_widget_grid_column_renderer_datetime',
|
182 |
+
'filter' => false,
|
183 |
+
'sortable' => false,
|
184 |
+
)
|
185 |
+
);
|
186 |
+
|
187 |
+
$this->addColumn(
|
188 |
+
'updated_at',
|
189 |
+
array(
|
190 |
+
'header' => $this->helperPayoneCore()->__('Updated At'),
|
191 |
+
'index' => 'updated_at',
|
192 |
+
'type' => 'datetime',
|
193 |
+
'width' => '50px',
|
194 |
+
'renderer' => 'payone_core/adminhtml_widget_grid_column_renderer_datetime',
|
195 |
+
'filter' => false,
|
196 |
+
'sortable' => false,
|
197 |
+
)
|
198 |
+
);
|
199 |
+
|
200 |
+
$this->addColumn(
|
201 |
+
'id',
|
202 |
+
array(
|
203 |
+
'header' => $this->helperPayoneCore()->__('ID'),
|
204 |
+
'align' => 'right',
|
205 |
+
'width' => '5px',
|
206 |
+
'index' => 'id',
|
207 |
+
'filter' => false,
|
208 |
+
'sortable' => false,
|
209 |
+
)
|
210 |
+
);
|
211 |
+
|
212 |
+
$this->addColumn(
|
213 |
+
'action',
|
214 |
+
|
215 |
+
array(
|
216 |
+
'header' => $this->helperPayoneCore()->__('Action'),
|
217 |
+
'width' => '100',
|
218 |
+
'type' => 'action',
|
219 |
+
'getter' => 'getId',
|
220 |
+
'actions' => array(
|
221 |
+
array(
|
222 |
+
'field' => 'id',
|
223 |
+
'caption' => $this->helperPayoneCore()->__('Edit'),
|
224 |
+
'url' => array(
|
225 |
+
'base' => '*/*/edit',
|
226 |
+
'params' => array(
|
227 |
+
'_current' => true,
|
228 |
+
'type' => ''),
|
229 |
+
|
230 |
+
),
|
231 |
+
)
|
232 |
+
),
|
233 |
+
'filter' => false,
|
234 |
+
'sortable' => false,
|
235 |
+
'index' => 'stores',
|
236 |
+
'is_system' => true,
|
237 |
+
)
|
238 |
+
);
|
239 |
+
|
240 |
+
return parent::_prepareColumns();
|
241 |
+
}
|
242 |
+
|
243 |
+
public function getRowUrl($row)
|
244 |
+
{
|
245 |
+
return $this->getUrl(
|
246 |
+
'*/*/edit',
|
247 |
+
array(
|
248 |
+
'_current' => true,
|
249 |
+
'id' => $row->getId(),
|
250 |
+
'type' => $row->getCode()
|
251 |
+
)
|
252 |
+
);
|
253 |
+
}
|
254 |
+
|
255 |
+
public function getGridUrl()
|
256 |
+
{
|
257 |
+
return $this->getUrl(
|
258 |
+
'*/*/grid',
|
259 |
+
array(
|
260 |
+
'_current' => true
|
261 |
+
)
|
262 |
+
);
|
263 |
+
}
|
264 |
+
|
265 |
+
/**
|
266 |
+
*
|
267 |
+
* @return Payone_Core_Helper_Data
|
268 |
+
*/
|
269 |
+
protected function helperPayoneCore()
|
270 |
+
{
|
271 |
+
return Mage::helper('payone_core');
|
272 |
+
}
|
273 |
+
|
274 |
+
/**
|
275 |
+
* @return Payone_Core_Model_Factory
|
276 |
+
*/
|
277 |
+
public function getPayoneFactory()
|
278 |
+
{
|
279 |
+
return $this->helperPayoneCore()->getFactory();
|
280 |
+
}
|
281 |
}
|
app/code/community/Payone/Core/Exception/InvalidScope.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* NOTICE OF LICENSE
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License (GPL 3)
|
7 |
+
* that is bundled with this package in the file LICENSE.txt
|
8 |
+
*
|
9 |
+
* DISCLAIMER
|
10 |
+
*
|
11 |
+
* Do not edit or add to this file if you wish to upgrade Payone_Core to newer
|
12 |
+
* versions in the future. If you wish to customize Payone_Core for your
|
13 |
+
* needs please refer to http://www.payone.de for more information.
|
14 |
+
*
|
15 |
+
* @category Payone
|
16 |
+
* @package Payone_Core_Exception
|
17 |
+
* @subpackage
|
18 |
+
* @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
|
19 |
+
* @author Matthias Walter <info@noovias.com>
|
20 |
+
* @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
|
21 |
+
* @link http://www.noovias.com
|
22 |
+
*/
|
23 |
+
|
24 |
+
/**
|
25 |
+
*
|
26 |
+
* @category Payone
|
27 |
+
* @package Payone_Core_Exception
|
28 |
+
* @subpackage
|
29 |
+
* @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
|
30 |
+
* @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
|
31 |
+
* @link http://www.noovias.com
|
32 |
+
*/
|
33 |
+
class Payone_Core_Exception_InvalidScope extends Exception
|
34 |
+
{
|
35 |
+
|
36 |
+
}
|
app/code/community/Payone/Core/Helper/Data.php
CHANGED
@@ -64,8 +64,8 @@ class Payone_Core_Helper_Data
|
|
64 |
*/
|
65 |
public function getMagentoEdition()
|
66 |
{
|
67 |
-
if (
|
68 |
-
// getEdition is only available after
|
69 |
$edition = Mage::getEdition();
|
70 |
switch ($edition) {
|
71 |
case Mage::EDITION_COMMUNITY :
|
64 |
*/
|
65 |
public function getMagentoEdition()
|
66 |
{
|
67 |
+
if (method_exists('Mage', 'getEdition')) {
|
68 |
+
// getEdition is only available after Magento CE Version 1.7.0.0
|
69 |
$edition = Mage::getEdition();
|
70 |
switch ($edition) {
|
71 |
case Mage::EDITION_COMMUNITY :
|
app/code/community/Payone/Core/Model/Config/Misc.php
CHANGED
@@ -40,6 +40,10 @@ class Payone_Core_Model_Config_Misc extends Payone_Core_Model_Config_AreaAbstrac
|
|
40 |
* @var Payone_Core_Model_Config_Misc_ShippingCosts
|
41 |
*/
|
42 |
protected $shippingCosts = null;
|
|
|
|
|
|
|
|
|
43 |
/**
|
44 |
* @var Payone_Core_Model_Config_Misc_Creditmemo
|
45 |
*/
|
@@ -122,7 +126,7 @@ class Payone_Core_Model_Config_Misc extends Payone_Core_Model_Config_AreaAbstrac
|
|
122 |
}
|
123 |
|
124 |
/**
|
125 |
-
* @param
|
126 |
*/
|
127 |
public function setTransactionstatusProcessing($transactionstatusProcessing)
|
128 |
{
|
@@ -130,7 +134,7 @@ class Payone_Core_Model_Config_Misc extends Payone_Core_Model_Config_AreaAbstrac
|
|
130 |
}
|
131 |
|
132 |
/**
|
133 |
-
* @return
|
134 |
*/
|
135 |
public function getTransactionstatusProcessing()
|
136 |
{
|
@@ -138,7 +142,7 @@ class Payone_Core_Model_Config_Misc extends Payone_Core_Model_Config_AreaAbstrac
|
|
138 |
}
|
139 |
|
140 |
/**
|
141 |
-
* @param
|
142 |
*/
|
143 |
public function setCreditmemo($creditmemo)
|
144 |
{
|
@@ -146,10 +150,26 @@ class Payone_Core_Model_Config_Misc extends Payone_Core_Model_Config_AreaAbstrac
|
|
146 |
}
|
147 |
|
148 |
/**
|
149 |
-
* @return
|
150 |
*/
|
151 |
public function getCreditmemo()
|
152 |
{
|
153 |
return $this->creditmemo;
|
154 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
}
|
40 |
* @var Payone_Core_Model_Config_Misc_ShippingCosts
|
41 |
*/
|
42 |
protected $shippingCosts = null;
|
43 |
+
|
44 |
+
/** @var Payone_Core_Model_Config_Misc_Discount */
|
45 |
+
protected $discount = null;
|
46 |
+
|
47 |
/**
|
48 |
* @var Payone_Core_Model_Config_Misc_Creditmemo
|
49 |
*/
|
126 |
}
|
127 |
|
128 |
/**
|
129 |
+
* @param Payone_Core_Model_Config_Misc_TransactionstatusProcessing $transactionstatusProcessing
|
130 |
*/
|
131 |
public function setTransactionstatusProcessing($transactionstatusProcessing)
|
132 |
{
|
134 |
}
|
135 |
|
136 |
/**
|
137 |
+
* @return Payone_Core_Model_Config_Misc_TransactionstatusProcessing
|
138 |
*/
|
139 |
public function getTransactionstatusProcessing()
|
140 |
{
|
142 |
}
|
143 |
|
144 |
/**
|
145 |
+
* @param Payone_Core_Model_Config_Misc_Creditmemo $creditmemo
|
146 |
*/
|
147 |
public function setCreditmemo($creditmemo)
|
148 |
{
|
150 |
}
|
151 |
|
152 |
/**
|
153 |
+
* @return Payone_Core_Model_Config_Misc_Creditmemo
|
154 |
*/
|
155 |
public function getCreditmemo()
|
156 |
{
|
157 |
return $this->creditmemo;
|
158 |
}
|
159 |
+
|
160 |
+
/**
|
161 |
+
* @param Payone_Core_Model_Config_Misc_Discount $discount
|
162 |
+
*/
|
163 |
+
public function setDiscount(Payone_Core_Model_Config_Misc_Discount $discount)
|
164 |
+
{
|
165 |
+
$this->discount = $discount;
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* @return Payone_Core_Model_Config_Misc_Discount
|
170 |
+
*/
|
171 |
+
public function getDiscount()
|
172 |
+
{
|
173 |
+
return $this->discount;
|
174 |
+
}
|
175 |
}
|
app/code/community/Payone/Core/Model/Config/Misc/Discount.php
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* NOTICE OF LICENSE
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License (GPL 3)
|
7 |
+
* that is bundled with this package in the file LICENSE.txt
|
8 |
+
*
|
9 |
+
* DISCLAIMER
|
10 |
+
*
|
11 |
+
* Do not edit or add to this file if you wish to upgrade Payone_Core to newer
|
12 |
+
* versions in the future. If you wish to customize Payone_Core for your
|
13 |
+
* needs please refer to http://www.payone.de for more information.
|
14 |
+
*
|
15 |
+
* @category Payone
|
16 |
+
* @package Payone_Core_Model
|
17 |
+
* @subpackage Config
|
18 |
+
* @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
|
19 |
+
* @author Matthias Walter <info@noovias.com>
|
20 |
+
* @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
|
21 |
+
* @link http://www.noovias.com
|
22 |
+
*/
|
23 |
+
|
24 |
+
/**
|
25 |
+
*
|
26 |
+
* @category Payone
|
27 |
+
* @package Payone_Core_Model
|
28 |
+
* @subpackage Config
|
29 |
+
* @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
|
30 |
+
* @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
|
31 |
+
* @link http://www.noovias.com
|
32 |
+
*/
|
33 |
+
class Payone_Core_Model_Config_Misc_Discount
|
34 |
+
extends Payone_Core_Model_Config_AreaAbstract
|
35 |
+
{
|
36 |
+
/** @var string */
|
37 |
+
protected $sku = '';
|
38 |
+
|
39 |
+
/** @var string */
|
40 |
+
protected $description = '';
|
41 |
+
|
42 |
+
/**
|
43 |
+
* @param string $sku
|
44 |
+
*/
|
45 |
+
public function setSku($sku)
|
46 |
+
{
|
47 |
+
$this->sku = $sku;
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* @return string
|
52 |
+
*/
|
53 |
+
public function getSku()
|
54 |
+
{
|
55 |
+
return $this->sku;
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* @param string $description
|
60 |
+
*/
|
61 |
+
public function setDescription($description)
|
62 |
+
{
|
63 |
+
$this->description = $description;
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* @return string
|
68 |
+
*/
|
69 |
+
public function getDescription()
|
70 |
+
{
|
71 |
+
return $this->description;
|
72 |
+
}
|
73 |
+
}
|
app/code/community/Payone/Core/Model/Domain/Config/PaymentMethod.php
CHANGED
@@ -40,7 +40,7 @@
|
|
40 |
* @method string getCode()
|
41 |
* @method setName($name)
|
42 |
* @method string getName()
|
43 |
-
* @mehtod
|
44 |
* @method int getSortOrder()
|
45 |
* @method setEnabled($enabled)
|
46 |
* @method int getEnabled()
|
@@ -91,8 +91,12 @@
|
|
91 |
* @method setGroups($groups)
|
92 |
* @method array getGroups()
|
93 |
*/
|
94 |
-
class Payone_Core_Model_Domain_Config_PaymentMethod
|
|
|
95 |
{
|
|
|
|
|
|
|
96 |
/**
|
97 |
*
|
98 |
*/
|
@@ -134,9 +138,14 @@ class Payone_Core_Model_Domain_Config_PaymentMethod extends Mage_Core_Model_Abst
|
|
134 |
if ($originModel->getScope() != $parentScope) {
|
135 |
$parentField = 'parent_' . $originModel->getScope() . '_id';
|
136 |
/** @var $dummy Payone_Core_Model_Domain_Config_PaymentMethod */
|
|
|
|
|
|
|
|
|
|
|
137 |
$dummy = Mage::getModel('payone_core/domain_config_paymentMethod');
|
138 |
$dummy->setScope($parentScope);
|
139 |
-
$dummy->setScopeId($
|
140 |
$dummy->setCode($originModel->getCode());
|
141 |
$dummy->setData($parentField, $this->getId());
|
142 |
$dummy->setMode(null);
|
@@ -144,8 +153,7 @@ class Payone_Core_Model_Domain_Config_PaymentMethod extends Mage_Core_Model_Abst
|
|
144 |
$dummy->setName($originModel->getName());
|
145 |
$dummy->save();
|
146 |
}
|
147 |
-
else
|
148 |
-
{
|
149 |
$dummy = null;
|
150 |
}
|
151 |
|
@@ -155,6 +163,20 @@ class Payone_Core_Model_Domain_Config_PaymentMethod extends Mage_Core_Model_Abst
|
|
155 |
$this->unsetData('id');
|
156 |
}
|
157 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
$code = $this->getCode();
|
159 |
if (empty($code)) {
|
160 |
$this->setCode($originModel->getCode());
|
@@ -190,6 +212,30 @@ class Payone_Core_Model_Domain_Config_PaymentMethod extends Mage_Core_Model_Abst
|
|
190 |
return null;
|
191 |
}
|
192 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
/**
|
194 |
* Validate Store and Website
|
195 |
*/
|
@@ -277,7 +323,7 @@ class Payone_Core_Model_Domain_Config_PaymentMethod extends Mage_Core_Model_Abst
|
|
277 |
$value = empty($value) ? null : $value;
|
278 |
break;
|
279 |
case 'use_global':
|
280 |
-
if($value
|
281 |
// set data to null if we use global config
|
282 |
$mappedData['allowspecific'] = null;
|
283 |
$mappedData['specificcountry'] = null;
|
@@ -292,8 +338,8 @@ class Payone_Core_Model_Domain_Config_PaymentMethod extends Mage_Core_Model_Abst
|
|
292 |
default:
|
293 |
if (!isset($value)) {
|
294 |
continue 2;
|
295 |
-
}
|
296 |
-
{
|
297 |
$value = null;
|
298 |
}
|
299 |
break;
|
@@ -491,4 +537,23 @@ class Payone_Core_Model_Domain_Config_PaymentMethod extends Mage_Core_Model_Abst
|
|
491 |
$this->explodeData('specificcountry');
|
492 |
return $this->getData('specificcountry');
|
493 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
494 |
}
|
40 |
* @method string getCode()
|
41 |
* @method setName($name)
|
42 |
* @method string getName()
|
43 |
+
* @mehtod setSortOrder($sortOrder)
|
44 |
* @method int getSortOrder()
|
45 |
* @method setEnabled($enabled)
|
46 |
* @method int getEnabled()
|
91 |
* @method setGroups($groups)
|
92 |
* @method array getGroups()
|
93 |
*/
|
94 |
+
class Payone_Core_Model_Domain_Config_PaymentMethod
|
95 |
+
extends Mage_Core_Model_Abstract
|
96 |
{
|
97 |
+
/** @var Payone_Core_Model_Factory */
|
98 |
+
protected $factory = null;
|
99 |
+
|
100 |
/**
|
101 |
*
|
102 |
*/
|
138 |
if ($originModel->getScope() != $parentScope) {
|
139 |
$parentField = 'parent_' . $originModel->getScope() . '_id';
|
140 |
/** @var $dummy Payone_Core_Model_Domain_Config_PaymentMethod */
|
141 |
+
|
142 |
+
/** @var $store Mage_Core_Model_Store */
|
143 |
+
$store = $this->getFactory()->getModelCoreStore()->load($this->getScopeId());
|
144 |
+
$websiteId = $store->getWebsiteId();
|
145 |
+
|
146 |
$dummy = Mage::getModel('payone_core/domain_config_paymentMethod');
|
147 |
$dummy->setScope($parentScope);
|
148 |
+
$dummy->setScopeId($websiteId);
|
149 |
$dummy->setCode($originModel->getCode());
|
150 |
$dummy->setData($parentField, $this->getId());
|
151 |
$dummy->setMode(null);
|
153 |
$dummy->setName($originModel->getName());
|
154 |
$dummy->save();
|
155 |
}
|
156 |
+
else {
|
|
|
157 |
$dummy = null;
|
158 |
}
|
159 |
|
163 |
$this->unsetData('id');
|
164 |
}
|
165 |
|
166 |
+
if ($this->getIsDeleted()) {
|
167 |
+
// On "delete" we have to mark all child configs as deleted as well:
|
168 |
+
$children = $this->loadChildPaymentMethodConfigs();
|
169 |
+
if ($children) {
|
170 |
+
foreach ($children as $child) {
|
171 |
+
/** @var $child Payone_Core_Model_Domain_Config_PaymentMethod */
|
172 |
+
$child->setIsDeleted(1);
|
173 |
+
$child->save();
|
174 |
+
}
|
175 |
+
}
|
176 |
+
|
177 |
+
}
|
178 |
+
|
179 |
+
|
180 |
$code = $this->getCode();
|
181 |
if (empty($code)) {
|
182 |
$this->setCode($originModel->getCode());
|
212 |
return null;
|
213 |
}
|
214 |
|
215 |
+
/**
|
216 |
+
* @return Payone_Core_Model_Domain_Resource_Config_PaymentMethod_Collection|null
|
217 |
+
*/
|
218 |
+
public function loadChildPaymentMethodConfigs()
|
219 |
+
{
|
220 |
+
if ($this->getId()) {
|
221 |
+
if ($this->getScope() == 'default') {
|
222 |
+
$parentFieldName = 'parent_default_id';
|
223 |
+
}
|
224 |
+
elseif ($this->getScope() == 'websites') {
|
225 |
+
$parentFieldName = 'parent_websites_id';
|
226 |
+
}
|
227 |
+
else {
|
228 |
+
return array();
|
229 |
+
}
|
230 |
+
/** @var $collection Payone_Core_Model_Domain_Resource_Config_PaymentMethod_Collection */
|
231 |
+
$collection = $this->getCollection();
|
232 |
+
$collection->addFieldToFilter($parentFieldName, $this->getId());
|
233 |
+
|
234 |
+
return $collection;
|
235 |
+
}
|
236 |
+
return null;
|
237 |
+
}
|
238 |
+
|
239 |
/**
|
240 |
* Validate Store and Website
|
241 |
*/
|
323 |
$value = empty($value) ? null : $value;
|
324 |
break;
|
325 |
case 'use_global':
|
326 |
+
if ($value) {
|
327 |
// set data to null if we use global config
|
328 |
$mappedData['allowspecific'] = null;
|
329 |
$mappedData['specificcountry'] = null;
|
338 |
default:
|
339 |
if (!isset($value)) {
|
340 |
continue 2;
|
341 |
+
}
|
342 |
+
elseif ($value == '') {
|
343 |
$value = null;
|
344 |
}
|
345 |
break;
|
537 |
$this->explodeData('specificcountry');
|
538 |
return $this->getData('specificcountry');
|
539 |
}
|
540 |
+
|
541 |
+
/**
|
542 |
+
* @return Payone_Core_Model_Factory
|
543 |
+
*/
|
544 |
+
public function getFactory()
|
545 |
+
{
|
546 |
+
if ($this->factory === null) {
|
547 |
+
$this->factory = new Payone_Core_Model_Factory();
|
548 |
+
}
|
549 |
+
return $this->factory;
|
550 |
+
}
|
551 |
+
|
552 |
+
/**
|
553 |
+
* @param Payone_Core_Model_Factory $factory
|
554 |
+
*/
|
555 |
+
public function setFactory(Payone_Core_Model_Factory $factory)
|
556 |
+
{
|
557 |
+
$this->factory = $factory;
|
558 |
+
}
|
559 |
}
|
app/code/community/Payone/Core/Model/Domain/Resource/Config/PaymentMethod/Collection.php
CHANGED
@@ -1,194 +1,328 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
*
|
4 |
-
* NOTICE OF LICENSE
|
5 |
-
*
|
6 |
-
* This source file is subject to the GNU General Public License (GPL 3)
|
7 |
-
* that is bundled with this package in the file LICENSE.txt
|
8 |
-
*
|
9 |
-
* DISCLAIMER
|
10 |
-
*
|
11 |
-
* Do not edit or add to this file if you wish to upgrade Payone_Core to newer
|
12 |
-
* versions in the future. If you wish to customize Payone_Core for your
|
13 |
-
* needs please refer to http://www.payone.de for more information.
|
14 |
-
*
|
15 |
-
* @category Payone
|
16 |
-
* @package Payone_Core_Model
|
17 |
-
* @subpackage Domain
|
18 |
-
* @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
|
19 |
-
* @author Matthias Walter <info@noovias.com>
|
20 |
-
* @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
|
21 |
-
* @link http://www.noovias.com
|
22 |
-
*/
|
23 |
-
|
24 |
-
/**
|
25 |
-
*
|
26 |
-
* @category Payone
|
27 |
-
* @package Payone_Core_Model
|
28 |
-
* @subpackage Domain
|
29 |
-
* @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
|
30 |
-
* @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
|
31 |
-
* @link http://www.noovias.com
|
32 |
-
*/
|
33 |
-
class Payone_Core_Model_Domain_Resource_Config_PaymentMethod_Collection
|
34 |
-
extends Mage_Core_Model_Mysql4_Collection_Abstract
|
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 |
-
|
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 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
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 |
-
|
156 |
-
|
157 |
-
|
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 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* NOTICE OF LICENSE
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License (GPL 3)
|
7 |
+
* that is bundled with this package in the file LICENSE.txt
|
8 |
+
*
|
9 |
+
* DISCLAIMER
|
10 |
+
*
|
11 |
+
* Do not edit or add to this file if you wish to upgrade Payone_Core to newer
|
12 |
+
* versions in the future. If you wish to customize Payone_Core for your
|
13 |
+
* needs please refer to http://www.payone.de for more information.
|
14 |
+
*
|
15 |
+
* @category Payone
|
16 |
+
* @package Payone_Core_Model
|
17 |
+
* @subpackage Domain
|
18 |
+
* @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
|
19 |
+
* @author Matthias Walter <info@noovias.com>
|
20 |
+
* @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
|
21 |
+
* @link http://www.noovias.com
|
22 |
+
*/
|
23 |
+
|
24 |
+
/**
|
25 |
+
*
|
26 |
+
* @category Payone
|
27 |
+
* @package Payone_Core_Model
|
28 |
+
* @subpackage Domain
|
29 |
+
* @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
|
30 |
+
* @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
|
31 |
+
* @link http://www.noovias.com
|
32 |
+
*/
|
33 |
+
class Payone_Core_Model_Domain_Resource_Config_PaymentMethod_Collection
|
34 |
+
extends Mage_Core_Model_Mysql4_Collection_Abstract
|
35 |
+
{
|
36 |
+
/** @var Payone_Core_Model_Factory */
|
37 |
+
protected $factory = null;
|
38 |
+
|
39 |
+
/**
|
40 |
+
*
|
41 |
+
*/
|
42 |
+
public function _construct()
|
43 |
+
{
|
44 |
+
parent::_construct();
|
45 |
+
$this->_init('payone_core/domain_config_paymentMethod');
|
46 |
+
}
|
47 |
+
|
48 |
+
public function addItem(Varien_Object $item)
|
49 |
+
{
|
50 |
+
/** @var $item Payone_Core_Model_Domain_Config_PaymentMethod */
|
51 |
+
$item->afterLoadPrepareData();
|
52 |
+
return parent::addItem($item);
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* if activated, the result will only return not deleted methods
|
57 |
+
*/
|
58 |
+
public function filterExcludeDeleted()
|
59 |
+
{
|
60 |
+
$this->addFilterIsDeleted(0);
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* 0 => deleted methods are excluded
|
65 |
+
* 1 => deleted methods are included
|
66 |
+
*
|
67 |
+
* @param int $isDeleted
|
68 |
+
*/
|
69 |
+
protected function addFilterIsDeleted($isDeleted = 0)
|
70 |
+
{
|
71 |
+
$this->addFieldToFilter('is_deleted', array('eq' => $isDeleted));
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* if used, all paymentmethod-configs with scope 'default' and 'websites' were returned
|
76 |
+
*/
|
77 |
+
public function filterExcludeStoresScope()
|
78 |
+
{
|
79 |
+
$this->addFilterScope('websites');
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* @param $scope
|
84 |
+
*/
|
85 |
+
protected function addFilterScope($scope)
|
86 |
+
{
|
87 |
+
// OR-Statement
|
88 |
+
$this->addFieldToFilter('scope',
|
89 |
+
array(
|
90 |
+
array('attribute' => 'scope', 'eq' => 'default'),
|
91 |
+
array('attribute' => 'scope', 'eq' => $scope)
|
92 |
+
));
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* @param $store Mage_Core_Model_Store
|
97 |
+
*/
|
98 |
+
public function filterByStore(Mage_Core_Model_Store $store)
|
99 |
+
{
|
100 |
+
$this->filterExcludeDeleted();
|
101 |
+
$this->addFieldToFilter('scope_id', $store->getWebsiteId());
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* @param string $order
|
106 |
+
* @param string $orderDir
|
107 |
+
*/
|
108 |
+
public function addSortOrder($order = 'sort_order', $orderDir = self::SORT_ORDER_ASC)
|
109 |
+
{
|
110 |
+
$this->addOrder($order, $orderDir);
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* @param $id
|
115 |
+
*
|
116 |
+
* @return Payone_Core_Model_Domain_Resource_Config_PaymentMethod_Collection
|
117 |
+
*/
|
118 |
+
public function getCollectionByStoreId($id)
|
119 |
+
{
|
120 |
+
$store = Mage::app()->getStore($id);
|
121 |
+
$websiteId = $store->getWebsiteId();
|
122 |
+
|
123 |
+
$results = array();
|
124 |
+
$globalCollection = $this->getCollectionByScopeId();
|
125 |
+
|
126 |
+
// Cycle through default configs, there is one for each configures payment type.
|
127 |
+
foreach ($globalCollection as $globalConfigId => $globalConfig) {
|
128 |
+
$websiteConfigs = $this->getChildConfigs($globalConfigId, $websiteId, 'websites');
|
129 |
+
if (count($websiteConfigs) < 1) {
|
130 |
+
// No website scope config found, use global level config
|
131 |
+
$results[$globalConfigId] = $globalConfig;
|
132 |
+
continue;
|
133 |
+
}
|
134 |
+
|
135 |
+
$websiteConfig = $websiteConfigs->getFirstItem(); // @todo hs: is this okay, just getting the first item? there should never be more than one.
|
136 |
+
|
137 |
+
$mergedConfig = $this->mergeConfigs($globalConfig, $websiteConfig);
|
138 |
+
|
139 |
+
|
140 |
+
$websiteConfigId = $websiteConfig->getId();
|
141 |
+
$storeConfigs = $this->getChildConfigs($websiteConfigId, $id, 'stores');
|
142 |
+
if (count($storeConfigs) < 1) {
|
143 |
+
// No storeView scope config found, use website level config
|
144 |
+
$results[$websiteConfigId] = $mergedConfig;
|
145 |
+
continue;
|
146 |
+
}
|
147 |
+
|
148 |
+
$storeConfig = $storeConfigs->getFirstItem(); // @todo hs: is this okay, just getting the first item? there should never be more than one.
|
149 |
+
$finalConfig = $this->mergeConfigs($mergedConfig, $storeConfig);
|
150 |
+
|
151 |
+
$results[$storeConfig->getId()] = $finalConfig;
|
152 |
+
}
|
153 |
+
|
154 |
+
$this->resetData();
|
155 |
+
foreach ($results as $config) {
|
156 |
+
$this->addItem($config);
|
157 |
+
}
|
158 |
+
$this->_isCollectionLoaded = true;
|
159 |
+
return $this;
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
* @param $id
|
164 |
+
*
|
165 |
+
* @return Payone_Core_Model_Domain_Resource_Config_PaymentMethod_Collection
|
166 |
+
*/
|
167 |
+
public function getCollectionByWebsiteId($id)
|
168 |
+
{
|
169 |
+
$results = array();
|
170 |
+
$globalCollection = $this->getCollectionByScopeId();
|
171 |
+
|
172 |
+
// Cycle through default configs, there is one for each configures payment type.
|
173 |
+
foreach ($globalCollection as $globalConfigId => $globalConfig) {
|
174 |
+
$websiteConfigs = $this->getChildConfigs($globalConfigId, $id, 'websites');
|
175 |
+
if (count($websiteConfigs) < 1) {
|
176 |
+
// No website scope config found, use global level config
|
177 |
+
$results[$globalConfigId] = $globalConfig;
|
178 |
+
continue;
|
179 |
+
}
|
180 |
+
|
181 |
+
/** @var $websiteConfig Payone_Core_Model_Domain_Resource_Config_PaymentMethod */
|
182 |
+
$websiteConfig = $websiteConfigs->getFirstItem(); // @todo hs: is this okay, just getting the first item? there should never be more than one.
|
183 |
+
|
184 |
+
$mergedConfig = $this->mergeConfigs($globalConfig, $websiteConfig);
|
185 |
+
|
186 |
+
$results[$websiteConfig->getId()] = $mergedConfig;
|
187 |
+
}
|
188 |
+
|
189 |
+
$this->resetData();
|
190 |
+
foreach ($results as $config) {
|
191 |
+
$this->addItem($config);
|
192 |
+
}
|
193 |
+
$this->_isCollectionLoaded = true;
|
194 |
+
return $this;
|
195 |
+
}
|
196 |
+
|
197 |
+
/**
|
198 |
+
* Fetch a collection filtered by scope and scopeId.
|
199 |
+
* This function will NOT modify this object, only return a NEW collection.
|
200 |
+
*
|
201 |
+
* @param int $scopeId
|
202 |
+
* @param string $scope ('default', 'websites', 'stores')
|
203 |
+
* @param bool $includeDeletedConfigs true = collection also included configurations marked as "is_deleted = 1"
|
204 |
+
*
|
205 |
+
* @return Payone_Core_Model_Domain_Resource_Config_PaymentMethod_Collection
|
206 |
+
*/
|
207 |
+
protected function getCollectionByScopeId($scopeId = 0, $scope = 'default', $includeDeletedConfigs = false)
|
208 |
+
{
|
209 |
+
/** @var $collection Payone_Core_Model_Domain_Resource_Config_PaymentMethod_Collection */
|
210 |
+
$collection = $this->getFactory()->getModelDomainConfigPaymentMethod()->getCollection();
|
211 |
+
|
212 |
+
$collection->addFieldToFilter('scope', $scope);
|
213 |
+
$collection->addFieldToFilter('scope_id', $scopeId);
|
214 |
+
if (!$includeDeletedConfigs) {
|
215 |
+
$collection->addFilterIsDeleted(0);
|
216 |
+
}
|
217 |
+
|
218 |
+
return $collection;
|
219 |
+
}
|
220 |
+
|
221 |
+
/**
|
222 |
+
* Fetch a collection filtered by scope and scopeId.
|
223 |
+
*
|
224 |
+
* @param int $scopeId
|
225 |
+
* @param string $scope ('default', 'websites', 'stores')
|
226 |
+
*
|
227 |
+
* @return Payone_Core_Model_Domain_Resource_Config_PaymentMethod_Collection
|
228 |
+
* @throws Payone_Core_Exception_InvalidScope
|
229 |
+
*/
|
230 |
+
public function getCollectionByScopeIdMerged($scopeId = 0, $scope = 'default')
|
231 |
+
{ if ($scope === 'default') {
|
232 |
+
$this->addFieldToFilter('scope', $scope);
|
233 |
+
$this->addFieldToFilter('scope_id', $scopeId);
|
234 |
+
$this->addFilterIsDeleted(0);
|
235 |
+
|
236 |
+
return $this;
|
237 |
+
}
|
238 |
+
if ($scope === 'websites') {
|
239 |
+
return $this->getCollectionByWebsiteId($scopeId);
|
240 |
+
}
|
241 |
+
if ($scope === 'stores') {
|
242 |
+
return $this->getCollectionByStoreId($scopeId);
|
243 |
+
}
|
244 |
+
throw new Payone_Core_Exception_InvalidScope();
|
245 |
+
}
|
246 |
+
|
247 |
+
/**
|
248 |
+
* Merge config2 onto config1, config2 values overwrite config1 values.
|
249 |
+
*
|
250 |
+
* @param Payone_Core_Model_Domain_Config_PaymentMethod $config1
|
251 |
+
* @param Payone_Core_Model_Domain_Config_PaymentMethod $config2
|
252 |
+
*
|
253 |
+
* @return Payone_Core_Model_Domain_Config_PaymentMethod
|
254 |
+
*/
|
255 |
+
protected function mergeConfigs(Payone_Core_Model_Domain_Config_PaymentMethod $config1,
|
256 |
+
Payone_Core_Model_Domain_Config_PaymentMethod $config2)
|
257 |
+
{
|
258 |
+
foreach ($config2->getData() as $key => $value) {
|
259 |
+
if (isset($value)) {
|
260 |
+
$config1->setData($key, $config2->getData($key));
|
261 |
+
}
|
262 |
+
}
|
263 |
+
return $config1;
|
264 |
+
}
|
265 |
+
|
266 |
+
/**
|
267 |
+
* @param int $parentId
|
268 |
+
* @param int $scopeId
|
269 |
+
* @param string $scope ('default', 'websites', 'stores')
|
270 |
+
*
|
271 |
+
* @return Payone_Core_Model_Domain_Resource_Config_PaymentMethod_Collection
|
272 |
+
*/
|
273 |
+
public function getChildConfigs($parentId, $scopeId, $scope)
|
274 |
+
{
|
275 |
+
/** @var $collection Payone_Core_Model_Domain_Resource_Config_PaymentMethod_Collection */
|
276 |
+
$collection = $this->getFactory()->getModelDomainConfigPaymentMethod()->getCollection();
|
277 |
+
|
278 |
+
$parentIdField = 'websites';
|
279 |
+
if ($scope === 'websites') {
|
280 |
+
$parentIdField = 'parent_default_id';
|
281 |
+
}
|
282 |
+
if ($scope === 'stores') {
|
283 |
+
$parentIdField = 'parent_websites_id';
|
284 |
+
}
|
285 |
+
$collection = $this->getCollectionByScopeId($scopeId, $scope);
|
286 |
+
$collection->addFieldToFilter($parentIdField, $parentId);
|
287 |
+
|
288 |
+
return $collection;
|
289 |
+
}
|
290 |
+
|
291 |
+
|
292 |
+
/**
|
293 |
+
* @param Payone_Core_Model_Domain_Config_PaymentMethod $child
|
294 |
+
* @param Payone_Core_Model_Domain_Config_PaymentMethod $parent
|
295 |
+
* @return Payone_Core_Model_Domain_Config_PaymentMethod
|
296 |
+
*/
|
297 |
+
protected function mergeData(
|
298 |
+
Payone_Core_Model_Domain_Config_PaymentMethod $child,
|
299 |
+
Payone_Core_Model_Domain_Config_PaymentMethod $parent
|
300 |
+
)
|
301 |
+
{
|
302 |
+
foreach ($child->getData() as $key => $value) {
|
303 |
+
if ($value === null || $value === false) {
|
304 |
+
$child->setData($key, $parent->getData($key));
|
305 |
+
}
|
306 |
+
}
|
307 |
+
return $child;
|
308 |
+
}
|
309 |
+
|
310 |
+
/**
|
311 |
+
* @param Payone_Core_Model_Factory $factory
|
312 |
+
*/
|
313 |
+
public function setFactory(Payone_Core_Model_Factory $factory)
|
314 |
+
{
|
315 |
+
$this->factory = $factory;
|
316 |
+
}
|
317 |
+
|
318 |
+
/**
|
319 |
+
* @return Payone_Core_Model_Factory
|
320 |
+
*/
|
321 |
+
public function getFactory()
|
322 |
+
{
|
323 |
+
if ($this->factory === null) {
|
324 |
+
$this->factory = new Payone_Core_Model_Factory();
|
325 |
+
}
|
326 |
+
return $this->factory;
|
327 |
+
}
|
328 |
}
|
app/code/community/Payone/Core/Model/Mapper/ApiRequest/Payment/Abstract.php
CHANGED
@@ -38,6 +38,9 @@ abstract class Payone_Core_Model_Mapper_ApiRequest_Payment_Abstract
|
|
38 |
const DEFAULT_ADJUSTMENT_POSITIVE_SKU = 'Adjustment Refund';
|
39 |
const DEFAULT_ADJUSTMENT_NEGATIVE_SKU = 'Adjustment Fee';
|
40 |
|
|
|
|
|
|
|
41 |
/** @var float */
|
42 |
protected $amount = 0.00;
|
43 |
|
@@ -84,6 +87,7 @@ abstract class Payone_Core_Model_Mapper_ApiRequest_Payment_Abstract
|
|
84 |
$request->setSolutionName($solutionName);
|
85 |
$request->setSolutionVersion($solutionVersion);
|
86 |
}
|
|
|
87 |
/**
|
88 |
* @return Payone_Api_Request_Parameter_Invoicing_Item
|
89 |
*/
|
@@ -108,6 +112,33 @@ abstract class Payone_Core_Model_Mapper_ApiRequest_Payment_Abstract
|
|
108 |
return $item;
|
109 |
}
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
/**
|
112 |
* @param Mage_Sales_Model_Order_Creditmemo $creditmemo
|
113 |
* @return Payone_Api_Request_Parameter_Invoicing_Item
|
38 |
const DEFAULT_ADJUSTMENT_POSITIVE_SKU = 'Adjustment Refund';
|
39 |
const DEFAULT_ADJUSTMENT_NEGATIVE_SKU = 'Adjustment Fee';
|
40 |
|
41 |
+
const DEFAULT_DISCOUNT_SKU = 'Discount';
|
42 |
+
const DEFAULT_TAX_SKU = 'Tax';
|
43 |
+
|
44 |
/** @var float */
|
45 |
protected $amount = 0.00;
|
46 |
|
87 |
$request->setSolutionName($solutionName);
|
88 |
$request->setSolutionVersion($solutionVersion);
|
89 |
}
|
90 |
+
|
91 |
/**
|
92 |
* @return Payone_Api_Request_Parameter_Invoicing_Item
|
93 |
*/
|
112 |
return $item;
|
113 |
}
|
114 |
|
115 |
+
/**
|
116 |
+
* @param float $discountAmount
|
117 |
+
* @return Payone_Api_Request_Parameter_Invoicing_Item
|
118 |
+
*/
|
119 |
+
protected function mapDiscountAsItem($discountAmount)
|
120 |
+
{
|
121 |
+
$configMiscDiscount = $this->getConfigMisc()->getDiscount();
|
122 |
+
$sku = $configMiscDiscount->getSku();
|
123 |
+
$description = $configMiscDiscount->getDescription();
|
124 |
+
if (empty($sku)) {
|
125 |
+
$sku = $this->helper()->__(self::DEFAULT_DISCOUNT_SKU);
|
126 |
+
}
|
127 |
+
if (empty($description)) {
|
128 |
+
$description = $this->helper()->__(self::DEFAULT_DISCOUNT_SKU);
|
129 |
+
}
|
130 |
+
|
131 |
+
$params['id'] = $sku;
|
132 |
+
$params['de'] = $description;
|
133 |
+
$params['no'] = 1;
|
134 |
+
$params['pr'] = $discountAmount;
|
135 |
+
|
136 |
+
$item = new Payone_Api_Request_Parameter_Invoicing_Item();
|
137 |
+
$item->init($params);
|
138 |
+
|
139 |
+
return $item;
|
140 |
+
}
|
141 |
+
|
142 |
/**
|
143 |
* @param Mage_Sales_Model_Order_Creditmemo $creditmemo
|
144 |
* @return Payone_Api_Request_Parameter_Invoicing_Item
|
app/code/community/Payone/Core/Model/Mapper/ApiRequest/Payment/Authorize/Abstract.php
CHANGED
@@ -234,6 +234,12 @@ abstract class Payone_Core_Model_Mapper_ApiRequest_Payment_Authorize_Abstract
|
|
234 |
$invoicing->addItem($this->mapShippingFeeAsItem());
|
235 |
}
|
236 |
|
|
|
|
|
|
|
|
|
|
|
|
|
237 |
return $invoicing;
|
238 |
}
|
239 |
|
234 |
$invoicing->addItem($this->mapShippingFeeAsItem());
|
235 |
}
|
236 |
|
237 |
+
// Discounts:
|
238 |
+
$discountAmount = $order->getDiscountAmount(); // Discount Amount is negative on order.
|
239 |
+
if($discountAmount > 0 || $discountAmount < 0)
|
240 |
+
{
|
241 |
+
$invoicing->addItem($this->mapDiscountAsItem($discountAmount));
|
242 |
+
}
|
243 |
return $invoicing;
|
244 |
}
|
245 |
|
app/code/community/Payone/Core/Model/Mapper/ApiRequest/Payment/Capture.php
CHANGED
@@ -143,6 +143,13 @@ class Payone_Core_Model_Mapper_ApiRequest_Payment_Capture
|
|
143 |
$invoicing->addItem($this->mapShippingFeeAsItem());
|
144 |
}
|
145 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
return $invoicing;
|
147 |
}
|
148 |
|
143 |
$invoicing->addItem($this->mapShippingFeeAsItem());
|
144 |
}
|
145 |
|
146 |
+
// Discounts:
|
147 |
+
$discountAmount = $invoice->getDiscountAmount(); // Discount Amount is positive on invoice.
|
148 |
+
if($discountAmount > 0)
|
149 |
+
{
|
150 |
+
$invoicing->addItem($this->mapDiscountAsItem(-1 * $discountAmount));
|
151 |
+
}
|
152 |
+
|
153 |
return $invoicing;
|
154 |
}
|
155 |
|
app/code/community/Payone/Core/Model/Observer/TransactionStatus/InvoiceCreate.php
CHANGED
@@ -94,7 +94,17 @@ class Payone_Core_Model_Observer_TransactionStatus_InvoiceCreate
|
|
94 |
$invoice = $this->getInvoiceForOrder();
|
95 |
if ($invoice) {
|
96 |
$invoice->pay();
|
97 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
}
|
99 |
}
|
100 |
}
|
94 |
$invoice = $this->getInvoiceForOrder();
|
95 |
if ($invoice) {
|
96 |
$invoice->pay();
|
97 |
+
|
98 |
+
// Save invoice and it´s order as a transaction:
|
99 |
+
try {
|
100 |
+
$transaction = $this->getFactory()->getModelResourceTransaction();
|
101 |
+
$transaction->addObject($invoice);
|
102 |
+
$transaction->addObject($invoice->getOrder());
|
103 |
+
$transaction->save();
|
104 |
+
}
|
105 |
+
catch (Mage_Core_Exception $e) {
|
106 |
+
throw new Payone_Core_Exception_InvoiceSave($e->getMessage());
|
107 |
+
}
|
108 |
}
|
109 |
}
|
110 |
}
|
app/code/community/Payone/Core/Model/Service/InitializeConfig.php
CHANGED
@@ -173,7 +173,7 @@ class Payone_Core_Model_Service_InitializeConfig
|
|
173 |
$payment = $this->getConfigModel(self::CONFIG_SECTION_PAYMENT);
|
174 |
|
175 |
/** @var $methodConfigCollection Payone_Core_Model_Domain_Resource_Config_PaymentMethod_Collection */
|
176 |
-
$methodConfigCollection =
|
177 |
$methodConfigCollection->getCollectionByStoreId($this->getStoreId());
|
178 |
$methodConfigCollection->addSortOrder();
|
179 |
|
173 |
$payment = $this->getConfigModel(self::CONFIG_SECTION_PAYMENT);
|
174 |
|
175 |
/** @var $methodConfigCollection Payone_Core_Model_Domain_Resource_Config_PaymentMethod_Collection */
|
176 |
+
$methodConfigCollection = $this->getFactory()->getModelDomainConfigPaymentMethod()->getCollection();
|
177 |
$methodConfigCollection->getCollectionByStoreId($this->getStoreId());
|
178 |
$methodConfigCollection->addSortOrder();
|
179 |
|
app/code/community/Payone/Core/Model/Service/TransactionStatus/Process.php
CHANGED
@@ -64,7 +64,15 @@ class Payone_Core_Model_Service_TransactionStatus_Process extends Payone_Core_Mo
|
|
64 |
$order->loadByIncrementId($transactionStatus->getReference());
|
65 |
|
66 |
if (!$order->hasData()) {
|
67 |
-
throw new Payone_Core_Exception_OrderNotFound
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
}
|
69 |
|
70 |
$config = $this->helperConfig()->getConfigStore($order->getStoreId());
|
64 |
$order->loadByIncrementId($transactionStatus->getReference());
|
65 |
|
66 |
if (!$order->hasData()) {
|
67 |
+
throw new Payone_Core_Exception_OrderNotFound('Reference "'.$transactionStatus->getReference().'"."');
|
68 |
+
}
|
69 |
+
|
70 |
+
// Secondary validation: is Transaction Id correct?
|
71 |
+
$payment = $order->getPayment();
|
72 |
+
$lastTxId = $payment->getLastTransId();
|
73 |
+
if($lastTxId != $transactionStatus->getTxid())
|
74 |
+
{
|
75 |
+
return; // Don´t throw an exception, just abort processing.
|
76 |
}
|
77 |
|
78 |
$config = $this->helperConfig()->getConfigStore($order->getStoreId());
|
app/code/community/Payone/Core/controllers/Adminhtml/System/Config/PaymentController.php
CHANGED
@@ -1,205 +1,231 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
*
|
4 |
-
* NOTICE OF LICENSE
|
5 |
-
*
|
6 |
-
* This source file is subject to the GNU General Public License (GPL 3)
|
7 |
-
* that is bundled with this package in the file LICENSE.txt
|
8 |
-
*
|
9 |
-
* DISCLAIMER
|
10 |
-
*
|
11 |
-
* Do not edit or add to this file if you wish to upgrade Payone_Core to newer
|
12 |
-
* versions in the future. If you wish to customize Payone_Core for your
|
13 |
-
* needs please refer to http://www.payone.de for more information.
|
14 |
-
*
|
15 |
-
* @category Payone
|
16 |
-
* @package Payone_Core_controllers
|
17 |
-
* @subpackage Adminhtml_System
|
18 |
-
* @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
|
19 |
-
* @author Matthias Walter <info@noovias.com>
|
20 |
-
* @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
|
21 |
-
* @link http://www.noovias.com
|
22 |
-
*/
|
23 |
-
|
24 |
-
/**
|
25 |
-
*
|
26 |
-
* @category Payone
|
27 |
-
* @package Payone_Core_controllers
|
28 |
-
* @subpackage Adminhtml_System
|
29 |
-
* @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
|
30 |
-
* @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
|
31 |
-
* @link http://www.noovias.com
|
32 |
-
*/
|
33 |
-
class Payone_Core_Adminhtml_System_Config_PaymentController
|
34 |
-
extends Payone_Core_Controller_Adminhtml_Abstract
|
35 |
-
{
|
36 |
-
/**
|
37 |
-
* @return Payone_Core_Adminhtml_System_Config_PaymentController
|
38 |
-
*/
|
39 |
-
protected function _initAction()
|
40 |
-
{
|
41 |
-
$this->loadLayout();
|
42 |
-
return $this;
|
43 |
-
}
|
44 |
-
|
45 |
-
/**
|
46 |
-
*
|
47 |
-
*/
|
48 |
-
public function indexAction()
|
49 |
-
{
|
50 |
-
$websiteCode = $this->getRequest()->getParam('website');
|
51 |
-
|
52 |
-
$showButtons = true;
|
53 |
-
if ($websiteCode) {
|
54 |
-
$showButtons = false;
|
55 |
-
}
|
56 |
-
|
57 |
-
Mage::register('show_new_payment_buttons', $showButtons);
|
58 |
-
|
59 |
-
$this->_initAction();
|
60 |
-
$this->renderLayout();
|
61 |
-
}
|
62 |
-
|
63 |
-
public function gridAction()
|
64 |
-
{
|
65 |
-
$this->getResponse()->setBody(
|
66 |
-
Mage::getBlockSingleton('payone_core/adminhtml_system_config_payment_grid')->toHtml()
|
67 |
-
);
|
68 |
-
}
|
69 |
-
|
70 |
-
/**
|
71 |
-
*
|
72 |
-
*/
|
73 |
-
public function newAction()
|
74 |
-
{
|
75 |
-
$type = $this->getRequest()->getParam('type');
|
76 |
-
if ($type == null) {
|
77 |
-
$this->_redirect('*/*/', array('_current' => true));
|
78 |
-
}
|
79 |
-
|
80 |
-
$this->_forward('edit');
|
81 |
-
}
|
82 |
-
|
83 |
-
/**
|
84 |
-
*
|
85 |
-
*/
|
86 |
-
public function editAction()
|
87 |
-
{
|
88 |
-
$id = $this->getRequest()->getParam('id');
|
89 |
-
$website = $this->getRequest()->getParam('website');
|
90 |
-
$store = $this->getRequest()->getParam('store');
|
91 |
-
$type = $this->getRequest()->getParam('type');
|
92 |
-
|
93 |
-
/** @var $model Payone_Core_Model_Domain_Config_PaymentMethod */
|
94 |
-
$model = $this->getModelDomainConfigPaymentMethod()->load($id);
|
95 |
-
|
96 |
-
if ($model->getId() || $id == 0) {
|
97 |
-
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
98 |
-
if (!empty($data)) {
|
99 |
-
$model->setData($data);
|
100 |
-
}
|
101 |
-
$model->setWebsite($website);
|
102 |
-
$model->setStore($store);
|
103 |
-
$model->setCode($type);
|
104 |
-
|
105 |
-
Mage::register('payone_core_config_payment_method', $model);
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
$this->
|
110 |
-
|
111 |
-
$this->
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
$
|
129 |
-
$
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
$model
|
135 |
-
$model->
|
136 |
-
$model->
|
137 |
-
$model->
|
138 |
-
$model->
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
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 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
);
|
188 |
-
$
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
$
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
205 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* NOTICE OF LICENSE
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License (GPL 3)
|
7 |
+
* that is bundled with this package in the file LICENSE.txt
|
8 |
+
*
|
9 |
+
* DISCLAIMER
|
10 |
+
*
|
11 |
+
* Do not edit or add to this file if you wish to upgrade Payone_Core to newer
|
12 |
+
* versions in the future. If you wish to customize Payone_Core for your
|
13 |
+
* needs please refer to http://www.payone.de for more information.
|
14 |
+
*
|
15 |
+
* @category Payone
|
16 |
+
* @package Payone_Core_controllers
|
17 |
+
* @subpackage Adminhtml_System
|
18 |
+
* @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
|
19 |
+
* @author Matthias Walter <info@noovias.com>
|
20 |
+
* @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
|
21 |
+
* @link http://www.noovias.com
|
22 |
+
*/
|
23 |
+
|
24 |
+
/**
|
25 |
+
*
|
26 |
+
* @category Payone
|
27 |
+
* @package Payone_Core_controllers
|
28 |
+
* @subpackage Adminhtml_System
|
29 |
+
* @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
|
30 |
+
* @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
|
31 |
+
* @link http://www.noovias.com
|
32 |
+
*/
|
33 |
+
class Payone_Core_Adminhtml_System_Config_PaymentController
|
34 |
+
extends Payone_Core_Controller_Adminhtml_Abstract
|
35 |
+
{
|
36 |
+
/**
|
37 |
+
* @return Payone_Core_Adminhtml_System_Config_PaymentController
|
38 |
+
*/
|
39 |
+
protected function _initAction()
|
40 |
+
{
|
41 |
+
$this->loadLayout();
|
42 |
+
return $this;
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
*
|
47 |
+
*/
|
48 |
+
public function indexAction()
|
49 |
+
{
|
50 |
+
$websiteCode = $this->getRequest()->getParam('website');
|
51 |
+
|
52 |
+
$showButtons = true;
|
53 |
+
if ($websiteCode) {
|
54 |
+
$showButtons = false;
|
55 |
+
}
|
56 |
+
|
57 |
+
Mage::register('show_new_payment_buttons', $showButtons);
|
58 |
+
|
59 |
+
$this->_initAction();
|
60 |
+
$this->renderLayout();
|
61 |
+
}
|
62 |
+
|
63 |
+
public function gridAction()
|
64 |
+
{
|
65 |
+
$this->getResponse()->setBody(
|
66 |
+
Mage::getBlockSingleton('payone_core/adminhtml_system_config_payment_grid')->toHtml()
|
67 |
+
);
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
*
|
72 |
+
*/
|
73 |
+
public function newAction()
|
74 |
+
{
|
75 |
+
$type = $this->getRequest()->getParam('type');
|
76 |
+
if ($type == null) {
|
77 |
+
$this->_redirect('*/*/', array('_current' => true));
|
78 |
+
}
|
79 |
+
|
80 |
+
$this->_forward('edit');
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
*
|
85 |
+
*/
|
86 |
+
public function editAction()
|
87 |
+
{
|
88 |
+
$id = $this->getRequest()->getParam('id');
|
89 |
+
$website = $this->getRequest()->getParam('website');
|
90 |
+
$store = $this->getRequest()->getParam('store');
|
91 |
+
$type = $this->getRequest()->getParam('type');
|
92 |
+
|
93 |
+
/** @var $model Payone_Core_Model_Domain_Config_PaymentMethod */
|
94 |
+
$model = $this->getModelDomainConfigPaymentMethod()->load($id);
|
95 |
+
|
96 |
+
if ($model->getId() || $id == 0) {
|
97 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
98 |
+
if (!empty($data)) {
|
99 |
+
$model->setData($data);
|
100 |
+
}
|
101 |
+
$model->setWebsite($website);
|
102 |
+
$model->setStore($store);
|
103 |
+
$model->setCode($type);
|
104 |
+
|
105 |
+
Mage::register('payone_core_config_payment_method', $model);
|
106 |
+
Mage::register('payone_core_config_active_scope', $this->determineActiveScope($website, $store));
|
107 |
+
|
108 |
+
|
109 |
+
$this->loadLayout();
|
110 |
+
|
111 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
112 |
+
|
113 |
+
$this->renderLayout();
|
114 |
+
}
|
115 |
+
else {
|
116 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
117 |
+
$this->helper()->__('PaymentMethod-Config does not exist.')
|
118 |
+
);
|
119 |
+
$this->_redirect('*/*/', array('_current' => true));
|
120 |
+
}
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
*
|
125 |
+
*/
|
126 |
+
public function saveAction()
|
127 |
+
{
|
128 |
+
$data = $this->getRequest()->getParam('groups');
|
129 |
+
$website = $this->getRequest()->getParam('website');
|
130 |
+
$store = $this->getRequest()->getParam('store');
|
131 |
+
$type = $this->getRequest()->getParam('type');
|
132 |
+
|
133 |
+
if ($data) {
|
134 |
+
/** @var $model Payone_Core_Model_Domain_Config_PaymentMethod */
|
135 |
+
$model = $this->getModelDomainConfigPaymentMethod();
|
136 |
+
$model->setWebsite($website);
|
137 |
+
$model->setStore($store);
|
138 |
+
$model->setCode($type);
|
139 |
+
$model->setGroups($data);
|
140 |
+
$model->setId($this->getRequest()->getParam('id'));
|
141 |
+
|
142 |
+
try {
|
143 |
+
$model->save();
|
144 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
145 |
+
$this->helper()->__('PaymentMethod-Config was successfully saved.')
|
146 |
+
);
|
147 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
148 |
+
|
149 |
+
$this->_redirect('*/*/', array('_current' => true));
|
150 |
+
return;
|
151 |
+
}
|
152 |
+
catch (Exception $e) {
|
153 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
154 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
155 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id'), '_current' => true));
|
156 |
+
return;
|
157 |
+
}
|
158 |
+
}
|
159 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
160 |
+
$this->helper()->__('Unable to find PaymentMethod-Config to save.')
|
161 |
+
);
|
162 |
+
$this->_redirect('*/*/', array('_current' => true));
|
163 |
+
}
|
164 |
+
|
165 |
+
/**
|
166 |
+
*
|
167 |
+
*/
|
168 |
+
public function deleteAction()
|
169 |
+
{
|
170 |
+
$id = $this->getRequest()->getParam('id');
|
171 |
+
if ($id > 0) {
|
172 |
+
$data = $this->getRequest()->getParam('groups');
|
173 |
+
$website = $this->getRequest()->getParam('website');
|
174 |
+
$store = $this->getRequest()->getParam('store');
|
175 |
+
$type = $this->getRequest()->getParam('type');
|
176 |
+
|
177 |
+
|
178 |
+
try {
|
179 |
+
if ($this->determineActiveScope($website, $store) != 'default') {
|
180 |
+
// Deleting payment configs is only allowed in default scope, go back to grid.
|
181 |
+
$this->_redirect('*/*/index', array('website' => $website, 'store' => $store));
|
182 |
+
return;
|
183 |
+
}
|
184 |
+
|
185 |
+
/** @var $model Payone_Core_Model_Domain_Config_PaymentMethod */
|
186 |
+
$model = $this->getModelDomainConfigPaymentMethod();
|
187 |
+
$model->setWebsite($website);
|
188 |
+
$model->setStore($store);
|
189 |
+
$model->setCode($type);
|
190 |
+
$model->setGroups($data);
|
191 |
+
$model->setId($id);
|
192 |
+
$model->setIsDeleted(1);
|
193 |
+
$model->save();
|
194 |
+
|
195 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
196 |
+
Mage::helper('adminhtml')->__('PaymentMethod Config was successfully deleted.')
|
197 |
+
);
|
198 |
+
$this->_redirect('*/*/', array('_current' => true));
|
199 |
+
}
|
200 |
+
catch (Exception $e) {
|
201 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
202 |
+
$this->_redirect('*/*/edit', array('id' => $id, '_current' => true));
|
203 |
+
}
|
204 |
+
}
|
205 |
+
$this->_redirect('*/*/', array('_current' => true));
|
206 |
+
}
|
207 |
+
|
208 |
+
/**
|
209 |
+
* Determine active scope (not payment config scope, but the scope the admin is currently editing.)
|
210 |
+
*
|
211 |
+
* @param string $website
|
212 |
+
* @param string $store
|
213 |
+
* @return string
|
214 |
+
*/
|
215 |
+
protected function determineActiveScope($website = '', $store = '')
|
216 |
+
{
|
217 |
+
if($store)
|
218 |
+
return 'stores';
|
219 |
+
if ($website)
|
220 |
+
return 'websites';
|
221 |
+
return 'default';
|
222 |
+
}
|
223 |
+
|
224 |
+
/**
|
225 |
+
* @return Payone_Core_Model_Domain_Config_PaymentMethod
|
226 |
+
*/
|
227 |
+
protected function getModelDomainConfigPaymentMethod()
|
228 |
+
{
|
229 |
+
return $this->getFactory()->getModelDomainConfigPaymentMethod();
|
230 |
+
}
|
231 |
}
|
app/code/community/Payone/Core/etc/config.xml
CHANGED
@@ -24,7 +24,7 @@
|
|
24 |
<config>
|
25 |
<modules>
|
26 |
<Payone_Core>
|
27 |
-
<version>3.0.
|
28 |
</Payone_Core>
|
29 |
</modules>
|
30 |
|
24 |
<config>
|
25 |
<modules>
|
26 |
<Payone_Core>
|
27 |
+
<version>3.0.11</version>
|
28 |
</Payone_Core>
|
29 |
</modules>
|
30 |
|
app/code/community/Payone/Core/etc/system.xml
CHANGED
@@ -1150,7 +1150,7 @@
|
|
1150 |
</fields>
|
1151 |
</transactionstatus_forwarding>
|
1152 |
<shipping_costs>
|
1153 |
-
<label>Shipping Costs</label>
|
1154 |
<frontend_type>text</frontend_type>
|
1155 |
<sort_order>20</sort_order>
|
1156 |
<show_in_default>1</show_in_default>
|
@@ -1158,7 +1158,7 @@
|
|
1158 |
<show_in_store>1</show_in_store>
|
1159 |
<fields>
|
1160 |
<hint translate="label">
|
1161 |
-
<label>Shipping Costs</label>
|
1162 |
<sort_order>0</sort_order>
|
1163 |
<show_in_default>1</show_in_default>
|
1164 |
<show_in_website>1</show_in_website>
|
@@ -1178,8 +1178,45 @@
|
|
1178 |
</sku>
|
1179 |
</fields>
|
1180 |
</shipping_costs>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1181 |
<creditmemo>
|
1182 |
-
<label>Creditmemo</label>
|
1183 |
<frontend_type>text</frontend_type>
|
1184 |
<sort_order>30</sort_order>
|
1185 |
<show_in_default>1</show_in_default>
|
@@ -1187,7 +1224,7 @@
|
|
1187 |
<show_in_store>1</show_in_store>
|
1188 |
<fields>
|
1189 |
<hint translate="label">
|
1190 |
-
<label>Creditmemo</label>
|
1191 |
<sort_order>0</sort_order>
|
1192 |
<show_in_default>1</show_in_default>
|
1193 |
<show_in_website>1</show_in_website>
|
@@ -1206,7 +1243,7 @@
|
|
1206 |
<show_in_store>1</show_in_store>
|
1207 |
</adjustment_refund_sku>
|
1208 |
<adjustment_refund_name translate="label">
|
1209 |
-
<label>Adjustment Refund
|
1210 |
<frontend_type>text</frontend_type>
|
1211 |
<sort_order>20</sort_order>
|
1212 |
<show_in_default>1</show_in_default>
|
@@ -1222,7 +1259,7 @@
|
|
1222 |
<show_in_store>1</show_in_store>
|
1223 |
</adjustment_fee_sku>
|
1224 |
<adjustment_fee_name translate="label">
|
1225 |
-
<label>Adjustment Fee
|
1226 |
<frontend_type>text</frontend_type>
|
1227 |
<sort_order>40</sort_order>
|
1228 |
<show_in_default>1</show_in_default>
|
1150 |
</fields>
|
1151 |
</transactionstatus_forwarding>
|
1152 |
<shipping_costs>
|
1153 |
+
<label>Invoicing Data - Shipping Costs</label>
|
1154 |
<frontend_type>text</frontend_type>
|
1155 |
<sort_order>20</sort_order>
|
1156 |
<show_in_default>1</show_in_default>
|
1158 |
<show_in_store>1</show_in_store>
|
1159 |
<fields>
|
1160 |
<hint translate="label">
|
1161 |
+
<label>Invoicing Data - Shipping Costs</label>
|
1162 |
<sort_order>0</sort_order>
|
1163 |
<show_in_default>1</show_in_default>
|
1164 |
<show_in_website>1</show_in_website>
|
1178 |
</sku>
|
1179 |
</fields>
|
1180 |
</shipping_costs>
|
1181 |
+
<discount>
|
1182 |
+
<label>Invoicing Data - Discount</label>
|
1183 |
+
<frontend_type>text</frontend_type>
|
1184 |
+
<sort_order>20</sort_order>
|
1185 |
+
<show_in_default>1</show_in_default>
|
1186 |
+
<show_in_website>1</show_in_website>
|
1187 |
+
<show_in_store>1</show_in_store>
|
1188 |
+
<fields>
|
1189 |
+
<hint translate="label">
|
1190 |
+
<label>Invoicing Data - Discount</label>
|
1191 |
+
<sort_order>0</sort_order>
|
1192 |
+
<show_in_default>1</show_in_default>
|
1193 |
+
<show_in_website>1</show_in_website>
|
1194 |
+
<show_in_store>1</show_in_store>
|
1195 |
+
<hint>
|
1196 |
+
<template>payone/core/system/config/tooltip/misc/discount.phtml</template>
|
1197 |
+
</hint>
|
1198 |
+
<frontend_model>payone_core/adminhtml_system_config_form_field_info</frontend_model>
|
1199 |
+
</hint>
|
1200 |
+
<sku translate="label">
|
1201 |
+
<label>SKU</label>
|
1202 |
+
<frontend_type>text</frontend_type>
|
1203 |
+
<sort_order>10</sort_order>
|
1204 |
+
<show_in_default>1</show_in_default>
|
1205 |
+
<show_in_website>1</show_in_website>
|
1206 |
+
<show_in_store>1</show_in_store>
|
1207 |
+
</sku>
|
1208 |
+
<description translate="label">
|
1209 |
+
<label>Description</label>
|
1210 |
+
<frontend_type>text</frontend_type>
|
1211 |
+
<sort_order>20</sort_order>
|
1212 |
+
<show_in_default>1</show_in_default>
|
1213 |
+
<show_in_website>1</show_in_website>
|
1214 |
+
<show_in_store>1</show_in_store>
|
1215 |
+
</description>
|
1216 |
+
</fields>
|
1217 |
+
</discount>
|
1218 |
<creditmemo>
|
1219 |
+
<label>Invoicing Data - Creditmemo</label>
|
1220 |
<frontend_type>text</frontend_type>
|
1221 |
<sort_order>30</sort_order>
|
1222 |
<show_in_default>1</show_in_default>
|
1224 |
<show_in_store>1</show_in_store>
|
1225 |
<fields>
|
1226 |
<hint translate="label">
|
1227 |
+
<label>Invoicing Data - Creditmemo</label>
|
1228 |
<sort_order>0</sort_order>
|
1229 |
<show_in_default>1</show_in_default>
|
1230 |
<show_in_website>1</show_in_website>
|
1243 |
<show_in_store>1</show_in_store>
|
1244 |
</adjustment_refund_sku>
|
1245 |
<adjustment_refund_name translate="label">
|
1246 |
+
<label>Adjustment Refund Description</label>
|
1247 |
<frontend_type>text</frontend_type>
|
1248 |
<sort_order>20</sort_order>
|
1249 |
<show_in_default>1</show_in_default>
|
1259 |
<show_in_store>1</show_in_store>
|
1260 |
</adjustment_fee_sku>
|
1261 |
<adjustment_fee_name translate="label">
|
1262 |
+
<label>Adjustment Fee Description</label>
|
1263 |
<frontend_type>text</frontend_type>
|
1264 |
<sort_order>40</sort_order>
|
1265 |
<show_in_default>1</show_in_default>
|
app/code/community/Payone/Core/sql/payone_core_setup/mysql4-install-3.0.0.php
CHANGED
@@ -43,7 +43,27 @@ $installer = $this;
|
|
43 |
|
44 |
$installer->startSetup();
|
45 |
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
// Use own String for type datetime, to be compatible to Magento 1.5
|
48 |
$datetime = 'datetime';
|
49 |
|
43 |
|
44 |
$installer->startSetup();
|
45 |
|
46 |
+
/** @var $helper Payone_Core_Helper_Data */
|
47 |
+
$helper = Mage::helper('payone_core');
|
48 |
+
|
49 |
+
$magentoEdition = $helper->getMagentoEdition();
|
50 |
+
$magentoVersion = $helper->getMagentoVersion();
|
51 |
+
|
52 |
+
$useOldStyleInstaller = false;
|
53 |
+
switch($magentoEdition)
|
54 |
+
{
|
55 |
+
case 'CE' :
|
56 |
+
if(version_compare($magentoVersion, '1.6', '<'))
|
57 |
+
$useOldStyleInstaller = true;
|
58 |
+
break;
|
59 |
+
case 'EE' : // Intentional fallthrough
|
60 |
+
case 'PE' :
|
61 |
+
if(version_compare($magentoVersion, '1.11', '<'))
|
62 |
+
$useOldStyleInstaller = true;
|
63 |
+
break;
|
64 |
+
}
|
65 |
+
|
66 |
+
if($useOldStyleInstaller) {
|
67 |
// Use own String for type datetime, to be compatible to Magento 1.5
|
68 |
$datetime = 'datetime';
|
69 |
|
app/design/adminhtml/default/default/layout/payone/configuration.xml
CHANGED
@@ -21,7 +21,7 @@
|
|
21 |
* @link http://www.noovias.com
|
22 |
*/
|
23 |
-->
|
24 |
-
<layout
|
25 |
|
26 |
<adminhtml_system_config_edit>
|
27 |
<reference name="head">
|
21 |
* @link http://www.noovias.com
|
22 |
*/
|
23 |
-->
|
24 |
+
<layout>
|
25 |
|
26 |
<adminhtml_system_config_edit>
|
27 |
<reference name="head">
|
app/design/adminhtml/default/default/layout/payone/core.xml
CHANGED
@@ -21,7 +21,7 @@
|
|
21 |
* @link http://www.noovias.com
|
22 |
*/
|
23 |
-->
|
24 |
-
<layout
|
25 |
<default>
|
26 |
<reference name="head">
|
27 |
<action method="addCss">
|
21 |
* @link http://www.noovias.com
|
22 |
*/
|
23 |
-->
|
24 |
+
<layout>
|
25 |
<default>
|
26 |
<reference name="head">
|
27 |
<action method="addCss">
|
app/design/adminhtml/default/default/layout/payone/migrator.xml
CHANGED
@@ -21,7 +21,7 @@
|
|
21 |
* @link http://www.noovias.com
|
22 |
*/
|
23 |
-->
|
24 |
-
<layout
|
25 |
|
26 |
<!-- Wizard -->
|
27 |
<payone_migrator_adminhtml_migration_index>
|
21 |
* @link http://www.noovias.com
|
22 |
*/
|
23 |
-->
|
24 |
+
<layout>
|
25 |
|
26 |
<!-- Wizard -->
|
27 |
<payone_migrator_adminhtml_migration_index>
|
app/design/adminhtml/default/default/layout/payone/transaction.xml
CHANGED
@@ -21,7 +21,7 @@
|
|
21 |
* @link http://www.noovias.com
|
22 |
*/
|
23 |
-->
|
24 |
-
<layout
|
25 |
<!--
|
26 |
Protocol TransactionStatus
|
27 |
-->
|
21 |
* @link http://www.noovias.com
|
22 |
*/
|
23 |
-->
|
24 |
+
<layout>
|
25 |
<!--
|
26 |
Protocol TransactionStatus
|
27 |
-->
|
app/design/adminhtml/default/default/template/payone/core/sales/order/create/init.phtml
CHANGED
@@ -22,34 +22,18 @@
|
|
22 |
*/
|
23 |
?>
|
24 |
<script type="text/javascript">
|
25 |
-
|
|
|
|
|
|
|
26 |
|
27 |
Event.observe(window, 'load', function () {
|
28 |
-
|
29 |
-
wrapOrderPrepareParams();
|
30 |
-
});
|
31 |
-
|
32 |
-
function wrapOrderSubmitButton() {
|
33 |
order.submit = order.submit.wrap(
|
34 |
function (origMethod) {
|
35 |
-
|
36 |
-
|
37 |
-
if (radio_p1_cc != undefined && radio_p1_cc != null && radio_p1_cc.checked
|
38 |
-
&& $('payone_pseudocardpan').value == ''){
|
39 |
-
|
40 |
-
// Payone credit card payment method is available, and selected, initiate credit card check:
|
41 |
-
payone.origMethod = origMethod;
|
42 |
-
if (payone.validate('payment_form_payone_creditcard')) {
|
43 |
-
payone.creditcardcheck();
|
44 |
-
}
|
45 |
-
}
|
46 |
-
else
|
47 |
-
origMethod();
|
48 |
-
|
49 |
}
|
50 |
);
|
51 |
-
}
|
52 |
-
function wrapOrderPrepareParams() {
|
53 |
order.prepareParams = order.prepareParams.wrap(
|
54 |
function (origMethod, params) {
|
55 |
params = origMethod(params);
|
@@ -57,5 +41,6 @@
|
|
57 |
return params;
|
58 |
}
|
59 |
);
|
60 |
-
|
61 |
-
|
|
22 |
*/
|
23 |
?>
|
24 |
<script type="text/javascript">
|
25 |
+
//<![CDATA[
|
26 |
+
payone = new PAYONE.Service.CreditCardCheck(
|
27 |
+
new PAYONE.Handler.CreditCardCheck.Admin()
|
28 |
+
);
|
29 |
|
30 |
Event.observe(window, 'load', function () {
|
31 |
+
payone.form = 'payment_form_payone_creditcard';
|
|
|
|
|
|
|
|
|
32 |
order.submit = order.submit.wrap(
|
33 |
function (origMethod) {
|
34 |
+
payone.exec(origMethod);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
}
|
36 |
);
|
|
|
|
|
37 |
order.prepareParams = order.prepareParams.wrap(
|
38 |
function (origMethod, params) {
|
39 |
params = origMethod(params);
|
41 |
return params;
|
42 |
}
|
43 |
);
|
44 |
+
});
|
45 |
+
//]]>
|
46 |
+
</script>
|
app/design/adminhtml/default/default/template/payone/core/system/config/tooltip/misc/creditmemo.phtml
CHANGED
@@ -20,10 +20,16 @@
|
|
20 |
* @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
|
21 |
* @link http://www.noovias.com
|
22 |
*/
|
|
|
|
|
|
|
|
|
23 |
?>
|
24 |
<div class="field-name">Gutschrift</div>
|
25 |
<div class="field-description">
|
26 |
Hier können Sie einstellen welche Artikelnummer und welchen Namen die Berichtigungserstattung bzw. der Berichtigungszuschlag<br>
|
27 |
bei der Übertragung von Rechnungsinformationen bekommen.<br>
|
|
|
|
|
28 |
</div>
|
29 |
<br>
|
20 |
* @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
|
21 |
* @link http://www.noovias.com
|
22 |
*/
|
23 |
+
|
24 |
+
/** @var $this Mage_Adminhtml_Block_Template */
|
25 |
+
$link = Mage::helper('payone_core')->__('PAYONE > General');
|
26 |
+
$url = $this->getUrl('adminhtml/system_config/edit', array('section' => 'payone_general'));
|
27 |
?>
|
28 |
<div class="field-name">Gutschrift</div>
|
29 |
<div class="field-description">
|
30 |
Hier können Sie einstellen welche Artikelnummer und welchen Namen die Berichtigungserstattung bzw. der Berichtigungszuschlag<br>
|
31 |
bei der Übertragung von Rechnungsinformationen bekommen.<br>
|
32 |
+
Um diese Optionen nutzen zu können ist eine Beauftragung des Moduls Invoicing bei PAYONE notwendig.<br>
|
33 |
+
Die Einstellung "Rechnungsinformationen versenden" im Bereich "<a href="<?php echo $this->escapeHtml($url) ?>"><?php echo $link ?></a>" muss auf "Ja" gestellt sein.<br>
|
34 |
</div>
|
35 |
<br>
|
app/design/adminhtml/default/default/template/payone/core/system/config/tooltip/misc/discount.phtml
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* NOTICE OF LICENSE
|
5 |
+
*
|
6 |
+
* This source file is subject to the GNU General Public License (GPL 3)
|
7 |
+
* that is bundled with this package in the file LICENSE.txt
|
8 |
+
*
|
9 |
+
* DISCLAIMER
|
10 |
+
*
|
11 |
+
* Do not edit or add to this file if you wish to upgrade Payone_Core to newer
|
12 |
+
* versions in the future. If you wish to customize Payone_Core for your
|
13 |
+
* needs please refer to http://www.payone.de for more information.
|
14 |
+
*
|
15 |
+
* @category Payone
|
16 |
+
* @package design_adminhtml_default_default
|
17 |
+
* @subpackage template
|
18 |
+
* @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
|
19 |
+
* @author Matthias Walter <info@noovias.com>
|
20 |
+
* @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
|
21 |
+
* @link http://www.noovias.com
|
22 |
+
*/
|
23 |
+
/** @var $this Mage_Adminhtml_Block_Template */
|
24 |
+
$link = Mage::helper('payone_core')->__('PAYONE > General');
|
25 |
+
$url = $this->getUrl('adminhtml/system_config/edit', array('section' => 'payone_general'));
|
26 |
+
?>
|
27 |
+
<div class="field-name">Rabatt</div>
|
28 |
+
<div class="field-description">
|
29 |
+
Hier können Sie einstellen mit welcher Artikelnummer und Beschreibung Rabatte bei der Übertragung von Rechnungsinformationen übermittelt werden.<br>
|
30 |
+
Um diese Optionen nutzen zu können ist eine Beauftragung des Moduls Invoicing bei PAYONE notwendig.<br>
|
31 |
+
Die Einstellung "Rechnungsinformationen versenden" im Bereich "<a href="<?php echo $this->escapeHtml($url) ?>"><?php echo $link ?></a>" muss auf "Ja" gestellt sein.<br>
|
32 |
+
|
33 |
+
</div>
|
34 |
+
<br>
|
app/design/adminhtml/default/default/template/payone/core/system/config/tooltip/misc/shipping_costs.phtml
CHANGED
@@ -20,9 +20,14 @@
|
|
20 |
* @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
|
21 |
* @link http://www.noovias.com
|
22 |
*/
|
|
|
|
|
|
|
23 |
?>
|
24 |
<div class="field-name">Versandkosten</div>
|
25 |
<div class="field-description">
|
26 |
Hier können Sie einstellen welche Artikelnummer die Versandkosten bei der Übertragung von Rechnungsinformationen bekommen.<br>
|
|
|
|
|
27 |
</div>
|
28 |
<br>
|
20 |
* @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
|
21 |
* @link http://www.noovias.com
|
22 |
*/
|
23 |
+
/** @var $this Mage_Adminhtml_Block_Template */
|
24 |
+
$link = Mage::helper('payone_core')->__('PAYONE > General');
|
25 |
+
$url = $this->getUrl('adminhtml/system_config/edit', array('section' => 'payone_general'));
|
26 |
?>
|
27 |
<div class="field-name">Versandkosten</div>
|
28 |
<div class="field-description">
|
29 |
Hier können Sie einstellen welche Artikelnummer die Versandkosten bei der Übertragung von Rechnungsinformationen bekommen.<br>
|
30 |
+
Um diese Optionen nutzen zu können ist eine Beauftragung des Moduls Invoicing bei PAYONE notwendig.<br>
|
31 |
+
Die Einstellung "Rechnungsinformationen versenden" im Bereich "<a href="<?php echo $this->escapeHtml($url) ?>"><?php echo $link ?></a>" muss auf "Ja" gestellt sein.<br>
|
32 |
</div>
|
33 |
<br>
|
app/design/adminhtml/default/default/template/payone/core/system/config/tooltip/misc/transaction_status_forwarding.phtml
CHANGED
@@ -29,4 +29,7 @@ Danach geben Sie die URL an, an welche die Status-Meldungen gesendet werden soll
|
|
29 |
<br>
|
30 |
Die Meldungen werden so weitergegeben wie diese von PAYONE an Magento gemeldet wurden.<br>
|
31 |
<br>
|
32 |
-
Bei Bedarf können Sie im Feld Timeout selbigen erhöhen (Standard: <?php echo $timeout ?>s )<br>
|
|
|
|
|
|
29 |
<br>
|
30 |
Die Meldungen werden so weitergegeben wie diese von PAYONE an Magento gemeldet wurden.<br>
|
31 |
<br>
|
32 |
+
Bei Bedarf können Sie im Feld Timeout selbigen erhöhen (Standard: <?php echo $timeout ?>s )<br>
|
33 |
+
<ul class="payone-config-warning">
|
34 |
+
<li class="payone-config-warning-content"><span>Stellen Sie weiterhin sicher, dass die Cronjobs für ihr System korrekt eingerichtet sind.<span></li>
|
35 |
+
</ul>
|
app/design/adminhtml/default/default/template/payone/core/system/config/tooltip/misc/transactionstatus_forwarding.phtml
CHANGED
@@ -24,6 +24,9 @@
|
|
24 |
<b>Der Transaktionsstatus ist notwendig um evtl. nachfolgende Aktionen wie Warenversand oder ähnliches auszulösen. Um diesen Status auch an weitere<br>
|
25 |
Systeme zu übermitteln können Sie an dieser Stelle für jeden Status eine URL definieren an die dann dieser Status weitergeleitet werden kann.</b><br>
|
26 |
<br>
|
|
|
|
|
|
|
27 |
<div class="field-name">Weiterleitung</div>
|
28 |
<div class="field-description">
|
29 |
<ul>
|
24 |
<b>Der Transaktionsstatus ist notwendig um evtl. nachfolgende Aktionen wie Warenversand oder ähnliches auszulösen. Um diesen Status auch an weitere<br>
|
25 |
Systeme zu übermitteln können Sie an dieser Stelle für jeden Status eine URL definieren an die dann dieser Status weitergeleitet werden kann.</b><br>
|
26 |
<br>
|
27 |
+
<ul class="payone-config-warning">
|
28 |
+
<li class="payone-config-warning-content"><span>Stellen Sie weiterhin sicher, dass die Cronjobs für ihr System korrekt eingerichtet sind.<span></li>
|
29 |
+
</ul>
|
30 |
<div class="field-name">Weiterleitung</div>
|
31 |
<div class="field-description">
|
32 |
<ul>
|