Overview

Packages

  • currencysymbol
  • MAbout
  • Mage
    • Admin
    • Adminhtml
    • AdminNotification
    • Api
    • Api2
    • Authorizenet
    • Backup
    • Bundle
    • Captcha
    • Catalog
    • CatalogIndex
    • CatalogInventory
    • CatalogRule
    • CatalogSearch
    • Centinel
    • Checkout
    • Cms
    • Compiler
    • Connect
    • Contacts
    • Core
    • Cron
    • CurrencySymbol
    • Customer
    • Dataflow
    • Directory
    • DirtectPost
    • Downloadable
    • Eav
    • GiftMessage
    • GoogleAnalytics
    • GoogleBase
    • GoogleCheckout
    • ImportExport
    • Index
    • Install
    • Log
    • Media
    • Newsletter
    • Oauth
    • Page
    • PageCache
    • Paygate
    • Payment
    • Paypal
    • PaypalUk
    • Persistent
    • Poll
    • ProductAlert
    • Rating
    • Reports
    • Review
    • Rss
    • Rule
    • Sales
    • SalesRule
    • Sedfriend
    • Sendfriend
    • Shipping
    • Sitemap
    • Tag
    • Tax
    • Usa
    • Weee
    • Widget
    • Wishlist
    • XmlConnect
  • None
  • Phoenix
    • Moneybookers
  • PHP
  • Zend
    • Date
    • Mime
    • XmlRpc

Classes

  • Mage_Paypal_Adminhtml_Paypal_ReportsController
  • Mage_Paypal_Block_Adminhtml_Settlement_Details
  • Mage_Paypal_Block_Adminhtml_Settlement_Details_Form
  • Mage_Paypal_Block_Adminhtml_Settlement_Report
  • Mage_Paypal_Block_Adminhtml_Settlement_Report_Grid
  • Mage_Paypal_Block_Adminhtml_System_Config_ApiWizard
  • Mage_Paypal_Block_Adminhtml_System_Config_Field_Country
  • Mage_Paypal_Block_Adminhtml_System_Config_Field_Hidden
  • Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Expanded
  • Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Group
  • Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Hint
  • Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Location
  • Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Payment
  • Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Store
  • Mage_Paypal_Block_Adminhtml_System_Config_Payflowlink_Advanced
  • Mage_Paypal_Block_Adminhtml_System_Config_Payflowlink_Info
  • Mage_Paypal_Block_Express_Form
  • Mage_Paypal_Block_Express_Review
  • Mage_Paypal_Block_Express_Review_Billing
  • Mage_Paypal_Block_Express_Review_Details
  • Mage_Paypal_Block_Express_Review_Shipping
  • Mage_Paypal_Block_Express_Shortcut
  • Mage_Paypal_Block_Hosted_Pro_Form
  • Mage_Paypal_Block_Hosted_Pro_Iframe
  • Mage_Paypal_Block_Hosted_Pro_Info
  • Mage_Paypal_Block_Iframe
  • Mage_Paypal_Block_Logo
  • Mage_Paypal_Block_Payflow_Advanced_Form
  • Mage_Paypal_Block_Payflow_Advanced_Iframe
  • Mage_Paypal_Block_Payflow_Advanced_Info
  • Mage_Paypal_Block_Payflow_Link_Form
  • Mage_Paypal_Block_Payflow_Link_Iframe
  • Mage_Paypal_Block_Payflow_Link_Info
  • Mage_Paypal_Block_Payment_Info
  • Mage_Paypal_Block_Standard_Form
  • Mage_Paypal_Block_Standard_Redirect
  • Mage_Paypal_Controller_Express_Abstract
  • Mage_Paypal_ExpressController
  • Mage_Paypal_Helper_Data
  • Mage_Paypal_Helper_Hss
  • Mage_Paypal_HostedproController
  • Mage_Paypal_IpnController
  • Mage_Paypal_Model_Api_Abstract
  • Mage_Paypal_Model_Api_Nvp
  • Mage_Paypal_Model_Api_Standard
  • Mage_Paypal_Model_Cart
  • Mage_Paypal_Model_Cert
  • Mage_Paypal_Model_Config
  • Mage_Paypal_Model_Direct
  • Mage_Paypal_Model_Express
  • Mage_Paypal_Model_Express_Checkout
  • Mage_Paypal_Model_Hostedpro
  • Mage_Paypal_Model_Hostedpro_Request
  • Mage_Paypal_Model_Info
  • Mage_Paypal_Model_Ipn
  • Mage_Paypal_Model_Method_Agreement
  • Mage_Paypal_Model_Mysql4_Cert
  • Mage_Paypal_Model_Mysql4_Report_Settlement
  • Mage_Paypal_Model_Mysql4_Report_Settlement_Row
  • Mage_Paypal_Model_Mysql4_Report_Settlement_Row_Collection
  • Mage_Paypal_Model_Mysql4_Setup
  • Mage_Paypal_Model_Observer
  • Mage_Paypal_Model_Payflow_Request
  • Mage_Paypal_Model_Payflowadvanced
  • Mage_Paypal_Model_Payflowlink
  • Mage_Paypal_Model_Payflowpro
  • Mage_Paypal_Model_Payment_Transaction
  • Mage_Paypal_Model_Pro
  • Mage_Paypal_Model_Report_Settlement
  • Mage_Paypal_Model_Report_Settlement_Row
  • Mage_Paypal_Model_Resource_Cert
  • Mage_Paypal_Model_Resource_Report_Settlement
  • Mage_Paypal_Model_Resource_Report_Settlement_Row
  • Mage_Paypal_Model_Resource_Report_Settlement_Row_Collection
  • Mage_Paypal_Model_Resource_Setup
  • Mage_Paypal_Model_Session
  • Mage_Paypal_Model_Standard
  • Mage_Paypal_Model_System_Config_Backend_Cert
  • Mage_Paypal_Model_System_Config_Backend_Cron
  • Mage_Paypal_Model_System_Config_Backend_MerchantCountry
  • Mage_Paypal_Model_System_Config_Source_BuyerCountry
  • Mage_Paypal_Model_System_Config_Source_FetchingSchedule
  • Mage_Paypal_Model_System_Config_Source_Logo
  • Mage_Paypal_Model_System_Config_Source_MerchantCountry
  • Mage_Paypal_Model_System_Config_Source_PaymentActions
  • Mage_Paypal_Model_System_Config_Source_PaymentActions_Express
  • Mage_Paypal_Model_System_Config_Source_RequireBillingAddress
  • Mage_Paypal_Model_System_Config_Source_UrlMethod
  • Mage_Paypal_PayflowadvancedController
  • Mage_Paypal_PayflowController
  • Mage_Paypal_StandardController

Exceptions

  • Mage_Paypal_Exception
  • Overview
  • Package
  • Class
  • Tree
  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: }
354: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0