Mage_Payone - Version 3.0.12

Version Notes

Mage_Payone-3.0.12

Download this release

Release Info

Developer Magento Core Team
Extension Mage_Payone
Version 3.0.12
Comparing to
See all releases


Code changes from version 3.0.11 to 3.0.12

Files changed (38) hide show
  1. app/code/community/Payone/Core/Block/Adminhtml/Sales/Order/Grid.php +1 -1
  2. app/code/community/Payone/Core/Block/Adminhtml/System/Config/Form/Payment/Method.php +21 -8
  3. app/code/community/Payone/Core/Block/Adminhtml/System/Config/Payment/Grid.php +1 -0
  4. app/code/community/Payone/Core/Block/Payment/Method/Info/Abstract.php +2 -1
  5. app/code/community/Payone/Core/Helper/Compatibility.php +13 -4
  6. app/code/community/Payone/Core/Helper/Data.php +12 -0
  7. app/code/community/Payone/Core/Model/Config/Misc/TransactionstatusProcessing.php +20 -0
  8. app/code/community/Payone/Core/Model/Config/Payment.php +3 -0
  9. app/code/community/Payone/Core/Model/Domain/Resource/Config/PaymentMethod/Collection.php +13 -13
  10. app/code/community/Payone/Core/Model/Factory.php +24 -1
  11. app/code/community/Payone/Core/Model/Mapper/ApiRequest/Payment/Authorize/Abstract.php +8 -5
  12. app/code/community/Payone/Core/Model/Mapper/ApiRequest/Payment/Capture.php +82 -43
  13. app/code/community/Payone/Core/Model/Mapper/ApiRequest/Payment/Debit.php +9 -3
  14. app/code/community/Payone/Core/Model/Sales/Quote/Address.php +9 -2
  15. app/code/community/Payone/Core/Model/Service/InitializeConfig.php +1 -1
  16. app/code/community/Payone/Core/Model/Service/Sales/OrderStatus.php +2 -1
  17. app/code/community/Payone/Core/controllers/TransactionStatusController.php +16 -3
  18. app/code/community/Payone/Core/etc/config.xml +2 -1
  19. app/code/community/Payone/Core/etc/system.xml +16 -1
  20. app/code/community/Payone/Migrator/Model/Service/Configuration/PaymentMigrate.php +10 -7
  21. app/code/community/Payone/Migrator/etc/config.xml +1 -1
  22. app/design/adminhtml/default/default/template/payone/core/system/config/tooltip/protect/creditrating_agreement_message.phtml +29 -0
  23. app/design/frontend/base/default/template/payone/core/checkout/onepage/payment/additional.phtml +1 -1
  24. app/locale/de_DE/Payone_Core.csv +3 -0
  25. js/payone/core/addresscheck.js +7 -11
  26. lib/Payone/Api/Config.php +33 -1
  27. lib/Payone/Api/Factory.php +35 -0
  28. lib/Payone/Builder.php +3 -2
  29. lib/Payone/Config.php +62 -65
  30. lib/Payone/Config/Abstract.php +207 -0
  31. lib/Payone/Log4php/Logger.php +1 -1
  32. lib/Payone/Log4php/LoggerPatternConverterSuperglobal.php +3 -3
  33. lib/Payone/Settings/Service/XmlGenerate.php +150 -66
  34. lib/Payone/TransactionStatus/Config.php +64 -0
  35. lib/Payone/TransactionStatus/Factory.php +29 -0
  36. lib/Payone/TransactionStatus/Validator/Ip.php +46 -1
  37. package.xml +5 -5
  38. skin/adminhtml/default/default/payone/core/boxes.css +11 -0
