Version Notes
1.7.0.1
Download this release
Release Info
Developer | Magento Core Team |
Extension | Mage_Core_Modules |
Version | 1.7.0.1 |
Comparing to | |
See all releases |
Code changes from version 1.7.0.0 to 1.7.0.1
- RELEASE_NOTES.txt +22 -0
- app/Mage.php +1 -1
- app/code/core/Mage/Api/Helper/Data.php +86 -1
- app/code/core/Mage/Api/etc/wsdl2.xml +1 -7
- app/code/core/Mage/Api/etc/wsi.xml +1 -1
- app/code/core/Mage/Api2/Model/Request/Interpreter/Xml.php +4 -0
- app/code/core/Mage/Authorizenet/etc/system.xml +1 -1
- app/code/core/Mage/Catalog/Model/Product/Api.php +12 -18
- app/code/core/Mage/Catalog/Model/Product/Api/V2.php +0 -60
- app/code/core/Mage/Customer/Model/Customer/Api.php +12 -21
- app/code/core/Mage/Customer/Model/Customer/Api/V2.php +0 -60
- app/code/core/Mage/Install/Model/Installer/Console.php +3 -1
- app/code/core/Mage/Paygate/etc/system.xml +1 -1
- app/code/core/Mage/Payment/etc/system.xml +6 -6
- app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Field/Country.php +127 -0
- app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Field/Hidden.php +48 -0
- app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Expanded.php +52 -0
- app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Global.php +1 -0
- app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Group.php +77 -0
- app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Hint.php +51 -1
- app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Location.php +353 -0
- app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Payment.php +128 -0
- app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Payflowlink/Advanced.php +1 -1
- app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Payflowlink/Info.php +5 -3
- app/code/core/Mage/Paypal/Model/Api/Nvp.php +5 -1
- app/code/core/Mage/Paypal/Model/Config.php +36 -21
- app/code/core/Mage/Paypal/Model/Ipn.php +8 -6
- app/code/core/Mage/Paypal/Model/Observer.php +38 -0
- app/code/core/Mage/Paypal/Model/Payflowadvanced.php +7 -0
- app/code/core/Mage/Paypal/Model/Payflowlink.php +112 -2
- app/code/core/Mage/Paypal/Model/Payflowpro.php +6 -2
- app/code/core/Mage/Paypal/Model/System/Config/Source/UrlMethod.php +44 -0
- app/code/core/Mage/Paypal/etc/config.xml +30 -2
- app/code/core/Mage/Paypal/etc/system.xml +3242 -1877
- app/code/core/Mage/Sales/Model/Api/Resource.php +4 -2
- app/code/core/Mage/Sales/Model/Order/Api.php +44 -56
- app/code/core/Mage/Sales/Model/Order/Api/V2.php +0 -97
- app/code/core/Mage/Sales/Model/Order/Creditmemo/Api.php +18 -19
- app/code/core/Mage/Sales/Model/Order/Creditmemo/Api/V2.php +1 -0
- app/code/core/Mage/Sales/Model/Order/Invoice/Api.php +29 -42
- app/code/core/Mage/Sales/Model/Order/Invoice/Api/V2.php +20 -87
- app/code/core/Mage/Sales/Model/Order/Shipment/Api.php +15 -20
- app/code/core/Mage/Sales/Model/Order/Shipment/Api/V2.php +4 -59
- package.xml +6 -6
RELEASE_NOTES.txt
CHANGED
@@ -1,3 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
==== 1.7.0.0 ====
|
2 |
|
3 |
=== Major Highlights ===
|
1 |
+
==== 1.7.0.1 ====
|
2 |
+
|
3 |
+
=== Major Highlights ===
|
4 |
+
Improved the backend configuration UI for PayPal payment solutions
|
5 |
+
|
6 |
+
=== Improvements ===
|
7 |
+
Added the functionality for creating nested field sets in the System configuration
|
8 |
+
Implemented the support for the extended and shared configuration fields
|
9 |
+
Added the ability to define dependencies between fields from different field sets
|
10 |
+
|
11 |
+
=== Changes ===
|
12 |
+
Moved PayPal configuration to the Payment Methods menu
|
13 |
+
Set the default value of the cUrl VERIFYPEER option to TRUE for PayPal and added the ability to change this value
|
14 |
+
Changed the design and position of the configuration field tooltips
|
15 |
+
|
16 |
+
=== Fixes ===
|
17 |
+
Fixed: Inability of SOAP v2 API use in non WS-I compatible mode in the applications written in languages with strong typing
|
18 |
+
Fixed: In some cases comments history tab on order does not contain information about customer notifications
|
19 |
+
Fixed: Several potential security vulnerabilities
|
20 |
+
|
21 |
+
|
22 |
+
|
23 |
==== 1.7.0.0 ====
|
24 |
|
25 |
=== Major Highlights ===
|
app/Mage.php
CHANGED
@@ -170,7 +170,7 @@ final class Mage
|
|
170 |
'major' => '1',
|
171 |
'minor' => '7',
|
172 |
'revision' => '0',
|
173 |
-
'patch' => '
|
174 |
'stability' => '',
|
175 |
'number' => '',
|
176 |
);
|
170 |
'major' => '1',
|
171 |
'minor' => '7',
|
172 |
'revision' => '0',
|
173 |
+
'patch' => '1',
|
174 |
'stability' => '',
|
175 |
'number' => '',
|
176 |
);
|
app/code/core/Mage/Api/Helper/Data.php
CHANGED
@@ -250,4 +250,89 @@ class Mage_Api_Helper_Data extends Mage_Core_Helper_Abstract
|
|
250 |
}
|
251 |
}
|
252 |
}
|
253 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
250 |
}
|
251 |
}
|
252 |
}
|
253 |
+
|
254 |
+
/**
|
255 |
+
* Parse filters and format them to be applicable for collection filtration
|
256 |
+
*
|
257 |
+
* @param null|object|array $filters
|
258 |
+
* @param array $fieldsMap Map of field names in format: array('field_name_in_filter' => 'field_name_in_db')
|
259 |
+
* @return array
|
260 |
+
*/
|
261 |
+
public function parseFilters($filters, $fieldsMap = null)
|
262 |
+
{
|
263 |
+
// if filters are used in SOAP they must be represented in array format to be used for collection filtration
|
264 |
+
if (is_object($filters)) {
|
265 |
+
$parsedFilters = array();
|
266 |
+
// parse simple filter
|
267 |
+
if (isset($filters->filter) && is_array($filters->filter)) {
|
268 |
+
foreach ($filters->filter as $field => $value) {
|
269 |
+
if (is_object($value) && isset($value->key) && isset($value->value)) {
|
270 |
+
$parsedFilters[$value->key] = $value->value;
|
271 |
+
} else {
|
272 |
+
$parsedFilters[$field] = $value;
|
273 |
+
}
|
274 |
+
}
|
275 |
+
}
|
276 |
+
// parse complex filter
|
277 |
+
if (isset($filters->complex_filter) && is_array($filters->complex_filter)) {
|
278 |
+
if ($this->isComplianceWSI()) {
|
279 |
+
// WS-I compliance mode
|
280 |
+
foreach ($filters->complex_filter as $fieldName => $condition) {
|
281 |
+
if (is_object($condition) && isset($condition->key) && isset($condition->value)) {
|
282 |
+
$conditionName = $condition->key;
|
283 |
+
$conditionValue = $condition->value;
|
284 |
+
$this->formatFilterConditionValue($conditionName, $conditionValue);
|
285 |
+
$parsedFilters[$fieldName] = array($conditionName => $conditionValue);
|
286 |
+
}
|
287 |
+
}
|
288 |
+
} else {
|
289 |
+
// non WS-I compliance mode
|
290 |
+
foreach ($filters->complex_filter as $value) {
|
291 |
+
if (is_object($value) && isset($value->key) && isset($value->value)) {
|
292 |
+
$fieldName = $value->key;
|
293 |
+
$condition = $value->value;
|
294 |
+
if (is_object($condition) && isset($condition->key) && isset($condition->value)) {
|
295 |
+
$this->formatFilterConditionValue($condition->key, $condition->value);
|
296 |
+
$parsedFilters[$fieldName] = array($condition->key => $condition->value);
|
297 |
+
}
|
298 |
+
}
|
299 |
+
}
|
300 |
+
}
|
301 |
+
}
|
302 |
+
$filters = $parsedFilters;
|
303 |
+
}
|
304 |
+
// make sure that method result is always array
|
305 |
+
if (!is_array($filters)) {
|
306 |
+
$filters = array();
|
307 |
+
}
|
308 |
+
// apply fields mapping
|
309 |
+
if (isset($fieldsMap) && is_array($fieldsMap)) {
|
310 |
+
foreach ($filters as $field => $value) {
|
311 |
+
if (isset($fieldsMap[$field])) {
|
312 |
+
unset($filters[$field]);
|
313 |
+
$field = $fieldsMap[$field];
|
314 |
+
$filters[$field] = $value;
|
315 |
+
}
|
316 |
+
}
|
317 |
+
}
|
318 |
+
return $filters;
|
319 |
+
}
|
320 |
+
|
321 |
+
/**
|
322 |
+
* Convert condition value from the string into the array
|
323 |
+
* for the condition operators that require value to be an array.
|
324 |
+
* Condition value is changed by reference
|
325 |
+
*
|
326 |
+
* @param string $conditionOperator
|
327 |
+
* @param string $conditionValue
|
328 |
+
*/
|
329 |
+
public function formatFilterConditionValue($conditionOperator, &$conditionValue)
|
330 |
+
{
|
331 |
+
if (is_string($conditionOperator) && in_array($conditionOperator, array('in', 'nin', 'finset'))
|
332 |
+
&& is_string($conditionValue)
|
333 |
+
) {
|
334 |
+
$delimiter = ',';
|
335 |
+
$conditionValue = explode($delimiter, $conditionValue);
|
336 |
+
}
|
337 |
+
}
|
338 |
+
}
|
app/code/core/Mage/Api/etc/wsdl2.xml
CHANGED
@@ -31,12 +31,6 @@
|
|
31 |
</restriction>
|
32 |
</complexContent>
|
33 |
</complexType>
|
34 |
-
<complexType name="associativeAnyTypeEntity">
|
35 |
-
<all>
|
36 |
-
<element name="key" type="xsd:string" />
|
37 |
-
<element name="value" type="typens:anyType" />
|
38 |
-
</all>
|
39 |
-
</complexType>
|
40 |
<complexType name="filters">
|
41 |
<all>
|
42 |
<element name="filter" type="typens:associativeArray" minOccurs="0" />
|
@@ -53,7 +47,7 @@
|
|
53 |
<complexType name="complexFilter">
|
54 |
<all>
|
55 |
<element name="key" type="xsd:string" />
|
56 |
-
<element name="value" type="typens:
|
57 |
</all>
|
58 |
</complexType>
|
59 |
<complexType name="ArrayOfString">
|
31 |
</restriction>
|
32 |
</complexContent>
|
33 |
</complexType>
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
<complexType name="filters">
|
35 |
<all>
|
36 |
<element name="filter" type="typens:associativeArray" minOccurs="0" />
|
47 |
<complexType name="complexFilter">
|
48 |
<all>
|
49 |
<element name="key" type="xsd:string" />
|
50 |
+
<element name="value" type="typens:associativeEntity" />
|
51 |
</all>
|
52 |
</complexType>
|
53 |
<complexType name="ArrayOfString">
|
app/code/core/Mage/Api/etc/wsi.xml
CHANGED
@@ -33,7 +33,7 @@
|
|
33 |
<xsd:complexType name="complexFilter">
|
34 |
<xsd:sequence>
|
35 |
<xsd:element name="key" type="xsd:string" />
|
36 |
-
<xsd:element name="value" type="typens:
|
37 |
</xsd:sequence>
|
38 |
</xsd:complexType>
|
39 |
<xsd:complexType name="complexFilterArray">
|
33 |
<xsd:complexType name="complexFilter">
|
34 |
<xsd:sequence>
|
35 |
<xsd:element name="key" type="xsd:string" />
|
36 |
+
<xsd:element name="value" type="typens:associativeEntity" />
|
37 |
</xsd:sequence>
|
38 |
</xsd:complexType>
|
39 |
<xsd:complexType name="complexFilterArray">
|
app/code/core/Mage/Api2/Model/Request/Interpreter/Xml.php
CHANGED
@@ -61,9 +61,13 @@ class Mage_Api2_Model_Request_Interpreter_Xml implements Mage_Api2_Model_Request
|
|
61 |
}
|
62 |
$body = false !== strpos($body, '<?xml') ? $body : '<?xml version="1.0"?>' . PHP_EOL . $body;
|
63 |
|
|
|
|
|
64 |
set_error_handler(array($this, '_loadErrorHandler')); // Warnings and errors are suppressed
|
65 |
$config = simplexml_load_string($body);
|
66 |
restore_error_handler();
|
|
|
|
|
67 |
|
68 |
// Check if there was a error while loading file
|
69 |
if ($this->_loadErrorStr !== null) {
|
61 |
}
|
62 |
$body = false !== strpos($body, '<?xml') ? $body : '<?xml version="1.0"?>' . PHP_EOL . $body;
|
63 |
|
64 |
+
// disable external entity loading to prevent possible vulnerability
|
65 |
+
libxml_disable_entity_loader(true);
|
66 |
set_error_handler(array($this, '_loadErrorHandler')); // Warnings and errors are suppressed
|
67 |
$config = simplexml_load_string($body);
|
68 |
restore_error_handler();
|
69 |
+
// restore default behavior to make possible to load external entities
|
70 |
+
libxml_disable_entity_loader(false);
|
71 |
|
72 |
// Check if there was a error while loading file
|
73 |
if ($this->_loadErrorStr !== null) {
|
app/code/core/Mage/Authorizenet/etc/system.xml
CHANGED
@@ -32,7 +32,7 @@
|
|
32 |
<authorizenet_directpost translate="label" module="authorizenet">
|
33 |
<label>Authorize.net Direct Post</label>
|
34 |
<frontend_type>text</frontend_type>
|
35 |
-
<sort_order>
|
36 |
<show_in_default>1</show_in_default>
|
37 |
<show_in_website>1</show_in_website>
|
38 |
<show_in_store>1</show_in_store>
|
32 |
<authorizenet_directpost translate="label" module="authorizenet">
|
33 |
<label>Authorize.net Direct Post</label>
|
34 |
<frontend_type>text</frontend_type>
|
35 |
+
<sort_order>34</sort_order>
|
36 |
<show_in_default>1</show_in_default>
|
37 |
<show_in_website>1</show_in_website>
|
38 |
<show_in_store>1</show_in_store>
|
app/code/core/Mage/Catalog/Model/Product/Api.php
CHANGED
@@ -83,7 +83,7 @@ class Mage_Catalog_Model_Product_Api extends Mage_Catalog_Model_Api_Resource
|
|
83 |
/**
|
84 |
* Retrieve list of products with basic info (id, sku, type, set, name)
|
85 |
*
|
86 |
-
* @param array $filters
|
87 |
* @param string|int $store
|
88 |
* @return array
|
89 |
*/
|
@@ -93,34 +93,28 @@ class Mage_Catalog_Model_Product_Api extends Mage_Catalog_Model_Api_Resource
|
|
93 |
->addStoreFilter($this->_getStoreId($store))
|
94 |
->addAttributeToSelect('name');
|
95 |
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
$collection->addFieldToFilter($field, $value);
|
104 |
-
}
|
105 |
-
} catch (Mage_Core_Exception $e) {
|
106 |
-
$this->_fault('filters_invalid', $e->getMessage());
|
107 |
}
|
|
|
|
|
108 |
}
|
109 |
-
|
110 |
$result = array();
|
111 |
-
|
112 |
foreach ($collection as $product) {
|
113 |
-
|
114 |
-
$result[] = array( // Basic product data
|
115 |
'product_id' => $product->getId(),
|
116 |
'sku' => $product->getSku(),
|
117 |
'name' => $product->getName(),
|
118 |
'set' => $product->getAttributeSetId(),
|
119 |
'type' => $product->getTypeId(),
|
120 |
-
'category_ids'
|
|
|
121 |
);
|
122 |
}
|
123 |
-
|
124 |
return $result;
|
125 |
}
|
126 |
|
83 |
/**
|
84 |
* Retrieve list of products with basic info (id, sku, type, set, name)
|
85 |
*
|
86 |
+
* @param null|object|array $filters
|
87 |
* @param string|int $store
|
88 |
* @return array
|
89 |
*/
|
93 |
->addStoreFilter($this->_getStoreId($store))
|
94 |
->addAttributeToSelect('name');
|
95 |
|
96 |
+
/** @var $apiHelper Mage_Api_Helper_Data */
|
97 |
+
$apiHelper = Mage::helper('api');
|
98 |
+
$filters = $apiHelper->parseFilters($filters, $this->_filtersMap);
|
99 |
+
try {
|
100 |
+
foreach ($filters as $field => $value) {
|
101 |
+
$collection->addFieldToFilter($field, $value);
|
|
|
|
|
|
|
|
|
|
|
102 |
}
|
103 |
+
} catch (Mage_Core_Exception $e) {
|
104 |
+
$this->_fault('filters_invalid', $e->getMessage());
|
105 |
}
|
|
|
106 |
$result = array();
|
|
|
107 |
foreach ($collection as $product) {
|
108 |
+
$result[] = array(
|
|
|
109 |
'product_id' => $product->getId(),
|
110 |
'sku' => $product->getSku(),
|
111 |
'name' => $product->getName(),
|
112 |
'set' => $product->getAttributeSetId(),
|
113 |
'type' => $product->getTypeId(),
|
114 |
+
'category_ids' => $product->getCategoryIds(),
|
115 |
+
'website_ids' => $product->getWebsiteIds()
|
116 |
);
|
117 |
}
|
|
|
118 |
return $result;
|
119 |
}
|
120 |
|
app/code/core/Mage/Catalog/Model/Product/Api/V2.php
CHANGED
@@ -33,66 +33,6 @@
|
|
33 |
*/
|
34 |
class Mage_Catalog_Model_Product_Api_V2 extends Mage_Catalog_Model_Product_Api
|
35 |
{
|
36 |
-
|
37 |
-
/**
|
38 |
-
* Retrieve list of products with basic info (id, sku, type, set, name)
|
39 |
-
*
|
40 |
-
* @param array $filters
|
41 |
-
* @param string|int $store
|
42 |
-
* @return array
|
43 |
-
*/
|
44 |
-
public function items($filters = null, $store = null)
|
45 |
-
{
|
46 |
-
$collection = Mage::getModel('catalog/product')->getCollection()
|
47 |
-
->addStoreFilter($this->_getStoreId($store))
|
48 |
-
->addAttributeToSelect('name');
|
49 |
-
|
50 |
-
$preparedFilters = array();
|
51 |
-
if (isset($filters->filter)) {
|
52 |
-
foreach ($filters->filter as $_filter) {
|
53 |
-
$preparedFilters[$_filter->key] = $_filter->value;
|
54 |
-
}
|
55 |
-
}
|
56 |
-
if (isset($filters->complex_filter)) {
|
57 |
-
foreach ($filters->complex_filter as $_filter) {
|
58 |
-
$_value = $_filter->value;
|
59 |
-
$preparedFilters[$_filter->key] = array(
|
60 |
-
$_value->key => $_value->value
|
61 |
-
);
|
62 |
-
}
|
63 |
-
}
|
64 |
-
|
65 |
-
if (!empty($preparedFilters)) {
|
66 |
-
try {
|
67 |
-
foreach ($preparedFilters as $field => $value) {
|
68 |
-
if (isset($this->_filtersMap[$field])) {
|
69 |
-
$field = $this->_filtersMap[$field];
|
70 |
-
}
|
71 |
-
|
72 |
-
$collection->addFieldToFilter($field, $value);
|
73 |
-
}
|
74 |
-
} catch (Mage_Core_Exception $e) {
|
75 |
-
$this->_fault('filters_invalid', $e->getMessage());
|
76 |
-
}
|
77 |
-
}
|
78 |
-
|
79 |
-
$result = array();
|
80 |
-
|
81 |
-
foreach ($collection as $product) {
|
82 |
-
$result[] = array(
|
83 |
-
'product_id' => $product->getId(),
|
84 |
-
'sku' => $product->getSku(),
|
85 |
-
'name' => $product->getName(),
|
86 |
-
'set' => $product->getAttributeSetId(),
|
87 |
-
'type' => $product->getTypeId(),
|
88 |
-
'category_ids' => $product->getCategoryIds(),
|
89 |
-
'website_ids' => $product->getWebsiteIds()
|
90 |
-
);
|
91 |
-
}
|
92 |
-
|
93 |
-
return $result;
|
94 |
-
}
|
95 |
-
|
96 |
/**
|
97 |
* Retrieve product info
|
98 |
*
|
33 |
*/
|
34 |
class Mage_Catalog_Model_Product_Api_V2 extends Mage_Catalog_Model_Product_Api
|
35 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
/**
|
37 |
* Retrieve product info
|
38 |
*
|
app/code/core/Mage/Customer/Model/Customer/Api.php
CHANGED
@@ -107,45 +107,36 @@ class Mage_Customer_Model_Customer_Api extends Mage_Customer_Model_Api_Resource
|
|
107 |
}
|
108 |
|
109 |
/**
|
110 |
-
* Retrieve
|
111 |
*
|
112 |
-
* @param array $filters
|
113 |
* @return array
|
114 |
*/
|
115 |
public function items($filters)
|
116 |
{
|
117 |
-
$collection = Mage::getModel('customer/customer')->getCollection
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
$field = $this->_mapAttributes[$field];
|
125 |
-
}
|
126 |
-
|
127 |
-
$collection->addFieldToFilter($field, $value);
|
128 |
-
}
|
129 |
-
} catch (Mage_Core_Exception $e) {
|
130 |
-
$this->_fault('filters_invalid', $e->getMessage());
|
131 |
}
|
|
|
|
|
132 |
}
|
133 |
-
|
134 |
$result = array();
|
135 |
foreach ($collection as $customer) {
|
136 |
$data = $customer->toArray();
|
137 |
$row = array();
|
138 |
-
|
139 |
foreach ($this->_mapAttributes as $attributeAlias => $attributeCode) {
|
140 |
$row[$attributeAlias] = (isset($data[$attributeCode]) ? $data[$attributeCode] : null);
|
141 |
}
|
142 |
-
|
143 |
foreach ($this->getAllowedAttributes($customer) as $attributeCode => $attribute) {
|
144 |
if (isset($data[$attributeCode])) {
|
145 |
$row[$attributeCode] = $data[$attributeCode];
|
146 |
}
|
147 |
}
|
148 |
-
|
149 |
$result[] = $row;
|
150 |
}
|
151 |
|
@@ -162,7 +153,7 @@ class Mage_Customer_Model_Customer_Api extends Mage_Customer_Model_Api_Resource
|
|
162 |
public function update($customerId, $customerData)
|
163 |
{
|
164 |
$customerData = $this->_prepareData($customerData);
|
165 |
-
|
166 |
$customer = Mage::getModel('customer/customer')->load($customerId);
|
167 |
|
168 |
if (!$customer->getId()) {
|
107 |
}
|
108 |
|
109 |
/**
|
110 |
+
* Retrieve customers data
|
111 |
*
|
112 |
+
* @param object|array $filters
|
113 |
* @return array
|
114 |
*/
|
115 |
public function items($filters)
|
116 |
{
|
117 |
+
$collection = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('*');
|
118 |
+
/** @var $apiHelper Mage_Api_Helper_Data */
|
119 |
+
$apiHelper = Mage::helper('api');
|
120 |
+
$filters = $apiHelper->parseFilters($filters, $this->_mapAttributes);
|
121 |
+
try {
|
122 |
+
foreach ($filters as $field => $value) {
|
123 |
+
$collection->addFieldToFilter($field, $value);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
}
|
125 |
+
} catch (Mage_Core_Exception $e) {
|
126 |
+
$this->_fault('filters_invalid', $e->getMessage());
|
127 |
}
|
|
|
128 |
$result = array();
|
129 |
foreach ($collection as $customer) {
|
130 |
$data = $customer->toArray();
|
131 |
$row = array();
|
|
|
132 |
foreach ($this->_mapAttributes as $attributeAlias => $attributeCode) {
|
133 |
$row[$attributeAlias] = (isset($data[$attributeCode]) ? $data[$attributeCode] : null);
|
134 |
}
|
|
|
135 |
foreach ($this->getAllowedAttributes($customer) as $attributeCode => $attribute) {
|
136 |
if (isset($data[$attributeCode])) {
|
137 |
$row[$attributeCode] = $data[$attributeCode];
|
138 |
}
|
139 |
}
|
|
|
140 |
$result[] = $row;
|
141 |
}
|
142 |
|
153 |
public function update($customerId, $customerData)
|
154 |
{
|
155 |
$customerData = $this->_prepareData($customerData);
|
156 |
+
|
157 |
$customer = Mage::getModel('customer/customer')->load($customerId);
|
158 |
|
159 |
if (!$customer->getId()) {
|
app/code/core/Mage/Customer/Model/Customer/Api/V2.php
CHANGED
@@ -47,64 +47,4 @@ class Mage_Customer_Model_Customer_Api_V2 extends Mage_Customer_Model_Customer_A
|
|
47 |
}
|
48 |
return array();
|
49 |
}
|
50 |
-
|
51 |
-
/**
|
52 |
-
* Retrieve cutomers data
|
53 |
-
*
|
54 |
-
* @param array $filters
|
55 |
-
* @return array
|
56 |
-
*/
|
57 |
-
public function items($filters)
|
58 |
-
{
|
59 |
-
$collection = Mage::getModel('customer/customer')->getCollection()
|
60 |
-
->addAttributeToSelect('*');
|
61 |
-
|
62 |
-
$preparedFilters = array();
|
63 |
-
if (isset($filters->filter)) {
|
64 |
-
foreach ($filters->filter as $_filter) {
|
65 |
-
$preparedFilters[$_filter->key] = $_filter->value;
|
66 |
-
}
|
67 |
-
}
|
68 |
-
if (isset($filters->complex_filter)) {
|
69 |
-
foreach ($filters->complex_filter as $_filter) {
|
70 |
-
$_value = $_filter->value;
|
71 |
-
$preparedFilters[$_filter->key] = array(
|
72 |
-
$_value->key => $_value->value
|
73 |
-
);
|
74 |
-
}
|
75 |
-
}
|
76 |
-
|
77 |
-
if (!empty($preparedFilters)) {
|
78 |
-
try {
|
79 |
-
foreach ($preparedFilters as $field => $value) {
|
80 |
-
if (isset($this->_mapAttributes[$field])) {
|
81 |
-
$field = $this->_mapAttributes[$field];
|
82 |
-
}
|
83 |
-
$collection->addFieldToFilter($field, $value);
|
84 |
-
}
|
85 |
-
} catch (Mage_Core_Exception $e) {
|
86 |
-
$this->_fault('filters_invalid', $e->getMessage());
|
87 |
-
}
|
88 |
-
}
|
89 |
-
|
90 |
-
$result = array();
|
91 |
-
foreach ($collection as $customer) {
|
92 |
-
$data = $customer->toArray();
|
93 |
-
$row = array();
|
94 |
-
|
95 |
-
foreach ($this->_mapAttributes as $attributeAlias => $attributeCode) {
|
96 |
-
$row[$attributeAlias] = (isset($data[$attributeCode]) ? $data[$attributeCode] : null);
|
97 |
-
}
|
98 |
-
|
99 |
-
foreach ($this->getAllowedAttributes($customer) as $attributeCode => $attribute) {
|
100 |
-
if (isset($data[$attributeCode])) {
|
101 |
-
$row[$attributeCode] = $data[$attributeCode];
|
102 |
-
}
|
103 |
-
}
|
104 |
-
|
105 |
-
$result[] = $row;
|
106 |
-
}
|
107 |
-
|
108 |
-
return $result;
|
109 |
-
}
|
110 |
}
|
47 |
}
|
48 |
return array();
|
49 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
}
|
app/code/core/Mage/Install/Model/Installer/Console.php
CHANGED
@@ -392,7 +392,9 @@ class Mage_Install_Model_Installer_Console extends Mage_Install_Model_Installer_
|
|
392 |
/**
|
393 |
* Prepare encryption key and validate it
|
394 |
*/
|
395 |
-
$encryptionKey = empty($this->_args['encryption_key'])
|
|
|
|
|
396 |
$this->_getDataModel()->setEncryptionKey($encryptionKey);
|
397 |
$installer->validateEncryptionKey($encryptionKey);
|
398 |
|
392 |
/**
|
393 |
* Prepare encryption key and validate it
|
394 |
*/
|
395 |
+
$encryptionKey = empty($this->_args['encryption_key'])
|
396 |
+
? md5(Mage::helper('core')->getRandomString(10))
|
397 |
+
: $this->_args['encryption_key'];
|
398 |
$this->_getDataModel()->setEncryptionKey($encryptionKey);
|
399 |
$installer->validateEncryptionKey($encryptionKey);
|
400 |
|
app/code/core/Mage/Paygate/etc/system.xml
CHANGED
@@ -32,7 +32,7 @@
|
|
32 |
<authorizenet translate="label" module="paygate">
|
33 |
<label>Authorize.net</label>
|
34 |
<frontend_type>text</frontend_type>
|
35 |
-
<sort_order>
|
36 |
<show_in_default>1</show_in_default>
|
37 |
<show_in_website>1</show_in_website>
|
38 |
<show_in_store>1</show_in_store>
|
32 |
<authorizenet translate="label" module="paygate">
|
33 |
<label>Authorize.net</label>
|
34 |
<frontend_type>text</frontend_type>
|
35 |
+
<sort_order>34</sort_order>
|
36 |
<show_in_default>1</show_in_default>
|
37 |
<show_in_website>1</show_in_website>
|
38 |
<show_in_store>1</show_in_store>
|
app/code/core/Mage/Payment/etc/system.xml
CHANGED
@@ -39,7 +39,7 @@
|
|
39 |
<ccsave translate="label">
|
40 |
<label>Saved CC</label>
|
41 |
<frontend_type>text</frontend_type>
|
42 |
-
<sort_order>
|
43 |
<show_in_default>1</show_in_default>
|
44 |
<show_in_website>1</show_in_website>
|
45 |
<show_in_store>1</show_in_store>
|
@@ -173,7 +173,7 @@
|
|
173 |
<checkmo translate="label">
|
174 |
<label>Check / Money Order</label>
|
175 |
<frontend_type>text</frontend_type>
|
176 |
-
<sort_order>
|
177 |
<show_in_default>1</show_in_default>
|
178 |
<show_in_website>1</show_in_website>
|
179 |
<show_in_store>1</show_in_store>
|
@@ -270,7 +270,7 @@
|
|
270 |
<free translate="label">
|
271 |
<label>Zero Subtotal Checkout</label>
|
272 |
<frontend_type>text</frontend_type>
|
273 |
-
<sort_order>
|
274 |
<show_in_default>1</show_in_default>
|
275 |
<show_in_website>1</show_in_website>
|
276 |
<show_in_store>1</show_in_store>
|
@@ -366,7 +366,7 @@
|
|
366 |
<purchaseorder translate="label">
|
367 |
<label>Purchase Order</label>
|
368 |
<frontend_type>text</frontend_type>
|
369 |
-
<sort_order>
|
370 |
<show_in_default>1</show_in_default>
|
371 |
<show_in_website>1</show_in_website>
|
372 |
<show_in_store>1</show_in_store>
|
@@ -448,7 +448,7 @@
|
|
448 |
<banktransfer translate="label">
|
449 |
<label>Bank Transfer Payment</label>
|
450 |
<frontend_type>text</frontend_type>
|
451 |
-
<sort_order>
|
452 |
<show_in_default>1</show_in_default>
|
453 |
<show_in_website>1</show_in_website>
|
454 |
<show_in_store>1</show_in_store>
|
@@ -535,7 +535,7 @@
|
|
535 |
<cashondelivery translate="label">
|
536 |
<label>Cash On Delivery Payment</label>
|
537 |
<frontend_type>text</frontend_type>
|
538 |
-
<sort_order>
|
539 |
<show_in_default>1</show_in_default>
|
540 |
<show_in_website>1</show_in_website>
|
541 |
<show_in_store>1</show_in_store>
|
39 |
<ccsave translate="label">
|
40 |
<label>Saved CC</label>
|
41 |
<frontend_type>text</frontend_type>
|
42 |
+
<sort_order>27</sort_order>
|
43 |
<show_in_default>1</show_in_default>
|
44 |
<show_in_website>1</show_in_website>
|
45 |
<show_in_store>1</show_in_store>
|
173 |
<checkmo translate="label">
|
174 |
<label>Check / Money Order</label>
|
175 |
<frontend_type>text</frontend_type>
|
176 |
+
<sort_order>30</sort_order>
|
177 |
<show_in_default>1</show_in_default>
|
178 |
<show_in_website>1</show_in_website>
|
179 |
<show_in_store>1</show_in_store>
|
270 |
<free translate="label">
|
271 |
<label>Zero Subtotal Checkout</label>
|
272 |
<frontend_type>text</frontend_type>
|
273 |
+
<sort_order>30</sort_order>
|
274 |
<show_in_default>1</show_in_default>
|
275 |
<show_in_website>1</show_in_website>
|
276 |
<show_in_store>1</show_in_store>
|
366 |
<purchaseorder translate="label">
|
367 |
<label>Purchase Order</label>
|
368 |
<frontend_type>text</frontend_type>
|
369 |
+
<sort_order>32</sort_order>
|
370 |
<show_in_default>1</show_in_default>
|
371 |
<show_in_website>1</show_in_website>
|
372 |
<show_in_store>1</show_in_store>
|
448 |
<banktransfer translate="label">
|
449 |
<label>Bank Transfer Payment</label>
|
450 |
<frontend_type>text</frontend_type>
|
451 |
+
<sort_order>30</sort_order>
|
452 |
<show_in_default>1</show_in_default>
|
453 |
<show_in_website>1</show_in_website>
|
454 |
<show_in_store>1</show_in_store>
|
535 |
<cashondelivery translate="label">
|
536 |
<label>Cash On Delivery Payment</label>
|
537 |
<frontend_type>text</frontend_type>
|
538 |
+
<sort_order>30</sort_order>
|
539 |
<show_in_default>1</show_in_default>
|
540 |
<show_in_website>1</show_in_website>
|
541 |
<show_in_store>1</show_in_store>
|
app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Field/Country.php
ADDED
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Paypal
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Field renderer for PayPal merchant country selector
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_Paypal
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_Paypal_Block_Adminhtml_System_Config_Field_Country
|
35 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
36 |
+
{
|
37 |
+
/**#@+
|
38 |
+
*
|
39 |
+
* Request parameters names
|
40 |
+
*/
|
41 |
+
const REQUEST_PARAM_COUNTRY = 'country';
|
42 |
+
const REQUEST_PARAM_DEFAULT = 'default_country';
|
43 |
+
/**#@-*/
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Country of default scope
|
47 |
+
*
|
48 |
+
* @var string
|
49 |
+
*/
|
50 |
+
protected $_defaultCountry;
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Render country field considering request parameter
|
54 |
+
*
|
55 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
56 |
+
* @return string
|
57 |
+
*/
|
58 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
59 |
+
{
|
60 |
+
$country = $this->getRequest()->getParam(self::REQUEST_PARAM_COUNTRY);
|
61 |
+
if ($country) {
|
62 |
+
$element->setValue($country);
|
63 |
+
}
|
64 |
+
|
65 |
+
if ($element->getCanUseDefaultValue()) {
|
66 |
+
$defaultConfigNode = Mage::getConfig()->getNode(null, 'default');
|
67 |
+
if ($defaultConfigNode) {
|
68 |
+
$this->_defaultCountry = (string)$defaultConfigNode->descend('paypal/general/merchant_country');
|
69 |
+
}
|
70 |
+
if (!$this->_defaultCountry) {
|
71 |
+
$this->_defaultCountry = Mage::helper('core')->getDefaultCountry();
|
72 |
+
}
|
73 |
+
if ($country) {
|
74 |
+
$shouldInherit = $country == $this->_defaultCountry
|
75 |
+
&& $this->getRequest()->getParam(self::REQUEST_PARAM_DEFAULT);
|
76 |
+
$element->setInherit($shouldInherit);
|
77 |
+
}
|
78 |
+
if ($element->getInherit()) {
|
79 |
+
$this->_defaultCountry = null;
|
80 |
+
}
|
81 |
+
}
|
82 |
+
|
83 |
+
return parent::render($element);
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Get country selector html
|
88 |
+
*
|
89 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
90 |
+
* @return string
|
91 |
+
*/
|
92 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
93 |
+
{
|
94 |
+
$configDataModel = Mage::getSingleton('adminhtml/config_data');
|
95 |
+
$urlParams = array(
|
96 |
+
'section' => $configDataModel->getSection(),
|
97 |
+
'website' => $configDataModel->getWebsite(),
|
98 |
+
'store' => $configDataModel->getStore(),
|
99 |
+
self::REQUEST_PARAM_COUNTRY => '__country__',
|
100 |
+
);
|
101 |
+
$urlString = $this->helper('core')
|
102 |
+
->jsQuoteEscape(Mage::getModel('adminhtml/url')->getUrl('*/*/*', $urlParams));
|
103 |
+
$jsString = '
|
104 |
+
$("' . $element->getHtmlId() . '").observe("change", function () {
|
105 |
+
location.href = \'' . $urlString . '\'.replace("__country__", this.value);
|
106 |
+
});
|
107 |
+
';
|
108 |
+
|
109 |
+
if ($this->_defaultCountry) {
|
110 |
+
$urlParams[self::REQUEST_PARAM_DEFAULT] = '__default__';
|
111 |
+
$urlString = $this->helper('core')
|
112 |
+
->jsQuoteEscape(Mage::getModel('adminhtml/url')->getUrl('*/*/*', $urlParams));
|
113 |
+
$jsParentCountry = $this->helper('core')->jsQuoteEscape($this->_defaultCountry);
|
114 |
+
$jsString .= '
|
115 |
+
$("' . $element->getHtmlId() . '_inherit").observe("click", function () {
|
116 |
+
if (this.checked) {
|
117 |
+
location.href = \'' . $urlString . '\'.replace("__country__", \'' . $jsParentCountry . '\')
|
118 |
+
.replace("__default__", "1");
|
119 |
+
}
|
120 |
+
});
|
121 |
+
';
|
122 |
+
}
|
123 |
+
|
124 |
+
return parent::_getElementHtml($element) . $this->helper('adminhtml/js')
|
125 |
+
->getScript('document.observe("dom:loaded", function() {' . $jsString . '});');
|
126 |
+
}
|
127 |
+
}
|
app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Field/Hidden.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Paypal
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Field renderer for hidden fields
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_Paypal
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_Paypal_Block_Adminhtml_System_Config_Field_Hidden
|
35 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Decorate field row html to be invisible
|
39 |
+
*
|
40 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
41 |
+
* @param string $html
|
42 |
+
* @return string
|
43 |
+
*/
|
44 |
+
protected function _decorateRowHtml($element, $html)
|
45 |
+
{
|
46 |
+
return '<tr id="row_' . $element->getHtmlId() . '" style="display: none;">' . $html . '</tr>';
|
47 |
+
}
|
48 |
+
}
|
app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Expanded.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Paypal
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Fielset renderer which expanded by default
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_Paypal
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Expanded
|
35 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Return collapse state
|
39 |
+
*
|
40 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
41 |
+
* @return bool
|
42 |
+
*/
|
43 |
+
protected function _getCollapseState($element)
|
44 |
+
{
|
45 |
+
$extra = Mage::getSingleton('admin/session')->getUser()->getExtra();
|
46 |
+
if (isset($extra['configState'][$element->getId()])) {
|
47 |
+
return $extra['configState'][$element->getId()];
|
48 |
+
}
|
49 |
+
|
50 |
+
return true;
|
51 |
+
}
|
52 |
+
}
|
app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Global.php
CHANGED
@@ -27,6 +27,7 @@
|
|
27 |
/**
|
28 |
* Fieldset renderer for PayPal global settings
|
29 |
* @author Magento Core Team <core@magentocommerce.com>
|
|
|
30 |
*/
|
31 |
class Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Global
|
32 |
extends Mage_Adminhtml_Block_Abstract
|
27 |
/**
|
28 |
* Fieldset renderer for PayPal global settings
|
29 |
* @author Magento Core Team <core@magentocommerce.com>
|
30 |
+
* @deprecated since 1.7.0.1
|
31 |
*/
|
32 |
class Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Global
|
33 |
extends Mage_Adminhtml_Block_Abstract
|
app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Group.php
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Paypal
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Fieldset renderer for PayPal solutions group
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_Paypal
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Group
|
35 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Return header comment part of html for fieldset
|
39 |
+
*
|
40 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
41 |
+
* @return string
|
42 |
+
*/
|
43 |
+
protected function _getHeaderCommentHtml($element)
|
44 |
+
{
|
45 |
+
$groupConfig = $this->getGroup($element)->asArray();
|
46 |
+
|
47 |
+
if (empty($groupConfig['help_url']) || !$element->getComment()) {
|
48 |
+
return parent::_getHeaderCommentHtml($element);
|
49 |
+
}
|
50 |
+
|
51 |
+
$html = '<div class="comment">' . $element->getComment()
|
52 |
+
. ' <a target="_blank" href="' . $groupConfig['help_url'] . '">'
|
53 |
+
. Mage::helper('paypal')->__('Help') . '</a></div>';
|
54 |
+
|
55 |
+
return $html;
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Return collapse state
|
60 |
+
*
|
61 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
62 |
+
* @return bool
|
63 |
+
*/
|
64 |
+
protected function _getCollapseState($element)
|
65 |
+
{
|
66 |
+
$extra = Mage::getSingleton('admin/session')->getUser()->getExtra();
|
67 |
+
if (isset($extra['configState'][$element->getId()])) {
|
68 |
+
return $extra['configState'][$element->getId()];
|
69 |
+
}
|
70 |
+
|
71 |
+
if ($element->getExpanded() !== null) {
|
72 |
+
return 1;
|
73 |
+
}
|
74 |
+
|
75 |
+
return false;
|
76 |
+
}
|
77 |
+
}
|
app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Hint.php
CHANGED
@@ -27,6 +27,7 @@
|
|
27 |
|
28 |
/**
|
29 |
* Renderer for PayPal banner in System Configuration
|
|
|
30 |
* @author Magento Core Team <core@magentocommerce.com>
|
31 |
*/
|
32 |
class Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Hint
|
@@ -43,6 +44,55 @@ class Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Hint
|
|
43 |
*/
|
44 |
public function render(Varien_Data_Form_Element_Abstract $element)
|
45 |
{
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
}
|
48 |
}
|
27 |
|
28 |
/**
|
29 |
* Renderer for PayPal banner in System Configuration
|
30 |
+
*
|
31 |
* @author Magento Core Team <core@magentocommerce.com>
|
32 |
*/
|
33 |
class Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Hint
|
44 |
*/
|
45 |
public function render(Varien_Data_Form_Element_Abstract $element)
|
46 |
{
|
47 |
+
$elementOriginalData = $element->getOriginalData();
|
48 |
+
if (isset($elementOriginalData['help_link'])) {
|
49 |
+
$this->setHelpLink($elementOriginalData['help_link']);
|
50 |
+
}
|
51 |
+
$js = '
|
52 |
+
paypalToggleSolution = function(id, url) {
|
53 |
+
var doScroll = false;
|
54 |
+
Fieldset.toggleCollapse(id, url);
|
55 |
+
if ($(this).hasClassName("open")) {
|
56 |
+
$(".with-button button.button").each(function(anotherButton) {
|
57 |
+
if (anotherButton != this && $(anotherButton).hasClassName("open")) {
|
58 |
+
$(anotherButton).click();
|
59 |
+
doScroll = true;
|
60 |
+
}
|
61 |
+
}.bind(this));
|
62 |
+
}
|
63 |
+
if (doScroll) {
|
64 |
+
var pos = Element.cumulativeOffset($(this));
|
65 |
+
window.scrollTo(pos[0], pos[1] - 45);
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
togglePaypalSolutionConfigureButton = function(button, enable) {
|
70 |
+
var $button = $(button);
|
71 |
+
$button.disabled = !enable;
|
72 |
+
if ($button.hasClassName("disabled") && enable) {
|
73 |
+
$button.removeClassName("disabled");
|
74 |
+
} else if (!$button.hasClassName("disabled") && !enable) {
|
75 |
+
$button.addClassName("disabled");
|
76 |
+
}
|
77 |
+
}
|
78 |
+
|
79 |
+
// check store-view disabling Express Checkout
|
80 |
+
document.observe("dom:loaded", function() {
|
81 |
+
var ecButton = $(".pp-method-express button.button")[0];
|
82 |
+
var ecEnabler = $(".paypal-ec-enabler")[0];
|
83 |
+
if (typeof ecButton == "undefined" || typeof ecEnabler != "undefined") {
|
84 |
+
return;
|
85 |
+
}
|
86 |
+
var $ecButton = $(ecButton);
|
87 |
+
$(".with-button button.button").each(function(configureButton) {
|
88 |
+
if (configureButton != ecButton && !configureButton.disabled
|
89 |
+
&& !$(configureButton).hasClassName("paypal-ec-separate")
|
90 |
+
) {
|
91 |
+
togglePaypalSolutionConfigureButton(ecButton, false);
|
92 |
+
}
|
93 |
+
});
|
94 |
+
});
|
95 |
+
';
|
96 |
+
return $this->toHtml() . $this->helper('adminhtml/js')->getScript($js);
|
97 |
}
|
98 |
}
|
app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Location.php
ADDED
@@ -0,0 +1,353 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Paypal
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Fieldset renderer for PayPal Merchant Location fieldset
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_Paypal
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Location
|
35 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Add conflicts resolution js code to the fieldset
|
39 |
+
*
|
40 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
41 |
+
* @param bool $tooltipsExist Init tooltips observer or not
|
42 |
+
* @return string
|
43 |
+
*/
|
44 |
+
protected function _getExtraJs($element, $tooltipsExist = false)
|
45 |
+
{
|
46 |
+
$js = '
|
47 |
+
document.observe("dom:loaded", function() {
|
48 |
+
$(".with-button button.button").each(function(configureButton) {
|
49 |
+
togglePaypalSolutionConfigureButton(configureButton, true);
|
50 |
+
});
|
51 |
+
var paypalConflictsObject = {
|
52 |
+
"isConflict": false,
|
53 |
+
"ecMissed": false,
|
54 |
+
sharePayflowEnabling: function(enabler, isEvent) {
|
55 |
+
var ecPayflowEnabler = $(".paypal-ec-payflow-enabler")[0];
|
56 |
+
if (typeof ecPayflowEnabler == "undefined") {
|
57 |
+
return;
|
58 |
+
}
|
59 |
+
var ecPayflowScopeElement = adminSystemConfig.getScopeElement(ecPayflowEnabler);
|
60 |
+
|
61 |
+
if (!enabler.enablerObject.ecPayflow) {
|
62 |
+
if ((!ecPayflowScopeElement || !ecPayflowScopeElement.checked) && isEvent
|
63 |
+
&& enabler.value == 1
|
64 |
+
) {
|
65 |
+
ecPayflowEnabler.value = 0;
|
66 |
+
fireEvent(ecPayflowEnabler, "change");
|
67 |
+
}
|
68 |
+
return;
|
69 |
+
}
|
70 |
+
|
71 |
+
var enablerScopeElement = adminSystemConfig.getScopeElement(enabler);
|
72 |
+
if (enablerScopeElement && ecPayflowScopeElement
|
73 |
+
&& enablerScopeElement.checked != ecPayflowScopeElement.checked
|
74 |
+
&& (isEvent || ecPayflowScopeElement.checked)
|
75 |
+
) {
|
76 |
+
$(ecPayflowScopeElement).click();
|
77 |
+
}
|
78 |
+
|
79 |
+
var ecEnabler = $(".paypal-ec-enabler")[0];
|
80 |
+
if (ecPayflowEnabler.value != enabler.value && (isEvent || enabler.value == 1)) {
|
81 |
+
ecPayflowEnabler.value = enabler.value;
|
82 |
+
fireEvent(ecPayflowEnabler, "change");
|
83 |
+
if (ecPayflowEnabler.value == 1) {
|
84 |
+
if (typeof ecEnabler != "undefined") {
|
85 |
+
var ecEnablerScopeElement = adminSystemConfig.getScopeElement(ecEnabler);
|
86 |
+
ecEnabler.value = 1;
|
87 |
+
if (ecEnablerScopeElement && ecEnablerScopeElement.checked) {
|
88 |
+
paypalConflictsObject.checklessEventAction(ecEnablerScopeElement, false);
|
89 |
+
}
|
90 |
+
paypalConflictsObject.checklessEventAction(ecEnabler, true);
|
91 |
+
}
|
92 |
+
}
|
93 |
+
}
|
94 |
+
if (!isEvent && ecPayflowEnabler.value == 1 && typeof ecEnabler != "undefined") {
|
95 |
+
var ecSolution = $(".pp-method-express")[0];
|
96 |
+
if (typeof ecSolution != "undefined" && !$(ecSolution).hasClassName("enabled")) {
|
97 |
+
ecSolution.addClassName("enabled");
|
98 |
+
}
|
99 |
+
}
|
100 |
+
},
|
101 |
+
onChangeEnabler: function(event) {
|
102 |
+
paypalConflictsObject.checkPaymentConflicts($(Event.element(event)), "change");
|
103 |
+
},
|
104 |
+
onClickEnablerScope: function(event) {
|
105 |
+
paypalConflictsObject.checkPaymentConflicts(
|
106 |
+
$(adminSystemConfig.getUpTr($(Event.element(event))).select(".paypal-enabler")[0]),
|
107 |
+
"click"
|
108 |
+
);
|
109 |
+
},
|
110 |
+
getSharedElements: function(element) {
|
111 |
+
var sharedElements = [];
|
112 |
+
adminSystemConfig.mapClasses(element, true, function(elementClassName) {
|
113 |
+
$("." + elementClassName).each(function(sharedElement) {
|
114 |
+
if (sharedElements.indexOf(sharedElement) == -1) {
|
115 |
+
sharedElements.push(sharedElement);
|
116 |
+
}
|
117 |
+
});
|
118 |
+
});
|
119 |
+
if (sharedElements.length == 0) {
|
120 |
+
sharedElements.push(element);
|
121 |
+
}
|
122 |
+
return sharedElements;
|
123 |
+
},
|
124 |
+
checklessEventAction: function(element, isChange) {
|
125 |
+
var action = isChange ? "change" : "click";
|
126 |
+
var handler = isChange
|
127 |
+
? paypalConflictsObject.onChangeEnabler
|
128 |
+
: paypalConflictsObject.onClickEnablerScope;
|
129 |
+
paypalConflictsObject.getSharedElements(element).each(function(sharedElement) {
|
130 |
+
Event.stopObserving(sharedElement, action, handler);
|
131 |
+
if (isChange) {
|
132 |
+
sharedElement.value = element.value;
|
133 |
+
if ($(sharedElement).requiresObj) {
|
134 |
+
$(sharedElement).requiresObj.indicateEnabled();
|
135 |
+
}
|
136 |
+
}
|
137 |
+
});
|
138 |
+
if (isChange) {
|
139 |
+
fireEvent(element, "change");
|
140 |
+
} else {
|
141 |
+
$(element).click();
|
142 |
+
}
|
143 |
+
paypalConflictsObject.getSharedElements(element).each(function(sharedElement) {
|
144 |
+
Event.observe(sharedElement, action, handler);
|
145 |
+
});
|
146 |
+
},
|
147 |
+
ecCheckAvailability: function() {
|
148 |
+
var ecButton = $(".pp-method-express button.button")[0];
|
149 |
+
if (typeof ecButton == "undefined") {
|
150 |
+
return;
|
151 |
+
}
|
152 |
+
var couldBeConfigured = true;
|
153 |
+
$(".paypal-enabler").each(function(enabler) {
|
154 |
+
if (enabler.enablerObject.ecEnabler || enabler.enablerObject.ecConflicts
|
155 |
+
|| enabler.enablerObject.ecSeparate
|
156 |
+
) {
|
157 |
+
return;
|
158 |
+
}
|
159 |
+
if (enabler.value == 1) {
|
160 |
+
couldBeConfigured = false;
|
161 |
+
}
|
162 |
+
});
|
163 |
+
if (couldBeConfigured) {
|
164 |
+
togglePaypalSolutionConfigureButton(ecButton, true);
|
165 |
+
} else {
|
166 |
+
togglePaypalSolutionConfigureButton(ecButton, false);
|
167 |
+
}
|
168 |
+
},
|
169 |
+
// type could be "initial", "change", "click"
|
170 |
+
checkPaymentConflicts: function(enabler, type) {
|
171 |
+
var isEvent = (type != "initial");
|
172 |
+
var ecEnabler = $(".paypal-ec-enabler")[0];
|
173 |
+
|
174 |
+
if (enabler.value == 0) {
|
175 |
+
if (!enabler.enablerObject.ecIndependent && type == "change") {
|
176 |
+
if (typeof ecEnabler != "undefined" && ecEnabler.value == 1) {
|
177 |
+
var ecEnablerScopeElement = adminSystemConfig.getScopeElement(ecEnabler);
|
178 |
+
if (!ecEnablerScopeElement || !ecEnablerScopeElement.checked) {
|
179 |
+
ecEnabler.value = 0;
|
180 |
+
paypalConflictsObject.checklessEventAction(ecEnabler, true);
|
181 |
+
}
|
182 |
+
}
|
183 |
+
}
|
184 |
+
paypalConflictsObject.ecCheckAvailability();
|
185 |
+
paypalConflictsObject.sharePayflowEnabling(enabler, isEvent);
|
186 |
+
return;
|
187 |
+
}
|
188 |
+
|
189 |
+
var confirmationApproved = isEvent;
|
190 |
+
var confirmationShowed = false;
|
191 |
+
// check other solutions
|
192 |
+
$(".paypal-enabler").each(function(anotherEnabler) {
|
193 |
+
var anotherEnablerScopeElement = adminSystemConfig.getScopeElement(anotherEnabler);
|
194 |
+
if (!confirmationApproved && isEvent || $(anotherEnabler) == enabler
|
195 |
+
|| anotherEnabler.value == 0
|
196 |
+
&& (!anotherEnablerScopeElement || !anotherEnablerScopeElement.checked)
|
197 |
+
) {
|
198 |
+
return;
|
199 |
+
}
|
200 |
+
var conflict = enabler.enablerObject.ecConflicts && anotherEnabler.enablerObject.ecEnabler
|
201 |
+
|| enabler.enablerObject.ecEnabler && anotherEnabler.enablerObject.ecConflicts
|
202 |
+
|| !enabler.enablerObject.ecIndependent && anotherEnabler.enablerObject.ecConflicts
|
203 |
+
|| !enabler.enablerObject.ecEnabler && !anotherEnabler.enablerObject.ecEnabler;
|
204 |
+
|
205 |
+
if (conflict && !confirmationShowed && anotherEnabler.value == 1) {
|
206 |
+
if (isEvent) {
|
207 |
+
confirmationApproved = confirm(\'' . $this->helper('core')->jsQuoteEscape($this->__('There is already another PayPal solution enabled. Enable this solution instead?')) . '\');
|
208 |
+
} else {
|
209 |
+
paypalConflictsObject.isConflict = true;
|
210 |
+
}
|
211 |
+
confirmationShowed = true;
|
212 |
+
}
|
213 |
+
if (conflict && confirmationApproved) {
|
214 |
+
anotherEnabler.value = 0;
|
215 |
+
if (anotherEnablerScopeElement && anotherEnablerScopeElement.checked && isEvent) {
|
216 |
+
paypalConflictsObject.checklessEventAction(anotherEnablerScopeElement, false);
|
217 |
+
}
|
218 |
+
paypalConflictsObject.checklessEventAction(anotherEnabler, true);
|
219 |
+
}
|
220 |
+
});
|
221 |
+
|
222 |
+
if (!enabler.enablerObject.ecIndependent) {
|
223 |
+
if (!isEvent && (typeof ecEnabler == "undefined" || ecEnabler.value == 0)) {
|
224 |
+
if (!enabler.enablerObject.ecPayflow) {
|
225 |
+
paypalConflictsObject.ecMissed = true;
|
226 |
+
}
|
227 |
+
} else if (isEvent && typeof ecEnabler != "undefined" && confirmationApproved) {
|
228 |
+
var ecEnablerScopeElement = adminSystemConfig.getScopeElement(ecEnabler);
|
229 |
+
if (ecEnablerScopeElement && ecEnablerScopeElement.checked) {
|
230 |
+
paypalConflictsObject.checklessEventAction(ecEnablerScopeElement, false);
|
231 |
+
}
|
232 |
+
if (ecEnabler.value == 0) {
|
233 |
+
ecEnabler.value = 1;
|
234 |
+
paypalConflictsObject.checklessEventAction(ecEnabler, true);
|
235 |
+
}
|
236 |
+
}
|
237 |
+
}
|
238 |
+
|
239 |
+
if (!confirmationApproved && isEvent) {
|
240 |
+
enabler.value = 0;
|
241 |
+
paypalConflictsObject.checklessEventAction(enabler, true);
|
242 |
+
}
|
243 |
+
paypalConflictsObject.ecCheckAvailability();
|
244 |
+
paypalConflictsObject.sharePayflowEnabling(enabler, isEvent);
|
245 |
+
}
|
246 |
+
};
|
247 |
+
|
248 |
+
// fill enablers with conflict data
|
249 |
+
$(".paypal-enabler").each(function(enablerElement) {
|
250 |
+
var enablerObj = {
|
251 |
+
ecIndependent: false,
|
252 |
+
ecConflicts: false,
|
253 |
+
ecEnabler: false,
|
254 |
+
ecSeparate: false,
|
255 |
+
ecPayflow: false
|
256 |
+
};
|
257 |
+
$(enablerElement).classNames().each(function(className) {
|
258 |
+
switch (className) {
|
259 |
+
case "paypal-ec-conflicts":
|
260 |
+
enablerObj.ecConflicts = true;
|
261 |
+
case "paypal-ec-independent":
|
262 |
+
enablerObj.ecIndependent = true;
|
263 |
+
break;
|
264 |
+
case "paypal-ec-enabler":
|
265 |
+
enablerObj.ecEnabler = true;
|
266 |
+
enablerObj.ecIndependent = true;
|
267 |
+
break;
|
268 |
+
case "paypal-ec-separate":
|
269 |
+
enablerObj.ecSeparate = true;
|
270 |
+
enablerObj.ecIndependent = true;
|
271 |
+
break;
|
272 |
+
case "paypal-ec-pe":
|
273 |
+
enablerObj.ecPayflow = true;
|
274 |
+
break;
|
275 |
+
}
|
276 |
+
});
|
277 |
+
enablerElement.enablerObject = enablerObj;
|
278 |
+
|
279 |
+
Event.observe(enablerElement, "change", paypalConflictsObject.onChangeEnabler);
|
280 |
+
var enablerScopeElement = adminSystemConfig.getScopeElement(enablerElement);
|
281 |
+
if (enablerScopeElement) {
|
282 |
+
Event.observe(enablerScopeElement, "click", paypalConflictsObject.onClickEnablerScope);
|
283 |
+
}
|
284 |
+
});
|
285 |
+
|
286 |
+
// initially uncheck payflow
|
287 |
+
var ecPayflowEnabler = $(".paypal-ec-payflow-enabler")[0];
|
288 |
+
if (typeof ecPayflowEnabler != "undefined") {
|
289 |
+
if (ecPayflowEnabler.value == 1) {
|
290 |
+
ecPayflowEnabler.value = 0;
|
291 |
+
fireEvent(ecPayflowEnabler, "change");
|
292 |
+
}
|
293 |
+
|
294 |
+
var ecPayflowScopeElement = adminSystemConfig.getScopeElement(ecPayflowEnabler);
|
295 |
+
if (ecPayflowScopeElement && !ecPayflowScopeElement.checked) {
|
296 |
+
$(ecPayflowScopeElement).click();
|
297 |
+
}
|
298 |
+
}
|
299 |
+
|
300 |
+
$(".paypal-enabler").each(function(enablerElement) {
|
301 |
+
paypalConflictsObject.checkPaymentConflicts(enablerElement, "initial");
|
302 |
+
});
|
303 |
+
if (paypalConflictsObject.isConflict || paypalConflictsObject.ecMissed) {
|
304 |
+
var notification = \'' . $this->helper('core')->jsQuoteEscape($this->__('The following error(s) occured:')) . '\';
|
305 |
+
if (paypalConflictsObject.isConflict) {
|
306 |
+
notification += "\\n " + \'' . $this->helper('core')->jsQuoteEscape($this->__('Some PayPal solutions conflict.')) . '\';
|
307 |
+
}
|
308 |
+
if (paypalConflictsObject.ecMissed) {
|
309 |
+
notification += "\\n " + \'' . $this->helper('core')->jsQuoteEscape($this->__('PayPal Express Checkout is not enabled.')) . '\';
|
310 |
+
}
|
311 |
+
notification += "\\n" + \'' . $this->helper('core')->jsQuoteEscape($this->__('Please re-enable the previously enabled payment solutions.')) . '\';
|
312 |
+
setTimeout(function() {
|
313 |
+
alert(notification);
|
314 |
+
}, 1);
|
315 |
+
}
|
316 |
+
|
317 |
+
$(".requires").each(function(dependent) {
|
318 |
+
var $dependent = $(dependent);
|
319 |
+
if ($dependent.hasClassName("paypal-ec-enabler")) {
|
320 |
+
$dependent.requiresObj.callback = function(required) {
|
321 |
+
if ($(required).hasClassName("paypal-enabler") && required.value == 0) {
|
322 |
+
$dependent.disable();
|
323 |
+
}
|
324 |
+
}
|
325 |
+
$dependent.requiresObj.requires.each(function(required) {
|
326 |
+
$dependent.requiresObj.callback(required);
|
327 |
+
});
|
328 |
+
}
|
329 |
+
});
|
330 |
+
|
331 |
+
var originalFormValidation = configForm.validator.options.onFormValidate;
|
332 |
+
configForm.validator.options.onFormValidate = function(result, form) {
|
333 |
+
originalFormValidation(result, form);
|
334 |
+
if (result) {
|
335 |
+
var ecPayflowEnabler = $(".paypal-ec-payflow-enabler")[0];
|
336 |
+
if (typeof ecPayflowEnabler == "undefined") {
|
337 |
+
return;
|
338 |
+
}
|
339 |
+
var ecPayflowScopeElement = adminSystemConfig.getScopeElement(ecPayflowEnabler);
|
340 |
+
if ((typeof ecPayflowScopeElement == "undefined" || !ecPayflowScopeElement.checked)
|
341 |
+
&& ecPayflowEnabler.value == 1
|
342 |
+
) {
|
343 |
+
$(".paypal-ec-enabler").each(function(ecEnabler) {
|
344 |
+
ecEnabler.value = 0;
|
345 |
+
});
|
346 |
+
}
|
347 |
+
}
|
348 |
+
}
|
349 |
+
});
|
350 |
+
';
|
351 |
+
return parent::_getExtraJs($element, $tooltipsExist) . $this->helper('adminhtml/js')->getScript($js);
|
352 |
+
}
|
353 |
+
}
|
app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Payment.php
ADDED
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Paypal
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Fieldset renderer for PayPal solution
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_Paypal
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Payment
|
35 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Add custom css class
|
39 |
+
*
|
40 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
41 |
+
* @return string
|
42 |
+
*/
|
43 |
+
protected function _getFrontendClass($element)
|
44 |
+
{
|
45 |
+
return parent::_getFrontendClass($element) . ' with-button '
|
46 |
+
. ($this->_isPaymentEnabled($element) ? ' enabled' : '');
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Check whether current payment method is enabled
|
51 |
+
*
|
52 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
53 |
+
* @return bool
|
54 |
+
*/
|
55 |
+
protected function _isPaymentEnabled($element)
|
56 |
+
{
|
57 |
+
$groupConfig = $this->getGroup($element)->asArray();
|
58 |
+
$activityPath = isset($groupConfig['activity_path']) ? $groupConfig['activity_path'] : '';
|
59 |
+
|
60 |
+
if (empty($activityPath)) {
|
61 |
+
return false;
|
62 |
+
}
|
63 |
+
|
64 |
+
$isPaymentEnabled = (string)Mage::getSingleton('adminhtml/config_data')->getConfigDataValue($activityPath);
|
65 |
+
|
66 |
+
return (bool)$isPaymentEnabled;
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Return header title part of html for payment solution
|
71 |
+
*
|
72 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
73 |
+
* @return string
|
74 |
+
*/
|
75 |
+
protected function _getHeaderTitleHtml($element)
|
76 |
+
{
|
77 |
+
$html = '<div class="config-heading" ><div class="heading"><strong>' . $element->getLegend();
|
78 |
+
|
79 |
+
$groupConfig = $this->getGroup($element)->asArray();
|
80 |
+
if (!empty($groupConfig['learn_more_link'])) {
|
81 |
+
$html .= '<a class="link-more" href="' . $groupConfig['learn_more_link'] . '" target="_blank">'
|
82 |
+
. $this->__('Learn More') . '</a>';
|
83 |
+
}
|
84 |
+
if (!empty($groupConfig['demo_link'])) {
|
85 |
+
$html .= '<a class="link-demo" href="' . $groupConfig['demo_link'] . '" target="_blank">'
|
86 |
+
. $this->__('View Demo') . '</a>';
|
87 |
+
}
|
88 |
+
$html .= '</strong>';
|
89 |
+
|
90 |
+
if ($element->getComment()) {
|
91 |
+
$html .= '<span class="heading-intro">' . $element->getComment() . '</span>';
|
92 |
+
}
|
93 |
+
$html .= '</div>';
|
94 |
+
|
95 |
+
$html .= '<div class="button-container"><button type="button"'
|
96 |
+
. ($this->_isPaymentEnabled($element) ? '' : ' disabled="disabled"') . ' class="button'
|
97 |
+
. (empty($groupConfig['paypal_ec_separate']) ? '' : ' paypal-ec-separate')
|
98 |
+
. ($this->_isPaymentEnabled($element) ? '' : ' disabled') . '" id="' . $element->getHtmlId()
|
99 |
+
. '-head" onclick="paypalToggleSolution.call(this, \'' . $element->getHtmlId() . '\', \''
|
100 |
+
. $this->getUrl('*/*/state') . '\'); return false;"><span class="state-closed">'
|
101 |
+
. $this->__('Configure') . '</span><span class="state-opened">'
|
102 |
+
. $this->__('Close') . '</span></button></div></div>';
|
103 |
+
|
104 |
+
return $html;
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Return header comment part of html for payment solution
|
109 |
+
*
|
110 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
111 |
+
* @return string
|
112 |
+
*/
|
113 |
+
protected function _getHeaderCommentHtml($element)
|
114 |
+
{
|
115 |
+
return '';
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Get collapsed state on-load
|
120 |
+
*
|
121 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
122 |
+
* @return bool
|
123 |
+
*/
|
124 |
+
protected function _getCollapseState($element)
|
125 |
+
{
|
126 |
+
return false;
|
127 |
+
}
|
128 |
+
}
|
app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Payflowlink/Advanced.php
CHANGED
@@ -25,7 +25,7 @@
|
|
25 |
*/
|
26 |
|
27 |
/**
|
28 |
-
* Renderer for
|
29 |
*
|
30 |
* @category Mage
|
31 |
* @package Mage_Paypal
|
25 |
*/
|
26 |
|
27 |
/**
|
28 |
+
* Renderer for Payments Advanced information
|
29 |
*
|
30 |
* @category Mage
|
31 |
* @package Mage_Paypal
|
app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Payflowlink/Info.php
CHANGED
@@ -32,8 +32,7 @@
|
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
class Mage_Paypal_Block_Adminhtml_System_Config_Payflowlink_Info
|
35 |
-
extends
|
36 |
-
implements Varien_Data_Form_Element_Renderer_Interface
|
37 |
{
|
38 |
/**
|
39 |
* Template path
|
@@ -50,12 +49,15 @@
|
|
50 |
*/
|
51 |
public function render(Varien_Data_Form_Element_Abstract $element)
|
52 |
{
|
53 |
-
|
|
|
54 |
}
|
55 |
|
|
|
56 |
/**
|
57 |
* Get frontend url
|
58 |
*
|
|
|
59 |
* @param string $routePath
|
60 |
* @return strting
|
61 |
*/
|
32 |
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
*/
|
34 |
class Mage_Paypal_Block_Adminhtml_System_Config_Payflowlink_Info
|
35 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
|
|
36 |
{
|
37 |
/**
|
38 |
* Template path
|
49 |
*/
|
50 |
public function render(Varien_Data_Form_Element_Abstract $element)
|
51 |
{
|
52 |
+
$columns = ($this->getRequest()->getParam('website') || $this->getRequest()->getParam('store')) ? 5 : 4;
|
53 |
+
return $this->_decorateRowHtml($element, "<td colspan='$columns'>" . $this->toHtml() . '</td>');
|
54 |
}
|
55 |
|
56 |
+
|
57 |
/**
|
58 |
* Get frontend url
|
59 |
*
|
60 |
+
* @deprecated since 1.7.0.1
|
61 |
* @param string $routePath
|
62 |
* @return strting
|
63 |
*/
|
app/code/core/Mage/Paypal/Model/Api/Nvp.php
CHANGED
@@ -940,7 +940,11 @@ class Mage_Paypal_Model_Api_Nvp extends Mage_Paypal_Model_Api_Abstract
|
|
940 |
|
941 |
try {
|
942 |
$http = new Varien_Http_Adapter_Curl();
|
943 |
-
$config = array
|
|
|
|
|
|
|
|
|
944 |
if ($this->getUseProxy()) {
|
945 |
$config['proxy'] = $this->getProxyHost(). ':' . $this->getProxyPort();
|
946 |
}
|
940 |
|
941 |
try {
|
942 |
$http = new Varien_Http_Adapter_Curl();
|
943 |
+
$config = array(
|
944 |
+
'timeout' => 30,
|
945 |
+
'verifypeer' => $this->_config->verifyPeer
|
946 |
+
);
|
947 |
+
|
948 |
if ($this->getUseProxy()) {
|
949 |
$config['proxy'] = $this->getProxyHost(). ':' . $this->getProxyPort();
|
950 |
}
|
app/code/core/Mage/Paypal/Model/Config.php
CHANGED
@@ -483,60 +483,74 @@ class Mage_Paypal_Model_Config
|
|
483 |
public function getCountryMethods($countryCode = null)
|
484 |
{
|
485 |
$countryMethods = array(
|
486 |
-
'
|
487 |
self::METHOD_WPS,
|
488 |
-
self::METHOD_WPP_DIRECT,
|
489 |
self::METHOD_WPP_EXPRESS,
|
490 |
self::METHOD_BILLING_AGREEMENT,
|
491 |
-
|
492 |
-
|
|
|
|
|
|
|
493 |
self::METHOD_PAYFLOWPRO,
|
494 |
self::METHOD_PAYFLOWLINK,
|
495 |
-
self::
|
|
|
|
|
496 |
),
|
497 |
'CA' => array(
|
498 |
-
self::METHOD_WPS,
|
499 |
self::METHOD_WPP_DIRECT,
|
500 |
-
self::
|
501 |
-
self::METHOD_BILLING_AGREEMENT,
|
502 |
self::METHOD_PAYFLOWPRO,
|
503 |
self::METHOD_PAYFLOWLINK,
|
|
|
|
|
504 |
),
|
505 |
'GB' => array(
|
506 |
-
self::METHOD_WPS,
|
507 |
self::METHOD_WPP_DIRECT,
|
|
|
|
|
|
|
508 |
self::METHOD_WPP_EXPRESS,
|
509 |
self::METHOD_BILLING_AGREEMENT,
|
510 |
-
self::METHOD_WPP_PE_DIRECT,
|
511 |
self::METHOD_WPP_PE_EXPRESS,
|
512 |
-
self::METHOD_HOSTEDPRO,
|
513 |
),
|
514 |
'AU' => array(
|
515 |
-
self::METHOD_WPS,
|
516 |
-
self::METHOD_WPP_EXPRESS,
|
517 |
-
self::METHOD_BILLING_AGREEMENT,
|
518 |
self::METHOD_PAYFLOWPRO,
|
519 |
self::METHOD_HOSTEDPRO,
|
|
|
|
|
520 |
),
|
521 |
'NZ' => array(
|
522 |
-
self::
|
523 |
self::METHOD_WPP_EXPRESS,
|
524 |
self::METHOD_BILLING_AGREEMENT,
|
525 |
-
|
|
|
526 |
self::METHOD_HOSTEDPRO,
|
|
|
|
|
527 |
),
|
528 |
-
'
|
529 |
-
self::
|
530 |
self::METHOD_WPP_EXPRESS,
|
531 |
self::METHOD_BILLING_AGREEMENT,
|
|
|
|
|
532 |
self::METHOD_HOSTEDPRO,
|
|
|
|
|
533 |
),
|
534 |
-
'
|
535 |
-
self::
|
536 |
self::METHOD_WPP_EXPRESS,
|
537 |
self::METHOD_BILLING_AGREEMENT,
|
|
|
|
|
538 |
self::METHOD_HOSTEDPRO,
|
539 |
-
|
|
|
|
|
540 |
);
|
541 |
if ($countryCode === null) {
|
542 |
return $countryMethods;
|
@@ -1358,6 +1372,7 @@ class Mage_Paypal_Model_Config
|
|
1358 |
case 'cctypes':
|
1359 |
case 'sort_order':
|
1360 |
case 'debug':
|
|
|
1361 |
return "payment/{$this->_methodCode}/{$fieldName}";
|
1362 |
default:
|
1363 |
return null;
|
483 |
public function getCountryMethods($countryCode = null)
|
484 |
{
|
485 |
$countryMethods = array(
|
486 |
+
'other' => array(
|
487 |
self::METHOD_WPS,
|
|
|
488 |
self::METHOD_WPP_EXPRESS,
|
489 |
self::METHOD_BILLING_AGREEMENT,
|
490 |
+
),
|
491 |
+
'US' => array(
|
492 |
+
self::METHOD_PAYFLOWADVANCED,
|
493 |
+
self::METHOD_WPP_DIRECT,
|
494 |
+
self::METHOD_WPS,
|
495 |
self::METHOD_PAYFLOWPRO,
|
496 |
self::METHOD_PAYFLOWLINK,
|
497 |
+
self::METHOD_WPP_EXPRESS,
|
498 |
+
self::METHOD_BILLING_AGREEMENT,
|
499 |
+
self::METHOD_WPP_PE_EXPRESS,
|
500 |
),
|
501 |
'CA' => array(
|
|
|
502 |
self::METHOD_WPP_DIRECT,
|
503 |
+
self::METHOD_WPS,
|
|
|
504 |
self::METHOD_PAYFLOWPRO,
|
505 |
self::METHOD_PAYFLOWLINK,
|
506 |
+
self::METHOD_WPP_EXPRESS,
|
507 |
+
self::METHOD_BILLING_AGREEMENT,
|
508 |
),
|
509 |
'GB' => array(
|
|
|
510 |
self::METHOD_WPP_DIRECT,
|
511 |
+
self::METHOD_WPS,
|
512 |
+
self::METHOD_WPP_PE_DIRECT,
|
513 |
+
self::METHOD_HOSTEDPRO,
|
514 |
self::METHOD_WPP_EXPRESS,
|
515 |
self::METHOD_BILLING_AGREEMENT,
|
|
|
516 |
self::METHOD_WPP_PE_EXPRESS,
|
|
|
517 |
),
|
518 |
'AU' => array(
|
|
|
|
|
|
|
519 |
self::METHOD_PAYFLOWPRO,
|
520 |
self::METHOD_HOSTEDPRO,
|
521 |
+
self::METHOD_WPP_EXPRESS,
|
522 |
+
self::METHOD_BILLING_AGREEMENT,
|
523 |
),
|
524 |
'NZ' => array(
|
525 |
+
self::METHOD_PAYFLOWPRO,
|
526 |
self::METHOD_WPP_EXPRESS,
|
527 |
self::METHOD_BILLING_AGREEMENT,
|
528 |
+
),
|
529 |
+
'JP' => array(
|
530 |
self::METHOD_HOSTEDPRO,
|
531 |
+
self::METHOD_WPP_EXPRESS,
|
532 |
+
self::METHOD_BILLING_AGREEMENT,
|
533 |
),
|
534 |
+
'FR' => array(
|
535 |
+
self::METHOD_HOSTEDPRO,
|
536 |
self::METHOD_WPP_EXPRESS,
|
537 |
self::METHOD_BILLING_AGREEMENT,
|
538 |
+
),
|
539 |
+
'IT' => array(
|
540 |
self::METHOD_HOSTEDPRO,
|
541 |
+
self::METHOD_WPP_EXPRESS,
|
542 |
+
self::METHOD_BILLING_AGREEMENT,
|
543 |
),
|
544 |
+
'ES' => array(
|
545 |
+
self::METHOD_HOSTEDPRO,
|
546 |
self::METHOD_WPP_EXPRESS,
|
547 |
self::METHOD_BILLING_AGREEMENT,
|
548 |
+
),
|
549 |
+
'HK' => array(
|
550 |
self::METHOD_HOSTEDPRO,
|
551 |
+
self::METHOD_WPP_EXPRESS,
|
552 |
+
self::METHOD_BILLING_AGREEMENT,
|
553 |
+
),
|
554 |
);
|
555 |
if ($countryCode === null) {
|
556 |
return $countryMethods;
|
1372 |
case 'cctypes':
|
1373 |
case 'sort_order':
|
1374 |
case 'debug':
|
1375 |
+
case 'verify_peer':
|
1376 |
return "payment/{$this->_methodCode}/{$fieldName}";
|
1377 |
default:
|
1378 |
return null;
|
app/code/core/Mage/Paypal/Model/Ipn.php
CHANGED
@@ -139,6 +139,7 @@ class Mage_Paypal_Model_Ipn
|
|
139 |
$this->_debugData['postback'] = $sReq;
|
140 |
$this->_debugData['postback_to'] = $this->_config->getPaypalUrl();
|
141 |
|
|
|
142 |
$httpAdapter->write(Zend_Http_Client::POST, $this->_config->getPaypalUrl(), '1.1', array(), $sReq);
|
143 |
try {
|
144 |
$response = $httpAdapter->read();
|
@@ -398,12 +399,13 @@ class Mage_Paypal_Model_Ipn
|
|
398 |
$this->_order->save();
|
399 |
|
400 |
// notify customer
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
|
|
407 |
}
|
408 |
}
|
409 |
|
139 |
$this->_debugData['postback'] = $sReq;
|
140 |
$this->_debugData['postback_to'] = $this->_config->getPaypalUrl();
|
141 |
|
142 |
+
$httpAdapter->setConfig(array('verifypeer' => $this->_config->verifyPeer));
|
143 |
$httpAdapter->write(Zend_Http_Client::POST, $this->_config->getPaypalUrl(), '1.1', array(), $sReq);
|
144 |
try {
|
145 |
$response = $httpAdapter->read();
|
399 |
$this->_order->save();
|
400 |
|
401 |
// notify customer
|
402 |
+
$invoice = $payment->getCreatedInvoice();
|
403 |
+
if ($invoice && !$this->_order->getEmailSent()) {
|
404 |
+
$this->_order->sendNewOrderEmail()->addStatusHistoryComment(
|
405 |
+
Mage::helper('paypal')->__('Notified customer about invoice #%s.', $invoice->getIncrementId())
|
406 |
+
)
|
407 |
+
->setIsCustomerNotified(true)
|
408 |
+
->save();
|
409 |
}
|
410 |
}
|
411 |
|
app/code/core/Mage/Paypal/Model/Observer.php
CHANGED
@@ -118,4 +118,42 @@ class Mage_Paypal_Model_Observer
|
|
118 |
|
119 |
return $this;
|
120 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
}
|
118 |
|
119 |
return $this;
|
120 |
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Load country dependent PayPal solutions system configuration
|
124 |
+
*
|
125 |
+
* @param Varien_Event_Observer $observer
|
126 |
+
* @return void
|
127 |
+
*/
|
128 |
+
public function loadCountryDependentSolutionsConfig(Varien_Event_Observer $observer)
|
129 |
+
{
|
130 |
+
$requestParam = Mage_Paypal_Block_Adminhtml_System_Config_Field_Country::REQUEST_PARAM_COUNTRY;
|
131 |
+
$countryCode = Mage::app()->getRequest()->getParam($requestParam);
|
132 |
+
if (is_null($countryCode) || preg_match('/^[a-zA-Z]{2}#x2F;', $countryCode) == 0) {
|
133 |
+
$countryCode = (string)Mage::getSingleton('adminhtml/config_data')
|
134 |
+
->getConfigDataValue('paypal/general/merchant_country');
|
135 |
+
}
|
136 |
+
if (empty($countryCode)) {
|
137 |
+
$countryCode = Mage::helper('core')->getDefaultCountry();
|
138 |
+
}
|
139 |
+
|
140 |
+
$paymentGroups = $observer->getEvent()->getConfig()->getNode('sections/payment/groups');
|
141 |
+
$paymentsConfigs = $paymentGroups->xpath('paypal_payments/*/backend_config/' . $countryCode);
|
142 |
+
if ($paymentsConfigs) {
|
143 |
+
foreach ($paymentsConfigs as $config) {
|
144 |
+
$parent = $config->getParent()->getParent();
|
145 |
+
$parent->extend($config, true);
|
146 |
+
}
|
147 |
+
}
|
148 |
+
|
149 |
+
$payments = $paymentGroups->xpath('paypal_payments/*');
|
150 |
+
foreach ($payments as $payment) {
|
151 |
+
if ((int)$payment->include) {
|
152 |
+
$fields = $paymentGroups->xpath((string)$payment->group . '/fields');
|
153 |
+
if (isset($fields[0])) {
|
154 |
+
$fields[0]->appendChild($payment, true);
|
155 |
+
}
|
156 |
+
}
|
157 |
+
}
|
158 |
+
}
|
159 |
}
|
app/code/core/Mage/Paypal/Model/Payflowadvanced.php
CHANGED
@@ -54,4 +54,11 @@ class Mage_Paypal_Model_Payflowadvanced extends Mage_Paypal_Model_Payflowlink
|
|
54 |
* @var string
|
55 |
*/
|
56 |
protected $_infoBlockType = 'paypal/payflow_advanced_info';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
}
|
54 |
* @var string
|
55 |
*/
|
56 |
protected $_infoBlockType = 'paypal/payflow_advanced_info';
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Controller for callback urls
|
60 |
+
*
|
61 |
+
* @var string
|
62 |
+
*/
|
63 |
+
protected $_callbackController = 'payflowadvanced';
|
64 |
}
|
app/code/core/Mage/Paypal/Model/Payflowlink.php
CHANGED
@@ -34,6 +34,47 @@
|
|
34 |
|
35 |
class Mage_Paypal_Model_Payflowlink extends Mage_Paypal_Model_Payflowpro
|
36 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
/**
|
38 |
* Payment method code
|
39 |
*/
|
@@ -158,6 +199,25 @@ class Mage_Paypal_Model_Payflowlink extends Mage_Paypal_Model_Payflowpro
|
|
158 |
foreach ($postData as $key => $val) {
|
159 |
$this->getResponse()->setData(strtolower($key), $val);
|
160 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
return $this;
|
162 |
}
|
163 |
|
@@ -175,8 +235,9 @@ class Mage_Paypal_Model_Payflowlink extends Mage_Paypal_Model_Payflowpro
|
|
175 |
$this->_debug($debugData);
|
176 |
|
177 |
$this->setResponseData($responseData);
|
|
|
178 |
|
179 |
-
if ($order
|
180 |
$this->_processOrder($order);
|
181 |
}
|
182 |
}
|
@@ -378,13 +439,25 @@ class Mage_Paypal_Model_Payflowlink extends Mage_Paypal_Model_Payflowpro
|
|
378 |
protected function _buildBasicRequest(Varien_Object $payment)
|
379 |
{
|
380 |
$request = Mage::getModel('paypal/payflow_request');
|
|
|
381 |
$request
|
382 |
->setUser($this->getConfigData('user', $this->_getStoreId()))
|
383 |
->setVendor($this->getConfigData('vendor', $this->_getStoreId()))
|
384 |
->setPartner($this->getConfigData('partner', $this->_getStoreId()))
|
385 |
->setPwd($this->getConfigData('pwd', $this->_getStoreId()))
|
386 |
->setVerbosity($this->getConfigData('verbosity', $this->_getStoreId()))
|
387 |
-
->setTender(self::TENDER_CC
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
388 |
return $request;
|
389 |
}
|
390 |
|
@@ -554,4 +627,41 @@ class Mage_Paypal_Model_Payflowlink extends Mage_Paypal_Model_Payflowpro
|
|
554 |
{
|
555 |
return null;
|
556 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
557 |
}
|
34 |
|
35 |
class Mage_Paypal_Model_Payflowlink extends Mage_Paypal_Model_Payflowpro
|
36 |
{
|
37 |
+
/**
|
38 |
+
* Default layout template
|
39 |
+
*/
|
40 |
+
const LAYOUT_TEMPLATE = 'minLayout';
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Controller for callback urls
|
44 |
+
*
|
45 |
+
* @var string
|
46 |
+
*/
|
47 |
+
protected $_callbackController = 'payflow';
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Response params mappings
|
51 |
+
*
|
52 |
+
* @var array
|
53 |
+
*/
|
54 |
+
protected $_responseParamsMappings = array(
|
55 |
+
'firstname' => 'billtofirstname',
|
56 |
+
'lastname' => 'billtolastname',
|
57 |
+
'address' => 'billtostreet',
|
58 |
+
'city' => 'billtocity',
|
59 |
+
'state' => 'billtostate',
|
60 |
+
'zip' => 'billtozip',
|
61 |
+
'country' => 'billtocountry',
|
62 |
+
'phone' => 'billtophone',
|
63 |
+
'email' => 'billtoemail',
|
64 |
+
'nametoship' => 'shiptofirstname',
|
65 |
+
'addresstoship' => 'shiptostreet',
|
66 |
+
'citytoship' => 'shiptocity',
|
67 |
+
'statetoship' => 'shiptostate',
|
68 |
+
'ziptoship' => 'shiptozip',
|
69 |
+
'countrytoship' => 'shiptocountry',
|
70 |
+
'phonetoship' => 'shiptophone',
|
71 |
+
'emailtoship' => 'shiptoemail',
|
72 |
+
'faxtoship' => 'shiptofax',
|
73 |
+
'method' => 'tender',
|
74 |
+
'cscmatch' => 'cvv2match',
|
75 |
+
'type' => 'trxtype',
|
76 |
+
);
|
77 |
+
|
78 |
/**
|
79 |
* Payment method code
|
80 |
*/
|
199 |
foreach ($postData as $key => $val) {
|
200 |
$this->getResponse()->setData(strtolower($key), $val);
|
201 |
}
|
202 |
+
foreach ($this->_responseParamsMappings as $originKey => $key) {
|
203 |
+
$data = $this->getResponse()->getData($key);
|
204 |
+
if (isset($data)) {
|
205 |
+
$this->getResponse()->setData($originKey, $data);
|
206 |
+
}
|
207 |
+
}
|
208 |
+
// process AVS data separately
|
209 |
+
$avsAddr = $this->getResponse()->getData('avsaddr');
|
210 |
+
$avsZip = $this->getResponse()->getData('avszip');
|
211 |
+
if (isset($avsAddr) && isset($avsZip)) {
|
212 |
+
$this->getResponse()->setData('avsdata', $avsAddr . $avsZip);
|
213 |
+
}
|
214 |
+
// process Name separately
|
215 |
+
$firstnameParameter = $this->getResponse()->getData('billtofirstname');
|
216 |
+
$lastnameParameter = $this->getResponse()->getData('billtolastname');
|
217 |
+
if (isset($firstnameParameter) && isset($lastnameParameter)) {
|
218 |
+
$this->getResponse()->setData('name', $firstnameParameter . ' ' . $lastnameParameter);
|
219 |
+
}
|
220 |
+
|
221 |
return $this;
|
222 |
}
|
223 |
|
235 |
$this->_debug($debugData);
|
236 |
|
237 |
$this->setResponseData($responseData);
|
238 |
+
$order = $this->_getOrderFromResponse();
|
239 |
|
240 |
+
if ($order) {
|
241 |
$this->_processOrder($order);
|
242 |
}
|
243 |
}
|
439 |
protected function _buildBasicRequest(Varien_Object $payment)
|
440 |
{
|
441 |
$request = Mage::getModel('paypal/payflow_request');
|
442 |
+
$cscEditable = $this->getConfigData('csc_editable');
|
443 |
$request
|
444 |
->setUser($this->getConfigData('user', $this->_getStoreId()))
|
445 |
->setVendor($this->getConfigData('vendor', $this->_getStoreId()))
|
446 |
->setPartner($this->getConfigData('partner', $this->_getStoreId()))
|
447 |
->setPwd($this->getConfigData('pwd', $this->_getStoreId()))
|
448 |
->setVerbosity($this->getConfigData('verbosity', $this->_getStoreId()))
|
449 |
+
->setTender(self::TENDER_CC)
|
450 |
+
->setCancelurl($this->_getCallbackUrl('cancelPayment'))
|
451 |
+
->setErrorurl($this->_getCallbackUrl('returnUrl'))
|
452 |
+
->setSilentpost('TRUE')
|
453 |
+
->setSilentposturl($this->_getCallbackUrl('silentPost'))
|
454 |
+
->setReturnurl($this->_getCallbackUrl('returnUrl'))
|
455 |
+
->setTemplate(self::LAYOUT_TEMPLATE)
|
456 |
+
->setDisablereceipt('TRUE')
|
457 |
+
->setCscrequired($cscEditable && $this->getConfigData('csc_required') ? 'TRUE' : 'FALSE')
|
458 |
+
->setCscedit($cscEditable ? 'TRUE' : 'FALSE')
|
459 |
+
->setEmailcustomer($this->getConfigData('email_confirmation') ? 'TRUE' : 'FALSE')
|
460 |
+
->setUrlmethod($this->getConfigData('url_method'));
|
461 |
return $request;
|
462 |
}
|
463 |
|
627 |
{
|
628 |
return null;
|
629 |
}
|
630 |
+
|
631 |
+
/**
|
632 |
+
* Get callback controller
|
633 |
+
*
|
634 |
+
* @return string
|
635 |
+
*/
|
636 |
+
public function getCallbackController()
|
637 |
+
{
|
638 |
+
return $this->_callbackController;
|
639 |
+
}
|
640 |
+
|
641 |
+
/**
|
642 |
+
* Get callback url
|
643 |
+
*
|
644 |
+
* @param string $actionName
|
645 |
+
* @return string
|
646 |
+
*/
|
647 |
+
protected function _getCallbackUrl($actionName)
|
648 |
+
{
|
649 |
+
$request = Mage::app()->getRequest();
|
650 |
+
if ($request->getParam('website')) {
|
651 |
+
$website = Mage::getModel('core/website')->load($request->getParam('website'));
|
652 |
+
$secure = Mage::getStoreConfigFlag(
|
653 |
+
Mage_Core_Model_Url::XML_PATH_SECURE_IN_FRONT,
|
654 |
+
$website->getDefaultStore()
|
655 |
+
);
|
656 |
+
$path = $secure
|
657 |
+
? Mage_Core_Model_Store::XML_PATH_SECURE_BASE_LINK_URL
|
658 |
+
: Mage_Core_Model_Store::XML_PATH_UNSECURE_BASE_LINK_URL;
|
659 |
+
$websiteUrl = Mage::getStoreConfig($path, $website->getDefaultStore());
|
660 |
+
} else {
|
661 |
+
$secure = Mage::getStoreConfigFlag(Mage_Core_Model_Url::XML_PATH_SECURE_IN_FRONT);
|
662 |
+
$websiteUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK, $secure);
|
663 |
+
}
|
664 |
+
|
665 |
+
return $websiteUrl . 'paypal/' . $this->getCallbackController() . '/' . $actionName;
|
666 |
+
}
|
667 |
}
|
app/code/core/Mage/Paypal/Model/Payflowpro.php
CHANGED
@@ -338,10 +338,14 @@ class Mage_Paypal_Model_Payflowpro extends Mage_Payment_Model_Method_Cc
|
|
338 |
$client = new Varien_Http_Client();
|
339 |
$result = new Varien_Object();
|
340 |
|
341 |
-
$_config = array
|
|
|
|
|
|
|
|
|
342 |
|
343 |
$_isProxy = $this->getConfigData('use_proxy', false);
|
344 |
-
if($_isProxy
|
345 |
$_config['proxy'] = $this->getConfigData('proxy_host')
|
346 |
. ':'
|
347 |
. $this->getConfigData('proxy_port');//http://proxy.shr.secureserver.net:3128',
|
338 |
$client = new Varien_Http_Client();
|
339 |
$result = new Varien_Object();
|
340 |
|
341 |
+
$_config = array(
|
342 |
+
'maxredirects' => 5,
|
343 |
+
'timeout' => 30,
|
344 |
+
'verifypeer' => $this->getConfigData('verify_peer')
|
345 |
+
);
|
346 |
|
347 |
$_isProxy = $this->getConfigData('use_proxy', false);
|
348 |
+
if ($_isProxy) {
|
349 |
$_config['proxy'] = $this->getConfigData('proxy_host')
|
350 |
. ':'
|
351 |
. $this->getConfigData('proxy_port');//http://proxy.shr.secureserver.net:3128',
|
app/code/core/Mage/Paypal/Model/System/Config/Source/UrlMethod.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Paypal
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Source model for url method: GET/POST
|
29 |
+
*/
|
30 |