app/code/community/Payone/Core/Block/Adminhtml/Sales/Order/Grid.php CHANGED
@@ -266,7 +266,7 @@ class Payone_Core_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_
266
267
$this->getMassactionBlock()->addItem('print_shipping_label', array(
268
'label'=> Mage::helper('sales')->__('Print Shipping Labels'),
269
- 'url' => $this->getUrl('*/*/massPrintShippingLabel'),
270
));
271
272
return $this;
266
267
$this->getMassactionBlock()->addItem('print_shipping_label', array(
268
'label'=> Mage::helper('sales')->__('Print Shipping Labels'),
269
+ 'url' => $this->getUrl('adminhtml/sales_order_shipment/massPrintShippingLabel'),
270
));
271
272
return $this;
app/code/community/Payone/Core/Block/Adminhtml/System/Config/Form/Payment/Method.php CHANGED
@@ -65,20 +65,26 @@ class Payone_Core_Block_Adminhtml_System_Config_Form_Payment_Method
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
}
@@ -175,7 +181,14 @@ class Payone_Core_Block_Adminhtml_System_Config_Form_Payment_Method
175
176
foreach ($groupDefault->fields as $elements) {
177
foreach ($elements as $e) {
178
- $group->fields->appendChild($e);
179
}
180
}
181
65
if ($parentModel) {
66
$grandParentModel = $parentModel->getParentModel();
67
68
+ foreach ($parentModel->getData() as $key => $parentValue)
69
+ {
70
$path = self::SECTION_PAYONE_PAYMENT . '/' . self::GROUP_TEMPLATE_PREFIX . $this->getMethodType() . '/' . $key;
71
$modelValue = $model->getData($key);
72
+
73
if (isset($modelValue)) {
74
+ $value = $modelValue;
75
}
76
elseif (isset($parentValue)) {
77
+ $value = $parentValue;
78
}
79
elseif ($grandParentModel) {
80
+ $value = $grandParentModel->getData($key);
81
+ }
82
+
83
+ if(isset($value))
84
+ {
85
+ if(is_array($value))
86
+ $value = serialize($value);
87
+ $this->_configRoot->setNode($path, $value, true);
88
}
89
90
}
181
182
foreach ($groupDefault->fields as $elements) {
183
foreach ($elements as $e) {
184
+ // Check if the node already exists. If it does, do not append, default is lower in the hierarchy.
185
+ $name= $e->getName();
186
+ /** @var $e Mage_Core_Model_Config_Element */
187
+ /** @var $configElement Mage_Core_Model_Config_Element */
188
+ $configElement = $group->fields->$name;
189
+ if( empty($configElement)
190
+ || !$configElement->hasChildren())
191
+ $group->fields->appendChild($e);
192
}
193
}
194
app/code/community/Payone/Core/Block/Adminhtml/System/Config/Payment/Grid.php CHANGED
@@ -34,6 +34,7 @@ class Payone_Core_Block_Adminhtml_System_Config_Payment_Grid
34
extends Mage_Adminhtml_Block_Widget_Grid
35
{
36
37
/**
38
*
39
*/
34
extends Mage_Adminhtml_Block_Widget_Grid
35
{
36
37
+ protected $_defaultLimit = 200;
38
/**
39
*
40
*/
app/code/community/Payone/Core/Block/Payment/Method/Info/Abstract.php CHANGED
@@ -58,7 +58,8 @@ class Payone_Core_Block_Payment_Method_Info_Abstract
58
$quote = $paymentInfo->getQuote();
59
$config = $this->helperConfig()->getConfigPaymentMethodByQuote($quote);
60
}
61
- else {
62
throw new Payone_Core_Exception_PaymentMethodConfigNotFound();
63
}
64
$this->paymentConfig = $config;
58
$quote = $paymentInfo->getQuote();
59
$config = $this->helperConfig()->getConfigPaymentMethodByQuote($quote);
60
}
61
+ if(empty($config))
62
+ {
63
throw new Payone_Core_Exception_PaymentMethodConfigNotFound();
64
}
65
$this->paymentConfig = $config;
app/code/community/Payone/Core/Helper/Compatibility.php CHANGED
@@ -35,11 +35,20 @@ class Payone_Core_Helper_Compatibility
35
{
36
public function isEnabledDsdataNoState()
37
{
38
- $isActive = false;
39
40
- $dsdataNoStateModule = Mage::getConfig()->getModuleConfig('Dsdata_NoState');
41
- if ($dsdataNoStateModule instanceof Varien_Simplexml_Element) {
42
- $active = (string)$dsdataNoStateModule->active;
43
if ($active === 'true') {
44
$isActive = true;
45
}
35
{
36
public function isEnabledDsdataNoState()
37
{
38
+ return $this->isModuleActive('Dsdata_NoState');
39
+ }
40
41
+ public function isEnabledGoMageLightCheckout()
42
+ {
43
+ return $this->isModuleActive('GoMage_Checkout');
44
+ }
45
+
46
+ protected function isModuleActive($name)
47
+ {
48
+ $isActive = false;
49
+ $module = Mage::getConfig()->getModuleConfig($name);
50
+ if ($module instanceof Varien_Simplexml_Element) {
51
+ $active = (string)$module->active;
52
if ($active === 'true') {
53
$isActive = true;
54
}
app/code/community/Payone/Core/Helper/Data.php CHANGED
@@ -216,4 +216,16 @@ class Payone_Core_Helper_Data
216
return $hash;
217
}
218
219
}
216
return $hash;
217
}
218
219
+ /**
220
+ * Check if Mage-Compiler is enabled
221
+ * @return bool
222
+ */
223
+ public function isCompilerEnabled()
224
+ {
225
+ if(defined('COMPILER_INCLUDE_PATH'))
226
+ {
227
+ return true;
228
+ }
229
+ return false;
230
+ }
231
}
app/code/community/Payone/Core/Model/Config/Misc/TransactionstatusProcessing.php CHANGED
@@ -41,6 +41,9 @@ class Payone_Core_Model_Config_Misc_TransactionstatusProcessing
41
/** @var array */
42
protected $valid_ips = '';
43
44
public function init(array $data)
45
{
46
foreach ($data as $key => $value) {
@@ -101,4 +104,21 @@ class Payone_Core_Model_Config_Misc_TransactionstatusProcessing
101
{
102
return $this->valid_ips;
103
}
104
}
41
/** @var array */
42
protected $valid_ips = '';
43
44
+ /** @var int */
45
+ protected $proxy_mode = 0;
46
+
47
public function init(array $data)
48
{
49
foreach ($data as $key => $value) {
104
{
105
return $this->valid_ips;
106
}
107
+
108
+ /**
109
+ * @param int $proxy_mode
110
+ */
111
+ public function setProxyMode($proxy_mode)
112
+ {
113
+ $this->proxy_mode = $proxy_mode;
114
+ }
115
+
116
+ /**
117
+ * @return int
118
+ */
119
+ public function getProxyMode()
120
+ {
121
+ return $this->proxy_mode;
122
+ }
123
+
124
}
app/code/community/Payone/Core/Model/Config/Payment.php CHANGED
@@ -212,6 +212,9 @@ class Payone_Core_Model_Config_Payment extends Payone_Core_Model_Config_AreaAbst
212
return $methods;
213
}
214
215
public function getAllMethods()
216
{
217
return $this->methods;
212
return $methods;
213
}
214
215
+ /**
216
+ * @return array
217
+ */
218
public function getAllMethods()
219
{
220
return $this->methods;
app/code/community/Payone/Core/Model/Domain/Resource/Config/PaymentMethod/Collection.php CHANGED
@@ -115,37 +115,37 @@ class Payone_Core_Model_Domain_Resource_Config_PaymentMethod_Collection
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;
@@ -164,14 +164,14 @@ class Payone_Core_Model_Domain_Resource_Config_PaymentMethod_Collection
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;
@@ -179,7 +179,7 @@ class Payone_Core_Model_Domain_Resource_Config_PaymentMethod_Collection
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
@@ -200,18 +200,18 @@ class Payone_Core_Model_Domain_Resource_Config_PaymentMethod_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
115
*
116
* @return Payone_Core_Model_Domain_Resource_Config_PaymentMethod_Collection
117
*/
118
+ public function getCollectionByStoreId($id, $includeDeleted = false)
119
{
120
$store = Mage::app()->getStore($id);
121
$websiteId = $store->getWebsiteId();
122
123
$results = array();
124
+ $globalCollection = $this->getCollectionByScopeId(0, 'default', $includeDeleted);
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', $includeDeleted);
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();
136
137
$mergedConfig = $this->mergeConfigs($globalConfig, $websiteConfig);
138
139
140
$websiteConfigId = $websiteConfig->getId();
141
+ $storeConfigs = $this->getChildConfigs($websiteConfigId, $id, 'stores', $includeDeleted);
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();
149
$finalConfig = $this->mergeConfigs($mergedConfig, $storeConfig);
150
151
$results[$storeConfig->getId()] = $finalConfig;
164
*
165
* @return Payone_Core_Model_Domain_Resource_Config_PaymentMethod_Collection
166
*/
167
+ public function getCollectionByWebsiteId($id, $includeDeleted = false)
168
{
169
$results = array();
170
+ $globalCollection = $this->getCollectionByScopeId(0, 'default', $includeDeleted);
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', $includeDeleted);
175
if (count($websiteConfigs) < 1) {
176
// No website scope config found, use global level config
177
$results[$globalConfigId] = $globalConfig;
179
}
180
181
/** @var $websiteConfig Payone_Core_Model_Domain_Resource_Config_PaymentMethod */
182
+ $websiteConfig = $websiteConfigs->getFirstItem();
183
184
$mergedConfig = $this->mergeConfigs($globalConfig, $websiteConfig);
185
200
*
201
* @param int $scopeId
202
* @param string $scope ('default', 'websites', 'stores')
203
+ * @param bool $includeDeleted 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', $includeDeleted = 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 (!$includeDeleted) {
215
$collection->addFilterIsDeleted(0);
216
}
217
app/code/community/Payone/Core/Model/Factory.php CHANGED
@@ -1094,11 +1094,24 @@ class Payone_Core_Model_Factory
1094
1095
// Set Magento logger configuration:
1096
$this->config->setValue('api/default/protocol/loggers', $this->getConfigApiLogger());
1097
- $this->config->setValue('transaction_status/default/protocol/loggers/', $this->getConfigTransactionStatusLogger());
1098
}
1099
return $this->config;
1100
}
1101
1102
1103
/**
1104
* @return array
@@ -1131,6 +1144,16 @@ class Payone_Core_Model_Factory
1131
return $config;
1132
}
1133
1134
/**
1135
* @return Mage_Cron_Model_Schedule
1136
*/
1094
1095
// Set Magento logger configuration:
1096
$this->config->setValue('api/default/protocol/loggers', $this->getConfigApiLogger());
1097
+ $this->config->setValue('transaction_status/default/protocol/loggers', $this->getConfigTransactionStatusLogger());
1098
+ $this->config->setValue('transaction_status/validator/proxy/enabled', $this->getConfigProxyMode());
1099
+ if($this->helper()->isCompilerEnabled())
1100
+ {
1101
+ $this->config->setValue('api/default/mapper/currency/currency_properties', $this->getLibCurrencyProperties());
1102
+ }
1103
}
1104
return $this->config;
1105
}
1106
1107
+ /**
1108
+ * @return string
1109
+ */
1110
+ protected function getLibCurrencyProperties()
1111
+ {
1112
+ return Mage::getBaseDir('lib') . DIRECTORY_SEPARATOR . 'Payone' . DIRECTORY_SEPARATOR . 'Api' . DIRECTORY_SEPARATOR . 'Mapper' . DIRECTORY_SEPARATOR . 'currency.properties';
1113
+ }
1114
+
1115
1116
/**
1117
* @return array
1144
return $config;
1145
}
1146
1147
+ /**
1148
+ * @return int
1149
+ */
1150
+ protected function getConfigProxyMode()
1151
+ {
1152
+ $configMisc = $this->helperConfig()->getConfigMisc();
1153
+ $transactionStatusProcessing = $configMisc->getTransactionstatusProcessing();
1154
+ return $transactionStatusProcessing->getProxyMode();
1155
+ }
1156
+
1157
/**
1158
* @return Mage_Cron_Model_Schedule
1159
*/
app/code/community/Payone/Core/Model/Mapper/ApiRequest/Payment/Authorize/Abstract.php CHANGED
@@ -218,6 +218,10 @@ abstract class Payone_Core_Model_Mapper_ApiRequest_Payment_Authorize_Abstract
218
// Order items:
219
foreach ($order->getItemsCollection() as $key => $itemData) {
220
/** @var $itemData Mage_Sales_Model_Order_Item */
221
$params['id'] = $itemData->getSku();
222
$params['pr'] = $itemData->getPriceInclTax();
223
$params['no'] = $itemData->getQtyToInvoice();
@@ -235,11 +239,10 @@ abstract class Payone_Core_Model_Mapper_ApiRequest_Payment_Authorize_Abstract
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
218
// Order items:
219
foreach ($order->getItemsCollection() as $key => $itemData) {
220
/** @var $itemData Mage_Sales_Model_Order_Item */
221
+ if ($itemData->isDummy()) {
222
+ continue;// Do not map dummy items
223
+ }
224
+
225
$params['id'] = $itemData->getSku();
226
$params['pr'] = $itemData->getPriceInclTax();
227
$params['no'] = $itemData->getQtyToInvoice();
239
}
240
241
// Discounts:
242
+ $discountAmount = $order->getDiscountAmount(); // Discount Amount is negative on order.
243
+ if ($discountAmount > 0 || $discountAmount < 0) {
244
+ $invoicing->addItem($this->mapDiscountAsItem($discountAmount));
245
+ }
246
return $invoicing;
247
}
248
app/code/community/Payone/Core/Model/Mapper/ApiRequest/Payment/Capture.php CHANGED
@@ -93,10 +93,28 @@ class Payone_Core_Model_Mapper_ApiRequest_Payment_Capture
93
protected function mapBusinessParameters()
94
{
95
$business = new Payone_Api_Request_Parameter_Capture_Business();
96
- $business->setSettleaccount('auto');
97
$business->setBookingDate('');
98
$business->setDocumentDate('');
99
$business->setDueTime('');
100
return $business;
101
}
102
@@ -108,51 +126,78 @@ class Payone_Core_Model_Mapper_ApiRequest_Payment_Capture
108
$order = $this->getOrder();
109
$invoice = $this->getInvoice();
110
111
- $invoiceIncrementId = $invoice->getIncrementId();
112
- if ($invoiceIncrementId === null) {
113
- $invoiceIncrementId = $this->fetchNewIncrementId($invoice);
114
- }
115
116
- $appendix = $this->getInvoiceAppendix($invoice);
117
118
- $invoicing = new Payone_Api_Request_Parameter_Invoicing_Transaction();
119
- $invoicing->setInvoiceid($invoiceIncrementId);
120
- $invoicing->setInvoiceappendix($appendix);
121
-
122
- // Regular order items:
123
- foreach ($invoice->getItemsCollection() as $itemData) {
124
- /** @var $itemData Mage_Sales_Model_Order_Invoice_Item */
125
- $params['id'] = $itemData->getSku();
126
- $params['de'] = $itemData->getName();
127
- $params['no'] = number_format($itemData->getQty(), 0, '.', '');
128
- $params['pr'] = $itemData->getPriceInclTax();
129
-
130
- // We have to load the tax percentage from the order item
131
- /** @var $orderItem Mage_Sales_Model_Order_Item */
132
- $orderItem = $order->getItemById($itemData->getOrderItemId());
133
134
- $params['va'] = number_format($orderItem->getTaxPercent(), 0, '.', '');
135
136
- $item = new Payone_Api_Request_Parameter_Invoicing_Item();
137
- $item->init($params);
138
- $invoicing->addItem($item);
139
- }
140
141
- // Shipping / Fees:
142
- if ($invoice->getShippingInclTax() > 0) {
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
156
/**
157
* @return Mage_Sales_Model_Order_Invoice|null
158
*/
@@ -160,13 +205,7 @@ class Payone_Core_Model_Mapper_ApiRequest_Payment_Capture
160
{
161
if ($this->invoice === null) {
162
// we need to check registry because Magento won't give the invoice instance to PaymentMethodInstance
163
- $invoice = Mage::registry('current_invoice');
164
- if (is_null($invoice)) {
165
- // fallback to lastInvoice when invoice could not be fetched from Registry
166
- $order = $this->getOrder();
167
- $invoice = $order->getInvoiceCollection()->getLastItem();
168
- }
169
- $this->invoice = $invoice;
170
}
171
return $this->invoice;
172
}
@@ -179,4 +218,4 @@ class Payone_Core_Model_Mapper_ApiRequest_Payment_Capture
179
$this->invoice = $invoice;
180
}
181
182
- }
93
protected function mapBusinessParameters()
94
{
95
$business = new Payone_Api_Request_Parameter_Capture_Business();
96
$business->setBookingDate('');
97
$business->setDocumentDate('');
98
$business->setDueTime('');
99
+
100
+ $paymentMethod = $this->getPaymentMethod();
101
+
102
+ // Some payment methods can not use settleaccount auto:
103
+ if ($paymentMethod instanceof Payone_Core_Model_Payment_Method_AdvancePayment
104
+ or $paymentMethod instanceof Payone_Core_Model_Payment_Method_Invoice)
105
+ {
106
+ // Check if the invoice completes the order
107
+ if ($this->isInvoiceLast()) {
108
+ $business->setSettleaccount(Payone_Api_Enum_Settleaccount::AUTO);
109
+ }
110
+ else {
111
+ $business->setSettleaccount(Payone_Api_Enum_Settleaccount::NO);
112
+ }
113
+ }
114
+ else
115
+ {
116
+ $business->setSettleaccount(Payone_Api_Enum_Settleaccount::AUTO);
117
+ }
118
return $business;
119
}
120
126
$order = $this->getOrder();
127
$invoice = $this->getInvoice();
128
129
+ $invoicing = new Payone_Api_Request_Parameter_Invoicing_Transaction();
130
+ if (!empty($invoice) && $invoice->hasData()) {
131
132
+ $invoiceIncrementId = $invoice->getIncrementId();
133
+ if ($invoiceIncrementId === null) {
134
+ $invoiceIncrementId = $this->fetchNewIncrementId($invoice);
135
+ }
136
137
+ $appendix = $this->getInvoiceAppendix($invoice);
138
139
+ $invoicing->setInvoiceid($invoiceIncrementId);
140
+ $invoicing->setInvoiceappendix($appendix);
141
142
+ // Regular order items:
143
+ foreach ($invoice->getItemsCollection() as $itemData) {
144
+ /** @var $orderItem Mage_Sales_Model_Order_Item */
145
+ $orderItem = $order->getItemById($itemData->getOrderItemId());
146
147
+ if ($orderItem->isDummy()) {
148
+ continue;
149
+ } // Do not map dummy items.
150
+ /** @var $itemData Mage_Sales_Model_Order_Invoice_Item */
151
+ $params['id'] = $itemData->getSku();
152
+ $params['de'] = $itemData->getName();
153
+ $params['no'] = number_format($itemData->getQty(), 0, '.', '');
154
+ $params['pr'] = $itemData->getPriceInclTax();
155
156
+ // We have to load the tax percentage from the order item
157
+ $params['va'] = number_format($orderItem->getTaxPercent(), 0, '.', '');
158
+
159
+ $item = new Payone_Api_Request_Parameter_Invoicing_Item();
160
+ $item->init($params);
161
+ $invoicing->addItem($item);
162
+ }
163
+
164
+ // Shipping / Fees:
165
+ if ($invoice->getShippingInclTax() > 0) {
166
+ $invoicing->addItem($this->mapShippingFeeAsItem());
167
+ }
168
+
169
+ // Discounts:
170
+ $discountAmount = $invoice->getDiscountAmount(); // Discount Amount is positive on invoice.
171
+ if ($discountAmount > 0) {
172
+ $invoicing->addItem($this->mapDiscountAsItem(-1 * $discountAmount));
173
+ }
174
}
175
176
return $invoicing;
177
}
178
179
+ /**
180
+ * Check if this invoice will be the last one (not the case if any orderItems can still be invoiced)
181
+ * @note Can´t use $invoice->isLast() here, as the items have already been processed, $orderItem->qty_invoiced is already incremented, which means isLast() returns wrong results.
182
+ *
183
+ * @return bool
184
+ */
185
+ protected function isInvoiceLast()
186
+ {
187
+ foreach ($this->getOrder()->getAllItems() as $orderItem) {
188
+ /** @var $orderItem Mage_Sales_Model_Order_Item */
189
+ if ($orderItem->isDummy()) {
190
+ continue;
191
+ }
192
+
193
+ if ($orderItem->canInvoice()) {
194
+ return false;
195
+ }
196
+ }
197
+
198
+ return true;
199
+ }
200
+
201
/**
202
* @return Mage_Sales_Model_Order_Invoice|null
203
*/
205
{
206
if ($this->invoice === null) {
207
// we need to check registry because Magento won't give the invoice instance to PaymentMethodInstance
208
+ $this->invoice = Mage::registry('current_invoice');
209
}
210
return $this->invoice;
211
}
218
$this->invoice = $invoice;
219
}
220
221
+ }
app/code/community/Payone/Core/Model/Mapper/ApiRequest/Payment/Debit.php CHANGED
@@ -124,15 +124,21 @@ class Payone_Core_Model_Mapper_ApiRequest_Payment_Debit
124
// Regular order items:
125
foreach ($creditmemo->getItemsCollection() as $itemData) {
126
/** @var $itemData Mage_Sales_Model_Order_Creditmemo_Item */
127
$params['id'] = $itemData->getSku();
128
$params['de'] = $itemData->getName();
129
$params['no'] = number_format($itemData->getQty(), 0, '.', '');
130
$params['pr'] = $itemData->getPriceInclTax();
131
132
- // We have to load the tax percentage from the order item
133
- /** @var $orderItem Mage_Sales_Model_Order_Item */
134
- $orderItem = $order->getItemById($itemData->getOrderItemId());
135
136
$params['va'] = number_format($orderItem->getTaxPercent(), 0, '.', '');
137
138
$item = new Payone_Api_Request_Parameter_Invoicing_Item();
124
// Regular order items:
125
foreach ($creditmemo->getItemsCollection() as $itemData) {
126
/** @var $itemData Mage_Sales_Model_Order_Creditmemo_Item */
127
+ /** @var $orderItem Mage_Sales_Model_Order_Item */
128
+ $orderItem = $order->getItemById($itemData->getOrderItemId());
129
+
130
+ if($orderItem->isDummy())
131
+ {
132
+ continue; // Do not map dummy items.
133
+ }
134
+
135
$params['id'] = $itemData->getSku();
136
$params['de'] = $itemData->getName();
137
$params['no'] = number_format($itemData->getQty(), 0, '.', '');
138
$params['pr'] = $itemData->getPriceInclTax();
139
140
141
+ // We have to load the tax percentage from the order item
142
$params['va'] = number_format($orderItem->getTaxPercent(), 0, '.', '');
143
144
$item = new Payone_Api_Request_Parameter_Invoicing_Item();
app/code/community/Payone/Core/Model/Sales/Quote/Address.php CHANGED
@@ -67,10 +67,17 @@ class Payone_Core_Model_Sales_Quote_Address extends Mage_Sales_Model_Quote_Addre
67
if ($this->helperCompatibility()->isEnabledDsdataNoState()) {
68
// we need to instantiate without Mage::getModel, cause no model is defined for NoState
69
if (class_exists('Dsdata_NoState_Model_Quote_Address')) {
70
- $dsdataAddress = new Dsdata_NoState_Model_Quote_Address($this->getData());
71
- $errors = $dsdataAddress->validate();
72
}
73
}
74
else {
75
$errors = parent::validate();
76
}
67
if ($this->helperCompatibility()->isEnabledDsdataNoState()) {
68
// we need to instantiate without Mage::getModel, cause no model is defined for NoState
69
if (class_exists('Dsdata_NoState_Model_Quote_Address')) {
70
+ $address = new Dsdata_NoState_Model_Quote_Address($this->getData());
71
+ $errors = $address->validate();
72
}
73
}
74
+ elseif ($this->helperCompatibility()->isEnabledGoMageLightCheckout()) {
75
+ /**
76
+ * @var $address GoMage_Checkout_Model_Quote_Address
77
+ */
78
+ $address = Mage::getModel('gomage_checkout/quote_address', $this->getData());
79
+ $errors = $address->validate();
80
+ }
81
else {
82
$errors = parent::validate();
83
}
app/code/community/Payone/Core/Model/Service/InitializeConfig.php CHANGED
@@ -174,7 +174,7 @@ class Payone_Core_Model_Service_InitializeConfig
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
180
foreach ($methodConfigCollection as $methodConfig) {
174
175
/** @var $methodConfigCollection Payone_Core_Model_Domain_Resource_Config_PaymentMethod_Collection */
176
$methodConfigCollection = $this->getFactory()->getModelDomainConfigPaymentMethod()->getCollection();
177
+ $methodConfigCollection->getCollectionByStoreId($this->getStoreId(), true);
178
$methodConfigCollection->addSortOrder();
179
180
foreach ($methodConfigCollection as $methodConfig) {
app/code/community/Payone/Core/Model/Service/Sales/OrderStatus.php CHANGED
@@ -56,7 +56,8 @@ class Payone_Core_Model_Service_Sales_OrderStatus extends Payone_Core_Model_Serv
56
57
$mapping = $statusMapping->getByType($type);
58
59
- if (!array_key_exists($txAction, $mapping)) {
60
return;
61
}
62
56
57
$mapping = $statusMapping->getByType($type);
58
59
+ if (!is_array($mapping)
60
+ or !array_key_exists($txAction, $mapping)) {
61
return;
62
}
63
app/code/community/Payone/Core/controllers/TransactionStatusController.php CHANGED
@@ -78,11 +78,24 @@ class Payone_Core_TransactionStatusController extends Payone_Core_Controller_Abs
78
// Send Confirmation Message
79
$this->getResponse()->setBody($response->getStatus());
80
}
81
- catch (Exception $e) {
82
- $msg = $e->getMessage();
83
$type = get_class($e);
84
85
- Mage::throwException($type . ' : ' . $msg);
86
}
87
}
88
78
// Send Confirmation Message
79
$this->getResponse()->setBody($response->getStatus());
80
}
81
+ catch( Payone_TransactionStatus_Exception_Validation $e)
82
+ {
83
+ // Throw generic error.
84
$type = get_class($e);
85
+ $message = 'ERROR='.$type;
86
87
+ $this->getResponse()->setBody($message);
88
+ }
89
+ catch (Exception $e)
90
+ {
91
+ $type = get_class($e);
92
+
93
+ $message = 'ERROR='.$type.'|MESSAGE='.$e->getMessage();
94
+
95
+ // Send Confirmation Message
96
+ $this->getResponse()->setBody($message);
97
+
98
+ Mage::logException($e);
99
}
100
}
101
app/code/community/Payone/Core/etc/config.xml CHANGED
@@ -24,7 +24,7 @@
24
<config>
25
<modules>
26
<Payone_Core>
27
- <version>3.0.11</version>
28
</Payone_Core>
29
</modules>
30
@@ -503,6 +503,7 @@ Detaillierte Informationen zur Arbeitsweise der ABC finde ich unter www.abc.de/f
503
<valid_ips><![CDATA[213.178.72.196
504
213.178.72.197
505
217.70.200.*]]></valid_ips>
506
</transactionstatus_processing>
507
<email_exception>
508
<enabled>0</enabled>
24
<config>
25
<modules>
26
<Payone_Core>
27
+ <version>3.0.12</version>
28
</Payone_Core>
29
</modules>
30
503
<valid_ips><![CDATA[213.178.72.196
504
213.178.72.197
505
217.70.200.*]]></valid_ips>
506
+ <proxy_mode>0</proxy_mode>
507
</transactionstatus_processing>
508
<email_exception>
509
<enabled>0</enabled>
app/code/community/Payone/Core/etc/system.xml CHANGED
@@ -938,9 +938,14 @@
938
<show_in_website>1</show_in_website>
939
<show_in_store>1</show_in_store>
940
</agreement_enabled>
941
- <agreement_message translate="label">
942
<label>Agreement message</label>
943
<frontend_type>textarea</frontend_type>
944
<sort_order>36</sort_order>
945
<depends>
946
<agreement_enabled>1</agreement_enabled>
@@ -1114,6 +1119,16 @@
1114
<show_in_website>1</show_in_website>
1115
<show_in_store>1</show_in_store>
1116
</valid_ips>
1117
</fields>
1118
</transactionstatus_processing>
1119
<transactionstatus_forwarding>
938
<show_in_website>1</show_in_website>
939
<show_in_store>1</show_in_store>
940
</agreement_enabled>
941
+ <agreement_message translate="label,comment">
942
<label>Agreement message</label>
943
+ <comment>A template for the agreement message can be found under "?"</comment>
944
<frontend_type>textarea</frontend_type>
945
+ <frontend_model>payone_core/adminhtml_system_config_form_field</frontend_model>
946
+ <hint>
947
+ <template>payone/core/system/config/tooltip/protect/creditrating_agreement_message.phtml</template>
948
+ </hint>
949
<sort_order>36</sort_order>
950
<depends>
951
<agreement_enabled>1</agreement_enabled>
1119
<show_in_website>1</show_in_website>
1120
<show_in_store>1</show_in_store>
1121
</valid_ips>
1122
+ <proxy_mode>
1123
+ <label>Proxy-Mode</label>
1124
+ <comment>If your shop is behind a Proxy. Enable this option to validate the HTTP_X_FORWARDED_FOR</comment>
1125
+ <frontend_type>select</frontend_type>
1126
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1127
+ <sort_order>30</sort_order>
1128
+ <show_in_default>1</show_in_default>
1129
+ <show_in_website>1</show_in_website>
1130
+ <show_in_store>1</show_in_store>
1131
+ </proxy_mode>
1132
</fields>
1133
</transactionstatus_processing>
1134
<transactionstatus_forwarding>
app/code/community/Payone/Migrator/Model/Service/Configuration/PaymentMigrate.php CHANGED
@@ -45,7 +45,7 @@ class Payone_Migrator_Model_Service_Configuration_PaymentMigrate extends Payone_
45
46
// Create array of configs to migrate
47
$orderPayments = $this->getOrderPayments();
48
- if($orderPayments == null){
49
return true;
50
}
51
$paymentConfigs = $this->preparePaymentConfigsToMigrate($orderPayments->getItems());
@@ -128,28 +128,31 @@ class Payone_Migrator_Model_Service_Configuration_PaymentMigrate extends Payone_
128
$methodStoreToConfig = array();
129
foreach ($paymentConfigs as $methodCode => $paymentConfigForStore) {
130
$globalConfig = $this->paymentCreateGlobalConfiguration($methodCode);
131
- $globalId = $globalConfig->getId();
132
133
// Create Store Configs
134
foreach ($paymentConfigForStore as $storeId => $paymentConfig) {
135
// Create NEW Website Configuration if needed
136
$websiteConfig = $this->createPaymentConfiguration(
137
- $methodCode, array('parent_default_id' => $globalId), 'websites', $storeId
138
);
139
140
- $websiteId = $websiteConfig->getId();
141
142
// Create NEW Store Configuration
143
- $paymentConfig['parent_websites_id'] = $websiteId;
144
$storeConfig = $this->createPaymentConfiguration(
145
$methodCode, $paymentConfig, 'stores', $storeId
146
);
147
- $configId = $storeConfig->getId();
148
149
if (!array_key_exists($methodCode, $methodStoreToConfig)) {
150
$methodStoreToConfig[$methodCode] = array();
151
}
152
- $methodStoreToConfig[$methodCode][$storeId] = $configId;
153
}
154
}
155
return $methodStoreToConfig;
45
46
// Create array of configs to migrate
47
$orderPayments = $this->getOrderPayments();
48
+ if ($orderPayments == null) {
49
return true;
50
}
51
$paymentConfigs = $this->preparePaymentConfigsToMigrate($orderPayments->getItems());
128
$methodStoreToConfig = array();
129
foreach ($paymentConfigs as $methodCode => $paymentConfigForStore) {
130
$globalConfig = $this->paymentCreateGlobalConfiguration($methodCode);
131
+ $globalConfigId = $globalConfig->getId();
132
133
// Create Store Configs
134
foreach ($paymentConfigForStore as $storeId => $paymentConfig) {
135
+ $store = Mage::app()->getStore($storeId);
136
+ $websiteId = $store->getWebsiteId();
137
+
138
// Create NEW Website Configuration if needed
139
$websiteConfig = $this->createPaymentConfiguration(
140
+ $methodCode, array('parent_default_id' => $globalConfigId), 'websites', $websiteId
141
);
142
143
+ $websiteConfigId = $websiteConfig->getId();
144
145
// Create NEW Store Configuration
146
+ $paymentConfig['parent_websites_id'] = $websiteConfigId;
147
$storeConfig = $this->createPaymentConfiguration(
148
$methodCode, $paymentConfig, 'stores', $storeId
149
);
150
+ $storeConfigId = $storeConfig->getId();
151
152
if (!array_key_exists($methodCode, $methodStoreToConfig)) {
153
$methodStoreToConfig[$methodCode] = array();
154
}
155
+ $methodStoreToConfig[$methodCode][$storeId] = $storeConfigId;
156
}
157
}
158
return $methodStoreToConfig;
app/code/community/Payone/Migrator/etc/config.xml CHANGED
@@ -24,7 +24,7 @@
24
<config>
25
<modules>
26
<Payone_Migrator>
27
- <version>3.0.10</version>
28
</Payone_Migrator>
29
</modules>
30
24
<config>
25
<modules>
26
<Payone_Migrator>
27
+ <version>3.0.12</version>
28
</Payone_Migrator>
29
</modules>
30
app/design/adminhtml/default/default/template/payone/core/system/config/tooltip/protect/creditrating_agreement_message.phtml ADDED
@@ -0,0 +1,29 @@
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
+ ?>
24
+ <p>Bitte nutzen sie für die Frage zur Zustimmung zur Bonität diese Vorlage. Bitte ersetzen sie die farblich gekennzeichneten Teile durch Ihre Daten:</p>
25
+
26
+ <div class="payone-config-panel">Ich willige ein, dass von <span class="payone-config-text-emphasis">XY-Shop</span> zum Zweck der eigenen Kreditprüfung ggf. Bonitätsinformationen auf der Basis mathematisch-statistischer Verfahren von der <span class="payone-config-text-emphasis">Firma ABC, Musterstr. 1, 11111 Musterhausen</span> abgerufen und während der Dauer der Kundenbeziehung Adress- und ggf. Negativdaten an die ABC übermittelt werden, die bei berechtigtem Interesse Dritten für Kreditprüfungszwecke Bonitätsinformationen auf Basis mathematisch-statistischer Verfahren zur Verfügung stellt.<br>
27
+ Detaillierte Informationen zur Arbeitsweise der <span class="payone-config-text-emphasis">ABC</span> finde ich unter <span class="payone-config-text-emphasis">www.abc.de/fghi….</span></div>
28
+
29
+ <p>Falls sie Detailfragen haben kontaktieren sie gerne unseren Technical - Support unter tech.support@payone.de oder unter der Telefonnummer: 0431/25968-500.</p>
app/design/frontend/base/default/template/payone/core/checkout/onepage/payment/additional.phtml CHANGED
@@ -40,7 +40,7 @@ if ($this->canShowPaymentHintText()) :?>
40
<li>
41
<p class="payone-agreement">
42
<input type="checkbox" id="payone_creditrating_agreement" name="payment[payone_creditrating_agreement]"
43
- value="1" title="<?php echo $this->getAgreementMessage(); ?>" class="checkbox" checked="checked"/>
44
<label for="payone_creditrating_agreement"><?php echo $this->getAgreementMessage(); ?></label>
45
</p>
46
</li>
40
<li>
41
<p class="payone-agreement">
42
<input type="checkbox" id="payone_creditrating_agreement" name="payment[payone_creditrating_agreement]"
43
+ value="1" title="<?php echo $this->getAgreementMessage(); ?>" class="checkbox" />
44
<label for="payone_creditrating_agreement"><?php echo $this->getAgreementMessage(); ?></label>
45
</p>
46
</li>
app/locale/de_DE/Payone_Core.csv CHANGED
@@ -110,6 +110,7 @@
110
"Payment hint text","Hinweistext"
111
"Agreement enabled","Zustimmung durch Kunden"
112
"Agreement message","Text der Zustimmungsabfrage"
113
"Integration Event","Zeitpunkt der Prüfung"
114
"Before Payment Selection","Vor Auswahl der Zahlart"
115
"After Payment Selection","Nach Auswahl der Zahlart"
@@ -144,6 +145,8 @@
144
"Transaction-Status Forwarding","Weiterleitung des Transaktionsstatus"
145
"Valid PAYONE IPs","Gültige PAYONE IPs"
146
"Enter valid PAYONE IPs (Format xxx.xxx.xxx.xxx). As a Wildcard You can use * ","Tragen Sie hier gültige PAYONE IPs ein (Format xxx.xxx.xxx.xxx). Als Wildcard können Sie * verwenden"
147
"Forwarding","Weiterleitung"
148
"Add Forwarding","Füge Weiterleitung hinzu"
149
"Shipping Costs","Versandkosten"
110
"Payment hint text","Hinweistext"
111
"Agreement enabled","Zustimmung durch Kunden"
112
"Agreement message","Text der Zustimmungsabfrage"
113
+ "A template for the agreement message can be found under ""?""","Eine Vorlage für den Text zur Zustimmung finden sie unter ""?"""
114
"Integration Event","Zeitpunkt der Prüfung"
115
"Before Payment Selection","Vor Auswahl der Zahlart"
116
"After Payment Selection","Nach Auswahl der Zahlart"
145
"Transaction-Status Forwarding","Weiterleitung des Transaktionsstatus"
146
"Valid PAYONE IPs","Gültige PAYONE IPs"
147
"Enter valid PAYONE IPs (Format xxx.xxx.xxx.xxx). As a Wildcard You can use * ","Tragen Sie hier gültige PAYONE IPs ein (Format xxx.xxx.xxx.xxx). Als Wildcard können Sie * verwenden"
148
+ "Proxy-Mode","Proxy-Modus"
149
+ "If your shop is behind a Proxy. Enable this option to validate the HTTP_X_FORWARDED_FOR","Aktivieren Sie diese Option für eine IP-Validierung mit HTTP_X_FORWARDED_FOR. Dies ist nur notwendig, wenn Ihr Shop hinter einen Proxy-Server läuft."
150
"Forwarding","Weiterleitung"
151
"Add Forwarding","Füge Weiterleitung hinzu"
152
"Shipping Costs","Versandkosten"
js/payone/core/addresscheck.js CHANGED
@@ -29,19 +29,15 @@ Event.observe(window, 'load', function () {
29
* Place a wrapper for the nextStep function on Magento´s Billing and Shipping objects, to allow additional output on addresscheck failure
30
*/
31
function wrapAddressNextStepEvents() {
32
- billing.nextStep = billing.nextStep.wrap(
33
- function (origSaveMethod, transport) {
34
- nextStepWithAddresscheckOutput(origSaveMethod, transport, 'billing');
35
- }
36
- );
37
- shipping.nextStep = shipping.nextStep.wrap(
38
- function (origSaveMethod, transport) {
39
- nextStepWithAddresscheckOutput(origSaveMethod, transport, 'shipping');
40
- }
41
- );
42
}
43
44
- function nextStepWithAddresscheckOutput(origSaveMethod, transport, address_type) {
45
46
if (transport && transport.responseText) {
47
response = JSON.parse(transport.responseText);
29
* Place a wrapper for the nextStep function on Magento´s Billing and Shipping objects, to allow additional output on addresscheck failure
30
*/
31
function wrapAddressNextStepEvents() {
32
+ billing.onSave = nextStepWithAddresscheckOutput.bindAsEventListener(billing.nextStep, 'billing', billing.nextStep);
33
+
34
+ if (typeof shipping != "undefined") // no shipping inputs for virtual orders.
35
+ {
36
+ shipping.onSave = nextStepWithAddresscheckOutput.bindAsEventListener(shipping.nextStep, 'shipping', shipping.nextStep);
37
+ }
38
}
39
40
+ function nextStepWithAddresscheckOutput(transport, address_type, origSaveMethod) {
41
42
if (transport && transport.responseText) {
43
response = JSON.parse(transport.responseText);
lib/Payone/Api/Config.php CHANGED
@@ -28,7 +28,39 @@
28
* @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
29
* @link http://www.noovias.com
30
*/
31
- class Payone_Api_Config
32
{
33
34
}
28
* @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
29
* @link http://www.noovias.com
30
*/
31
+ class Payone_Api_Config extends Payone_Config_Abstract
32
{
33
+ /**
34
+ * @return array
35
+ */
36
+ public function getDefaultConfigData()
37
+ {
38
+ $defaultConfig = array(
39
+ 'default' => array(
40
+ 'validator' => 'Payone_Api_Validator_DefaultParameters',
41
+ 'protocol' => array(
42
+ 'filter' => array(
43
+ 'mask_value' => array(
44
+ 'enabled' => 1,
45
+ 'percent' => 100
46
+ )
47
+ ),
48
+ 'loggers' => array(
49
+ 'Payone_Protocol_Logger_Log4php' => array(
50
+ 'filename' => 'payone_api.log',
51
+ 'max_file_size' => '1MB',
52
+ 'max_file_count' => 20
53
+ )
54
+ ),
55
+ ),
56
+ 'mapper' => array(
57
+ 'currency' => array(
58
+ 'currency_properties' => 'currency.properties'
59
+ )
60
+ )
61
+ )
62
+ );
63
+ return $defaultConfig;
64
+ }
65
66
}
lib/Payone/Api/Factory.php CHANGED
@@ -33,6 +33,15 @@ class Payone_Api_Factory
33
/** @var Payone_Api_Config */
34
protected $config = null;
35
36
/**
37
* @return Payone_Api_Adapter_Interface
38
*/
@@ -80,9 +89,19 @@ class Payone_Api_Factory
80
public function buildMapperCurrency()
81
{
82
$mapper = new Payone_Api_Mapper_Currency();
83
return $mapper;
84
}
85
86
/**
87
* @return Payone_Api_Mapper_Request_Payment_Preauthorization
88
*/
@@ -401,4 +420,20 @@ class Payone_Api_Factory
401
402
return $validator;
403
}
404
}
33
/** @var Payone_Api_Config */
34
protected $config = null;
35
36
+ /**
37
+ * @constructor
38
+ * @param Payone_Api_Config $config
39
+ */
40
+ public function __construct(Payone_Api_Config $config = null)
41
+ {
42
+ $this->config = $config;
43
+ }
44
+
45
/**
46
* @return Payone_Api_Adapter_Interface
47
*/
89
public function buildMapperCurrency()
90
{
91
$mapper = new Payone_Api_Mapper_Currency();
92
+ $mapper->setPathToProperties($this->getCurrencyPropertiesPath());
93
return $mapper;
94
}
95
96
+ /**
97
+ * Returns Path to currency.properties file
98
+ * @return string
99
+ */
100
+ protected function getCurrencyPropertiesPath()
101
+ {
102
+ return $this->getConfig()->getValue('default/mapper/currency/currency_properties');
103
+ }
104
+
105
/**
106
* @return Payone_Api_Mapper_Request_Payment_Preauthorization
107
*/
420
421
return $validator;
422
}
423
+
424
+ /**
425
+ * @param Payone_Api_Config $config
426
+ */
427
+ public function setConfig($config)
428
+ {
429
+ $this->config = $config;
430
+ }
431
+
432
+ /**
433
+ * @return Payone_Api_Config
434
+ */
435
+ public function getConfig()
436
+ {
437
+ return $this->config;
438
+ }
439
}
lib/Payone/Builder.php CHANGED
@@ -52,11 +52,11 @@ class Payone_Builder
52
}
53
$this->config = $config;
54
55
- $this->factories[self::KEY_API] = new Payone_Api_Factory();
56
$this->factories[self::KEY_CLIENTAPI] = new Payone_ClientApi_Factory();
57
$this->factories[self::KEY_PROTOCOL] = new Payone_Protocol_Factory();
58
$this->factories[self::KEY_SETTINGS] = new Payone_Settings_Factory();
59
- $this->factories[self::KEY_TRANSACTIONSTATUS] = new Payone_TransactionStatus_Factory();
60
61
}
62
@@ -211,6 +211,7 @@ class Payone_Builder
211
{
212
/** @var $validator Payone_TransactionStatus_Validator_Ip */
213
$validator->setValidIps($validIps);
214
}
215
}
216
52
}
53
$this->config = $config;
54
55
+ $this->factories[self::KEY_API] = new Payone_Api_Factory($config->getApiConfig());
56
$this->factories[self::KEY_CLIENTAPI] = new Payone_ClientApi_Factory();
57
$this->factories[self::KEY_PROTOCOL] = new Payone_Protocol_Factory();
58
$this->factories[self::KEY_SETTINGS] = new Payone_Settings_Factory();
59
+ $this->factories[self::KEY_TRANSACTIONSTATUS] = new Payone_TransactionStatus_Factory($config->getTransactionStatusConfig());
60
61
}
62
211
{
212
/** @var $validator Payone_TransactionStatus_Validator_Ip */
213
$validator->setValidIps($validIps);
214
+ $validator->setConfig($this->getConfig()->getTransactionStatusConfig());
215
}
216
}
217
lib/Payone/Config.php CHANGED
@@ -74,6 +74,12 @@ class Payone_Config
74
/** @var array */
75
protected $config = array();
76
77
/**
78
* @constructor
79
*
@@ -82,9 +88,21 @@ class Payone_Config
82
public function __construct(array $data = array())
83
{
84
if (empty($data)) {
85
$this->config = $this->getDefaultConfigData();
86
}
87
else {
88
$this->config = $data;
89
}
90
}
@@ -114,49 +132,8 @@ class Payone_Config
114
protected function getDefaultConfigData()
115
{
116
$configData = array(
117
- 'api' => array(
118
- 'default' => array(
119
- 'validator' => 'Payone_Api_Validator_DefaultParameters',
120
- 'protocol' => array(
121
- 'filter' => array(
122
- 'mask_value' => array(
123
- 'enabled' => 1,
124
- 'percent' => 100
125
- )
126
- ),
127
- 'loggers' => array(
128
- 'Payone_Protocol_Logger_Log4php' => array(
129
- 'filename' => 'payone_api.log',
130
- 'max_file_size' => '1MB',
131
- 'max_file_count' => 20
132
- )
133
- ),
134
- ),
135
- )
136
- ),
137
- 'transaction_status' => array(
138
- 'default' => array(
139
- 'validators' => array(
140
- 'Payone_TransactionStatus_Validator_Ip',
141
- 'Payone_TransactionStatus_Validator_DefaultParameters',
142
- ),
143
- 'protocol' => array(
144
- 'filter' => array(
145
- 'mask_value' => array(
146
- 'enabled' => 1,
147
- 'percent' => 100
148
- )
149
- ),
150
- 'loggers' => array(
151
- 'Payone_Protocol_Logger_Log4php' => array(
152
- 'filename' => 'payone_transactionstatus.log',
153
- 'max_file_size' => '1MB',
154
- 'max_file_count' => 20
155
- )
156
- ),
157
- ),
158
- )
159
- )
160
);
161
162
return $configData;
@@ -177,16 +154,12 @@ class Payone_Config
177
// Disassemble key, extracting the first node of the string:
178
$explodedKey = explode(self::KEY_SEPARATOR, $key);
179
$currentKey = array_shift($explodedKey);
180
181
- // Reassemble shortened key:
182
- $newKey = implode(self::KEY_SEPARATOR, $explodedKey);
183
- if (FALSE === array_key_exists($currentKey, $tree)) {
184
- // Create new array index:
185
- $tree[$currentKey] = array();
186
- }
187
- // Start recursion:
188
- return $this->set($newKey, $value, $tree[$currentKey]);
189
-
190
}
191
else {
192
// Set value (can overwrite an existing value)
@@ -196,7 +169,6 @@ class Payone_Config
196
}
197
}
198
199
-
200
/**
201
* Recursively read from a nested array with a key/path
202
* If a non-existant key is given, NULL will be returned.
@@ -218,19 +190,11 @@ class Payone_Config
218
// Disassemble key, extracting the first node of the string:
219
$explodedKey = explode(self::KEY_SEPARATOR, $key);
220
$currentKey = array_shift($explodedKey);
221
222
- if (array_key_exists($currentKey, $tree)) {
223
- // Get the node from the tree:
224
- $newTree = $tree[$currentKey];
225
-
226
- // Reassemble key, start recursion:
227
- $newKey = implode(self::KEY_SEPARATOR, $explodedKey);
228
- return $this->get($newKey, $newTree);
229
- }
230
- else {
231
- return NULL; // Exit recursion, unsuccessful
232
- }
233
-
234
}
235
elseif (is_array($tree) and array_key_exists($key, $tree)) {
236
return $tree[$key]; // Exit recursion, Success!
@@ -239,4 +203,37 @@ class Payone_Config
239
return NULL; // Exit recursion, unsuccessful
240
}
241
}
242
}
74
/** @var array */
75
protected $config = array();
76
77
+ /** @var Payone_Api_Config */
78
+ protected $apiConfig = null;
79
+
80
+ /** @var Payone_TransactionStatus_Config */
81
+ protected $transactionStatusConfig = null;
82
+
83
/**
84
* @constructor
85
*
88
public function __construct(array $data = array())
89
{
90
if (empty($data)) {
91
+ if($this->getApiConfig() === null)
92
+ {
93
+ $this->apiConfig = new Payone_Api_Config();
94
+ }
95
+ if($this->getTransactionStatusConfig() === null)
96
+ {
97
+ $this->transactionStatusConfig = new Payone_TransactionStatus_Config();
98
+ }
99
$this->config = $this->getDefaultConfigData();
100
}
101
else {
102
+ if(array_key_exists('api', $data))
103
+ $this->setApiConfig($data['api']);
104
+ if(array_key_exists('transaction_status',$data))
105
+ $this->setTransactionStatusConfig($data['transaction_status']);
106
$this->config = $data;
107
}
108
}
132
protected function getDefaultConfigData()
133
{
134
$configData = array(
135
+ 'api' => $this->getApiConfig(),
136
+ 'transaction_status' => $this->getTransactionStatusConfig()
137
);
138
139
return $configData;
154
// Disassemble key, extracting the first node of the string:
155
$explodedKey = explode(self::KEY_SEPARATOR, $key);
156
$currentKey = array_shift($explodedKey);
157
+ $newKey = implode(self::KEY_SEPARATOR,$explodedKey);
158
159
+ /** @var $object Payone_Config_Abstract */
160
+ $object = $tree[$currentKey];
161
+ $object->setValue($newKey,$value);
162
+ return TRUE;
163
}
164
else {
165
// Set value (can overwrite an existing value)
169
}
170
}
171
172
/**
173
* Recursively read from a nested array with a key/path
174
* If a non-existant key is given, NULL will be returned.
190
// Disassemble key, extracting the first node of the string:
191
$explodedKey = explode(self::KEY_SEPARATOR, $key);
192
$currentKey = array_shift($explodedKey);
193
+ $newKey = implode(self::KEY_SEPARATOR,$explodedKey);
194
195
+ /** @var $object Payone_Config_Abstract */
196
+ $object = $tree[$currentKey];
197
+ return $object->getValue($newKey);
198
}
199
elseif (is_array($tree) and array_key_exists($key, $tree)) {
200
return $tree[$key]; // Exit recursion, Success!
203
return NULL; // Exit recursion, unsuccessful
204
}
205
}
206
+
207
+ /**
208
+ * @param Payone_Api_Config $apiConfig
209
+ */
210
+ public function setApiConfig($apiConfig)
211
+ {
212
+ $this->apiConfig = $apiConfig;
213
+ }
214
+
215
+ /**
216
+ * @return Payone_Api_Config
217
+ */
218
+ public function getApiConfig()
219
+ {
220
+ return $this->apiConfig;
221
+ }
222
+
223
+ /**
224
+ * @param Payone_TransactionStatus_Config $transactionStatusConfig
225
+ */
226
+ public function setTransactionStatusConfig($transactionStatusConfig)
227
+ {
228
+ $this->transactionStatusConfig = $transactionStatusConfig;
229
+ }
230
+
231
+ /**
232
+ * @return Payone_TransactionStatus_Config
233
+ */
234
+ public function getTransactionStatusConfig()
235
+ {
236
+ return $this->transactionStatusConfig;
237
+ }
238
+
239
}
lib/Payone/Config/Abstract.php ADDED
@@ -0,0 +1,207 @@
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 to newer
12
+ * versions in the future. If you wish to customize Payone for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone
17
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
18
+ * @author Matthias Walter <info@noovias.com>
19
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
20
+ * @link http://www.noovias.com
21
+ */
22
+
23
+ /**
24
+ * Configuration for Payone SDK
25
+ *
26
+ * <b>Example: Replacing the default logging mechanism for Payone Api</b>
27
+ * <pre class="prettyprint">
28
+ * $config = new Payone_Config();
29
+ *
30
+ * // Array with classname of logger to use as key, options array as value:
31
+ * $myLoggers = array(
32
+ * 'Payone_Protocol_Logger_Log4php' => array(
33
+ * 'filename' => 'my_path/my_logfile.log',
34
+ * 'max_file_size' => '50MB',
35
+ * 'max_file_count' => 10));
36
+ *
37
+ * $config->setValue('api/default/protocol/loggers/', $myLoggers);
38
+ * </pre>
39
+ *
40
+ * <b>Example: Adding an additional logger for Payone TransactionStatus</b>
41
+ * <pre class="prettyprint">
42
+ * $config = new Payone_Config();
43
+ *
44
+ * // options array:
45
+ * $myLogger = array(
46
+ * 'filename' => 'my_path/my_logfile.log',
47
+ * 'max_file_size' => '50MB',
48
+ * 'max_file_count' => 10));
49
+ *
50
+ *
51
+ * $config->setValue('transaction_status/default/protocol/loggers/My_Logger_Class', $myLogger); *
52
+ * </pre>
53
+ *
54
+ *
55
+ * <b>Example: Changing the target log file for all logging activities</b>
56
+ * <pre class="prettyprint">
57
+ *
58
+ * // Initiate default config:
59
+ * $config = new Payone_Config();
60
+ *
61
+ * // Change the log file only:
62
+ * $config->setValue('api/default/protocol/loggers/Payone_Protocol_Logger_Log4php/filename', 'my_file.log'); *
63
+ * </pre>
64
+ *
65
+ * @category Payone
66
+ * @package Payone
67
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
68
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
69
+ * @link http://www.noovias.com
70
+ */
71
+ abstract class Payone_Config_Abstract
72
+ {
73
+ const KEY_SEPARATOR = '/';
74
+ /** @var array */
75
+ protected $config = array();
76
+
77
+ abstract protected function getDefaultConfigData();
78
+
79
+ /**
80
+ * @constructor
81
+ *
82
+ * @param array $data
83
+ */
84
+ public function __construct(array $data = array())
85
+ {
86
+ if (empty($data)) {
87
+ $this->config = $this->getDefaultConfigData();
88
+ }
89
+ else {
90
+ $this->config = $data;
91
+ }
92
+ }
93
+
94
+ /**
95
+ * Retrieve a value from the config
96
+ * @param string $key Config key in the form 'node/node/node'
97
+ * @return mixed
98
+ */
99
+ public function getValue($key)
100
+ {
101
+ return $this->get($key, $this->config);
102
+ }
103
+
104
+ /**
105
+ * @param string $key Config key in the form 'node/node/node'
106
+ * @param mixed $value Config to set
107
+ */
108
+ public function setValue($key, $value)
109
+ {
110
+ $this->set($key, $value, $this->config);
111
+ }
112
+
113
+ /**
114
+ * @param string $key Key in the form 'something/something'
115
+ * @param mixed $value The value to set, can be any type
116
+ * @param array $tree
117
+ *
118
+ * @return bool TRUE on Success
119
+ */
120
+ protected function set($key, $value, array &$tree)
121
+ {
122
+ if (strpos($key, self::KEY_SEPARATOR) !== FALSE
123
+ // and is_array($tree)
124
+ ) {
125
+ // Disassemble key, extracting the first node of the string:
126
+ $explodedKey = explode(self::KEY_SEPARATOR, $key);
127
+ $currentKey = array_shift($explodedKey);
128
+
129
+ // Reassemble shortened key:
130
+ $newKey = implode(self::KEY_SEPARATOR, $explodedKey);
131
+ if (FALSE === array_key_exists($currentKey, $tree)) {
132
+ // Create new array index:
133
+ $tree[$currentKey] = array();
134
+ }
135
+ // Start recursion:
136
+ return $this->set($newKey, $value, $tree[$currentKey]);
137
+
138
+ }
139
+ else {
140
+ // Set value (can overwrite an existing value)
141
+ $tree[$key] = $value;
142
+ // Exit recursion, Success!
143
+ return TRUE;
144
+ }
145
+ }
146
+
147
+
148
+ /**
149
+ * Recursively read from a nested array with a key/path
150
+ * If a non-existant key is given, NULL will be returned.
151
+ * Retrieving sub-trees is possible as well.
152
+ *
153
+ * Example:
154
+ * get('root/node/node', array($root => array($node => array($node => 'value'))))
155
+ * will return 'value'
156
+ *
157
+ * @recursive
158
+ *
159
+ * @param $key
160
+ * @param array|mixed$tree An array, or, if recursively called, a leaf of the treef
161
+ * @return mixed
162
+ */
163
+ protected function get($key, $tree)
164
+ {
165
+ if (strpos($key, self::KEY_SEPARATOR) !== FALSE and is_array($tree)) {
166
+ // Disassemble key, extracting the first node of the string:
167
+ $explodedKey = explode(self::KEY_SEPARATOR, $key);
168
+ $currentKey = array_shift($explodedKey);
169
+
170
+ if (array_key_exists($currentKey, $tree)) {
171
+ // Get the node from the tree:
172
+ $newTree = $tree[$currentKey];
173
+
174
+ // Reassemble key, start recursion:
175
+ $newKey = implode(self::KEY_SEPARATOR, $explodedKey);
176
+ return $this->get($newKey, $newTree);
177
+ }
178
+ else {
179
+ return NULL; // Exit recursion, unsuccessful
180
+ }
181
+
182
+ }
183
+ elseif (is_array($tree) and array_key_exists($key, $tree)) {
184
+ return $tree[$key]; // Exit recursion, Success!
185
+ }
186
+ else {
187
+ return NULL; // Exit recursion, unsuccessful
188
+ }
189
+ }
190
+
191
+ /**
192
+ * @param array $config
193
+ */
194
+ public function setConfig($config)
195
+ {
196
+ $this->config = $config;
197
+ }
198
+
199
+ /**
200
+ * @return array
201
+ */
202
+ public function getConfig()
203
+ {
204
+ return $this->config;
205
+ }
206
+
207
+ }
lib/Payone/Log4php/Logger.php CHANGED
@@ -18,7 +18,7 @@
18
* @package log4php
19
*/
20
21
- require_once dirname(__FILE__) . '/LoggerAutoloader.php';
22
23
/**
24
* This is the central class in the log4php package. All logging operations
18
* @package log4php
19
*/
20
21
+ //require_once dirname(__FILE__) . '/LoggerAutoloader.php';
22
23
/**
24
* This is the central class in the log4php package. All logging operations
lib/Payone/Log4php/LoggerPatternConverterSuperglobal.php CHANGED
@@ -54,14 +54,14 @@ abstract class Payone_Log4php_LoggerPatternConverterSuperglobal extends Payone_L
54
* accessed when their name is stored in a variable, e.g.:
55
*
56
* $name = '_SERVER';
57
- * $array = $name;
58
*
59
* This code does not work when run from within a method (only when run
60
* in global scope). But the following code does work:
61
*
62
* $name = '_SERVER';
63
- * global $name;
64
- * $array = $name;
65
*
66
* That's why global is used here.
67
*/
54
* accessed when their name is stored in a variable, e.g.:
55
*
56
* $name = '_SERVER';
57
+ * $array = $name;
58
*
59
* This code does not work when run from within a method (only when run
60
* in global scope). But the following code does work:
61
*
62
* $name = '_SERVER';
63
+ * global $name;
64
+ * $array = $name;
65
*
66
* That's why global is used here.
67
*/
lib/Payone/Settings/Service/XmlGenerate.php CHANGED
@@ -35,6 +35,8 @@ class Payone_Settings_Service_XmlGenerate
35
const TAG_CONFIG_ROOT = 'config';
36
const CLASS_PREFIX = 'Payone_Settings_Data_ConfigFile_';
37
38
39
// @todo neue Methode generate mit gleichen Parametern
40
// @todo wandelt anhand Shop "gruppiert" um und fügt mehrere Shops umwandlungen zusammen in ein config-root
@@ -52,14 +54,16 @@ class Payone_Settings_Service_XmlGenerate
52
public function generate(Payone_Settings_Data_ConfigFile_Root $config)
53
{
54
// @todo wandelt anhand Shop "gruppiert" um und fügt mehrere Shops umwandlungen zusammen in ein config-root
55
- $configXml = new SimpleXMLElement('<' . $config->getKey() . '>' . '</' . $config->getKey() . '>');
56
57
58
foreach ($config->getShop() as $key => $value) {
59
- $shop = $this->mapShop($value, $configXml);
60
}
61
62
- $xmlString = $configXml->asXML();
63
64
return $xmlString;
65
}
@@ -120,15 +124,15 @@ class Payone_Settings_Service_XmlGenerate
120
121
/**
122
* @param Payone_Settings_Data_ConfigFile_Shop $shopConfig
123
- * @param SimpleXMLElement $configXml
124
* @return string
125
*/
126
- protected function mapShop(Payone_Settings_Data_ConfigFile_Shop $shopConfig, SimpleXMLElement $configXml)
127
{
128
- $shopXml = $configXml->addChild($shopConfig->getKey());
129
130
$this->addChild($shopXml, $shopConfig, 'code');
131
- $this->addChild($shopXml, $shopConfig, 'name');
132
133
$shopXml = $this->mapSystem($shopConfig->getSystem(), $shopXml);
134
@@ -142,12 +146,13 @@ class Payone_Settings_Service_XmlGenerate
142
143
/**
144
* @param Payone_Settings_Data_ConfigFile_Shop_System $systemConfig
145
- * @param SimpleXMLElement $shopXml
146
- * @return SimpleXMLElement
147
*/
148
- protected function mapSystem(Payone_Settings_Data_ConfigFile_Shop_System $systemConfig, SimpleXMLElement $shopXml)
149
{
150
- $systemXml = $shopXml->addChild($systemConfig->getKey());
151
$this->addChild($systemXml, $systemConfig, 'name');
152
$this->addChild($systemXml, $systemConfig, 'version');
153
$this->addChild($systemXml, $systemConfig, 'edition');
@@ -157,35 +162,36 @@ class Payone_Settings_Service_XmlGenerate
157
158
/**
159
* @param Payone_Settings_Data_ConfigFile_Shop_Global $globalConfig
160
- * @param SimpleXMLElement $shopXml
161
- * @return SimpleXMLElement
162
*/
163
- protected function mapGlobal(Payone_Settings_Data_ConfigFile_Shop_Global $globalConfig, SimpleXMLElement $shopXml)
164
{
165
- $globalXml = $shopXml->addChild($globalConfig->getKey());
166
$this->addChild($globalXml, $globalConfig, 'mid');
167
$this->addChild($globalXml, $globalConfig, 'aid');
168
$this->addChild($globalXml, $globalConfig, 'portalid');
169
$this->addChild($globalXml, $globalConfig, 'request_type');
170
- $this->addChild($globalXml, $globalConfig, 'parameter_invoice');
171
$this->addStatusMapping($globalConfig, $globalXml);
172
- $this->addChild($globalXml, $globalConfig, 'payment_creditcard');
173
return $shopXml;
174
}
175
176
/**
177
* @param Payone_Settings_Data_ConfigFile_Shop_ClearingTypes $clearingTypes
178
- * @param SimpleXMLElement $shopXml
179
- * @return SimpleXMLElement
180
*/
181
- protected function mapClearingTypes(Payone_Settings_Data_ConfigFile_Shop_ClearingTypes $clearingTypes, SimpleXMLElement $shopXml)
182
{
183
- $clearingTypesXml = $shopXml->addChild($clearingTypes->getKey());
184
185
foreach ($clearingTypes->getClearingtypes() as $keyClearingType => $valueClearingType) {
186
- $cleatringTypeNode = $clearingTypesXml->addChild($valueClearingType->getKey());
187
188
- $this->addChild($cleatringTypeNode, $valueClearingType, 'title');
189
$this->addChild($cleatringTypeNode, $valueClearingType, 'id');
190
$this->addChild($cleatringTypeNode, $valueClearingType, 'mid');
191
$this->addChild($cleatringTypeNode, $valueClearingType, 'aid');
@@ -203,12 +209,12 @@ class Payone_Settings_Service_XmlGenerate
203
204
/**
205
* @param Payone_Settings_Data_ConfigFile_Shop_Protect $protectConfig
206
- * @param SimpleXMLElement $shopXml
207
- * @return SimpleXMLElement
208
*/
209
- protected function mapProtect(Payone_Settings_Data_ConfigFile_Shop_Protect $protectConfig, SimpleXMLElement $shopXml)
210
{
211
- $protectXml = $shopXml->addChild($protectConfig->getKey());
212
213
$protectXml = $this->mapConsumerscore($protectConfig->getConsumerscore(), $protectXml);
214
$protectXml = $this->mapAddresscheck($protectConfig->getAddresscheck(), $protectXml);
@@ -218,12 +224,13 @@ class Payone_Settings_Service_XmlGenerate
218
219
/**
220
* @param Payone_Settings_Data_ConfigFile_Shop_Misc $miscConfig
221
- * @param SimpleXMLElement $shopXml
222
- * @return SimpleXMLElement
223
*/
224
- protected function mapMisc(Payone_Settings_Data_ConfigFile_Shop_Misc $miscConfig, SimpleXMLElement $shopXml)
225
{
226
- $miscXml = $shopXml->addChild($miscConfig->getKey());
227
$this->addTransactionstatusForwarding($miscConfig, $miscXml);
228
$this->addChild($miscXml, $miscConfig, 'shipping_costs');
229
return $shopXml;
@@ -232,12 +239,13 @@ class Payone_Settings_Service_XmlGenerate
232
233
/**
234
* @param Payone_Settings_Data_ConfigFile_Protect_Consumerscore $consumerscoreConfig
235
- * @param SimpleXMLElement $protectXml
236
- * @return SimpleXMLElement
237
*/
238
- protected function mapConsumerscore(Payone_Settings_Data_ConfigFile_Protect_Consumerscore $consumerscoreConfig, SimpleXMLElement $protectXml)
239
{
240
- $consumerscoreXml = $protectXml->addChild($consumerscoreConfig->getKey());
241
$this->addChild($consumerscoreXml, $consumerscoreConfig, 'active');
242
$this->addChild($consumerscoreXml, $consumerscoreConfig, 'mode');
243
$this->addChild($consumerscoreXml, $consumerscoreConfig, 'min_order_total');
@@ -252,12 +260,13 @@ class Payone_Settings_Service_XmlGenerate
252
253
/**
254
* @param Payone_Settings_Data_ConfigFile_Protect_Addresscheck $addresscheckConfig
255
- * @param SimpleXMLElement $protectXml
256
- * @return SimpleXMLElement
257
*/
258
- protected function mapAddresscheck(Payone_Settings_Data_ConfigFile_Protect_Addresscheck $addresscheckConfig, SimpleXMLElement $protectXml)
259
{
260
- $addresscheckXml = $protectXml->addChild($addresscheckConfig->getKey());
261
$this->addChild($addresscheckXml, $addresscheckConfig, 'active');
262
$this->addChild($addresscheckXml, $addresscheckConfig, 'mode');
263
$this->addChild($addresscheckXml, $addresscheckConfig, 'min_order_total');
@@ -269,38 +278,82 @@ class Payone_Settings_Service_XmlGenerate
269
return $protectXml;
270
}
271
272
- public function addTransactionstatusForwarding(Payone_Settings_Data_ConfigFile_Shop_Misc $miscConfig, SimpleXMLElement $miscXml)
273
{
274
$tasForwarding = $miscConfig->getTransactionstatusforwarding();
275
- $tasXml = $miscXml->addChild($tasForwarding->getKey());
276
277
foreach ($tasForwarding->getTransactionstatusForwarding() as $keyTas => $config) {
278
- $configNode = $tasXml->addChild('config');
279
280
foreach ($config as $key => $value) {
281
- $configNode->addAttribute($key, $value);
282
}
283
}
284
}
285
286
- public function addStatusMapping(Payone_Settings_Data_ConfigFile_Shop_Global $globalConfig, SimpleXMLElement $globalXml)
287
{
288
$statusMapping = $globalConfig->getStatusMapping();
289
- $tasXml = $globalXml->addChild($statusMapping->getKey());
290
291
foreach ($statusMapping->getStatusMapping() as $keyStatusMapping => $valueStatusMapping) {
292
-
293
- $parent = $tasXml->addChild($keyStatusMapping);
294
295
foreach ($valueStatusMapping as $key => $value) {
296
- $mapNode = $parent->addChild('map');
297
298
$this->addAttribute($mapNode, $key, $value);
299
}
300
}
301
}
302
303
- public function addTypesOrGlobalInfo(SimpleXMLElement $cleatringTypeNode, Payone_Settings_Data_ConfigFile_PaymentMethod_Abstract $valueClearingType)
304
{
305
if ($valueClearingType->getTypes() !== NULL && $valueClearingType->getTypes() !== FALSE) {
306
@@ -324,19 +377,21 @@ class Payone_Settings_Service_XmlGenerate
324
$this->addChild($parent, $type, 'mode');
325
}
326
327
- public function addFeeConfig(SimpleXMLElement $cleatringTypeNode, Payone_Settings_Data_ConfigFile_PaymentMethod_Abstract $valueClearingType)
328
{
329
$feeConfig = $valueClearingType->getFeeConfig();
330
if (!empty($feeConfig)) {
331
332
- $feeConfigNode = $cleatringTypeNode->addChild('fee_config');
333
foreach ($feeConfig as $keyFeeConfig => $valueFeeConfig) {
334
if (array_key_exists('value', $valueFeeConfig) && array_key_exists('attribute', $valueFeeConfig)) {
335
- $feeNode = $feeConfigNode->addChild('fee', $valueFeeConfig['value']);
336
-
337
foreach ($valueFeeConfig['attribute'] as $keyFee => $valueFee) {
338
- $feeNode->addAttribute($keyFee, $valueFee);
339
-
340
}
341
}
342
}
@@ -345,48 +400,77 @@ class Payone_Settings_Service_XmlGenerate
345
346
347
/**
348
- * @param SimpleXMLElement $parent
349
* @param $object
350
* @param $property
351
- * @return SimpleXMLElement
352
*/
353
- protected function addChild(SimpleXMLElement $parent, $object, $property)
354
{
355
$getter = 'get' . str_replace(' ', '', ucwords(str_replace('_', ' ', $property)));
356
$data = $object->$getter();
357
$child = $parent;
358
if (is_array($data)) {
359
- $parent = $parent->addChild($property);
360
foreach ($data as $key => $value) {
361
- $child = $parent->addChild($key, $value);
362
}
363
}
364
else {
365
if (isset($data)) {
366
- $child = $parent->addChild($property, $data);
367
}
368
}
369
return $child;
370
}
371
372
/**
373
- * @param SimpleXMLElement $mapNode
374
* @param $name
375
* @param $value
376
- * @return SimpleXMLElement
377
*/
378
- protected function addAttribute(SimpleXMLElement $mapNode, $name, $value)
379
{
380
if (is_array($value)) {
381
foreach ($value as $key => $data) {
382
- $mapNode->addAttribute($key, $data);
383
}
384
}
385
else {
386
if (!empty($data)) {
387
- $mapNode->addAttribute($name, $value);
388
}
389
}
390
return $mapNode;
391
}
392
}
35
const TAG_CONFIG_ROOT = 'config';
36
const CLASS_PREFIX = 'Payone_Settings_Data_ConfigFile_';
37
38
+ /** @var DOMDocument */
39
+ private $dom;
40
41
// @todo neue Methode generate mit gleichen Parametern
42
// @todo wandelt anhand Shop "gruppiert" um und fügt mehrere Shops umwandlungen zusammen in ein config-root
54
public function generate(Payone_Settings_Data_ConfigFile_Root $config)
55
{
56
// @todo wandelt anhand Shop "gruppiert" um und fügt mehrere Shops umwandlungen zusammen in ein config-root
57
+ $this->dom = new DOMDocument('1.0', 'UTF-8');
58
59
+ $root = $this->appendElement($this->dom, $config->getKey());
60
61
foreach ($config->getShop() as $key => $value) {
62
+ $shop = $this->mapShop($value, $root);
63
}
64
65
+ $this->dom->formatOutput = true;
66
+ $xmlString = $this->dom->saveXML();
67
68
return $xmlString;
69
}
124
125
/**
126
* @param Payone_Settings_Data_ConfigFile_Shop $shopConfig
127
+ * @param DOMElement $configXml
128
* @return string
129
*/
130
+ protected function mapShop(Payone_Settings_Data_ConfigFile_Shop $shopConfig, DOMElement $configXml)
131
{
132
+ $shopXml = $this->appendElement($configXml, $shopConfig->getKey());
133
134
$this->addChild($shopXml, $shopConfig, 'code');
135
+ $this->addChild($shopXml, $shopConfig, 'name', true);
136
137
$shopXml = $this->mapSystem($shopConfig->getSystem(), $shopXml);
138
146
147
/**
148
* @param Payone_Settings_Data_ConfigFile_Shop_System $systemConfig
149
+ * @param DOMElement $shopXml
150
+ * @return DOMElement
151
*/
152
+ protected function mapSystem(Payone_Settings_Data_ConfigFile_Shop_System $systemConfig, DOMElement $shopXml)
153
{
154
+ $systemXml = $this->appendElement($shopXml, $systemConfig->getKey());
155
+
156
$this->addChild($systemXml, $systemConfig, 'name');
157
$this->addChild($systemXml, $systemConfig, 'version');
158
$this->addChild($systemXml, $systemConfig, 'edition');
162
163
/**
164
* @param Payone_Settings_Data_ConfigFile_Shop_Global $globalConfig
165
+ * @param DOMElement $shopXml
166
+ * @return DOMElement
167
*/
168
+ protected function mapGlobal(Payone_Settings_Data_ConfigFile_Shop_Global $globalConfig, DOMElement $shopXml)
169
{
170
+ $globalXml = $this->appendElement($shopXml, $globalConfig->getKey());
171
+
172
$this->addChild($globalXml, $globalConfig, 'mid');
173
$this->addChild($globalXml, $globalConfig, 'aid');
174
$this->addChild($globalXml, $globalConfig, 'portalid');
175
$this->addChild($globalXml, $globalConfig, 'request_type');
176
+ $this->mapParameterInvoice($globalConfig,$globalXml);
177
$this->addStatusMapping($globalConfig, $globalXml);
178
+ $this->mapPaymentCreditcard($globalConfig,$globalXml);
179
return $shopXml;
180
}
181
182
/**
183
* @param Payone_Settings_Data_ConfigFile_Shop_ClearingTypes $clearingTypes
184
+ * @param DOMElement $shopXml
185
+ * @return DOMElement
186
*/
187
+ protected function mapClearingTypes(Payone_Settings_Data_ConfigFile_Shop_ClearingTypes $clearingTypes, DOMElement $shopXml)
188
{
189
+ $clearingTypesXml = $this->appendElement($shopXml, $clearingTypes->getKey());
190
191
foreach ($clearingTypes->getClearingtypes() as $keyClearingType => $valueClearingType) {
192
+ $cleatringTypeNode = $this->appendElement($clearingTypesXml, $valueClearingType->getKey());
193
194
+ $this->addChild($cleatringTypeNode, $valueClearingType, 'title', true);
195
$this->addChild($cleatringTypeNode, $valueClearingType, 'id');
196
$this->addChild($cleatringTypeNode, $valueClearingType, 'mid');
197
$this->addChild($cleatringTypeNode, $valueClearingType, 'aid');
209
210
/**
211
* @param Payone_Settings_Data_ConfigFile_Shop_Protect $protectConfig
212
+ * @param DOMElement $shopXml
213
+ * @return DOMElement
214
*/
215
+ protected function mapProtect(Payone_Settings_Data_ConfigFile_Shop_Protect $protectConfig, DOMElement $shopXml)
216
{
217
+ $protectXml = $this->appendElement($shopXml,$protectConfig->getKey());
218
219
$protectXml = $this->mapConsumerscore($protectConfig->getConsumerscore(), $protectXml);
220
$protectXml = $this->mapAddresscheck($protectConfig->getAddresscheck(), $protectXml);
224
225
/**
226
* @param Payone_Settings_Data_ConfigFile_Shop_Misc $miscConfig
227
+ * @param DOMElement $shopXml
228
+ * @return DOMElement
229
*/
230
+ protected function mapMisc(Payone_Settings_Data_ConfigFile_Shop_Misc $miscConfig, DOMElement $shopXml)
231
{
232
+ $miscXml = $this->appendElement($shopXml, $miscConfig->getKey());
233
+
234
$this->addTransactionstatusForwarding($miscConfig, $miscXml);
235
$this->addChild($miscXml, $miscConfig, 'shipping_costs');
236
return $shopXml;
239
240
/**
241
* @param Payone_Settings_Data_ConfigFile_Protect_Consumerscore $consumerscoreConfig
242
+ * @param DOMElement $protectXml
243
+ * @return DOMElement
244
*/
245
+ protected function mapConsumerscore(Payone_Settings_Data_ConfigFile_Protect_Consumerscore $consumerscoreConfig, DOMElement $protectXml)
246
{
247
+ $consumerscoreXml = $this->appendElement($protectXml, $consumerscoreConfig->getKey());
248
+
249
$this->addChild($consumerscoreXml, $consumerscoreConfig, 'active');
250
$this->addChild($consumerscoreXml, $consumerscoreConfig, 'mode');
251
$this->addChild($consumerscoreXml, $consumerscoreConfig, 'min_order_total');
260
261
/**
262
* @param Payone_Settings_Data_ConfigFile_Protect_Addresscheck $addresscheckConfig
263
+ * @param DOMElement $protectXml
264
+ * @return DOMElement
265
*/
266
+ protected function mapAddresscheck(Payone_Settings_Data_ConfigFile_Protect_Addresscheck $addresscheckConfig, DOMElement $protectXml)
267
{
268
+ $addresscheckXml = $this->appendElement($protectXml, $addresscheckConfig->getKey());
269
+
270
$this->addChild($addresscheckXml, $addresscheckConfig, 'active');
271
$this->addChild($addresscheckXml, $addresscheckConfig, 'mode');
272
$this->addChild($addresscheckXml, $addresscheckConfig, 'min_order_total');
278
return $protectXml;
279
}
280
281
+ /**
282
+ * @param Payone_Settings_Data_ConfigFile_Shop_Global $globalConfig
283
+ * @param DOMElement $globalXml
284
+ * @return DOMElement
285
+ */
286
+ protected function mapParameterInvoice(Payone_Settings_Data_ConfigFile_Shop_Global $globalConfig, DOMElement $globalXml)
287
+ {
288
+ $parameterInvoice = $globalConfig->getParameterInvoice();
289
+ $parameterInvoiceXml = $this->appendElement($globalXml, 'parameter_invoice');
290
+
291
+ $this->appendElement($parameterInvoiceXml, 'invoice_appendix', $parameterInvoice['invoice_appendix'], true);
292
+ $this->appendElement($parameterInvoiceXml, 'invoice_appendix_refund', $parameterInvoice['invoice_appendix_refund'], true);
293
+ $this->appendElement($parameterInvoiceXml, 'pdf_download_enabled', $parameterInvoice['pdf_download_enabled']);
294
+ $this->appendElement($parameterInvoiceXml, 'transmit_enabled', $parameterInvoice['transmit_enabled']);
295
+
296
+ return $globalXml;
297
+ }
298
+
299
+ /**
300
+ * @param Payone_Settings_Data_ConfigFile_Shop_Global $globalConfig
301
+ * @param DOMElement $globalXml
302
+ * @return DOMElement
303
+ */
304
+ protected function mapPaymentCreditcard(Payone_Settings_Data_ConfigFile_Shop_Global $globalConfig, DOMElement $globalXml)
305
+ {
306
+ $paymentCreditcard = $globalConfig->getPaymentCreditcard();
307
+ $paymentCreditcardXml = $this->appendElement($globalXml, 'payment_creditcard');
308
+
309
+ $this->appendElement($paymentCreditcardXml, 'min_validity_period', $paymentCreditcard['min_validity_period']);
310
+
311
+ return $globalXml;
312
+ }
313
+
314
+ /**
315
+ * @param Payone_Settings_Data_ConfigFile_Shop_Misc $miscConfig
316
+ * @param DOMElement $miscXml
317
+ */
318
+ public function addTransactionstatusForwarding(Payone_Settings_Data_ConfigFile_Shop_Misc $miscConfig, DOMElement $miscXml)
319
{
320
$tasForwarding = $miscConfig->getTransactionstatusforwarding();
321
+ $tasXml = $this->appendElement($miscXml, $tasForwarding->getKey());
322
323
foreach ($tasForwarding->getTransactionstatusForwarding() as $keyTas => $config) {
324
+ $configNode = $this->appendElement($tasXml,'config');
325
326
foreach ($config as $key => $value) {
327
+ $configNode->setAttribute($key, $value);
328
}
329
}
330
}
331
332
+ /**
333
+ * @param Payone_Settings_Data_ConfigFile_Shop_Global $globalConfig
334
+ * @param DOMElement $globalXml
335
+ */
336
+ public function addStatusMapping(Payone_Settings_Data_ConfigFile_Shop_Global $globalConfig, DOMElement $globalXml)
337
{
338
$statusMapping = $globalConfig->getStatusMapping();
339
+ $tasXml = $this->appendElement($globalXml,$statusMapping->getKey());
340
341
foreach ($statusMapping->getStatusMapping() as $keyStatusMapping => $valueStatusMapping) {
342
+ $parent = $this->appendElement($tasXml,$keyStatusMapping);
343
344
foreach ($valueStatusMapping as $key => $value) {
345
+ $mapNode = $this->appendElement($parent, 'map');
346
347
$this->addAttribute($mapNode, $key, $value);
348
}
349
}
350
}
351
352
+ /**
353
+ * @param DOMElement $cleatringTypeNode
354
+ * @param Payone_Settings_Data_ConfigFile_PaymentMethod_Abstract $valueClearingType
355
+ */
356
+ public function addTypesOrGlobalInfo(DOMElement $cleatringTypeNode, Payone_Settings_Data_ConfigFile_PaymentMethod_Abstract $valueClearingType)
357
{
358
if ($valueClearingType->getTypes() !== NULL && $valueClearingType->getTypes() !== FALSE) {
359
377
$this->addChild($parent, $type, 'mode');
378
}
379
380
+ /**
381
+ * @param DOMElement $cleatringTypeNode
382
+ * @param Payone_Settings_Data_ConfigFile_PaymentMethod_Abstract $valueClearingType
383
+ */
384
+ public function addFeeConfig(DOMElement $cleatringTypeNode, Payone_Settings_Data_ConfigFile_PaymentMethod_Abstract $valueClearingType)
385
{
386
$feeConfig = $valueClearingType->getFeeConfig();
387
if (!empty($feeConfig)) {
388
+ $feeConfigNode = $this->appendElement($cleatringTypeNode,'fee_config');
389
390
foreach ($feeConfig as $keyFeeConfig => $valueFeeConfig) {
391
if (array_key_exists('value', $valueFeeConfig) && array_key_exists('attribute', $valueFeeConfig)) {
392
+ $feeNode = $this->appendElement($feeConfigNode, 'fee', $valueFeeConfig['value']);
393
foreach ($valueFeeConfig['attribute'] as $keyFee => $valueFee) {
394
+ $feeNode->setAttribute($keyFee, $valueFee);
395
}
396
}
397
}
400
401
402
/**
403
+ * @param DOMElement $parent
404
* @param $object
405
* @param $property
406
+ * @param bool $withCdata
407
+ * @return DOMElement
408
*/
409
+ protected function addChild(DOMElement $parent, $object, $property, $withCdata = false)
410
{
411
$getter = 'get' . str_replace(' ', '', ucwords(str_replace('_', ' ', $property)));
412
$data = $object->$getter();
413
$child = $parent;
414
if (is_array($data)) {
415
+ $parentNode = $this->appendElement($parent,$property);
416
foreach ($data as $key => $value) {
417
+ $child = $this->appendElement($parentNode, $key, $value, $withCdata);
418
}
419
}
420
else {
421
if (isset($data)) {
422
+ $child = $this->appendElement($parent, $property, $data, $withCdata);
423
}
424
}
425
return $child;
426
}
427
428
/**
429
+ * @param DOMElement $mapNode
430
* @param $name
431
* @param $value
432
+ * @return DOMElement
433
*/
434
+ protected function addAttribute(DOMElement $mapNode, $name, $value)
435
{
436
if (is_array($value)) {
437
foreach ($value as $key => $data) {
438
+ $mapNode->setAttribute($key, $data);
439
}
440
}
441
else {
442
if (!empty($data)) {
443
+ $mapNode->setAttribute($name, $value);
444
}
445
}
446
return $mapNode;
447
}
448
+
449
+ /**
450
+ * @param DOMElement|DOMDocument $parent
451
+ * @param $key
452
+ * @param $value
453
+ * @param bool $asCdata
454
+ * @return DOMElement
455
+ */
456
+ protected function appendElement( $parent, $key, $value = null, $asCdata = false)
457
+ {
458
+ if($asCdata === true)
459
+ {
460
+ $cdata = $this->dom->createCDATASection($value);
461
+ $child = $this->dom->createElement($key);
462
+ $child->appendChild($cdata);
463
+ }
464
+ else
465
+ {
466
+ $child = $this->dom->createElement($key);
467
+ if($value !== null)
468
+ {
469
+ $domValue = $this->dom->createTextNode($value);
470
+ $child->appendChild($domValue);
471
+ }
472
+ }
473
+ $parent->appendChild($child);
474
+ return $child;
475
+ }
476
}
lib/Payone/TransactionStatus/Config.php ADDED
@@ -0,0 +1,64 @@
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 to newer
12
+ * versions in the future. If you wish to customize Payone for your
13
+ * needs please refer to http://www.payone.de for more information.
14
+ *
15
+ * @category Payone
16
+ * @package Payone_Api
17
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
18
+ * @author Matthias Walter <info@noovias.com>
19
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
20
+ * @link http://www.noovias.com
21
+ */
22
+
23
+ /**
24
+ *
25
+ * @category Payone
26
+ * @package Payone_Api
27
+ * @copyright Copyright (c) 2012 <info@noovias.com> - www.noovias.com
28
+ * @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
29
+ * @link http://www.noovias.com
30
+ */
31
+ class Payone_TransactionStatus_Config extends Payone_Config_Abstract
32
+ {
33
+ /**
34
+ * @return array
35
+ */
36
+ public function getDefaultConfigData()
37
+ {
38
+ $defaultConfig = array(
39
+ 'default' => array(
40
+ 'validators' => array(
41
+ 'Payone_TransactionStatus_Validator_Ip',
42
+ 'Payone_TransactionStatus_Validator_DefaultParameters',
43
+ ),
44
+ 'protocol' => array(
45
+ 'filter' => array(
46
+ 'mask_value' => array(
47
+ 'enabled' => 1,
48
+ 'percent' => 100
49
+ )
50
+ ),
51
+ 'loggers' => array(
52
+ 'Payone_Protocol_Logger_Log4php' => array(
53
+ 'filename' => 'payone_transactionstatus.log',
54
+ 'max_file_size' => '1MB',
55
+ 'max_file_count' => 20
56
+ )
57
+ ),
58
+ ),
59
+ )
60
+ );
61
+ return $defaultConfig;
62
+ }
63
+
64
+ }
lib/Payone/TransactionStatus/Factory.php CHANGED
@@ -30,6 +30,19 @@
30
*/
31
class Payone_TransactionStatus_Factory
32
{
33
/**
34
* @return Payone_TransactionStatus_Service_ProtocolRequest
35
*/
@@ -88,5 +101,21 @@ class Payone_TransactionStatus_Factory
88
return $validator;
89
}
90
91
92
}
30
*/
31
class Payone_TransactionStatus_Factory
32
{
33
+
34
+ /** @var Payone_TransactionStatus_Config */
35
+ protected $config = null;
36
+
37
+ /**
38
+ * @constructor
39
+ * @param Payone_TransactionStatus_Config $config
40
+ */
41
+ public function __construct(Payone_TransactionStatus_Config $config = null)
42
+ {
43
+ $this->config = $config;
44
+ }
45
+
46
/**
47
* @return Payone_TransactionStatus_Service_ProtocolRequest
48
*/
101
return $validator;
102
}
103
104
+ /**
105
+ * @param Payone_TransactionStatus_Config $config
106
+ */
107
+ public function setConfig($config)
108
+ {
109
+ $this->config = $config;
110
+ }
111
+
112
+ /**
113
+ * @return Payone_TransactionStatus_Config
114
+ */
115
+ public function getConfig()
116
+ {
117
+ return $this->config;
118
+ }
119
+
120
121
}
lib/Payone/TransactionStatus/Validator/Ip.php CHANGED
@@ -36,6 +36,9 @@ class Payone_TransactionStatus_Validator_Ip
36
/** @var array */
37
protected $validIps = array();
38
39
/**
40
* @param Payone_TransactionStatus_Request_Interface $request
41
* @throws Payone_TransactionStatus_Exception_Validation
@@ -93,10 +96,52 @@ class Payone_TransactionStatus_Validator_Ip
93
}
94
95
/**
96
* @return string
97
*/
98
public function getRemoteAddress()
99
{
100
- return $_SERVER['REMOTE_ADDR'];