diff --git a/.phpstan.dist.baseline.neon b/.phpstan.dist.baseline.neon index ba4a1b07b6e..b9fca4364db 100644 --- a/.phpstan.dist.baseline.neon +++ b/.phpstan.dist.baseline.neon @@ -3828,258 +3828,6 @@ parameters: count: 1 path: app/code/core/Mage/Payment/Model/Recurring/Profile.php - - - message: '#^Parameter \#2 \$value of method Mage_Core_Model_Config\:\:saveConfig\(\) expects string, int given\.$#' - identifier: argument.type - count: 1 - path: app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Deprecated.php - - - - message: '#^Return type \(false\) of method Mage_Paypal_Block_Hosted_Pro_Info\:\:getCcTypeName\(\) should be compatible with return type \(string\|null\) of method Mage_Paypal_Block_Payment_Info\:\:getCcTypeName\(\)$#' - identifier: method.childReturnType - count: 1 - path: app/code/core/Mage/Paypal/Block/Hosted/Pro/Info.php - - - - message: '#^Return type \(false\) of method Mage_Paypal_Block_Payflow_Link_Info\:\:getCcTypeName\(\) should be compatible with return type \(string\|null\) of method Mage_Paypal_Block_Payment_Info\:\:getCcTypeName\(\)$#' - identifier: method.childReturnType - count: 1 - path: app/code/core/Mage/Paypal/Block/Payflow/Link/Info.php - - - - message: '#^Parameter \#1 \$setToken of method Mage_Paypal_Controller_Express_Abstract\:\:_initToken\(\) expects string\|null, false given\.$#' - identifier: argument.type - count: 2 - path: app/code/core/Mage/Paypal/Controller/Express/Abstract.php - - - - message: '#^Call to an undefined method Mage_Paypal_Model_Api_Nvp\:\:_export\(\)\.$#' - identifier: method.notFound - count: 1 - path: app/code/core/Mage/Paypal/Model/Api/Nvp.php - - - - message: '#^Call to an undefined method Mage_Paypal_Model_Api_Nvp\:\:_import\(\)\.$#' - identifier: method.notFound - count: 1 - path: app/code/core/Mage/Paypal/Model/Api/Nvp.php - - - - message: '#^Parameter \#1 \$array \(non\-empty\-list\) of array_values is already a list, call has no effect\.$#' - identifier: arrayValues.list - count: 1 - path: app/code/core/Mage/Paypal/Model/Api/Nvp.php - - - - message: '#^Call to an undefined method Varien_Object\:\:isNominal\(\)\.$#' - identifier: method.notFound - count: 1 - path: app/code/core/Mage/Paypal/Model/Cart.php - - - - message: '#^Empty array passed to foreach\.$#' - identifier: foreach.emptyArray - count: 1 - path: app/code/core/Mage/Paypal/Model/Cart.php - - - - message: '#^Left side of && is always true\.$#' - identifier: booleanAnd.leftAlwaysTrue - count: 1 - path: app/code/core/Mage/Paypal/Model/Cart.php - - - - message: '#^Negated boolean expression is always true\.$#' - identifier: booleanNot.alwaysTrue - count: 1 - path: app/code/core/Mage/Paypal/Model/Config.php - - - - message: '#^If condition is always false\.$#' - identifier: if.alwaysFalse - count: 1 - path: app/code/core/Mage/Paypal/Model/Express.php - - - - message: '#^Parameter \#1 \$amount of method Mage_Paypal_Model_Express\:\:_callDoAuthorize\(\) expects int, float given\.$#' - identifier: argument.type - count: 2 - path: app/code/core/Mage/Paypal/Model/Express.php - - - - message: '#^Parameter \#1 \$datetime of class DateTime constructor expects string, null given\.$#' - identifier: argument.type - count: 1 - path: app/code/core/Mage/Paypal/Model/Express.php - - - - message: '#^Cannot call method getData\(\) on array\.$#' - identifier: method.nonObject - count: 2 - path: app/code/core/Mage/Paypal/Model/Express/Checkout.php - - - - message: '#^Cannot call method getExportedKeys\(\) on array\.$#' - identifier: method.nonObject - count: 2 - path: app/code/core/Mage/Paypal/Model/Express/Checkout.php - - - - message: '#^Parameter \#1 \$message of static method Mage\:\:throwException\(\) expects string, array given\.$#' - identifier: argument.type - count: 1 - path: app/code/core/Mage/Paypal/Model/Express/Checkout.php - - - - message: '#^Return type \(bool\) of method Mage_Paypal_Model_Hostedpro\:\:getAllowedCcTypes\(\) should be compatible with return type \(string\) of method Mage_Paypal_Model_Direct\:\:getAllowedCcTypes\(\)$#' - identifier: method.childReturnType - count: 1 - path: app/code/core/Mage/Paypal/Model/Hostedpro.php - - - - message: '#^Return type \(bool\) of method Mage_Paypal_Model_Hostedpro\:\:validate\(\) should be compatible with return type \(\$this\(Mage_Payment_Model_Method_Cc\)\) of method Mage_Payment_Model_Method_Cc\:\:validate\(\)$#' - identifier: method.childReturnType - count: 1 - path: app/code/core/Mage/Paypal/Model/Hostedpro.php - - - - message: '#^Binary operation "\-" between array\|string and array\|string results in an error\.$#' - identifier: binaryOp.invalid - count: 1 - path: app/code/core/Mage/Paypal/Model/Ipn.php - - - - message: '#^Parameter \#1 \$amount of method Mage_Sales_Model_Order_Payment\:\:registerCaptureNotification\(\) expects float, array\|string given\.$#' - identifier: argument.type - count: 1 - path: app/code/core/Mage/Paypal/Model/Ipn.php - - - - message: '#^Parameter \#2 \$url of method Zend_Http_Client_Adapter_Interface\:\:write\(\) expects Zend_Uri_Http, string given\.$#' - identifier: argument.type - count: 1 - path: app/code/core/Mage/Paypal/Model/Ipn.php - - - - message: '#^Parameter \#1 \$payment of method Mage_Paypal_Model_Method_Agreement\:\:_placeOrder\(\) expects Mage_Sales_Model_Order_Payment, Varien_Object given\.$#' - identifier: argument.type - count: 1 - path: app/code/core/Mage/Paypal/Model/Method/Agreement.php - - - - message: '#^Parameter \#1 \$spec of method Zend_Controller_Response_Abstract\:\:getBody\(\) expects bool, string given\.$#' - identifier: argument.type - count: 1 - path: app/code/core/Mage/Paypal/Model/Observer.php - - - - message: '#^Return type \(bool\) of method Mage_Paypal_Model_Payflowlink\:\:validate\(\) should be compatible with return type \(\$this\(Mage_Payment_Model_Method_Cc\)\) of method Mage_Payment_Model_Method_Cc\:\:validate\(\)$#' - identifier: method.childReturnType - count: 1 - path: app/code/core/Mage/Paypal/Model/Payflowlink.php - - - - message: '#^Parameter \#1 \$payment of method Mage_Paypal_Model_Payflowpro\:\:_buildBasicRequest\(\) expects Mage_Sales_Model_Order_Payment, Mage_Payment_Model_Info given\.$#' - identifier: argument.type - count: 1 - path: app/code/core/Mage/Paypal/Model/Payflowpro.php - - - - message: '#^Parameter \#1 \$payment of method Mage_Paypal_Model_Payflowpro\:\:void\(\) expects Mage_Sales_Model_Order_Payment, Varien_Object given\.$#' - identifier: argument.type - count: 1 - path: app/code/core/Mage/Paypal/Model/Payflowpro.php - - - - message: '#^Parameter \#2 \$storeId of method Mage_Payment_Model_Method_Abstract\:\:getConfigData\(\) expects int\|Mage_Core_Model_Store\|string\|null, false given\.$#' - identifier: argument.type - count: 1 - path: app/code/core/Mage/Paypal/Model/Payflowpro.php - - - - message: '#^Parameter \#3 \$map of static method Varien_Object_Mapper\:\:accumulateByMap\(\) expects array, string given\.$#' - identifier: argument.type - count: 1 - path: app/code/core/Mage/Paypal/Model/Payflowpro.php - - - - message: '#^Property Mage_Paypal_Model_Payflowpro\:\:\$_centinelFieldMap \(string\) does not accept default value of type array\\.$#' - identifier: property.defaultValue - count: 1 - path: app/code/core/Mage/Paypal/Model/Payflowpro.php - - - - message: '#^Method Mage_Paypal_Model_Pro\:\:capture\(\) should return false\|null but return statement is missing\.$#' - identifier: return.missing - count: 1 - path: app/code/core/Mage/Paypal/Model/Pro.php - - - - message: '#^Parameter \#2 \$payment of method Mage_Paypal_Model_Pro\:\:_importCaptureResultToPayment\(\) expects Mage_Sales_Model_Order_Payment, Varien_Object given\.$#' - identifier: argument.type - count: 1 - path: app/code/core/Mage/Paypal/Model/Pro.php - - - - message: '#^Parameter \#2 \$payment of method Mage_Paypal_Model_Pro\:\:_importRefundResultToPayment\(\) expects Mage_Sales_Model_Order_Payment, Varien_Object given\.$#' - identifier: argument.type - count: 1 - path: app/code/core/Mage/Paypal/Model/Pro.php - - - - message: '#^Parameter \#2 \$to of method Mage_Paypal_Model_Pro\:\:importPaymentInfo\(\) expects Mage_Payment_Model_Info, Varien_Object given\.$#' - identifier: argument.type - count: 1 - path: app/code/core/Mage/Paypal/Model/Pro.php - - - - message: '#^Method Varien_Data_Collection\:\:toOptionArray\(\) invoked with 1 parameter, 0 required\.$#' - identifier: arguments.count - count: 1 - path: app/code/core/Mage/Paypal/Model/System/Config/Source/BuyerCountry.php - - - - message: '#^Method Varien_Data_Collection\:\:toOptionArray\(\) invoked with 1 parameter, 0 required\.$#' - identifier: arguments.count - count: 1 - path: app/code/core/Mage/Paypal/Model/System/Config/Source/MerchantCountry.php - - - - message: '#^Access to protected property Mage_Paypal_Model_Api_Nvp\:\:\$_setExpressCheckoutResponse\.$#' - identifier: property.protected - count: 1 - path: app/code/core/Mage/PaypalUk/Model/Api/Express/Nvp.php - - - - message: '#^Access to protected property Mage_Paypal_Model_Api_Nvp\:\:\$_doCaptureResponse\.$#' - identifier: property.protected - count: 1 - path: app/code/core/Mage/PaypalUk/Model/Api/Nvp.php - - - - message: '#^Access to protected property Mage_Paypal_Model_Api_Nvp\:\:\$_getTransactionDetailsResponse\.$#' - identifier: property.protected - count: 1 - path: app/code/core/Mage/PaypalUk/Model/Api/Nvp.php - - - - message: '#^Access to protected property Mage_Paypal_Model_Api_Nvp\:\:\$_paymentInformationResponse\.$#' - identifier: property.protected - count: 1 - path: app/code/core/Mage/PaypalUk/Model/Api/Nvp.php - - - - message: '#^Access to protected property Mage_Paypal_Model_Api_Nvp\:\:\$_refundTransactionResponse\.$#' - identifier: property.protected - count: 1 - path: app/code/core/Mage/PaypalUk/Model/Api/Nvp.php - - - - message: '#^Return type \(void\) of method Mage_PaypalUk_Model_Pro\:\:fetchTransactionInfo\(\) should be compatible with return type \(array\) of method Mage_Paypal_Model_Pro\:\:fetchTransactionInfo\(\)$#' - identifier: method.childReturnType - count: 1 - path: app/code/core/Mage/PaypalUk/Model/Pro.php - - message: '#^Method Mage_ProductAlert_Helper_Data\:\:createBlock\(\) should return Mage_ProductAlert_Block_Email_Price\|Mage_ProductAlert_Block_Email_Stock but returns Mage_Core_Block_Abstract\.$#' identifier: return.type @@ -5844,12 +5592,6 @@ parameters: count: 1 path: app/design/frontend/base/default/template/googleanalytics/ga.phtml - - - message: '#^Class Mage_Paypal_Block_Express_Form referenced with incorrect case\: Mage_PayPal_Block_Express_Form\.$#' - identifier: class.nameCase - count: 1 - path: app/design/frontend/base/default/template/paypal/payment/redirect.phtml - - message: '#^Cannot call method isEnabled\(\) on Mage_Core_Block_Abstract\|false\.$#' identifier: method.nonObject diff --git a/.phpstan.dist.neon b/.phpstan.dist.neon index ac155db64d8..404acdaa0ad 100644 --- a/.phpstan.dist.neon +++ b/.phpstan.dist.neon @@ -55,7 +55,6 @@ parameters: - app/code/core/Mage/Centinel/Model/Api/Client.php # Class phpseclib\Net\SSH2 not found. - - app/code/core/Mage/Paypal/Model/Report/Settlement.php - lib/Varien/Io/Sftp.php # Dataflow/Model/Convert/Iterator.php @@ -126,12 +125,10 @@ parameters: - app/design/frontend/base/default/template/customer/wishlist.phtml - app/design/frontend/base/default/template/directory/currency/switch.phtml - app/design/frontend/base/default/template/page/redirect.phtml - - app/design/frontend/base/default/template/paypal/hss/review/button.phtml - app/design/frontend/rwd/default/template/checkout/cart/render/default.phtml - app/design/frontend/rwd/default/template/checkout/cart/render/simple.phtml - app/design/frontend/rwd/default/template/customer/form/address.phtml - app/design/frontend/rwd/default/template/customer/form/changepassword.phtml - - app/design/frontend/rwd/default/template/paypal/express/review/address.phtml - app/design/install/default/default/template/page.phtml - identifier: phpunit.coversMethod diff --git a/.phpstorm.meta.php/magento_blocks.meta.php b/.phpstorm.meta.php/magento_blocks.meta.php index c1af1bf09b2..c18209301a1 100644 --- a/.phpstorm.meta.php/magento_blocks.meta.php +++ b/.phpstorm.meta.php/magento_blocks.meta.php @@ -588,6 +588,7 @@ 'adminhtml/system_config_form' => \Mage_Adminhtml_Block_System_Config_Form::class, 'adminhtml/system_config_form_field' => \Mage_Adminhtml_Block_System_Config_Form_Field::class, 'adminhtml/system_config_form_field_array_abstract' => \Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract::class, + 'adminhtml/system_config_form_field_csp_hosts' => \Mage_Adminhtml_Block_System_Config_Form_Field_Csp_Hosts::class, 'adminhtml/system_config_form_field_datetime' => \Mage_Adminhtml_Block_System_Config_Form_Field_Datetime::class, 'adminhtml/system_config_form_field_export' => \Mage_Adminhtml_Block_System_Config_Form_Field_Export::class, 'adminhtml/system_config_form_field_file' => \Mage_Adminhtml_Block_System_Config_Form_Field_File::class, @@ -968,6 +969,8 @@ 'core/text_tag_debug' => \Mage_Core_Block_Text_Tag_Debug::class, 'core/text_tag_js' => \Mage_Core_Block_Text_Tag_Js::class, 'core/text_tag_meta' => \Mage_Core_Block_Text_Tag_Meta::class, + 'csp/adminhtml_meta' => \Mage_Csp_Block_Adminhtml_Meta::class, + 'csp/meta' => \Mage_Csp_Block_Meta::class, 'currencysymbol/adminhtml_system_currencysymbol' => \Mage_CurrencySymbol_Block_Adminhtml_System_Currencysymbol::class, 'customer/account' => \Mage_Customer_Block_Account::class, 'customer/account_changeforgotten' => \Mage_Customer_Block_Account_Changeforgotten::class, @@ -1105,53 +1108,16 @@ 'payment/info_checkmo' => \Mage_Payment_Block_Info_Checkmo::class, 'payment/info_container' => \Mage_Payment_Block_Info_Container::class, 'payment/info_purchaseorder' => \Mage_Payment_Block_Info_Purchaseorder::class, - 'paypaluk/bml_form' => \Mage_PaypalUk_Block_Bml_Form::class, - 'paypaluk/express_form' => \Mage_PaypalUk_Block_Express_Form::class, - 'paypaluk/express_shortcut' => \Mage_PaypalUk_Block_Express_Shortcut::class, - 'paypal/adminhtml_settlement_details' => \Mage_Paypal_Block_Adminhtml_Settlement_Details::class, - 'paypal/adminhtml_settlement_details_form' => \Mage_Paypal_Block_Adminhtml_Settlement_Details_Form::class, - 'paypal/adminhtml_settlement_report' => \Mage_Paypal_Block_Adminhtml_Settlement_Report::class, - 'paypal/adminhtml_settlement_report_grid' => \Mage_Paypal_Block_Adminhtml_Settlement_Report_Grid::class, - 'paypal/adminhtml_system_config_apiWizard' => \Mage_Paypal_Block_Adminhtml_System_Config_ApiWizard::class, - 'paypal/adminhtml_system_config_bmlApiWizard' => \Mage_Paypal_Block_Adminhtml_System_Config_BmlApiWizard::class, - 'paypal/adminhtml_system_config_field_country' => \Mage_Paypal_Block_Adminhtml_System_Config_Field_Country::class, - 'paypal/adminhtml_system_config_field_hidden' => \Mage_Paypal_Block_Adminhtml_System_Config_Field_Hidden::class, - 'paypal/adminhtml_system_config_field_solutionType' => \Mage_Paypal_Block_Adminhtml_System_Config_Field_SolutionType::class, - 'paypal/adminhtml_system_config_fieldset_deprecated' => \Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Deprecated::class, - 'paypal/adminhtml_system_config_fieldset_expanded' => \Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Expanded::class, - 'paypal/adminhtml_system_config_fieldset_global' => \Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Global::class, - 'paypal/adminhtml_system_config_fieldset_group' => \Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Group::class, - 'paypal/adminhtml_system_config_fieldset_hint' => \Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Hint::class, - 'paypal/adminhtml_system_config_fieldset_location' => \Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Location::class, - 'paypal/adminhtml_system_config_fieldset_pathDependent' => \Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_PathDependent::class, - 'paypal/adminhtml_system_config_fieldset_payment' => \Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Payment::class, - 'paypal/adminhtml_system_config_fieldset_store' => \Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Store::class, - 'paypal/adminhtml_system_config_payflowlink_advanced' => \Mage_Paypal_Block_Adminhtml_System_Config_Payflowlink_Advanced::class, - 'paypal/adminhtml_system_config_payflowlink_info' => \Mage_Paypal_Block_Adminhtml_System_Config_Payflowlink_Info::class, - 'paypal/bml_banners' => \Mage_Paypal_Block_Bml_Banners::class, - 'paypal/bml_form' => \Mage_Paypal_Block_Bml_Form::class, - 'paypal/express_form' => \Mage_Paypal_Block_Express_Form::class, - 'paypal/express_review' => \Mage_Paypal_Block_Express_Review::class, - 'paypal/express_review_billing' => \Mage_Paypal_Block_Express_Review_Billing::class, - 'paypal/express_review_details' => \Mage_Paypal_Block_Express_Review_Details::class, - 'paypal/express_review_shipping' => \Mage_Paypal_Block_Express_Review_Shipping::class, - 'paypal/express_shortcut' => \Mage_Paypal_Block_Express_Shortcut::class, - 'paypal/hosted_pro_form' => \Mage_Paypal_Block_Hosted_Pro_Form::class, - 'paypal/hosted_pro_iframe' => \Mage_Paypal_Block_Hosted_Pro_Iframe::class, - 'paypal/hosted_pro_info' => \Mage_Paypal_Block_Hosted_Pro_Info::class, - 'paypal/iframe' => \Mage_Paypal_Block_Iframe::class, - 'paypal/logo' => \Mage_Paypal_Block_Logo::class, - 'paypal/payflow_advanced_form' => \Mage_Paypal_Block_Payflow_Advanced_Form::class, - 'paypal/payflow_advanced_iframe' => \Mage_Paypal_Block_Payflow_Advanced_Iframe::class, - 'paypal/payflow_advanced_info' => \Mage_Paypal_Block_Payflow_Advanced_Info::class, - 'paypal/payflow_advanced_review' => \Mage_Paypal_Block_Payflow_Advanced_Review::class, - 'paypal/payflow_link_form' => \Mage_Paypal_Block_Payflow_Link_Form::class, - 'paypal/payflow_link_iframe' => \Mage_Paypal_Block_Payflow_Link_Iframe::class, - 'paypal/payflow_link_info' => \Mage_Paypal_Block_Payflow_Link_Info::class, - 'paypal/payflow_link_review' => \Mage_Paypal_Block_Payflow_Link_Review::class, - 'paypal/payment_info' => \Mage_Paypal_Block_Payment_Info::class, - 'paypal/standard_form' => \Mage_Paypal_Block_Standard_Form::class, - 'paypal/standard_redirect' => \Mage_Paypal_Block_Standard_Redirect::class, + 'paypal/adminhtml_debug' => \Mage_Paypal_Block_Adminhtml_Debug::class, + 'paypal/adminhtml_debug_grid' => \Mage_Paypal_Block_Adminhtml_Debug_Grid::class, + 'paypal/adminhtml_debug_grid_renderer_message' => \Mage_Paypal_Block_Adminhtml_Debug_Grid_Renderer_Message::class, + 'paypal/adminhtml_debug_grid_renderer_request' => \Mage_Paypal_Block_Adminhtml_Debug_Grid_Renderer_Request::class, + 'paypal/adminhtml_debug_grid_renderer_response' => \Mage_Paypal_Block_Adminhtml_Debug_Grid_Renderer_Response::class, + 'paypal/adminhtml_grid_renderer_json' => \Mage_Paypal_Block_Adminhtml_Grid_Renderer_Json::class, + 'paypal/adminhtml_grid_renderer_order' => \Mage_Paypal_Block_Adminhtml_Grid_Renderer_Order::class, + 'paypal/adminhtml_info' => \Mage_Paypal_Block_Adminhtml_Info::class, + 'paypal/form' => \Mage_Paypal_Block_Form::class, + 'paypal/info' => \Mage_Paypal_Block_Info::class, 'persistent/form_remember' => \Mage_Persistent_Block_Form_Remember::class, 'persistent/header_additional' => \Mage_Persistent_Block_Header_Additional::class, 'productalert/email_abstract' => \Mage_ProductAlert_Block_Email_Abstract::class, diff --git a/.phpstorm.meta.php/magento_blocks_methods.meta.php b/.phpstorm.meta.php/magento_blocks_methods.meta.php index bcded4467bb..9e66779a2e7 100644 --- a/.phpstorm.meta.php/magento_blocks_methods.meta.php +++ b/.phpstorm.meta.php/magento_blocks_methods.meta.php @@ -588,6 +588,7 @@ 'adminhtml/system_config_form' => \Mage_Adminhtml_Block_System_Config_Form::class, 'adminhtml/system_config_form_field' => \Mage_Adminhtml_Block_System_Config_Form_Field::class, 'adminhtml/system_config_form_field_array_abstract' => \Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract::class, + 'adminhtml/system_config_form_field_csp_hosts' => \Mage_Adminhtml_Block_System_Config_Form_Field_Csp_Hosts::class, 'adminhtml/system_config_form_field_datetime' => \Mage_Adminhtml_Block_System_Config_Form_Field_Datetime::class, 'adminhtml/system_config_form_field_export' => \Mage_Adminhtml_Block_System_Config_Form_Field_Export::class, 'adminhtml/system_config_form_field_file' => \Mage_Adminhtml_Block_System_Config_Form_Field_File::class, @@ -968,6 +969,8 @@ 'core/text_tag_debug' => \Mage_Core_Block_Text_Tag_Debug::class, 'core/text_tag_js' => \Mage_Core_Block_Text_Tag_Js::class, 'core/text_tag_meta' => \Mage_Core_Block_Text_Tag_Meta::class, + 'csp/adminhtml_meta' => \Mage_Csp_Block_Adminhtml_Meta::class, + 'csp/meta' => \Mage_Csp_Block_Meta::class, 'currencysymbol/adminhtml_system_currencysymbol' => \Mage_CurrencySymbol_Block_Adminhtml_System_Currencysymbol::class, 'customer/account' => \Mage_Customer_Block_Account::class, 'customer/account_changeforgotten' => \Mage_Customer_Block_Account_Changeforgotten::class, @@ -1105,53 +1108,16 @@ 'payment/info_checkmo' => \Mage_Payment_Block_Info_Checkmo::class, 'payment/info_container' => \Mage_Payment_Block_Info_Container::class, 'payment/info_purchaseorder' => \Mage_Payment_Block_Info_Purchaseorder::class, - 'paypaluk/bml_form' => \Mage_PaypalUk_Block_Bml_Form::class, - 'paypaluk/express_form' => \Mage_PaypalUk_Block_Express_Form::class, - 'paypaluk/express_shortcut' => \Mage_PaypalUk_Block_Express_Shortcut::class, - 'paypal/adminhtml_settlement_details' => \Mage_Paypal_Block_Adminhtml_Settlement_Details::class, - 'paypal/adminhtml_settlement_details_form' => \Mage_Paypal_Block_Adminhtml_Settlement_Details_Form::class, - 'paypal/adminhtml_settlement_report' => \Mage_Paypal_Block_Adminhtml_Settlement_Report::class, - 'paypal/adminhtml_settlement_report_grid' => \Mage_Paypal_Block_Adminhtml_Settlement_Report_Grid::class, - 'paypal/adminhtml_system_config_apiWizard' => \Mage_Paypal_Block_Adminhtml_System_Config_ApiWizard::class, - 'paypal/adminhtml_system_config_bmlApiWizard' => \Mage_Paypal_Block_Adminhtml_System_Config_BmlApiWizard::class, - 'paypal/adminhtml_system_config_field_country' => \Mage_Paypal_Block_Adminhtml_System_Config_Field_Country::class, - 'paypal/adminhtml_system_config_field_hidden' => \Mage_Paypal_Block_Adminhtml_System_Config_Field_Hidden::class, - 'paypal/adminhtml_system_config_field_solutionType' => \Mage_Paypal_Block_Adminhtml_System_Config_Field_SolutionType::class, - 'paypal/adminhtml_system_config_fieldset_deprecated' => \Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Deprecated::class, - 'paypal/adminhtml_system_config_fieldset_expanded' => \Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Expanded::class, - 'paypal/adminhtml_system_config_fieldset_global' => \Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Global::class, - 'paypal/adminhtml_system_config_fieldset_group' => \Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Group::class, - 'paypal/adminhtml_system_config_fieldset_hint' => \Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Hint::class, - 'paypal/adminhtml_system_config_fieldset_location' => \Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Location::class, - 'paypal/adminhtml_system_config_fieldset_pathDependent' => \Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_PathDependent::class, - 'paypal/adminhtml_system_config_fieldset_payment' => \Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Payment::class, - 'paypal/adminhtml_system_config_fieldset_store' => \Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Store::class, - 'paypal/adminhtml_system_config_payflowlink_advanced' => \Mage_Paypal_Block_Adminhtml_System_Config_Payflowlink_Advanced::class, - 'paypal/adminhtml_system_config_payflowlink_info' => \Mage_Paypal_Block_Adminhtml_System_Config_Payflowlink_Info::class, - 'paypal/bml_banners' => \Mage_Paypal_Block_Bml_Banners::class, - 'paypal/bml_form' => \Mage_Paypal_Block_Bml_Form::class, - 'paypal/express_form' => \Mage_Paypal_Block_Express_Form::class, - 'paypal/express_review' => \Mage_Paypal_Block_Express_Review::class, - 'paypal/express_review_billing' => \Mage_Paypal_Block_Express_Review_Billing::class, - 'paypal/express_review_details' => \Mage_Paypal_Block_Express_Review_Details::class, - 'paypal/express_review_shipping' => \Mage_Paypal_Block_Express_Review_Shipping::class, - 'paypal/express_shortcut' => \Mage_Paypal_Block_Express_Shortcut::class, - 'paypal/hosted_pro_form' => \Mage_Paypal_Block_Hosted_Pro_Form::class, - 'paypal/hosted_pro_iframe' => \Mage_Paypal_Block_Hosted_Pro_Iframe::class, - 'paypal/hosted_pro_info' => \Mage_Paypal_Block_Hosted_Pro_Info::class, - 'paypal/iframe' => \Mage_Paypal_Block_Iframe::class, - 'paypal/logo' => \Mage_Paypal_Block_Logo::class, - 'paypal/payflow_advanced_form' => \Mage_Paypal_Block_Payflow_Advanced_Form::class, - 'paypal/payflow_advanced_iframe' => \Mage_Paypal_Block_Payflow_Advanced_Iframe::class, - 'paypal/payflow_advanced_info' => \Mage_Paypal_Block_Payflow_Advanced_Info::class, - 'paypal/payflow_advanced_review' => \Mage_Paypal_Block_Payflow_Advanced_Review::class, - 'paypal/payflow_link_form' => \Mage_Paypal_Block_Payflow_Link_Form::class, - 'paypal/payflow_link_iframe' => \Mage_Paypal_Block_Payflow_Link_Iframe::class, - 'paypal/payflow_link_info' => \Mage_Paypal_Block_Payflow_Link_Info::class, - 'paypal/payflow_link_review' => \Mage_Paypal_Block_Payflow_Link_Review::class, - 'paypal/payment_info' => \Mage_Paypal_Block_Payment_Info::class, - 'paypal/standard_form' => \Mage_Paypal_Block_Standard_Form::class, - 'paypal/standard_redirect' => \Mage_Paypal_Block_Standard_Redirect::class, + 'paypal/adminhtml_debug' => \Mage_Paypal_Block_Adminhtml_Debug::class, + 'paypal/adminhtml_debug_grid' => \Mage_Paypal_Block_Adminhtml_Debug_Grid::class, + 'paypal/adminhtml_debug_grid_renderer_message' => \Mage_Paypal_Block_Adminhtml_Debug_Grid_Renderer_Message::class, + 'paypal/adminhtml_debug_grid_renderer_request' => \Mage_Paypal_Block_Adminhtml_Debug_Grid_Renderer_Request::class, + 'paypal/adminhtml_debug_grid_renderer_response' => \Mage_Paypal_Block_Adminhtml_Debug_Grid_Renderer_Response::class, + 'paypal/adminhtml_grid_renderer_json' => \Mage_Paypal_Block_Adminhtml_Grid_Renderer_Json::class, + 'paypal/adminhtml_grid_renderer_order' => \Mage_Paypal_Block_Adminhtml_Grid_Renderer_Order::class, + 'paypal/adminhtml_info' => \Mage_Paypal_Block_Adminhtml_Info::class, + 'paypal/form' => \Mage_Paypal_Block_Form::class, + 'paypal/info' => \Mage_Paypal_Block_Info::class, 'persistent/form_remember' => \Mage_Persistent_Block_Form_Remember::class, 'persistent/header_additional' => \Mage_Persistent_Block_Header_Additional::class, 'productalert/email_abstract' => \Mage_ProductAlert_Block_Email_Abstract::class, diff --git a/.phpstorm.meta.php/magento_helpers.meta.php b/.phpstorm.meta.php/magento_helpers.meta.php index 8d25c1bd54e..a0414bab12c 100644 --- a/.phpstorm.meta.php/magento_helpers.meta.php +++ b/.phpstorm.meta.php/magento_helpers.meta.php @@ -61,6 +61,7 @@ 'catalog/product_url' => \Mage_Catalog_Helper_Product_Url::class, 'catalog/product_url_rewrite' => \Mage_Catalog_Helper_Product_Url_Rewrite::class, 'catalog/product_view' => \Mage_Catalog_Helper_Product_View::class, + 'catalog/search' => \Mage_Catalog_Helper_Search::class, 'centinel' => \Mage_Centinel_Helper_Data::class, 'centinel/data' => \Mage_Centinel_Helper_Data::class, 'checkout/cart' => \Mage_Checkout_Helper_Cart::class, @@ -96,6 +97,8 @@ 'core/unserializeArray' => \Mage_Core_Helper_UnserializeArray::class, 'core/url' => \Mage_Core_Helper_Url::class, 'core/url_rewrite' => \Mage_Core_Helper_Url_Rewrite::class, + 'csp' => \Mage_Csp_Helper_Data::class, + 'csp/data' => \Mage_Csp_Helper_Data::class, 'currencysymbol' => \Mage_CurrencySymbol_Helper_Data::class, 'currencysymbol/data' => \Mage_CurrencySymbol_Helper_Data::class, 'customer/address' => \Mage_Customer_Helper_Address::class, @@ -139,12 +142,8 @@ 'page/layout' => \Mage_Page_Helper_Layout::class, 'payment' => \Mage_Payment_Helper_Data::class, 'payment/data' => \Mage_Payment_Helper_Data::class, - 'paypaluk' => \Mage_PaypalUk_Helper_Data::class, - 'paypaluk/data' => \Mage_PaypalUk_Helper_Data::class, - 'paypal/checkout' => \Mage_Paypal_Helper_Checkout::class, 'paypal' => \Mage_Paypal_Helper_Data::class, 'paypal/data' => \Mage_Paypal_Helper_Data::class, - 'paypal/hss' => \Mage_Paypal_Helper_Hss::class, 'persistent' => \Mage_Persistent_Helper_Data::class, 'persistent/data' => \Mage_Persistent_Helper_Data::class, 'persistent/session' => \Mage_Persistent_Helper_Session::class, diff --git a/.phpstorm.meta.php/magento_helpers_methods.meta.php b/.phpstorm.meta.php/magento_helpers_methods.meta.php index 78008eeee27..8f918a14b59 100644 --- a/.phpstorm.meta.php/magento_helpers_methods.meta.php +++ b/.phpstorm.meta.php/magento_helpers_methods.meta.php @@ -61,6 +61,7 @@ 'catalog/product_url' => \Mage_Catalog_Helper_Product_Url::class, 'catalog/product_url_rewrite' => \Mage_Catalog_Helper_Product_Url_Rewrite::class, 'catalog/product_view' => \Mage_Catalog_Helper_Product_View::class, + 'catalog/search' => \Mage_Catalog_Helper_Search::class, 'centinel' => \Mage_Centinel_Helper_Data::class, 'centinel/data' => \Mage_Centinel_Helper_Data::class, 'checkout/cart' => \Mage_Checkout_Helper_Cart::class, @@ -96,6 +97,8 @@ 'core/unserializeArray' => \Mage_Core_Helper_UnserializeArray::class, 'core/url' => \Mage_Core_Helper_Url::class, 'core/url_rewrite' => \Mage_Core_Helper_Url_Rewrite::class, + 'csp' => \Mage_Csp_Helper_Data::class, + 'csp/data' => \Mage_Csp_Helper_Data::class, 'currencysymbol' => \Mage_CurrencySymbol_Helper_Data::class, 'currencysymbol/data' => \Mage_CurrencySymbol_Helper_Data::class, 'customer/address' => \Mage_Customer_Helper_Address::class, @@ -139,12 +142,8 @@ 'page/layout' => \Mage_Page_Helper_Layout::class, 'payment' => \Mage_Payment_Helper_Data::class, 'payment/data' => \Mage_Payment_Helper_Data::class, - 'paypaluk' => \Mage_PaypalUk_Helper_Data::class, - 'paypaluk/data' => \Mage_PaypalUk_Helper_Data::class, - 'paypal/checkout' => \Mage_Paypal_Helper_Checkout::class, 'paypal' => \Mage_Paypal_Helper_Data::class, 'paypal/data' => \Mage_Paypal_Helper_Data::class, - 'paypal/hss' => \Mage_Paypal_Helper_Hss::class, 'persistent' => \Mage_Persistent_Helper_Data::class, 'persistent/data' => \Mage_Persistent_Helper_Data::class, 'persistent/session' => \Mage_Persistent_Helper_Session::class, @@ -251,6 +250,7 @@ 'catalog/product_url' => \Mage_Catalog_Helper_Product_Url::class, 'catalog/product_url_rewrite' => \Mage_Catalog_Helper_Product_Url_Rewrite::class, 'catalog/product_view' => \Mage_Catalog_Helper_Product_View::class, + 'catalog/search' => \Mage_Catalog_Helper_Search::class, 'centinel' => \Mage_Centinel_Helper_Data::class, 'centinel/data' => \Mage_Centinel_Helper_Data::class, 'checkout/cart' => \Mage_Checkout_Helper_Cart::class, @@ -286,6 +286,8 @@ 'core/unserializeArray' => \Mage_Core_Helper_UnserializeArray::class, 'core/url' => \Mage_Core_Helper_Url::class, 'core/url_rewrite' => \Mage_Core_Helper_Url_Rewrite::class, + 'csp' => \Mage_Csp_Helper_Data::class, + 'csp/data' => \Mage_Csp_Helper_Data::class, 'currencysymbol' => \Mage_CurrencySymbol_Helper_Data::class, 'currencysymbol/data' => \Mage_CurrencySymbol_Helper_Data::class, 'customer/address' => \Mage_Customer_Helper_Address::class, @@ -329,12 +331,8 @@ 'page/layout' => \Mage_Page_Helper_Layout::class, 'payment' => \Mage_Payment_Helper_Data::class, 'payment/data' => \Mage_Payment_Helper_Data::class, - 'paypaluk' => \Mage_PaypalUk_Helper_Data::class, - 'paypaluk/data' => \Mage_PaypalUk_Helper_Data::class, - 'paypal/checkout' => \Mage_Paypal_Helper_Checkout::class, 'paypal' => \Mage_Paypal_Helper_Data::class, 'paypal/data' => \Mage_Paypal_Helper_Data::class, - 'paypal/hss' => \Mage_Paypal_Helper_Hss::class, 'persistent' => \Mage_Persistent_Helper_Data::class, 'persistent/data' => \Mage_Persistent_Helper_Data::class, 'persistent/session' => \Mage_Persistent_Helper_Session::class, @@ -441,6 +439,7 @@ 'catalog/product_url' => \Mage_Catalog_Helper_Product_Url::class, 'catalog/product_url_rewrite' => \Mage_Catalog_Helper_Product_Url_Rewrite::class, 'catalog/product_view' => \Mage_Catalog_Helper_Product_View::class, + 'catalog/search' => \Mage_Catalog_Helper_Search::class, 'centinel' => \Mage_Centinel_Helper_Data::class, 'centinel/data' => \Mage_Centinel_Helper_Data::class, 'checkout/cart' => \Mage_Checkout_Helper_Cart::class, @@ -476,6 +475,8 @@ 'core/unserializeArray' => \Mage_Core_Helper_UnserializeArray::class, 'core/url' => \Mage_Core_Helper_Url::class, 'core/url_rewrite' => \Mage_Core_Helper_Url_Rewrite::class, + 'csp' => \Mage_Csp_Helper_Data::class, + 'csp/data' => \Mage_Csp_Helper_Data::class, 'currencysymbol' => \Mage_CurrencySymbol_Helper_Data::class, 'currencysymbol/data' => \Mage_CurrencySymbol_Helper_Data::class, 'customer/address' => \Mage_Customer_Helper_Address::class, @@ -519,12 +520,8 @@ 'page/layout' => \Mage_Page_Helper_Layout::class, 'payment' => \Mage_Payment_Helper_Data::class, 'payment/data' => \Mage_Payment_Helper_Data::class, - 'paypaluk' => \Mage_PaypalUk_Helper_Data::class, - 'paypaluk/data' => \Mage_PaypalUk_Helper_Data::class, - 'paypal/checkout' => \Mage_Paypal_Helper_Checkout::class, 'paypal' => \Mage_Paypal_Helper_Data::class, 'paypal/data' => \Mage_Paypal_Helper_Data::class, - 'paypal/hss' => \Mage_Paypal_Helper_Hss::class, 'persistent' => \Mage_Persistent_Helper_Data::class, 'persistent/data' => \Mage_Persistent_Helper_Data::class, 'persistent/session' => \Mage_Persistent_Helper_Session::class, @@ -631,6 +628,7 @@ 'catalog/product_url' => \Mage_Catalog_Helper_Product_Url::class, 'catalog/product_url_rewrite' => \Mage_Catalog_Helper_Product_Url_Rewrite::class, 'catalog/product_view' => \Mage_Catalog_Helper_Product_View::class, + 'catalog/search' => \Mage_Catalog_Helper_Search::class, 'centinel' => \Mage_Centinel_Helper_Data::class, 'centinel/data' => \Mage_Centinel_Helper_Data::class, 'checkout/cart' => \Mage_Checkout_Helper_Cart::class, @@ -666,6 +664,8 @@ 'core/unserializeArray' => \Mage_Core_Helper_UnserializeArray::class, 'core/url' => \Mage_Core_Helper_Url::class, 'core/url_rewrite' => \Mage_Core_Helper_Url_Rewrite::class, + 'csp' => \Mage_Csp_Helper_Data::class, + 'csp/data' => \Mage_Csp_Helper_Data::class, 'currencysymbol' => \Mage_CurrencySymbol_Helper_Data::class, 'currencysymbol/data' => \Mage_CurrencySymbol_Helper_Data::class, 'customer/address' => \Mage_Customer_Helper_Address::class, @@ -709,12 +709,8 @@ 'page/layout' => \Mage_Page_Helper_Layout::class, 'payment' => \Mage_Payment_Helper_Data::class, 'payment/data' => \Mage_Payment_Helper_Data::class, - 'paypaluk' => \Mage_PaypalUk_Helper_Data::class, - 'paypaluk/data' => \Mage_PaypalUk_Helper_Data::class, - 'paypal/checkout' => \Mage_Paypal_Helper_Checkout::class, 'paypal' => \Mage_Paypal_Helper_Data::class, 'paypal/data' => \Mage_Paypal_Helper_Data::class, - 'paypal/hss' => \Mage_Paypal_Helper_Hss::class, 'persistent' => \Mage_Persistent_Helper_Data::class, 'persistent/data' => \Mage_Persistent_Helper_Data::class, 'persistent/session' => \Mage_Persistent_Helper_Session::class, @@ -821,6 +817,7 @@ 'catalog/product_url' => \Mage_Catalog_Helper_Product_Url::class, 'catalog/product_url_rewrite' => \Mage_Catalog_Helper_Product_Url_Rewrite::class, 'catalog/product_view' => \Mage_Catalog_Helper_Product_View::class, + 'catalog/search' => \Mage_Catalog_Helper_Search::class, 'centinel' => \Mage_Centinel_Helper_Data::class, 'centinel/data' => \Mage_Centinel_Helper_Data::class, 'checkout/cart' => \Mage_Checkout_Helper_Cart::class, @@ -856,6 +853,8 @@ 'core/unserializeArray' => \Mage_Core_Helper_UnserializeArray::class, 'core/url' => \Mage_Core_Helper_Url::class, 'core/url_rewrite' => \Mage_Core_Helper_Url_Rewrite::class, + 'csp' => \Mage_Csp_Helper_Data::class, + 'csp/data' => \Mage_Csp_Helper_Data::class, 'currencysymbol' => \Mage_CurrencySymbol_Helper_Data::class, 'currencysymbol/data' => \Mage_CurrencySymbol_Helper_Data::class, 'customer/address' => \Mage_Customer_Helper_Address::class, @@ -899,12 +898,8 @@ 'page/layout' => \Mage_Page_Helper_Layout::class, 'payment' => \Mage_Payment_Helper_Data::class, 'payment/data' => \Mage_Payment_Helper_Data::class, - 'paypaluk' => \Mage_PaypalUk_Helper_Data::class, - 'paypaluk/data' => \Mage_PaypalUk_Helper_Data::class, - 'paypal/checkout' => \Mage_Paypal_Helper_Checkout::class, 'paypal' => \Mage_Paypal_Helper_Data::class, 'paypal/data' => \Mage_Paypal_Helper_Data::class, - 'paypal/hss' => \Mage_Paypal_Helper_Hss::class, 'persistent' => \Mage_Persistent_Helper_Data::class, 'persistent/data' => \Mage_Persistent_Helper_Data::class, 'persistent/session' => \Mage_Persistent_Helper_Session::class, @@ -1011,6 +1006,7 @@ 'catalog/product_url' => \Mage_Catalog_Helper_Product_Url::class, 'catalog/product_url_rewrite' => \Mage_Catalog_Helper_Product_Url_Rewrite::class, 'catalog/product_view' => \Mage_Catalog_Helper_Product_View::class, + 'catalog/search' => \Mage_Catalog_Helper_Search::class, 'centinel' => \Mage_Centinel_Helper_Data::class, 'centinel/data' => \Mage_Centinel_Helper_Data::class, 'checkout/cart' => \Mage_Checkout_Helper_Cart::class, @@ -1046,6 +1042,8 @@ 'core/unserializeArray' => \Mage_Core_Helper_UnserializeArray::class, 'core/url' => \Mage_Core_Helper_Url::class, 'core/url_rewrite' => \Mage_Core_Helper_Url_Rewrite::class, + 'csp' => \Mage_Csp_Helper_Data::class, + 'csp/data' => \Mage_Csp_Helper_Data::class, 'currencysymbol' => \Mage_CurrencySymbol_Helper_Data::class, 'currencysymbol/data' => \Mage_CurrencySymbol_Helper_Data::class, 'customer/address' => \Mage_Customer_Helper_Address::class, @@ -1089,12 +1087,8 @@ 'page/layout' => \Mage_Page_Helper_Layout::class, 'payment' => \Mage_Payment_Helper_Data::class, 'payment/data' => \Mage_Payment_Helper_Data::class, - 'paypaluk' => \Mage_PaypalUk_Helper_Data::class, - 'paypaluk/data' => \Mage_PaypalUk_Helper_Data::class, - 'paypal/checkout' => \Mage_Paypal_Helper_Checkout::class, 'paypal' => \Mage_Paypal_Helper_Data::class, 'paypal/data' => \Mage_Paypal_Helper_Data::class, - 'paypal/hss' => \Mage_Paypal_Helper_Hss::class, 'persistent' => \Mage_Persistent_Helper_Data::class, 'persistent/data' => \Mage_Persistent_Helper_Data::class, 'persistent/session' => \Mage_Persistent_Helper_Session::class, @@ -1201,6 +1195,7 @@ 'catalog/product_url' => \Mage_Catalog_Helper_Product_Url::class, 'catalog/product_url_rewrite' => \Mage_Catalog_Helper_Product_Url_Rewrite::class, 'catalog/product_view' => \Mage_Catalog_Helper_Product_View::class, + 'catalog/search' => \Mage_Catalog_Helper_Search::class, 'centinel' => \Mage_Centinel_Helper_Data::class, 'centinel/data' => \Mage_Centinel_Helper_Data::class, 'checkout/cart' => \Mage_Checkout_Helper_Cart::class, @@ -1236,6 +1231,8 @@ 'core/unserializeArray' => \Mage_Core_Helper_UnserializeArray::class, 'core/url' => \Mage_Core_Helper_Url::class, 'core/url_rewrite' => \Mage_Core_Helper_Url_Rewrite::class, + 'csp' => \Mage_Csp_Helper_Data::class, + 'csp/data' => \Mage_Csp_Helper_Data::class, 'currencysymbol' => \Mage_CurrencySymbol_Helper_Data::class, 'currencysymbol/data' => \Mage_CurrencySymbol_Helper_Data::class, 'customer/address' => \Mage_Customer_Helper_Address::class, @@ -1279,12 +1276,8 @@ 'page/layout' => \Mage_Page_Helper_Layout::class, 'payment' => \Mage_Payment_Helper_Data::class, 'payment/data' => \Mage_Payment_Helper_Data::class, - 'paypaluk' => \Mage_PaypalUk_Helper_Data::class, - 'paypaluk/data' => \Mage_PaypalUk_Helper_Data::class, - 'paypal/checkout' => \Mage_Paypal_Helper_Checkout::class, 'paypal' => \Mage_Paypal_Helper_Data::class, 'paypal/data' => \Mage_Paypal_Helper_Data::class, - 'paypal/hss' => \Mage_Paypal_Helper_Hss::class, 'persistent' => \Mage_Persistent_Helper_Data::class, 'persistent/data' => \Mage_Persistent_Helper_Data::class, 'persistent/session' => \Mage_Persistent_Helper_Session::class, @@ -1391,6 +1384,7 @@ 'catalog/product_url' => \Mage_Catalog_Helper_Product_Url::class, 'catalog/product_url_rewrite' => \Mage_Catalog_Helper_Product_Url_Rewrite::class, 'catalog/product_view' => \Mage_Catalog_Helper_Product_View::class, + 'catalog/search' => \Mage_Catalog_Helper_Search::class, 'centinel' => \Mage_Centinel_Helper_Data::class, 'centinel/data' => \Mage_Centinel_Helper_Data::class, 'checkout/cart' => \Mage_Checkout_Helper_Cart::class, @@ -1426,6 +1420,8 @@ 'core/unserializeArray' => \Mage_Core_Helper_UnserializeArray::class, 'core/url' => \Mage_Core_Helper_Url::class, 'core/url_rewrite' => \Mage_Core_Helper_Url_Rewrite::class, + 'csp' => \Mage_Csp_Helper_Data::class, + 'csp/data' => \Mage_Csp_Helper_Data::class, 'currencysymbol' => \Mage_CurrencySymbol_Helper_Data::class, 'currencysymbol/data' => \Mage_CurrencySymbol_Helper_Data::class, 'customer/address' => \Mage_Customer_Helper_Address::class, @@ -1469,12 +1465,8 @@ 'page/layout' => \Mage_Page_Helper_Layout::class, 'payment' => \Mage_Payment_Helper_Data::class, 'payment/data' => \Mage_Payment_Helper_Data::class, - 'paypaluk' => \Mage_PaypalUk_Helper_Data::class, - 'paypaluk/data' => \Mage_PaypalUk_Helper_Data::class, - 'paypal/checkout' => \Mage_Paypal_Helper_Checkout::class, 'paypal' => \Mage_Paypal_Helper_Data::class, 'paypal/data' => \Mage_Paypal_Helper_Data::class, - 'paypal/hss' => \Mage_Paypal_Helper_Hss::class, 'persistent' => \Mage_Persistent_Helper_Data::class, 'persistent/data' => \Mage_Persistent_Helper_Data::class, 'persistent/session' => \Mage_Persistent_Helper_Session::class, @@ -1581,6 +1573,7 @@ 'catalog/product_url' => \Mage_Catalog_Helper_Product_Url::class, 'catalog/product_url_rewrite' => \Mage_Catalog_Helper_Product_Url_Rewrite::class, 'catalog/product_view' => \Mage_Catalog_Helper_Product_View::class, + 'catalog/search' => \Mage_Catalog_Helper_Search::class, 'centinel' => \Mage_Centinel_Helper_Data::class, 'centinel/data' => \Mage_Centinel_Helper_Data::class, 'checkout/cart' => \Mage_Checkout_Helper_Cart::class, @@ -1616,6 +1609,8 @@ 'core/unserializeArray' => \Mage_Core_Helper_UnserializeArray::class, 'core/url' => \Mage_Core_Helper_Url::class, 'core/url_rewrite' => \Mage_Core_Helper_Url_Rewrite::class, + 'csp' => \Mage_Csp_Helper_Data::class, + 'csp/data' => \Mage_Csp_Helper_Data::class, 'currencysymbol' => \Mage_CurrencySymbol_Helper_Data::class, 'currencysymbol/data' => \Mage_CurrencySymbol_Helper_Data::class, 'customer/address' => \Mage_Customer_Helper_Address::class, @@ -1659,12 +1654,8 @@ 'page/layout' => \Mage_Page_Helper_Layout::class, 'payment' => \Mage_Payment_Helper_Data::class, 'payment/data' => \Mage_Payment_Helper_Data::class, - 'paypaluk' => \Mage_PaypalUk_Helper_Data::class, - 'paypaluk/data' => \Mage_PaypalUk_Helper_Data::class, - 'paypal/checkout' => \Mage_Paypal_Helper_Checkout::class, 'paypal' => \Mage_Paypal_Helper_Data::class, 'paypal/data' => \Mage_Paypal_Helper_Data::class, - 'paypal/hss' => \Mage_Paypal_Helper_Hss::class, 'persistent' => \Mage_Persistent_Helper_Data::class, 'persistent/data' => \Mage_Persistent_Helper_Data::class, 'persistent/session' => \Mage_Persistent_Helper_Session::class, @@ -1771,6 +1762,7 @@ 'catalog/product_url' => \Mage_Catalog_Helper_Product_Url::class, 'catalog/product_url_rewrite' => \Mage_Catalog_Helper_Product_Url_Rewrite::class, 'catalog/product_view' => \Mage_Catalog_Helper_Product_View::class, + 'catalog/search' => \Mage_Catalog_Helper_Search::class, 'centinel' => \Mage_Centinel_Helper_Data::class, 'centinel/data' => \Mage_Centinel_Helper_Data::class, 'checkout/cart' => \Mage_Checkout_Helper_Cart::class, @@ -1806,6 +1798,8 @@ 'core/unserializeArray' => \Mage_Core_Helper_UnserializeArray::class, 'core/url' => \Mage_Core_Helper_Url::class, 'core/url_rewrite' => \Mage_Core_Helper_Url_Rewrite::class, + 'csp' => \Mage_Csp_Helper_Data::class, + 'csp/data' => \Mage_Csp_Helper_Data::class, 'currencysymbol' => \Mage_CurrencySymbol_Helper_Data::class, 'currencysymbol/data' => \Mage_CurrencySymbol_Helper_Data::class, 'customer/address' => \Mage_Customer_Helper_Address::class, @@ -1849,12 +1843,8 @@ 'page/layout' => \Mage_Page_Helper_Layout::class, 'payment' => \Mage_Payment_Helper_Data::class, 'payment/data' => \Mage_Payment_Helper_Data::class, - 'paypaluk' => \Mage_PaypalUk_Helper_Data::class, - 'paypaluk/data' => \Mage_PaypalUk_Helper_Data::class, - 'paypal/checkout' => \Mage_Paypal_Helper_Checkout::class, 'paypal' => \Mage_Paypal_Helper_Data::class, 'paypal/data' => \Mage_Paypal_Helper_Data::class, - 'paypal/hss' => \Mage_Paypal_Helper_Hss::class, 'persistent' => \Mage_Persistent_Helper_Data::class, 'persistent/data' => \Mage_Persistent_Helper_Data::class, 'persistent/session' => \Mage_Persistent_Helper_Session::class, @@ -1961,6 +1951,7 @@ 'catalog/product_url' => \Mage_Catalog_Helper_Product_Url::class, 'catalog/product_url_rewrite' => \Mage_Catalog_Helper_Product_Url_Rewrite::class, 'catalog/product_view' => \Mage_Catalog_Helper_Product_View::class, + 'catalog/search' => \Mage_Catalog_Helper_Search::class, 'centinel' => \Mage_Centinel_Helper_Data::class, 'centinel/data' => \Mage_Centinel_Helper_Data::class, 'checkout/cart' => \Mage_Checkout_Helper_Cart::class, @@ -1996,6 +1987,8 @@ 'core/unserializeArray' => \Mage_Core_Helper_UnserializeArray::class, 'core/url' => \Mage_Core_Helper_Url::class, 'core/url_rewrite' => \Mage_Core_Helper_Url_Rewrite::class, + 'csp' => \Mage_Csp_Helper_Data::class, + 'csp/data' => \Mage_Csp_Helper_Data::class, 'currencysymbol' => \Mage_CurrencySymbol_Helper_Data::class, 'currencysymbol/data' => \Mage_CurrencySymbol_Helper_Data::class, 'customer/address' => \Mage_Customer_Helper_Address::class, @@ -2039,12 +2032,8 @@ 'page/layout' => \Mage_Page_Helper_Layout::class, 'payment' => \Mage_Payment_Helper_Data::class, 'payment/data' => \Mage_Payment_Helper_Data::class, - 'paypaluk' => \Mage_PaypalUk_Helper_Data::class, - 'paypaluk/data' => \Mage_PaypalUk_Helper_Data::class, - 'paypal/checkout' => \Mage_Paypal_Helper_Checkout::class, 'paypal' => \Mage_Paypal_Helper_Data::class, 'paypal/data' => \Mage_Paypal_Helper_Data::class, - 'paypal/hss' => \Mage_Paypal_Helper_Hss::class, 'persistent' => \Mage_Persistent_Helper_Data::class, 'persistent/data' => \Mage_Persistent_Helper_Data::class, 'persistent/session' => \Mage_Persistent_Helper_Session::class, @@ -2151,6 +2140,7 @@ 'catalog/product_url' => \Mage_Catalog_Helper_Product_Url::class, 'catalog/product_url_rewrite' => \Mage_Catalog_Helper_Product_Url_Rewrite::class, 'catalog/product_view' => \Mage_Catalog_Helper_Product_View::class, + 'catalog/search' => \Mage_Catalog_Helper_Search::class, 'centinel' => \Mage_Centinel_Helper_Data::class, 'centinel/data' => \Mage_Centinel_Helper_Data::class, 'checkout/cart' => \Mage_Checkout_Helper_Cart::class, @@ -2186,6 +2176,8 @@ 'core/unserializeArray' => \Mage_Core_Helper_UnserializeArray::class, 'core/url' => \Mage_Core_Helper_Url::class, 'core/url_rewrite' => \Mage_Core_Helper_Url_Rewrite::class, + 'csp' => \Mage_Csp_Helper_Data::class, + 'csp/data' => \Mage_Csp_Helper_Data::class, 'currencysymbol' => \Mage_CurrencySymbol_Helper_Data::class, 'currencysymbol/data' => \Mage_CurrencySymbol_Helper_Data::class, 'customer/address' => \Mage_Customer_Helper_Address::class, @@ -2229,12 +2221,8 @@ 'page/layout' => \Mage_Page_Helper_Layout::class, 'payment' => \Mage_Payment_Helper_Data::class, 'payment/data' => \Mage_Payment_Helper_Data::class, - 'paypaluk' => \Mage_PaypalUk_Helper_Data::class, - 'paypaluk/data' => \Mage_PaypalUk_Helper_Data::class, - 'paypal/checkout' => \Mage_Paypal_Helper_Checkout::class, 'paypal' => \Mage_Paypal_Helper_Data::class, 'paypal/data' => \Mage_Paypal_Helper_Data::class, - 'paypal/hss' => \Mage_Paypal_Helper_Hss::class, 'persistent' => \Mage_Persistent_Helper_Data::class, 'persistent/data' => \Mage_Persistent_Helper_Data::class, 'persistent/session' => \Mage_Persistent_Helper_Session::class, @@ -2341,6 +2329,7 @@ 'catalog/product_url' => \Mage_Catalog_Helper_Product_Url::class, 'catalog/product_url_rewrite' => \Mage_Catalog_Helper_Product_Url_Rewrite::class, 'catalog/product_view' => \Mage_Catalog_Helper_Product_View::class, + 'catalog/search' => \Mage_Catalog_Helper_Search::class, 'centinel' => \Mage_Centinel_Helper_Data::class, 'centinel/data' => \Mage_Centinel_Helper_Data::class, 'checkout/cart' => \Mage_Checkout_Helper_Cart::class, @@ -2376,6 +2365,8 @@ 'core/unserializeArray' => \Mage_Core_Helper_UnserializeArray::class, 'core/url' => \Mage_Core_Helper_Url::class, 'core/url_rewrite' => \Mage_Core_Helper_Url_Rewrite::class, + 'csp' => \Mage_Csp_Helper_Data::class, + 'csp/data' => \Mage_Csp_Helper_Data::class, 'currencysymbol' => \Mage_CurrencySymbol_Helper_Data::class, 'currencysymbol/data' => \Mage_CurrencySymbol_Helper_Data::class, 'customer/address' => \Mage_Customer_Helper_Address::class, @@ -2419,12 +2410,8 @@ 'page/layout' => \Mage_Page_Helper_Layout::class, 'payment' => \Mage_Payment_Helper_Data::class, 'payment/data' => \Mage_Payment_Helper_Data::class, - 'paypaluk' => \Mage_PaypalUk_Helper_Data::class, - 'paypaluk/data' => \Mage_PaypalUk_Helper_Data::class, - 'paypal/checkout' => \Mage_Paypal_Helper_Checkout::class, 'paypal' => \Mage_Paypal_Helper_Data::class, 'paypal/data' => \Mage_Paypal_Helper_Data::class, - 'paypal/hss' => \Mage_Paypal_Helper_Hss::class, 'persistent' => \Mage_Persistent_Helper_Data::class, 'persistent/data' => \Mage_Persistent_Helper_Data::class, 'persistent/session' => \Mage_Persistent_Helper_Session::class, @@ -2531,6 +2518,7 @@ 'catalog/product_url' => \Mage_Catalog_Helper_Product_Url::class, 'catalog/product_url_rewrite' => \Mage_Catalog_Helper_Product_Url_Rewrite::class, 'catalog/product_view' => \Mage_Catalog_Helper_Product_View::class, + 'catalog/search' => \Mage_Catalog_Helper_Search::class, 'centinel' => \Mage_Centinel_Helper_Data::class, 'centinel/data' => \Mage_Centinel_Helper_Data::class, 'checkout/cart' => \Mage_Checkout_Helper_Cart::class, @@ -2566,6 +2554,8 @@ 'core/unserializeArray' => \Mage_Core_Helper_UnserializeArray::class, 'core/url' => \Mage_Core_Helper_Url::class, 'core/url_rewrite' => \Mage_Core_Helper_Url_Rewrite::class, + 'csp' => \Mage_Csp_Helper_Data::class, + 'csp/data' => \Mage_Csp_Helper_Data::class, 'currencysymbol' => \Mage_CurrencySymbol_Helper_Data::class, 'currencysymbol/data' => \Mage_CurrencySymbol_Helper_Data::class, 'customer/address' => \Mage_Customer_Helper_Address::class, @@ -2609,12 +2599,8 @@ 'page/layout' => \Mage_Page_Helper_Layout::class, 'payment' => \Mage_Payment_Helper_Data::class, 'payment/data' => \Mage_Payment_Helper_Data::class, - 'paypaluk' => \Mage_PaypalUk_Helper_Data::class, - 'paypaluk/data' => \Mage_PaypalUk_Helper_Data::class, - 'paypal/checkout' => \Mage_Paypal_Helper_Checkout::class, 'paypal' => \Mage_Paypal_Helper_Data::class, 'paypal/data' => \Mage_Paypal_Helper_Data::class, - 'paypal/hss' => \Mage_Paypal_Helper_Hss::class, 'persistent' => \Mage_Persistent_Helper_Data::class, 'persistent/data' => \Mage_Persistent_Helper_Data::class, 'persistent/session' => \Mage_Persistent_Helper_Session::class, @@ -2721,6 +2707,7 @@ 'catalog/product_url' => \Mage_Catalog_Helper_Product_Url::class, 'catalog/product_url_rewrite' => \Mage_Catalog_Helper_Product_Url_Rewrite::class, 'catalog/product_view' => \Mage_Catalog_Helper_Product_View::class, + 'catalog/search' => \Mage_Catalog_Helper_Search::class, 'centinel' => \Mage_Centinel_Helper_Data::class, 'centinel/data' => \Mage_Centinel_Helper_Data::class, 'checkout/cart' => \Mage_Checkout_Helper_Cart::class, @@ -2756,6 +2743,8 @@ 'core/unserializeArray' => \Mage_Core_Helper_UnserializeArray::class, 'core/url' => \Mage_Core_Helper_Url::class, 'core/url_rewrite' => \Mage_Core_Helper_Url_Rewrite::class, + 'csp' => \Mage_Csp_Helper_Data::class, + 'csp/data' => \Mage_Csp_Helper_Data::class, 'currencysymbol' => \Mage_CurrencySymbol_Helper_Data::class, 'currencysymbol/data' => \Mage_CurrencySymbol_Helper_Data::class, 'customer/address' => \Mage_Customer_Helper_Address::class, @@ -2799,12 +2788,8 @@ 'page/layout' => \Mage_Page_Helper_Layout::class, 'payment' => \Mage_Payment_Helper_Data::class, 'payment/data' => \Mage_Payment_Helper_Data::class, - 'paypaluk' => \Mage_PaypalUk_Helper_Data::class, - 'paypaluk/data' => \Mage_PaypalUk_Helper_Data::class, - 'paypal/checkout' => \Mage_Paypal_Helper_Checkout::class, 'paypal' => \Mage_Paypal_Helper_Data::class, 'paypal/data' => \Mage_Paypal_Helper_Data::class, - 'paypal/hss' => \Mage_Paypal_Helper_Hss::class, 'persistent' => \Mage_Persistent_Helper_Data::class, 'persistent/data' => \Mage_Persistent_Helper_Data::class, 'persistent/session' => \Mage_Persistent_Helper_Session::class, @@ -2911,6 +2896,7 @@ 'catalog/product_url' => \Mage_Catalog_Helper_Product_Url::class, 'catalog/product_url_rewrite' => \Mage_Catalog_Helper_Product_Url_Rewrite::class, 'catalog/product_view' => \Mage_Catalog_Helper_Product_View::class, + 'catalog/search' => \Mage_Catalog_Helper_Search::class, 'centinel' => \Mage_Centinel_Helper_Data::class, 'centinel/data' => \Mage_Centinel_Helper_Data::class, 'checkout/cart' => \Mage_Checkout_Helper_Cart::class, @@ -2946,6 +2932,8 @@ 'core/unserializeArray' => \Mage_Core_Helper_UnserializeArray::class, 'core/url' => \Mage_Core_Helper_Url::class, 'core/url_rewrite' => \Mage_Core_Helper_Url_Rewrite::class, + 'csp' => \Mage_Csp_Helper_Data::class, + 'csp/data' => \Mage_Csp_Helper_Data::class, 'currencysymbol' => \Mage_CurrencySymbol_Helper_Data::class, 'currencysymbol/data' => \Mage_CurrencySymbol_Helper_Data::class, 'customer/address' => \Mage_Customer_Helper_Address::class, @@ -2989,12 +2977,8 @@ 'page/layout' => \Mage_Page_Helper_Layout::class, 'payment' => \Mage_Payment_Helper_Data::class, 'payment/data' => \Mage_Payment_Helper_Data::class, - 'paypaluk' => \Mage_PaypalUk_Helper_Data::class, - 'paypaluk/data' => \Mage_PaypalUk_Helper_Data::class, - 'paypal/checkout' => \Mage_Paypal_Helper_Checkout::class, 'paypal' => \Mage_Paypal_Helper_Data::class, 'paypal/data' => \Mage_Paypal_Helper_Data::class, - 'paypal/hss' => \Mage_Paypal_Helper_Hss::class, 'persistent' => \Mage_Persistent_Helper_Data::class, 'persistent/data' => \Mage_Persistent_Helper_Data::class, 'persistent/session' => \Mage_Persistent_Helper_Session::class, diff --git a/.phpstorm.meta.php/magento_models.meta.php b/.phpstorm.meta.php/magento_models.meta.php index 18ac65f08c0..b4ea905d249 100644 --- a/.phpstorm.meta.php/magento_models.meta.php +++ b/.phpstorm.meta.php/magento_models.meta.php @@ -181,6 +181,7 @@ 'adminhtml/system_config_source_customer_forgotpassword' => \Mage_Adminhtml_Model_System_Config_Source_Customer_Forgotpassword::class, 'adminhtml/system_config_source_customer_group' => \Mage_Adminhtml_Model_System_Config_Source_Customer_Group::class, 'adminhtml/system_config_source_customer_group_multiselect' => \Mage_Adminhtml_Model_System_Config_Source_Customer_Group_Multiselect::class, + 'adminhtml/system_config_source_dashboard_chart_type' => \Mage_Adminhtml_Model_System_Config_Source_Dashboard_Chart_Type::class, 'adminhtml/system_config_source_date_short' => \Mage_Adminhtml_Model_System_Config_Source_Date_Short::class, 'adminhtml/system_config_source_design_robots' => \Mage_Adminhtml_Model_System_Config_Source_Design_Robots::class, 'adminhtml/system_config_source_dev_dbautoup' => \Mage_Adminhtml_Model_System_Config_Source_Dev_Dbautoup::class, @@ -643,6 +644,7 @@ 'catalog/layer_filter_price_algorithm' => \Mage_Catalog_Model_Layer_Filter_Price_Algorithm::class, 'catalog/layer_state' => \Mage_Catalog_Model_Layer_State::class, 'catalog/observer' => \Mage_Catalog_Model_Observer::class, + 'catalog/observer_disableAdvancedSearch' => \Mage_Catalog_Model_Observer_DisableAdvancedSearch::class, 'catalog/product' => \Mage_Catalog_Model_Product::class, 'catalog/product_action' => \Mage_Catalog_Model_Product_Action::class, 'catalog/product_api' => \Mage_Catalog_Model_Product_Api::class, @@ -1322,6 +1324,9 @@ 'cron/resource_schedule_collection' => \Mage_Cron_Model_Resource_Schedule_Collection::class, 'cron_resource/schedule_collection' => \Mage_Cron_Model_Resource_Schedule_Collection::class, 'cron/schedule' => \Mage_Cron_Model_Schedule::class, + 'csp/observer_abstract' => \Mage_Csp_Model_Observer_Abstract::class, + 'csp/observer_addAdminCspHeaders' => \Mage_Csp_Model_Observer_AddAdminCspHeaders::class, + 'csp/observer_addFrontendCspHeaders' => \Mage_Csp_Model_Observer_AddFrontendCspHeaders::class, 'currencysymbol/observer' => \Mage_CurrencySymbol_Model_Observer::class, 'currencysymbol/system_currencysymbol' => \Mage_CurrencySymbol_Model_System_Currencysymbol::class, 'customer/address' => \Mage_Customer_Model_Address::class, @@ -1930,76 +1935,30 @@ 'payment/recurring_profile' => \Mage_Payment_Model_Recurring_Profile::class, 'payment/source_cctype' => \Mage_Payment_Model_Source_Cctype::class, 'payment/source_invoice' => \Mage_Payment_Model_Source_Invoice::class, - 'paypaluk/api_express_nvp' => \Mage_PaypalUk_Model_Api_Express_Nvp::class, - 'paypaluk/api_nvp' => \Mage_PaypalUk_Model_Api_Nvp::class, - 'paypaluk/bml' => \Mage_PaypalUk_Model_Bml::class, - 'paypaluk/direct' => \Mage_PaypalUk_Model_Direct::class, - 'paypaluk/express' => \Mage_PaypalUk_Model_Express::class, - 'paypaluk/express_checkout' => \Mage_PaypalUk_Model_Express_Checkout::class, - 'paypaluk/express_pro' => \Mage_PaypalUk_Model_Express_Pro::class, - 'paypaluk/pro' => \Mage_PaypalUk_Model_Pro::class, - 'paypaluk/session' => \Mage_PaypalUk_Model_Session::class, - 'paypal/api_abstract' => \Mage_Paypal_Model_Api_Abstract::class, - 'paypal/api_nvp' => \Mage_Paypal_Model_Api_Nvp::class, - 'paypal/api_processableException' => \Mage_Paypal_Model_Api_ProcessableException::class, - 'paypal/api_standard' => \Mage_Paypal_Model_Api_Standard::class, - 'paypal/bml' => \Mage_Paypal_Model_Bml::class, + 'paypal/api' => \Mage_Paypal_Model_Api::class, 'paypal/cart' => \Mage_Paypal_Model_Cart::class, - 'paypal/cert' => \Mage_Paypal_Model_Cert::class, 'paypal/config' => \Mage_Paypal_Model_Config::class, - 'paypal/direct' => \Mage_Paypal_Model_Direct::class, - 'paypal/express' => \Mage_Paypal_Model_Express::class, - 'paypal/express_checkout' => \Mage_Paypal_Model_Express_Checkout::class, - 'paypal/hostedpro' => \Mage_Paypal_Model_Hostedpro::class, - 'paypal/hostedpro_request' => \Mage_Paypal_Model_Hostedpro_Request::class, - 'paypal/info' => \Mage_Paypal_Model_Info::class, - 'paypal/ipn' => \Mage_Paypal_Model_Ipn::class, - 'paypal/method_agreement' => \Mage_Paypal_Model_Method_Agreement::class, - 'paypal/mysql4_cert' => \Mage_Paypal_Model_Mysql4_Cert::class, - 'paypal/mysql4_report_settlement' => \Mage_Paypal_Model_Mysql4_Report_Settlement::class, - 'paypal/mysql4_report_settlement_row' => \Mage_Paypal_Model_Mysql4_Report_Settlement_Row::class, - 'paypal/mysql4_report_settlement_row_collection' => \Mage_Paypal_Model_Mysql4_Report_Settlement_Row_Collection::class, - 'paypal/mysql4_setup' => \Mage_Paypal_Model_Mysql4_Setup::class, - 'paypal/observer' => \Mage_Paypal_Model_Observer::class, - 'paypal/payflow_request' => \Mage_Paypal_Model_Payflow_Request::class, - 'paypal/payflowadvanced' => \Mage_Paypal_Model_Payflowadvanced::class, - 'paypal/payflowlink' => \Mage_Paypal_Model_Payflowlink::class, - 'paypal/payflowpro' => \Mage_Paypal_Model_Payflowpro::class, - 'paypal/payment_transaction' => \Mage_Paypal_Model_Payment_Transaction::class, - 'paypal/pro' => \Mage_Paypal_Model_Pro::class, - 'paypal/report_settlement' => \Mage_Paypal_Model_Report_Settlement::class, - 'paypal/report_settlement_row' => \Mage_Paypal_Model_Report_Settlement_Row::class, - 'paypal/resource_cert' => \Mage_Paypal_Model_Resource_Cert::class, - 'paypal_resource/cert' => \Mage_Paypal_Model_Resource_Cert::class, - 'paypal/resource_payment_transaction' => \Mage_Paypal_Model_Resource_Payment_Transaction::class, - 'paypal_resource/payment_transaction' => \Mage_Paypal_Model_Resource_Payment_Transaction::class, - 'paypal/resource_payment_transaction_collection' => \Mage_Paypal_Model_Resource_Payment_Transaction_Collection::class, - 'paypal_resource/payment_transaction_collection' => \Mage_Paypal_Model_Resource_Payment_Transaction_Collection::class, - 'paypal/resource_report_settlement' => \Mage_Paypal_Model_Resource_Report_Settlement::class, - 'paypal_resource/report_settlement' => \Mage_Paypal_Model_Resource_Report_Settlement::class, - 'paypal/resource_report_settlement_row' => \Mage_Paypal_Model_Resource_Report_Settlement_Row::class, - 'paypal_resource/report_settlement_row' => \Mage_Paypal_Model_Resource_Report_Settlement_Row::class, - 'paypal/resource_report_settlement_row_collection' => \Mage_Paypal_Model_Resource_Report_Settlement_Row_Collection::class, - 'paypal_resource/report_settlement_row_collection' => \Mage_Paypal_Model_Resource_Report_Settlement_Row_Collection::class, + 'paypal/cron' => \Mage_Paypal_Model_Cron::class, + 'paypal/debug' => \Mage_Paypal_Model_Debug::class, + 'paypal/exception' => \Mage_Paypal_Model_Exception::class, + 'paypal/helper' => \Mage_Paypal_Model_Helper::class, + 'paypal/order' => \Mage_Paypal_Model_Order::class, + 'paypal/payment' => \Mage_Paypal_Model_Payment::class, + 'paypal/paypal' => \Mage_Paypal_Model_Paypal::class, + 'paypal/resource_debug' => \Mage_Paypal_Model_Resource_Debug::class, + 'paypal_resource/debug' => \Mage_Paypal_Model_Resource_Debug::class, + 'paypal/resource_debug_collection' => \Mage_Paypal_Model_Resource_Debug_Collection::class, + 'paypal_resource/debug_collection' => \Mage_Paypal_Model_Resource_Debug_Collection::class, 'paypal/resource_setup' => \Mage_Paypal_Model_Resource_Setup::class, 'paypal_resource/setup' => \Mage_Paypal_Model_Resource_Setup::class, - 'paypal/session' => \Mage_Paypal_Model_Session::class, - 'paypal/standard' => \Mage_Paypal_Model_Standard::class, - 'paypal/system_config_backend_cert' => \Mage_Paypal_Model_System_Config_Backend_Cert::class, - 'paypal/system_config_backend_cron' => \Mage_Paypal_Model_System_Config_Backend_Cron::class, 'paypal/system_config_backend_merchantCountry' => \Mage_Paypal_Model_System_Config_Backend_MerchantCountry::class, - 'paypal/system_config_source_authorizationAmounts' => \Mage_Paypal_Model_System_Config_Source_AuthorizationAmounts::class, - 'paypal/system_config_source_bmlPosition' => \Mage_Paypal_Model_System_Config_Source_BmlPosition::class, - 'paypal/system_config_source_bmlSize' => \Mage_Paypal_Model_System_Config_Source_BmlSize::class, - 'paypal/system_config_source_buyerCountry' => \Mage_Paypal_Model_System_Config_Source_BuyerCountry::class, - 'paypal/system_config_source_fetchingSchedule' => \Mage_Paypal_Model_System_Config_Source_FetchingSchedule::class, - 'paypal/system_config_source_logo' => \Mage_Paypal_Model_System_Config_Source_Logo::class, + 'paypal/system_config_source_buttonColors' => \Mage_Paypal_Model_System_Config_Source_ButtonColors::class, + 'paypal/system_config_source_buttonLabels' => \Mage_Paypal_Model_System_Config_Source_ButtonLabels::class, + 'paypal/system_config_source_buttonLayouts' => \Mage_Paypal_Model_System_Config_Source_ButtonLayouts::class, + 'paypal/system_config_source_buttonShapes' => \Mage_Paypal_Model_System_Config_Source_ButtonShapes::class, 'paypal/system_config_source_merchantCountry' => \Mage_Paypal_Model_System_Config_Source_MerchantCountry::class, 'paypal/system_config_source_paymentActions' => \Mage_Paypal_Model_System_Config_Source_PaymentActions::class, - 'paypal/system_config_source_paymentActions_express' => \Mage_Paypal_Model_System_Config_Source_PaymentActions_Express::class, - 'paypal/system_config_source_requireBillingAddress' => \Mage_Paypal_Model_System_Config_Source_RequireBillingAddress::class, - 'paypal/system_config_source_urlMethod' => \Mage_Paypal_Model_System_Config_Source_UrlMethod::class, - 'paypal/system_config_source_yesnoShortcut' => \Mage_Paypal_Model_System_Config_Source_YesnoShortcut::class, + 'paypal/transaction' => \Mage_Paypal_Model_Transaction::class, 'persistent/observer' => \Mage_Persistent_Model_Observer::class, 'persistent/observer_session' => \Mage_Persistent_Model_Observer_Session::class, 'persistent/persistent_config' => \Mage_Persistent_Model_Persistent_Config::class, @@ -3337,6 +3296,7 @@ 'adminhtml/system_config_source_customer_forgotpassword' => \Mage_Adminhtml_Model_System_Config_Source_Customer_Forgotpassword::class, 'adminhtml/system_config_source_customer_group' => \Mage_Adminhtml_Model_System_Config_Source_Customer_Group::class, 'adminhtml/system_config_source_customer_group_multiselect' => \Mage_Adminhtml_Model_System_Config_Source_Customer_Group_Multiselect::class, + 'adminhtml/system_config_source_dashboard_chart_type' => \Mage_Adminhtml_Model_System_Config_Source_Dashboard_Chart_Type::class, 'adminhtml/system_config_source_date_short' => \Mage_Adminhtml_Model_System_Config_Source_Date_Short::class, 'adminhtml/system_config_source_design_robots' => \Mage_Adminhtml_Model_System_Config_Source_Design_Robots::class, 'adminhtml/system_config_source_dev_dbautoup' => \Mage_Adminhtml_Model_System_Config_Source_Dev_Dbautoup::class, @@ -3799,6 +3759,7 @@ 'catalog/layer_filter_price_algorithm' => \Mage_Catalog_Model_Layer_Filter_Price_Algorithm::class, 'catalog/layer_state' => \Mage_Catalog_Model_Layer_State::class, 'catalog/observer' => \Mage_Catalog_Model_Observer::class, + 'catalog/observer_disableAdvancedSearch' => \Mage_Catalog_Model_Observer_DisableAdvancedSearch::class, 'catalog/product' => \Mage_Catalog_Model_Product::class, 'catalog/product_action' => \Mage_Catalog_Model_Product_Action::class, 'catalog/product_api' => \Mage_Catalog_Model_Product_Api::class, @@ -4478,6 +4439,9 @@ 'cron/resource_schedule_collection' => \Mage_Cron_Model_Resource_Schedule_Collection::class, 'cron_resource/schedule_collection' => \Mage_Cron_Model_Resource_Schedule_Collection::class, 'cron/schedule' => \Mage_Cron_Model_Schedule::class, + 'csp/observer_abstract' => \Mage_Csp_Model_Observer_Abstract::class, + 'csp/observer_addAdminCspHeaders' => \Mage_Csp_Model_Observer_AddAdminCspHeaders::class, + 'csp/observer_addFrontendCspHeaders' => \Mage_Csp_Model_Observer_AddFrontendCspHeaders::class, 'currencysymbol/observer' => \Mage_CurrencySymbol_Model_Observer::class, 'currencysymbol/system_currencysymbol' => \Mage_CurrencySymbol_Model_System_Currencysymbol::class, 'customer/address' => \Mage_Customer_Model_Address::class, @@ -5086,76 +5050,30 @@ 'payment/recurring_profile' => \Mage_Payment_Model_Recurring_Profile::class, 'payment/source_cctype' => \Mage_Payment_Model_Source_Cctype::class, 'payment/source_invoice' => \Mage_Payment_Model_Source_Invoice::class, - 'paypaluk/api_express_nvp' => \Mage_PaypalUk_Model_Api_Express_Nvp::class, - 'paypaluk/api_nvp' => \Mage_PaypalUk_Model_Api_Nvp::class, - 'paypaluk/bml' => \Mage_PaypalUk_Model_Bml::class, - 'paypaluk/direct' => \Mage_PaypalUk_Model_Direct::class, - 'paypaluk/express' => \Mage_PaypalUk_Model_Express::class, - 'paypaluk/express_checkout' => \Mage_PaypalUk_Model_Express_Checkout::class, - 'paypaluk/express_pro' => \Mage_PaypalUk_Model_Express_Pro::class, - 'paypaluk/pro' => \Mage_PaypalUk_Model_Pro::class, - 'paypaluk/session' => \Mage_PaypalUk_Model_Session::class, - 'paypal/api_abstract' => \Mage_Paypal_Model_Api_Abstract::class, - 'paypal/api_nvp' => \Mage_Paypal_Model_Api_Nvp::class, - 'paypal/api_processableException' => \Mage_Paypal_Model_Api_ProcessableException::class, - 'paypal/api_standard' => \Mage_Paypal_Model_Api_Standard::class, - 'paypal/bml' => \Mage_Paypal_Model_Bml::class, + 'paypal/api' => \Mage_Paypal_Model_Api::class, 'paypal/cart' => \Mage_Paypal_Model_Cart::class, - 'paypal/cert' => \Mage_Paypal_Model_Cert::class, 'paypal/config' => \Mage_Paypal_Model_Config::class, - 'paypal/direct' => \Mage_Paypal_Model_Direct::class, - 'paypal/express' => \Mage_Paypal_Model_Express::class, - 'paypal/express_checkout' => \Mage_Paypal_Model_Express_Checkout::class, - 'paypal/hostedpro' => \Mage_Paypal_Model_Hostedpro::class, - 'paypal/hostedpro_request' => \Mage_Paypal_Model_Hostedpro_Request::class, - 'paypal/info' => \Mage_Paypal_Model_Info::class, - 'paypal/ipn' => \Mage_Paypal_Model_Ipn::class, - 'paypal/method_agreement' => \Mage_Paypal_Model_Method_Agreement::class, - 'paypal/mysql4_cert' => \Mage_Paypal_Model_Mysql4_Cert::class, - 'paypal/mysql4_report_settlement' => \Mage_Paypal_Model_Mysql4_Report_Settlement::class, - 'paypal/mysql4_report_settlement_row' => \Mage_Paypal_Model_Mysql4_Report_Settlement_Row::class, - 'paypal/mysql4_report_settlement_row_collection' => \Mage_Paypal_Model_Mysql4_Report_Settlement_Row_Collection::class, - 'paypal/mysql4_setup' => \Mage_Paypal_Model_Mysql4_Setup::class, - 'paypal/observer' => \Mage_Paypal_Model_Observer::class, - 'paypal/payflow_request' => \Mage_Paypal_Model_Payflow_Request::class, - 'paypal/payflowadvanced' => \Mage_Paypal_Model_Payflowadvanced::class, - 'paypal/payflowlink' => \Mage_Paypal_Model_Payflowlink::class, - 'paypal/payflowpro' => \Mage_Paypal_Model_Payflowpro::class, - 'paypal/payment_transaction' => \Mage_Paypal_Model_Payment_Transaction::class, - 'paypal/pro' => \Mage_Paypal_Model_Pro::class, - 'paypal/report_settlement' => \Mage_Paypal_Model_Report_Settlement::class, - 'paypal/report_settlement_row' => \Mage_Paypal_Model_Report_Settlement_Row::class, - 'paypal/resource_cert' => \Mage_Paypal_Model_Resource_Cert::class, - 'paypal_resource/cert' => \Mage_Paypal_Model_Resource_Cert::class, - 'paypal/resource_payment_transaction' => \Mage_Paypal_Model_Resource_Payment_Transaction::class, - 'paypal_resource/payment_transaction' => \Mage_Paypal_Model_Resource_Payment_Transaction::class, - 'paypal/resource_payment_transaction_collection' => \Mage_Paypal_Model_Resource_Payment_Transaction_Collection::class, - 'paypal_resource/payment_transaction_collection' => \Mage_Paypal_Model_Resource_Payment_Transaction_Collection::class, - 'paypal/resource_report_settlement' => \Mage_Paypal_Model_Resource_Report_Settlement::class, - 'paypal_resource/report_settlement' => \Mage_Paypal_Model_Resource_Report_Settlement::class, - 'paypal/resource_report_settlement_row' => \Mage_Paypal_Model_Resource_Report_Settlement_Row::class, - 'paypal_resource/report_settlement_row' => \Mage_Paypal_Model_Resource_Report_Settlement_Row::class, - 'paypal/resource_report_settlement_row_collection' => \Mage_Paypal_Model_Resource_Report_Settlement_Row_Collection::class, - 'paypal_resource/report_settlement_row_collection' => \Mage_Paypal_Model_Resource_Report_Settlement_Row_Collection::class, + 'paypal/cron' => \Mage_Paypal_Model_Cron::class, + 'paypal/debug' => \Mage_Paypal_Model_Debug::class, + 'paypal/exception' => \Mage_Paypal_Model_Exception::class, + 'paypal/helper' => \Mage_Paypal_Model_Helper::class, + 'paypal/order' => \Mage_Paypal_Model_Order::class, + 'paypal/payment' => \Mage_Paypal_Model_Payment::class, + 'paypal/paypal' => \Mage_Paypal_Model_Paypal::class, + 'paypal/resource_debug' => \Mage_Paypal_Model_Resource_Debug::class, + 'paypal_resource/debug' => \Mage_Paypal_Model_Resource_Debug::class, + 'paypal/resource_debug_collection' => \Mage_Paypal_Model_Resource_Debug_Collection::class, + 'paypal_resource/debug_collection' => \Mage_Paypal_Model_Resource_Debug_Collection::class, 'paypal/resource_setup' => \Mage_Paypal_Model_Resource_Setup::class, 'paypal_resource/setup' => \Mage_Paypal_Model_Resource_Setup::class, - 'paypal/session' => \Mage_Paypal_Model_Session::class, - 'paypal/standard' => \Mage_Paypal_Model_Standard::class, - 'paypal/system_config_backend_cert' => \Mage_Paypal_Model_System_Config_Backend_Cert::class, - 'paypal/system_config_backend_cron' => \Mage_Paypal_Model_System_Config_Backend_Cron::class, 'paypal/system_config_backend_merchantCountry' => \Mage_Paypal_Model_System_Config_Backend_MerchantCountry::class, - 'paypal/system_config_source_authorizationAmounts' => \Mage_Paypal_Model_System_Config_Source_AuthorizationAmounts::class, - 'paypal/system_config_source_bmlPosition' => \Mage_Paypal_Model_System_Config_Source_BmlPosition::class, - 'paypal/system_config_source_bmlSize' => \Mage_Paypal_Model_System_Config_Source_BmlSize::class, - 'paypal/system_config_source_buyerCountry' => \Mage_Paypal_Model_System_Config_Source_BuyerCountry::class, - 'paypal/system_config_source_fetchingSchedule' => \Mage_Paypal_Model_System_Config_Source_FetchingSchedule::class, - 'paypal/system_config_source_logo' => \Mage_Paypal_Model_System_Config_Source_Logo::class, + 'paypal/system_config_source_buttonColors' => \Mage_Paypal_Model_System_Config_Source_ButtonColors::class, + 'paypal/system_config_source_buttonLabels' => \Mage_Paypal_Model_System_Config_Source_ButtonLabels::class, + 'paypal/system_config_source_buttonLayouts' => \Mage_Paypal_Model_System_Config_Source_ButtonLayouts::class, + 'paypal/system_config_source_buttonShapes' => \Mage_Paypal_Model_System_Config_Source_ButtonShapes::class, 'paypal/system_config_source_merchantCountry' => \Mage_Paypal_Model_System_Config_Source_MerchantCountry::class, 'paypal/system_config_source_paymentActions' => \Mage_Paypal_Model_System_Config_Source_PaymentActions::class, - 'paypal/system_config_source_paymentActions_express' => \Mage_Paypal_Model_System_Config_Source_PaymentActions_Express::class, - 'paypal/system_config_source_requireBillingAddress' => \Mage_Paypal_Model_System_Config_Source_RequireBillingAddress::class, - 'paypal/system_config_source_urlMethod' => \Mage_Paypal_Model_System_Config_Source_UrlMethod::class, - 'paypal/system_config_source_yesnoShortcut' => \Mage_Paypal_Model_System_Config_Source_YesnoShortcut::class, + 'paypal/transaction' => \Mage_Paypal_Model_Transaction::class, 'persistent/observer' => \Mage_Persistent_Model_Observer::class, 'persistent/observer_session' => \Mage_Persistent_Model_Observer_Session::class, 'persistent/persistent_config' => \Mage_Persistent_Model_Persistent_Config::class, diff --git a/.phpstorm.meta.php/magento_models_methods.meta.php b/.phpstorm.meta.php/magento_models_methods.meta.php index a43119c4fee..ce0a861d2f3 100644 --- a/.phpstorm.meta.php/magento_models_methods.meta.php +++ b/.phpstorm.meta.php/magento_models_methods.meta.php @@ -181,6 +181,7 @@ 'adminhtml/system_config_source_customer_forgotpassword' => \Mage_Adminhtml_Model_System_Config_Source_Customer_Forgotpassword::class, 'adminhtml/system_config_source_customer_group' => \Mage_Adminhtml_Model_System_Config_Source_Customer_Group::class, 'adminhtml/system_config_source_customer_group_multiselect' => \Mage_Adminhtml_Model_System_Config_Source_Customer_Group_Multiselect::class, + 'adminhtml/system_config_source_dashboard_chart_type' => \Mage_Adminhtml_Model_System_Config_Source_Dashboard_Chart_Type::class, 'adminhtml/system_config_source_date_short' => \Mage_Adminhtml_Model_System_Config_Source_Date_Short::class, 'adminhtml/system_config_source_design_robots' => \Mage_Adminhtml_Model_System_Config_Source_Design_Robots::class, 'adminhtml/system_config_source_dev_dbautoup' => \Mage_Adminhtml_Model_System_Config_Source_Dev_Dbautoup::class, @@ -643,6 +644,7 @@ 'catalog/layer_filter_price_algorithm' => \Mage_Catalog_Model_Layer_Filter_Price_Algorithm::class, 'catalog/layer_state' => \Mage_Catalog_Model_Layer_State::class, 'catalog/observer' => \Mage_Catalog_Model_Observer::class, + 'catalog/observer_disableAdvancedSearch' => \Mage_Catalog_Model_Observer_DisableAdvancedSearch::class, 'catalog/product' => \Mage_Catalog_Model_Product::class, 'catalog/product_action' => \Mage_Catalog_Model_Product_Action::class, 'catalog/product_api' => \Mage_Catalog_Model_Product_Api::class, @@ -1322,6 +1324,9 @@ 'cron/resource_schedule_collection' => \Mage_Cron_Model_Resource_Schedule_Collection::class, 'cron_resource/schedule_collection' => \Mage_Cron_Model_Resource_Schedule_Collection::class, 'cron/schedule' => \Mage_Cron_Model_Schedule::class, + 'csp/observer_abstract' => \Mage_Csp_Model_Observer_Abstract::class, + 'csp/observer_addAdminCspHeaders' => \Mage_Csp_Model_Observer_AddAdminCspHeaders::class, + 'csp/observer_addFrontendCspHeaders' => \Mage_Csp_Model_Observer_AddFrontendCspHeaders::class, 'currencysymbol/observer' => \Mage_CurrencySymbol_Model_Observer::class, 'currencysymbol/system_currencysymbol' => \Mage_CurrencySymbol_Model_System_Currencysymbol::class, 'customer/address' => \Mage_Customer_Model_Address::class, @@ -1930,76 +1935,30 @@ 'payment/recurring_profile' => \Mage_Payment_Model_Recurring_Profile::class, 'payment/source_cctype' => \Mage_Payment_Model_Source_Cctype::class, 'payment/source_invoice' => \Mage_Payment_Model_Source_Invoice::class, - 'paypaluk/api_express_nvp' => \Mage_PaypalUk_Model_Api_Express_Nvp::class, - 'paypaluk/api_nvp' => \Mage_PaypalUk_Model_Api_Nvp::class, - 'paypaluk/bml' => \Mage_PaypalUk_Model_Bml::class, - 'paypaluk/direct' => \Mage_PaypalUk_Model_Direct::class, - 'paypaluk/express' => \Mage_PaypalUk_Model_Express::class, - 'paypaluk/express_checkout' => \Mage_PaypalUk_Model_Express_Checkout::class, - 'paypaluk/express_pro' => \Mage_PaypalUk_Model_Express_Pro::class, - 'paypaluk/pro' => \Mage_PaypalUk_Model_Pro::class, - 'paypaluk/session' => \Mage_PaypalUk_Model_Session::class, - 'paypal/api_abstract' => \Mage_Paypal_Model_Api_Abstract::class, - 'paypal/api_nvp' => \Mage_Paypal_Model_Api_Nvp::class, - 'paypal/api_processableException' => \Mage_Paypal_Model_Api_ProcessableException::class, - 'paypal/api_standard' => \Mage_Paypal_Model_Api_Standard::class, - 'paypal/bml' => \Mage_Paypal_Model_Bml::class, + 'paypal/api' => \Mage_Paypal_Model_Api::class, 'paypal/cart' => \Mage_Paypal_Model_Cart::class, - 'paypal/cert' => \Mage_Paypal_Model_Cert::class, 'paypal/config' => \Mage_Paypal_Model_Config::class, - 'paypal/direct' => \Mage_Paypal_Model_Direct::class, - 'paypal/express' => \Mage_Paypal_Model_Express::class, - 'paypal/express_checkout' => \Mage_Paypal_Model_Express_Checkout::class, - 'paypal/hostedpro' => \Mage_Paypal_Model_Hostedpro::class, - 'paypal/hostedpro_request' => \Mage_Paypal_Model_Hostedpro_Request::class, - 'paypal/info' => \Mage_Paypal_Model_Info::class, - 'paypal/ipn' => \Mage_Paypal_Model_Ipn::class, - 'paypal/method_agreement' => \Mage_Paypal_Model_Method_Agreement::class, - 'paypal/mysql4_cert' => \Mage_Paypal_Model_Mysql4_Cert::class, - 'paypal/mysql4_report_settlement' => \Mage_Paypal_Model_Mysql4_Report_Settlement::class, - 'paypal/mysql4_report_settlement_row' => \Mage_Paypal_Model_Mysql4_Report_Settlement_Row::class, - 'paypal/mysql4_report_settlement_row_collection' => \Mage_Paypal_Model_Mysql4_Report_Settlement_Row_Collection::class, - 'paypal/mysql4_setup' => \Mage_Paypal_Model_Mysql4_Setup::class, - 'paypal/observer' => \Mage_Paypal_Model_Observer::class, - 'paypal/payflow_request' => \Mage_Paypal_Model_Payflow_Request::class, - 'paypal/payflowadvanced' => \Mage_Paypal_Model_Payflowadvanced::class, - 'paypal/payflowlink' => \Mage_Paypal_Model_Payflowlink::class, - 'paypal/payflowpro' => \Mage_Paypal_Model_Payflowpro::class, - 'paypal/payment_transaction' => \Mage_Paypal_Model_Payment_Transaction::class, - 'paypal/pro' => \Mage_Paypal_Model_Pro::class, - 'paypal/report_settlement' => \Mage_Paypal_Model_Report_Settlement::class, - 'paypal/report_settlement_row' => \Mage_Paypal_Model_Report_Settlement_Row::class, - 'paypal/resource_cert' => \Mage_Paypal_Model_Resource_Cert::class, - 'paypal_resource/cert' => \Mage_Paypal_Model_Resource_Cert::class, - 'paypal/resource_payment_transaction' => \Mage_Paypal_Model_Resource_Payment_Transaction::class, - 'paypal_resource/payment_transaction' => \Mage_Paypal_Model_Resource_Payment_Transaction::class, - 'paypal/resource_payment_transaction_collection' => \Mage_Paypal_Model_Resource_Payment_Transaction_Collection::class, - 'paypal_resource/payment_transaction_collection' => \Mage_Paypal_Model_Resource_Payment_Transaction_Collection::class, - 'paypal/resource_report_settlement' => \Mage_Paypal_Model_Resource_Report_Settlement::class, - 'paypal_resource/report_settlement' => \Mage_Paypal_Model_Resource_Report_Settlement::class, - 'paypal/resource_report_settlement_row' => \Mage_Paypal_Model_Resource_Report_Settlement_Row::class, - 'paypal_resource/report_settlement_row' => \Mage_Paypal_Model_Resource_Report_Settlement_Row::class, - 'paypal/resource_report_settlement_row_collection' => \Mage_Paypal_Model_Resource_Report_Settlement_Row_Collection::class, - 'paypal_resource/report_settlement_row_collection' => \Mage_Paypal_Model_Resource_Report_Settlement_Row_Collection::class, + 'paypal/cron' => \Mage_Paypal_Model_Cron::class, + 'paypal/debug' => \Mage_Paypal_Model_Debug::class, + 'paypal/exception' => \Mage_Paypal_Model_Exception::class, + 'paypal/helper' => \Mage_Paypal_Model_Helper::class, + 'paypal/order' => \Mage_Paypal_Model_Order::class, + 'paypal/payment' => \Mage_Paypal_Model_Payment::class, + 'paypal/paypal' => \Mage_Paypal_Model_Paypal::class, + 'paypal/resource_debug' => \Mage_Paypal_Model_Resource_Debug::class, + 'paypal_resource/debug' => \Mage_Paypal_Model_Resource_Debug::class, + 'paypal/resource_debug_collection' => \Mage_Paypal_Model_Resource_Debug_Collection::class, + 'paypal_resource/debug_collection' => \Mage_Paypal_Model_Resource_Debug_Collection::class, 'paypal/resource_setup' => \Mage_Paypal_Model_Resource_Setup::class, 'paypal_resource/setup' => \Mage_Paypal_Model_Resource_Setup::class, - 'paypal/session' => \Mage_Paypal_Model_Session::class, - 'paypal/standard' => \Mage_Paypal_Model_Standard::class, - 'paypal/system_config_backend_cert' => \Mage_Paypal_Model_System_Config_Backend_Cert::class, - 'paypal/system_config_backend_cron' => \Mage_Paypal_Model_System_Config_Backend_Cron::class, 'paypal/system_config_backend_merchantCountry' => \Mage_Paypal_Model_System_Config_Backend_MerchantCountry::class, - 'paypal/system_config_source_authorizationAmounts' => \Mage_Paypal_Model_System_Config_Source_AuthorizationAmounts::class, - 'paypal/system_config_source_bmlPosition' => \Mage_Paypal_Model_System_Config_Source_BmlPosition::class, - 'paypal/system_config_source_bmlSize' => \Mage_Paypal_Model_System_Config_Source_BmlSize::class, - 'paypal/system_config_source_buyerCountry' => \Mage_Paypal_Model_System_Config_Source_BuyerCountry::class, - 'paypal/system_config_source_fetchingSchedule' => \Mage_Paypal_Model_System_Config_Source_FetchingSchedule::class, - 'paypal/system_config_source_logo' => \Mage_Paypal_Model_System_Config_Source_Logo::class, + 'paypal/system_config_source_buttonColors' => \Mage_Paypal_Model_System_Config_Source_ButtonColors::class, + 'paypal/system_config_source_buttonLabels' => \Mage_Paypal_Model_System_Config_Source_ButtonLabels::class, + 'paypal/system_config_source_buttonLayouts' => \Mage_Paypal_Model_System_Config_Source_ButtonLayouts::class, + 'paypal/system_config_source_buttonShapes' => \Mage_Paypal_Model_System_Config_Source_ButtonShapes::class, 'paypal/system_config_source_merchantCountry' => \Mage_Paypal_Model_System_Config_Source_MerchantCountry::class, 'paypal/system_config_source_paymentActions' => \Mage_Paypal_Model_System_Config_Source_PaymentActions::class, - 'paypal/system_config_source_paymentActions_express' => \Mage_Paypal_Model_System_Config_Source_PaymentActions_Express::class, - 'paypal/system_config_source_requireBillingAddress' => \Mage_Paypal_Model_System_Config_Source_RequireBillingAddress::class, - 'paypal/system_config_source_urlMethod' => \Mage_Paypal_Model_System_Config_Source_UrlMethod::class, - 'paypal/system_config_source_yesnoShortcut' => \Mage_Paypal_Model_System_Config_Source_YesnoShortcut::class, + 'paypal/transaction' => \Mage_Paypal_Model_Transaction::class, 'persistent/observer' => \Mage_Persistent_Model_Observer::class, 'persistent/observer_session' => \Mage_Persistent_Model_Observer_Session::class, 'persistent/persistent_config' => \Mage_Persistent_Model_Persistent_Config::class, @@ -3337,6 +3296,7 @@ 'adminhtml/system_config_source_customer_forgotpassword' => \Mage_Adminhtml_Model_System_Config_Source_Customer_Forgotpassword::class, 'adminhtml/system_config_source_customer_group' => \Mage_Adminhtml_Model_System_Config_Source_Customer_Group::class, 'adminhtml/system_config_source_customer_group_multiselect' => \Mage_Adminhtml_Model_System_Config_Source_Customer_Group_Multiselect::class, + 'adminhtml/system_config_source_dashboard_chart_type' => \Mage_Adminhtml_Model_System_Config_Source_Dashboard_Chart_Type::class, 'adminhtml/system_config_source_date_short' => \Mage_Adminhtml_Model_System_Config_Source_Date_Short::class, 'adminhtml/system_config_source_design_robots' => \Mage_Adminhtml_Model_System_Config_Source_Design_Robots::class, 'adminhtml/system_config_source_dev_dbautoup' => \Mage_Adminhtml_Model_System_Config_Source_Dev_Dbautoup::class, @@ -3799,6 +3759,7 @@ 'catalog/layer_filter_price_algorithm' => \Mage_Catalog_Model_Layer_Filter_Price_Algorithm::class, 'catalog/layer_state' => \Mage_Catalog_Model_Layer_State::class, 'catalog/observer' => \Mage_Catalog_Model_Observer::class, + 'catalog/observer_disableAdvancedSearch' => \Mage_Catalog_Model_Observer_DisableAdvancedSearch::class, 'catalog/product' => \Mage_Catalog_Model_Product::class, 'catalog/product_action' => \Mage_Catalog_Model_Product_Action::class, 'catalog/product_api' => \Mage_Catalog_Model_Product_Api::class, @@ -4478,6 +4439,9 @@ 'cron/resource_schedule_collection' => \Mage_Cron_Model_Resource_Schedule_Collection::class, 'cron_resource/schedule_collection' => \Mage_Cron_Model_Resource_Schedule_Collection::class, 'cron/schedule' => \Mage_Cron_Model_Schedule::class, + 'csp/observer_abstract' => \Mage_Csp_Model_Observer_Abstract::class, + 'csp/observer_addAdminCspHeaders' => \Mage_Csp_Model_Observer_AddAdminCspHeaders::class, + 'csp/observer_addFrontendCspHeaders' => \Mage_Csp_Model_Observer_AddFrontendCspHeaders::class, 'currencysymbol/observer' => \Mage_CurrencySymbol_Model_Observer::class, 'currencysymbol/system_currencysymbol' => \Mage_CurrencySymbol_Model_System_Currencysymbol::class, 'customer/address' => \Mage_Customer_Model_Address::class, @@ -5086,76 +5050,30 @@ 'payment/recurring_profile' => \Mage_Payment_Model_Recurring_Profile::class, 'payment/source_cctype' => \Mage_Payment_Model_Source_Cctype::class, 'payment/source_invoice' => \Mage_Payment_Model_Source_Invoice::class, - 'paypaluk/api_express_nvp' => \Mage_PaypalUk_Model_Api_Express_Nvp::class, - 'paypaluk/api_nvp' => \Mage_PaypalUk_Model_Api_Nvp::class, - 'paypaluk/bml' => \Mage_PaypalUk_Model_Bml::class, - 'paypaluk/direct' => \Mage_PaypalUk_Model_Direct::class, - 'paypaluk/express' => \Mage_PaypalUk_Model_Express::class, - 'paypaluk/express_checkout' => \Mage_PaypalUk_Model_Express_Checkout::class, - 'paypaluk/express_pro' => \Mage_PaypalUk_Model_Express_Pro::class, - 'paypaluk/pro' => \Mage_PaypalUk_Model_Pro::class, - 'paypaluk/session' => \Mage_PaypalUk_Model_Session::class, - 'paypal/api_abstract' => \Mage_Paypal_Model_Api_Abstract::class, - 'paypal/api_nvp' => \Mage_Paypal_Model_Api_Nvp::class, - 'paypal/api_processableException' => \Mage_Paypal_Model_Api_ProcessableException::class, - 'paypal/api_standard' => \Mage_Paypal_Model_Api_Standard::class, - 'paypal/bml' => \Mage_Paypal_Model_Bml::class, + 'paypal/api' => \Mage_Paypal_Model_Api::class, 'paypal/cart' => \Mage_Paypal_Model_Cart::class, - 'paypal/cert' => \Mage_Paypal_Model_Cert::class, 'paypal/config' => \Mage_Paypal_Model_Config::class, - 'paypal/direct' => \Mage_Paypal_Model_Direct::class, - 'paypal/express' => \Mage_Paypal_Model_Express::class, - 'paypal/express_checkout' => \Mage_Paypal_Model_Express_Checkout::class, - 'paypal/hostedpro' => \Mage_Paypal_Model_Hostedpro::class, - 'paypal/hostedpro_request' => \Mage_Paypal_Model_Hostedpro_Request::class, - 'paypal/info' => \Mage_Paypal_Model_Info::class, - 'paypal/ipn' => \Mage_Paypal_Model_Ipn::class, - 'paypal/method_agreement' => \Mage_Paypal_Model_Method_Agreement::class, - 'paypal/mysql4_cert' => \Mage_Paypal_Model_Mysql4_Cert::class, - 'paypal/mysql4_report_settlement' => \Mage_Paypal_Model_Mysql4_Report_Settlement::class, - 'paypal/mysql4_report_settlement_row' => \Mage_Paypal_Model_Mysql4_Report_Settlement_Row::class, - 'paypal/mysql4_report_settlement_row_collection' => \Mage_Paypal_Model_Mysql4_Report_Settlement_Row_Collection::class, - 'paypal/mysql4_setup' => \Mage_Paypal_Model_Mysql4_Setup::class, - 'paypal/observer' => \Mage_Paypal_Model_Observer::class, - 'paypal/payflow_request' => \Mage_Paypal_Model_Payflow_Request::class, - 'paypal/payflowadvanced' => \Mage_Paypal_Model_Payflowadvanced::class, - 'paypal/payflowlink' => \Mage_Paypal_Model_Payflowlink::class, - 'paypal/payflowpro' => \Mage_Paypal_Model_Payflowpro::class, - 'paypal/payment_transaction' => \Mage_Paypal_Model_Payment_Transaction::class, - 'paypal/pro' => \Mage_Paypal_Model_Pro::class, - 'paypal/report_settlement' => \Mage_Paypal_Model_Report_Settlement::class, - 'paypal/report_settlement_row' => \Mage_Paypal_Model_Report_Settlement_Row::class, - 'paypal/resource_cert' => \Mage_Paypal_Model_Resource_Cert::class, - 'paypal_resource/cert' => \Mage_Paypal_Model_Resource_Cert::class, - 'paypal/resource_payment_transaction' => \Mage_Paypal_Model_Resource_Payment_Transaction::class, - 'paypal_resource/payment_transaction' => \Mage_Paypal_Model_Resource_Payment_Transaction::class, - 'paypal/resource_payment_transaction_collection' => \Mage_Paypal_Model_Resource_Payment_Transaction_Collection::class, - 'paypal_resource/payment_transaction_collection' => \Mage_Paypal_Model_Resource_Payment_Transaction_Collection::class, - 'paypal/resource_report_settlement' => \Mage_Paypal_Model_Resource_Report_Settlement::class, - 'paypal_resource/report_settlement' => \Mage_Paypal_Model_Resource_Report_Settlement::class, - 'paypal/resource_report_settlement_row' => \Mage_Paypal_Model_Resource_Report_Settlement_Row::class, - 'paypal_resource/report_settlement_row' => \Mage_Paypal_Model_Resource_Report_Settlement_Row::class, - 'paypal/resource_report_settlement_row_collection' => \Mage_Paypal_Model_Resource_Report_Settlement_Row_Collection::class, - 'paypal_resource/report_settlement_row_collection' => \Mage_Paypal_Model_Resource_Report_Settlement_Row_Collection::class, + 'paypal/cron' => \Mage_Paypal_Model_Cron::class, + 'paypal/debug' => \Mage_Paypal_Model_Debug::class, + 'paypal/exception' => \Mage_Paypal_Model_Exception::class, + 'paypal/helper' => \Mage_Paypal_Model_Helper::class, + 'paypal/order' => \Mage_Paypal_Model_Order::class, + 'paypal/payment' => \Mage_Paypal_Model_Payment::class, + 'paypal/paypal' => \Mage_Paypal_Model_Paypal::class, + 'paypal/resource_debug' => \Mage_Paypal_Model_Resource_Debug::class, + 'paypal_resource/debug' => \Mage_Paypal_Model_Resource_Debug::class, + 'paypal/resource_debug_collection' => \Mage_Paypal_Model_Resource_Debug_Collection::class, + 'paypal_resource/debug_collection' => \Mage_Paypal_Model_Resource_Debug_Collection::class, 'paypal/resource_setup' => \Mage_Paypal_Model_Resource_Setup::class, 'paypal_resource/setup' => \Mage_Paypal_Model_Resource_Setup::class, - 'paypal/session' => \Mage_Paypal_Model_Session::class, - 'paypal/standard' => \Mage_Paypal_Model_Standard::class, - 'paypal/system_config_backend_cert' => \Mage_Paypal_Model_System_Config_Backend_Cert::class, - 'paypal/system_config_backend_cron' => \Mage_Paypal_Model_System_Config_Backend_Cron::class, 'paypal/system_config_backend_merchantCountry' => \Mage_Paypal_Model_System_Config_Backend_MerchantCountry::class, - 'paypal/system_config_source_authorizationAmounts' => \Mage_Paypal_Model_System_Config_Source_AuthorizationAmounts::class, - 'paypal/system_config_source_bmlPosition' => \Mage_Paypal_Model_System_Config_Source_BmlPosition::class, - 'paypal/system_config_source_bmlSize' => \Mage_Paypal_Model_System_Config_Source_BmlSize::class, - 'paypal/system_config_source_buyerCountry' => \Mage_Paypal_Model_System_Config_Source_BuyerCountry::class, - 'paypal/system_config_source_fetchingSchedule' => \Mage_Paypal_Model_System_Config_Source_FetchingSchedule::class, - 'paypal/system_config_source_logo' => \Mage_Paypal_Model_System_Config_Source_Logo::class, + 'paypal/system_config_source_buttonColors' => \Mage_Paypal_Model_System_Config_Source_ButtonColors::class, + 'paypal/system_config_source_buttonLabels' => \Mage_Paypal_Model_System_Config_Source_ButtonLabels::class, + 'paypal/system_config_source_buttonLayouts' => \Mage_Paypal_Model_System_Config_Source_ButtonLayouts::class, + 'paypal/system_config_source_buttonShapes' => \Mage_Paypal_Model_System_Config_Source_ButtonShapes::class, 'paypal/system_config_source_merchantCountry' => \Mage_Paypal_Model_System_Config_Source_MerchantCountry::class, 'paypal/system_config_source_paymentActions' => \Mage_Paypal_Model_System_Config_Source_PaymentActions::class, - 'paypal/system_config_source_paymentActions_express' => \Mage_Paypal_Model_System_Config_Source_PaymentActions_Express::class, - 'paypal/system_config_source_requireBillingAddress' => \Mage_Paypal_Model_System_Config_Source_RequireBillingAddress::class, - 'paypal/system_config_source_urlMethod' => \Mage_Paypal_Model_System_Config_Source_UrlMethod::class, - 'paypal/system_config_source_yesnoShortcut' => \Mage_Paypal_Model_System_Config_Source_YesnoShortcut::class, + 'paypal/transaction' => \Mage_Paypal_Model_Transaction::class, 'persistent/observer' => \Mage_Persistent_Model_Observer::class, 'persistent/observer_session' => \Mage_Persistent_Model_Observer_Session::class, 'persistent/persistent_config' => \Mage_Persistent_Model_Persistent_Config::class, @@ -6493,6 +6411,7 @@ 'adminhtml/system_config_source_customer_forgotpassword' => \Mage_Adminhtml_Model_System_Config_Source_Customer_Forgotpassword::class, 'adminhtml/system_config_source_customer_group' => \Mage_Adminhtml_Model_System_Config_Source_Customer_Group::class, 'adminhtml/system_config_source_customer_group_multiselect' => \Mage_Adminhtml_Model_System_Config_Source_Customer_Group_Multiselect::class, + 'adminhtml/system_config_source_dashboard_chart_type' => \Mage_Adminhtml_Model_System_Config_Source_Dashboard_Chart_Type::class, 'adminhtml/system_config_source_date_short' => \Mage_Adminhtml_Model_System_Config_Source_Date_Short::class, 'adminhtml/system_config_source_design_robots' => \Mage_Adminhtml_Model_System_Config_Source_Design_Robots::class, 'adminhtml/system_config_source_dev_dbautoup' => \Mage_Adminhtml_Model_System_Config_Source_Dev_Dbautoup::class, @@ -6955,6 +6874,7 @@ 'catalog/layer_filter_price_algorithm' => \Mage_Catalog_Model_Layer_Filter_Price_Algorithm::class, 'catalog/layer_state' => \Mage_Catalog_Model_Layer_State::class, 'catalog/observer' => \Mage_Catalog_Model_Observer::class, + 'catalog/observer_disableAdvancedSearch' => \Mage_Catalog_Model_Observer_DisableAdvancedSearch::class, 'catalog/product' => \Mage_Catalog_Model_Product::class, 'catalog/product_action' => \Mage_Catalog_Model_Product_Action::class, 'catalog/product_api' => \Mage_Catalog_Model_Product_Api::class, @@ -7634,6 +7554,9 @@ 'cron/resource_schedule_collection' => \Mage_Cron_Model_Resource_Schedule_Collection::class, 'cron_resource/schedule_collection' => \Mage_Cron_Model_Resource_Schedule_Collection::class, 'cron/schedule' => \Mage_Cron_Model_Schedule::class, + 'csp/observer_abstract' => \Mage_Csp_Model_Observer_Abstract::class, + 'csp/observer_addAdminCspHeaders' => \Mage_Csp_Model_Observer_AddAdminCspHeaders::class, + 'csp/observer_addFrontendCspHeaders' => \Mage_Csp_Model_Observer_AddFrontendCspHeaders::class, 'currencysymbol/observer' => \Mage_CurrencySymbol_Model_Observer::class, 'currencysymbol/system_currencysymbol' => \Mage_CurrencySymbol_Model_System_Currencysymbol::class, 'customer/address' => \Mage_Customer_Model_Address::class, @@ -8242,76 +8165,30 @@ 'payment/recurring_profile' => \Mage_Payment_Model_Recurring_Profile::class, 'payment/source_cctype' => \Mage_Payment_Model_Source_Cctype::class, 'payment/source_invoice' => \Mage_Payment_Model_Source_Invoice::class, - 'paypaluk/api_express_nvp' => \Mage_PaypalUk_Model_Api_Express_Nvp::class, - 'paypaluk/api_nvp' => \Mage_PaypalUk_Model_Api_Nvp::class, - 'paypaluk/bml' => \Mage_PaypalUk_Model_Bml::class, - 'paypaluk/direct' => \Mage_PaypalUk_Model_Direct::class, - 'paypaluk/express' => \Mage_PaypalUk_Model_Express::class, - 'paypaluk/express_checkout' => \Mage_PaypalUk_Model_Express_Checkout::class, - 'paypaluk/express_pro' => \Mage_PaypalUk_Model_Express_Pro::class, - 'paypaluk/pro' => \Mage_PaypalUk_Model_Pro::class, - 'paypaluk/session' => \Mage_PaypalUk_Model_Session::class, - 'paypal/api_abstract' => \Mage_Paypal_Model_Api_Abstract::class, - 'paypal/api_nvp' => \Mage_Paypal_Model_Api_Nvp::class, - 'paypal/api_processableException' => \Mage_Paypal_Model_Api_ProcessableException::class, - 'paypal/api_standard' => \Mage_Paypal_Model_Api_Standard::class, - 'paypal/bml' => \Mage_Paypal_Model_Bml::class, + 'paypal/api' => \Mage_Paypal_Model_Api::class, 'paypal/cart' => \Mage_Paypal_Model_Cart::class, - 'paypal/cert' => \Mage_Paypal_Model_Cert::class, 'paypal/config' => \Mage_Paypal_Model_Config::class, - 'paypal/direct' => \Mage_Paypal_Model_Direct::class, - 'paypal/express' => \Mage_Paypal_Model_Express::class, - 'paypal/express_checkout' => \Mage_Paypal_Model_Express_Checkout::class, - 'paypal/hostedpro' => \Mage_Paypal_Model_Hostedpro::class, - 'paypal/hostedpro_request' => \Mage_Paypal_Model_Hostedpro_Request::class, - 'paypal/info' => \Mage_Paypal_Model_Info::class, - 'paypal/ipn' => \Mage_Paypal_Model_Ipn::class, - 'paypal/method_agreement' => \Mage_Paypal_Model_Method_Agreement::class, - 'paypal/mysql4_cert' => \Mage_Paypal_Model_Mysql4_Cert::class, - 'paypal/mysql4_report_settlement' => \Mage_Paypal_Model_Mysql4_Report_Settlement::class, - 'paypal/mysql4_report_settlement_row' => \Mage_Paypal_Model_Mysql4_Report_Settlement_Row::class, - 'paypal/mysql4_report_settlement_row_collection' => \Mage_Paypal_Model_Mysql4_Report_Settlement_Row_Collection::class, - 'paypal/mysql4_setup' => \Mage_Paypal_Model_Mysql4_Setup::class, - 'paypal/observer' => \Mage_Paypal_Model_Observer::class, - 'paypal/payflow_request' => \Mage_Paypal_Model_Payflow_Request::class, - 'paypal/payflowadvanced' => \Mage_Paypal_Model_Payflowadvanced::class, - 'paypal/payflowlink' => \Mage_Paypal_Model_Payflowlink::class, - 'paypal/payflowpro' => \Mage_Paypal_Model_Payflowpro::class, - 'paypal/payment_transaction' => \Mage_Paypal_Model_Payment_Transaction::class, - 'paypal/pro' => \Mage_Paypal_Model_Pro::class, - 'paypal/report_settlement' => \Mage_Paypal_Model_Report_Settlement::class, - 'paypal/report_settlement_row' => \Mage_Paypal_Model_Report_Settlement_Row::class, - 'paypal/resource_cert' => \Mage_Paypal_Model_Resource_Cert::class, - 'paypal_resource/cert' => \Mage_Paypal_Model_Resource_Cert::class, - 'paypal/resource_payment_transaction' => \Mage_Paypal_Model_Resource_Payment_Transaction::class, - 'paypal_resource/payment_transaction' => \Mage_Paypal_Model_Resource_Payment_Transaction::class, - 'paypal/resource_payment_transaction_collection' => \Mage_Paypal_Model_Resource_Payment_Transaction_Collection::class, - 'paypal_resource/payment_transaction_collection' => \Mage_Paypal_Model_Resource_Payment_Transaction_Collection::class, - 'paypal/resource_report_settlement' => \Mage_Paypal_Model_Resource_Report_Settlement::class, - 'paypal_resource/report_settlement' => \Mage_Paypal_Model_Resource_Report_Settlement::class, - 'paypal/resource_report_settlement_row' => \Mage_Paypal_Model_Resource_Report_Settlement_Row::class, - 'paypal_resource/report_settlement_row' => \Mage_Paypal_Model_Resource_Report_Settlement_Row::class, - 'paypal/resource_report_settlement_row_collection' => \Mage_Paypal_Model_Resource_Report_Settlement_Row_Collection::class, - 'paypal_resource/report_settlement_row_collection' => \Mage_Paypal_Model_Resource_Report_Settlement_Row_Collection::class, + 'paypal/cron' => \Mage_Paypal_Model_Cron::class, + 'paypal/debug' => \Mage_Paypal_Model_Debug::class, + 'paypal/exception' => \Mage_Paypal_Model_Exception::class, + 'paypal/helper' => \Mage_Paypal_Model_Helper::class, + 'paypal/order' => \Mage_Paypal_Model_Order::class, + 'paypal/payment' => \Mage_Paypal_Model_Payment::class, + 'paypal/paypal' => \Mage_Paypal_Model_Paypal::class, + 'paypal/resource_debug' => \Mage_Paypal_Model_Resource_Debug::class, + 'paypal_resource/debug' => \Mage_Paypal_Model_Resource_Debug::class, + 'paypal/resource_debug_collection' => \Mage_Paypal_Model_Resource_Debug_Collection::class, + 'paypal_resource/debug_collection' => \Mage_Paypal_Model_Resource_Debug_Collection::class, 'paypal/resource_setup' => \Mage_Paypal_Model_Resource_Setup::class, 'paypal_resource/setup' => \Mage_Paypal_Model_Resource_Setup::class, - 'paypal/session' => \Mage_Paypal_Model_Session::class, - 'paypal/standard' => \Mage_Paypal_Model_Standard::class, - 'paypal/system_config_backend_cert' => \Mage_Paypal_Model_System_Config_Backend_Cert::class, - 'paypal/system_config_backend_cron' => \Mage_Paypal_Model_System_Config_Backend_Cron::class, 'paypal/system_config_backend_merchantCountry' => \Mage_Paypal_Model_System_Config_Backend_MerchantCountry::class, - 'paypal/system_config_source_authorizationAmounts' => \Mage_Paypal_Model_System_Config_Source_AuthorizationAmounts::class, - 'paypal/system_config_source_bmlPosition' => \Mage_Paypal_Model_System_Config_Source_BmlPosition::class, - 'paypal/system_config_source_bmlSize' => \Mage_Paypal_Model_System_Config_Source_BmlSize::class, - 'paypal/system_config_source_buyerCountry' => \Mage_Paypal_Model_System_Config_Source_BuyerCountry::class, - 'paypal/system_config_source_fetchingSchedule' => \Mage_Paypal_Model_System_Config_Source_FetchingSchedule::class, - 'paypal/system_config_source_logo' => \Mage_Paypal_Model_System_Config_Source_Logo::class, + 'paypal/system_config_source_buttonColors' => \Mage_Paypal_Model_System_Config_Source_ButtonColors::class, + 'paypal/system_config_source_buttonLabels' => \Mage_Paypal_Model_System_Config_Source_ButtonLabels::class, + 'paypal/system_config_source_buttonLayouts' => \Mage_Paypal_Model_System_Config_Source_ButtonLayouts::class, + 'paypal/system_config_source_buttonShapes' => \Mage_Paypal_Model_System_Config_Source_ButtonShapes::class, 'paypal/system_config_source_merchantCountry' => \Mage_Paypal_Model_System_Config_Source_MerchantCountry::class, 'paypal/system_config_source_paymentActions' => \Mage_Paypal_Model_System_Config_Source_PaymentActions::class, - 'paypal/system_config_source_paymentActions_express' => \Mage_Paypal_Model_System_Config_Source_PaymentActions_Express::class, - 'paypal/system_config_source_requireBillingAddress' => \Mage_Paypal_Model_System_Config_Source_RequireBillingAddress::class, - 'paypal/system_config_source_urlMethod' => \Mage_Paypal_Model_System_Config_Source_UrlMethod::class, - 'paypal/system_config_source_yesnoShortcut' => \Mage_Paypal_Model_System_Config_Source_YesnoShortcut::class, + 'paypal/transaction' => \Mage_Paypal_Model_Transaction::class, 'persistent/observer' => \Mage_Persistent_Model_Observer::class, 'persistent/observer_session' => \Mage_Persistent_Model_Observer_Session::class, 'persistent/persistent_config' => \Mage_Persistent_Model_Persistent_Config::class, @@ -9649,6 +9526,7 @@ 'adminhtml/system_config_source_customer_forgotpassword' => \Mage_Adminhtml_Model_System_Config_Source_Customer_Forgotpassword::class, 'adminhtml/system_config_source_customer_group' => \Mage_Adminhtml_Model_System_Config_Source_Customer_Group::class, 'adminhtml/system_config_source_customer_group_multiselect' => \Mage_Adminhtml_Model_System_Config_Source_Customer_Group_Multiselect::class, + 'adminhtml/system_config_source_dashboard_chart_type' => \Mage_Adminhtml_Model_System_Config_Source_Dashboard_Chart_Type::class, 'adminhtml/system_config_source_date_short' => \Mage_Adminhtml_Model_System_Config_Source_Date_Short::class, 'adminhtml/system_config_source_design_robots' => \Mage_Adminhtml_Model_System_Config_Source_Design_Robots::class, 'adminhtml/system_config_source_dev_dbautoup' => \Mage_Adminhtml_Model_System_Config_Source_Dev_Dbautoup::class, @@ -10111,6 +9989,7 @@ 'catalog/layer_filter_price_algorithm' => \Mage_Catalog_Model_Layer_Filter_Price_Algorithm::class, 'catalog/layer_state' => \Mage_Catalog_Model_Layer_State::class, 'catalog/observer' => \Mage_Catalog_Model_Observer::class, + 'catalog/observer_disableAdvancedSearch' => \Mage_Catalog_Model_Observer_DisableAdvancedSearch::class, 'catalog/product' => \Mage_Catalog_Model_Product::class, 'catalog/product_action' => \Mage_Catalog_Model_Product_Action::class, 'catalog/product_api' => \Mage_Catalog_Model_Product_Api::class, @@ -10790,6 +10669,9 @@ 'cron/resource_schedule_collection' => \Mage_Cron_Model_Resource_Schedule_Collection::class, 'cron_resource/schedule_collection' => \Mage_Cron_Model_Resource_Schedule_Collection::class, 'cron/schedule' => \Mage_Cron_Model_Schedule::class, + 'csp/observer_abstract' => \Mage_Csp_Model_Observer_Abstract::class, + 'csp/observer_addAdminCspHeaders' => \Mage_Csp_Model_Observer_AddAdminCspHeaders::class, + 'csp/observer_addFrontendCspHeaders' => \Mage_Csp_Model_Observer_AddFrontendCspHeaders::class, 'currencysymbol/observer' => \Mage_CurrencySymbol_Model_Observer::class, 'currencysymbol/system_currencysymbol' => \Mage_CurrencySymbol_Model_System_Currencysymbol::class, 'customer/address' => \Mage_Customer_Model_Address::class, @@ -11398,76 +11280,30 @@ 'payment/recurring_profile' => \Mage_Payment_Model_Recurring_Profile::class, 'payment/source_cctype' => \Mage_Payment_Model_Source_Cctype::class, 'payment/source_invoice' => \Mage_Payment_Model_Source_Invoice::class, - 'paypaluk/api_express_nvp' => \Mage_PaypalUk_Model_Api_Express_Nvp::class, - 'paypaluk/api_nvp' => \Mage_PaypalUk_Model_Api_Nvp::class, - 'paypaluk/bml' => \Mage_PaypalUk_Model_Bml::class, - 'paypaluk/direct' => \Mage_PaypalUk_Model_Direct::class, - 'paypaluk/express' => \Mage_PaypalUk_Model_Express::class, - 'paypaluk/express_checkout' => \Mage_PaypalUk_Model_Express_Checkout::class, - 'paypaluk/express_pro' => \Mage_PaypalUk_Model_Express_Pro::class, - 'paypaluk/pro' => \Mage_PaypalUk_Model_Pro::class, - 'paypaluk/session' => \Mage_PaypalUk_Model_Session::class, - 'paypal/api_abstract' => \Mage_Paypal_Model_Api_Abstract::class, - 'paypal/api_nvp' => \Mage_Paypal_Model_Api_Nvp::class, - 'paypal/api_processableException' => \Mage_Paypal_Model_Api_ProcessableException::class, - 'paypal/api_standard' => \Mage_Paypal_Model_Api_Standard::class, - 'paypal/bml' => \Mage_Paypal_Model_Bml::class, + 'paypal/api' => \Mage_Paypal_Model_Api::class, 'paypal/cart' => \Mage_Paypal_Model_Cart::class, - 'paypal/cert' => \Mage_Paypal_Model_Cert::class, 'paypal/config' => \Mage_Paypal_Model_Config::class, - 'paypal/direct' => \Mage_Paypal_Model_Direct::class, - 'paypal/express' => \Mage_Paypal_Model_Express::class, - 'paypal/express_checkout' => \Mage_Paypal_Model_Express_Checkout::class, - 'paypal/hostedpro' => \Mage_Paypal_Model_Hostedpro::class, - 'paypal/hostedpro_request' => \Mage_Paypal_Model_Hostedpro_Request::class, - 'paypal/info' => \Mage_Paypal_Model_Info::class, - 'paypal/ipn' => \Mage_Paypal_Model_Ipn::class, - 'paypal/method_agreement' => \Mage_Paypal_Model_Method_Agreement::class, - 'paypal/mysql4_cert' => \Mage_Paypal_Model_Mysql4_Cert::class, - 'paypal/mysql4_report_settlement' => \Mage_Paypal_Model_Mysql4_Report_Settlement::class, - 'paypal/mysql4_report_settlement_row' => \Mage_Paypal_Model_Mysql4_Report_Settlement_Row::class, - 'paypal/mysql4_report_settlement_row_collection' => \Mage_Paypal_Model_Mysql4_Report_Settlement_Row_Collection::class, - 'paypal/mysql4_setup' => \Mage_Paypal_Model_Mysql4_Setup::class, - 'paypal/observer' => \Mage_Paypal_Model_Observer::class, - 'paypal/payflow_request' => \Mage_Paypal_Model_Payflow_Request::class, - 'paypal/payflowadvanced' => \Mage_Paypal_Model_Payflowadvanced::class, - 'paypal/payflowlink' => \Mage_Paypal_Model_Payflowlink::class, - 'paypal/payflowpro' => \Mage_Paypal_Model_Payflowpro::class, - 'paypal/payment_transaction' => \Mage_Paypal_Model_Payment_Transaction::class, - 'paypal/pro' => \Mage_Paypal_Model_Pro::class, - 'paypal/report_settlement' => \Mage_Paypal_Model_Report_Settlement::class, - 'paypal/report_settlement_row' => \Mage_Paypal_Model_Report_Settlement_Row::class, - 'paypal/resource_cert' => \Mage_Paypal_Model_Resource_Cert::class, - 'paypal_resource/cert' => \Mage_Paypal_Model_Resource_Cert::class, - 'paypal/resource_payment_transaction' => \Mage_Paypal_Model_Resource_Payment_Transaction::class, - 'paypal_resource/payment_transaction' => \Mage_Paypal_Model_Resource_Payment_Transaction::class, - 'paypal/resource_payment_transaction_collection' => \Mage_Paypal_Model_Resource_Payment_Transaction_Collection::class, - 'paypal_resource/payment_transaction_collection' => \Mage_Paypal_Model_Resource_Payment_Transaction_Collection::class, - 'paypal/resource_report_settlement' => \Mage_Paypal_Model_Resource_Report_Settlement::class, - 'paypal_resource/report_settlement' => \Mage_Paypal_Model_Resource_Report_Settlement::class, - 'paypal/resource_report_settlement_row' => \Mage_Paypal_Model_Resource_Report_Settlement_Row::class, - 'paypal_resource/report_settlement_row' => \Mage_Paypal_Model_Resource_Report_Settlement_Row::class, - 'paypal/resource_report_settlement_row_collection' => \Mage_Paypal_Model_Resource_Report_Settlement_Row_Collection::class, - 'paypal_resource/report_settlement_row_collection' => \Mage_Paypal_Model_Resource_Report_Settlement_Row_Collection::class, + 'paypal/cron' => \Mage_Paypal_Model_Cron::class, + 'paypal/debug' => \Mage_Paypal_Model_Debug::class, + 'paypal/exception' => \Mage_Paypal_Model_Exception::class, + 'paypal/helper' => \Mage_Paypal_Model_Helper::class, + 'paypal/order' => \Mage_Paypal_Model_Order::class, + 'paypal/payment' => \Mage_Paypal_Model_Payment::class, + 'paypal/paypal' => \Mage_Paypal_Model_Paypal::class, + 'paypal/resource_debug' => \Mage_Paypal_Model_Resource_Debug::class, + 'paypal_resource/debug' => \Mage_Paypal_Model_Resource_Debug::class, + 'paypal/resource_debug_collection' => \Mage_Paypal_Model_Resource_Debug_Collection::class, + 'paypal_resource/debug_collection' => \Mage_Paypal_Model_Resource_Debug_Collection::class, 'paypal/resource_setup' => \Mage_Paypal_Model_Resource_Setup::class, 'paypal_resource/setup' => \Mage_Paypal_Model_Resource_Setup::class, - 'paypal/session' => \Mage_Paypal_Model_Session::class, - 'paypal/standard' => \Mage_Paypal_Model_Standard::class, - 'paypal/system_config_backend_cert' => \Mage_Paypal_Model_System_Config_Backend_Cert::class, - 'paypal/system_config_backend_cron' => \Mage_Paypal_Model_System_Config_Backend_Cron::class, 'paypal/system_config_backend_merchantCountry' => \Mage_Paypal_Model_System_Config_Backend_MerchantCountry::class, - 'paypal/system_config_source_authorizationAmounts' => \Mage_Paypal_Model_System_Config_Source_AuthorizationAmounts::class, - 'paypal/system_config_source_bmlPosition' => \Mage_Paypal_Model_System_Config_Source_BmlPosition::class, - 'paypal/system_config_source_bmlSize' => \Mage_Paypal_Model_System_Config_Source_BmlSize::class, - 'paypal/system_config_source_buyerCountry' => \Mage_Paypal_Model_System_Config_Source_BuyerCountry::class, - 'paypal/system_config_source_fetchingSchedule' => \Mage_Paypal_Model_System_Config_Source_FetchingSchedule::class, - 'paypal/system_config_source_logo' => \Mage_Paypal_Model_System_Config_Source_Logo::class, + 'paypal/system_config_source_buttonColors' => \Mage_Paypal_Model_System_Config_Source_ButtonColors::class, + 'paypal/system_config_source_buttonLabels' => \Mage_Paypal_Model_System_Config_Source_ButtonLabels::class, + 'paypal/system_config_source_buttonLayouts' => \Mage_Paypal_Model_System_Config_Source_ButtonLayouts::class, + 'paypal/system_config_source_buttonShapes' => \Mage_Paypal_Model_System_Config_Source_ButtonShapes::class, 'paypal/system_config_source_merchantCountry' => \Mage_Paypal_Model_System_Config_Source_MerchantCountry::class, 'paypal/system_config_source_paymentActions' => \Mage_Paypal_Model_System_Config_Source_PaymentActions::class, - 'paypal/system_config_source_paymentActions_express' => \Mage_Paypal_Model_System_Config_Source_PaymentActions_Express::class, - 'paypal/system_config_source_requireBillingAddress' => \Mage_Paypal_Model_System_Config_Source_RequireBillingAddress::class, - 'paypal/system_config_source_urlMethod' => \Mage_Paypal_Model_System_Config_Source_UrlMethod::class, - 'paypal/system_config_source_yesnoShortcut' => \Mage_Paypal_Model_System_Config_Source_YesnoShortcut::class, + 'paypal/transaction' => \Mage_Paypal_Model_Transaction::class, 'persistent/observer' => \Mage_Persistent_Model_Observer::class, 'persistent/observer_session' => \Mage_Persistent_Model_Observer_Session::class, 'persistent/persistent_config' => \Mage_Persistent_Model_Persistent_Config::class, @@ -12805,6 +12641,7 @@ 'adminhtml/system_config_source_customer_forgotpassword' => \Mage_Adminhtml_Model_System_Config_Source_Customer_Forgotpassword::class, 'adminhtml/system_config_source_customer_group' => \Mage_Adminhtml_Model_System_Config_Source_Customer_Group::class, 'adminhtml/system_config_source_customer_group_multiselect' => \Mage_Adminhtml_Model_System_Config_Source_Customer_Group_Multiselect::class, + 'adminhtml/system_config_source_dashboard_chart_type' => \Mage_Adminhtml_Model_System_Config_Source_Dashboard_Chart_Type::class, 'adminhtml/system_config_source_date_short' => \Mage_Adminhtml_Model_System_Config_Source_Date_Short::class, 'adminhtml/system_config_source_design_robots' => \Mage_Adminhtml_Model_System_Config_Source_Design_Robots::class, 'adminhtml/system_config_source_dev_dbautoup' => \Mage_Adminhtml_Model_System_Config_Source_Dev_Dbautoup::class, @@ -13267,6 +13104,7 @@ 'catalog/layer_filter_price_algorithm' => \Mage_Catalog_Model_Layer_Filter_Price_Algorithm::class, 'catalog/layer_state' => \Mage_Catalog_Model_Layer_State::class, 'catalog/observer' => \Mage_Catalog_Model_Observer::class, + 'catalog/observer_disableAdvancedSearch' => \Mage_Catalog_Model_Observer_DisableAdvancedSearch::class, 'catalog/product' => \Mage_Catalog_Model_Product::class, 'catalog/product_action' => \Mage_Catalog_Model_Product_Action::class, 'catalog/product_api' => \Mage_Catalog_Model_Product_Api::class, @@ -13946,6 +13784,9 @@ 'cron/resource_schedule_collection' => \Mage_Cron_Model_Resource_Schedule_Collection::class, 'cron_resource/schedule_collection' => \Mage_Cron_Model_Resource_Schedule_Collection::class, 'cron/schedule' => \Mage_Cron_Model_Schedule::class, + 'csp/observer_abstract' => \Mage_Csp_Model_Observer_Abstract::class, + 'csp/observer_addAdminCspHeaders' => \Mage_Csp_Model_Observer_AddAdminCspHeaders::class, + 'csp/observer_addFrontendCspHeaders' => \Mage_Csp_Model_Observer_AddFrontendCspHeaders::class, 'currencysymbol/observer' => \Mage_CurrencySymbol_Model_Observer::class, 'currencysymbol/system_currencysymbol' => \Mage_CurrencySymbol_Model_System_Currencysymbol::class, 'customer/address' => \Mage_Customer_Model_Address::class, @@ -14554,76 +14395,30 @@ 'payment/recurring_profile' => \Mage_Payment_Model_Recurring_Profile::class, 'payment/source_cctype' => \Mage_Payment_Model_Source_Cctype::class, 'payment/source_invoice' => \Mage_Payment_Model_Source_Invoice::class, - 'paypaluk/api_express_nvp' => \Mage_PaypalUk_Model_Api_Express_Nvp::class, - 'paypaluk/api_nvp' => \Mage_PaypalUk_Model_Api_Nvp::class, - 'paypaluk/bml' => \Mage_PaypalUk_Model_Bml::class, - 'paypaluk/direct' => \Mage_PaypalUk_Model_Direct::class, - 'paypaluk/express' => \Mage_PaypalUk_Model_Express::class, - 'paypaluk/express_checkout' => \Mage_PaypalUk_Model_Express_Checkout::class, - 'paypaluk/express_pro' => \Mage_PaypalUk_Model_Express_Pro::class, - 'paypaluk/pro' => \Mage_PaypalUk_Model_Pro::class, - 'paypaluk/session' => \Mage_PaypalUk_Model_Session::class, - 'paypal/api_abstract' => \Mage_Paypal_Model_Api_Abstract::class, - 'paypal/api_nvp' => \Mage_Paypal_Model_Api_Nvp::class, - 'paypal/api_processableException' => \Mage_Paypal_Model_Api_ProcessableException::class, - 'paypal/api_standard' => \Mage_Paypal_Model_Api_Standard::class, - 'paypal/bml' => \Mage_Paypal_Model_Bml::class, + 'paypal/api' => \Mage_Paypal_Model_Api::class, 'paypal/cart' => \Mage_Paypal_Model_Cart::class, - 'paypal/cert' => \Mage_Paypal_Model_Cert::class, 'paypal/config' => \Mage_Paypal_Model_Config::class, - 'paypal/direct' => \Mage_Paypal_Model_Direct::class, - 'paypal/express' => \Mage_Paypal_Model_Express::class, - 'paypal/express_checkout' => \Mage_Paypal_Model_Express_Checkout::class, - 'paypal/hostedpro' => \Mage_Paypal_Model_Hostedpro::class, - 'paypal/hostedpro_request' => \Mage_Paypal_Model_Hostedpro_Request::class, - 'paypal/info' => \Mage_Paypal_Model_Info::class, - 'paypal/ipn' => \Mage_Paypal_Model_Ipn::class, - 'paypal/method_agreement' => \Mage_Paypal_Model_Method_Agreement::class, - 'paypal/mysql4_cert' => \Mage_Paypal_Model_Mysql4_Cert::class, - 'paypal/mysql4_report_settlement' => \Mage_Paypal_Model_Mysql4_Report_Settlement::class, - 'paypal/mysql4_report_settlement_row' => \Mage_Paypal_Model_Mysql4_Report_Settlement_Row::class, - 'paypal/mysql4_report_settlement_row_collection' => \Mage_Paypal_Model_Mysql4_Report_Settlement_Row_Collection::class, - 'paypal/mysql4_setup' => \Mage_Paypal_Model_Mysql4_Setup::class, - 'paypal/observer' => \Mage_Paypal_Model_Observer::class, - 'paypal/payflow_request' => \Mage_Paypal_Model_Payflow_Request::class, - 'paypal/payflowadvanced' => \Mage_Paypal_Model_Payflowadvanced::class, - 'paypal/payflowlink' => \Mage_Paypal_Model_Payflowlink::class, - 'paypal/payflowpro' => \Mage_Paypal_Model_Payflowpro::class, - 'paypal/payment_transaction' => \Mage_Paypal_Model_Payment_Transaction::class, - 'paypal/pro' => \Mage_Paypal_Model_Pro::class, - 'paypal/report_settlement' => \Mage_Paypal_Model_Report_Settlement::class, - 'paypal/report_settlement_row' => \Mage_Paypal_Model_Report_Settlement_Row::class, - 'paypal/resource_cert' => \Mage_Paypal_Model_Resource_Cert::class, - 'paypal_resource/cert' => \Mage_Paypal_Model_Resource_Cert::class, - 'paypal/resource_payment_transaction' => \Mage_Paypal_Model_Resource_Payment_Transaction::class, - 'paypal_resource/payment_transaction' => \Mage_Paypal_Model_Resource_Payment_Transaction::class, - 'paypal/resource_payment_transaction_collection' => \Mage_Paypal_Model_Resource_Payment_Transaction_Collection::class, - 'paypal_resource/payment_transaction_collection' => \Mage_Paypal_Model_Resource_Payment_Transaction_Collection::class, - 'paypal/resource_report_settlement' => \Mage_Paypal_Model_Resource_Report_Settlement::class, - 'paypal_resource/report_settlement' => \Mage_Paypal_Model_Resource_Report_Settlement::class, - 'paypal/resource_report_settlement_row' => \Mage_Paypal_Model_Resource_Report_Settlement_Row::class, - 'paypal_resource/report_settlement_row' => \Mage_Paypal_Model_Resource_Report_Settlement_Row::class, - 'paypal/resource_report_settlement_row_collection' => \Mage_Paypal_Model_Resource_Report_Settlement_Row_Collection::class, - 'paypal_resource/report_settlement_row_collection' => \Mage_Paypal_Model_Resource_Report_Settlement_Row_Collection::class, + 'paypal/cron' => \Mage_Paypal_Model_Cron::class, + 'paypal/debug' => \Mage_Paypal_Model_Debug::class, + 'paypal/exception' => \Mage_Paypal_Model_Exception::class, + 'paypal/helper' => \Mage_Paypal_Model_Helper::class, + 'paypal/order' => \Mage_Paypal_Model_Order::class, + 'paypal/payment' => \Mage_Paypal_Model_Payment::class, + 'paypal/paypal' => \Mage_Paypal_Model_Paypal::class, + 'paypal/resource_debug' => \Mage_Paypal_Model_Resource_Debug::class, + 'paypal_resource/debug' => \Mage_Paypal_Model_Resource_Debug::class, + 'paypal/resource_debug_collection' => \Mage_Paypal_Model_Resource_Debug_Collection::class, + 'paypal_resource/debug_collection' => \Mage_Paypal_Model_Resource_Debug_Collection::class, 'paypal/resource_setup' => \Mage_Paypal_Model_Resource_Setup::class, 'paypal_resource/setup' => \Mage_Paypal_Model_Resource_Setup::class, - 'paypal/session' => \Mage_Paypal_Model_Session::class, - 'paypal/standard' => \Mage_Paypal_Model_Standard::class, - 'paypal/system_config_backend_cert' => \Mage_Paypal_Model_System_Config_Backend_Cert::class, - 'paypal/system_config_backend_cron' => \Mage_Paypal_Model_System_Config_Backend_Cron::class, 'paypal/system_config_backend_merchantCountry' => \Mage_Paypal_Model_System_Config_Backend_MerchantCountry::class, - 'paypal/system_config_source_authorizationAmounts' => \Mage_Paypal_Model_System_Config_Source_AuthorizationAmounts::class, - 'paypal/system_config_source_bmlPosition' => \Mage_Paypal_Model_System_Config_Source_BmlPosition::class, - 'paypal/system_config_source_bmlSize' => \Mage_Paypal_Model_System_Config_Source_BmlSize::class, - 'paypal/system_config_source_buyerCountry' => \Mage_Paypal_Model_System_Config_Source_BuyerCountry::class, - 'paypal/system_config_source_fetchingSchedule' => \Mage_Paypal_Model_System_Config_Source_FetchingSchedule::class, - 'paypal/system_config_source_logo' => \Mage_Paypal_Model_System_Config_Source_Logo::class, + 'paypal/system_config_source_buttonColors' => \Mage_Paypal_Model_System_Config_Source_ButtonColors::class, + 'paypal/system_config_source_buttonLabels' => \Mage_Paypal_Model_System_Config_Source_ButtonLabels::class, + 'paypal/system_config_source_buttonLayouts' => \Mage_Paypal_Model_System_Config_Source_ButtonLayouts::class, + 'paypal/system_config_source_buttonShapes' => \Mage_Paypal_Model_System_Config_Source_ButtonShapes::class, 'paypal/system_config_source_merchantCountry' => \Mage_Paypal_Model_System_Config_Source_MerchantCountry::class, 'paypal/system_config_source_paymentActions' => \Mage_Paypal_Model_System_Config_Source_PaymentActions::class, - 'paypal/system_config_source_paymentActions_express' => \Mage_Paypal_Model_System_Config_Source_PaymentActions_Express::class, - 'paypal/system_config_source_requireBillingAddress' => \Mage_Paypal_Model_System_Config_Source_RequireBillingAddress::class, - 'paypal/system_config_source_urlMethod' => \Mage_Paypal_Model_System_Config_Source_UrlMethod::class, - 'paypal/system_config_source_yesnoShortcut' => \Mage_Paypal_Model_System_Config_Source_YesnoShortcut::class, + 'paypal/transaction' => \Mage_Paypal_Model_Transaction::class, 'persistent/observer' => \Mage_Persistent_Model_Observer::class, 'persistent/observer_session' => \Mage_Persistent_Model_Observer_Session::class, 'persistent/persistent_config' => \Mage_Persistent_Model_Persistent_Config::class, @@ -15961,6 +15756,7 @@ 'adminhtml/system_config_source_customer_forgotpassword' => \Mage_Adminhtml_Model_System_Config_Source_Customer_Forgotpassword::class, 'adminhtml/system_config_source_customer_group' => \Mage_Adminhtml_Model_System_Config_Source_Customer_Group::class, 'adminhtml/system_config_source_customer_group_multiselect' => \Mage_Adminhtml_Model_System_Config_Source_Customer_Group_Multiselect::class, + 'adminhtml/system_config_source_dashboard_chart_type' => \Mage_Adminhtml_Model_System_Config_Source_Dashboard_Chart_Type::class, 'adminhtml/system_config_source_date_short' => \Mage_Adminhtml_Model_System_Config_Source_Date_Short::class, 'adminhtml/system_config_source_design_robots' => \Mage_Adminhtml_Model_System_Config_Source_Design_Robots::class, 'adminhtml/system_config_source_dev_dbautoup' => \Mage_Adminhtml_Model_System_Config_Source_Dev_Dbautoup::class, @@ -16423,6 +16219,7 @@ 'catalog/layer_filter_price_algorithm' => \Mage_Catalog_Model_Layer_Filter_Price_Algorithm::class, 'catalog/layer_state' => \Mage_Catalog_Model_Layer_State::class, 'catalog/observer' => \Mage_Catalog_Model_Observer::class, + 'catalog/observer_disableAdvancedSearch' => \Mage_Catalog_Model_Observer_DisableAdvancedSearch::class, 'catalog/product' => \Mage_Catalog_Model_Product::class, 'catalog/product_action' => \Mage_Catalog_Model_Product_Action::class, 'catalog/product_api' => \Mage_Catalog_Model_Product_Api::class, @@ -17102,6 +16899,9 @@ 'cron/resource_schedule_collection' => \Mage_Cron_Model_Resource_Schedule_Collection::class, 'cron_resource/schedule_collection' => \Mage_Cron_Model_Resource_Schedule_Collection::class, 'cron/schedule' => \Mage_Cron_Model_Schedule::class, + 'csp/observer_abstract' => \Mage_Csp_Model_Observer_Abstract::class, + 'csp/observer_addAdminCspHeaders' => \Mage_Csp_Model_Observer_AddAdminCspHeaders::class, + 'csp/observer_addFrontendCspHeaders' => \Mage_Csp_Model_Observer_AddFrontendCspHeaders::class, 'currencysymbol/observer' => \Mage_CurrencySymbol_Model_Observer::class, 'currencysymbol/system_currencysymbol' => \Mage_CurrencySymbol_Model_System_Currencysymbol::class, 'customer/address' => \Mage_Customer_Model_Address::class, @@ -17710,76 +17510,30 @@ 'payment/recurring_profile' => \Mage_Payment_Model_Recurring_Profile::class, 'payment/source_cctype' => \Mage_Payment_Model_Source_Cctype::class, 'payment/source_invoice' => \Mage_Payment_Model_Source_Invoice::class, - 'paypaluk/api_express_nvp' => \Mage_PaypalUk_Model_Api_Express_Nvp::class, - 'paypaluk/api_nvp' => \Mage_PaypalUk_Model_Api_Nvp::class, - 'paypaluk/bml' => \Mage_PaypalUk_Model_Bml::class, - 'paypaluk/direct' => \Mage_PaypalUk_Model_Direct::class, - 'paypaluk/express' => \Mage_PaypalUk_Model_Express::class, - 'paypaluk/express_checkout' => \Mage_PaypalUk_Model_Express_Checkout::class, - 'paypaluk/express_pro' => \Mage_PaypalUk_Model_Express_Pro::class, - 'paypaluk/pro' => \Mage_PaypalUk_Model_Pro::class, - 'paypaluk/session' => \Mage_PaypalUk_Model_Session::class, - 'paypal/api_abstract' => \Mage_Paypal_Model_Api_Abstract::class, - 'paypal/api_nvp' => \Mage_Paypal_Model_Api_Nvp::class, - 'paypal/api_processableException' => \Mage_Paypal_Model_Api_ProcessableException::class, - 'paypal/api_standard' => \Mage_Paypal_Model_Api_Standard::class, - 'paypal/bml' => \Mage_Paypal_Model_Bml::class, + 'paypal/api' => \Mage_Paypal_Model_Api::class, 'paypal/cart' => \Mage_Paypal_Model_Cart::class, - 'paypal/cert' => \Mage_Paypal_Model_Cert::class, 'paypal/config' => \Mage_Paypal_Model_Config::class, - 'paypal/direct' => \Mage_Paypal_Model_Direct::class, - 'paypal/express' => \Mage_Paypal_Model_Express::class, - 'paypal/express_checkout' => \Mage_Paypal_Model_Express_Checkout::class, - 'paypal/hostedpro' => \Mage_Paypal_Model_Hostedpro::class, - 'paypal/hostedpro_request' => \Mage_Paypal_Model_Hostedpro_Request::class, - 'paypal/info' => \Mage_Paypal_Model_Info::class, - 'paypal/ipn' => \Mage_Paypal_Model_Ipn::class, - 'paypal/method_agreement' => \Mage_Paypal_Model_Method_Agreement::class, - 'paypal/mysql4_cert' => \Mage_Paypal_Model_Mysql4_Cert::class, - 'paypal/mysql4_report_settlement' => \Mage_Paypal_Model_Mysql4_Report_Settlement::class, - 'paypal/mysql4_report_settlement_row' => \Mage_Paypal_Model_Mysql4_Report_Settlement_Row::class, - 'paypal/mysql4_report_settlement_row_collection' => \Mage_Paypal_Model_Mysql4_Report_Settlement_Row_Collection::class, - 'paypal/mysql4_setup' => \Mage_Paypal_Model_Mysql4_Setup::class, - 'paypal/observer' => \Mage_Paypal_Model_Observer::class, - 'paypal/payflow_request' => \Mage_Paypal_Model_Payflow_Request::class, - 'paypal/payflowadvanced' => \Mage_Paypal_Model_Payflowadvanced::class, - 'paypal/payflowlink' => \Mage_Paypal_Model_Payflowlink::class, - 'paypal/payflowpro' => \Mage_Paypal_Model_Payflowpro::class, - 'paypal/payment_transaction' => \Mage_Paypal_Model_Payment_Transaction::class, - 'paypal/pro' => \Mage_Paypal_Model_Pro::class, - 'paypal/report_settlement' => \Mage_Paypal_Model_Report_Settlement::class, - 'paypal/report_settlement_row' => \Mage_Paypal_Model_Report_Settlement_Row::class, - 'paypal/resource_cert' => \Mage_Paypal_Model_Resource_Cert::class, - 'paypal_resource/cert' => \Mage_Paypal_Model_Resource_Cert::class, - 'paypal/resource_payment_transaction' => \Mage_Paypal_Model_Resource_Payment_Transaction::class, - 'paypal_resource/payment_transaction' => \Mage_Paypal_Model_Resource_Payment_Transaction::class, - 'paypal/resource_payment_transaction_collection' => \Mage_Paypal_Model_Resource_Payment_Transaction_Collection::class, - 'paypal_resource/payment_transaction_collection' => \Mage_Paypal_Model_Resource_Payment_Transaction_Collection::class, - 'paypal/resource_report_settlement' => \Mage_Paypal_Model_Resource_Report_Settlement::class, - 'paypal_resource/report_settlement' => \Mage_Paypal_Model_Resource_Report_Settlement::class, - 'paypal/resource_report_settlement_row' => \Mage_Paypal_Model_Resource_Report_Settlement_Row::class, - 'paypal_resource/report_settlement_row' => \Mage_Paypal_Model_Resource_Report_Settlement_Row::class, - 'paypal/resource_report_settlement_row_collection' => \Mage_Paypal_Model_Resource_Report_Settlement_Row_Collection::class, - 'paypal_resource/report_settlement_row_collection' => \Mage_Paypal_Model_Resource_Report_Settlement_Row_Collection::class, + 'paypal/cron' => \Mage_Paypal_Model_Cron::class, + 'paypal/debug' => \Mage_Paypal_Model_Debug::class, + 'paypal/exception' => \Mage_Paypal_Model_Exception::class, + 'paypal/helper' => \Mage_Paypal_Model_Helper::class, + 'paypal/order' => \Mage_Paypal_Model_Order::class, + 'paypal/payment' => \Mage_Paypal_Model_Payment::class, + 'paypal/paypal' => \Mage_Paypal_Model_Paypal::class, + 'paypal/resource_debug' => \Mage_Paypal_Model_Resource_Debug::class, + 'paypal_resource/debug' => \Mage_Paypal_Model_Resource_Debug::class, + 'paypal/resource_debug_collection' => \Mage_Paypal_Model_Resource_Debug_Collection::class, + 'paypal_resource/debug_collection' => \Mage_Paypal_Model_Resource_Debug_Collection::class, 'paypal/resource_setup' => \Mage_Paypal_Model_Resource_Setup::class, 'paypal_resource/setup' => \Mage_Paypal_Model_Resource_Setup::class, - 'paypal/session' => \Mage_Paypal_Model_Session::class, - 'paypal/standard' => \Mage_Paypal_Model_Standard::class, - 'paypal/system_config_backend_cert' => \Mage_Paypal_Model_System_Config_Backend_Cert::class, - 'paypal/system_config_backend_cron' => \Mage_Paypal_Model_System_Config_Backend_Cron::class, 'paypal/system_config_backend_merchantCountry' => \Mage_Paypal_Model_System_Config_Backend_MerchantCountry::class, - 'paypal/system_config_source_authorizationAmounts' => \Mage_Paypal_Model_System_Config_Source_AuthorizationAmounts::class, - 'paypal/system_config_source_bmlPosition' => \Mage_Paypal_Model_System_Config_Source_BmlPosition::class, - 'paypal/system_config_source_bmlSize' => \Mage_Paypal_Model_System_Config_Source_BmlSize::class, - 'paypal/system_config_source_buyerCountry' => \Mage_Paypal_Model_System_Config_Source_BuyerCountry::class, - 'paypal/system_config_source_fetchingSchedule' => \Mage_Paypal_Model_System_Config_Source_FetchingSchedule::class, - 'paypal/system_config_source_logo' => \Mage_Paypal_Model_System_Config_Source_Logo::class, + 'paypal/system_config_source_buttonColors' => \Mage_Paypal_Model_System_Config_Source_ButtonColors::class, + 'paypal/system_config_source_buttonLabels' => \Mage_Paypal_Model_System_Config_Source_ButtonLabels::class, + 'paypal/system_config_source_buttonLayouts' => \Mage_Paypal_Model_System_Config_Source_ButtonLayouts::class, + 'paypal/system_config_source_buttonShapes' => \Mage_Paypal_Model_System_Config_Source_ButtonShapes::class, 'paypal/system_config_source_merchantCountry' => \Mage_Paypal_Model_System_Config_Source_MerchantCountry::class, 'paypal/system_config_source_paymentActions' => \Mage_Paypal_Model_System_Config_Source_PaymentActions::class, - 'paypal/system_config_source_paymentActions_express' => \Mage_Paypal_Model_System_Config_Source_PaymentActions_Express::class, - 'paypal/system_config_source_requireBillingAddress' => \Mage_Paypal_Model_System_Config_Source_RequireBillingAddress::class, - 'paypal/system_config_source_urlMethod' => \Mage_Paypal_Model_System_Config_Source_UrlMethod::class, - 'paypal/system_config_source_yesnoShortcut' => \Mage_Paypal_Model_System_Config_Source_YesnoShortcut::class, + 'paypal/transaction' => \Mage_Paypal_Model_Transaction::class, 'persistent/observer' => \Mage_Persistent_Model_Observer::class, 'persistent/observer_session' => \Mage_Persistent_Model_Observer_Session::class, 'persistent/persistent_config' => \Mage_Persistent_Model_Persistent_Config::class, @@ -19117,6 +18871,7 @@ 'adminhtml/system_config_source_customer_forgotpassword' => \Mage_Adminhtml_Model_System_Config_Source_Customer_Forgotpassword::class, 'adminhtml/system_config_source_customer_group' => \Mage_Adminhtml_Model_System_Config_Source_Customer_Group::class, 'adminhtml/system_config_source_customer_group_multiselect' => \Mage_Adminhtml_Model_System_Config_Source_Customer_Group_Multiselect::class, + 'adminhtml/system_config_source_dashboard_chart_type' => \Mage_Adminhtml_Model_System_Config_Source_Dashboard_Chart_Type::class, 'adminhtml/system_config_source_date_short' => \Mage_Adminhtml_Model_System_Config_Source_Date_Short::class, 'adminhtml/system_config_source_design_robots' => \Mage_Adminhtml_Model_System_Config_Source_Design_Robots::class, 'adminhtml/system_config_source_dev_dbautoup' => \Mage_Adminhtml_Model_System_Config_Source_Dev_Dbautoup::class, @@ -19579,6 +19334,7 @@ 'catalog/layer_filter_price_algorithm' => \Mage_Catalog_Model_Layer_Filter_Price_Algorithm::class, 'catalog/layer_state' => \Mage_Catalog_Model_Layer_State::class, 'catalog/observer' => \Mage_Catalog_Model_Observer::class, + 'catalog/observer_disableAdvancedSearch' => \Mage_Catalog_Model_Observer_DisableAdvancedSearch::class, 'catalog/product' => \Mage_Catalog_Model_Product::class, 'catalog/product_action' => \Mage_Catalog_Model_Product_Action::class, 'catalog/product_api' => \Mage_Catalog_Model_Product_Api::class, @@ -20258,6 +20014,9 @@ 'cron/resource_schedule_collection' => \Mage_Cron_Model_Resource_Schedule_Collection::class, 'cron_resource/schedule_collection' => \Mage_Cron_Model_Resource_Schedule_Collection::class, 'cron/schedule' => \Mage_Cron_Model_Schedule::class, + 'csp/observer_abstract' => \Mage_Csp_Model_Observer_Abstract::class, + 'csp/observer_addAdminCspHeaders' => \Mage_Csp_Model_Observer_AddAdminCspHeaders::class, + 'csp/observer_addFrontendCspHeaders' => \Mage_Csp_Model_Observer_AddFrontendCspHeaders::class, 'currencysymbol/observer' => \Mage_CurrencySymbol_Model_Observer::class, 'currencysymbol/system_currencysymbol' => \Mage_CurrencySymbol_Model_System_Currencysymbol::class, 'customer/address' => \Mage_Customer_Model_Address::class, @@ -20866,76 +20625,30 @@ 'payment/recurring_profile' => \Mage_Payment_Model_Recurring_Profile::class, 'payment/source_cctype' => \Mage_Payment_Model_Source_Cctype::class, 'payment/source_invoice' => \Mage_Payment_Model_Source_Invoice::class, - 'paypaluk/api_express_nvp' => \Mage_PaypalUk_Model_Api_Express_Nvp::class, - 'paypaluk/api_nvp' => \Mage_PaypalUk_Model_Api_Nvp::class, - 'paypaluk/bml' => \Mage_PaypalUk_Model_Bml::class, - 'paypaluk/direct' => \Mage_PaypalUk_Model_Direct::class, - 'paypaluk/express' => \Mage_PaypalUk_Model_Express::class, - 'paypaluk/express_checkout' => \Mage_PaypalUk_Model_Express_Checkout::class, - 'paypaluk/express_pro' => \Mage_PaypalUk_Model_Express_Pro::class, - 'paypaluk/pro' => \Mage_PaypalUk_Model_Pro::class, - 'paypaluk/session' => \Mage_PaypalUk_Model_Session::class, - 'paypal/api_abstract' => \Mage_Paypal_Model_Api_Abstract::class, - 'paypal/api_nvp' => \Mage_Paypal_Model_Api_Nvp::class, - 'paypal/api_processableException' => \Mage_Paypal_Model_Api_ProcessableException::class, - 'paypal/api_standard' => \Mage_Paypal_Model_Api_Standard::class, - 'paypal/bml' => \Mage_Paypal_Model_Bml::class, + 'paypal/api' => \Mage_Paypal_Model_Api::class, 'paypal/cart' => \Mage_Paypal_Model_Cart::class, - 'paypal/cert' => \Mage_Paypal_Model_Cert::class, 'paypal/config' => \Mage_Paypal_Model_Config::class, - 'paypal/direct' => \Mage_Paypal_Model_Direct::class, - 'paypal/express' => \Mage_Paypal_Model_Express::class, - 'paypal/express_checkout' => \Mage_Paypal_Model_Express_Checkout::class, - 'paypal/hostedpro' => \Mage_Paypal_Model_Hostedpro::class, - 'paypal/hostedpro_request' => \Mage_Paypal_Model_Hostedpro_Request::class, - 'paypal/info' => \Mage_Paypal_Model_Info::class, - 'paypal/ipn' => \Mage_Paypal_Model_Ipn::class, - 'paypal/method_agreement' => \Mage_Paypal_Model_Method_Agreement::class, - 'paypal/mysql4_cert' => \Mage_Paypal_Model_Mysql4_Cert::class, - 'paypal/mysql4_report_settlement' => \Mage_Paypal_Model_Mysql4_Report_Settlement::class, - 'paypal/mysql4_report_settlement_row' => \Mage_Paypal_Model_Mysql4_Report_Settlement_Row::class, - 'paypal/mysql4_report_settlement_row_collection' => \Mage_Paypal_Model_Mysql4_Report_Settlement_Row_Collection::class, - 'paypal/mysql4_setup' => \Mage_Paypal_Model_Mysql4_Setup::class, - 'paypal/observer' => \Mage_Paypal_Model_Observer::class, - 'paypal/payflow_request' => \Mage_Paypal_Model_Payflow_Request::class, - 'paypal/payflowadvanced' => \Mage_Paypal_Model_Payflowadvanced::class, - 'paypal/payflowlink' => \Mage_Paypal_Model_Payflowlink::class, - 'paypal/payflowpro' => \Mage_Paypal_Model_Payflowpro::class, - 'paypal/payment_transaction' => \Mage_Paypal_Model_Payment_Transaction::class, - 'paypal/pro' => \Mage_Paypal_Model_Pro::class, - 'paypal/report_settlement' => \Mage_Paypal_Model_Report_Settlement::class, - 'paypal/report_settlement_row' => \Mage_Paypal_Model_Report_Settlement_Row::class, - 'paypal/resource_cert' => \Mage_Paypal_Model_Resource_Cert::class, - 'paypal_resource/cert' => \Mage_Paypal_Model_Resource_Cert::class, - 'paypal/resource_payment_transaction' => \Mage_Paypal_Model_Resource_Payment_Transaction::class, - 'paypal_resource/payment_transaction' => \Mage_Paypal_Model_Resource_Payment_Transaction::class, - 'paypal/resource_payment_transaction_collection' => \Mage_Paypal_Model_Resource_Payment_Transaction_Collection::class, - 'paypal_resource/payment_transaction_collection' => \Mage_Paypal_Model_Resource_Payment_Transaction_Collection::class, - 'paypal/resource_report_settlement' => \Mage_Paypal_Model_Resource_Report_Settlement::class, - 'paypal_resource/report_settlement' => \Mage_Paypal_Model_Resource_Report_Settlement::class, - 'paypal/resource_report_settlement_row' => \Mage_Paypal_Model_Resource_Report_Settlement_Row::class, - 'paypal_resource/report_settlement_row' => \Mage_Paypal_Model_Resource_Report_Settlement_Row::class, - 'paypal/resource_report_settlement_row_collection' => \Mage_Paypal_Model_Resource_Report_Settlement_Row_Collection::class, - 'paypal_resource/report_settlement_row_collection' => \Mage_Paypal_Model_Resource_Report_Settlement_Row_Collection::class, + 'paypal/cron' => \Mage_Paypal_Model_Cron::class, + 'paypal/debug' => \Mage_Paypal_Model_Debug::class, + 'paypal/exception' => \Mage_Paypal_Model_Exception::class, + 'paypal/helper' => \Mage_Paypal_Model_Helper::class, + 'paypal/order' => \Mage_Paypal_Model_Order::class, + 'paypal/payment' => \Mage_Paypal_Model_Payment::class, + 'paypal/paypal' => \Mage_Paypal_Model_Paypal::class, + 'paypal/resource_debug' => \Mage_Paypal_Model_Resource_Debug::class, + 'paypal_resource/debug' => \Mage_Paypal_Model_Resource_Debug::class, + 'paypal/resource_debug_collection' => \Mage_Paypal_Model_Resource_Debug_Collection::class, + 'paypal_resource/debug_collection' => \Mage_Paypal_Model_Resource_Debug_Collection::class, 'paypal/resource_setup' => \Mage_Paypal_Model_Resource_Setup::class, 'paypal_resource/setup' => \Mage_Paypal_Model_Resource_Setup::class, - 'paypal/session' => \Mage_Paypal_Model_Session::class, - 'paypal/standard' => \Mage_Paypal_Model_Standard::class, - 'paypal/system_config_backend_cert' => \Mage_Paypal_Model_System_Config_Backend_Cert::class, - 'paypal/system_config_backend_cron' => \Mage_Paypal_Model_System_Config_Backend_Cron::class, 'paypal/system_config_backend_merchantCountry' => \Mage_Paypal_Model_System_Config_Backend_MerchantCountry::class, - 'paypal/system_config_source_authorizationAmounts' => \Mage_Paypal_Model_System_Config_Source_AuthorizationAmounts::class, - 'paypal/system_config_source_bmlPosition' => \Mage_Paypal_Model_System_Config_Source_BmlPosition::class, - 'paypal/system_config_source_bmlSize' => \Mage_Paypal_Model_System_Config_Source_BmlSize::class, - 'paypal/system_config_source_buyerCountry' => \Mage_Paypal_Model_System_Config_Source_BuyerCountry::class, - 'paypal/system_config_source_fetchingSchedule' => \Mage_Paypal_Model_System_Config_Source_FetchingSchedule::class, - 'paypal/system_config_source_logo' => \Mage_Paypal_Model_System_Config_Source_Logo::class, + 'paypal/system_config_source_buttonColors' => \Mage_Paypal_Model_System_Config_Source_ButtonColors::class, + 'paypal/system_config_source_buttonLabels' => \Mage_Paypal_Model_System_Config_Source_ButtonLabels::class, + 'paypal/system_config_source_buttonLayouts' => \Mage_Paypal_Model_System_Config_Source_ButtonLayouts::class, + 'paypal/system_config_source_buttonShapes' => \Mage_Paypal_Model_System_Config_Source_ButtonShapes::class, 'paypal/system_config_source_merchantCountry' => \Mage_Paypal_Model_System_Config_Source_MerchantCountry::class, 'paypal/system_config_source_paymentActions' => \Mage_Paypal_Model_System_Config_Source_PaymentActions::class, - 'paypal/system_config_source_paymentActions_express' => \Mage_Paypal_Model_System_Config_Source_PaymentActions_Express::class, - 'paypal/system_config_source_requireBillingAddress' => \Mage_Paypal_Model_System_Config_Source_RequireBillingAddress::class, - 'paypal/system_config_source_urlMethod' => \Mage_Paypal_Model_System_Config_Source_UrlMethod::class, - 'paypal/system_config_source_yesnoShortcut' => \Mage_Paypal_Model_System_Config_Source_YesnoShortcut::class, + 'paypal/transaction' => \Mage_Paypal_Model_Transaction::class, 'persistent/observer' => \Mage_Persistent_Model_Observer::class, 'persistent/observer_session' => \Mage_Persistent_Model_Observer_Session::class, 'persistent/persistent_config' => \Mage_Persistent_Model_Persistent_Config::class, @@ -22273,6 +21986,7 @@ 'adminhtml/system_config_source_customer_forgotpassword' => \Mage_Adminhtml_Model_System_Config_Source_Customer_Forgotpassword::class, 'adminhtml/system_config_source_customer_group' => \Mage_Adminhtml_Model_System_Config_Source_Customer_Group::class, 'adminhtml/system_config_source_customer_group_multiselect' => \Mage_Adminhtml_Model_System_Config_Source_Customer_Group_Multiselect::class, + 'adminhtml/system_config_source_dashboard_chart_type' => \Mage_Adminhtml_Model_System_Config_Source_Dashboard_Chart_Type::class, 'adminhtml/system_config_source_date_short' => \Mage_Adminhtml_Model_System_Config_Source_Date_Short::class, 'adminhtml/system_config_source_design_robots' => \Mage_Adminhtml_Model_System_Config_Source_Design_Robots::class, 'adminhtml/system_config_source_dev_dbautoup' => \Mage_Adminhtml_Model_System_Config_Source_Dev_Dbautoup::class, @@ -22735,6 +22449,7 @@ 'catalog/layer_filter_price_algorithm' => \Mage_Catalog_Model_Layer_Filter_Price_Algorithm::class, 'catalog/layer_state' => \Mage_Catalog_Model_Layer_State::class, 'catalog/observer' => \Mage_Catalog_Model_Observer::class, + 'catalog/observer_disableAdvancedSearch' => \Mage_Catalog_Model_Observer_DisableAdvancedSearch::class, 'catalog/product' => \Mage_Catalog_Model_Product::class, 'catalog/product_action' => \Mage_Catalog_Model_Product_Action::class, 'catalog/product_api' => \Mage_Catalog_Model_Product_Api::class, @@ -23414,6 +23129,9 @@ 'cron/resource_schedule_collection' => \Mage_Cron_Model_Resource_Schedule_Collection::class, 'cron_resource/schedule_collection' => \Mage_Cron_Model_Resource_Schedule_Collection::class, 'cron/schedule' => \Mage_Cron_Model_Schedule::class, + 'csp/observer_abstract' => \Mage_Csp_Model_Observer_Abstract::class, + 'csp/observer_addAdminCspHeaders' => \Mage_Csp_Model_Observer_AddAdminCspHeaders::class, + 'csp/observer_addFrontendCspHeaders' => \Mage_Csp_Model_Observer_AddFrontendCspHeaders::class, 'currencysymbol/observer' => \Mage_CurrencySymbol_Model_Observer::class, 'currencysymbol/system_currencysymbol' => \Mage_CurrencySymbol_Model_System_Currencysymbol::class, 'customer/address' => \Mage_Customer_Model_Address::class, @@ -24022,76 +23740,30 @@ 'payment/recurring_profile' => \Mage_Payment_Model_Recurring_Profile::class, 'payment/source_cctype' => \Mage_Payment_Model_Source_Cctype::class, 'payment/source_invoice' => \Mage_Payment_Model_Source_Invoice::class, - 'paypaluk/api_express_nvp' => \Mage_PaypalUk_Model_Api_Express_Nvp::class, - 'paypaluk/api_nvp' => \Mage_PaypalUk_Model_Api_Nvp::class, - 'paypaluk/bml' => \Mage_PaypalUk_Model_Bml::class, - 'paypaluk/direct' => \Mage_PaypalUk_Model_Direct::class, - 'paypaluk/express' => \Mage_PaypalUk_Model_Express::class, - 'paypaluk/express_checkout' => \Mage_PaypalUk_Model_Express_Checkout::class, - 'paypaluk/express_pro' => \Mage_PaypalUk_Model_Express_Pro::class, - 'paypaluk/pro' => \Mage_PaypalUk_Model_Pro::class, - 'paypaluk/session' => \Mage_PaypalUk_Model_Session::class, - 'paypal/api_abstract' => \Mage_Paypal_Model_Api_Abstract::class, - 'paypal/api_nvp' => \Mage_Paypal_Model_Api_Nvp::class, - 'paypal/api_processableException' => \Mage_Paypal_Model_Api_ProcessableException::class, - 'paypal/api_standard' => \Mage_Paypal_Model_Api_Standard::class, - 'paypal/bml' => \Mage_Paypal_Model_Bml::class, + 'paypal/api' => \Mage_Paypal_Model_Api::class, 'paypal/cart' => \Mage_Paypal_Model_Cart::class, - 'paypal/cert' => \Mage_Paypal_Model_Cert::class, 'paypal/config' => \Mage_Paypal_Model_Config::class, - 'paypal/direct' => \Mage_Paypal_Model_Direct::class, - 'paypal/express' => \Mage_Paypal_Model_Express::class, - 'paypal/express_checkout' => \Mage_Paypal_Model_Express_Checkout::class, - 'paypal/hostedpro' => \Mage_Paypal_Model_Hostedpro::class, - 'paypal/hostedpro_request' => \Mage_Paypal_Model_Hostedpro_Request::class, - 'paypal/info' => \Mage_Paypal_Model_Info::class, - 'paypal/ipn' => \Mage_Paypal_Model_Ipn::class, - 'paypal/method_agreement' => \Mage_Paypal_Model_Method_Agreement::class, - 'paypal/mysql4_cert' => \Mage_Paypal_Model_Mysql4_Cert::class, - 'paypal/mysql4_report_settlement' => \Mage_Paypal_Model_Mysql4_Report_Settlement::class, - 'paypal/mysql4_report_settlement_row' => \Mage_Paypal_Model_Mysql4_Report_Settlement_Row::class, - 'paypal/mysql4_report_settlement_row_collection' => \Mage_Paypal_Model_Mysql4_Report_Settlement_Row_Collection::class, - 'paypal/mysql4_setup' => \Mage_Paypal_Model_Mysql4_Setup::class, - 'paypal/observer' => \Mage_Paypal_Model_Observer::class, - 'paypal/payflow_request' => \Mage_Paypal_Model_Payflow_Request::class, - 'paypal/payflowadvanced' => \Mage_Paypal_Model_Payflowadvanced::class, - 'paypal/payflowlink' => \Mage_Paypal_Model_Payflowlink::class, - 'paypal/payflowpro' => \Mage_Paypal_Model_Payflowpro::class, - 'paypal/payment_transaction' => \Mage_Paypal_Model_Payment_Transaction::class, - 'paypal/pro' => \Mage_Paypal_Model_Pro::class, - 'paypal/report_settlement' => \Mage_Paypal_Model_Report_Settlement::class, - 'paypal/report_settlement_row' => \Mage_Paypal_Model_Report_Settlement_Row::class, - 'paypal/resource_cert' => \Mage_Paypal_Model_Resource_Cert::class, - 'paypal_resource/cert' => \Mage_Paypal_Model_Resource_Cert::class, - 'paypal/resource_payment_transaction' => \Mage_Paypal_Model_Resource_Payment_Transaction::class, - 'paypal_resource/payment_transaction' => \Mage_Paypal_Model_Resource_Payment_Transaction::class, - 'paypal/resource_payment_transaction_collection' => \Mage_Paypal_Model_Resource_Payment_Transaction_Collection::class, - 'paypal_resource/payment_transaction_collection' => \Mage_Paypal_Model_Resource_Payment_Transaction_Collection::class, - 'paypal/resource_report_settlement' => \Mage_Paypal_Model_Resource_Report_Settlement::class, - 'paypal_resource/report_settlement' => \Mage_Paypal_Model_Resource_Report_Settlement::class, - 'paypal/resource_report_settlement_row' => \Mage_Paypal_Model_Resource_Report_Settlement_Row::class, - 'paypal_resource/report_settlement_row' => \Mage_Paypal_Model_Resource_Report_Settlement_Row::class, - 'paypal/resource_report_settlement_row_collection' => \Mage_Paypal_Model_Resource_Report_Settlement_Row_Collection::class, - 'paypal_resource/report_settlement_row_collection' => \Mage_Paypal_Model_Resource_Report_Settlement_Row_Collection::class, + 'paypal/cron' => \Mage_Paypal_Model_Cron::class, + 'paypal/debug' => \Mage_Paypal_Model_Debug::class, + 'paypal/exception' => \Mage_Paypal_Model_Exception::class, + 'paypal/helper' => \Mage_Paypal_Model_Helper::class, + 'paypal/order' => \Mage_Paypal_Model_Order::class, + 'paypal/payment' => \Mage_Paypal_Model_Payment::class, + 'paypal/paypal' => \Mage_Paypal_Model_Paypal::class, + 'paypal/resource_debug' => \Mage_Paypal_Model_Resource_Debug::class, + 'paypal_resource/debug' => \Mage_Paypal_Model_Resource_Debug::class, + 'paypal/resource_debug_collection' => \Mage_Paypal_Model_Resource_Debug_Collection::class, + 'paypal_resource/debug_collection' => \Mage_Paypal_Model_Resource_Debug_Collection::class, 'paypal/resource_setup' => \Mage_Paypal_Model_Resource_Setup::class, 'paypal_resource/setup' => \Mage_Paypal_Model_Resource_Setup::class, - 'paypal/session' => \Mage_Paypal_Model_Session::class, - 'paypal/standard' => \Mage_Paypal_Model_Standard::class, - 'paypal/system_config_backend_cert' => \Mage_Paypal_Model_System_Config_Backend_Cert::class, - 'paypal/system_config_backend_cron' => \Mage_Paypal_Model_System_Config_Backend_Cron::class, 'paypal/system_config_backend_merchantCountry' => \Mage_Paypal_Model_System_Config_Backend_MerchantCountry::class, - 'paypal/system_config_source_authorizationAmounts' => \Mage_Paypal_Model_System_Config_Source_AuthorizationAmounts::class, - 'paypal/system_config_source_bmlPosition' => \Mage_Paypal_Model_System_Config_Source_BmlPosition::class, - 'paypal/system_config_source_bmlSize' => \Mage_Paypal_Model_System_Config_Source_BmlSize::class, - 'paypal/system_config_source_buyerCountry' => \Mage_Paypal_Model_System_Config_Source_BuyerCountry::class, - 'paypal/system_config_source_fetchingSchedule' => \Mage_Paypal_Model_System_Config_Source_FetchingSchedule::class, - 'paypal/system_config_source_logo' => \Mage_Paypal_Model_System_Config_Source_Logo::class, + 'paypal/system_config_source_buttonColors' => \Mage_Paypal_Model_System_Config_Source_ButtonColors::class, + 'paypal/system_config_source_buttonLabels' => \Mage_Paypal_Model_System_Config_Source_ButtonLabels::class, + 'paypal/system_config_source_buttonLayouts' => \Mage_Paypal_Model_System_Config_Source_ButtonLayouts::class, + 'paypal/system_config_source_buttonShapes' => \Mage_Paypal_Model_System_Config_Source_ButtonShapes::class, 'paypal/system_config_source_merchantCountry' => \Mage_Paypal_Model_System_Config_Source_MerchantCountry::class, 'paypal/system_config_source_paymentActions' => \Mage_Paypal_Model_System_Config_Source_PaymentActions::class, - 'paypal/system_config_source_paymentActions_express' => \Mage_Paypal_Model_System_Config_Source_PaymentActions_Express::class, - 'paypal/system_config_source_requireBillingAddress' => \Mage_Paypal_Model_System_Config_Source_RequireBillingAddress::class, - 'paypal/system_config_source_urlMethod' => \Mage_Paypal_Model_System_Config_Source_UrlMethod::class, - 'paypal/system_config_source_yesnoShortcut' => \Mage_Paypal_Model_System_Config_Source_YesnoShortcut::class, + 'paypal/transaction' => \Mage_Paypal_Model_Transaction::class, 'persistent/observer' => \Mage_Persistent_Model_Observer::class, 'persistent/observer_session' => \Mage_Persistent_Model_Observer_Session::class, 'persistent/persistent_config' => \Mage_Persistent_Model_Persistent_Config::class, @@ -25429,6 +25101,7 @@ 'adminhtml/system_config_source_customer_forgotpassword' => \Mage_Adminhtml_Model_System_Config_Source_Customer_Forgotpassword::class, 'adminhtml/system_config_source_customer_group' => \Mage_Adminhtml_Model_System_Config_Source_Customer_Group::class, 'adminhtml/system_config_source_customer_group_multiselect' => \Mage_Adminhtml_Model_System_Config_Source_Customer_Group_Multiselect::class, + 'adminhtml/system_config_source_dashboard_chart_type' => \Mage_Adminhtml_Model_System_Config_Source_Dashboard_Chart_Type::class, 'adminhtml/system_config_source_date_short' => \Mage_Adminhtml_Model_System_Config_Source_Date_Short::class, 'adminhtml/system_config_source_design_robots' => \Mage_Adminhtml_Model_System_Config_Source_Design_Robots::class, 'adminhtml/system_config_source_dev_dbautoup' => \Mage_Adminhtml_Model_System_Config_Source_Dev_Dbautoup::class, @@ -25891,6 +25564,7 @@ 'catalog/layer_filter_price_algorithm' => \Mage_Catalog_Model_Layer_Filter_Price_Algorithm::class, 'catalog/layer_state' => \Mage_Catalog_Model_Layer_State::class, 'catalog/observer' => \Mage_Catalog_Model_Observer::class, + 'catalog/observer_disableAdvancedSearch' => \Mage_Catalog_Model_Observer_DisableAdvancedSearch::class, 'catalog/product' => \Mage_Catalog_Model_Product::class, 'catalog/product_action' => \Mage_Catalog_Model_Product_Action::class, 'catalog/product_api' => \Mage_Catalog_Model_Product_Api::class, @@ -26570,6 +26244,9 @@ 'cron/resource_schedule_collection' => \Mage_Cron_Model_Resource_Schedule_Collection::class, 'cron_resource/schedule_collection' => \Mage_Cron_Model_Resource_Schedule_Collection::class, 'cron/schedule' => \Mage_Cron_Model_Schedule::class, + 'csp/observer_abstract' => \Mage_Csp_Model_Observer_Abstract::class, + 'csp/observer_addAdminCspHeaders' => \Mage_Csp_Model_Observer_AddAdminCspHeaders::class, + 'csp/observer_addFrontendCspHeaders' => \Mage_Csp_Model_Observer_AddFrontendCspHeaders::class, 'currencysymbol/observer' => \Mage_CurrencySymbol_Model_Observer::class, 'currencysymbol/system_currencysymbol' => \Mage_CurrencySymbol_Model_System_Currencysymbol::class, 'customer/address' => \Mage_Customer_Model_Address::class, @@ -27178,76 +26855,30 @@ 'payment/recurring_profile' => \Mage_Payment_Model_Recurring_Profile::class, 'payment/source_cctype' => \Mage_Payment_Model_Source_Cctype::class, 'payment/source_invoice' => \Mage_Payment_Model_Source_Invoice::class, - 'paypaluk/api_express_nvp' => \Mage_PaypalUk_Model_Api_Express_Nvp::class, - 'paypaluk/api_nvp' => \Mage_PaypalUk_Model_Api_Nvp::class, - 'paypaluk/bml' => \Mage_PaypalUk_Model_Bml::class, - 'paypaluk/direct' => \Mage_PaypalUk_Model_Direct::class, - 'paypaluk/express' => \Mage_PaypalUk_Model_Express::class, - 'paypaluk/express_checkout' => \Mage_PaypalUk_Model_Express_Checkout::class, - 'paypaluk/express_pro' => \Mage_PaypalUk_Model_Express_Pro::class, - 'paypaluk/pro' => \Mage_PaypalUk_Model_Pro::class, - 'paypaluk/session' => \Mage_PaypalUk_Model_Session::class, - 'paypal/api_abstract' => \Mage_Paypal_Model_Api_Abstract::class, - 'paypal/api_nvp' => \Mage_Paypal_Model_Api_Nvp::class, - 'paypal/api_processableException' => \Mage_Paypal_Model_Api_ProcessableException::class, - 'paypal/api_standard' => \Mage_Paypal_Model_Api_Standard::class, - 'paypal/bml' => \Mage_Paypal_Model_Bml::class, + 'paypal/api' => \Mage_Paypal_Model_Api::class, 'paypal/cart' => \Mage_Paypal_Model_Cart::class, - 'paypal/cert' => \Mage_Paypal_Model_Cert::class, 'paypal/config' => \Mage_Paypal_Model_Config::class, - 'paypal/direct' => \Mage_Paypal_Model_Direct::class, - 'paypal/express' => \Mage_Paypal_Model_Express::class, - 'paypal/express_checkout' => \Mage_Paypal_Model_Express_Checkout::class, - 'paypal/hostedpro' => \Mage_Paypal_Model_Hostedpro::class, - 'paypal/hostedpro_request' => \Mage_Paypal_Model_Hostedpro_Request::class, - 'paypal/info' => \Mage_Paypal_Model_Info::class, - 'paypal/ipn' => \Mage_Paypal_Model_Ipn::class, - 'paypal/method_agreement' => \Mage_Paypal_Model_Method_Agreement::class, - 'paypal/mysql4_cert' => \Mage_Paypal_Model_Mysql4_Cert::class, - 'paypal/mysql4_report_settlement' => \Mage_Paypal_Model_Mysql4_Report_Settlement::class, - 'paypal/mysql4_report_settlement_row' => \Mage_Paypal_Model_Mysql4_Report_Settlement_Row::class, - 'paypal/mysql4_report_settlement_row_collection' => \Mage_Paypal_Model_Mysql4_Report_Settlement_Row_Collection::class, - 'paypal/mysql4_setup' => \Mage_Paypal_Model_Mysql4_Setup::class, - 'paypal/observer' => \Mage_Paypal_Model_Observer::class, - 'paypal/payflow_request' => \Mage_Paypal_Model_Payflow_Request::class, - 'paypal/payflowadvanced' => \Mage_Paypal_Model_Payflowadvanced::class, - 'paypal/payflowlink' => \Mage_Paypal_Model_Payflowlink::class, - 'paypal/payflowpro' => \Mage_Paypal_Model_Payflowpro::class, - 'paypal/payment_transaction' => \Mage_Paypal_Model_Payment_Transaction::class, - 'paypal/pro' => \Mage_Paypal_Model_Pro::class, - 'paypal/report_settlement' => \Mage_Paypal_Model_Report_Settlement::class, - 'paypal/report_settlement_row' => \Mage_Paypal_Model_Report_Settlement_Row::class, - 'paypal/resource_cert' => \Mage_Paypal_Model_Resource_Cert::class, - 'paypal_resource/cert' => \Mage_Paypal_Model_Resource_Cert::class, - 'paypal/resource_payment_transaction' => \Mage_Paypal_Model_Resource_Payment_Transaction::class, - 'paypal_resource/payment_transaction' => \Mage_Paypal_Model_Resource_Payment_Transaction::class, - 'paypal/resource_payment_transaction_collection' => \Mage_Paypal_Model_Resource_Payment_Transaction_Collection::class, - 'paypal_resource/payment_transaction_collection' => \Mage_Paypal_Model_Resource_Payment_Transaction_Collection::class, - 'paypal/resource_report_settlement' => \Mage_Paypal_Model_Resource_Report_Settlement::class, - 'paypal_resource/report_settlement' => \Mage_Paypal_Model_Resource_Report_Settlement::class, - 'paypal/resource_report_settlement_row' => \Mage_Paypal_Model_Resource_Report_Settlement_Row::class, - 'paypal_resource/report_settlement_row' => \Mage_Paypal_Model_Resource_Report_Settlement_Row::class, - 'paypal/resource_report_settlement_row_collection' => \Mage_Paypal_Model_Resource_Report_Settlement_Row_Collection::class, - 'paypal_resource/report_settlement_row_collection' => \Mage_Paypal_Model_Resource_Report_Settlement_Row_Collection::class, + 'paypal/cron' => \Mage_Paypal_Model_Cron::class, + 'paypal/debug' => \Mage_Paypal_Model_Debug::class, + 'paypal/exception' => \Mage_Paypal_Model_Exception::class, + 'paypal/helper' => \Mage_Paypal_Model_Helper::class, + 'paypal/order' => \Mage_Paypal_Model_Order::class, + 'paypal/payment' => \Mage_Paypal_Model_Payment::class, + 'paypal/paypal' => \Mage_Paypal_Model_Paypal::class, + 'paypal/resource_debug' => \Mage_Paypal_Model_Resource_Debug::class, + 'paypal_resource/debug' => \Mage_Paypal_Model_Resource_Debug::class, + 'paypal/resource_debug_collection' => \Mage_Paypal_Model_Resource_Debug_Collection::class, + 'paypal_resource/debug_collection' => \Mage_Paypal_Model_Resource_Debug_Collection::class, 'paypal/resource_setup' => \Mage_Paypal_Model_Resource_Setup::class, 'paypal_resource/setup' => \Mage_Paypal_Model_Resource_Setup::class, - 'paypal/session' => \Mage_Paypal_Model_Session::class, - 'paypal/standard' => \Mage_Paypal_Model_Standard::class, - 'paypal/system_config_backend_cert' => \Mage_Paypal_Model_System_Config_Backend_Cert::class, - 'paypal/system_config_backend_cron' => \Mage_Paypal_Model_System_Config_Backend_Cron::class, 'paypal/system_config_backend_merchantCountry' => \Mage_Paypal_Model_System_Config_Backend_MerchantCountry::class, - 'paypal/system_config_source_authorizationAmounts' => \Mage_Paypal_Model_System_Config_Source_AuthorizationAmounts::class, - 'paypal/system_config_source_bmlPosition' => \Mage_Paypal_Model_System_Config_Source_BmlPosition::class, - 'paypal/system_config_source_bmlSize' => \Mage_Paypal_Model_System_Config_Source_BmlSize::class, - 'paypal/system_config_source_buyerCountry' => \Mage_Paypal_Model_System_Config_Source_BuyerCountry::class, - 'paypal/system_config_source_fetchingSchedule' => \Mage_Paypal_Model_System_Config_Source_FetchingSchedule::class, - 'paypal/system_config_source_logo' => \Mage_Paypal_Model_System_Config_Source_Logo::class, + 'paypal/system_config_source_buttonColors' => \Mage_Paypal_Model_System_Config_Source_ButtonColors::class, + 'paypal/system_config_source_buttonLabels' => \Mage_Paypal_Model_System_Config_Source_ButtonLabels::class, + 'paypal/system_config_source_buttonLayouts' => \Mage_Paypal_Model_System_Config_Source_ButtonLayouts::class, + 'paypal/system_config_source_buttonShapes' => \Mage_Paypal_Model_System_Config_Source_ButtonShapes::class, 'paypal/system_config_source_merchantCountry' => \Mage_Paypal_Model_System_Config_Source_MerchantCountry::class, 'paypal/system_config_source_paymentActions' => \Mage_Paypal_Model_System_Config_Source_PaymentActions::class, - 'paypal/system_config_source_paymentActions_express' => \Mage_Paypal_Model_System_Config_Source_PaymentActions_Express::class, - 'paypal/system_config_source_requireBillingAddress' => \Mage_Paypal_Model_System_Config_Source_RequireBillingAddress::class, - 'paypal/system_config_source_urlMethod' => \Mage_Paypal_Model_System_Config_Source_UrlMethod::class, - 'paypal/system_config_source_yesnoShortcut' => \Mage_Paypal_Model_System_Config_Source_YesnoShortcut::class, + 'paypal/transaction' => \Mage_Paypal_Model_Transaction::class, 'persistent/observer' => \Mage_Persistent_Model_Observer::class, 'persistent/observer_session' => \Mage_Persistent_Model_Observer_Session::class, 'persistent/persistent_config' => \Mage_Persistent_Model_Persistent_Config::class, diff --git a/.phpstorm.meta.php/magento_resource_models.meta.php b/.phpstorm.meta.php/magento_resource_models.meta.php index 2e8ab002dbb..3f4773b3858 100644 --- a/.phpstorm.meta.php/magento_resource_models.meta.php +++ b/.phpstorm.meta.php/magento_resource_models.meta.php @@ -382,12 +382,8 @@ 'oauth/token_collection' => \Mage_Oauth_Model_Resource_Token_Collection::class, 'paygate/authorizenet_debug' => \Mage_Paygate_Model_Resource_Authorizenet_Debug::class, 'paygate/authorizenet_debug_collection' => \Mage_Paygate_Model_Resource_Authorizenet_Debug_Collection::class, - 'paypal/cert' => \Mage_Paypal_Model_Resource_Cert::class, - 'paypal/payment_transaction' => \Mage_Paypal_Model_Resource_Payment_Transaction::class, - 'paypal/payment_transaction_collection' => \Mage_Paypal_Model_Resource_Payment_Transaction_Collection::class, - 'paypal/report_settlement' => \Mage_Paypal_Model_Resource_Report_Settlement::class, - 'paypal/report_settlement_row' => \Mage_Paypal_Model_Resource_Report_Settlement_Row::class, - 'paypal/report_settlement_row_collection' => \Mage_Paypal_Model_Resource_Report_Settlement_Row_Collection::class, + 'paypal/debug' => \Mage_Paypal_Model_Resource_Debug::class, + 'paypal/debug_collection' => \Mage_Paypal_Model_Resource_Debug_Collection::class, 'paypal/setup' => \Mage_Paypal_Model_Resource_Setup::class, 'persistent/session' => \Mage_Persistent_Model_Resource_Session::class, 'productalert/abstract' => \Mage_ProductAlert_Model_Resource_Abstract::class, @@ -1015,12 +1011,8 @@ 'oauth/token_collection' => \Mage_Oauth_Model_Resource_Token_Collection::class, 'paygate/authorizenet_debug' => \Mage_Paygate_Model_Resource_Authorizenet_Debug::class, 'paygate/authorizenet_debug_collection' => \Mage_Paygate_Model_Resource_Authorizenet_Debug_Collection::class, - 'paypal/cert' => \Mage_Paypal_Model_Resource_Cert::class, - 'paypal/payment_transaction' => \Mage_Paypal_Model_Resource_Payment_Transaction::class, - 'paypal/payment_transaction_collection' => \Mage_Paypal_Model_Resource_Payment_Transaction_Collection::class, - 'paypal/report_settlement' => \Mage_Paypal_Model_Resource_Report_Settlement::class, - 'paypal/report_settlement_row' => \Mage_Paypal_Model_Resource_Report_Settlement_Row::class, - 'paypal/report_settlement_row_collection' => \Mage_Paypal_Model_Resource_Report_Settlement_Row_Collection::class, + 'paypal/debug' => \Mage_Paypal_Model_Resource_Debug::class, + 'paypal/debug_collection' => \Mage_Paypal_Model_Resource_Debug_Collection::class, 'paypal/setup' => \Mage_Paypal_Model_Resource_Setup::class, 'persistent/session' => \Mage_Persistent_Model_Resource_Session::class, 'productalert/abstract' => \Mage_ProductAlert_Model_Resource_Abstract::class, diff --git a/.phpstorm.meta.php/magento_resource_models_methods.meta.php b/.phpstorm.meta.php/magento_resource_models_methods.meta.php index fd8ccde3495..85849aad391 100644 --- a/.phpstorm.meta.php/magento_resource_models_methods.meta.php +++ b/.phpstorm.meta.php/magento_resource_models_methods.meta.php @@ -382,12 +382,8 @@ 'oauth/token_collection' => \Mage_Oauth_Model_Resource_Token_Collection::class, 'paygate/authorizenet_debug' => \Mage_Paygate_Model_Resource_Authorizenet_Debug::class, 'paygate/authorizenet_debug_collection' => \Mage_Paygate_Model_Resource_Authorizenet_Debug_Collection::class, - 'paypal/cert' => \Mage_Paypal_Model_Resource_Cert::class, - 'paypal/payment_transaction' => \Mage_Paypal_Model_Resource_Payment_Transaction::class, - 'paypal/payment_transaction_collection' => \Mage_Paypal_Model_Resource_Payment_Transaction_Collection::class, - 'paypal/report_settlement' => \Mage_Paypal_Model_Resource_Report_Settlement::class, - 'paypal/report_settlement_row' => \Mage_Paypal_Model_Resource_Report_Settlement_Row::class, - 'paypal/report_settlement_row_collection' => \Mage_Paypal_Model_Resource_Report_Settlement_Row_Collection::class, + 'paypal/debug' => \Mage_Paypal_Model_Resource_Debug::class, + 'paypal/debug_collection' => \Mage_Paypal_Model_Resource_Debug_Collection::class, 'paypal/setup' => \Mage_Paypal_Model_Resource_Setup::class, 'persistent/session' => \Mage_Persistent_Model_Resource_Session::class, 'productalert/abstract' => \Mage_ProductAlert_Model_Resource_Abstract::class, diff --git a/app/code/core/Mage/Adminhtml/Helper/Help/Mapping.php b/app/code/core/Mage/Adminhtml/Helper/Help/Mapping.php index 5ae2342ae02..84a0f1e6e69 100644 --- a/app/code/core/Mage/Adminhtml/Helper/Help/Mapping.php +++ b/app/code/core/Mage/Adminhtml/Helper/Help/Mapping.php @@ -32,7 +32,6 @@ abstract class Mage_Adminhtml_Helper_Help_Mapping extends Mage_Core_Helper_Abstr 'sales_creditmemo' => 'order-processing/credit-refunds.html', 'sales_transactions' => 'order-processing/sales-transactions.html', 'sales_recurring_profile' => 'catalog/product-recurring-profile.html', - 'sales_billing_agreement' => 'payment/paypal-billing-agreements.html', 'checkout_agreement' => 'order-processing/terms-conditions.html', /* Sales → Tax */ 'tax_rule' => 'tax/tax-rules.html', @@ -174,9 +173,6 @@ abstract class Mage_Adminhtml_Helper_Help_Mapping extends Mage_Core_Helper_Abstr 'Mage_Widget_Adminhtml' => [ 'widget_instance' => 'cms/widgets.html', ], - 'Mage_Paypal_Adminhtml' => [ - 'paypal_reports' => 'store-operations/reports-available.html', - ], 'Mage_Api2_Adminhtml' => [ 'api2_attribute' => 'system-operations/web-services.html', ], diff --git a/app/code/core/Mage/Core/Model/Config.php b/app/code/core/Mage/Core/Model/Config.php index 5e1090bcae4..ed647fd76a0 100644 --- a/app/code/core/Mage/Core/Model/Config.php +++ b/app/code/core/Mage/Core/Model/Config.php @@ -56,7 +56,6 @@ class Mage_Core_Model_Config extends Mage_Core_Model_Config_Base 'Mage_Tax' => 38, 'Mage_Wishlist' => 39, 'Mage_Media' => 40, - 'Mage_PaypalUk' => 41, 'Mage_Contacts' => 42, 'Mage_GiftMessage' => 43, 'Mage_Sendfriend' => 44, diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.3-0.7.4.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.3-0.7.4.php index be2ee4b292f..2d5d8fb0361 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.3-0.7.4.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.3-0.7.4.php @@ -14,8 +14,7 @@ $rows = $installer->getConnection()->fetchAll( "select * from {$this->getTable('core_config_data')} where path in ( - 'paypal/wpp/api_password', 'paypal/wpp/api_signature', 'paypal/wpp/api_username', - 'paypal/wps/business_account', 'paypal/wpuk/user', 'paypal/wpuk/pwd', 'carriers/dhl/id', + 'payment/paypal/client_secret', 'carriers/dhl/id', 'carriers/dhl/password', 'carriers/dhl/shipping_key', 'carriers/dhl/shipping_intlkey', 'carriers/fedex/account', 'carriers/ups/account_license_number', 'carriers/ups/username', 'carriers/usps/userid', 'payment/authorizenet/login', 'payment/authorizenet/trans_key', diff --git a/app/code/core/Mage/Paypal/Block/Adminhtml/Debug.php b/app/code/core/Mage/Paypal/Block/Adminhtml/Debug.php new file mode 100644 index 00000000000..4f8fd3927db --- /dev/null +++ b/app/code/core/Mage/Paypal/Block/Adminhtml/Debug.php @@ -0,0 +1,41 @@ +_blockGroup = 'paypal'; + $this->_controller = 'adminhtml_debug'; + $this->_headerText = Mage::helper('paypal')->__('PayPal Debug Log'); + parent::__construct(); + $this->_removeButton('add'); + + $this->_addButton('delete_all', [ + 'label' => Mage::helper('paypal')->__('Delete All Logs'), + 'onclick' => 'deleteConfirm(\'' . + Mage::helper('paypal')->__('Are you sure you want to delete all debug logs?') . + '\', \'' . $this->getUrl('*/*/deleteAll') . '\')', + 'class' => 'delete', + ]); + } +} diff --git a/app/code/core/Mage/Paypal/Block/Adminhtml/Debug/Grid.php b/app/code/core/Mage/Paypal/Block/Adminhtml/Debug/Grid.php new file mode 100644 index 00000000000..c84ed539990 --- /dev/null +++ b/app/code/core/Mage/Paypal/Block/Adminhtml/Debug/Grid.php @@ -0,0 +1,121 @@ +setId('paypalDebugGrid'); + $this->setDefaultSort('created_at'); + $this->setDefaultDir('DESC'); + $this->setSaveParametersInSession(true); + } + + /** + * Prepare collection + * + * @return $this + */ + protected function _prepareCollection(): self + { + $collection = Mage::getModel('paypal/debug')->getCollection(); + $this->setCollection($collection); + return parent::_prepareCollection(); + } + + /** + * Prepare columns + * + * @return $this + */ + protected function _prepareColumns(): self + { + $this->addColumn('entity_id', [ + 'header' => Mage::helper('paypal')->__('ID'), + 'index' => 'entity_id', + 'type' => 'number', + ]); + + $this->addColumn('quote_id', [ + 'header' => Mage::helper('paypal')->__('Quote #'), + 'index' => 'quote_id', + 'type' => 'number', + ]); + + $this->addColumn('increment_id', [ + 'header' => Mage::helper('paypal')->__('Order #'), + 'index' => 'increment_id', + 'renderer' => 'paypal/adminhtml_grid_renderer_order', + ]); + + $this->addColumn('action', [ + 'header' => Mage::helper('paypal')->__('Action'), + 'index' => 'action', + ]); + + $this->addColumn('transaction_id', [ + 'header' => Mage::helper('paypal')->__('Transaction ID'), + 'index' => 'transaction_id', + ]); + + $this->addColumn('request_body', [ + 'header' => Mage::helper('paypal')->__('Request'), + 'index' => 'request_body', + 'renderer' => 'paypal/adminhtml_debug_grid_renderer_request', + 'width' => '700px', + ]); + + $this->addColumn('response_body', [ + 'header' => Mage::helper('paypal')->__('Response'), + 'index' => 'response_body', + 'renderer' => 'paypal/adminhtml_debug_grid_renderer_response', + 'width' => '700px', + ]); + + $this->addColumn('exception_message', [ + 'header' => Mage::helper('paypal')->__('Exception'), + 'index' => 'exception_message', + 'renderer' => 'paypal/adminhtml_debug_grid_renderer_message', + ]); + + $this->addColumn('created_at', [ + 'header' => Mage::helper('paypal')->__('Created At'), + 'index' => 'created_at', + 'type' => 'datetime', + ]); + + return parent::_prepareColumns(); + } + + /** + * Prepare massaction + * + * @return $this + */ + protected function _prepareMassaction(): self + { + $this->setMassactionIdField('entity_id'); + $this->getMassactionBlock()->setFormFieldName('debug'); + + $this->getMassactionBlock()->addItem('delete', [ + 'label' => Mage::helper('paypal')->__('Delete'), + 'url' => $this->getUrl('*/*/massDelete'), + 'confirm' => Mage::helper('paypal')->__('Are you sure?'), + ]); + + return $this; + } +} diff --git a/app/code/core/Mage/Paypal/Block/Adminhtml/Debug/Grid/Renderer/Message.php b/app/code/core/Mage/Paypal/Block/Adminhtml/Debug/Grid/Renderer/Message.php new file mode 100644 index 00000000000..93149729798 --- /dev/null +++ b/app/code/core/Mage/Paypal/Block/Adminhtml/Debug/Grid/Renderer/Message.php @@ -0,0 +1,32 @@ +getData($this->getColumn()->getIndex()); + + if (empty($value)) { + return ''; + } + + $escapedValue = $this->escapeHtml($value); + + return '' . $escapedValue . ''; + } +} diff --git a/app/code/core/Mage/Paypal/Block/Adminhtml/Debug/Grid/Renderer/Request.php b/app/code/core/Mage/Paypal/Block/Adminhtml/Debug/Grid/Renderer/Request.php new file mode 100644 index 00000000000..17b418430b0 --- /dev/null +++ b/app/code/core/Mage/Paypal/Block/Adminhtml/Debug/Grid/Renderer/Request.php @@ -0,0 +1,33 @@ +getData($this->getColumn()->getIndex()); + + if (empty($value)) { + return ''; + } + + $formattedValue = $this->_formatJson($value); + $rawValue = $this->escapeHtml($value); + + return '
' . $formattedValue . '
'; + } +} diff --git a/app/code/core/Mage/Paypal/Block/Adminhtml/Debug/Grid/Renderer/Response.php b/app/code/core/Mage/Paypal/Block/Adminhtml/Debug/Grid/Renderer/Response.php new file mode 100644 index 00000000000..d35b4f5c60d --- /dev/null +++ b/app/code/core/Mage/Paypal/Block/Adminhtml/Debug/Grid/Renderer/Response.php @@ -0,0 +1,33 @@ +getData($this->getColumn()->getIndex()); + + if (empty($value)) { + return ''; + } + + $formattedValue = $this->_formatJson($value); + $rawValue = $this->escapeHtml($value); + + return '
' . $formattedValue . '
'; + } +} diff --git a/app/code/core/Mage/Paypal/Block/Adminhtml/Grid/Renderer/Json.php b/app/code/core/Mage/Paypal/Block/Adminhtml/Grid/Renderer/Json.php new file mode 100644 index 00000000000..fd2575acae2 --- /dev/null +++ b/app/code/core/Mage/Paypal/Block/Adminhtml/Grid/Renderer/Json.php @@ -0,0 +1,49 @@ +jsonDecode($json); + + $formattedJson = json_encode( + $data, + JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE, + ); + + return sprintf( + '
%s
', + $this->escapeHtml($formattedJson), + ); + } catch (Exception) { + return $this->escapeHtml($json); + } + } + + /** + * Render cell content + */ + public function render(Varien_Object $row): string + { + return $this->_formatJson($row->getData($this->getColumn()->getIndex())); + } +} diff --git a/app/code/core/Mage/Paypal/Block/Adminhtml/Grid/Renderer/Order.php b/app/code/core/Mage/Paypal/Block/Adminhtml/Grid/Renderer/Order.php new file mode 100644 index 00000000000..689a4f34605 --- /dev/null +++ b/app/code/core/Mage/Paypal/Block/Adminhtml/Grid/Renderer/Order.php @@ -0,0 +1,37 @@ +getData($this->getColumn()->getIndex()); + + if (empty($incrementId)) { + return ''; + } + + $order = Mage::getModel('sales/order')->loadByIncrementId($incrementId); + + if (!$order->getId()) { + return $this->escapeHtml($incrementId); + } + + return sprintf( + '%s', + $this->getUrl('*/sales_order/view', ['order_id' => $order->getId()]), + $this->escapeHtml($incrementId), + ); + } +} diff --git a/app/code/core/Mage/Paypal/Block/Adminhtml/Info.php b/app/code/core/Mage/Paypal/Block/Adminhtml/Info.php new file mode 100644 index 00000000000..2eb2da9ce62 --- /dev/null +++ b/app/code/core/Mage/Paypal/Block/Adminhtml/Info.php @@ -0,0 +1,85 @@ +setTemplate('paypal/info.phtml'); + } + + /** + * Retrieves the transaction ID from the payment information. + */ + public function getTransactionId(): ?string + { + return $this->getInfo()->getLastTransId(); + } + + /** + * Generates the PayPal transaction URL based on the transaction ID and sandbox status. + */ + public function getTransactionUrl(): ?string + { + $transactionId = $this->getTransactionId(); + if (!$transactionId) { + return null; + } + + $isSandbox = Mage::getSingleton('paypal/config')->isSandbox(); + return Mage::helper('paypal')->getTransactionUrl($transactionId, $isSandbox); + } + + /** + * Retrieves and formats additional payment information, such as status and authorization details. + */ + public function getPaymentInfo(): array + { + $payment = $this->getInfo(); + $info = []; + if ($payment->getAdditionalInformation(Mage_Paypal_Model_Transaction::PAYPAL_PAYMENT_STATUS)) { + $info[Mage::helper('paypal')->__('Status')] = + $payment->getAdditionalInformation(Mage_Paypal_Model_Transaction::PAYPAL_PAYMENT_STATUS); + } + if ($payment->getAdditionalInformation(Mage_Paypal_Model_Transaction::PAYPAL_PAYMENT_AUTHORIZATION_ID)) { + $info[Mage::helper('paypal')->__('Authorization ID')] = + $payment->getAdditionalInformation(Mage_Paypal_Model_Transaction::PAYPAL_PAYMENT_AUTHORIZATION_ID); + if ($payment->getAdditionalInformation(Mage_Paypal_Model_Transaction::PAYPAL_PAYMENT_AUTHORIZATION_EXPIRATION_TIME)) { + $expirationTime = + $payment->getAdditionalInformation(Mage_Paypal_Model_Transaction::PAYPAL_PAYMENT_AUTHORIZATION_EXPIRATION_TIME); + $info[Mage::helper('paypal')->__('Authorization Expires')] = $this->formatExpirationDate($expirationTime); + } + } + + return $info; + } + + /** + * Formats a given UTC expiration timestamp to the store's local timezone. + * + * @param string $expirationTime The expiration timestamp in UTC. + * @return string The formatted date and time string. + */ + protected function formatExpirationDate(string $expirationTime): string + { + $storeTimezone = Mage::app()->getStore()->getConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_TIMEZONE); + $date = new DateTime($expirationTime, new DateTimeZone('UTC')); + $date->setTimezone(new DateTimeZone($storeTimezone)); + return $date->format('Y-m-d H:i:s'); + } +} diff --git a/app/code/core/Mage/Paypal/Block/Adminhtml/Settlement/Details.php b/app/code/core/Mage/Paypal/Block/Adminhtml/Settlement/Details.php deleted file mode 100644 index b0e766ce322..00000000000 --- a/app/code/core/Mage/Paypal/Block/Adminhtml/Settlement/Details.php +++ /dev/null @@ -1,41 +0,0 @@ -_controller = ''; - $this->_headerText = Mage::helper('paypal')->__('View Transaction Details'); - $this->_removeButton('reset') - ->_removeButton('delete') - ->_removeButton('save'); - } - - /** - * Initialize form - * @return $this - */ - protected function _prepareLayout() - { - parent::_prepareLayout(); - $this->setChild('form', $this->getLayout()->createBlock('paypal/adminhtml_settlement_details_form')); - return $this; - } -} diff --git a/app/code/core/Mage/Paypal/Block/Adminhtml/Settlement/Details/Form.php b/app/code/core/Mage/Paypal/Block/Adminhtml/Settlement/Details/Form.php deleted file mode 100644 index a9f011b1e3c..00000000000 --- a/app/code/core/Mage/Paypal/Block/Adminhtml/Settlement/Details/Form.php +++ /dev/null @@ -1,104 +0,0 @@ - [ - 'fields' => [ - 'transaction_id' => ['label' => $settlement->getFieldLabel('transaction_id')], - 'invoice_id' => ['label' => $settlement->getFieldLabel('invoice_id')], - 'paypal_reference_id' => ['label' => $settlement->getFieldLabel('paypal_reference_id')], - 'paypal_reference_id_type' => [ - 'label' => $settlement->getFieldLabel('paypal_reference_id_type'), - 'value' => $model->getReferenceType($model->getData('paypal_reference_id_type')), - ], - 'custom_field' => ['label' => $settlement->getFieldLabel('custom_field')], - ], - 'legend' => Mage::helper('paypal')->__('Reference Information'), - ], - - 'transaction_fieldset' => [ - 'fields' => [ - 'transaction_event_code' => [ - 'label' => $settlement->getFieldLabel('transaction_event_code'), - 'value' => sprintf('%s (%s)', $model->getData('transaction_event_code'), $model->getTransactionEvent($model->getData('transaction_event_code'))), - ], - 'transaction_initiation_date' => [ - 'label' => $settlement->getFieldLabel('transaction_initiation_date'), - 'value' => $this->formatDate($model->getData('transaction_initiation_date'), Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true), - ], - 'transaction_completion_date' => [ - 'label' => $settlement->getFieldLabel('transaction_completion_date'), - 'value' => $this->formatDate($model->getData('transaction_completion_date'), Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true), - ], - 'transaction_debit_or_credit' => [ - 'label' => $settlement->getFieldLabel('transaction_debit_or_credit'), - 'value' => $model->getDebitCreditText($model->getData('transaction_debit_or_credit')), - ], - 'gross_transaction_amount' => [ - 'label' => $settlement->getFieldLabel('gross_transaction_amount'), - 'value' => Mage::app()->getLocale() - ->currency($model->getData('gross_transaction_currency')) - ->toCurrency($model->getData('gross_transaction_amount')), - ], - ], - 'legend' => Mage::helper('paypal')->__('Transaction Information'), - ], - - 'fee_fieldset' => [ - 'fields' => [ - 'fee_debit_or_credit' => [ - 'label' => $settlement->getFieldLabel('fee_debit_or_credit'), - 'value' => $model->getDebitCreditText($model->getData('fee_debit_or_credit')), - ], - 'fee_amount' => [ - 'label' => $settlement->getFieldLabel('fee_amount'), - 'value' => Mage::app()->getLocale() - ->currency($model->getData('fee_currency')) - ->toCurrency($model->getData('fee_amount')), - ], - ], - 'legend' => Mage::helper('paypal')->__('PayPal Fee Information'), - ], - ]; - - $form = new Varien_Data_Form(); - foreach ($fieldsets as $key => $data) { - $fieldset = $form->addFieldset($key, ['legend' => $data['legend']]); - foreach ($data['fields'] as $id => $info) { - $fieldset->addField($id, 'label', [ - 'name' => $id, - 'label' => $info['label'], - 'title' => $info['label'], - 'value' => $info['value'] ?? $model->getData($id), - ]); - } - } - $this->setForm($form); - return parent::_prepareForm(); - } -} diff --git a/app/code/core/Mage/Paypal/Block/Adminhtml/Settlement/Report.php b/app/code/core/Mage/Paypal/Block/Adminhtml/Settlement/Report.php deleted file mode 100644 index 1d7e8abf4f4..00000000000 --- a/app/code/core/Mage/Paypal/Block/Adminhtml/Settlement/Report.php +++ /dev/null @@ -1,42 +0,0 @@ -_blockGroup = 'paypal'; - $this->_controller = 'adminhtml_settlement_report'; - $this->_headerText = Mage::helper('paypal')->__('PayPal Settlement Reports'); - parent::__construct(); - $this->_removeButton('add'); - $this->_addButton('fetch', [ - 'label' => Mage::helper('paypal')->__('Fetch Updates'), - 'onclick' => Mage::helper('core/js')->getConfirmSetLocationJs( - $this->getUrl('*/*/fetch'), - Mage::helper('paypal')->__('Connecting to PayPal SFTP server to fetch new reports. Are you sure you want to proceed?'), - ), - 'class' => 'task', - ]); - } - - /** - * @return string - */ - public function getHeaderCssClass() - { - return 'icon-head head-report'; - } -} diff --git a/app/code/core/Mage/Paypal/Block/Adminhtml/Settlement/Report/Grid.php b/app/code/core/Mage/Paypal/Block/Adminhtml/Settlement/Report/Grid.php deleted file mode 100644 index 5fe8de933df..00000000000 --- a/app/code/core/Mage/Paypal/Block/Adminhtml/Settlement/Report/Grid.php +++ /dev/null @@ -1,123 +0,0 @@ -setId('settlementGrid'); - $this->setUseAjax(true); - } - - /** - * @inheritDoc - */ - protected function _prepareCollection() - { - $collection = Mage::getResourceModel('paypal/report_settlement_row_collection'); - $this->setCollection($collection); - if (!$this->getParam($this->getVarNameSort())) { - $collection->setOrder('row_id', 'desc'); - } - return parent::_prepareCollection(); - } - - /** - * @inheritDoc - */ - protected function _prepareColumns() - { - $settlement = Mage::getSingleton('paypal/report_settlement'); - $this->addColumn('report_date', [ - 'header' => $settlement->getFieldLabel('report_date'), - 'index' => 'report_date', - 'type' => 'date', - ]); - $this->addColumn('account_id', [ - 'header' => $settlement->getFieldLabel('account_id'), - 'index' => 'account_id', - ]); - $this->addColumn('transaction_id', [ - 'header' => $settlement->getFieldLabel('transaction_id'), - 'index' => 'transaction_id', - ]); - $this->addColumn('invoice_id', [ - 'header' => $settlement->getFieldLabel('invoice_id'), - 'index' => 'invoice_id', - ]); - $this->addColumn('paypal_reference_id', [ - 'header' => $settlement->getFieldLabel('paypal_reference_id'), - 'index' => 'paypal_reference_id', - ]); - $this->addColumn('transaction_event_code', [ - 'header' => $settlement->getFieldLabel('transaction_event'), - 'index' => 'transaction_event_code', - 'type' => 'options', - 'options' => Mage::getModel('paypal/report_settlement_row')->getTransactionEvents(), - ]); - $this->addColumn('transaction_initiation_date', [ - 'header' => $settlement->getFieldLabel('transaction_initiation_date'), - 'index' => 'transaction_initiation_date', - 'type' => 'datetime', - ]); - $this->addColumn('transaction_completion_date', [ - 'header' => $settlement->getFieldLabel('transaction_completion_date'), - 'index' => 'transaction_completion_date', - 'type' => 'datetime', - ]); - $this->addColumn('gross_transaction_amount', [ - 'header' => $settlement->getFieldLabel('gross_transaction_amount'), - 'index' => 'gross_transaction_amount', - 'type' => 'currency', - 'currency' => 'gross_transaction_currency', - ]); - $this->addColumn('fee_amount', [ - 'header' => $settlement->getFieldLabel('fee_amount'), - 'index' => 'fee_amount', - 'type' => 'currency', - 'currency' => 'gross_transaction_currency', - ]); - return parent::_prepareColumns(); - } - - /** - * Return grid URL - * @return string - */ - public function getGridUrl() - { - return $this->getUrl('*/*/grid'); - } - - /** - * Return item view URL - * @return string - */ - public function getRowUrl($item) - { - return $this->getUrl('*/*/details', ['id' => $item->getId()]); - } -} diff --git a/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/ApiWizard.php b/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/ApiWizard.php deleted file mode 100644 index 9f9a2447539..00000000000 --- a/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/ApiWizard.php +++ /dev/null @@ -1,92 +0,0 @@ -getTemplate()) { - $this->setTemplate($this->_wizardTemplate); - } - return $this; - } - - /** - * Unset some non-related element parameters - * - * @return string - */ - public function render(Varien_Data_Form_Element_Abstract $element) - { - $element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue(); - return parent::render($element); - } - - /** - * Get the button and scripts contents - * - * @return string - */ - protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) - { - $originalData = $element->getOriginalData(); - $elementHtmlId = $element->getHtmlId(); - $this->addData(array_merge( - $this->_getButtonData($elementHtmlId, $originalData), - $this->_getSandboxButtonData($elementHtmlId, $originalData), - )); - return $this->_toHtml(); - } - - /** - * Prepare button data - * - * @param string $elementHtmlId - * @param array $originalData - * @return array - */ - protected function _getButtonData($elementHtmlId, $originalData) - { - return [ - 'button_label' => Mage::helper('paypal')->__($originalData['button_label']), - 'button_url' => $originalData['button_url'], - 'html_id' => $elementHtmlId, - ]; - } - - /** - * Prepare sandbox button data - * - * @param string $elementHtmlId - * @param array $originalData - * @return array - */ - protected function _getSandboxButtonData($elementHtmlId, $originalData) - { - return [ - 'sandbox_button_label' => Mage::helper('paypal')->__($originalData['sandbox_button_label']), - 'sandbox_button_url' => $originalData['sandbox_button_url'], - 'sandbox_html_id' => 'sandbox_' . $elementHtmlId, - ]; - } -} diff --git a/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/BmlApiWizard.php b/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/BmlApiWizard.php deleted file mode 100644 index 0fa4a4bb6f6..00000000000 --- a/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/BmlApiWizard.php +++ /dev/null @@ -1,33 +0,0 @@ -getRequest()->getParam(self::REQUEST_PARAM_COUNTRY); - if ($country) { - $element->setValue($country); - } - - if ($element->getCanUseDefaultValue()) { - $defaultConfigNode = Mage::getConfig()->getNode(null, 'default'); - if ($defaultConfigNode) { - $this->_defaultCountry = (string) $defaultConfigNode->descend('paypal/general/merchant_country'); - } - if (!$this->_defaultCountry) { - $this->_defaultCountry = Mage::helper('core')->getDefaultCountry(); - } - if ($country) { - $shouldInherit = $country == $this->_defaultCountry - && $this->getRequest()->getParam(self::REQUEST_PARAM_DEFAULT); - $element->setInherit($shouldInherit); - } - if ($element->getInherit()) { - $this->_defaultCountry = null; - } - } - - return parent::render($element); - } - - /** - * Get country selector html - * - * @return string - */ - protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) - { - $configDataModel = Mage::getSingleton('adminhtml/config_data'); - $urlParams = [ - 'section' => $configDataModel->getSection(), - 'website' => $configDataModel->getWebsite(), - 'store' => $configDataModel->getStore(), - self::REQUEST_PARAM_COUNTRY => '__country__', - ]; - $urlString = $this->helper('core') - ->jsQuoteEscape(Mage::getModel('adminhtml/url')->getUrl('*/*/*', $urlParams)); - $jsString = ' - $("' . $element->getHtmlId() . '").observe("change", function () { - location.href = \'' . $urlString . '\'.replace("__country__", this.value); - }); - '; - - if ($this->_defaultCountry) { - $urlParams[self::REQUEST_PARAM_DEFAULT] = '__default__'; - $urlString = $this->helper('core') - ->jsQuoteEscape(Mage::getModel('adminhtml/url')->getUrl('*/*/*', $urlParams)); - $jsParentCountry = $this->helper('core')->jsQuoteEscape($this->_defaultCountry); - $jsString .= ' - $("' . $element->getHtmlId() . '_inherit").observe("click", function () { - if (this.checked) { - location.href = \'' . $urlString . '\'.replace("__country__", \'' . $jsParentCountry . '\') - .replace("__default__", "1"); - } - }); - '; - } - - /** @var Mage_Adminhtml_Helper_Js $helper */ - $helper = $this->helper('adminhtml/js'); - return parent::_getElementHtml($element) . - $helper->getScript('document.observe("dom:loaded", function() {' . $jsString . '});'); - } -} diff --git a/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Field/Hidden.php b/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Field/Hidden.php deleted file mode 100644 index 203c29bfb72..00000000000 --- a/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Field/Hidden.php +++ /dev/null @@ -1,28 +0,0 @@ -getHtmlId() . '" style="display: none;">' . $html . ''; - } -} diff --git a/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Field/SolutionType.php b/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Field/SolutionType.php deleted file mode 100644 index 8a0c1629e9e..00000000000 --- a/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Field/SolutionType.php +++ /dev/null @@ -1,31 +0,0 @@ -getConfigurationCountryCode(); - if ($countryCode === 'DE') { - /** @var Mage_Paypal_Block_Adminhtml_System_Config_Field_Hidden $block */ - $block = Mage::getBlockSingleton('paypal/adminhtml_System_config_field_hidden'); - return $block->render($element); - } - - return parent::render($element); - } -} diff --git a/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Deprecated.php b/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Deprecated.php deleted file mode 100644 index c759a813807..00000000000 --- a/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Deprecated.php +++ /dev/null @@ -1,120 +0,0 @@ -getGroup($element)->asArray(); - return $groupConfig['was_enabled_path'] ?? ''; - } - - /** - * Check whether solution was enabled - * - * @return bool - */ - protected function _wasActive(Varien_Data_Form_Element_Abstract $element) - { - $wasActiveConfigPath = $this->_getWasActiveConfigPath($element); - return empty($wasActiveConfigPath) - ? false - : (bool) (string) $this->_getConfigDataModel()->getConfigDataValue($wasActiveConfigPath); - } - - /** - * Set solution as was enabled - * - * @return $this - */ - protected function _setWasActive(Varien_Data_Form_Element_Abstract $element) - { - $wasActiveConfigPath = $this->_getWasActiveConfigPath($element); - Mage::getConfig()->saveConfig($wasActiveConfigPath, 1); - return $this; - } - - /** - * Get config data model - * - * @return Mage_Core_Model_Config - */ - protected function _getConfigModel() - { - if (!$this->hasConfigModel()) { - $this->setConfigModel(Mage::getConfig()); - } - - return $this->getConfigModel(); - } - - /** - * Get all websites - * - * @return array - */ - protected function _getWebsites() - { - if (!$this->hasWebsites()) { - $this->setWebsites(Mage::app()->getWebsites()); - } - - return $this->getWebsites(); - } - - /** - * Check whether current payment method is enabled on any scope - * - * @param string $activityPath - * @return bool - */ - public function isPaymentEnabledAnyScope($activityPath) - { - if ((bool) (string) $this->_getConfigModel()->getNode($activityPath, 'default')) { - return true; - } - foreach ($this->_getWebsites() as $website) { - if ((bool) (string) $this->_getConfigModel()->getNode($activityPath, 'website', (int) $website->getId())) { - return true; - } - } - - return false; - } - - /** - * Do not render solution if disabled - * - * @return string - */ - public function render(Varien_Data_Form_Element_Abstract $element) - { - $isPaymentEnabled = $this->_isPaymentEnabled($element, [$this, 'isPaymentEnabledAnyScope']); - if ($this->_wasActive($element) && $isPaymentEnabled) { - return parent::render($element); - } - - if ($isPaymentEnabled) { - $this->_setWasActive($element); - return parent::render($element); - } - - return ''; - } -} diff --git a/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Expanded.php b/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Expanded.php deleted file mode 100644 index ad9680f7ca2..00000000000 --- a/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Expanded.php +++ /dev/null @@ -1,28 +0,0 @@ -getUser()->getExtra(); - return $extra['configState'][$element->getId()] ?? true; - } -} diff --git a/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Global.php b/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Global.php deleted file mode 100644 index c2d0c00492d..00000000000 --- a/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Global.php +++ /dev/null @@ -1,211 +0,0 @@ -getSortedElements() as $element) { - $htmlId = $element->getHtmlId(); - $this->_elements[$htmlId] = $element; - } - $originalData = $fieldset->getOriginalData(); - $this->addData([ - 'fieldset_label' => $fieldset->getLegend(), - 'fieldset_help_url' => $originalData['help_url'] ?? '', - ]); - return $this->toHtml(); - } - - /** - * Get array of element objects - * - * @return array - */ - public function getElements() - { - return $this->_elements; - } - - /** - * Get element by id - * - * @param string $elementId - * @return Varien_Data_Form_Element_Abstract|false - */ - public function getElement($elementId) - { - return $this->_elements[$elementId] ?? false; - } - - /** - * Return checkbox html with hidden field for correct config values - * - * @return string - */ - public function getElementHtml(Varien_Data_Form_Element_Abstract $element) - { - $configValue = (string) $element->getValue(); - if ($configValue) { - $element->setChecked(true); - } else { - $element->setValue('1'); - } - if ($element->getCanUseDefaultValue() && $element->getInherit()) { - $element->setDisabled(true); - } - - $hidden = new Varien_Data_Form_Element_Hidden([ - 'html_id' => $element->getHtmlId() . '_value', - 'name' => $element->getName(), - 'value' => '0', - ]); - $hidden->setForm($element->getForm()); - return $hidden->getElementHtml() . $element->getElementHtml(); - } - - /** - * Whether element should be rendered in "simplified" mode - * - * @return bool - */ - public function getIsElementSimplified(Varien_Data_Form_Element_Abstract $element) - { - $originalData = $element->getOriginalData(); - return isset($originalData['is_simplified']) && $originalData['is_simplified'] == 1; - } - - /** - * Getter for element label - * - * @return string - */ - public function getElementLabel(Varien_Data_Form_Element_Abstract $element) - { - return $element->getLabel(); - } - - /** - * Getter for element comment - * - * @return string - */ - public function getElementComment(Varien_Data_Form_Element_Abstract $element) - { - return $element->getComment(); - } - - /** - * Getter for element comment - * - * @return string - */ - public function getElementOriginalData(Varien_Data_Form_Element_Abstract $element, $key) - { - $data = $element->getOriginalData(); - return $data[$key] ?? ''; - } - - /** - * Check whether checkbox has "Use default" option or not - * - * @return bool - */ - public function hasInheritElement(Varien_Data_Form_Element_Abstract $element) - { - return (bool) $element->getCanUseDefaultValue(); - } - - /** - * Return "Use default" checkbox html - * - * @return string - */ - public function getInheritElementHtml(Varien_Data_Form_Element_Abstract $element) - { - $elementId = $element->getHtmlId(); - $inheritCheckbox = new Varien_Data_Form_Element_Checkbox([ - 'html_id' => $elementId . '_inherit', - 'name' => preg_replace('/\[value\](\[\])?$/', '[inherit]', $element->getName()), - 'value' => '1', - 'class' => 'checkbox config-inherit', - 'onclick' => 'toggleValueElements(this, $(\'' . $elementId . '\').up())', - ]); - if ($element->getInherit()) { - $inheritCheckbox->setChecked(true); - } - - $inheritCheckbox->setForm($element->getForm()); - return $inheritCheckbox->getElementHtml(); - } - - /** - * Return label for "Use default" checkbox - * - * @return string - */ - public function getInheritElementLabelHtml(Varien_Data_Form_Element_Abstract $element) - { - return sprintf( - '', - $element->getHtmlId() . '_inherit', - $element->getDefaultValue(), - Mage::helper('adminhtml')->__('Use Default'), - ); - } - - /** - * Return element label with tag SPAN - * - * @return string - */ - public function getElementLabelTextHtml(Varien_Data_Form_Element_Abstract $element) - { - return sprintf( - '%s', - $element->getHtmlId() . '_label_text', - $this->escapeHtml($this->getElementLabel($element)), - ); - } - - /** - * Return backend config for element like JSON - * - * @return string - */ - public function getElementBackendConfig(Varien_Data_Form_Element_Abstract $element) - { - return Mage::helper('paypal')->getElementBackendConfig($element); - } -} diff --git a/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Group.php b/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Group.php deleted file mode 100644 index d6f455fb730..00000000000 --- a/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Group.php +++ /dev/null @@ -1,55 +0,0 @@ -getGroup($element)->asArray(); - - if (empty($groupConfig['help_url']) || !$element->getComment()) { - return parent::_getHeaderCommentHtml($element); - } - - return '
' . $element->getComment() - . ' ' - . Mage::helper('paypal')->__('Help') . '
'; - } - - /** - * Return collapse state - * - * @param Varien_Data_Form_Element_Abstract $element - * @return int|false - */ - protected function _getCollapseState($element) - { - $extra = Mage::getSingleton('admin/session')->getUser()->getExtra(); - if (isset($extra['configState'][$element->getId()])) { - return $extra['configState'][$element->getId()]; - } - - if ($element->getExpanded() !== null) { - return 1; - } - - return false; - } -} diff --git a/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Hint.php b/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Hint.php deleted file mode 100644 index 13029bdc035..00000000000 --- a/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Hint.php +++ /dev/null @@ -1,80 +0,0 @@ -getOriginalData(); - if (isset($elementOriginalData['help_link'])) { - $this->setHelpLink($elementOriginalData['help_link']); - } - $js = ' - paypalToggleSolution = function(id, url) { - var doScroll = false; - Fieldset.toggleCollapse(id, url); - if ($(this).hasClassName("open")) { - $$(".with-button button.button").each(function(anotherButton) { - if (anotherButton != this && $(anotherButton).hasClassName("open")) { - $(anotherButton).click(); - doScroll = true; - } - }.bind(this)); - } - if (doScroll) { - var pos = Element.cumulativeOffset($(this)); - window.scrollTo(pos[0], pos[1] - 45); - } - } - - togglePaypalSolutionConfigureButton = function(button, enable) { - var $button = $(button); - $button.disabled = !enable; - if ($button.hasClassName("disabled") && enable) { - $button.removeClassName("disabled"); - } else if (!$button.hasClassName("disabled") && !enable) { - $button.addClassName("disabled"); - } - } - - // check store-view disabling Express Checkout - document.observe("dom:loaded", function() { - var ecButton = $$(".pp-method-express button.button")[0]; - var ecEnabler = $$(".paypal-ec-enabler")[0]; - if (typeof ecButton == "undefined" || typeof ecEnabler != "undefined") { - return; - } - var $ecButton = $(ecButton); - $$(".with-button button.button").each(function(configureButton) { - if (configureButton != ecButton && !configureButton.disabled - && !$(configureButton).hasClassName("paypal-ec-separate") - ) { - togglePaypalSolutionConfigureButton(ecButton, false); - } - }); - }); - '; - - /** @var Mage_Adminhtml_Helper_Js $helper */ - $helper = $this->helper('adminhtml/js'); - return $this->toHtml() . $helper->getScript($js); - } -} diff --git a/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Location.php b/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Location.php deleted file mode 100644 index 923d198f149..00000000000 --- a/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Location.php +++ /dev/null @@ -1,368 +0,0 @@ -helper('core')->jsQuoteEscape($this->__('There is already another PayPal solution enabled. Enable this solution instead?')) . '\'); - } else { - paypalConflictsObject.isConflict = true; - } - confirmationShowed = true; - } - if (conflict && confirmationApproved) { - anotherEnabler.value = 0; - if (anotherEnablerScopeElement && anotherEnablerScopeElement.checked && isEvent) { - paypalConflictsObject.checklessEventAction(anotherEnablerScopeElement, false); - } - paypalConflictsObject.checklessEventAction(anotherEnabler, true); - } - }); - - if (!enabler.enablerObject.ecIndependent) { - if (!isEvent && (typeof ecEnabler == "undefined" || ecEnabler.value == 0)) { - if (!enabler.enablerObject.ecPayflow) { - paypalConflictsObject.ecMissed = true; - } - } else if (isEvent && typeof ecEnabler != "undefined" && confirmationApproved) { - var ecEnablerScopeElement = adminSystemConfig.getScopeElement(ecEnabler); - if (ecEnablerScopeElement && ecEnablerScopeElement.checked) { - paypalConflictsObject.checklessEventAction(ecEnablerScopeElement, false); - } - if (ecEnabler.value == 0) { - ecEnabler.value = 1; - paypalConflictsObject.checklessEventAction(ecEnabler, true); - } - } - } - - if (!confirmationApproved && isEvent) { - enabler.value = 0; - paypalConflictsObject.checklessEventAction(enabler, true); - } - paypalConflictsObject.ecCheckAvailability(); - paypalConflictsObject.sharePayflowEnabling(enabler, isEvent); - }, - - handleBmlEnabler: function(event) { - required = Event.element(event); - var bml = $(required).bmlEnabler; - if (required.value == "1") { - bml.value = "1"; - } - paypalConflictsObject.toggleBmlEnabler(required); - }, - - toggleBmlEnabler: function(required) { - var bml = $(required).bmlEnabler; - if (!bml) { - return; - } - if (required.value != "1") { - bml.value = "0"; - $(bml).disable(); - } - $(bml).requiresObj.indicateEnabled(); - } - }; - - // fill enablers with conflict data - $$(".paypal-enabler").each(function(enablerElement) { - var enablerObj = { - ecIndependent: false, - ecConflicts: false, - ecEnabler: false, - ecSeparate: false, - ecPayflow: false - }; - $(enablerElement).classNames().each(function(className) { - switch (className) { - case "paypal-ec-conflicts": - enablerObj.ecConflicts = true; - case "paypal-ec-independent": - enablerObj.ecIndependent = true; - break; - case "paypal-ec-enabler": - enablerObj.ecEnabler = true; - enablerObj.ecIndependent = true; - break; - case "paypal-ec-separate": - enablerObj.ecSeparate = true; - enablerObj.ecIndependent = true; - break; - case "paypal-ec-pe": - enablerObj.ecPayflow = true; - break; - } - }); - enablerElement.enablerObject = enablerObj; - - Event.observe(enablerElement, "change", paypalConflictsObject.onChangeEnabler); - var enablerScopeElement = adminSystemConfig.getScopeElement(enablerElement); - if (enablerScopeElement) { - Event.observe(enablerScopeElement, "click", paypalConflictsObject.onClickEnablerScope); - } - }); - - // initially uncheck payflow - var ecPayflowEnabler = $$(".paypal-ec-payflow-enabler")[0]; - if (typeof ecPayflowEnabler != "undefined") { - if (ecPayflowEnabler.value == 1) { - ecPayflowEnabler.value = 0; - fireEvent(ecPayflowEnabler, "change"); - } - - var ecPayflowScopeElement = adminSystemConfig.getScopeElement(ecPayflowEnabler); - if (ecPayflowScopeElement && !ecPayflowScopeElement.checked) { - $(ecPayflowScopeElement).click(); - } - } - - $$(".paypal-bml").each(function(bmlEnabler) { - $(bmlEnabler).classNames().each(function(className) { - if (className.indexOf("requires-") !== -1) { - var required = $(className.replace("requires-", "")); - required.bmlEnabler = bmlEnabler; - Event.observe(required, "change", paypalConflictsObject.handleBmlEnabler); - } - }); - }); - - $$(".paypal-enabler").each(function(enablerElement) { - paypalConflictsObject.checkPaymentConflicts(enablerElement, "initial"); - paypalConflictsObject.toggleBmlEnabler(enablerElement); - }); - if (paypalConflictsObject.isConflict || paypalConflictsObject.ecMissed) { - var notification = \'' . $this->helper('core')->jsQuoteEscape($this->__('The following error(s) occured:')) . '\'; - if (paypalConflictsObject.isConflict) { - notification += "\\n " + \'' . $this->helper('core')->jsQuoteEscape($this->__('Some PayPal solutions conflict.')) . '\'; - } - if (paypalConflictsObject.ecMissed) { - notification += "\\n " + \'' . $this->helper('core')->jsQuoteEscape($this->__('PayPal Express Checkout is not enabled.')) . '\'; - } - notification += "\\n" + \'' . $this->helper('core')->jsQuoteEscape($this->__('Please re-enable the previously enabled payment solutions.')) . '\'; - setTimeout(function() { - alert(notification); - }, 1); - } - - $$(".requires").each(function(dependent) { - var $dependent = $(dependent); - if ($dependent.hasClassName("paypal-ec-enabler")) { - $dependent.requiresObj.callback = function(required) { - if ($(required).hasClassName("paypal-enabler") && required.value == 0) { - $dependent.disable(); - } - } - $dependent.requiresObj.requires.each(function(required) { - $dependent.requiresObj.callback(required); - }); - } - }); - - var originalFormValidation = configForm.validator.options.onFormValidate; - configForm.validator.options.onFormValidate = function(result, form) { - originalFormValidation(result, form); - if (result) { - var ecPayflowEnabler = $$(".paypal-ec-payflow-enabler")[0]; - if (typeof ecPayflowEnabler == "undefined") { - return; - } - var ecPayflowScopeElement = adminSystemConfig.getScopeElement(ecPayflowEnabler); - if ((typeof ecPayflowScopeElement == "undefined" || !ecPayflowScopeElement.checked) - && ecPayflowEnabler.value == 1 - ) { - $$(".paypal-ec-enabler").each(function(ecEnabler) { - ecEnabler.value = 0; - }); - } - } - } - }); - '; - - /** @var Mage_Adminhtml_Helper_Js $helper */ - $helper = $this->helper('adminhtml/js'); - return parent::_getExtraJs($element, $tooltipsExist) . $helper->getScript($js); - } -} diff --git a/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/PathDependent.php b/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/PathDependent.php deleted file mode 100644 index cb42fec4793..00000000000 --- a/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/PathDependent.php +++ /dev/null @@ -1,42 +0,0 @@ -_getConfigDataModel()->getConfigDataValue($activityPath); - } - - /** - * Do not render solution if disabled - * - * @return string - */ - public function render(Varien_Data_Form_Element_Abstract $element) - { - if (!$this->hasActivePathDependencies($this->getGroup($element)->asArray())) { - return parent::render($element); - } - - return ''; - } -} diff --git a/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Payment.php b/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Payment.php deleted file mode 100644 index 31e754ffe21..00000000000 --- a/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Payment.php +++ /dev/null @@ -1,125 +0,0 @@ -_isPaymentEnabled($element) ? ' enabled' : ''); - } - - /** - * Check whether current payment method is enabled - * - * @param Varien_Data_Form_Element_Abstract $element - * @param callback|null $configCallback - * @return bool - */ - protected function _isPaymentEnabled($element, $configCallback = null) - { - $groupConfig = $this->getGroup($element)->asArray(); - $activityPath = $groupConfig['activity_path'] ?? ''; - - if (empty($activityPath)) { - return false; - } - - if ($configCallback && is_callable($configCallback)) { - $isPaymentEnabled = call_user_func($configCallback, $activityPath); - } else { - $isPaymentEnabled = (bool) (string) $this->_getConfigDataModel()->getConfigDataValue($activityPath); - } - - return (bool) $isPaymentEnabled; - } - - /** - * Get config data model - * - * @return Mage_Adminhtml_Model_Config_Data - */ - protected function _getConfigDataModel() - { - if (!$this->hasConfigDataModel()) { - $this->setConfigDataModel(Mage::getSingleton('adminhtml/config_data')); - } - - return $this->getConfigDataModel(); - } - - /** - * Return header title part of html for payment solution - * - * @param Varien_Data_Form_Element_Abstract $element - * @return string - */ - protected function _getHeaderTitleHtml($element) - { - $html = '
' . $element->getLegend(); - - $groupConfig = $this->getGroup($element)->asArray(); - if (!empty($groupConfig['learn_more_link'])) { - $html .= '' - . $this->__('Learn More') . ''; - } - if (!empty($groupConfig['demo_link'])) { - $html .= '' - . $this->__('View Demo') . ''; - } - $html .= ''; - - if ($element->getComment()) { - $html .= '' . $element->getComment() . ''; - } - $html .= '
'; - - return $html . ('
'); - } - - /** - * Return header comment part of html for payment solution - * - * @param Varien_Data_Form_Element_Abstract $element - * @return string - */ - protected function _getHeaderCommentHtml($element) - { - return ''; - } - - /** - * Get collapsed state on-load - * - * @param Varien_Data_Form_Element_Abstract $element - * @return bool - */ - protected function _getCollapseState($element) - { - return false; - } -} diff --git a/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Store.php b/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Store.php deleted file mode 100644 index 11c97860177..00000000000 --- a/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Store.php +++ /dev/null @@ -1,65 +0,0 @@ -toHtml(); - } - - /** - * Returns list of disabled (in the Default or the Website Scope) paypal methods - * - * @return array - */ - protected function getPaypalDisabledMethods() - { - // Assoc array that contains info about paypal methods (their IDs and corresponding Config Paths) - $methods = [ - 'express' => 'payment/paypal_express/active', - 'wps' => 'payment/paypal_standard/active', - 'wpp' => 'payment/paypal_direct/active', - 'wpppe' => 'payment/paypaluk_direct/active', - 'verisign' => 'payment/verisign/active', - 'expresspe' => 'payment/paypaluk_express/active', - ]; - // Retrieve a code of the current website - $website = $this->getRequest()->getParam('website'); - - $configRoot = Mage::getConfig()->getNode(null, 'website', $website); - - $disabledMethods = []; - foreach ($methods as $methodId => $methodPath) { - $isEnabled = (int) $configRoot->descend($methodPath); - if ($isEnabled === 0) { - $disabledMethods[$methodId] = $isEnabled; - } - } - - return $disabledMethods; - } -} diff --git a/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Payflowlink/Advanced.php b/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Payflowlink/Advanced.php deleted file mode 100644 index 25938de5d10..00000000000 --- a/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Payflowlink/Advanced.php +++ /dev/null @@ -1,23 +0,0 @@ -getRequest()->getParam('website') || $this->getRequest()->getParam('store')) ? 5 : 4; - return $this->_decorateRowHtml($element, "" . $this->toHtml() . ''); - } - - /** - * Get frontend url - * - * @deprecated since 1.7.0.1 - * @param string $routePath - * @return string - */ - public function getFrontendUrl($routePath) - { - if ($this->getRequest()->getParam('website')) { - $website = Mage::getModel('core/website')->load($this->getRequest()->getParam('website')); - $secure = Mage::getStoreConfigFlag( - Mage_Core_Model_Url::XML_PATH_SECURE_IN_FRONT, - $website->getDefaultStore(), - ); - $path = $secure ? - Mage_Core_Model_Store::XML_PATH_SECURE_BASE_LINK_URL : - Mage_Core_Model_Store::XML_PATH_UNSECURE_BASE_LINK_URL; - $websiteUrl = Mage::getStoreConfig($path, $website->getDefaultStore()); - } else { - $secure = Mage::getStoreConfigFlag( - Mage_Core_Model_Url::XML_PATH_SECURE_IN_FRONT, - ); - $websiteUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK, $secure); - } - - return $websiteUrl . $routePath; - } -} diff --git a/app/code/core/Mage/Paypal/Block/Bml/Banners.php b/app/code/core/Mage/Paypal/Block/Bml/Banners.php deleted file mode 100644 index 1835a5a7d9c..00000000000 --- a/app/code/core/Mage/Paypal/Block/Bml/Banners.php +++ /dev/null @@ -1,75 +0,0 @@ -_section = $section; - } - - /** - * @param int $position - */ - public function setPosition($position = 0) - { - $this->_position = $position; - } - - /** - * Getter for paypal config - * - * @return Mage_Paypal_Model_Config - */ - protected function _getConfig() - { - return Mage::getSingleton('paypal/config'); - } - - /** - * Disable block output if banner turned off or PublisherId is miss - * - * @return string - */ - protected function _toHtml() - { - if (!$this->_getConfig()->isMethodAvailable(Mage_Paypal_Model_Config::METHOD_BML) - && !$this->_getConfig()->isMethodAvailable(Mage_Paypal_Model_Config::METHOD_WPP_PE_BML) - ) { - return ''; - } - $publisherId = $this->_getConfig()->getBmlPublisherId(); - $display = $this->_getConfig()->getBmlDisplay($this->_section); - $position = $this->_getConfig()->getBmlPosition($this->_section); - if (!$publisherId || $display == 0 || $this->_position != $position) { - return ''; - } - $this->setPublisherId($publisherId); - $this->setSize($this->_getConfig()->getBmlSize($this->_section)); - return parent::_toHtml(); - } -} diff --git a/app/code/core/Mage/Paypal/Block/Bml/Form.php b/app/code/core/Mage/Paypal/Block/Bml/Form.php deleted file mode 100644 index bfde70f094b..00000000000 --- a/app/code/core/Mage/Paypal/Block/Bml/Form.php +++ /dev/null @@ -1,44 +0,0 @@ -_config = Mage::getModel('paypal/config')->setMethod($this->getMethodCode()); - $mark = Mage::getConfig()->getBlockClassName('core/template'); - $mark = new $mark(); - $mark->setTemplate('paypal/payment/mark.phtml') - ->setPaymentAcceptanceMarkHref('https://www.securecheckout.billmelater.com/paycapture-content/' - . 'fetch?hash=AU826TU8&content=/bmlweb/ppwpsiw.html') - ->setPaymentAcceptanceMarkSrc('https://www.paypalobjects.com/webstatic/en_US/i/buttons/' - . 'ppc-acceptance-medium.png') - ->setPaymentWhatIs('See terms'); - $this->setTemplate('paypal/payment/redirect.phtml') - ->setRedirectMessage( - Mage::helper('paypal')->__('You will be redirected to the PayPal website.'), - ) - ->setMethodTitle('') // Output PayPal mark, omit title - ->setMethodLabelAfterHtml($mark->toHtml()); - } -} diff --git a/app/code/core/Mage/Paypal/Block/Express/Form.php b/app/code/core/Mage/Paypal/Block/Express/Form.php deleted file mode 100644 index f25a1a73803..00000000000 --- a/app/code/core/Mage/Paypal/Block/Express/Form.php +++ /dev/null @@ -1,47 +0,0 @@ -setRedirectMessage(Mage::helper('paypal')->__('You will be redirected to the PayPal website.')); - } - - /** - * Set data to block - * - * @return Mage_Core_Block_Abstract - */ - protected function _beforeToHtml() - { - $customerId = Mage::getSingleton('customer/session')->getCustomerId(); - if (Mage::helper('paypal')->shouldAskToCreateBillingAgreement($this->_config, $customerId) - && $this->canCreateBillingAgreement() - ) { - $this->setCreateBACode(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT); - } - return parent::_beforeToHtml(); - } -} diff --git a/app/code/core/Mage/Paypal/Block/Express/Review.php b/app/code/core/Mage/Paypal/Block/Express/Review.php deleted file mode 100644 index 747c1c3c08e..00000000000 --- a/app/code/core/Mage/Paypal/Block/Express/Review.php +++ /dev/null @@ -1,227 +0,0 @@ -_quote = $quote; - return $this; - } - - /** - * Return quote billing address - * - * @return Mage_Sales_Model_Quote_Address - */ - public function getBillingAddress() - { - return $this->_quote->getBillingAddress(); - } - - /** - * Return quote shipping address - * - * @return Mage_Sales_Model_Quote_Address|false - */ - public function getShippingAddress() - { - if ($this->_quote->getIsVirtual()) { - return false; - } - return $this->_quote->getShippingAddress(); - } - - /** - * Get HTML output for specified address - * - * @param Mage_Sales_Model_Quote_Address $address - * @return string - */ - public function renderAddress($address) - { - return $address->getFormated(true); - } - - /** - * Return carrier name from config, base on carrier code - * - * @param string $carrierCode - * @return string - */ - public function getCarrierName($carrierCode) - { - if ($name = Mage::getStoreConfig("carriers/{$carrierCode}/title")) { - return $name; - } - return $carrierCode; - } - - /** - * Get either shipping rate code or empty value on error - * - * @return string - */ - public function renderShippingRateValue(Varien_Object $rate) - { - if ($rate->getErrorMessage()) { - return ''; - } - return $rate->getCode(); - } - - /** - * Get shipping rate code title and its price or error message - * - * @param Varien_Object $rate - * @param string $format - * @param string $inclTaxFormat - * @return string - */ - public function renderShippingRateOption($rate, $format = '%s - %s%s', $inclTaxFormat = ' (%s %s)') - { - $renderedInclTax = ''; - if ($rate->getErrorMessage()) { - $price = $rate->getErrorMessage(); - } else { - /** @var Mage_Tax_Helper_Data $helper */ - $helper = $this->helper('tax'); - - $price = $this->_getShippingPrice($rate->getPrice(), $helper->displayShippingPriceIncludingTax()); - $incl = $this->_getShippingPrice($rate->getPrice(), true); - if (($incl != $price) && $helper->displayShippingBothPrices()) { - $renderedInclTax = sprintf($inclTaxFormat, Mage::helper('tax')->__('Incl. Tax'), $incl); - } - } - return sprintf($format, $this->escapeHtml($rate->getMethodTitle()), $price, $renderedInclTax); - } - - /** - * Getter for current shipping rate - * - * @return Mage_Sales_Model_Quote_Address_Rate - */ - public function getCurrentShippingRate() - { - return $this->_currentShippingRate; - } - - /** - * Set paypal actions prefix - * @param string $prefix - */ - public function setPaypalActionPrefix($prefix) - { - $this->_paypalActionPrefix = $prefix; - } - - /** - * Return formatted shipping price - * - * @param float $price - * @param bool $isInclTax - * @return float - */ - protected function _getShippingPrice($price, $isInclTax) - { - /** @var Mage_Tax_Helper_Data $helper */ - $helper = $this->helper('tax'); - return $helper->getShippingPrice($price, $isInclTax, $this->_address); - } - - /** - * Format price base on store convert price method - * - * @param float $price - * @return float - */ - protected function _formatPrice($price) - { - return $this->_quote->getStore()->convertPrice($price, true); - } - - /** - * Retrieve payment method and assign additional template values - * - * @return $this - */ - protected function _beforeToHtml() - { - $methodInstance = $this->_quote->getPayment()->getMethodInstance(); - $this->setPaymentMethodTitle($methodInstance->getTitle()); - - $this->setShippingRateRequired(true); - if ($this->_quote->getIsVirtual()) { - $this->setShippingRateRequired(false); - } else { - // prepare shipping rates - $this->_address = $this->_quote->getShippingAddress(); - $groups = $this->_address->getGroupedAllShippingRates(); - if ($groups && $this->_address) { - $this->setShippingRateGroups($groups); - // determine current selected code & name - foreach ($groups as $code => $rates) { - foreach ($rates as $rate) { - if ($this->_address->getShippingMethod() == $rate->getCode()) { - $this->_currentShippingRate = $rate; - break(2); - } - } - } - } - - $canEditShippingAddress = $this->_quote->getMayEditShippingAddress() && $this->_quote->getPayment() - ->getAdditionalInformation(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_BUTTON) == 1; - // misc shipping parameters - $this->setShippingMethodSubmitUrl($this->getUrl("{$this->_paypalActionPrefix}/express/saveShippingMethod")) - ->setCanEditShippingAddress($canEditShippingAddress) - ->setCanEditShippingMethod($this->_quote->getMayEditShippingMethod()) - ; - } - - $this->setEditUrl($this->getUrl("{$this->_paypalActionPrefix}/express/edit")) - ->setPlaceOrderUrl($this->getUrl("{$this->_paypalActionPrefix}/express/placeOrder")); - - return parent::_beforeToHtml(); - } -} diff --git a/app/code/core/Mage/Paypal/Block/Express/Review/Billing.php b/app/code/core/Mage/Paypal/Block/Express/Review/Billing.php deleted file mode 100644 index ea7e7086e97..00000000000 --- a/app/code/core/Mage/Paypal/Block/Express/Review/Billing.php +++ /dev/null @@ -1,43 +0,0 @@ -_address)) { - if ($this->isCustomerLoggedIn() || $this->getQuote()->getBillingAddress()) { - $this->_address = $this->getQuote()->getBillingAddress(); - if (!$this->_address->getFirstname()) { - $this->_address->setFirstname($this->getQuote()->getCustomer()->getFirstname()); - } - if (!$this->_address->getMiddlename()) { - $this->_address->setMiddlename($this->getQuote()->getCustomer()->getMiddlename()); - } - if (!$this->_address->getLastname()) { - $this->_address->setLastname($this->getQuote()->getCustomer()->getLastname()); - } - } else { - $this->_address = Mage::getModel('sales/quote_address'); - } - } - - return $this->_address; - } -} diff --git a/app/code/core/Mage/Paypal/Block/Express/Review/Details.php b/app/code/core/Mage/Paypal/Block/Express/Review/Details.php deleted file mode 100644 index 97ac738e254..00000000000 --- a/app/code/core/Mage/Paypal/Block/Express/Review/Details.php +++ /dev/null @@ -1,41 +0,0 @@ -_address)) { - $this->_address = $this->getQuote()->getShippingAddress(); - } - return $this->_address; - } - - /** - * Return review quote totals - * - * @return array - */ - public function getTotals() - { - return $this->getQuote()->getTotals(); - } -} diff --git a/app/code/core/Mage/Paypal/Block/Express/Review/Shipping.php b/app/code/core/Mage/Paypal/Block/Express/Review/Shipping.php deleted file mode 100644 index 47082eb2567..00000000000 --- a/app/code/core/Mage/Paypal/Block/Express/Review/Shipping.php +++ /dev/null @@ -1,34 +0,0 @@ -_address)) { - if ($this->isCustomerLoggedIn() || $this->getQuote()->getShippingAddress()) { - $this->_address = $this->getQuote()->getShippingAddress(); - } else { - $this->_address = Mage::getModel('sales/quote_address'); - } - } - - return $this->_address; - } -} diff --git a/app/code/core/Mage/Paypal/Block/Express/Shortcut.php b/app/code/core/Mage/Paypal/Block/Express/Shortcut.php deleted file mode 100644 index 5e8ab37cc9e..00000000000 --- a/app/code/core/Mage/Paypal/Block/Express/Shortcut.php +++ /dev/null @@ -1,196 +0,0 @@ -_paymentMethodCode]); - $isInCatalog = $this->getIsInCatalogProduct(); - $quote = ($isInCatalog || $this->getIsQuoteAllowed() == '') - ? null : Mage::getSingleton('checkout/session')->getQuote(); - - // check visibility on cart or product page - $context = $isInCatalog ? 'visible_on_product' : 'visible_on_cart'; - if (!$config->$context) { - $this->_shouldRender = false; - return $result; - } - - if ($isInCatalog) { - /** @var Mage_Catalog_Model_Product $currentProduct */ - $currentProduct = Mage::registry('current_product'); - if (!is_null($currentProduct)) { - $price = (float) $currentProduct->getFinalPrice(); - $typeInstance = $currentProduct->getTypeInstance(); - if (empty($price) && !$currentProduct->isSuper() && !$typeInstance->canConfigure($currentProduct)) { - $this->_shouldRender = false; - return $result; - } - } - } - - // validate minimum quote amount and validate quote for zero grandtotal - if ($quote !== null && (!$quote->validateMinimumAmount() - || (!$quote->getGrandTotal() && !$quote->hasNominalItems())) - ) { - $this->_shouldRender = false; - return $result; - } - - // check payment method availability - $methodInstance = Mage::helper('payment')->getMethodInstance($this->_paymentMethodCode); - if (!$methodInstance || !$methodInstance->isAvailable($quote)) { - $this->_shouldRender = false; - return $result; - } - - // set misc data - /** @var Mage_Core_Helper_Data $helper */ - $helper = $this->helper('core'); - $this->setShortcutHtmlId($helper->uniqHash('ec_shortcut_')) - ->setCheckoutUrl($this->getUrl($this->_startAction)); - - $this->_getBmlShortcut($quote); - - // use static image if in catalog - if ($isInCatalog || $quote === null) { - $this->setImageUrl($config->getExpressCheckoutShortcutImageUrl(Mage::app()->getLocale()->getLocaleCode())); - } else { - $this->setImageUrl(Mage::getModel($this->_checkoutType, [ - 'quote' => $quote, - 'config' => $config, - ])->getCheckoutShortcutImageUrl()); - } - - // ask whether to create a billing agreement - $customerId = Mage::getSingleton('customer/session')->getCustomerId(); // potential issue for caching - if (Mage::helper('paypal')->shouldAskToCreateBillingAgreement($config, $customerId)) { - $this->setConfirmationUrl( - $this->getUrl( - $this->_startAction, - [Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT => 1], - ), - ); - $this->setConfirmationMessage(Mage::helper('paypal')->__('Would you like to sign a billing agreement to streamline further purchases with PayPal?')); - } - - return $result; - } - - /** - * @param Mage_Sales_Model_Quote $quote - * - * @return $this - */ - protected function _getBmlShortcut($quote) - { - /** @var Mage_Core_Helper_Data $helper */ - $helper = $this->helper('core'); - $bml = Mage::helper('payment')->getMethodInstance(Mage_Paypal_Model_Config::METHOD_BML); - $isBmlEnabled = $bml && $bml->isAvailable($quote); - $this->setBmlShortcutHtmlId($helper->uniqHash('ec_shortcut_bml_')) - ->setBmlCheckoutUrl($this->getUrl('paypal/bml/start/button/1')) - ->setBmlImageUrl('https://www.paypalobjects.com/webstatic/en_US/i/buttons/ppcredit-logo-medium.png') - ->setMarketMessage('https://www.paypalobjects.com/webstatic/en_US/btn/btn_bml_text.png') - ->setMarketMessageUrl('https://www.securecheckout.billmelater.com/paycapture-content/' - . 'fetch?hash=AU826TU8&content=/bmlweb/ppwpsiw.html') - ->setIsBmlEnabled($isBmlEnabled); - return $this; - } - - /** - * Render the block if needed - * - * @return string - */ - protected function _toHtml() - { - if (!$this->_shouldRender) { - return ''; - } - return parent::_toHtml(); - } - - /** - * Check is "OR" label position before shortcut - * - * @return bool - */ - public function isOrPositionBefore() - { - return ($this->getIsInCatalogProduct() && !$this->getShowOrPosition()) - || ($this->getShowOrPosition() && $this->getShowOrPosition() === self::POSITION_BEFORE); - } - - /** - * Check is "OR" label position after shortcut - * - * @return bool - */ - public function isOrPositionAfter() - { - return (!$this->getIsInCatalogProduct() && !$this->getShowOrPosition()) - || ($this->getShowOrPosition() && $this->getShowOrPosition() === self::POSITION_AFTER); - } -} diff --git a/app/code/core/Mage/Paypal/Block/Form.php b/app/code/core/Mage/Paypal/Block/Form.php new file mode 100644 index 00000000000..8ce50740b33 --- /dev/null +++ b/app/code/core/Mage/Paypal/Block/Form.php @@ -0,0 +1,91 @@ +setTemplate('paypal/payment.phtml'); + } + + /** + * Retrieves the configuration for the PayPal button. + */ + public function getButtonConfig(): array + { + return Mage::helper('paypal')->getButtonConfig(); + } + + /** + * Retrieves the PayPal API endpoint URL. + */ + public function getEndpointUrl(): string + { + return Mage::helper('paypal')->getConfig()->getEndpoint(); + } + + /** + * Retrieves the PayPal client ID from the API credentials. + */ + public function getClientId(): string + { + return Mage::helper('paypal')->getConfig()->getApiCredentials()['client_id']; + } + + /** + * Constructs and retrieves the full URL for the PayPal JavaScript SDK. + */ + public function getSdkUrl(): string + { + $intent = Mage::getSingleton('paypal/config')->getPaymentAction(); + + $params = [ + 'client-id' => $this->getClientId(), + 'components' => 'buttons', + 'intent' => (string) $intent, + 'currency' => Mage::app()->getStore()->getCurrentCurrencyCode(), + ]; + if (Mage::getSingleton('paypal/config')->isDebugEnabled()) { + $params['debug'] = 'true'; + } + + $baseUrl = $this->getEndpointUrl(); + if (!str_ends_with($baseUrl, '/')) { + $baseUrl .= '/'; + } + return $baseUrl . 'sdk/js?' . http_build_query($params); + } + + /** + * Retrieves the grand total amount from the current quote. + * + * @return float + */ + public function getAmount() + { + return $this->getMethod()->getQuote()->getGrandTotal(); + } + + /** + * Retrieves the currency code for the current store. + */ + public function getCurrencyCode(): string + { + return Mage::app()->getStore()->getCurrentCurrencyCode(); + } +} diff --git a/app/code/core/Mage/Paypal/Block/Hosted/Pro/Form.php b/app/code/core/Mage/Paypal/Block/Hosted/Pro/Form.php deleted file mode 100644 index 362d092fe42..00000000000 --- a/app/code/core/Mage/Paypal/Block/Hosted/Pro/Form.php +++ /dev/null @@ -1,26 +0,0 @@ -setTemplate('paypal/hss/info.phtml'); - } -} diff --git a/app/code/core/Mage/Paypal/Block/Hosted/Pro/Iframe.php b/app/code/core/Mage/Paypal/Block/Hosted/Pro/Iframe.php deleted file mode 100644 index f7e4d212940..00000000000 --- a/app/code/core/Mage/Paypal/Block/Hosted/Pro/Iframe.php +++ /dev/null @@ -1,36 +0,0 @@ -_paymentMethodCode = Mage_Paypal_Model_Config::METHOD_HOSTEDPRO; - } - - /** - * Get iframe action URL - * @return string - */ - public function getFrameActionUrl() - { - return $this->_getOrder() - ->getPayment() - ->getAdditionalInformation('secure_form_url'); - } -} diff --git a/app/code/core/Mage/Paypal/Block/Hosted/Pro/Info.php b/app/code/core/Mage/Paypal/Block/Hosted/Pro/Info.php deleted file mode 100644 index 9bae4489b0d..00000000000 --- a/app/code/core/Mage/Paypal/Block/Hosted/Pro/Info.php +++ /dev/null @@ -1,26 +0,0 @@ -_getCheckout() - ->getQuote() - ->getPayment() - ->getMethod(); - /** @var Mage_Paypal_Helper_Hss $helper */ - $helper = $this->helper('paypal/hss'); - if (in_array($paymentCode, $helper->getHssMethods())) { - $this->_paymentMethodCode = $paymentCode; - $templatePath = str_replace('_', '', $paymentCode); - $templateFile = "paypal/{$templatePath}/iframe.phtml"; - if (file_exists(Mage::getDesign()->getTemplateFilename($templateFile))) { - $this->setTemplate($templateFile); - } else { - $this->setTemplate('paypal/hss/iframe.phtml'); - } - } - } - - /** - * Get current block instance - * - * @return Mage_Paypal_Block_Iframe - * @throws Mage_Core_Exception - */ - protected function _getBlock() - { - if (!$this->_block) { - $block = $this->getAction() - ->getLayout() - ->createBlock('paypal/' . $this->_paymentMethodCode . '_iframe'); - if (!$block instanceof Mage_Paypal_Block_Iframe) { - Mage::throwException('Invalid block type'); - } - $this->_block = $block; - } - - return $this->_block; - } - - /** - * Get order object - * - * @return Mage_Sales_Model_Order - */ - protected function _getOrder() - { - if (!$this->_order) { - $incrementId = $this->_getCheckout()->getLastRealOrderId(); - $this->_order = Mage::getModel('sales/order') - ->loadByIncrementId($incrementId); - } - return $this->_order; - } - - /** - * Get frontend checkout session object - * - * @return Mage_Checkout_Model_Session - */ - protected function _getCheckout() - { - return Mage::getSingleton('checkout/session'); - } - - /** - * Before rendering html, check if is block rendering needed - * - * @return Mage_Core_Block_Abstract - */ - protected function _beforeToHtml() - { - if ($this->_getOrder()->getId() && - $this->_getOrder()->getQuoteId() == $this->_getCheckout()->getLastQuoteId() && - $this->_paymentMethodCode - ) { - $this->_shouldRender = true; - } - - if ($this->getGotoSection() || $this->getGotoSuccessPage()) { - $this->_shouldRender = true; - } - - return parent::_beforeToHtml(); - } - - /** - * Render the block if needed - * - * @return string - * @throws Exception - */ - protected function _toHtml() - { - if ($this->_isAfterPaymentSave()) { - $this->setTemplate('paypal/hss/js.phtml'); - return parent::_toHtml(); - } - if (!$this->_shouldRender) { - return ''; - } - return parent::_toHtml(); - } - - /** - * Check whether block is rendering after save payment - * - * @return bool - * @throws Exception - */ - protected function _isAfterPaymentSave() - { - $quote = $this->_getCheckout()->getQuote(); - if ($quote->getPayment()->getMethod() == $this->_paymentMethodCode && - $quote->getIsActive() && - $this->getTemplate() && - $this->getRequest()->getActionName() == 'savePayment' - ) { - return true; - } - - return false; - } - - /** - * Get iframe action URL - * - * @return string - * @throws Mage_Core_Exception - */ - public function getFrameActionUrl() - { - return $this->_getBlock()->getFrameActionUrl(); - } - - /** - * Get secure token - * - * @return string - * @throws Mage_Core_Exception - */ - public function getSecureToken() - { - return $this->_getBlock()->getSecureToken(); - } - - /** - * Get secure token ID - * - * @return string - * @throws Mage_Core_Exception - */ - public function getSecureTokenId() - { - return $this->_getBlock()->getSecureTokenId(); - } - - /** - * Get payflow transaction URL - * - * @return string - * @throws Mage_Core_Exception - */ - public function getTransactionUrl() - { - return $this->_getBlock()->getTransactionUrl(); - } - - /** - * Check sandbox mode - * - * @return bool - * @throws Mage_Core_Exception - */ - public function isTestMode() - { - return $this->_getBlock()->isTestMode(); - } -} diff --git a/app/code/core/Mage/Paypal/Block/Info.php b/app/code/core/Mage/Paypal/Block/Info.php new file mode 100644 index 00000000000..1bc78ebb5bf --- /dev/null +++ b/app/code/core/Mage/Paypal/Block/Info.php @@ -0,0 +1,33 @@ +setTemplate('paypal/info.phtml'); + } + + /** + * Retrieves the transaction ID from the payment information. + */ + public function getTransactionId(): ?string + { + return $this->getInfo()->getLastTransId(); + } +} diff --git a/app/code/core/Mage/Paypal/Block/Logo.php b/app/code/core/Mage/Paypal/Block/Logo.php deleted file mode 100644 index d397594ae6a..00000000000 --- a/app/code/core/Mage/Paypal/Block/Logo.php +++ /dev/null @@ -1,58 +0,0 @@ -_getConfig()->getPaymentMarkWhatIsPaypalUrl(Mage::app()->getLocale()); - } - - /** - * Getter for paypal config - * - * @return Mage_Paypal_Model_Config - */ - protected function _getConfig() - { - return Mage::getSingleton('paypal/config'); - } - - /** - * Disable block output if logo turned off - * - * @return string - */ - protected function _toHtml() - { - $type = $this->getLogoType(); // assigned in layout etc. - $logoUrl = $this->_getConfig()->getAdditionalOptionsLogoUrl(Mage::app()->getLocale()->getLocaleCode(), $type); - if (!$logoUrl) { - return ''; - } - $country = Mage::getStoreConfig(Mage_Paypal_Helper_Data::MERCHANT_COUNTRY_CONFIG_PATH); - if ($country == Mage_Paypal_Helper_Data::US_COUNTRY) { - $this->setTemplate('paypal/partner/us_logo.phtml'); - return parent::_toHtml(); - } - $this->setLogoImageUrl($logoUrl); - return parent::_toHtml(); - } -} diff --git a/app/code/core/Mage/Paypal/Block/Payflow/Advanced/Form.php b/app/code/core/Mage/Paypal/Block/Payflow/Advanced/Form.php deleted file mode 100644 index ca2b82f6a49..00000000000 --- a/app/code/core/Mage/Paypal/Block/Payflow/Advanced/Form.php +++ /dev/null @@ -1,36 +0,0 @@ -setTemplate('paypal/payflowadvanced/info.phtml'); - } - - /** - * Get frame action URL - * - * @return string - */ - public function getFrameActionUrl() - { - return $this->getUrl('paypal/payflowadvanced/form', ['_secure' => true]); - } -} diff --git a/app/code/core/Mage/Paypal/Block/Payflow/Advanced/Iframe.php b/app/code/core/Mage/Paypal/Block/Payflow/Advanced/Iframe.php deleted file mode 100644 index 454100269ce..00000000000 --- a/app/code/core/Mage/Paypal/Block/Payflow/Advanced/Iframe.php +++ /dev/null @@ -1,48 +0,0 @@ -_paymentMethodCode = Mage_Paypal_Model_Config::METHOD_PAYFLOWADVANCED; - } - - /** - * Get frame action URL - * @return string - */ - public function getFrameActionUrl() - { - return $this->getTransactionUrl() . '?SECURETOKEN=' . $this->getSecureToken() . '&SECURETOKENID=' - . $this->getSecureTokenId() . '&MODE=' . ($this->isTestMode() ? 'TEST' : 'LIVE'); - } - - /** - * Check sandbox mode - * - * @return bool - */ - public function isTestMode() - { - $mode = Mage::helper('payment') - ->getMethodInstance(Mage_Paypal_Model_Config::METHOD_PAYFLOWADVANCED) - ->getConfigData('sandbox_flag'); - return (bool) $mode; - } -} diff --git a/app/code/core/Mage/Paypal/Block/Payflow/Advanced/Info.php b/app/code/core/Mage/Paypal/Block/Payflow/Advanced/Info.php deleted file mode 100644 index bda357ad9da..00000000000 --- a/app/code/core/Mage/Paypal/Block/Payflow/Advanced/Info.php +++ /dev/null @@ -1,15 +0,0 @@ -setTemplate('paypal/payflowlink/info.phtml'); - } - - /** - * Get frame action URL - * - * @return string - */ - public function getFrameActionUrl() - { - return $this->getUrl('paypal/payflow/form', ['_secure' => true]); - } -} diff --git a/app/code/core/Mage/Paypal/Block/Payflow/Link/Iframe.php b/app/code/core/Mage/Paypal/Block/Payflow/Link/Iframe.php deleted file mode 100644 index 750ee5d0d3b..00000000000 --- a/app/code/core/Mage/Paypal/Block/Payflow/Link/Iframe.php +++ /dev/null @@ -1,83 +0,0 @@ -_paymentMethodCode = Mage_Paypal_Model_Config::METHOD_PAYFLOWLINK; - } - - /** - * Get frame action URL - * - * @return string - */ - public function getFrameActionUrl() - { - return $this->getTransactionUrl() . '?SECURETOKEN=' . $this->getSecureToken() . '&SECURETOKENID=' - . $this->getSecureTokenId() . '&MODE=' . ($this->isTestMode() ? 'TEST' : 'LIVE'); - } - - /** - * Get secure token - * - * @return string - */ - public function getSecureToken() - { - return $this->_getOrder() - ->getPayment() - ->getAdditionalInformation('secure_token'); - } - - /** - * Get secure token ID - * - * @return string - */ - public function getSecureTokenId() - { - return $this->_getOrder() - ->getPayment() - ->getAdditionalInformation('secure_token_id'); - } - - /** - * Get payflow transaction URL - * - * @return string - */ - public function getTransactionUrl() - { - return Mage_Paypal_Model_Payflowlink::TRANSACTION_PAYFLOW_URL; - } - - /** - * Check sandbox mode - * - * @return bool - */ - public function isTestMode() - { - $mode = Mage::helper('payment') - ->getMethodInstance($this->_paymentMethodCode) - ->getConfigData('sandbox_flag'); - return (bool) $mode; - } -} diff --git a/app/code/core/Mage/Paypal/Block/Payflow/Link/Info.php b/app/code/core/Mage/Paypal/Block/Payflow/Link/Info.php deleted file mode 100644 index 9f349f5f646..00000000000 --- a/app/code/core/Mage/Paypal/Block/Payflow/Link/Info.php +++ /dev/null @@ -1,26 +0,0 @@ -getInfo()->getMethod())) { - return parent::getCcTypeName(); - } - return null; - } - - /** - * Prepare PayPal-specific payment information - * - * @param Varien_Object|array $transport - * return Varien_Object - * @return Varien_Object - */ - protected function _prepareSpecificInformation($transport = null) - { - $transport = parent::_prepareSpecificInformation($transport); - $payment = $this->getInfo(); - $paypalInfo = Mage::getModel('paypal/info'); - if (!$this->getIsSecureMode()) { - $info = $paypalInfo->getPaymentInfo($payment, true); - } else { - $info = $paypalInfo->getPublicPaymentInfo($payment, true); - } - return $transport->addData($info); - } -} diff --git a/app/code/core/Mage/Paypal/Block/Standard/Form.php b/app/code/core/Mage/Paypal/Block/Standard/Form.php deleted file mode 100644 index 2d8c85b11fa..00000000000 --- a/app/code/core/Mage/Paypal/Block/Standard/Form.php +++ /dev/null @@ -1,63 +0,0 @@ -_config = Mage::getModel('paypal/config')->setMethod($this->getMethodCode()); - $locale = Mage::app()->getLocale(); - $mark = Mage::getConfig()->getBlockClassName('core/template'); - $mark = new $mark(); - $mark->setTemplate('paypal/payment/mark.phtml') - ->setPaymentAcceptanceMarkHref($this->_config->getPaymentMarkWhatIsPaypalUrl($locale)) - ->setPaymentAcceptanceMarkSrc($this->_config->getPaymentMarkImageUrl($locale->getLocaleCode())) - ; // known issue: code above will render only static mark image - $this->setTemplate('paypal/payment/redirect.phtml') - ->setRedirectMessage( - Mage::helper('paypal')->__('You will be redirected to the PayPal website when you place an order.'), - ) - ->setMethodTitle('') // Output PayPal mark, omit title - ->setMethodLabelAfterHtml($mark->toHtml()) - ; - parent::_construct(); - } - - /** - * Payment method code getter - * @return string - */ - public function getMethodCode() - { - return $this->_methodCode; - } -} diff --git a/app/code/core/Mage/Paypal/Block/Standard/Redirect.php b/app/code/core/Mage/Paypal/Block/Standard/Redirect.php deleted file mode 100644 index 5ef8bdd308e..00000000000 --- a/app/code/core/Mage/Paypal/Block/Standard/Redirect.php +++ /dev/null @@ -1,42 +0,0 @@ -setAction($standard->getConfig()->getPaypalUrl()) - ->setId('paypal_standard_checkout') - ->setName('paypal_standard_checkout') - ->setMethod('POST') - ->setUseContainer(true); - foreach ($standard->getStandardCheckoutFormFields() as $field => $value) { - $form->addField($field, 'hidden', ['name' => $field, 'value' => $value]); - } - $idSuffix = Mage::helper('core')->uniqHash(); - $submitButton = new Varien_Data_Form_Element_Submit([ - 'value' => $this->__('Click here if you are not redirected within 10 seconds...'), - ]); - $id = "submit_to_paypal_button_{$idSuffix}"; - $submitButton->setId($id); - $form->addElement($submitButton); - $html = ''; - $html .= $this->__('You will be redirected to the PayPal website in a few seconds.'); - $html .= $form->toHtml(); - $html .= ''; - - return $html . ''; - } -} diff --git a/app/code/core/Mage/Paypal/Controller/Express/Abstract.php b/app/code/core/Mage/Paypal/Controller/Express/Abstract.php deleted file mode 100644 index ebd07f5c8c8..00000000000 --- a/app/code/core/Mage/Paypal/Controller/Express/Abstract.php +++ /dev/null @@ -1,536 +0,0 @@ -_configType, [$this->_configMethod]); - $this->_config = $classInstance; - } - - /** - * Start Express Checkout by requesting initial token and dispatching customer to PayPal - */ - public function startAction() - { - try { - $this->_initCheckout(); - - if ($this->_getQuote()->getIsMultiShipping()) { - $this->_getQuote()->setIsMultiShipping(false); - $this->_getQuote()->removeAllAddresses(); - } - - $customer = Mage::getSingleton('customer/session')->getCustomer(); - $quoteCheckoutMethod = $this->_getQuote()->getCheckoutMethod(); - if ($customer && $customer->getId()) { - $this->_checkout->setCustomerWithAddressChange( - $customer, - $this->_getQuote()->getBillingAddress(), - $this->_getQuote()->getShippingAddress(), - ); - } elseif ((!$quoteCheckoutMethod - || $quoteCheckoutMethod != Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER) - && !Mage::helper('checkout')->isAllowedGuestCheckout( - $this->_getQuote(), - $this->_getQuote()->getStoreId(), - ) - ) { - Mage::getSingleton('core/session')->addNotice( - Mage::helper('paypal')->__('To proceed to Checkout, please log in using your email address.'), - ); - $this->redirectLogin(); - Mage::getSingleton('customer/session') - ->setBeforeAuthUrl(Mage::getUrl('*/*/*', ['_current' => true])); - return; - } - - // billing agreement - $isBARequested = (bool) $this->getRequest() - ->getParam(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT); - if ($customer && $customer->getId()) { - $this->_checkout->setIsBillingAgreementRequested($isBARequested); - } - - // Bill Me Later - $this->_checkout->setIsBml((bool) $this->getRequest()->getParam('bml')); - - // giropay - $this->_checkout->prepareGiropayUrls( - Mage::getUrl('checkout/onepage/success'), - Mage::getUrl('paypal/express/cancel'), - Mage::getUrl('checkout/onepage/success'), - ); - - $button = (bool) $this->getRequest()->getParam(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_BUTTON); - $token = $this->_checkout->start(Mage::getUrl('*/*/return'), Mage::getUrl('*/*/cancel'), $button); - if ($token && $url = $this->_checkout->getRedirectUrl()) { - $this->_initToken($token); - $this->getResponse()->setRedirect($url); - return; - } - } catch (Mage_Core_Exception $e) { - $this->_getCheckoutSession()->addError($e->getMessage()); - } catch (Exception $e) { - $this->_getCheckoutSession()->addError($this->__('Unable to start Express Checkout.')); - Mage::logException($e); - } - - $this->_redirect('checkout/cart'); - } - - /** - * Return shipping options items for shipping address from request - */ - public function shippingOptionsCallbackAction() - { - try { - $quoteId = $this->getRequest()->getParam('quote_id'); - $this->_quote = Mage::getModel('sales/quote')->load($quoteId); - $this->_initCheckout(); - $response = $this->_checkout->getShippingOptionsCallbackResponse($this->getRequest()->getParams()); - $this->getResponse()->setBody($response); - } catch (Exception $e) { - Mage::logException($e); - } - } - - /** - * Cancel Express Checkout - */ - public function cancelAction() - { - try { - $this->_initToken(false); - // TODO verify if this logic of order cancellation is deprecated - // if there is an order - cancel it - $orderId = $this->_getCheckoutSession()->getLastOrderId(); - $order = ($orderId) ? Mage::getModel('sales/order')->load($orderId) : false; - if ($order && $order->getId() && $order->getQuoteId() == $this->_getCheckoutSession()->getQuoteId()) { - $order->cancel()->save(); - $this->_getCheckoutSession() - ->unsLastQuoteId() - ->unsLastSuccessQuoteId() - ->unsLastOrderId() - ->unsLastRealOrderId() - ->addSuccess($this->__('Express Checkout and Order have been canceled.')) - ; - } else { - $this->_getCheckoutSession()->addSuccess($this->__('Express Checkout has been canceled.')); - } - } catch (Mage_Core_Exception $e) { - $this->_getCheckoutSession()->addError($e->getMessage()); - } catch (Exception $e) { - $this->_getCheckoutSession()->addError($this->__('Unable to cancel Express Checkout.')); - Mage::logException($e); - } - - $this->_redirect('checkout/cart'); - } - - /** - * Return from PayPal and dispatch customer to order review page - */ - public function returnAction() - { - if ($this->getRequest()->getParam('retry_authorization') == 'true' - && is_array($this->_getCheckoutSession()->getPaypalTransactionData()) - ) { - $this->_forward('placeOrder'); - return; - } - try { - $this->_getCheckoutSession()->unsPaypalTransactionData(); - $this->_checkout = $this->_initCheckout(); - $this->_checkout->returnFromPaypal($this->_initToken()); - - if ($this->_checkout->canSkipOrderReviewStep()) { - $this->_forward('placeOrder'); - } else { - $this->_redirect('*/*/review'); - } - - return; - } catch (Mage_Core_Exception $e) { - Mage::getSingleton('checkout/session')->addError($e->getMessage()); - } catch (Exception $e) { - Mage::getSingleton('checkout/session')->addError($this->__('Unable to process Express Checkout approval.')); - Mage::logException($e); - } - $this->_redirect('checkout/cart'); - } - - /** - * Review order after returning from PayPal - */ - public function reviewAction() - { - try { - $this->_initCheckout(); - $this->_checkout->prepareOrderReview($this->_initToken()); - $this->loadLayout(); - $this->_initLayoutMessages('paypal/session'); - $reviewBlock = $this->getLayout()->getBlock('paypal.express.review'); - $reviewBlock->setQuote($this->_getQuote()); - $reviewBlock->getChild('details')->setQuote($this->_getQuote()); - if ($reviewBlock->getChild('shipping_method')) { - $reviewBlock->getChild('shipping_method')->setQuote($this->_getQuote()); - } - $this->renderLayout(); - return; - } catch (Mage_Core_Exception $e) { - Mage::getSingleton('checkout/session')->addError($e->getMessage()); - } catch (Exception $e) { - Mage::getSingleton('checkout/session')->addError( - $this->__('Unable to initialize Express Checkout review.'), - ); - Mage::logException($e); - } - $this->_redirect('checkout/cart'); - } - - /** - * Dispatch customer back to PayPal for editing payment information - */ - public function editAction() - { - try { - $this->getResponse()->setRedirect($this->_config->getExpressCheckoutEditUrl($this->_initToken())); - } catch (Mage_Core_Exception $e) { - $this->_getSession()->addError($e->getMessage()); - $this->_redirect('*/*/review'); - } - } - - /** - * Update shipping method (combined action for ajax and regular request) - */ - public function saveShippingMethodAction() - { - try { - $isAjax = $this->getRequest()->getParam('isAjax'); - $this->_initCheckout(); - $this->_checkout->updateShippingMethod($this->getRequest()->getParam('shipping_method')); - if ($isAjax) { - $this->loadLayout('paypal_express_review_details'); - $this->getResponse()->setBody($this->getLayout()->getBlock('root') - ->setQuote($this->_getQuote()) - ->toHtml()); - return; - } - } catch (Mage_Core_Exception $e) { - $this->_getSession()->addError($e->getMessage()); - } catch (Exception $e) { - $this->_getSession()->addError($this->__('Unable to update shipping method.')); - Mage::logException($e); - } - if (isset($isAjax) && $isAjax) { - $this->getResponse()->setBody(''); - } else { - $this->_redirect('*/*/review'); - } - } - - /** - * Update Order (combined action for ajax and regular request) - */ - public function updateShippingMethodsAction() - { - try { - $this->_initCheckout(); - $this->_checkout->prepareOrderReview($this->_initToken()); - $this->loadLayout('paypal_express_review'); - - $this->getResponse()->setBody($this->getLayout()->getBlock('express.review.shipping.method') - ->setQuote($this->_getQuote()) - ->toHtml()); - return; - } catch (Mage_Core_Exception $e) { - $this->_getSession()->addError($e->getMessage()); - } catch (Exception $e) { - $this->_getSession()->addError($this->__('Unable to update shipping method.')); - Mage::logException($e); - } - $this->getResponse()->setBody(''); - } - - /** - * Submit the order - */ - public function placeOrderAction() - { - try { - $requiredAgreements = Mage::helper('checkout')->getRequiredAgreementIds(); - if ($requiredAgreements) { - $postedAgreements = array_keys($this->getRequest()->getPost('agreement', [])); - if (array_diff($requiredAgreements, $postedAgreements)) { - Mage::throwException(Mage::helper('paypal')->__('Please agree to all the terms and conditions before placing the order.')); - } - } - - $this->_initCheckout(); - $this->_checkout->place($this->_initToken()); - - // prepare session to success or cancellation page - $session = $this->_getCheckoutSession(); - $session->clearHelperData(); - - // "last successful quote" - $quoteId = $this->_getQuote()->getId(); - $session->setLastQuoteId($quoteId)->setLastSuccessQuoteId($quoteId); - - // an order may be created - $order = $this->_checkout->getOrder(); - if ($order) { - $session->setLastOrderId($order->getId()) - ->setLastRealOrderId($order->getIncrementId()); - // as well a billing agreement can be created - $agreement = $this->_checkout->getBillingAgreement(); - if ($agreement) { - $session->setLastBillingAgreementId($agreement->getId()); - } - } - - // recurring profiles may be created along with the order or without it - $profiles = $this->_checkout->getRecurringPaymentProfiles(); - if ($profiles) { - $ids = []; - foreach ($profiles as $profile) { - $ids[] = $profile->getId(); - } - $session->setLastRecurringProfileIds($ids); - } - - // redirect if PayPal specified some URL (for example, to Giropay bank) - $url = $this->_checkout->getRedirectUrl(); - if ($url) { - $this->getResponse()->setRedirect($url); - return; - } - $this->_initToken(false); // no need in token anymore - $this->_redirect('checkout/onepage/success'); - return; - } catch (Mage_Paypal_Model_Api_ProcessableException $e) { - $this->_processPaypalApiError($e); - } catch (Mage_Core_Exception $e) { - Mage::helper('checkout')->sendPaymentFailedEmail($this->_getQuote(), $e->getMessage()); - $this->_getSession()->addError($e->getMessage()); - $this->_redirect('*/*/review'); - } catch (Exception $e) { - Mage::helper('checkout')->sendPaymentFailedEmail( - $this->_getQuote(), - $this->__('Unable to place the order.'), - ); - $this->_getSession()->addError($this->__('Unable to place the order.')); - Mage::logException($e); - $this->_redirect('*/*/review'); - } - } - - /** - * Process PayPal API's processable errors - * - * @param Mage_Paypal_Model_Api_ProcessableException $exception - */ - protected function _processPaypalApiError($exception) - { - switch ($exception->getCode()) { - case Mage_Paypal_Model_Api_ProcessableException::API_MAX_PAYMENT_ATTEMPTS_EXCEEDED: - case Mage_Paypal_Model_Api_ProcessableException::API_TRANSACTION_EXPIRED: - $this->getResponse()->setRedirect( - $this->_getQuote()->getPayment()->getCheckoutRedirectUrl(), - ); - break; - case Mage_Paypal_Model_Api_ProcessableException::API_DO_EXPRESS_CHECKOUT_FAIL: - $this->_redirectSameToken(); - break; - case Mage_Paypal_Model_Api_ProcessableException::API_UNABLE_TRANSACTION_COMPLETE: - if ($this->_config->getPaymentAction() == Mage_Payment_Model_Method_Abstract::ACTION_ORDER) { - $paypalTransactionData = $this->_getCheckoutSession()->getPaypalTransactionData(); - $this->getResponse()->setRedirect( - $this->_config->getExpressCheckoutOrderUrl($paypalTransactionData['transaction_id']), - ); - } else { - $this->_redirectSameToken(); - } - break; - default: - $this->_redirectToCartAndShowError($exception->getUserMessage()); - break; - } - } - - /** - * Redirect customer back to PayPal with the same token - */ - protected function _redirectSameToken() - { - $token = $this->_initToken(); - $this->getResponse()->setRedirect( - $this->_config->getExpressCheckoutStartUrl($token), - ); - } - - /** - * Redirect customer to shopping cart and show error message - * - * @param string $errorMessage - */ - protected function _redirectToCartAndShowError($errorMessage) - { - $cart = Mage::getSingleton('checkout/cart'); - $cart->getCheckoutSession()->addError($errorMessage); - $this->_redirect('checkout/cart'); - } - - /** - * Instantiate quote and checkout - * - * @return Mage_Paypal_Model_Express_Checkout - * @throws Mage_Core_Exception - */ - protected function _initCheckout() - { - $quote = $this->_getQuote(); - if (!$quote->hasItems() || $quote->getHasError()) { - $this->getResponse()->setHeader('HTTP/1.1', '403 Forbidden'); - Mage::throwException(Mage::helper('paypal')->__('Unable to initialize Express Checkout.')); - } - - /** @var Mage_Paypal_Model_Express_Checkout $classInstance */ - $classInstance = Mage::getSingleton($this->_checkoutType, [ - 'config' => $this->_config, - 'quote' => $quote, - ]); - $this->_checkout = $classInstance; - return $this->_checkout; - } - - /** - * Search for proper checkout token in request or session or (un)set specified one - * Combined getter/setter - * - * @param string $setToken - * @return $this|string - */ - protected function _initToken($setToken = null) - { - if ($setToken !== null) { - if ($setToken === false) { - // security measure for avoid unsetting token twice - if (!$this->_getSession()->getExpressCheckoutToken()) { - Mage::throwException($this->__('PayPal Express Checkout Token does not exist.')); - } - $this->_getSession()->unsExpressCheckoutToken(); - } else { - $this->_getSession()->setExpressCheckoutToken($setToken); - } - return $this; - } - if ($setToken = $this->getRequest()->getParam('token')) { - if ($setToken !== $this->_getSession()->getExpressCheckoutToken()) { - Mage::throwException($this->__('Wrong PayPal Express Checkout Token specified.')); - } - } else { - $setToken = $this->_getSession()->getExpressCheckoutToken(); - } - return $setToken; - } - - /** - * PayPal session instance getter - * - * @return Mage_Paypal_Model_Session - */ - private function _getSession() - { - return Mage::getSingleton('paypal/session'); - } - - /** - * Return checkout session object - * - * @return Mage_Checkout_Model_Session - */ - protected function _getCheckoutSession() - { - return Mage::getSingleton('checkout/session'); - } - - /** - * Return checkout quote object - * - * @return Mage_Sales_Model_Quote - */ - private function _getQuote() - { - if (!$this->_quote) { - $this->_quote = $this->_getCheckoutSession()->getQuote(); - } - return $this->_quote; - } - - /** - * Redirect to login page - * - */ - public function redirectLogin() - { - $this->setFlag('', 'no-dispatch', true); - $this->getResponse()->setRedirect( - Mage::helper('core/url')->addRequestParam( - Mage::helper('customer')->getLoginUrl(), - ['context' => 'checkout'], - ), - ); - } -} diff --git a/app/code/core/Mage/Paypal/Exception.php b/app/code/core/Mage/Paypal/Exception.php deleted file mode 100644 index 5528c9507df..00000000000 --- a/app/code/core/Mage/Paypal/Exception.php +++ /dev/null @@ -1,13 +0,0 @@ -_getCheckoutSession()->getLastRealOrder(); - if ($order->getId()) { - $quote = $this->_getQuote($order->getQuoteId()); - if ($quote->getId()) { - $quote->setIsActive(1) - ->setReservedOrderId(null) - ->save(); - $this->_getCheckoutSession() - ->replaceQuote($quote) - ->unsLastRealOrderId(); - return true; - } - } - return false; - } - - /** - * Cancel last placed order with specified comment message - * - * @param string $comment Comment appended to order history - * @return bool True if order cancelled, false otherwise - */ - public function cancelCurrentOrder($comment) - { - $order = $this->_getCheckoutSession()->getLastRealOrder(); - if ($order->getId() && $order->getState() != Mage_Sales_Model_Order::STATE_CANCELED) { - $order->registerCancellation($comment)->save(); - return true; - } - return false; - } - - /** - * Return checkout session instance - * - * @return Mage_Checkout_Model_Session - */ - protected function _getCheckoutSession() - { - return Mage::getSingleton('checkout/session'); - } - - /** - * Return sales quote instance for specified ID - * - * @param int $quoteId Quote identifier - * @return Mage_Sales_Model_Quote - */ - protected function _getQuote($quoteId) - { - return Mage::getModel('sales/quote')->load($quoteId); - } -} diff --git a/app/code/core/Mage/Paypal/Helper/Data.php b/app/code/core/Mage/Paypal/Helper/Data.php index 6522de53d95..b8d8e86dd5d 100644 --- a/app/code/core/Mage/Paypal/Helper/Data.php +++ b/app/code/core/Mage/Paypal/Helper/Data.php @@ -7,113 +7,69 @@ * @package Mage_Paypal */ +declare(strict_types=1); + /** - * Paypal Data helper - * - * @package Mage_Paypal + * PayPal module helper */ class Mage_Paypal_Helper_Data extends Mage_Core_Helper_Abstract { - protected $_moduleName = 'Mage_Paypal'; - - /** - * US country code - */ - public const US_COUNTRY = 'US'; - - /** - * Config path for merchant country - */ - public const MERCHANT_COUNTRY_CONFIG_PATH = 'paypal/general/merchant_country'; - /** - * Cache for shouldAskToCreateBillingAgreement() + * Retrieves the PayPal configuration model, optionally for a specific store. * - * @var bool + * @param mixed $store The store ID or object. */ - protected static $_shouldAskToCreateBillingAgreement = null; + public function getConfig(mixed $store = null): Mage_Paypal_Model_Config + { + return Mage::getSingleton('paypal/config')->setStoreId($store); + } /** - * Check whether customer should be asked confirmation whether to sign a billing agreement + * Checks if the PayPal payment method is active and available, optionally for a specific store. * - * @param int $customerId - * @return bool + * @param mixed $store The store ID or object. */ - public function shouldAskToCreateBillingAgreement(Mage_Paypal_Model_Config $config, $customerId) + public function isAvailable(mixed $store = null): bool { - if (self::$_shouldAskToCreateBillingAgreement === null) { - self::$_shouldAskToCreateBillingAgreement = false; - if ($customerId && $config->shouldAskToCreateBillingAgreement()) { - if (Mage::getModel('sales/billing_agreement')->needToCreateForCustomer($customerId)) { - self::$_shouldAskToCreateBillingAgreement = true; - } - } - } - return self::$_shouldAskToCreateBillingAgreement; + return $this->getConfig($store)->isActive(); } /** - * Return backend config for element like JSON + * Retrieves the configuration settings for the PayPal button, optionally for a specific store. * - * @return false|string + * @param mixed $store The store ID or object. */ - public function getElementBackendConfig(Varien_Data_Form_Element_Abstract $element) + public function getButtonConfig(mixed $store = null): array { - $config = $element->getFieldConfig()->backend_congif; - if (!$config) { - return false; - } - $config = $config->asCanonicalArray(); - if (isset($config['enable_for_countries'])) { - $config['enable_for_countries'] = explode(',', str_replace(' ', '', $config['enable_for_countries'])); - } - if (isset($config['disable_for_countries'])) { - $config['disable_for_countries'] = explode(',', str_replace(' ', '', $config['disable_for_countries'])); - } - return Mage::helper('core')->jsonEncode($config); + return $this->getConfig($store)->getButtonConfiguration(); } /** - * Get selected merchant country code in system configuration + * Formats a numeric price into a string with two decimal places, suitable for the PayPal API. * - * @return string + * @param float $amount The price amount to format. */ - public function getConfigurationCountryCode() + public function formatPrice(float $amount): string { - $requestParam = Mage_Paypal_Block_Adminhtml_System_Config_Field_Country::REQUEST_PARAM_COUNTRY; - $countryCode = Mage::app()->getRequest()->getParam($requestParam); - if (is_null($countryCode) || preg_match('/^[a-zA-Z]{2}$/', $countryCode) == 0) { - $countryCode = (string) Mage::getSingleton('adminhtml/config_data') - ->getConfigDataValue(self::MERCHANT_COUNTRY_CONFIG_PATH); - } - if (empty($countryCode)) { - $countryCode = Mage::helper('core')->getDefaultCountry(); - } - return $countryCode; + return number_format($amount, 2, '.', ''); } /** - * Get HTML representation of transaction id + * Constructs the URL to view a specific transaction in the PayPal merchant dashboard. * - * @param string $methodCode - * @param string $txnId - * @return string + * @param string $transactionId The transaction ID. + * @param bool $sandbox Whether to use the sandbox environment. */ - public function getHtmlTransactionId($methodCode, $txnId) + public function getTransactionUrl(string $transactionId, bool $sandbox = false): string { - if (in_array($methodCode, [ - Mage_Paypal_Model_Config::METHOD_WPP_DIRECT, - Mage_Paypal_Model_Config::METHOD_WPP_EXPRESS, - Mage_Paypal_Model_Config::METHOD_HOSTEDPRO, - Mage_Paypal_Model_Config::METHOD_WPS, - ]) - ) { - /** @var Mage_Paypal_Model_Config $config */ - $config = Mage::getModel('paypal/config')->setMethod($methodCode); - $url = 'https://www.' . ($config->sandboxFlag ? 'sandbox.' : '') - . 'paypal.com/cgi-bin/webscr?cmd=_view-a-trans&id=' . $txnId; - return '' . $txnId . ''; + if (str_contains($transactionId, '-')) { + $parts = explode('-', $transactionId); + $transactionId = $parts[0]; } - return $txnId; + + $baseUrl = $sandbox + ? 'https://www.sandbox.paypal.com/activity/payment/' + : 'https://www.paypal.com/activity/payment/'; + return $baseUrl . $transactionId; } } diff --git a/app/code/core/Mage/Paypal/Helper/Hss.php b/app/code/core/Mage/Paypal/Helper/Hss.php deleted file mode 100644 index ad18a701628..00000000000 --- a/app/code/core/Mage/Paypal/Helper/Hss.php +++ /dev/null @@ -1,63 +0,0 @@ -getQuote(); - if ($quote) { - $payment = $quote->getPayment(); - if ($payment && in_array($payment->getMethod(), $this->_hssMethods)) { - return $name; - } - } - - if ($blockObject = Mage::getSingleton('core/layout')->getBlock($block)) { - return $blockObject->getTemplate(); - } - - return ''; - } - - /** - * Get methods - * - * @return array - */ - public function getHssMethods() - { - return $this->_hssMethods; - } -} diff --git a/app/code/core/Mage/Paypal/Model/Api.php b/app/code/core/Mage/Paypal/Model/Api.php new file mode 100644 index 00000000000..9443988a32d --- /dev/null +++ b/app/code/core/Mage/Paypal/Model/Api.php @@ -0,0 +1,574 @@ +helper = Mage::getSingleton('paypal/helper'); + $this->config = Mage::getSingleton('paypal/config'); + } + + /** + * Create a new PayPal order with a pre-built request + * + * @param object $orderRequest Pre-built order request object + * @param string $paypalRequestId PayPal request ID + * @param Mage_Sales_Model_Order|Mage_Sales_Model_Quote $quote Customer quote or order + * @throws Mage_Paypal_Model_Exception + */ + public function createOrder( + Mage_Sales_Model_Order|Mage_Sales_Model_Quote $quote, + object $orderRequest, + string $paypalRequestId + ): ?ApiResponse { + $this->_validateQuote($quote); + + try { + $request = [ + 'prefer' => self::PREFER_RETURN_REPRESENTATION, + 'body' => $orderRequest, + 'paypalRequestId' => $paypalRequestId, + ]; + $response = $this->getClient()->getOrdersController()->createOrder($request); + + $this->helper->logDebug('Create Order', $quote, $request, $response); + return $response; + } catch (Exception $e) { + $this->_logAndThrowError('Create Order Error', $e); + } + } + + /** + * Authorize payment for a PayPal order + * + * @param string $id PayPal order ID + * @throws Mage_Paypal_Model_Exception + */ + public function authorizeOrder( + string $id, + Mage_Sales_Model_Order|Mage_Sales_Model_Quote $quote + ): ?ApiResponse { + $this->_validateOrderId($id); + + try { + $request = [ + 'id' => $id, + 'prefer' => self::PREFER_RETURN_REPRESENTATION, + ]; + + $response = $this->getClient()->getOrdersController()->authorizeOrder($request); + + $this->helper->logDebug('Authorize Order', $quote, $request, $response); + return $response; + } catch (Exception $e) { + $this->_logAndThrowError('Authorize Order Error', $e); + } + } + /** + * Authorize payment for a PayPal order + * + * @param string $id PayPal order ID + * @throws Mage_Paypal_Model_Exception + */ + public function reAuthorizeOrder( + string $id, + Mage_Sales_Model_Order|Mage_Sales_Model_Quote $quote + ): ?ApiResponse { + $this->_validateAuthorizationId($id); + + try { + $request = [ + 'authorizationId' => $id, + 'prefer' => self::PREFER_RETURN_REPRESENTATION, + ]; + + $response = $this->getClient()->getPaymentsController()->reauthorizePayment($request); + + $this->helper->logDebug('Reauthorize Order', $quote, $request, $response); + return $response; + } catch (Exception $e) { + $this->_logAndThrowError('Reauthorize Order Error', $e); + } + } + + /** + * Capture authorized payment for a PayPal order + * + * @param string $id PayPal order ID + * @throws Mage_Paypal_Model_Exception + */ + public function captureAuthorizedPayment(string $id, Mage_Sales_Model_Order $order): ?ApiResponse + { + $this->_validateOrderId($id); + + try { + $request = [ + 'authorizationId' => $id, + 'prefer' => self::PREFER_RETURN_REPRESENTATION, + ]; + $response = $this->getClient()->getPaymentsController()->captureAuthorizedPayment($request); + $this->helper->logDebug('Capture Authorized Payment', $order, $request, $response); + return $response; + } catch (Exception $e) { + $this->_logAndThrowError('Capture Authorized Order Error', $e); + } + } + + /** + * Capture payment for a PayPal order + * + * @param string $id PayPal order ID + * @param Mage_Sales_Model_Order|Mage_Sales_Model_Quote $quote Customer quote or order + * @param string $paypalRequestId PayPal request ID + * @throws Mage_Paypal_Model_Exception + */ + public function captureOrder( + string $id, + Mage_Sales_Model_Order|Mage_Sales_Model_Quote $quote, + string $paypalRequestId + ): ?ApiResponse { + $this->_validateOrderId($id); + + try { + $request = [ + 'id' => $id, + 'prefer' => self::PREFER_RETURN_REPRESENTATION, + 'paypalRequestId' => $paypalRequestId, + ]; + + $response = $this->getClient()->getOrdersController()->captureOrder($request); + + $this->helper->logDebug('Capture Order', $quote, $request, $response); + + return $response; + } catch (Exception $e) { + if ($this->_isPhoneNumberMappingError($e)) { + $response = $this->_handlePhoneNumberMappingError($id, $quote, $e); + $this->helper->logDebug('Manual Capture Order', $quote, $request, $response); + return $response; + } + $this->_logAndThrowError('Capture Order Error', $e); + } + } + + /** + * Refund a captured payment + * + * @param string $captureId PayPal capture ID + * @param float $amount Amount to refund + * @param string $currencyCode Currency code + * @throws Mage_Paypal_Model_Exception + */ + public function refundCapturedPayment( + string $captureId, + float $amount, + string $currencyCode, + Mage_Sales_Model_Order $order + ): ?ApiResponse { + $this->_validateCaptureId($captureId); + $this->_validateAmount($amount); + + try { + $request = [ + 'captureId' => $captureId, + 'prefer' => self::PREFER_RETURN_REPRESENTATION, + 'body' => $this->_buildRefundBody($amount, $currencyCode), + ]; + $response = $this->getClient()->getPaymentsController()->refundCapturedPayment($request); + + $this->helper->logDebug('Refund Payment', $order, $request, $response); + return $response; + } catch (Exception $e) { + $this->_logAndThrowError('Refund Payment Error', $e); + } + } + + /** + * Void an authorization + * + * @param string $authorizationId PayPal authorization ID + * @throws Mage_Paypal_Model_Exception + */ + public function voidPayment(string $authorizationId, Mage_Sales_Model_Order $order): ?ApiResponse + { + $this->_validateAuthorizationId($authorizationId); + + try { + $request = [ + 'authorizationId' => $authorizationId, + 'prefer' => self::PREFER_RETURN_REPRESENTATION, + ]; + $response = $this->getClient()->getPaymentsController()->voidPayment($request); + + $this->helper->logDebug('Void Authorization', $order, $request, $response); + return $response; + } catch (Exception $e) { + $this->_logAndThrowError('Void Authorization Error', $e); + } + } + + /** + * Get PayPal API client instance with lazy loading + * + * @throws Mage_Paypal_Model_Exception + */ + public function getClient(): PaypalServerSdkClient + { + if (!$this->client instanceof PaypalServerSdkClient) { + $this->_initializeClient(); + } + return $this->client; + } + + /** + * Reset client instance (useful for testing or config changes) + * + * @return $this + */ + public function resetClient(): self + { + $this->client = null; + return $this; + } + + /** + * Initialize PayPal client + * + * @throws Mage_Paypal_Model_Exception + */ + private function _initializeClient(): void + { + try { + $credentials = $this->config->getApiCredentials(); + $environment = $this->config->isSandbox() ? Environment::SANDBOX : Environment::PRODUCTION; + + $this->client = PaypalServerSdkClientBuilder::init() + ->clientCredentialsAuthCredentials( + ClientCredentialsAuthCredentialsBuilder::init( + $credentials['client_id'], + $credentials['client_secret'], + ), + ) + ->environment($environment) + ->build(); + } catch (Exception $e) { + throw new Mage_Paypal_Model_Exception('Failed to initialize PayPal client: ' . $e->getMessage(), [], $e); + } + } + + /** + * Validate quote object + * + * @throws Mage_Paypal_Model_Exception + */ + private function _validateQuote(mixed $quote): void + { + if (!$quote || !$quote->hasItems()) { + throw new Mage_Paypal_Model_Exception(self::ERROR_INVALID_QUOTE); + } + } + + /** + * Validate order ID + * + * @throws Mage_Paypal_Model_Exception + */ + private function _validateOrderId(string $id): void + { + if (empty($id)) { + throw new Mage_Paypal_Model_Exception(self::ERROR_EMPTY_ORDER_ID); + } + } + + /** + * Validate capture ID + * + * @throws Mage_Paypal_Model_Exception + */ + private function _validateCaptureId(string $captureId): void + { + if (empty($captureId)) { + throw new Mage_Paypal_Model_Exception(self::ERROR_EMPTY_CAPTURE_ID); + } + } + + /** + * Validate authorization ID + * + * @throws Mage_Paypal_Model_Exception + */ + private function _validateAuthorizationId(string $authorizationId): void + { + if (empty($authorizationId)) { + throw new Mage_Paypal_Model_Exception(self::ERROR_EMPTY_AUTH_ID); + } + } + + /** + * Validate amount + * + * @throws Mage_Paypal_Model_Exception + */ + private function _validateAmount(float $amount): void + { + if ($amount <= 0) { + throw new Mage_Paypal_Model_Exception(self::ERROR_INVALID_AMOUNT); + } + } + + /** + * Build refund request body + * + * @return array + */ + private function _buildRefundBody(float $amount, string $currencyCode): array + { + return [ + 'amount' => [ + 'value' => number_format($amount, 2, '.', ''), + 'currency_code' => $currencyCode, + ], + ]; + } + + /** + * Log error and throw exception + * + * @throws Exception + */ + private function _logAndThrowError(string $message, Exception $e): never + { + $this->helper->logError($message, $e); + throw $e; + } + + /** + * @TODO: Temporary workaround for PhoneNumberWithCountryCode mapping issues + * https://github.com/paypal/PayPal-PHP-Server-SDK/issues/46 + * Check if exception is related to PhoneNumberWithCountryCode mapping + */ + private function _isPhoneNumberMappingError(Exception $e): bool + { + return str_contains($e->getMessage(), 'PhoneNumberWithCountryCode') && + str_contains($e->getMessage(), 'countryCode'); + } + + /** + * Handle PhoneNumberWithCountryCode mapping error by making raw API call + */ + private function _handlePhoneNumberMappingError( + string $orderId, + Mage_Sales_Model_Order|Mage_Sales_Model_Quote $quote, + Exception $originalException + ): ApiResponse { + try { + $rawResponse = $this->_makeRawApiCall($orderId); + $processedResponse = $this->_processPhoneNumberFields($rawResponse); + + $this->helper->logDebug('Capture Order (Phone Fix)', $quote, ['id' => $orderId], null); + return $this->_createApiResponseFromProcessedData($processedResponse); + } catch (Exception $e) { + $this->helper->logError('Failed to handle phone number mapping error', $e); + throw $originalException; + } + } + + /** + * @TODO: Temporary workaround for PhoneNumberWithCountryCode mapping issues + * https://github.com/paypal/PayPal-PHP-Server-SDK/issues/46 + * Make raw API call without SDK model mapping + */ + private function _makeRawApiCall(string $orderId): array + { + $environment = $this->config->isSandbox() ? 'sandbox' : 'production'; + $baseUrl = $environment === 'sandbox' ? 'https://api.sandbox.paypal.com' : 'https://api.paypal.com'; + + $credentials = $this->config->getApiCredentials(); + $accessToken = $this->_getAccessToken($credentials); + + $ch = curl_init(); + curl_setopt_array($ch, [ + CURLOPT_URL => "{$baseUrl}/v2/checkout/orders/{$orderId}", + CURLOPT_RETURNTRANSFER => true, + CURLOPT_HTTPHEADER => [ + "Authorization: Bearer {$accessToken}", + 'Content-Type: application/json', + 'Accept: application/json', + ], + ]); + + $response = curl_exec($ch); + $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); + curl_close($ch); + + if ($httpCode !== 200) { + throw new Exception("API call failed with status: $httpCode" . " and response: {$response}"); + } + + return json_decode($response, true); + } + + /** + * @TODO: Temporary workaround for PhoneNumberWithCountryCode mapping issues + * https://github.com/paypal/PayPal-PHP-Server-SDK/issues/46 + * Process phone number fields to handle missing country codes + */ + private function _processPhoneNumberFields(array $responseData): array + { + array_walk_recursive($responseData, function (&$value, $key) { + if ($key === 'phone_number' && is_array($value)) { + if (isset($value['national_number']) && !isset($value['country_code'])) { + $value['country_code'] = '1'; + } + } + }); + + return $responseData; + } + + /** + * @TODO: Temporary workaround for PhoneNumberWithCountryCode mapping issues + * https://github.com/paypal/PayPal-PHP-Server-SDK/issues/46 + * Create API response from processed data + */ + private function _createApiResponseFromProcessedData(array $processedData): ApiResponse + { + $purchaseUnits = []; + if (!empty($processedData['purchase_units']) && is_array($processedData['purchase_units'])) { + foreach ($processedData['purchase_units'] as $purchaseUnit) { + $captures = []; + if (isset($purchaseUnit['payments']['captures']) && is_array($purchaseUnit['payments']['captures'])) { + foreach ($purchaseUnit['payments']['captures'] as $capture) { + $captures[] = OrdersCaptureBuilder::init() + ->id($capture['id'] ?? null) + ->status($capture['status'] ?? null) + ->build(); + } + } + $purchaseUnits[] = PurchaseUnitBuilder::init() + ->payments( + PaymentCollectionBuilder::init() + ->captures($captures) + ->build(), + ) + ->build(); + } + } + + $payer = null; + if (!empty($processedData['payer'])) { + $payerName = null; + if (!empty($processedData['payer']['name'])) { + $payerName = NameBuilder::init() + ->givenName($processedData['payer']['name']['given_name'] ?? null) + ->surname($processedData['payer']['name']['surname'] ?? null) + ->build(); + } + $payer = PayerBuilder::init() + ->name($payerName) + ->emailAddress($processedData['payer']['email_address'] ?? null) + ->payerId($processedData['payer']['payer_id'] ?? null) + ->build(); + } + + $order = OrderBuilder::init() + ->createTime($processedData['create_time'] ?? null) + ->updateTime($processedData['update_time'] ?? null) + ->id($processedData['id'] ?? null) + ->payer($payer) + ->intent($processedData['intent'] ?? null) + ->purchaseUnits($purchaseUnits) + ->status($processedData['status'] ?? null) + ->links($processedData['links'] ?? []) + ->build(); + + return new ApiResponse( + 200, + 200, + null, + ['Content-Type' => 'application/json'], + $order, + json_encode($processedData), + ); + } + + /** + * @TODO: Temporary workaround for PhoneNumberWithCountryCode mapping issues + * https://github.com/paypal/PayPal-PHP-Server-SDK/issues/46 + * Get access token for direct API calls + */ + private function _getAccessToken(array $credentials): string + { + $environment = $this->config->isSandbox() ? 'sandbox' : 'production'; + $baseUrl = $environment === 'sandbox' ? 'https://api.sandbox.paypal.com' : 'https://api.paypal.com'; + + $ch = curl_init(); + curl_setopt_array($ch, [ + CURLOPT_URL => "{$baseUrl}/v1/oauth2/token", + CURLOPT_RETURNTRANSFER => true, + CURLOPT_POST => true, + CURLOPT_POSTFIELDS => 'grant_type=client_credentials', + CURLOPT_HTTPHEADER => [ + 'Accept: application/json', + 'Accept-Language: en_US', + ], + CURLOPT_USERPWD => "{$credentials['client_id']}:{$credentials['client_secret']}", + ]); + + $response = curl_exec($ch); + $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); + curl_close($ch); + + if ($httpCode !== 200) { + throw new Exception("Token request failed with status: $httpCode"); + } + + $tokenData = json_decode($response, true); + return $tokenData['access_token']; + } +} diff --git a/app/code/core/Mage/Paypal/Model/Api/Abstract.php b/app/code/core/Mage/Paypal/Model/Api/Abstract.php deleted file mode 100644 index 78b746eb6a5..00000000000 --- a/app/code/core/Mage/Paypal/Model/Api/Abstract.php +++ /dev/null @@ -1,574 +0,0 @@ -_config->apiUsername; - } - - /** - * Return Paypal Api password based on config data - * - * @return string - */ - public function getApiPassword() - { - return $this->_config->apiPassword; - } - - /** - * Return Paypal Api signature based on config data - * - * @return string - */ - public function getApiSignature() - { - return $this->_config->apiSignature; - } - - /** - * Return Paypal Api certificate based on config data - * - * @return string - */ - public function getApiCertificate() - { - return $this->_config->getApiCertificate(); - } - - /** - * BN code getter - * - * @return string - */ - public function getBuildNotationCode() - { - return $this->_config->getBuildNotationCode(); - } - - /** - * Return Paypal Api proxy status based on config data - * - * @return bool - */ - public function getUseProxy() - { - return $this->_getDataOrConfig('use_proxy', false); - } - - /** - * Return Paypal Api proxy host based on config data - * - * @return string - */ - public function getProxyHost() - { - return $this->_getDataOrConfig('proxy_host', '127.0.0.1'); - } - - /** - * Return Paypal Api proxy port based on config data - * - * @return string - */ - public function getProxyPort() - { - return $this->_getDataOrConfig('proxy_port', '808'); - } - - /** - * @deprecated after 1.4.1.0 - * - * @return bool - */ - public function getDebug() - { - return $this->getDebugFlag(); - } - - /** - * PayPal page CSS getter - * - * @return string - */ - public function getPageStyle() - { - return $this->_getDataOrConfig('page_style'); - } - - /** - * PayPal page header image URL getter - * - * @return string - */ - public function getHdrimg() - { - return $this->_getDataOrConfig('paypal_hdrimg'); - } - - /** - * PayPal page header border color getter - * - * @return string - */ - public function getHdrbordercolor() - { - return $this->_getDataOrConfig('paypal_hdrbordercolor'); - } - - /** - * PayPal page header background color getter - * - * @return string - */ - public function getHdrbackcolor() - { - return $this->_getDataOrConfig('paypal_hdrbackcolor'); - } - - /** - * PayPal page "payflow color" (?) getter - * - * @return string - */ - public function getPayflowcolor() - { - return $this->_getDataOrConfig('paypal_payflowcolor'); - } - - /** - * Payment action getter - * - * @return string - */ - public function getPaymentAction() - { - return $this->_getDataOrConfig('payment_action'); - } - - /** - * PayPal merchant email getter - */ - public function getBusinessAccount() - { - return $this->_getDataOrConfig('business_account'); - } - - /** - * Import $this public data to specified object or array - * - * @param array|Varien_Object $to - * @return array|Varien_Object - */ - public function &import($to, array $publicMap = []) - { - return Varien_Object_Mapper::accumulateByMap([$this, 'getDataUsingMethod'], $to, $publicMap); - } - - /** - * Export $this public data from specified object or array - * - * @param array|Varien_Object $from - * @return Mage_Paypal_Model_Api_Abstract - */ - public function export($from, array $publicMap = []) - { - Varien_Object_Mapper::accumulateByMap($from, [$this, 'setDataUsingMethod'], $publicMap); - return $this; - } - - /** - * Set PayPal cart instance - * - * @return Mage_Paypal_Model_Api_Abstract - */ - public function setPaypalCart(Mage_Paypal_Model_Cart $cart) - { - $this->_cart = $cart; - return $this; - } - - /** - * Config instance setter - * @return Mage_Paypal_Model_Api_Abstract - */ - public function setConfigObject(Mage_Paypal_Model_Config $config) - { - $this->_config = $config; - return $this; - } - - /** - * Current locale code getter - * - * @return string - */ - public function getLocaleCode() - { - return Mage::app()->getLocale()->getLocaleCode(); - } - - /** - * Always take into account - */ - public function getFraudManagementFiltersEnabled() - { - return 1; - } - - /** - * Set recurring profiles - * - * @return Mage_Paypal_Model_Api_Abstract - */ - public function addRecurringPaymentProfiles(array $items) - { - if ($items) { - $this->_recurringPaymentProfiles = $items; - } - return $this; - } - - /** - * Export $this public data to private request array - * - * @return array - */ - protected function &_exportToRequest(array $privateRequestMap, array $request = []) - { - $map = []; - foreach ($privateRequestMap as $key) { - if (isset($this->_globalMap[$key])) { - $map[$this->_globalMap[$key]] = $key; - } - } - $result = Varien_Object_Mapper::accumulateByMap([$this, 'getDataUsingMethod'], $request, $map); - foreach ($privateRequestMap as $key) { - if (isset($this->_exportToRequestFilters[$key]) && isset($result[$key])) { - $callback = $this->_exportToRequestFilters[$key]; - $privateKey = $result[$key]; - $publicKey = $map[$this->_globalMap[$key]]; - $result[$key] = call_user_func([$this, $callback], $privateKey, $publicKey); - } - } - return $result; - } - - /** - * Import $this public data from a private response array - */ - protected function _importFromResponse(array $privateResponseMap, array $response) - { - $map = []; - foreach ($privateResponseMap as $key) { - if (isset($this->_globalMap[$key])) { - $map[$key] = $this->_globalMap[$key]; - } - if (isset($response[$key]) && isset($this->_importFromRequestFilters[$key])) { - $callback = $this->_importFromRequestFilters[$key]; - $response[$key] = call_user_func([$this, $callback], $response[$key], $key, $map[$key]); - } - } - Varien_Object_Mapper::accumulateByMap($response, [$this, 'setDataUsingMethod'], $map); - } - - /** - * Prepare line items request - * - * Returns true if there were line items added - * - * @param int $i - * @return bool - */ - protected function _exportLineItems(array &$request, $i = 0) - { - if (!$this->_cart) { - return false; - } - - // always add cart totals, even if line items are not requested - if ($this->_lineItemTotalExportMap) { - foreach ($this->_cart->getTotals() as $key => $total) { - if (isset($this->_lineItemTotalExportMap[$key])) { // !empty($total) - $privateKey = $this->_lineItemTotalExportMap[$key]; - $request[$privateKey] = $this->_filterAmount($total); - } - } - } - - // add cart line items - $items = $this->_cart->getItems(); - if (empty($items) || !$this->getIsLineItemsEnabled()) { - return false; - } - $result = false; - foreach ($items as $item) { - foreach ($this->_lineItemExportItemsFormat as $publicKey => $privateFormat) { - $result = true; - $value = $item->getDataUsingMethod($publicKey); - if (isset($this->_lineItemExportItemsFilters[$publicKey])) { - $callback = $this->_lineItemExportItemsFilters[$publicKey]; - $value = call_user_func([$this, $callback], $value); - } - if (is_float($value)) { - $value = $this->_filterAmount($value); - } - $request[sprintf($privateFormat, $i)] = $value; - } - $i++; - } - return $result; - } - - /** - * Prepare shipping options request - * Returns false if there are no shipping options - * - * @param int $i - * @return bool - */ - protected function _exportShippingOptions(array &$request, $i = 0) - { - $options = $this->getShippingOptions(); - if (empty($options)) { - return false; - } - foreach ($options as $option) { - foreach ($this->_shippingOptionsExportItemsFormat as $publicKey => $privateFormat) { - $value = $option->getDataUsingMethod($publicKey); - if (is_float($value)) { - $value = $this->_filterAmount($value); - } - if (is_bool($value)) { - $value = $this->_filterBool($value); - } - $request[sprintf($privateFormat, $i)] = $value; - } - $i++; - } - return true; - } - - /** - * Filter amounts in API calls - * @param float|string $value - * @return string - */ - protected function _filterAmount($value) - { - return sprintf('%.2F', $value); - } - - /** - * Filter boolean values in API calls - * - * @param mixed $value - * @return string - */ - protected function _filterBool($value) - { - return ($value) ? 'true' : 'false'; - } - - /** - * Filter int values in API calls - * - * @param mixed $value - * @return int - */ - protected function _filterInt($value) - { - return (int) $value; - } - - /** - * Unified getter that looks in data or falls back to config - * - * @param string $key - * @param mixed $default - * @return mixed - */ - protected function _getDataOrConfig($key, $default = null) - { - if ($this->hasData($key)) { - return $this->getData($key); - } - return $this->_config->$key ? $this->_config->$key : $default; - } - - /** - * region_id workaround: PayPal requires state code, try to find one in the address - * - * @return string - */ - protected function _lookupRegionCodeFromAddress(Varien_Object $address) - { - if ($regionId = $address->getData('region_id')) { - $region = Mage::getModel('directory/region')->load($regionId); - if ($region->getId()) { - return $region->getCode(); - } - } - return ''; - } - - /** - * Street address workaround: divides address lines into parts by specified keys - * (keys should go as 3rd, 4th[...] parameters) - */ - protected function _importStreetFromAddress(Varien_Object $address, array &$to) - { - $keys = func_get_args(); - array_shift($keys); - array_shift($keys); - $street = $address->getStreet(); - if (!$keys || !$street || !is_array($street)) { - return; - } - - $street = Mage::helper('customer/address') - ->convertStreetLines($address->getStreet(), count($keys)); - - $i = 0; - foreach ($keys as $key) { - $to[$key] = $street[$i] ?? ''; - $i++; - } - } - - /** - * Build query string from request - * - * @param array $request - * @return string - */ - protected function _buildQuery($request) - { - return http_build_query($request); - } - - /** - * Filter qty in API calls - * Paypal note: The value for quantity must be a positive integer. Null, zero, or negative numbers are not allowed. - * - * @param float|string|int $value - * @return int - */ - protected function _filterQty($value) - { - return (int) $value; - } - - /** - * Log debug data to file - * - * @param mixed $debugData - */ - protected function _debug($debugData) - { - if ($this->getDebugFlag()) { - Mage::getModel('core/log_adapter', 'payment_' . $this->_config->getMethodCode() . '.log') - ->setFilterDataKeys($this->_debugReplacePrivateDataKeys) - ->log($debugData); - } - } - - /** - * Define if debugging is enabled - * - * @return bool - */ - public function getDebugFlag() - { - return $this->_config->debug; - } - - /** - * Check whether API certificate authentication should be used - * - * @return bool - */ - public function getUseCertAuthentication() - { - return (bool) $this->_config->apiAuthentication; - } -} diff --git a/app/code/core/Mage/Paypal/Model/Api/Nvp.php b/app/code/core/Mage/Paypal/Model/Api/Nvp.php deleted file mode 100644 index 97e001377b3..00000000000 --- a/app/code/core/Mage/Paypal/Model/Api/Nvp.php +++ /dev/null @@ -1,1565 +0,0 @@ - 'version', - 'USER' => 'api_username', - 'PWD' => 'api_password', - 'SIGNATURE' => 'api_signature', - 'BUTTONSOURCE' => 'build_notation_code', - - // for Unilateral payments - 'SUBJECT' => 'business_account', - - // commands - 'PAYMENTACTION' => 'payment_action', - 'RETURNURL' => 'return_url', - 'CANCELURL' => 'cancel_url', - 'INVNUM' => 'inv_num', - 'TOKEN' => 'token', - 'CORRELATIONID' => 'correlation_id', - 'SOLUTIONTYPE' => 'solution_type', - 'GIROPAYCANCELURL' => 'giropay_cancel_url', - 'GIROPAYSUCCESSURL' => 'giropay_success_url', - 'BANKTXNPENDINGURL' => 'giropay_bank_txn_pending_url', - 'IPADDRESS' => 'ip_address', - 'NOTIFYURL' => 'notify_url', - 'RETURNFMFDETAILS' => 'fraud_management_filters_enabled', - 'NOTE' => 'note', - 'REFUNDTYPE' => 'refund_type', - 'ACTION' => 'action', - 'REDIRECTREQUIRED' => 'redirect_required', - 'SUCCESSPAGEREDIRECTREQUESTED' => 'redirect_requested', - 'REQBILLINGADDRESS' => 'require_billing_address', - // style settings - 'PAGESTYLE' => 'page_style', - 'HDRIMG' => 'hdrimg', - 'HDRBORDERCOLOR' => 'hdrbordercolor', - 'HDRBACKCOLOR' => 'hdrbackcolor', - 'PAYFLOWCOLOR' => 'payflowcolor', - 'LOCALECODE' => 'locale_code', - 'PAL' => 'pal', - 'USERSELECTEDFUNDINGSOURCE' => 'funding_source', - - // transaction info - 'TRANSACTIONID' => 'transaction_id', - 'AUTHORIZATIONID' => 'authorization_id', - 'REFUNDTRANSACTIONID' => 'refund_transaction_id', - 'COMPLETETYPE' => 'complete_type', - 'AMT' => 'amount', - 'ITEMAMT' => 'subtotal_amount', - 'GROSSREFUNDAMT' => 'refunded_amount', // possible mistake, check with API reference - - // payment/billing info - 'CURRENCYCODE' => 'currency_code', - 'PAYMENTSTATUS' => 'payment_status', - 'PENDINGREASON' => 'pending_reason', - 'PROTECTIONELIGIBILITY' => 'protection_eligibility', - 'PAYERID' => 'payer_id', - 'PAYERSTATUS' => 'payer_status', - 'ADDRESSID' => 'address_id', - 'ADDRESSSTATUS' => 'address_status', - 'EMAIL' => 'email', - // backwards compatibility - 'FIRSTNAME' => 'firstname', - 'LASTNAME' => 'lastname', - - // shipping rate - 'SHIPPINGOPTIONNAME' => 'shipping_rate_code', - 'NOSHIPPING' => 'suppress_shipping', - - // paypal direct credit card information - 'CREDITCARDTYPE' => 'credit_card_type', - 'ACCT' => 'credit_card_number', - 'EXPDATE' => 'credit_card_expiration_date', - 'CVV2' => 'credit_card_cvv2', - 'STARTDATE' => 'maestro_solo_issue_date', // MMYYYY, always six chars, including leading zero - 'ISSUENUMBER' => 'maestro_solo_issue_number', - 'CVV2MATCH' => 'cvv2_check_result', - 'AVSCODE' => 'avs_result', - // cardinal centinel - 'AUTHSTATUS3DS' => 'centinel_authstatus', - 'MPIVENDOR3DS' => 'centinel_mpivendor', - 'CAVV' => 'centinel_cavv', - 'ECI3DS' => 'centinel_eci', - 'XID' => 'centinel_xid', - 'VPAS' => 'centinel_vpas_result', - 'ECISUBMITTED3DS' => 'centinel_eci_result', - - // recurring payment profiles - //'TOKEN' => 'token', - 'SUBSCRIBERNAME' => 'subscriber_name', - 'PROFILESTARTDATE' => 'start_datetime', - 'PROFILEREFERENCE' => 'internal_reference_id', - 'DESC' => 'schedule_description', - 'MAXFAILEDPAYMENTS' => 'suspension_threshold', - 'AUTOBILLAMT' => 'bill_failed_later', - 'BILLINGPERIOD' => 'period_unit', - 'BILLINGFREQUENCY' => 'period_frequency', - 'TOTALBILLINGCYCLES' => 'period_max_cycles', - //'AMT' => 'billing_amount', // have to use 'amount', see above - 'TRIALBILLINGPERIOD' => 'trial_period_unit', - 'TRIALBILLINGFREQUENCY' => 'trial_period_frequency', - 'TRIALTOTALBILLINGCYCLES' => 'trial_period_max_cycles', - 'TRIALAMT' => 'trial_billing_amount', - // 'CURRENCYCODE' => 'currency_code', - 'SHIPPINGAMT' => 'shipping_amount', - 'TAXAMT' => 'tax_amount', - 'INITAMT' => 'init_amount', - 'FAILEDINITAMTACTION' => 'init_may_fail', - 'PROFILEID' => 'recurring_profile_id', - 'PROFILESTATUS' => 'recurring_profile_status', - 'STATUS' => 'status', - - //Next two fields are used for Brazil only - 'TAXID' => 'buyer_tax_id', - 'TAXIDTYPE' => 'buyer_tax_id_type', - - 'BILLINGAGREEMENTID' => 'billing_agreement_id', - 'REFERENCEID' => 'reference_id', - 'BILLINGAGREEMENTSTATUS' => 'billing_agreement_status', - 'BILLINGTYPE' => 'billing_type', - 'SREET' => 'street', - 'CITY' => 'city', - 'STATE' => 'state', - 'COUNTRYCODE' => 'countrycode', - 'ZIP' => 'zip', - 'PAYERBUSINESS' => 'payer_business', - ]; - - /** - * Filter callbacks for preparing internal amounts to NVP request - * - * @var array - */ - protected $_exportToRequestFilters = [ - 'AMT' => '_filterAmount', - 'ITEMAMT' => '_filterAmount', - 'TRIALAMT' => '_filterAmount', - 'SHIPPINGAMT' => '_filterAmount', - 'TAXAMT' => '_filterAmount', - 'INITAMT' => '_filterAmount', - 'CREDITCARDTYPE' => '_filterCcType', - 'AUTOBILLAMT' => '_filterBillFailedLater', - 'BILLINGPERIOD' => '_filterPeriodUnit', - 'TRIALBILLINGPERIOD' => '_filterPeriodUnit', - 'FAILEDINITAMTACTION' => '_filterInitialAmountMayFail', - 'BILLINGAGREEMENTSTATUS' => '_filterBillingAgreementStatus', - 'NOSHIPPING' => '_filterInt', - ]; - - protected $_importFromRequestFilters = [ - 'REDIRECTREQUIRED' => '_filterToBool', - 'SUCCESSPAGEREDIRECTREQUESTED' => '_filterToBool', - 'PAYMENTSTATUS' => '_filterPaymentStatusFromNvpToInfo', - ]; - - /** - * Request map for each API call - * @var array - */ - protected $_eachCallRequest = ['VERSION', 'USER', 'PWD', 'SIGNATURE', 'BUTTONSOURCE',]; - - /** - * SetExpressCheckout request/response map - * @var array - */ - protected $_setExpressCheckoutRequest = [ - 'PAYMENTACTION', 'AMT', 'CURRENCYCODE', 'RETURNURL', 'CANCELURL', 'INVNUM', 'SOLUTIONTYPE', 'NOSHIPPING', - 'GIROPAYCANCELURL', 'GIROPAYSUCCESSURL', 'BANKTXNPENDINGURL', - 'PAGESTYLE', 'HDRIMG', 'HDRBORDERCOLOR', 'HDRBACKCOLOR', 'PAYFLOWCOLOR', 'LOCALECODE', - 'BILLINGTYPE', 'SUBJECT', 'ITEMAMT', 'SHIPPINGAMT', 'TAXAMT', 'REQBILLINGADDRESS', - 'USERSELECTEDFUNDINGSOURCE', - ]; - protected $_setExpressCheckoutResponse = ['TOKEN']; - - /** - * GetExpressCheckoutDetails request/response map - * @var array - */ - protected $_getExpressCheckoutDetailsRequest = ['TOKEN', 'SUBJECT',]; - - /** - * DoExpressCheckoutPayment request/response map - * @var array - */ - protected $_doExpressCheckoutPaymentRequest = [ - 'TOKEN', 'PAYERID', 'PAYMENTACTION', 'AMT', 'CURRENCYCODE', 'IPADDRESS', 'BUTTONSOURCE', 'NOTIFYURL', - 'RETURNFMFDETAILS', 'SUBJECT', 'ITEMAMT', 'SHIPPINGAMT', 'TAXAMT', - ]; - protected $_doExpressCheckoutPaymentResponse = [ - 'TRANSACTIONID', 'AMT', 'PAYMENTSTATUS', 'PENDINGREASON', 'REDIRECTREQUIRED', - ]; - - /** - * DoDirectPayment request/response map - * @var array - */ - protected $_doDirectPaymentRequest = [ - 'PAYMENTACTION', 'IPADDRESS', 'RETURNFMFDETAILS', - 'AMT', 'CURRENCYCODE', 'INVNUM', 'NOTIFYURL', 'EMAIL', 'ITEMAMT', 'SHIPPINGAMT', 'TAXAMT', - 'CREDITCARDTYPE', 'ACCT', 'EXPDATE', 'CVV2', 'STARTDATE', 'ISSUENUMBER', - 'AUTHSTATUS3DS', 'MPIVENDOR3DS', 'CAVV', 'ECI3DS', 'XID', - ]; - protected $_doDirectPaymentResponse = [ - 'TRANSACTIONID', 'AMT', 'AVSCODE', 'CVV2MATCH', 'VPAS', 'ECISUBMITTED3DS', - ]; - - /** - * DoReauthorization request/response map - * @var array - */ - protected $_doReauthorizationRequest = ['AUTHORIZATIONID', 'AMT', 'CURRENCYCODE']; - protected $_doReauthorizationResponse = [ - 'AUTHORIZATIONID', 'PAYMENTSTATUS', 'PENDINGREASON', 'PROTECTIONELIGIBILITY', - ]; - - /** - * DoCapture request/response map - * @var array - */ - protected $_doCaptureRequest = ['AUTHORIZATIONID', 'COMPLETETYPE', 'AMT', 'CURRENCYCODE', 'NOTE', 'INVNUM',]; - protected $_doCaptureResponse = ['TRANSACTIONID', 'CURRENCYCODE', 'AMT', 'PAYMENTSTATUS', 'PENDINGREASON',]; - - /** - * DoAuthorization request/response map - * @var array - */ - protected $_doAuthorizationRequest = ['TRANSACTIONID', 'AMT', 'CURRENCYCODE']; - protected $_doAuthorizationResponse = ['TRANSACTIONID', 'AMT']; - - /** - * DoVoid request map - * @var array - */ - protected $_doVoidRequest = ['AUTHORIZATIONID', 'NOTE',]; - - /** - * GetTransactionDetailsRequest - * @var array - */ - protected $_getTransactionDetailsRequest = ['TRANSACTIONID']; - protected $_getTransactionDetailsResponse = [ - 'PAYERID', 'FIRSTNAME', 'LASTNAME', 'TRANSACTIONID', 'PARENTTRANSACTIONID', 'CURRENCYCODE', 'AMT', - 'PAYMENTSTATUS', 'PENDINGREASON', - ]; - - /** - * RefundTransaction request/response map - * @var array - */ - protected $_refundTransactionRequest = ['TRANSACTIONID', 'REFUNDTYPE', 'CURRENCYCODE', 'NOTE',]; - protected $_refundTransactionResponse = ['REFUNDTRANSACTIONID', 'GROSSREFUNDAMT',]; - - /** - * ManagePendingTransactionStatus request/response map - */ - protected $_managePendingTransactionStatusRequest = ['TRANSACTIONID', 'ACTION']; - protected $_managePendingTransactionStatusResponse = ['TRANSACTIONID', 'STATUS']; - - /** - * GetPalDetails response map - * @var array - */ - protected $_getPalDetailsResponse = ['PAL']; - - /** - * CreateRecurringPaymentsProfile request/response map - * - * @var array - */ - protected $_createRecurringPaymentsProfileRequest = [ - 'TOKEN', 'SUBSCRIBERNAME', 'PROFILESTARTDATE', 'PROFILEREFERENCE', 'DESC', 'MAXFAILEDPAYMENTS', 'AUTOBILLAMT', - 'BILLINGPERIOD', 'BILLINGFREQUENCY', 'TOTALBILLINGCYCLES', 'AMT', 'TRIALBILLINGPERIOD', 'TRIALBILLINGFREQUENCY', - 'TRIALTOTALBILLINGCYCLES', 'TRIALAMT', 'CURRENCYCODE', 'SHIPPINGAMT', 'TAXAMT', 'INITAMT', 'FAILEDINITAMTACTION', - ]; - protected $_createRecurringPaymentsProfileResponse = [ - 'PROFILEID', 'PROFILESTATUS', - ]; - - /** - * Request/response for ManageRecurringPaymentsProfileStatus map - * - * @var array - */ - protected $_manageRecurringPaymentsProfileStatusRequest = ['PROFILEID', 'ACTION']; - // protected $_manageRecurringPaymentsProfileStatusResponse = array('PROFILEID'); - - /** - * Request/response for GetRecurringPaymentsProfileDetails - * - * @var array - */ - protected $_getRecurringPaymentsProfileDetailsRequest = ['PROFILEID']; - protected $_getRecurringPaymentsProfileDetailsResponse = ['STATUS', /* TODO: lot of other stuff */]; - - /** - * Map for billing address import/export - * @var array - */ - protected $_billingAddressMap = [ - 'BUSINESS' => 'company', - 'NOTETEXT' => 'customer_notes', - 'EMAIL' => 'email', - 'FIRSTNAME' => 'firstname', - 'LASTNAME' => 'lastname', - 'MIDDLENAME' => 'middlename', - 'SALUTATION' => 'prefix', - 'SUFFIX' => 'suffix', - - 'COUNTRYCODE' => 'country_id', // iso-3166 two-character code - 'STATE' => 'region', - 'CITY' => 'city', - 'STREET' => 'street', - 'STREET2' => 'street2', - 'ZIP' => 'postcode', - 'PHONENUM' => 'telephone', - ]; - - /** - * Map for billing address to do request (not response) - * Merging with $_billingAddressMap - * - * @var array - */ - protected $_billingAddressMapRequest = []; - - /** - * Map for shipping address import/export (extends billing address mapper) - * @var array - */ - protected $_shippingAddressMap = [ - 'SHIPTOCOUNTRYCODE' => 'country_id', - 'SHIPTOSTATE' => 'region', - 'SHIPTOCITY' => 'city', - 'SHIPTOSTREET' => 'street', - 'SHIPTOSTREET2' => 'street2', - 'SHIPTOZIP' => 'postcode', - 'SHIPTOPHONENUM' => 'telephone', - // 'SHIPTONAME' will be treated manually in address import/export methods - ]; - - /** - * Map for callback request - * @var array - */ - protected $_callbackRequestMap = [ - 'SHIPTOCOUNTRY' => 'country_id', - 'SHIPTOSTATE' => 'region', - 'SHIPTOCITY' => 'city', - 'SHIPTOSTREET' => 'street', - 'SHIPTOSTREET2' => 'street2', - 'SHIPTOZIP' => 'postcode', - ]; - - /** - * Payment information response specifically to be collected after some requests - * @var array - */ - protected $_paymentInformationResponse = [ - 'PAYERID', 'PAYERSTATUS', 'CORRELATIONID', 'ADDRESSID', 'ADDRESSSTATUS', - 'PAYMENTSTATUS', 'PENDINGREASON', 'PROTECTIONELIGIBILITY', 'EMAIL', 'SHIPPINGOPTIONNAME', 'TAXID', 'TAXIDTYPE', - ]; - - /** - * Line items export mapping settings - * @var array - */ - protected $_lineItemTotalExportMap = [ - Mage_Paypal_Model_Cart::TOTAL_SUBTOTAL => 'ITEMAMT', - Mage_Paypal_Model_Cart::TOTAL_TAX => 'TAXAMT', - Mage_Paypal_Model_Cart::TOTAL_SHIPPING => 'SHIPPINGAMT', - ]; - protected $_lineItemExportItemsFormat = [ - 'id' => 'L_NUMBER%d', - 'name' => 'L_NAME%d', - 'qty' => 'L_QTY%d', - 'amount' => 'L_AMT%d', - ]; - - /** - * Shipping options export to request mapping settings - * @var array - */ - protected $_shippingOptionsExportItemsFormat = [ - 'is_default' => 'L_SHIPPINGOPTIONISDEFAULT%d', - 'amount' => 'L_SHIPPINGOPTIONAMOUNT%d', - 'code' => 'L_SHIPPINGOPTIONNAME%d', - 'name' => 'L_SHIPPINGOPTIONLABEL%d', - 'tax_amount' => 'L_TAXAMT%d', - ]; - - /** - * init Billing Agreement request/response map - * @var array - */ - protected $_customerBillingAgreementRequest = ['RETURNURL', 'CANCELURL', 'BILLINGTYPE']; - protected $_customerBillingAgreementResponse = ['TOKEN']; - - /** - * Billing Agreement details request/response map - * @var array - */ - protected $_billingAgreementCustomerDetailsRequest = ['TOKEN']; - protected $_billingAgreementCustomerDetailsResponse = ['EMAIL', 'PAYERID', 'PAYERSTATUS', 'SHIPTOCOUNTRYCODE', - 'PAYERBUSINESS', - ]; - - /** - * Create Billing Agreement request/response map - * @var array - */ - protected $_createBillingAgreementRequest = ['TOKEN']; - protected $_createBillingAgreementResponse = ['BILLINGAGREEMENTID']; - - /** - * Update Billing Agreement request/response map - * @var array - */ - protected $_updateBillingAgreementRequest = [ - 'REFERENCEID', 'BILLINGAGREEMENTDESCRIPTION', 'BILLINGAGREEMENTSTATUS', 'BILLINGAGREEMENTCUSTOM', - ]; - protected $_updateBillingAgreementResponse = [ - 'REFERENCEID', 'BILLINGAGREEMENTDESCRIPTION', 'BILLINGAGREEMENTSTATUS', 'BILLINGAGREEMENTCUSTOM', - ]; - - /** - * Do Reference Transaction request/response map - * - * @var array - */ - protected $_doReferenceTransactionRequest = ['REFERENCEID', 'PAYMENTACTION', 'AMT', 'ITEMAMT', 'SHIPPINGAMT', - 'TAXAMT', 'INVNUM', 'NOTIFYURL', 'CURRENCYCODE', - ]; - - protected $_doReferenceTransactionResponse = ['BILLINGAGREEMENTID', 'TRANSACTIONID']; - - /** - * Fields that should be replaced in debug with '***' - * - * @var array - */ - protected $_debugReplacePrivateDataKeys = [ - - 'ACCT', 'EXPDATE', 'CVV2', 'CARDISSUE', 'CARDSTART', 'CREDITCARDTYPE', 'USER', 'PWD', 'SIGNATURE', - - ]; - - /** - * Map of credit card types supported by this API - * @var array - */ - protected $_supportedCcTypes = [ - 'VI' => 'Visa', 'MC' => 'MasterCard', 'DI' => 'Discover', 'AE' => 'Amex', 'SM' => 'Maestro', 'SO' => 'Solo']; - - /** - * Required fields in the response - * - * @var array - */ - protected $_requiredResponseParams = [ - self::DO_DIRECT_PAYMENT => ['ACK', 'CORRELATIONID', 'AMT'], - self::DO_EXPRESS_CHECKOUT_PAYMENT => ['ACK', 'CORRELATIONID'], - ]; - - /** - * Warning codes recollected after each API call - * - * @var array - */ - protected $_callWarnings = []; - - /** - * Error codes recollected after each API call - * - * @var array - */ - protected $_callErrors = []; - - /** - * Whether to return raw response information after each call - * - * @var bool - */ - protected $_rawResponseNeeded = false; - - /** - * API call HTTP headers - * - * @var array - */ - protected $_headers = []; - - /** - * API endpoint getter - * - * @return string - */ - public function getApiEndpoint() - { - $url = $this->getUseCertAuthentication() ? 'https://api%s.paypal.com/nvp' : 'https://api-3t%s.paypal.com/nvp'; - return sprintf($url, $this->_config->sandboxFlag ? '.sandbox' : ''); - } - - /** - * Return Paypal Api version - * - * @return string - */ - public function getVersion() - { - return '72.0'; - } - - /** - * Retrieve billing agreement type - * - * @return string - */ - public function getBillingAgreementType() - { - return 'MerchantInitiatedBilling'; - } - - /** - * SetExpressCheckout call - * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_SetExpressCheckout - * TODO: put together style and giropay settings - */ - public function callSetExpressCheckout() - { - $this->_prepareExpressCheckoutCallRequest($this->_setExpressCheckoutRequest); - $request = $this->_exportToRequest($this->_setExpressCheckoutRequest); - $this->_exportLineItems($request); - - // import/suppress shipping address, if any - $options = $this->getShippingOptions(); - if ($this->getAddress()) { - $request = $this->_importAddresses($request); - $request['ADDROVERRIDE'] = 1; - } elseif ($options && (count($options) <= 10)) { // doesn't support more than 10 shipping options - $request['CALLBACK'] = $this->getShippingOptionsCallbackUrl(); - $request['CALLBACKTIMEOUT'] = 6; // max value - $request['MAXAMT'] = $request['AMT'] + 999.00; // it is impossible to calculate max amount - $this->_exportShippingOptions($request); - } - - // add recurring profiles information - $i = 0; - foreach ($this->_recurringPaymentProfiles as $profile) { - $request["L_BILLINGTYPE{$i}"] = 'RecurringPayments'; - $request["L_BILLINGAGREEMENTDESCRIPTION{$i}"] = $profile->getScheduleDescription(); - $i++; - } - - $response = $this->call(self::SET_EXPRESS_CHECKOUT, $request); - $this->_importFromResponse($this->_setExpressCheckoutResponse, $response); - } - - /** - * GetExpressCheckoutDetails call - * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_GetExpressCheckoutDetails - */ - public function callGetExpressCheckoutDetails() - { - $this->_prepareExpressCheckoutCallRequest($this->_getExpressCheckoutDetailsRequest); - $request = $this->_exportToRequest($this->_getExpressCheckoutDetailsRequest); - $response = $this->call(self::GET_EXPRESS_CHECKOUT_DETAILS, $request); - $this->_importFromResponse($this->_paymentInformationResponse, $response); - $this->_exportAddressses($response); - } - - /** - * DoExpressCheckout call - * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_DoExpressCheckoutPayment - */ - public function callDoExpressCheckoutPayment() - { - $this->_prepareExpressCheckoutCallRequest($this->_doExpressCheckoutPaymentRequest); - $request = $this->_exportToRequest($this->_doExpressCheckoutPaymentRequest); - $this->_exportLineItems($request); - - $response = $this->call(self::DO_EXPRESS_CHECKOUT_PAYMENT, $request); - $this->_importFromResponse($this->_paymentInformationResponse, $response); - $this->_importFromResponse($this->_doExpressCheckoutPaymentResponse, $response); - $this->_importFromResponse($this->_createBillingAgreementResponse, $response); - } - - /** - * Process a credit card payment - */ - public function callDoDirectPayment() - { - $request = $this->_exportToRequest($this->_doDirectPaymentRequest); - $this->_exportLineItems($request); - if ($this->getAddress()) { - $request = $this->_importAddresses($request); - } - $response = $this->call(self::DO_DIRECT_PAYMENT, $request); - $this->_importFromResponse($this->_doDirectPaymentResponse, $response); - } - - /** - * Do Reference Transaction call - * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_DoReferenceTransaction - */ - public function callDoReferenceTransaction() - { - $request = $this->_exportToRequest($this->_doReferenceTransactionRequest); - $this->_exportLineItems($request); - $response = $this->call('DoReferenceTransaction', $request); - $this->_importFromResponse($this->_doReferenceTransactionResponse, $response); - } - - /** - * Check whether the last call was returned with fraud warning - * - * @return bool - */ - public function getIsFraudDetected() - { - return in_array(11610, $this->_callWarnings); - } - - /** - * Made additional request to paypal to get autharization id - */ - public function callDoReauthorization() - { - $request = $this->_export($this->_doReauthorizationRequest); - $response = $this->call('DoReauthorization', $request); - $this->_import($response, $this->_doReauthorizationResponse); - } - - /** - * DoCapture call - * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_DoCapture - */ - public function callDoCapture() - { - $this->setCompleteType($this->_getCaptureCompleteType()); - $request = $this->_exportToRequest($this->_doCaptureRequest); - $response = $this->call(self::DO_CAPTURE, $request); - $this->_importFromResponse($this->_paymentInformationResponse, $response); - $this->_importFromResponse($this->_doCaptureResponse, $response); - } - - /** - * DoAuthorization call - * - * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_DoAuthorization - * @return $this - */ - public function callDoAuthorization() - { - $request = $this->_exportToRequest($this->_doAuthorizationRequest); - $response = $this->call(self::DO_AUTHORIZATION, $request); - $this->_importFromResponse($this->_paymentInformationResponse, $response); - $this->_importFromResponse($this->_doAuthorizationResponse, $response); - - return $this; - } - - /** - * DoVoid call - * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_DoVoid - */ - public function callDoVoid() - { - $request = $this->_exportToRequest($this->_doVoidRequest); - $this->call(self::DO_VOID, $request); - } - - /** - * GetTransactionDetails - * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_GetTransactionDetails - */ - public function callGetTransactionDetails() - { - $request = $this->_exportToRequest($this->_getTransactionDetailsRequest); - $response = $this->call('GetTransactionDetails', $request); - $this->_importFromResponse($this->_getTransactionDetailsResponse, $response); - } - - /** - * RefundTransaction call - * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_RefundTransaction - */ - public function callRefundTransaction() - { - $request = $this->_exportToRequest($this->_refundTransactionRequest); - if ($this->getRefundType() === Mage_Paypal_Model_Config::REFUND_TYPE_PARTIAL) { - $request['AMT'] = $this->getAmount(); - } - $response = $this->call(self::REFUND_TRANSACTION, $request); - $this->_importFromResponse($this->_refundTransactionResponse, $response); - } - - /** - * ManagePendingTransactionStatus - * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_ManagePendingTransactionStatus - */ - public function callManagePendingTransactionStatus() - { - $request = $this->_exportToRequest($this->_managePendingTransactionStatusRequest); - if (isset($request['ACTION'])) { - $request['ACTION'] = $this->_filterPaymentReviewAction($request['ACTION']); - } - $response = $this->call('ManagePendingTransactionStatus', $request); - $this->_importFromResponse($this->_managePendingTransactionStatusResponse, $response); - } - - /** - * getPalDetails call - * @link https://www.x.com/docs/DOC-1300 - * @link https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_ECButtonIntegration - */ - public function callGetPalDetails() - { - $response = $this->call('getPalDetails', []); - $this->_importFromResponse($this->_getPalDetailsResponse, $response); - } - - /** - * Set Customer BillingA greement call - * - * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_SetCustomerBillingAgreement - */ - public function callSetCustomerBillingAgreement() - { - $request = $this->_exportToRequest($this->_customerBillingAgreementRequest); - $response = $this->call('SetCustomerBillingAgreement', $request); - $this->_importFromResponse($this->_customerBillingAgreementResponse, $response); - } - - /** - * Get Billing Agreement Customer Details call - * - * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_GetBillingAgreementCustomerDetails - */ - public function callGetBillingAgreementCustomerDetails() - { - $request = $this->_exportToRequest($this->_billingAgreementCustomerDetailsRequest); - $response = $this->call('GetBillingAgreementCustomerDetails', $request); - $this->_importFromResponse($this->_billingAgreementCustomerDetailsResponse, $response); - } - - /** - * Create Billing Agreement call - * - */ - public function callCreateBillingAgreement() - { - $request = $this->_exportToRequest($this->_createBillingAgreementRequest); - $response = $this->call('CreateBillingAgreement', $request); - $this->_importFromResponse($this->_createBillingAgreementResponse, $response); - } - - /** - * Billing Agreement Update call - * - */ - public function callUpdateBillingAgreement() - { - $request = $this->_exportToRequest($this->_updateBillingAgreementRequest); - try { - $response = $this->call('BillAgreementUpdate', $request); - } catch (Mage_Core_Exception $e) { - if (in_array(10201, $this->_callErrors)) { - $this->setIsBillingAgreementAlreadyCancelled(true); - } - throw $e; - } - $this->_importFromResponse($this->_updateBillingAgreementResponse, $response); - } - - /** - * CreateRecurringPaymentsProfile call - */ - public function callCreateRecurringPaymentsProfile() - { - $request = $this->_exportToRequest($this->_createRecurringPaymentsProfileRequest); - $response = $this->call('CreateRecurringPaymentsProfile', $request); - $this->_importFromResponse($this->_createRecurringPaymentsProfileResponse, $response); - $this->_analyzeRecurringProfileStatus($this->getRecurringProfileStatus(), $this); - } - - /** - * ManageRecurringPaymentsProfileStatus call - */ - public function callManageRecurringPaymentsProfileStatus() - { - $request = $this->_exportToRequest($this->_manageRecurringPaymentsProfileStatusRequest); - if (isset($request['ACTION'])) { - $request['ACTION'] = $this->_filterRecurringProfileActionToNvp($request['ACTION']); - } - try { - $response = $this->call('ManageRecurringPaymentsProfileStatus', $request); - } catch (Mage_Core_Exception $e) { - if ((in_array(11556, $this->_callErrors) && $request['ACTION'] === 'Cancel') - || (in_array(11557, $this->_callErrors) && $request['ACTION'] === 'Suspend') - || (in_array(11558, $this->_callErrors) && $request['ACTION'] === 'Reactivate') - ) { - Mage::throwException(Mage::helper('paypal')->__('Unable to change status. Current status is not correspond to real status.')); - } - throw $e; - } - } - - /** - * GetRecurringPaymentsProfileDetails call - */ - public function callGetRecurringPaymentsProfileDetails(Varien_Object $result) - { - $request = $this->_exportToRequest($this->_getRecurringPaymentsProfileDetailsRequest); - $response = $this->call('GetRecurringPaymentsProfileDetails', $request); - $this->_importFromResponse($this->_getRecurringPaymentsProfileDetailsResponse, $response); - $this->_analyzeRecurringProfileStatus($this->getStatus(), $result); - } - - /** - * Import callback request array into $this public data - * - * @return Varien_Object - */ - public function prepareShippingOptionsCallbackAddress(array $request) - { - $address = new Varien_Object(); - Varien_Object_Mapper::accumulateByMap($request, $address, $this->_callbackRequestMap); - $address->setExportedKeys(array_values($this->_callbackRequestMap)); - $this->_applyStreetAndRegionWorkarounds($address); - return $address; - } - - /** - * Prepare response for shipping options callback - * - * @return string - */ - public function formatShippingOptionsCallback() - { - $response = []; - if (!$this->_exportShippingOptions($response)) { - $response['NO_SHIPPING_OPTION_DETAILS'] = '1'; - } - $response = $this->_addMethodToRequest(self::CALLBACK_RESPONSE, $response); - return $this->_buildQuery($response); - } - - /** - * Add method to request array - * - * @param string $methodName - * @param array $request - * @return array - */ - protected function _addMethodToRequest($methodName, $request) - { - $request['METHOD'] = $methodName; - return $request; - } - - /** - * Do the API call - * - * @param string $methodName - * @return array - * @throws Mage_Core_Exception - */ - public function call($methodName, array $request) - { - $request = $this->_addMethodToRequest($methodName, $request); - $eachCallRequest = $this->_prepareEachCallRequest($methodName); - if ($this->getUseCertAuthentication()) { - if ($key = array_search('SIGNATURE', $eachCallRequest)) { - unset($eachCallRequest[$key]); - } - } - $request = $this->_exportToRequest($eachCallRequest, $request); - $debugData = ['url' => $this->getApiEndpoint(), $methodName => $request]; - - try { - $http = new Varien_Http_Adapter_Curl(); - $config = [ - 'timeout' => 60, - 'verifypeer' => $this->_config->verifyPeer, - ]; - - if ($this->getUseProxy()) { - $config['proxy'] = $this->getProxyHost() . ':' . $this->getProxyPort(); - } - if ($this->getUseCertAuthentication()) { - $config['ssl_cert'] = $this->getApiCertificate(); - } - $http->setConfig($config); - $http->write( - Zend_Http_Client::POST, - $this->getApiEndpoint(), - '1.1', - $this->_headers, - $this->_buildQuery($request), - ); - $response = $http->read(); - } catch (Exception $e) { - $debugData['http_error'] = ['error' => $e->getMessage(), 'code' => $e->getCode()]; - $this->_debug($debugData); - throw $e; - } - - $response = preg_split('/^\r?$/m', $response, 2); - $response = trim($response[1]); - $response = $this->_deformatNVP($response); - - $debugData['response'] = $response; - $this->_debug($debugData); - $response = $this->_postProcessResponse($response); - - // handle transport error - if ($http->getErrno()) { - Mage::logException(new Exception( - sprintf('PayPal NVP CURL connection error #%s: %s', $http->getErrno(), $http->getError()), - )); - $http->close(); - - Mage::throwException(Mage::helper('paypal')->__('Unable to communicate with the PayPal gateway.')); - } - - // cUrl resource must be closed after checking it for errors - $http->close(); - - if (!$this->_validateResponse($methodName, $response)) { - Mage::logException(new Exception( - Mage::helper('paypal')->__("PayPal response hasn't required fields."), - )); - Mage::throwException(Mage::helper('paypal')->__('There was an error processing your order. Please contact us or try again later.')); - } - - $this->_callErrors = []; - if ($this->_isCallSuccessful($response)) { - if ($this->_rawResponseNeeded) { - $this->setRawSuccessResponseData($response); - } - return $response; - } - $this->_handleCallErrors($response); - return $response; - } - - /** - * Setter for 'raw response needed' flag - * - * @param bool $flag - * @return $this - */ - public function setRawResponseNeeded($flag) - { - $this->_rawResponseNeeded = $flag; - return $this; - } - - /** - * Handle logical errors - * - * @param array $response - * @throws Mage_Core_Exception - */ - protected function _handleCallErrors($response) - { - $errors = $this->_extractErrorsFromResponse($response); - $errorsCount = count($errors); - - if (!$errorsCount) { - return; - } - - $exceptionCode = 0; - - if ($errorsCount == 1 && $this->_isProcessableError($errors[0]['code'])) { - $exceptionCode = $errors[0]['code']; - $exceptionClass = 'Mage_Paypal_Model_Api_ProcessableException'; - } else { - $exceptionClass = 'Mage_Core_Exception'; - } - - $errorMessages = []; - - foreach ($errors as $error) { - $errorMessages[] = $error['message']; - $this->_callErrors[] = $error['code']; - } - - $errorMessages = implode(' ', array_values($errorMessages)); - $exceptionLogMessage = sprintf( - 'PayPal NVP gateway errors: %s Correlation ID: %s. Version: %s.', - $errorMessages, - $response['CORRELATIONID'] ?? '', - $response['VERSION'] ?? '', - ); - - $exception = new $exceptionClass($exceptionLogMessage, $exceptionCode); - Mage::logException($exception); - - $exception->setMessage(Mage::helper('paypal')->__('PayPal gateway has rejected request. %s', $errorMessages)); - - throw $exception; - } - - /** - * Format error message from error code, short error message and long error message - * - * @param string $errorCode - * @param string $shortErrorMessage - * @param string $longErrorMessage - * @return string - */ - protected function _formatErrorMessage($errorCode, $shortErrorMessage, $longErrorMessage) - { - $longErrorMessage = preg_replace('/\.$/', '', $longErrorMessage); - $shortErrorMessage = preg_replace('/\.$/', '', $shortErrorMessage); - - return $longErrorMessage ? sprintf('%s (#%s: %s).', $longErrorMessage, $errorCode, $shortErrorMessage) - : sprintf('#%s: %s.', $errorCode, $shortErrorMessage); - } - - /** - * Check whether PayPal error can be processed - * - * @param int $errorCode - * @return bool - */ - protected function _isProcessableError($errorCode) - { - $processableErrorsList = $this->getProcessableErrors(); - - if (!$processableErrorsList || !is_array($processableErrorsList)) { - return false; - } - - return in_array($errorCode, $processableErrorsList); - } - - /** - * Extract errors from PayPal's response and return them in array - * - * @param array $response - * @return array - */ - protected function _extractErrorsFromResponse($response) - { - $errors = []; - - for ($i = 0; isset($response["L_ERRORCODE{$i}"]); $i++) { - $errorCode = $response["L_ERRORCODE{$i}"]; - $errorMessage = $this->_formatErrorMessage( - $errorCode, - $response["L_SHORTMESSAGE{$i}"], - $response["L_LONGMESSAGE{$i}"], - ); - $errors[] = [ - 'code' => $errorCode, - 'message' => $errorMessage, - ]; - } - - return $errors; - } - - /** - * Catch success calls and collect warnings - * - * @param array $response - * @return bool success flag - */ - protected function _isCallSuccessful($response) - { - if (!isset($response['ACK'])) { - return false; - } - - $ack = strtoupper($response['ACK']); - $this->_callWarnings = []; - if ($ack == 'SUCCESS' || $ack == 'SUCCESSWITHWARNING') { - // collect warnings - if ($ack == 'SUCCESSWITHWARNING') { - for ($i = 0; isset($response["L_ERRORCODE{$i}"]); $i++) { - $this->_callWarnings[] = $response["L_ERRORCODE{$i}"]; - } - } - return true; - } - return false; - } - - /** - * Validate response array. - * - * @param string $method - * @param array $response - * @return bool - */ - protected function _validateResponse($method, $response) - { - if (isset($this->_requiredResponseParams[$method])) { - foreach ($this->_requiredResponseParams[$method] as $param) { - if (!isset($response[$param])) { - Mage::log("Expected PayPal field not found in NVP Response: $param"); - return false; - } - } - } - return true; - } - - /** - * Parse an NVP response string into an associative array - * @param string $nvpstr - * @return array - */ - protected function _deformatNVP($nvpstr) - { - $intial = 0; - $nvpArray = []; - - $nvpstr = str_contains($nvpstr, "\r\n\r\n") ? substr($nvpstr, strpos($nvpstr, "\r\n\r\n") + 4) : $nvpstr; - - while (strlen($nvpstr)) { - //position of Key - $keypos = strpos($nvpstr, '='); - //position of value - $valuepos = strpos($nvpstr, '&') ? strpos($nvpstr, '&') : strlen($nvpstr); - - /*getting the Key and Value values and storing in a Associative Array*/ - $keyval = substr($nvpstr, $intial, $keypos); - $valval = substr($nvpstr, $keypos + 1, $valuepos - $keypos - 1); - //decoding the response - $nvpArray[urldecode($keyval)] = urldecode($valval); - $nvpstr = substr($nvpstr, $valuepos + 1, strlen($nvpstr)); - } - return $nvpArray; - } - - /** - * NVP doesn't support passing discount total as a separate amount - add it as a line item - * - * @param int $i - * @return bool|void - */ - protected function _exportLineItems(array &$request, $i = 0) - { - if (!$this->_cart) { - return; - } - $this->_cart->isDiscountAsItem(true); - return parent::_exportLineItems($request, $i); - } - - /** - * Create billing and shipping addresses basing on response data - * @param array $data - */ - protected function _exportAddressses($data) - { - $address = new Varien_Object(); - Varien_Object_Mapper::accumulateByMap($data, $address, $this->_billingAddressMap); - $address->setExportedKeys(array_values($this->_billingAddressMap)); - $this->_applyStreetAndRegionWorkarounds($address); - $this->setExportedBillingAddress($address); - // assume there is shipping address if there is at least one field specific to shipping - if (isset($data['SHIPTONAME'])) { - $shippingAddress = clone $address; - Varien_Object_Mapper::accumulateByMap($data, $shippingAddress, $this->_shippingAddressMap); - $this->_applyStreetAndRegionWorkarounds($shippingAddress); - // PayPal doesn't provide detailed shipping name fields, so the name will be overwritten - $shippingAddress->addData([ - 'firstname' => $data['SHIPTONAME'], - ]); - $this->setExportedShippingAddress($shippingAddress); - } - } - - /** - * Adopt specified address object to be compatible with Magento - */ - protected function _applyStreetAndRegionWorkarounds(Varien_Object $address) - { - // merge street addresses into 1 - if ($address->hasStreet2()) { - $address->setStreet(implode("\n", [$address->getStreet(), $address->getStreet2()])); - $address->unsStreet2(); - } - // attempt to fetch region_id from directory - if ($address->getCountryId() && $address->getRegion()) { - $regions = Mage::getModel('directory/country')->loadByCode($address->getCountryId())->getRegionCollection() - ->addRegionCodeOrNameFilter($address->getRegion()) - ->setPageSize(1); - foreach ($regions as $region) { - $address->setRegionId($region->getId()); - $address->setExportedKeys(array_merge($address->getExportedKeys(), ['region_id'])); - break; - } - } - } - - /** - * Adopt specified request array to be compatible with Paypal - * Puerto Rico should be as state of USA and not as a country - * - * @param array $request - */ - protected function _applyCountryWorkarounds(&$request) - { - if (isset($request['SHIPTOCOUNTRYCODE']) && $request['SHIPTOCOUNTRYCODE'] == 'PR') { - $request['SHIPTOCOUNTRYCODE'] = 'US'; - $request['SHIPTOSTATE'] = 'PR'; - } - } - - /** - * Prepare request data basing on provided address - * - * @deprecated after 1.4.2.0-beta1, use _importAddresses() instead - * - * @return array - */ - protected function _importAddress(Varien_Object $address, array $to) - { - $this->setAddress($address); - return $this->_importAddresses($to); - } - - /** - * Prepare request data basing on provided addresses - * - * @return array - */ - protected function _importAddresses(array $to) - { - $billingAddress = ($this->getBillingAddress()) ? $this->getBillingAddress() : $this->getAddress(); - $shippingAddress = $this->getAddress(); - - $to = Varien_Object_Mapper::accumulateByMap( - $billingAddress, - $to, - array_merge(array_flip($this->_billingAddressMap), $this->_billingAddressMapRequest), - ); - if ($regionCode = $this->_lookupRegionCodeFromAddress($billingAddress)) { - $to['STATE'] = $regionCode; - } - if (!$this->getSuppressShipping()) { - $to = Varien_Object_Mapper::accumulateByMap($shippingAddress, $to, array_flip($this->_shippingAddressMap)); - if ($regionCode = $this->_lookupRegionCodeFromAddress($shippingAddress)) { - $to['SHIPTOSTATE'] = $regionCode; - } - $this->_importStreetFromAddress($shippingAddress, $to, 'SHIPTOSTREET', 'SHIPTOSTREET2'); - $this->_importStreetFromAddress($billingAddress, $to, 'STREET', 'STREET2'); - $to['SHIPTONAME'] = $shippingAddress->getName(); - } - $this->_applyCountryWorkarounds($to); - return $to; - } - - /** - * Filter for credit card type - * - * @param string $value - * @return string - */ - protected function _filterCcType($value) - { - return $this->_supportedCcTypes[$value] ?? ''; - } - - /** - * Filter for true/false values (converts to boolean) - * - * @param mixed $value - * @return mixed - */ - protected function _filterToBool($value) - { - if ($value === 'false' || $value === '0') { - return false; - } elseif ($value === 'true' || $value === '1') { - return true; - } - return $value; - } - - /** - * Filter for 'AUTOBILLAMT' - * - * @param string $value - * @return string - */ - protected function _filterBillFailedLater($value) - { - return $value ? 'AddToNextBilling' : 'NoAutoBill'; - } - - /** - * Filter for 'BILLINGPERIOD' and 'TRIALBILLINGPERIOD' - * - * @param string $value - * @return string|void - */ - protected function _filterPeriodUnit($value) - { - switch ($value) { - case 'day': - return 'Day'; - case 'week': - return 'Week'; - case 'semi_month': - return 'SemiMonth'; - case 'month': - return 'Month'; - case 'year': - return 'Year'; - } - } - - /** - * Filter for 'FAILEDINITAMTACTION' - * - * @param string $value - * @return string - */ - protected function _filterInitialAmountMayFail($value) - { - return $value ? 'ContinueOnFailure' : 'CancelOnFailure'; - } - - /** - * Filter for billing agreement status - * - * @param string $value - * @return string|void - */ - protected function _filterBillingAgreementStatus($value) - { - switch ($value) { - case 'canceled': - return 'Canceled'; - case 'active': - return 'Active'; - } - } - - /** - * Convert payment status from NVP format to paypal/info model format - * - * @param string $value - * @return string|void - */ - protected function _filterPaymentStatusFromNvpToInfo($value) - { - switch ($value) { - case 'None': - return Mage_Paypal_Model_Info::PAYMENTSTATUS_NONE; - case 'Completed': - return Mage_Paypal_Model_Info::PAYMENTSTATUS_COMPLETED; - case 'Denied': - return Mage_Paypal_Model_Info::PAYMENTSTATUS_DENIED; - case 'Expired': - return Mage_Paypal_Model_Info::PAYMENTSTATUS_EXPIRED; - case 'Failed': - return Mage_Paypal_Model_Info::PAYMENTSTATUS_FAILED; - case 'In-Progress': - return Mage_Paypal_Model_Info::PAYMENTSTATUS_INPROGRESS; - case 'Pending': - return Mage_Paypal_Model_Info::PAYMENTSTATUS_PENDING; - case 'Refunded': - return Mage_Paypal_Model_Info::PAYMENTSTATUS_REFUNDED; - case 'Partially-Refunded': - return Mage_Paypal_Model_Info::PAYMENTSTATUS_REFUNDEDPART; - case 'Reversed': - return Mage_Paypal_Model_Info::PAYMENTSTATUS_REVERSED; - case 'Canceled-Reversal': - return Mage_Paypal_Model_Info::PAYMENTSTATUS_UNREVERSED; - case 'Processed': - return Mage_Paypal_Model_Info::PAYMENTSTATUS_PROCESSED; - case 'Voided': - return Mage_Paypal_Model_Info::PAYMENTSTATUS_VOIDED; - } - } - - /** - * Convert payment review action to NVP-compatible value - * - * @param string $value - * @return string|void - */ - protected function _filterPaymentReviewAction($value) - { - switch ($value) { - case Mage_Paypal_Model_Pro::PAYMENT_REVIEW_ACCEPT: - return 'Accept'; - case Mage_Paypal_Model_Pro::PAYMENT_REVIEW_DENY: - return 'Deny'; - } - } - - /** - * Convert RP management action to NVP format - * - * @param string $value - * @return string|void - */ - protected function _filterRecurringProfileActionToNvp($value) - { - switch ($value) { - case 'cancel': - return 'Cancel'; - case 'suspend': - return 'Suspend'; - case 'activate': - return 'Reactivate'; - } - } - - /** - * Check the obtained RP status in NVP format and specify the profile state - * - * @param string $value - */ - protected function _analyzeRecurringProfileStatus($value, Varien_Object $result) - { - switch ($value) { - case 'ActiveProfile': - case 'Active': - $result->setIsProfileActive(true); - break; - case 'PendingProfile': - $result->setIsProfilePending(true); - break; - case 'CancelledProfile': - case 'Cancelled': - $result->setIsProfileCanceled(true); - break; - case 'SuspendedProfile': - case 'Suspended': - $result->setIsProfileSuspended(true); - break; - case 'ExpiredProfile': - case 'Expired': // ?? - $result->setIsProfileExpired(true); - break; - } - } - - /** - * Return capture type - * - * @return string - */ - protected function _getCaptureCompleteType() - { - return ($this->getIsCaptureComplete()) - ? $this->_captureTypeComplete - : $this->_captureTypeNotcomplete; - } - - /** - * Return each call request without unused fields in case of Express Checkout Unilateral payments - * - * @param string $methodName Current method name - * @return array - */ - protected function _prepareEachCallRequest($methodName) - { - $expressCheckooutMetods = [ - self::SET_EXPRESS_CHECKOUT, self::GET_EXPRESS_CHECKOUT_DETAILS, self::DO_EXPRESS_CHECKOUT_PAYMENT, - ]; - if (!in_array($methodName, $expressCheckooutMetods) || !$this->_config->shouldUseUnilateralPayments()) { - return $this->_eachCallRequest; - } - return array_diff($this->_eachCallRequest, ['USER', 'PWD', 'SIGNATURE']); - } - - /** - * Check the EC request against unilateral payments mode and remove the SUBJECT if needed - * - * @param array $requestFields - */ - protected function _prepareExpressCheckoutCallRequest(&$requestFields) - { - if (!$this->_config->shouldUseUnilateralPayments()) { - if ($key = array_search('SUBJECT', $requestFields)) { - unset($requestFields[$key]); - } - } - } - - /** - * Additional response processing. - * Hack to cut off length from API type response params. - * - * @param array $response - * @return array - */ - protected function _postProcessResponse($response) - { - foreach ($response as $key => $value) { - $pos = strpos($key, '['); - - if ($pos === false) { - continue; - } - - unset($response[$key]); - - if ($pos !== 0) { - $modifiedKey = substr($key, 0, $pos); - $response[$modifiedKey] = $value; - } - } - - return $response; - } -} diff --git a/app/code/core/Mage/Paypal/Model/Api/ProcessableException.php b/app/code/core/Mage/Paypal/Model/Api/ProcessableException.php deleted file mode 100644 index 4fb87dc0bca..00000000000 --- a/app/code/core/Mage/Paypal/Model/Api/ProcessableException.php +++ /dev/null @@ -1,43 +0,0 @@ -getCode()) { - self::API_INTERNAL_ERROR, self::API_UNABLE_PROCESS_PAYMENT_ERROR_CODE => Mage::helper('paypal')->__("I'm sorry - but we were not able to process your payment. Please try another payment method or contact us so we can assist you."), - self::API_COUNTRY_FILTER_DECLINE, self::API_MAXIMUM_AMOUNT_FILTER_DECLINE, self::API_OTHER_FILTER_DECLINE => Mage::helper('paypal')->__("I'm sorry - but we are not able to complete your transaction. Please contact us so we can assist you."), - default => $this->getMessage(), - }; - } -} diff --git a/app/code/core/Mage/Paypal/Model/Api/Standard.php b/app/code/core/Mage/Paypal/Model/Api/Standard.php deleted file mode 100644 index 0ba7e8094e8..00000000000 --- a/app/code/core/Mage/Paypal/Model/Api/Standard.php +++ /dev/null @@ -1,234 +0,0 @@ - 'business_account', - 'notify_url' => 'notify_url', - 'return' => 'return_url', - 'cancel_return' => 'cancel_url', - 'bn' => 'build_notation_code', - 'paymentaction' => 'payment_action', - // payment - 'invoice' => 'order_id', - 'currency_code' => 'currency_code', - 'amount' => 'amount', - 'shipping' => 'shipping_amount', - 'tax' => 'tax_amount', - 'discount_amount' => 'discount_amount', - // misc - 'item_name' => 'cart_summary', - // page design settings - 'page_style' => 'page_style', - 'cpp_header_image' => 'hdrimg', - 'cpp_headerback_color' => 'hdrbackcolor', - 'cpp_headerborder_color' => 'hdrbordercolor', - 'cpp_payflow_color' => 'payflowcolor', - 'lc' => 'locale', - ]; - protected $_exportToRequestFilters = [ - 'amount' => '_filterAmount', - 'shipping' => '_filterAmount', - 'tax' => '_filterAmount', - 'discount_amount' => '_filterAmount', - ]; - - /** - * Interface for common and "aggregated order" specific fields - * @var array - */ - protected $_commonRequestFields = [ - 'business', 'invoice', 'currency_code', 'paymentaction', 'return', 'cancel_return', 'notify_url', 'bn', - 'page_style', 'cpp_header_image', 'cpp_headerback_color', 'cpp_headerborder_color', 'cpp_payflow_color', - 'amount', 'shipping', 'tax', 'discount_amount', 'item_name', 'lc', - ]; - - /** - * Fields that should be replaced in debug with '***' - * - * @var array - */ - protected $_debugReplacePrivateDataKeys = ['business']; - - /** - * Line items export mapping settings - * @var array - */ - protected $_lineItemTotalExportMap = [ - Mage_Paypal_Model_Cart::TOTAL_SUBTOTAL => 'amount', - Mage_Paypal_Model_Cart::TOTAL_DISCOUNT => 'discount_amount', - Mage_Paypal_Model_Cart::TOTAL_TAX => 'tax', - Mage_Paypal_Model_Cart::TOTAL_SHIPPING => 'shipping', - ]; - protected $_lineItemExportItemsFormat = [ - 'id' => 'item_number_%d', - 'name' => 'item_name_%d', - 'qty' => 'quantity_%d', - 'amount' => 'amount_%d', - ]; - - protected $_lineItemExportItemsFilters = [ - 'qty' => '_filterQty', - ]; - - /** - * Address export to request map - * @var array - */ - protected $_addressMap = [ - 'city' => 'city', - 'country' => 'country_id', - 'email' => 'email', - 'first_name' => 'firstname', - 'last_name' => 'lastname', - 'zip' => 'postcode', - 'state' => 'region', - 'address1' => 'street', - 'address2' => 'street2', - ]; - - /** - * Generate PayPal Standard checkout request fields - * Depending on whether there are cart line items set, will aggregate everything or display items specifically - * Shipping amount in cart line items is implemented as a separate "fake" line item - */ - public function getStandardCheckoutRequest() - { - $request = $this->_exportToRequest($this->_commonRequestFields); - $request['charset'] = 'utf-8'; - - $isLineItems = $this->_exportLineItems($request); - if ($isLineItems) { - $request = array_merge($request, [ - 'cmd' => '_cart', - 'upload' => 1, - ]); - if (isset($request['tax'])) { - $request['tax_cart'] = $request['tax']; - } - if (isset($request['discount_amount'])) { - $request['discount_amount_cart'] = $request['discount_amount']; - } - } else { - $request = array_merge($request, [ - 'cmd' => '_ext-enter', - 'redirect_cmd' => '_xclick', - ]); - } - - // payer address - $this->_importAddress($request); - - return $request; - } - - /** - * Merchant account email getter - * @return string - */ - public function getBusinessAccount() - { - return $this->_getDataOrConfig('business_account'); - } - - /** - * Payment action getter - * @return string - */ - public function getPaymentAction() - { - return strtolower(parent::getPaymentAction()); - } - - /** - * @deprecated after 1.4.1.0 - * - * @param array $request - */ - public function debugRequest($request) {} - - /** - * Add shipping total as a line item. - * For some reason PayPal ignores shipping total variables exactly when line items is enabled - * Note that $i = 1 - * - * @param int $i - * @return bool - */ - protected function _exportLineItems(array &$request, $i = 1) - { - if (!$this->_cart) { - return false; - } - if ($this->getIsLineItemsEnabled()) { - $this->_cart->isShippingAsItem(true); - } - return parent::_exportLineItems($request, $i); - } - - /** - * Import address object, if set, to the request - * - * @param array|Varien_Object $request - */ - protected function _importAddress(&$request) - { - $address = $this->getAddress(); - if (!$address) { - if ($this->getNoShipping()) { - $request['no_shipping'] = 1; - } - return; - } - - $request = Varien_Object_Mapper::accumulateByMap($address, $request, array_flip($this->_addressMap)); - - // Address may come without email info (user is not always required to enter it), so add email from order - if (!$request['email']) { - $order = $this->getOrder(); - if ($order) { - $request['email'] = $order->getCustomerEmail(); - } - } - - $regionCode = $this->_lookupRegionCodeFromAddress($address); - if ($regionCode) { - $request['state'] = $regionCode; - } - $this->_importStreetFromAddress($address, $request, 'address1', 'address2'); - $this->_applyCountryWorkarounds($request); - - $request['address_override'] = 1; - } - - /** - * Adopt specified request array to be compatible with Paypal - * Puerto Rico should be as state of USA and not as a country - * - * @param array $request - */ - protected function _applyCountryWorkarounds(&$request) - { - if (isset($request['country']) && $request['country'] == 'PR') { - $request['country'] = 'US'; - $request['state'] = 'PR'; - } - } -} diff --git a/app/code/core/Mage/Paypal/Model/Bml.php b/app/code/core/Mage/Paypal/Model/Bml.php deleted file mode 100644 index 6bf8b1c8d8c..00000000000 --- a/app/code/core/Mage/Paypal/Model/Bml.php +++ /dev/null @@ -1,38 +0,0 @@ -_salesEntity = $salesEntity; + $this->_quote = $salesEntity; } else { throw new Exception('Invalid sales entity provided.'); } + $this->_validateCurrency(); } /** - * Getter for the current sales entity - * - * @return Mage_Sales_Model_Order - * @return Mage_Sales_Model_Quote + * Validates that the quote's currency is supported by PayPal. */ - public function getSalesEntity() + protected function _validateCurrency(): self { - return $this->_salesEntity; - } + $allowedCurrencies = Mage::getModel('paypal/config')->getAllowedCurrencyCodes(); + $currentCurrency = $this->_quote->getOrderCurrencyCode() + ?: $this->_quote->getQuoteCurrencyCode(); - /** - * Render and get line items - * By default returns false if the items are invalid - * - * @param bool $bypassValidation - * @return array|false - */ - public function getItems($bypassValidation = false) - { - $this->_render(); - if (!$bypassValidation && !$this->_areItemsValid) { - return false; - } - return $this->_items; - } - - /** - * Render and get totals - * If the totals are invalid for any reason, they will be merged into one amount (subtotal is utilized for it) - * An option to subtract discount from the subtotal is available - * - * @param bool $mergeDiscount - * @return array - */ - public function getTotals($mergeDiscount = false) - { - $this->_render(); - - // cut down totals to one total if they are invalid - if (!$this->_areTotalsValid) { - $totals = [ - self::TOTAL_SUBTOTAL => $this->_totals[self::TOTAL_SUBTOTAL] + $this->_totals[self::TOTAL_TAX], - ]; - if (!$this->_isShippingAsItem) { - $totals[self::TOTAL_SUBTOTAL] += $this->_totals[self::TOTAL_SHIPPING]; - } - if (!$this->_isDiscountAsItem) { - $totals[self::TOTAL_SUBTOTAL] -= $this->_totals[self::TOTAL_DISCOUNT]; - } - return $totals; - } elseif ($mergeDiscount) { - $totals = $this->_totals; - unset($totals[self::TOTAL_DISCOUNT]); - if (!$this->_isDiscountAsItem) { - $totals[self::TOTAL_SUBTOTAL] -= $this->_totals[self::TOTAL_DISCOUNT]; - } - return $totals; + if (!in_array($currentCurrency, $allowedCurrencies)) { + throw new Mage_Paypal_Model_Exception( + Mage::helper('paypal')->__('Selected currency code (%s) is not supported by PayPal', $currentCurrency), + ); } - return $this->_totals; + $this->_currency = $currentCurrency; + return $this; } /** - * Add a line item - * - * @param string $name - * @param numeric $qty - * @param float $amount - * @param string $identifier - * @return Varien_Object + * Retrieves all prepared items for the PayPal request. Items are prepared if not already. */ - public function addItem($name, $qty, $amount, $identifier = null) + public function getAllItems(): array { - $this->_shouldRender = true; - $item = new Varien_Object([ - 'name' => $name, - 'qty' => $qty, - 'amount' => (float) $amount, - ]); - if ($identifier) { - $item->setData('id', $identifier); + if (empty($this->_items)) { + $this->_prepareItems(); } - $this->_items[] = $item; - return $item; + return $this->_items; } /** - * Remove item from cart by identifier - * - * @param string $identifier - * @return bool + * Retrieves all prepared totals (subtotal, tax, shipping, discount). Totals are prepared if not already. */ - public function removeItem($identifier) + public function getAmounts(): array { - foreach ($this->_items as $key => $item) { - if ($item->getId() == $identifier) { - unset($this->_items[$key]); - return true; - } + if (empty($this->_totals)) { + $this->_prepareTotals(); } - return false; + return $this->_totals; } /** - * Compound the specified amount with the specified total - * - * @param string $code - * @param float $amount - * @param string $lineItemDescription - * @return $this + * Prepares the line items from the quote for the PayPal API request. */ - public function updateTotal($code, $amount, $lineItemDescription = null) + protected function _prepareItems(): self { - $this->_shouldRender = true; - if (isset($this->_totals[$code])) { - $this->_totals[$code] += $amount; - if ($lineItemDescription) { - $this->_totalLineItemDescriptions[$code][] = $lineItemDescription; - } - } - return $this; - } + foreach ($this->_quote->getAllVisibleItems() as $item) { + $taxAmount = $item->getData('tax_amount'); + $qty = $item->getQty(); + $moneyBuilder = MoneyBuilder::init( + $this->_currency, + number_format($item->getCalculationPrice(), 2, '.', ''), + ); - /** - * Get/Set whether to render the discount total as a line item - * - * @param bool $setValue - * @return bool|$this - */ - public function isDiscountAsItem($setValue = null) - { - return $this->_totalAsItem('_isDiscountAsItem', $setValue); - } + $taxMoneyBuilder = ($taxAmount > 0) + ? MoneyBuilder::init($this->_currency, number_format($taxAmount / $qty, 2, '.', '')) + : null; - /** - * Get/Set whether to render the discount total as a line item - * - * @param bool $setValue - * @return bool|$this - */ - public function isShippingAsItem($setValue = null) - { - return $this->_totalAsItem('_isShippingAsItem', $setValue); - } + $itemBuilder = ItemBuilder::init($item->getName(), $moneyBuilder->build(), (string) $qty) + ->sku($item->getSku()) + ->category($item->getIsVirtual() ? ItemCategory::DIGITAL_GOODS : ItemCategory::PHYSICAL_GOODS); - /** - * (re)Render all items and totals - */ - protected function _render() - { - if (!$this->_shouldRender) { - return; - } - - // regular items from the sales entity - $this->_items = []; - foreach ($this->_salesEntity->getAllItems() as $item) { - if (!$item->getParentItem()) { - $this->_addRegularItem($item); + if ($taxMoneyBuilder) { + $itemBuilder->tax($taxMoneyBuilder->build()); } - } - $lastRegularItemKey = array_key_last($this->_items); - - // regular totals - $shippingDescription = ''; - if ($this->_salesEntity instanceof Mage_Sales_Model_Order) { - $shippingDescription = $this->_salesEntity->getShippingDescription(); - $this->_totals = [ - self::TOTAL_SUBTOTAL => $this->_salesEntity->getBaseSubtotal(), - self::TOTAL_TAX => $this->_salesEntity->getBaseTaxAmount(), - self::TOTAL_SHIPPING => $this->_salesEntity->getBaseShippingAmount(), - self::TOTAL_DISCOUNT => abs($this->_salesEntity->getBaseDiscountAmount()), - ]; - $this->_applyHiddenTaxWorkaround($this->_salesEntity); - } else { - $address = $this->_salesEntity->getIsVirtual() ? - $this->_salesEntity->getBillingAddress() : $this->_salesEntity->getShippingAddress(); - $shippingDescription = $address->getShippingDescription(); - $this->_totals = [ - self::TOTAL_SUBTOTAL => $this->_salesEntity->getBaseSubtotal(), - self::TOTAL_TAX => $address->getBaseTaxAmount(), - self::TOTAL_SHIPPING => $address->getBaseShippingAmount(), - self::TOTAL_DISCOUNT => abs($address->getBaseDiscountAmount()), - ]; - $this->_applyHiddenTaxWorkaround($address); - } - $originalDiscount = $this->_totals[self::TOTAL_DISCOUNT]; - - // arbitrary items, total modifications - Mage::dispatchEvent('paypal_prepare_line_items', ['paypal_cart' => $this]); - - // distinguish original discount among the others - if ($originalDiscount > 0.0001 && isset($this->_totalLineItemDescriptions[self::TOTAL_DISCOUNT])) { - $this->_totalLineItemDescriptions[self::TOTAL_DISCOUNT][] = Mage::helper('sales')->__('Discount (%s)', Mage::app()->getStore()->convertPrice($originalDiscount, true, false)); - } - - // discount, shipping as items - if ($this->_isDiscountAsItem && $this->_totals[self::TOTAL_DISCOUNT]) { - $this->addItem( - Mage::helper('paypal')->__('Discount'), - 1, - -1.00 * $this->_totals[self::TOTAL_DISCOUNT], - $this->_renderTotalLineItemDescriptions(self::TOTAL_DISCOUNT), - ); - } - $shippingItemId = $this->_renderTotalLineItemDescriptions(self::TOTAL_SHIPPING, $shippingDescription); - if ($this->_isShippingAsItem && (float) $this->_totals[self::TOTAL_SHIPPING]) { - $this->addItem( - Mage::helper('paypal')->__('Shipping'), - 1, - (float) $this->_totals[self::TOTAL_SHIPPING], - $shippingItemId, - ); - } - - // compound non-regular items into subtotal - foreach ($this->_items as $key => $item) { - if ($key > $lastRegularItemKey && $item->getAmount() != 0) { - $this->_totals[self::TOTAL_SUBTOTAL] += $item->getAmount(); + $description = $item->getDescription(); + if ($description) { + $itemBuilder->description(substr((string) $description, 0, 127)); } + $this->_items[] = $itemBuilder->build(); } - $this->_validate(); - // if cart items are invalid, prepare cart for transfer without line items - if (!$this->_areItemsValid) { - $this->removeItem($shippingItemId); - } - - $this->_shouldRender = false; - } - - /** - * Merge multiple descriptions by a total code into a string - * - * @param string $code - * @param string $prepend - * @param string $append - * @param string $glue - * @return string - */ - protected function _renderTotalLineItemDescriptions($code, $prepend = '', $append = '', $glue = '; ') - { - $result = []; - if ($prepend) { - $result[] = $prepend; - } - if (isset($this->_totalLineItemDescriptions[$code])) { - $result = array_merge($this->_totalLineItemDescriptions[$code]); - } - if ($append) { - $result[] = $append; - } - return implode($glue, $result); - } - - /** - * Check the line items and totals according to PayPal business logic limitations - */ - protected function _validate() - { - $this->_areItemsValid = true; - $this->_areTotalsValid = false; - - $referenceAmount = $this->_salesEntity->getBaseGrandTotal(); - - $itemsSubtotal = 0; - foreach ($this->_items as $i) { - $itemsSubtotal = $itemsSubtotal + $i['qty'] * $i['amount']; - } - $sum = $itemsSubtotal + $this->_totals[self::TOTAL_TAX]; - if (!$this->_isShippingAsItem) { - $sum += $this->_totals[self::TOTAL_SHIPPING]; - } - if (!$this->_isDiscountAsItem) { - $sum -= $this->_totals[self::TOTAL_DISCOUNT]; - } - /** - * numbers are intentionally converted to strings because of possible comparison error - * see http://php.net/float - */ - // match sum of all the items and totals to the reference amount - if (sprintf('%.4F', $sum) != sprintf('%.4F', $referenceAmount)) { - $adjustment = $sum - $referenceAmount; - $this->_totals[self::TOTAL_SUBTOTAL] = $this->_totals[self::TOTAL_SUBTOTAL] - $adjustment; - } - - // PayPal requires to have discount less than items subtotal - if (!$this->_isDiscountAsItem) { - $this->_areTotalsValid = round($this->_totals[self::TOTAL_DISCOUNT], 4) < round($itemsSubtotal, 4); - } else { - $this->_areTotalsValid = $itemsSubtotal > 0.00001; - } - - $this->_areItemsValid = $this->_areItemsValid && $this->_areTotalsValid; - } - - /** - * Check whether items are valid - * - * @return bool - */ - public function areItemsValid() - { - return $this->_areItemsValid; - } - - /** - * Add a usual line item with amount and qty - * - * @return Varien_Object - */ - protected function _addRegularItem(Varien_Object $salesItem) - { - if ($this->_salesEntity instanceof Mage_Sales_Model_Order) { - // TODO: nominal item for order - $qty = (int) $salesItem->getQtyOrdered(); - $amount = (float) $salesItem->getBasePrice(); - } else { - $qty = (int) $salesItem->getTotalQty(); - $amount = $salesItem->isNominal() ? 0 : (float) $salesItem->getBaseCalculationPrice(); - } - // workaround in case if item subtotal precision is not compatible with PayPal (.2) - $subAggregatedLabel = ''; - if ($amount - round($amount, 2)) { - $amount = $amount * $qty; - $subAggregatedLabel = ' x' . $qty; - $qty = 1; - } - - // aggregate item price if item qty * price does not match row total - if ($amount * $qty != $salesItem->getBaseRowTotal()) { - $amount = (float) $salesItem->getBaseRowTotal(); - $subAggregatedLabel = ' x' . $qty; - $qty = 1; - } - - return $this->addItem($salesItem->getName() . $subAggregatedLabel, $qty, $amount, $salesItem->getSku()); + return $this; } /** - * Get/Set for the specified variable. - * If the value changes, the re-rendering is commenced - * - * @param string $var - * @param mixed $setValue - * @return mixed|$this - */ - private function _totalAsItem($var, $setValue = null) - { - if ($setValue !== null) { - if ($setValue != $this->$var) { - $this->_shouldRender = true; - } - $this->$var = $setValue; - return $this; - } - return $this->$var; - } + * Prepares the cart totals from the quote for the PayPal API request. + */ + protected function _prepareTotals(): self + { + $this->_quote->collectTotals()->save(); + $shippingAddress = $this->_quote->getShippingAddress(); + $totalDiscount = abs($shippingAddress->getDiscountAmount() ?? 0); + $this->_totals = [ + self::TOTAL_SUBTOTAL => MoneyBuilder::init( + $this->_currency, + number_format($this->_quote->getSubtotal(), 2, '.', ''), + )->build(), + self::TOTAL_TAX => MoneyBuilder::init( + $this->_currency, + number_format($shippingAddress->getTaxAmount() ?? 0, 2, '.', ''), + )->build(), + self::TOTAL_SHIPPING => MoneyBuilder::init( + $this->_currency, + number_format($shippingAddress->getShippingAmount() ?? 0, 2, '.', ''), + )->build(), + self::TOTAL_DISCOUNT => MoneyBuilder::init( + $this->_currency, + number_format($totalDiscount, 2, '.', ''), + )->build(), + ]; - /** - * Add "hidden" discount and shipping tax - * - * Go ahead, try to understand ]:-> - * - * Tax settings for getting "discount tax": - * - Catalog Prices = Including Tax - * - Apply Customer Tax = After Discount - * - Apply Discount on Prices = Including Tax - * - * Test case for getting "hidden shipping tax": - * - Make sure shipping is taxable (set shipping tax class) - * - Catalog Prices = Including Tax - * - Shipping Prices = Including Tax - * - Apply Customer Tax = After Discount - * - Create a shopping cart price rule with % discount applied to the Shipping Amount - * - run shopping cart and estimate shipping - * - go to PayPal - * - * @param Mage_Core_Model_Abstract $salesEntity - */ - private function _applyHiddenTaxWorkaround($salesEntity) - { - $this->_totals[self::TOTAL_TAX] += (float) $salesEntity->getBaseHiddenTaxAmount(); - $this->_totals[self::TOTAL_TAX] += (float) $salesEntity->getBaseShippingHiddenTaxAmount(); + return $this; } /** - * Check whether any item has negative amount - * - * @return bool + * Get the sales entity (quote or order) object associated with this cart. */ - public function hasNegativeItemAmount() + public function getQuote(): Mage_Sales_Model_Order|Mage_Sales_Model_Quote { - foreach ($this->_items as $item) { - if ($item->getAmount() < 0) { - return true; - } - } - return false; + return $this->_quote; } } diff --git a/app/code/core/Mage/Paypal/Model/Cert.php b/app/code/core/Mage/Paypal/Model/Cert.php deleted file mode 100644 index 15225ae87c6..00000000000 --- a/app/code/core/Mage/Paypal/Model/Cert.php +++ /dev/null @@ -1,115 +0,0 @@ -_init('paypal/cert'); - } - - /** - * Load model by website id - * - * @param int $websiteId - * @param bool $strictLoad - * @return $this - */ - public function loadByWebsite($websiteId, $strictLoad = true) - { - $this->setWebsiteId($websiteId); - $this->_getResource()->loadByWebsite($this, $strictLoad); - return $this; - } - - /** - * Get path to PayPal certificate file, if file does not exist try to create it - * - * @return string - */ - public function getCertPath() - { - if (!$this->getContent()) { - Mage::throwException(Mage::helper('paypal')->__('PayPal certificate does not exist.')); - } - - $certFileName = sprintf('cert_%s_%s.pem', $this->getWebsiteId(), strtotime($this->getUpdatedAt())); - $certFile = $this->_getBaseDir() . DS . $certFileName; - - if (!file_exists($certFile)) { - $this->_createCertFile($certFile); - } - return $certFile; - } - - /** - * Create physical certificate file based on DB data - * - * @param string $file - */ - protected function _createCertFile($file) - { - $certDir = $this->_getBaseDir(); - if (!is_dir($certDir)) { - $ioAdapter = new Varien_Io_File(); - $ioAdapter->checkAndCreateFolder($certDir); - } else { - $this->_removeOutdatedCertFile(); - } - - file_put_contents($file, Mage::helper('core')->decrypt($this->getContent())); - } - - /** - * Check and remove outdated certificate file by website - */ - protected function _removeOutdatedCertFile() - { - $certDir = $this->_getBaseDir(); - if (is_dir($certDir)) { - $entries = scandir($certDir); - foreach ($entries as $entry) { - if ($entry != '.' && $entry != '..' && str_contains($entry, 'cert_' . $this->getWebsiteId())) { - unlink($certDir . DS . $entry); - } - } - } - } - - /** - * Retrieve base directory for certificate - * - * @return string - */ - protected function _getBaseDir() - { - return Mage::getBaseDir('var') . DS . self::BASEPATH_PAYPAL_CERT; - } - - /** - * Delete assigned certificate file after delete object - * - * @return $this - */ - protected function _afterDelete() - { - $this->_removeOutdatedCertFile(); - return $this; - } -} diff --git a/app/code/core/Mage/Paypal/Model/Config.php b/app/code/core/Mage/Paypal/Model/Config.php index bbd80be6aa6..6b5d5a65ce5 100644 --- a/app/code/core/Mage/Paypal/Model/Config.php +++ b/app/code/core/Mage/Paypal/Model/Config.php @@ -7,243 +7,41 @@ * @package Mage_Paypal */ -/** - * Config model that is aware of all Mage_Paypal payment methods - * Works with PayPal-specific system configuration - * - * @package Mage_Paypal - * - * @property mixed $allow_ba_signup; - * @property mixed $api_cert; - * @property mixed $api_password; - * @property mixed $api_signature; - * @property mixed $api_username; - * @property mixed $apiAuthentication; - * @property mixed $apiPassword; - * @property mixed $apiSignature; - * @property mixed $apiUsername; - * @property mixed $business_account; - * @property mixed $businessAccount; - * @property mixed $buttonFlavor; - * @property mixed $buttonType; - * @property mixed $cctypes; - * @property mixed $debug; - * @property mixed $lineItemsEnabled; - * @property mixed $lineItemsSummary; - * @property mixed $payment_action; - * @property mixed $paymentAction; - * @property mixed $paymentMarkSize; - * @property mixed $requireBillingAddress; - * @property mixed $sandboxFlag; - * @property mixed $solutionType; - * @property mixed $transferShippingOptions; - * @property mixed $verifyPeer; - * @property mixed $visible_on_cart; - * @property mixed $visible_on_product; - */ -class Mage_Paypal_Model_Config -{ - /** - * PayPal Standard - * @var string - */ - public const METHOD_WPS = 'paypal_standard'; - - /** - * US locale - */ - public const LOCALE_US = 'en_US'; - - /** - * PayPal Website Payments Pro - Express Checkout - * @var string - */ - public const METHOD_WPP_EXPRESS = 'paypal_express'; - - /** - * PayPal Bill Me Later - Express Checkout - * @var string - */ - public const METHOD_BML = 'paypal_express_bml'; - - /** - * PayPal Website Payments Pro - Direct Payments - * @var string - */ - public const METHOD_WPP_DIRECT = 'paypal_direct'; - - /** - * Direct Payments (Payflow Edition) - * @var string - */ - public const METHOD_WPP_PE_DIRECT = 'paypaluk_direct'; - - /** - * PayPal Bill Me Later - Express Checkout (Payflow Edition) - * @var string - */ - public const METHOD_WPP_PE_BML = 'paypaluk_express_bml'; - - /** - * Express Checkout (Payflow Edition) - * @var string - */ - public const METHOD_WPP_PE_EXPRESS = 'paypaluk_express'; - - /** - * Payflow Pro Gateway - * @var string - */ - public const METHOD_PAYFLOWPRO = 'verisign'; - - public const METHOD_PAYFLOWLINK = 'payflow_link'; - public const METHOD_PAYFLOWADVANCED = 'payflow_advanced'; - - public const METHOD_HOSTEDPRO = 'hosted_pro'; - - public const METHOD_BILLING_AGREEMENT = 'paypal_billing_agreement'; - - /** - * Buttons and images - * @var string - */ - public const EC_FLAVOR_DYNAMIC = 'dynamic'; - public const EC_FLAVOR_STATIC = 'static'; - public const EC_BUTTON_TYPE_SHORTCUT = 'ecshortcut'; - public const EC_BUTTON_TYPE_MARK = 'ecmark'; - public const PAYMENT_MARK_37X23 = '37x23'; - public const PAYMENT_MARK_50X34 = '50x34'; - public const PAYMENT_MARK_60X38 = '60x38'; - public const PAYMENT_MARK_180X113 = '180x113'; - - public const DEFAULT_LOGO_TYPE = 'wePrefer_150x60'; - - /** - * Payment actions - * @var string - */ - public const PAYMENT_ACTION_SALE = 'Sale'; - public const PAYMENT_ACTION_ORDER = 'Order'; - public const PAYMENT_ACTION_AUTH = 'Authorization'; - - /** - * Authorization amounts for Account Verification - * - * @deprecated since 1.6.2.0 - * @var int - */ - public const AUTHORIZATION_AMOUNT_ZERO = 0; - public const AUTHORIZATION_AMOUNT_ONE = 1; - public const AUTHORIZATION_AMOUNT_FULL = 2; - - /** - * Require Billing Address - * @var int - */ - public const REQUIRE_BILLING_ADDRESS_NO = 0; - public const REQUIRE_BILLING_ADDRESS_ALL = 1; - public const REQUIRE_BILLING_ADDRESS_VIRTUAL = 2; - - /** - * Fraud management actions - * @var string - */ - public const FRAUD_ACTION_ACCEPT = 'Acept'; - public const FRAUD_ACTION_DENY = 'Deny'; - - /** - * Refund types - * @var string - */ - public const REFUND_TYPE_FULL = 'Full'; - public const REFUND_TYPE_PARTIAL = 'Partial'; - - /** - * Express Checkout flows - * @var string - */ - public const EC_SOLUTION_TYPE_SOLE = 'Sole'; - public const EC_SOLUTION_TYPE_MARK = 'Mark'; - - /** - * Payment data transfer methods (Standard) - * - * @var string - */ - public const WPS_TRANSPORT_IPN = 'ipn'; - public const WPS_TRANSPORT_PDT = 'pdt'; - public const WPS_TRANSPORT_IPN_PDT = 'ipn_n_pdt'; - - /** - * Billing Agreement Signup - * - * @var string - */ - public const EC_BA_SIGNUP_AUTO = 'auto'; - public const EC_BA_SIGNUP_ASK = 'ask'; - public const EC_BA_SIGNUP_NEVER = 'never'; +declare(strict_types=1); - /** - * Config path for enabling/disabling order review step in express checkout - */ - public const XML_PATH_PAYPAL_EXPRESS_SKIP_ORDER_REVIEW_STEP_FLAG = 'payment/paypal_express/skip_order_review_step'; - - public const XML_PATH_PAYMENT_SECTION = 'payment/'; - - /** - * Default URL for centinel API (PayPal Direct) - * - * @var string - */ - public $centinelDefaultApiUrl = 'https://paypal.cardinalcommerce.com/maps/txns.asp'; - - /** - * Current payment method code - * @var string|null - */ - protected $_methodCode = null; +class Mage_Paypal_Model_Config extends Varien_Object +{ + public const BUTTON_SHAPE_RECT = 'rect'; + public const BUTTON_SHAPE_PILL = 'pill'; + public const BUTTON_SHAPE_SHARP = 'sharp'; - /** - * Current store id - * - * @var int - */ - protected $_storeId = null; + public const BUTTON_COLOR_GOLD = 'gold'; + public const BUTTON_COLOR_BLUE = 'blue'; + public const BUTTON_COLOR_SILVER = 'silver'; + public const BUTTON_COLOR_WHITE = 'white'; + public const BUTTON_COLOR_BLACK = 'black'; - /** - * Instructions for generating proper BN code - * - * @var array - */ - protected $_buildNotationPPMap = [ - 'paypal_standard' => 'WPS', - 'paypal_express' => 'EC', - 'paypal_direct' => 'DP', - 'paypaluk_express' => 'EC', - 'paypaluk_direct' => 'DP', - ]; + public const BUTTON_LAYOUT_VERTICAL = 'vertical'; + public const BUTTON_LAYOUT_HORIZONTAL = 'horizontal'; - /** - * Style system config map (Express Checkout) - * - * @var array - */ - protected $_ecStyleConfigMap = [ - 'page_style' => 'page_style', - 'paypal_hdrimg' => 'hdrimg', - 'paypal_hdrbordercolor' => 'hdrbordercolor', - 'paypal_hdrbackcolor' => 'hdrbackcolor', - 'paypal_payflowcolor' => 'payflowcolor', - ]; + public const BUTTON_LABEL_PAYPAL = 'paypal'; + public const BUTTON_LABEL_CHECKOUT = 'checkout'; + public const BUTTON_LABEL_BUYNOW = 'buynow'; + public const BUTTON_LABEL_PAY = 'pay'; + public const BUTTON_LABEL_INSTALLMENT = 'installment'; + protected $_cachedCredentials = null; /** - * Currency codes supported by PayPal methods + * Supported currencies for PayPal transactions + * https://developer.paypal.com/docs/reports/reference/paypal-supported-currencies/ * * @var array */ - protected $_supportedCurrencyCodes = [ + protected $_supportedCurrencies = [ 'AUD', + 'BRL', 'CAD', + 'CNY', 'CZK', 'DKK', 'EUR', @@ -251,1617 +49,114 @@ class Mage_Paypal_Model_Config 'HUF', 'ILS', 'JPY', + 'MYR', 'MXN', - 'NOK', + 'TWD', 'NZD', + 'NOK', + 'PHP', 'PLN', 'GBP', - 'RUB', 'SGD', 'SEK', 'CHF', - 'TWD', 'THB', 'USD', - 'INR', - ]; - - /** - * Merchant country supported by PayPal - * - * @var array - */ - protected $_supportedCountryCodes = [ - 'AE', - 'AR', - 'AT', - 'AU', - 'BE', - 'BG', - 'BR', - 'CA', - 'CN', - 'CH', - 'CL', - 'CR', - 'CY', - 'CZ', - 'DE', - 'DK', - 'DO', - 'EC', - 'EE', - 'ES', - 'FI', - 'FR', - 'GB', - 'GF', - 'GI', - 'GP', - 'GR', - 'HK', - 'HU', - 'ID', - 'IE', - 'IL', - 'IN', - 'IS', - 'IT', - 'JM', - 'JP', - 'KR', - 'LI', - 'LT', - 'LU', - 'LV', - 'MQ', - 'MT', - 'MX', - 'MY', - 'NL', - 'NO', - 'NZ', - 'PH', - 'PL', - 'PT', - 'RU', - 'RE', - 'RO', - 'SE', - 'SG', - 'SI', - 'SK', - 'SM', - 'TH', - 'TR', - 'TW', - 'US', - 'UY', - 'VE', - 'VN', - 'ZA', - ]; - - /** - * Buyer country supported by PayPal - * - * @var array - */ - protected $_supportedBuyerCountryCodes = [ - 'AF ', - 'AX ', - 'AL ', - 'DZ ', - 'AS ', - 'AD ', - 'AO ', - 'AI ', - 'AQ ', - 'AG ', - 'AR ', - 'AM ', - 'AW ', - 'AU ', - 'AT ', - 'AZ ', - 'BS ', - 'BH ', - 'BD ', - 'BB ', - 'BY ', - 'BE ', - 'BZ ', - 'BJ ', - 'BM ', - 'BT ', - 'BO ', - 'BA ', - 'BW ', - 'BV ', - 'BR ', - 'IO ', - 'BN ', - 'BG ', - 'BF ', - 'BI ', - 'KH ', - 'CM ', - 'CA ', - 'CV ', - 'KY ', - 'CF ', - 'TD ', - 'CL ', - 'CN ', - 'CX ', - 'CC ', - 'CO ', - 'KM ', - 'CG ', - 'CD ', - 'CK ', - 'CR ', - 'CI ', - 'HR ', - 'CU ', - 'CY ', - 'CZ ', - 'DK ', - 'DJ ', - 'DM ', - 'DO ', - 'EC ', - 'EG ', - 'SV ', - 'GQ ', - 'ER ', - 'EE ', - 'ET ', - 'FK ', - 'FO ', - 'FJ ', - 'FI ', - 'FR ', - 'GF ', - 'PF ', - 'TF ', - 'GA ', - 'GM ', - 'GE ', - 'DE ', - 'GH ', - 'GI ', - 'GR ', - 'GL ', - 'GD ', - 'GP ', - 'GU ', - 'GT ', - 'GG ', - 'GN ', - 'GW ', - 'GY ', - 'HT ', - 'HM ', - 'VA ', - 'HN ', - 'HK ', - 'HU ', - 'IS ', - 'IN ', - 'ID ', - 'IR ', - 'IQ ', - 'IE ', - 'IM ', - 'IL ', - 'IT ', - 'JM ', - 'JP ', - 'JE ', - 'JO ', - 'KZ ', - 'KE ', - 'KI ', - 'KP ', - 'KR ', - 'KW ', - 'KG ', - 'LA ', - 'LV ', - 'LB ', - 'LS ', - 'LR ', - 'LY ', - 'LI ', - 'LT ', - 'LU ', - 'MO ', - 'MK ', - 'MG ', - 'MW ', - 'MY ', - 'MV ', - 'ML ', - 'MT ', - 'MH ', - 'MQ ', - 'MR ', - 'MU ', - 'YT ', - 'MX ', - 'FM ', - 'MD ', - 'MC ', - 'MN ', - 'MS ', - 'MA ', - 'MZ ', - 'MM ', - 'NA ', - 'NR ', - 'NP ', - 'NL ', - 'AN ', - 'NC ', - 'NZ ', - 'NI ', - 'NE ', - 'NG ', - 'NU ', - 'NF ', - 'MP ', - 'NO ', - 'OM ', - 'PK ', - 'PW ', - 'PS ', - 'PA ', - 'PG ', - 'PY ', - 'PE ', - 'PH ', - 'PN ', - 'PL ', - 'PT ', - 'PR ', - 'QA ', - 'RE ', - 'RO ', - 'RU ', - 'RW ', - 'SH ', - 'KN ', - 'LC ', - 'PM ', - 'VC ', - 'WS ', - 'SM ', - 'ST ', - 'SA ', - 'SN ', - 'CS ', - 'SC ', - 'SL ', - 'SG ', - 'SK ', - 'SI ', - 'SB ', - 'SO ', - 'ZA ', - 'GS ', - 'ES ', - 'LK ', - 'SD ', - 'SR ', - 'SJ ', - 'SZ ', - 'SE ', - 'CH ', - 'SY ', - 'TW ', - 'TJ ', - 'TZ ', - 'TH ', - 'TL ', - 'TG ', - 'TK ', - 'TO ', - 'TT ', - 'TN ', - 'TR ', - 'TM ', - 'TC ', - 'TV ', - 'UG ', - 'UA ', - 'AE ', - 'GB ', - 'US ', - 'UM ', - 'UY ', - 'UZ ', - 'VU ', - 'VE ', - 'VN ', - 'VG ', - 'VI ', - 'WF ', - 'EH ', - 'YE ', - 'ZM ', - 'ZW', ]; /** - * Locale codes supported by misc images (marks, shortcuts etc) - * - * @var array - * @link https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_ECButtonIntegration#id089QD0O0TX4__id08AH904I0YK - */ - protected $_supportedImageLocales = [ - 'de_DE', - 'en_AU', - 'en_GB', - 'en_US', - 'es_ES', - 'es_XC', - 'fr_FR', - 'fr_XC', - 'it_IT', - 'ja_JP', - 'nl_NL', - 'pl_PL', - 'zh_CN', - 'zh_XC', - ]; - - /** - * @var array - */ - protected $_config = []; - - /** - * Set method and store id, if specified - * - * @param array $params - */ - public function __construct($params = []) - { - if ($params) { - $method = array_shift($params); - $this->setMethod($method); - if ($params) { - $storeId = array_shift($params); - $this->setStoreId($storeId); - } - } - } - - /** - * Method code setter - * - * @param string|Mage_Payment_Model_Method_Abstract $method - * @return $this - */ - public function setMethod($method) - { - if ($method instanceof Mage_Payment_Model_Method_Abstract) { - $this->_methodCode = $method->getCode(); - } elseif (is_string($method)) { - $this->_methodCode = $method; - } - return $this; - } - - /** - * Payment method instance code getter + * Retrieves the API credentials, including the client ID and decrypted client secret. * - * @return string + * @return array */ - public function getMethodCode() + public function getApiCredentials(): array { - return $this->_methodCode; - } - - /** - * Store ID setter - * - * @param int $storeId - * @return $this - */ - public function setStoreId($storeId) - { - $this->_storeId = (int) $storeId; - return $this; - } - - /** - * Check whether method active in configuration and supported for merchant country or not - * - * @param string $method Method code - * @return bool - */ - public function isMethodActive($method) - { - if ($this->isMethodSupportedForCountry($method) - && Mage::getStoreConfigFlag("payment/{$method}/active", $this->_storeId) - ) { - return true; - } - return false; - } - - /** - * Check whether method available for checkout or not - * Logic based on merchant country, methods dependence - * - * @param string|null $methodCode Method code - * @return bool - */ - public function isMethodAvailable($methodCode = null) - { - if ($methodCode === null) { - $methodCode = $this->getMethodCode(); - } - - $result = true; - - if (!$this->isMethodActive($methodCode)) { - $result = false; - } - - switch ($methodCode) { - case self::METHOD_WPS: - if (!$this->businessAccount) { - $result = false; - break; - } - // check for direct payments dependence - if ($this->isMethodActive(self::METHOD_WPP_DIRECT) - || $this->isMethodActive(self::METHOD_WPP_PE_DIRECT) - ) { - $result = false; - } - break; - case self::METHOD_WPP_EXPRESS: - // check for direct payments dependence - if ($this->isMethodActive(self::METHOD_WPP_PE_DIRECT)) { - $result = false; - } elseif ($this->isMethodActive(self::METHOD_WPP_DIRECT)) { - $result = true; - } - break; - case self::METHOD_BML: - // check for express payments dependence - if (!$this->isMethodActive(self::METHOD_WPP_EXPRESS)) { - $result = false; - } - break; - case self::METHOD_WPP_PE_EXPRESS: - // check for direct payments dependence - if ($this->isMethodActive(self::METHOD_WPP_PE_DIRECT)) { - $result = true; - } elseif (!$this->isMethodActive(self::METHOD_WPP_PE_DIRECT) - && !$this->isMethodActive(self::METHOD_PAYFLOWPRO) - ) { - $result = false; - } - break; - case self::METHOD_WPP_PE_BML: - // check for express payments dependence - if (!$this->isMethodActive(self::METHOD_WPP_PE_EXPRESS)) { - $result = false; - } - break; - case self::METHOD_BILLING_AGREEMENT: - $result = $this->isWppApiAvailabe(); - break; - case self::METHOD_WPP_DIRECT: - case self::METHOD_WPP_PE_DIRECT: - break; - } - return $result; - } - - /** - * Config field magic getter - * The specified key can be either in camelCase or under_score format - * Tries to map specified value according to set payment method code, into the configuration value - * Sets the values into public class parameters, to avoid redundant calls of this method - * - * @param string $key - * @return string|null - */ - public function __get($key) - { - if (array_key_exists($key, $this->_config)) { - return $this->_config[$key]; - } - - $underscored = strtolower(preg_replace('/(.)([A-Z])/', '$1_$2', $key)); - if (array_key_exists($underscored, $this->_config)) { - return $this->_config[$underscored]; - } - - $value = Mage::getStoreConfig($this->_getSpecificConfigPath($underscored), $this->_storeId); - $value = $this->_prepareValue($underscored, $value); - $this->_config[$key] = $value; - $this->_config[$underscored] = $value; - return $value; - } - - /** - * Perform additional config value preparation and return new value if needed - * - * @param string $key Underscored key - * @param string $value Old value - * @return string Modified value or old value - */ - protected function _prepareValue($key, $value) - { - // Always set payment action as "Sale" for Unilateral payments in EC - if ($key == 'payment_action' - && $value != self::PAYMENT_ACTION_SALE - && $this->_methodCode == self::METHOD_WPP_EXPRESS - && $this->shouldUseUnilateralPayments() - ) { - return self::PAYMENT_ACTION_SALE; + if ($this->_cachedCredentials === null) { + $this->_cachedCredentials = [ + 'client_id' => $this->getConfigData('client_id'), + 'client_secret' => Mage::helper('core')->decrypt($this->getConfigData('client_secret')), + ]; } - return $value; - } - - /** - * Return merchant country codes supported by PayPal - * - * @return array - */ - public function getSupportedMerchantCountryCodes() - { - return $this->_supportedCountryCodes; + return $this->_cachedCredentials; } /** - * Return buyer country codes supported by PayPal - * - * @return array + * Checks if debug mode is enabled. */ - public function getSupportedBuyerCountryCodes() + public function isDebugEnabled(): bool { - return $this->_supportedBuyerCountryCodes; + return (bool) $this->getConfigData('debug'); } /** - * Return merchant country code, use default country if it not specified in General settings - * - * @return string + * Checks if sandbox mode is enabled. */ - public function getMerchantCountry() + public function isSandbox(): bool { - $countryCode = Mage::getStoreConfig($this->_mapGeneralFieldset('merchant_country'), $this->_storeId); - if (!$countryCode) { - $countryCode = Mage::helper('core')->getDefaultCountry($this->_storeId); - } - return $countryCode; + return (bool) $this->getConfigData('sandbox_mode'); } /** - * Check whether method supported for specified country or not - * Use $_methodCode and merchant country by default - * - * @return bool + * Retrieves the configured payment action (e.g., 'authorize', 'capture'). */ - public function isMethodSupportedForCountry($method = null, $countryCode = null) + public function getPaymentAction(): string { - if ($method === null) { - $method = $this->getMethodCode(); - } - if ($countryCode === null) { - $countryCode = $this->getMerchantCountry(); - } - $countryMethods = $this->getCountryMethods($countryCode); - if (in_array($method, $countryMethods)) { - return true; - } - return false; + return (string) $this->getConfigData('payment_action'); } /** - * Return list of allowed methods for specified country iso code - * - * @param string $countryCode 2-letters iso code - * @return array + * Retrieves the PayPal API endpoint URL based on the sandbox mode. */ - public function getCountryMethods($countryCode = null) + public function getEndpoint(): string { - $countryMethods = [ - 'other' => [ - self::METHOD_WPS, - self::METHOD_WPP_EXPRESS, - self::METHOD_BILLING_AGREEMENT, - ], - 'US' => [ - self::METHOD_PAYFLOWADVANCED, - self::METHOD_WPP_DIRECT, - self::METHOD_WPS, - self::METHOD_PAYFLOWPRO, - self::METHOD_PAYFLOWLINK, - self::METHOD_WPP_EXPRESS, - self::METHOD_BML, - self::METHOD_BILLING_AGREEMENT, - self::METHOD_WPP_PE_EXPRESS, - self::METHOD_WPP_PE_BML, - ], - 'CA' => [ - self::METHOD_WPP_DIRECT, - self::METHOD_WPS, - self::METHOD_PAYFLOWPRO, - self::METHOD_PAYFLOWLINK, - self::METHOD_WPP_EXPRESS, - self::METHOD_BILLING_AGREEMENT, - ], - 'GB' => [ - self::METHOD_WPP_DIRECT, - self::METHOD_WPS, - self::METHOD_WPP_PE_DIRECT, - self::METHOD_HOSTEDPRO, - self::METHOD_WPP_EXPRESS, - self::METHOD_BILLING_AGREEMENT, - self::METHOD_WPP_PE_EXPRESS, - ], - 'AU' => [ - self::METHOD_WPS, - self::METHOD_PAYFLOWPRO, - self::METHOD_HOSTEDPRO, - self::METHOD_WPP_EXPRESS, - self::METHOD_BILLING_AGREEMENT, - ], - 'NZ' => [ - self::METHOD_WPS, - self::METHOD_PAYFLOWPRO, - self::METHOD_WPP_EXPRESS, - self::METHOD_BILLING_AGREEMENT, - ], - 'JP' => [ - self::METHOD_WPS, - self::METHOD_HOSTEDPRO, - self::METHOD_WPP_EXPRESS, - self::METHOD_BILLING_AGREEMENT, - ], - 'FR' => [ - self::METHOD_WPS, - self::METHOD_HOSTEDPRO, - self::METHOD_WPP_EXPRESS, - self::METHOD_BILLING_AGREEMENT, - ], - 'IT' => [ - self::METHOD_WPS, - self::METHOD_HOSTEDPRO, - self::METHOD_WPP_EXPRESS, - self::METHOD_BILLING_AGREEMENT, - ], - 'ES' => [ - self::METHOD_WPS, - self::METHOD_HOSTEDPRO, - self::METHOD_WPP_EXPRESS, - self::METHOD_BILLING_AGREEMENT, - ], - 'HK' => [ - self::METHOD_WPS, - self::METHOD_HOSTEDPRO, - self::METHOD_WPP_EXPRESS, - self::METHOD_BILLING_AGREEMENT, - ], - ]; - if ($countryCode === null) { - return $countryMethods; - } - return $countryMethods[$countryCode] ?? $countryMethods['other']; + return $this->isSandbox() ? 'https://www.sandbox.paypal.com' : 'https://www.paypal.com'; } /** - * Return start url for PayPal Basic + * Retrieves an array of configuration settings for the PayPal button. * - * @param string $token - * @return string + * @return array */ - public function getPayPalBasicStartUrl($token) + public function getButtonConfiguration(): array { - $params = [ - 'cmd' => '_express-checkout', - 'token' => $token, + return [ + 'shape' => (string) $this->getConfigData('button_shape'), + 'color' => (string) $this->getConfigData('button_color'), + 'layout' => (string) $this->getConfigData('button_layout'), + 'label' => (string) $this->getConfigData('button_label'), + 'message' => (bool) $this->getConfigData('button_message'), ]; - - if ($this->isOrderReviewStepDisabled()) { - $params['useraction'] = 'commit'; - } - - return $this->getPaypalUrl($params); - } - - /** - * Check whether order review step enabled in configuration - * - * @return bool - */ - public function isOrderReviewStepDisabled() - { - return Mage::getStoreConfigFlag(self::XML_PATH_PAYPAL_EXPRESS_SKIP_ORDER_REVIEW_STEP_FLAG); - } - - /** - * Get url for dispatching customer to express checkout start - * - * @param string $token - * @return string - */ - public function getExpressCheckoutStartUrl($token) - { - return $this->getPaypalUrl([ - 'cmd' => '_express-checkout', - 'token' => $token, - ]); - } - - /** - * Get url for dispatching customer to checkout retrial - * - * @param string $orderId - * @return string - */ - public function getExpressCheckoutOrderUrl($orderId) - { - return $this->getPaypalUrl([ - 'cmd' => '_express-checkout', - 'order_id' => $orderId, - ]); - } - - /** - * Get url that allows to edit checkout details on paypal side - * - * @param string $token - * @return string - */ - public function getExpressCheckoutEditUrl($token) - { - return $this->getPaypalUrl([ - 'cmd' => '_express-checkout', - 'useraction' => 'continue', - 'token' => $token, - ]); - } - - /** - * Get url for additional actions that PayPal may require customer to do after placing the order. - * For instance, redirecting customer to bank for payment confirmation. - * - * @param string $token - * @return string - */ - public function getExpressCheckoutCompleteUrl($token) - { - return $this->getPaypalUrl([ - 'cmd' => '_complete-express-checkout', - 'token' => $token, - ]); - } - - /** - * Retrieve url for initialization of billing agreement - * - * @param string $token - * @return string - */ - public function getStartBillingAgreementUrl($token) - { - return $this->getPaypalUrl([ - 'cmd' => '_customer-billing-agreement', - 'token' => $token, - ]); - } - - /** - * PayPal web URL generic getter - * - * @return string - */ - public function getPaypalUrl(array $params = []) - { - return sprintf( - 'https://www.%spaypal.com/cgi-bin/webscr%s', - $this->sandboxFlag ? 'sandbox.' : '', - $params ? '?' . http_build_query($params) : '', - ); - } - - /** - * Get postback endpoint URL. - * - * @return string - */ - public function getPostbackUrl() - { - return sprintf('https://ipnpb.%spaypal.com/cgi-bin/webscr', $this->sandboxFlag ? 'sandbox.' : ''); - } - - /** - * Whether Express Checkout button should be rendered dynamically - * - * @return bool - */ - public function areButtonsDynamic() - { - return $this->buttonFlavor === self::EC_FLAVOR_DYNAMIC; - } - - /** - * Express checkout shortcut pic URL getter - * PayPal will ignore "pal", if there is no total amount specified - * - * @param string $localeCode - * @param float $orderTotal - * @param string $pal encrypted summary about merchant - * @return string - * @see Paypal_Model_Api_Nvp::callGetPalDetails() - */ - public function getExpressCheckoutShortcutImageUrl($localeCode, $orderTotal = null, $pal = null) - { - $country = Mage::getStoreConfig(Mage_Paypal_Helper_Data::MERCHANT_COUNTRY_CONFIG_PATH); - if ($country == Mage_Paypal_Helper_Data::US_COUNTRY - && ($this->areButtonsDynamic() || $this->buttonType != self::EC_BUTTON_TYPE_MARK) - ) { - return 'https://www.paypalobjects.com/webstatic/en_US/i/buttons/checkout-logo-medium.png'; - } - if ($this->areButtonsDynamic()) { - return $this->_getDynamicImageUrl(self::EC_BUTTON_TYPE_SHORTCUT, $localeCode, $orderTotal, $pal); - } - if ($this->buttonType === self::EC_BUTTON_TYPE_MARK) { - return $this->getPaymentMarkImageUrl($localeCode); - } - return sprintf( - 'https://www.paypal.com/%s/i/btn/btn_xpressCheckout.gif', - $this->_getSupportedLocaleCode($localeCode), - ); } - /** - * Get PayPal "mark" image URL - * Supposed to be used on payment methods selection - * $staticSize is applicable for static images only - * - * @param string $localeCode - * @param float $orderTotal - * @param string $pal - * @param string $staticSize - * @return string - */ - public function getPaymentMarkImageUrl($localeCode, $orderTotal = null, $pal = null, $staticSize = null) - { - $country = Mage::getStoreConfig(Mage_Paypal_Helper_Data::MERCHANT_COUNTRY_CONFIG_PATH); - if ($country == Mage_Paypal_Helper_Data::US_COUNTRY) { - return 'https://www.paypalobjects.com/webstatic/en_US/i/buttons/pp-acceptance-medium.png'; - } - if ($this->areButtonsDynamic()) { - return $this->_getDynamicImageUrl(self::EC_BUTTON_TYPE_MARK, $localeCode, $orderTotal, $pal); - } - - if ($staticSize === null) { - $staticSize = $this->paymentMarkSize; - } - switch ($staticSize) { - case self::PAYMENT_MARK_37X23: - case self::PAYMENT_MARK_50X34: - case self::PAYMENT_MARK_60X38: - case self::PAYMENT_MARK_180X113: - break; - default: - $staticSize = self::PAYMENT_MARK_37X23; - } - return sprintf( - 'https://www.paypal.com/%s/i/logo/PayPal_mark_%s.gif', - $this->_getSupportedLocaleCode($localeCode), - $staticSize, - ); - } - - /** - * Get "What Is PayPal" localized URL - * Supposed to be used with "mark" as popup window - * - * @return string - */ - public function getPaymentMarkWhatIsPaypalUrl(?Mage_Core_Model_Locale $locale = null) - { - $countryCode = 'US'; - if ($locale instanceof Mage_Core_Model_Locale) { - $shouldEmulate = ($this->_storeId !== null) && (Mage::app()->getStore()->getId() != $this->_storeId); - if ($shouldEmulate) { - $locale->emulate($this->_storeId); - } - $countryCode = $locale->getLocale()->getRegion(); - if ($shouldEmulate) { - $locale->revert(); - } - } - return sprintf( - 'https://www.paypal.com/%s/cgi-bin/webscr?cmd=xpt/Marketing/popup/OLCWhatIsPayPal-outside', - strtolower($countryCode), - ); - } - - /** - * Getter for Solution banner images - * - * @param string $localeCode - * @param bool $isVertical - * @param bool $isEcheck - * @return string - */ - public function getSolutionImageUrl($localeCode, $isVertical = false, $isEcheck = false) - { - return sprintf( - 'https://www.paypal.com/%s/i/bnr/%s_solution_PP%s.gif', - $this->_getSupportedLocaleCode($localeCode), - $isVertical ? 'vertical' : 'horizontal', - $isEcheck ? 'eCheck' : '', - ); - } - - /** - * Getter for Payment form logo images - * - * @param string $localeCode - * @return string - */ - public function getPaymentFormLogoUrl($localeCode) - { - $locale = $this->_getSupportedLocaleCode($localeCode); - - $imageType = 'logo'; - $domain = 'paypal.com'; - [, $country] = explode('_', $locale); - $countryPrefix = $country . '/'; - - switch ($locale) { - case 'en_GB': - $imageName = 'horizontal_solution_PP'; - $imageType = 'bnr'; - $countryPrefix = ''; - break; - case 'de_DE': - $imageName = 'lockbox_150x47'; - break; - case 'fr_FR': - $imageName = 'bnr_horizontal_solution_PP_327wx80h'; - $imageType = 'bnr'; - $locale = self::LOCALE_US; - $domain = 'paypalobjects.com'; - break; - case 'it_IT': - $imageName = 'bnr_horizontal_solution_PP_178wx80h'; - $imageType = 'bnr'; - $domain = 'paypalobjects.com'; - break; - default: - $imageName = 'PayPal_mark_60x38'; - $countryPrefix = ''; - break; - } - return sprintf('https://www.%s/%s/%si/%s/%s.gif', $domain, $locale, $countryPrefix, $imageType, $imageName); - } - - /** - * Return supported types for PayPal logo - * - * @return array - */ - public function getAdditionalOptionsLogoTypes() - { - return [ - 'wePrefer_150x60' => Mage::helper('paypal')->__('We prefer PayPal (150 X 60)'), - 'wePrefer_150x40' => Mage::helper('paypal')->__('We prefer PayPal (150 X 40)'), - 'nowAccepting_150x60' => Mage::helper('paypal')->__('Now accepting PayPal (150 X 60)'), - 'nowAccepting_150x40' => Mage::helper('paypal')->__('Now accepting PayPal (150 X 40)'), - 'paymentsBy_150x60' => Mage::helper('paypal')->__('Payments by PayPal (150 X 60)'), - 'paymentsBy_150x40' => Mage::helper('paypal')->__('Payments by PayPal (150 X 40)'), - 'shopNowUsing_150x60' => Mage::helper('paypal')->__('Shop now using (150 X 60)'), - 'shopNowUsing_150x40' => Mage::helper('paypal')->__('Shop now using (150 X 40)'), - ]; - } - - /** - * Return PayPal logo URL with additional options - * - * @param string $localeCode Supported locale code - * @param string|false $type One of supported logo types - * @return string|bool Logo Image URL or false if logo disabled in configuration - */ - public function getAdditionalOptionsLogoUrl($localeCode, $type = false) - { - $configType = Mage::getStoreConfig($this->_mapGenericStyleFieldset('logo'), $this->_storeId); - if (!$configType) { - return false; - } - $type = $type ? $type : $configType; - $locale = $this->_getSupportedLocaleCode($localeCode); - if (!array_key_exists($type, $this->getAdditionalOptionsLogoTypes())) { - $type = self::DEFAULT_LOGO_TYPE; - } - return sprintf('https://www.paypalobjects.com/%s/i/bnr/bnr_%s.gif', $locale, $type); - } - - /** - * BN code getter - * - * @return mixed - */ - public function getBuildNotationCode() - { - return Mage::getStoreConfig('paypal/bncode', $this->_storeId); - } - - /** - * Express Checkout button "flavors" source getter - * - * @return array - */ - public function getExpressCheckoutButtonFlavors() - { - return [ - self::EC_FLAVOR_DYNAMIC => Mage::helper('paypal')->__('Dynamic'), - self::EC_FLAVOR_STATIC => Mage::helper('paypal')->__('Static'), - ]; - } - - /** - * Express Checkout button types source getter - * - * @return array - */ - public function getExpressCheckoutButtonTypes() - { - return [ - self::EC_BUTTON_TYPE_SHORTCUT => Mage::helper('paypal')->__('Shortcut'), - self::EC_BUTTON_TYPE_MARK => Mage::helper('paypal')->__('Acceptance Mark Image'), - ]; - } - - /** - * Payment actions source getter - * - * @return array - */ - public function getPaymentActions() - { - $paymentActions = [ - self::PAYMENT_ACTION_AUTH => Mage::helper('paypal')->__('Authorization'), - self::PAYMENT_ACTION_SALE => Mage::helper('paypal')->__('Sale'), - ]; - if (!is_null($this->_methodCode) && $this->_methodCode == self::METHOD_WPP_EXPRESS) { - $paymentActions[self::PAYMENT_ACTION_ORDER] = Mage::helper('paypal')->__('Order'); - } - return $paymentActions; - } - - /** - * Require Billing Address source getter - * - * @return array - */ - public function getRequireBillingAddressOptions() - { - return [ - self::REQUIRE_BILLING_ADDRESS_ALL => Mage::helper('paypal')->__('Yes'), - self::REQUIRE_BILLING_ADDRESS_NO => Mage::helper('paypal')->__('No'), - self::REQUIRE_BILLING_ADDRESS_VIRTUAL => Mage::helper('paypal')->__('For Virtual Quotes Only'), - ]; - } - - /** - * Mapper from PayPal-specific payment actions to Magento payment actions - * - * @return string|null - */ - public function getPaymentAction() - { - return match ($this->paymentAction) { - self::PAYMENT_ACTION_AUTH => Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE, - self::PAYMENT_ACTION_SALE => Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE, - self::PAYMENT_ACTION_ORDER => Mage_Payment_Model_Method_Abstract::ACTION_ORDER, - default => null, - }; - } - - /** - * Returns array of possible Authorization Amounts for Account Verification - * - * @deprecated since 1.6.2.0 - * @return array - */ - public function getAuthorizationAmounts() - { - return []; - } - - /** - * Express Checkout "solution types" source getter - * "sole" = "Express Checkout for Auctions" - PayPal allows guest checkout - * "mark" = "Normal Express Checkout" - PayPal requires to checkout with PayPal buyer account only - * - * @return array - */ - public function getExpressCheckoutSolutionTypes() - { - return [ - self::EC_SOLUTION_TYPE_SOLE => Mage::helper('paypal')->__('Yes'), - self::EC_SOLUTION_TYPE_MARK => Mage::helper('paypal')->__('No'), - ]; - } - - /** - * Retrieve express checkout billing agreement signup options - * - * @return array - */ - public function getExpressCheckoutBASignupOptions() - { - return [ - self::EC_BA_SIGNUP_AUTO => Mage::helper('paypal')->__('Auto'), - self::EC_BA_SIGNUP_ASK => Mage::helper('paypal')->__('Ask Customer'), - self::EC_BA_SIGNUP_NEVER => Mage::helper('paypal')->__('Never'), - ]; - } - - /** - * Whether to ask customer to create billing agreements - * Unilateral payments are incompatible with the billing agreements - * - * @return bool - */ - public function shouldAskToCreateBillingAgreement() - { - return ($this->allow_ba_signup === self::EC_BA_SIGNUP_ASK) && !$this->shouldUseUnilateralPayments(); - } - - /** - * Check whether only Unilateral payments (Accelerated Boarding) possible for Express method or not - * - * @return bool - */ - public function shouldUseUnilateralPayments() - { - return $this->business_account && !$this->isWppApiAvailabe(); - } - - /** - * Check whether WPP API credentials are available for this method - * - * @return bool - */ - public function isWppApiAvailabe() - { - return $this->api_username && $this->api_password && ($this->api_signature || $this->api_cert); - } - - /** - * Payment data delivery methods getter for PayPal Standard - * - * @return array - */ - public function getWpsPaymentDeliveryMethods() - { - return [ - self::WPS_TRANSPORT_IPN => Mage::helper('adminhtml')->__('IPN (Instant Payment Notification) Only'), - ]; - } - - /** - * Return list of supported credit card types by Paypal Direct gateway - * - * @return array - */ - public function getWppCcTypesAsOptionArray() - { - $model = Mage::getModel('payment/source_cctype')->setAllowedTypes(['AE', 'VI', 'MC', 'SM', 'SO', 'DI']); - return $model->toOptionArray(); - } - - /** - * Return list of supported credit card types by Paypal Direct (Payflow Edition) gateway - * - * @return array - */ - public function getWppPeCcTypesAsOptionArray() - { - $model = Mage::getModel('payment/source_cctype')->setAllowedTypes(['VI', 'MC', 'SM', 'SO', 'OT', 'AE']); - return $model->toOptionArray(); - } - - /** - * Return list of supported credit card types by Payflow Pro gateway - * - * @return array - */ - public function getPayflowproCcTypesAsOptionArray() - { - $model = Mage::getModel('payment/source_cctype')->setAllowedTypes(['AE', 'VI', 'MC', 'JCB', 'DI']); - return $model->toOptionArray(); - } - - /** - * Check whether the specified payment method is a CC-based one - * - * @param string $code - * @return bool - */ - public static function getIsCreditCardMethod($code) - { - return match ($code) { - self::METHOD_WPP_DIRECT, self::METHOD_WPP_PE_DIRECT, self::METHOD_PAYFLOWPRO, self::METHOD_PAYFLOWLINK, self::METHOD_PAYFLOWADVANCED, self::METHOD_HOSTEDPRO => true, - default => false, - }; - } - - /** - * Check whether specified currency code is supported - * - * @param string $code - * @return bool - */ - public function isCurrencyCodeSupported($code) - { - if (in_array($code, $this->_supportedCurrencyCodes)) { - return true; - } - if ($this->getMerchantCountry() == 'BR' && $code == 'BRL') { - return true; - } - if ($this->getMerchantCountry() == 'MY' && $code == 'MYR') { - return true; - } - return false; - } - - /** - * Export page style current settings to specified object - */ - public function exportExpressCheckoutStyleSettings(Varien_Object $to) - { - foreach ($this->_ecStyleConfigMap as $key => $exportKey) { - if ($this->$key) { - $to->setData($exportKey, $this->$key); - } - } - } - - /** - * Dynamic PayPal image URL getter - * Also can render dynamic Acceptance Mark - * - * @param string $type - * @param string $localeCode - * @param float $orderTotal - * @param string $pal - * @return string - */ - protected function _getDynamicImageUrl($type, $localeCode, $orderTotal, $pal) - { - $params = [ - 'cmd' => '_dynamic-image', - 'buttontype' => $type, - 'locale' => $this->_getSupportedLocaleCode($localeCode), - ]; - if ($orderTotal) { - $params['ordertotal'] = sprintf('%.2F', $orderTotal); - if ($pal) { - $params['pal'] = $pal; - } - } - return sprintf( - 'https://fpdbs%s.paypal.com/dynamicimageweb?%s', - $this->sandboxFlag ? '.sandbox' : '', - http_build_query($params), - ); - } - - /** - * Check whether specified locale code is supported. Fallback to en_US - * - * @param string $localeCode - * @return string - */ - protected function _getSupportedLocaleCode($localeCode = null) - { - if (!$localeCode || !in_array($localeCode, $this->_supportedImageLocales)) { - return self::LOCALE_US; - } - return $localeCode; - } - - /** - * Map any supported payment method into a config path by specified field name - * - * @param string $fieldName - * @return string|null - */ - protected function _getSpecificConfigPath($fieldName) - { - $path = null; - switch ($this->_methodCode) { - case self::METHOD_WPS: - $path = $this->_mapStandardFieldset($fieldName); - break; - case self::METHOD_BML: - $path = $this->_mapBmlFieldset($fieldName); - break; - case self::METHOD_WPP_PE_BML: - $path = $this->_mapBmlUkFieldset($fieldName); - break; - case self::METHOD_WPP_EXPRESS: - case self::METHOD_WPP_PE_EXPRESS: - $path = $this->_mapExpressFieldset($fieldName); - break; - case self::METHOD_WPP_DIRECT: - case self::METHOD_WPP_PE_DIRECT: - $path = $this->_mapDirectFieldset($fieldName); - break; - case self::METHOD_BILLING_AGREEMENT: - case self::METHOD_HOSTEDPRO: - $path = $this->_mapMethodFieldset($fieldName); - break; - } - - if ($path === null) { - switch ($this->_methodCode) { - case self::METHOD_WPP_EXPRESS: - case self::METHOD_BML: - case self::METHOD_WPP_DIRECT: - case self::METHOD_BILLING_AGREEMENT: - case self::METHOD_HOSTEDPRO: - $path = $this->_mapWppFieldset($fieldName); - break; - case self::METHOD_WPP_PE_EXPRESS: - case self::METHOD_WPP_PE_DIRECT: - case self::METHOD_PAYFLOWADVANCED: - case self::METHOD_PAYFLOWLINK: - $path = $this->_mapWpukFieldset($fieldName); - break; - } - } - - if ($path === null) { - $path = $this->_mapGeneralFieldset($fieldName); - } - if ($path === null) { - $path = $this->_mapGenericStyleFieldset($fieldName); - } - return $path; - } - - /** - * Map PayPal Standard config fields - * - * @param string $fieldName - * @return string|null - */ - protected function _mapStandardFieldset($fieldName) - { - return match ($fieldName) { - 'line_items_summary', 'sandbox_flag' => self::XML_PATH_PAYMENT_SECTION . self::METHOD_WPS . "/{$fieldName}", - default => $this->_mapMethodFieldset($fieldName), - }; - } - - /** - * Map PayPal Express config fields - * - * @param string $fieldName - * @return string|null - */ - protected function _mapExpressFieldset($fieldName) - { - return match ($fieldName) { - 'transfer_shipping_options', 'solution_type', 'visible_on_cart', 'visible_on_product', 'require_billing_address', 'authorization_honor_period', 'order_valid_period', 'child_authorization_number', 'allow_ba_signup' => "payment/{$this->_methodCode}/{$fieldName}", - default => $this->_mapMethodFieldset($fieldName), - }; - } - - /** - * Map PayPal Express Bill Me Later config fields - * - * @param string $fieldName - * @return string|null - */ - protected function _mapBmlFieldset($fieldName) - { - return match ($fieldName) { - 'allow_ba_signup' => self::XML_PATH_PAYMENT_SECTION . self::METHOD_WPP_EXPRESS . "/{$fieldName}", - default => $this->_mapExpressFieldset($fieldName), - }; - } - - /** - * Map PayPal Express Bill Me Later config fields (Payflow Edition) - * - * @param string $fieldName - * @return string|null - */ - protected function _mapBmlUkFieldset($fieldName) - { - return match ($fieldName) { - 'allow_ba_signup' => self::XML_PATH_PAYMENT_SECTION . self::METHOD_WPP_PE_EXPRESS . "/{$fieldName}", - default => $this->_mapExpressFieldset($fieldName), - }; - } - - /** - * Map PayPal Direct config fields - * - * @param string $fieldName - * @return string|null - */ - protected function _mapDirectFieldset($fieldName) - { - return match ($fieldName) { - 'useccv', 'centinel', 'centinel_is_mode_strict', 'centinel_api_url' => "payment/{$this->_methodCode}/{$fieldName}", - default => $this->_mapMethodFieldset($fieldName), - }; - } - - /** - * Map PayPal Website Payments Pro common config fields - * - * @param string $fieldName - * @return string|null - */ - protected function _mapWppFieldset($fieldName) - { - return match ($fieldName) { - 'api_authentication', 'api_username', 'api_password', 'api_signature', 'api_cert', 'sandbox_flag', 'use_proxy', 'proxy_host', 'proxy_port', 'button_flavor' => "paypal/wpp/{$fieldName}", - default => null, - }; - } - - /** - * Map PayPal Website Payments Pro common config fields - * - * @param string $fieldName - * @return string|null - */ - protected function _mapWpukFieldset($fieldName) - { - $pathPrefix = 'paypal/wpuk'; - // Use PUMP credentials from Verisign for EC when Direct Payments are unavailable - if ($this->_methodCode == self::METHOD_WPP_PE_EXPRESS - && !$this->isMethodAvailable(self::METHOD_WPP_PE_DIRECT) - ) { - $pathPrefix = 'payment/verisign'; - } elseif ($this->_methodCode == self::METHOD_PAYFLOWADVANCED - || $this->_methodCode == self::METHOD_PAYFLOWLINK - ) { - $pathPrefix = self::XML_PATH_PAYMENT_SECTION . $this->_methodCode; - } - return match ($fieldName) { - 'partner', 'user', 'vendor', 'pwd', 'sandbox_flag', 'use_proxy', 'proxy_host', 'proxy_port' => $pathPrefix . '/' . $fieldName, - default => null, - }; - } - - /** - * Map PayPal common style config fields - * - * @param string $fieldName - * @return string|null - */ - protected function _mapGenericStyleFieldset($fieldName) - { - return match ($fieldName) { - 'logo', 'page_style', 'paypal_hdrimg', 'paypal_hdrbackcolor', 'paypal_hdrbordercolor', 'paypal_payflowcolor' => "paypal/style/{$fieldName}", - default => null, - }; - } - - /** - * Map PayPal General Settings - * - * @param string $fieldName - * @return string|null - */ - protected function _mapGeneralFieldset($fieldName) - { - return match ($fieldName) { - 'business_account', 'merchant_country' => "paypal/general/{$fieldName}", - default => null, - }; - } - - /** - * Map PayPal General Settings - * - * @param string $fieldName - * @return string|null - */ - protected function _mapMethodFieldset($fieldName) - { - if (!$this->_methodCode) { - return null; - } - return match ($fieldName) { - 'active', 'title', 'payment_action', 'allowspecific', 'specificcountry', 'line_items_enabled', 'cctypes', 'sort_order', 'debug', 'verify_peer', 'mobile_optimized' => "payment/{$this->_methodCode}/{$fieldName}", - default => null, - }; - } - - /** - * Payment API authentication methods source getter - * - * @return array - */ - public function getApiAuthenticationMethods() - { - return [ - '0' => Mage::helper('paypal')->__('API Signature'), - '1' => Mage::helper('paypal')->__('API Certificate'), - ]; - } - - /** - * Api certificate getter - * - * @return string - */ - public function getApiCertificate() - { - $websiteId = Mage::app()->getStore($this->_storeId)->getWebsiteId(); - return Mage::getModel('paypal/cert')->loadByWebsite($websiteId, false)->getCertPath(); - } - - /** - * Get PublisherId from stored config - * - * @return mixed - */ - public function getBmlPublisherId() - { - return Mage::getStoreConfig('payment/paypal_express_bml/publisher_id', $this->_storeId); - } /** - * Get Display option from stored config - * @param string $section + * Checks if the PayPal payment method is active for the given store. * - * @return mixed + * @param mixed|null $store The store ID or object to check for. */ - public function getBmlDisplay($section) + public function isActive(mixed $store = null): bool { - $display = Mage::getStoreConfig('payment/paypal_express_bml/' . $section . '_display', $this->_storeId); - $ecActive = Mage::getStoreConfig('payment/paypal_express/active', $this->_storeId); - $ecUkActive = Mage::getStoreConfig('payment/paypaluk_express/active', $this->_storeId); - $bmlActive = Mage::getStoreConfig('payment/paypal_express_bml/active', $this->_storeId); - $bmlUkActive = Mage::getStoreConfig('payment/paypaluk_express_bml/active', $this->_storeId); - return (($bmlActive && $ecActive) || ($bmlUkActive && $ecUkActive)) ? $display : 0; + return (bool) $this->getConfigData('active', $store); } /** - * Get Position option from stored config - * @param string $section + * Retrieves a list of supported currency codes. * - * @return mixed + * @return string[] */ - public function getBmlPosition($section) + public function getAllowedCurrencyCodes(): array { - return Mage::getStoreConfig('payment/paypal_express_bml/' . $section . '_position', $this->_storeId); + return $this->_supportedCurrencies; } /** - * Get Size option from stored config - * @param string $section + * Retrieves a specific configuration value from the store config. * - * @return mixed + * @param string $field The configuration field to retrieve. + * @param mixed|null $store The store ID or object. */ - public function getBmlSize($section) + protected function getConfigData(string $field, mixed $store = null): mixed { - return Mage::getStoreConfig('payment/paypal_express_bml/' . $section . '_size', $this->_storeId); + return Mage::getStoreConfig('payment/paypal/' . $field, $store); } } diff --git a/app/code/core/Mage/Paypal/Model/Cron.php b/app/code/core/Mage/Paypal/Model/Cron.php new file mode 100644 index 00000000000..d3b75b9ac69 --- /dev/null +++ b/app/code/core/Mage/Paypal/Model/Cron.php @@ -0,0 +1,301 @@ + + * @copyright Copyright (c) 2005-2024 Magento Inc. (https://www.magentocommerce.com) + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + * @link https://magento.com + */ +class Mage_Paypal_Model_Cron +{ + /** + * @var array + */ + protected $_emailAlerts = []; + + /** + * Main method to process PayPal authorization lifecycle + * + * @param Mage_Cron_Model_Schedule $schedule + * @return void + */ + public function processAuthorizationLifecycle($schedule) + { + $this->_emailAlerts = []; + + $transactions = $this->_getActivePayPalAuthorizations(); + + foreach ($transactions as $transaction) { + $this->_processTransaction($transaction); + } + if (!empty($this->_emailAlerts)) { + $this->_sendEmailAlerts(); + } + } + + /** + * Get active PayPal authorization transactions + */ + protected function _getActivePayPalAuthorizations(): Mage_Core_Model_Resource_Db_Collection_Abstract + { + return Mage::getModel('sales/order_payment_transaction')->getCollection() + ->join( + ['payment' => 'sales/order_payment'], + 'main_table.payment_id = payment.entity_id', + ['method', 'parent_id'], + ) + ->join( + ['order' => 'sales/order'], + 'payment.parent_id = order.entity_id', + ['increment_id', 'state', 'status', 'store_id'], + ) + ->addFieldToFilter('main_table.txn_type', Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH) + ->addFieldToFilter('main_table.is_closed', 0) + ->addFieldToFilter('payment.method', 'paypal') + ->addFieldToFilter('order.state', [ + 'in' => [ + Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, + ], + ]); + } + + /** + * Process individual transaction based on its age + * + * @param Mage_Sales_Model_Order_Payment_Transaction $transaction + * @return void + */ + protected function _processTransaction($transaction) + { + $order = Mage::getModel('sales/order')->load($transaction->getData('parent_id')); + $payment = $order->getPayment(); + + $hoursFromAuth = $this->_calculateHoursFromAuthorization($transaction); + $hoursUntilExpiry = $this->_calculateHoursUntilExpiry($transaction, $order->getStoreId()); + + if ($hoursUntilExpiry <= 0) { + // Authorization expired (29+ days) - close transaction + $this->_handleExpiredAuthorization($payment); + } elseif ($hoursUntilExpiry <= 72) { + // Within 3 days of expiration - send email alert + $this->_addExpirationAlert($order, $transaction, $hoursUntilExpiry); + } elseif ($hoursFromAuth >= 72 && !$this->_hasBeenReauthorized($payment)) { + // Past honor period (3+ days) - attempt reauthorization + $this->_attemptReauthorization($order, $transaction); + } + } + + /** + * Calculate hours from authorization creation + * + * @param Mage_Sales_Model_Order_Payment_Transaction $transaction + * @return float + */ + protected function _calculateHoursFromAuthorization($transaction) + { + $authCreated = $transaction->getCreatedAt(); + $createdTimestamp = strtotime((string) $authCreated); + $nowTimestamp = time(); + + return ($nowTimestamp - $createdTimestamp) / 3600; + } + + /** + * Calculate hours until expiry with timezone conversion + * + * @param Mage_Sales_Model_Order_Payment_Transaction $transaction + * @param int $storeId + * @return float + */ + protected function _calculateHoursUntilExpiry($transaction, $storeId) + { + $additionalInfo = $transaction->getAdditionalInformation(); + $authExpiry = $additionalInfo[Mage_Paypal_Model_Transaction::PAYPAL_PAYMENT_AUTHORIZATION_EXPIRATION_TIME] ?? null; + + if (!$authExpiry) { + $createdTimestamp = strtotime((string) $transaction->getCreatedAt()); + $expiryTimestamp = $createdTimestamp + (29 * 24 * 3600); + return ($expiryTimestamp - time()) / 3600; + } + $storeTimezone = Mage::app()->getStore($storeId)->getConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_TIMEZONE); + $expiryDateTime = new DateTime($authExpiry, new DateTimeZone('UTC')); + $expiryDateTime->setTimezone(new DateTimeZone($storeTimezone)); + $nowDateTime = new DateTime('now', new DateTimeZone($storeTimezone)); + + return ($expiryDateTime->getTimestamp() - $nowDateTime->getTimestamp()) / 3600; + } + + /** + * Check if transaction has been reauthorized + * + * @param Mage_Sales_Model_Order_Payment $payment + * @return bool + */ + protected function _hasBeenReauthorized($payment) + { + $additionalInfo = $payment->getAdditionalInformation(); + return isset($additionalInfo[Mage_Paypal_Model_Payment::PAYPAL_PAYMENT_AUTHORIZATION_REAUTHORIZED]); + } + + /** + * Attempt to reauthorize payment after honor period + * + * @param Mage_Sales_Model_Order $order + * @param Mage_Sales_Model_Order_Payment_Transaction $transaction + * @return void + */ + protected function _attemptReauthorization($order, $transaction) + { + try { + $authorizationId = $transaction->getAdditionalInformation(Mage_Paypal_Model_Transaction::PAYPAL_PAYMENT_AUTHORIZATION_ID); + if (!$authorizationId) { + return; + } + + $paypalModel = Mage::getModel('paypal/paypal'); + $response = $paypalModel->reauthorizePayment($authorizationId, $order); + + Mage::log([ + 'order_id' => $order->getIncrementId(), + 'auth_id' => $authorizationId, + 'message' => 'Auto-reauthorization successful', + 'response' => $response, + ], Zend_Log::INFO, 'paypal_auto_reauth.log'); + } catch (Exception $e) { + Mage::logException($e); + $order->addStatusHistoryComment( + 'PayPal auto-reauthorization failed due to system error. Please check log and go to PayPal site to reauthorize manually.', + false, + )->save(); + } + } + + /** + * Add expiration alert to email queue + * + * @param Mage_Sales_Model_Order $order + * @param Mage_Sales_Model_Order_Payment_Transaction $transaction + * @param float $hoursUntilExpiry + * @return void + */ + protected function _addExpirationAlert($order, $transaction, $hoursUntilExpiry) + { + $daysUntilExpiry = round($hoursUntilExpiry / 24, 1); + + $this->_emailAlerts[] = [ + 'order' => $order, + 'transaction' => $transaction, + 'days_until_expiry' => $daysUntilExpiry, + 'hours_until_expiry' => $hoursUntilExpiry, + ]; + } + + /** + * Handle expired authorization (29+ days) + * + * @param Mage_Sales_Model_Order_Payment $payment + * @return void + */ + protected function _handleExpiredAuthorization($payment) + { + try { + $transactionModel = Mage::getSingleton('paypal/transaction'); + $transactionModel->updateExpiredTransaction($payment); + + $order = $payment->getOrder(); + $message = sprintf( + 'PayPal authorization %s has expired after 29 days. Transaction closed.', + $payment->getLastTransId(), + ); + + $order->setState( + Mage_Sales_Model_Order::STATE_HOLDED, + 'paypal_auth_expired', + $message, + false, + )->save(); + + Mage::log([ + 'order_id' => $order->getIncrementId(), + 'message' => 'Authorization expired and closed', + ], Zend_Log::WARN, 'paypal_expired_auth.log'); + } catch (Exception $e) { + Mage::logException($e); + } + } + + /** + * Send email alerts for orders approaching expiration + * + * @return void + */ + protected function _sendEmailAlerts() + { + $subject = 'PayPal Authorization Expiring Soon - Action Required'; + $body = $this->_buildAlertEmailBody(); + + $mail = Mage::getModel('core/email') + ->setToEmail(Mage::getStoreConfig('trans_email/ident_general/email')) + ->setToName(Mage::getStoreConfig('trans_email/ident_general/name')) + ->setFromEmail(Mage::getStoreConfig('trans_email/ident_general/email')) + ->setFromName(Mage::getStoreConfig('general/store_information/name')) + ->setSubject($subject) + ->setBody($body) + ->setType('text'); + + try { + $mail->send(); + } catch (Exception $e) { + Mage::logException($e); + } + } + + /** + * Build email body for expiration alerts + * + * @return string + */ + protected function _buildAlertEmailBody() + { + $body = "PayPal Authorization Expiration Alert\n"; + $body .= 'Generated: ' . date('Y-m-d H:i:s') . "\n"; + $body .= str_repeat('=', 50) . "\n\n"; + + $body .= "The following orders have PayPal authorizations expiring within 3 days:\n\n"; + foreach ($this->_emailAlerts as $alert) { + $order = $alert['order']; + $transaction = $alert['transaction']; + $orderNumber = $order->getIncrementId(); + $customerName = $order->getCustomerName(); + + $orderAmount = $order->getBaseCurrencyCode() . ' ' . number_format((float) $order->getGrandTotal(), 2); + $transactionId = $transaction->getTxnId(); + $daysRemaining = $alert['days_until_expiry']; + + $body .= 'Order: #' . $orderNumber . "\n"; + $body .= 'Customer: ' . $customerName . "\n"; + $body .= 'Amount: ' . $orderAmount . "\n"; + $body .= 'Transaction ID: ' . $transactionId . "\n"; + $body .= 'Expires in: ' . $daysRemaining . " days\n"; + $body .= "Action: CAPTURE PAYMENT IMMEDIATELY\n\n"; + } + $body .= str_repeat('=', 50) . "\n"; + $body .= "Note: Authorizations expire after 29 days and cannot be recovered.\n"; + $body .= "Capture payments as soon as possible to avoid losing the transaction.\n\n"; + + return $body . 'This is an automated alert from your PayPal payment system.'; + } +} diff --git a/app/code/core/Mage/Paypal/Model/Resource/Report/Settlement/Row.php b/app/code/core/Mage/Paypal/Model/Debug.php similarity index 52% rename from app/code/core/Mage/Paypal/Model/Resource/Report/Settlement/Row.php rename to app/code/core/Mage/Paypal/Model/Debug.php index 5fefce9516d..28c1cbb86bf 100644 --- a/app/code/core/Mage/Paypal/Model/Resource/Report/Settlement/Row.php +++ b/app/code/core/Mage/Paypal/Model/Debug.php @@ -7,15 +7,15 @@ * @package Mage_Paypal */ +declare(strict_types=1); + /** - *Report settlement row resource model - * - * @package Mage_Paypal + * PayPal Debug Model */ -class Mage_Paypal_Model_Resource_Report_Settlement_Row extends Mage_Core_Model_Resource_Db_Abstract +class Mage_Paypal_Model_Debug extends Mage_Core_Model_Abstract { protected function _construct() { - $this->_init('paypal/settlement_report_row', 'row_id'); + $this->_init('paypal/debug'); } } diff --git a/app/code/core/Mage/Paypal/Model/Direct.php b/app/code/core/Mage/Paypal/Model/Direct.php deleted file mode 100644 index 3be920c8244..00000000000 --- a/app/code/core/Mage/Paypal/Model/Direct.php +++ /dev/null @@ -1,374 +0,0 @@ -_pro = $proInstance; - } else { - /** @var Mage_Paypal_Model_Pro $model */ - $model = Mage::getModel($this->_proType); - $this->_pro = $model; - } - $this->_pro->setMethod($this->_code); - } - - /** - * Store setter - * Also updates store ID in config object - * - * @param Mage_Core_Model_Store|int $store - * @return $this - */ - public function setStore($store) - { - $this->setData('store', $store); - if ($store === null) { - $store = Mage::app()->getStore()->getId(); - } - $this->_pro->getConfig()->setStoreId(is_object($store) ? $store->getId() : $store); - return $this; - } - - /** - * Whether method is available for specified currency - * - * @param string $currencyCode - * @return bool - */ - public function canUseForCurrency($currencyCode) - { - return $this->_pro->getConfig()->isCurrencyCodeSupported($currencyCode); - } - - /** - * Payment action getter compatible with payment model - * - * @see Mage_Sales_Model_Payment::place() - * @return string - */ - public function getConfigPaymentAction() - { - return $this->_pro->getConfig()->getPaymentAction(); - } - - /** - * Return available CC types for gateway based on merchant country - * - * @return string - */ - public function getAllowedCcTypes() - { - $ccTypes = explode(',', $this->_pro->getConfig()->cctypes); - $country = $this->_pro->getConfig()->getMerchantCountry(); - - if ($country == 'GB') { - $ccTypes = array_intersect(['SM', 'SO', 'MC', 'DI', 'VI'], $ccTypes); - } elseif ($country == 'CA') { - $ccTypes = array_intersect(['MC', 'VI'], $ccTypes); - } - return implode(',', $ccTypes); - } - - /** - * Check whether payment method can be used - * @param Mage_Sales_Model_Quote|null $quote - * @return bool - */ - public function isAvailable($quote = null) - { - if (parent::isAvailable($quote) && $this->_pro->getConfig()->isMethodAvailable()) { - return true; - } - return false; - } - - /** - * Custom getter for payment configuration - * - * @param string $field - * @param int $storeId - * @return mixed - */ - public function getConfigData($field, $storeId = null) - { - return match ($field) { - 'cctypes' => $this->getAllowedCcTypes(), - default => $this->_pro->getConfig()->$field, - }; - } - - /** - * Authorize payment - * - * @param Mage_Sales_Model_Order_Payment $payment - * @return $this - */ - public function authorize(Varien_Object $payment, $amount) - { - return $this->_placeOrder($payment, $amount); - } - - /** - * Void payment - * - * @param Mage_Sales_Model_Order_Payment $payment - * @return $this - */ - public function void(Varien_Object $payment) - { - $this->_pro->void($payment); - return $this; - } - - /** - * Capture payment - * - * @param Mage_Sales_Model_Order_Payment $payment - * @return $this - */ - public function capture(Varien_Object $payment, $amount) - { - if ($this->_pro->capture($payment, $amount) === false) { - $this->_placeOrder($payment, $amount); - } - return $this; - } - - /** - * Refund capture - * - * @param Mage_Sales_Model_Order_Payment $payment - * @return $this - */ - public function refund(Varien_Object $payment, $amount) - { - $this->_pro->refund($payment, $amount); - return $this; - } - - /** - * Cancel payment - * - * @param Mage_Sales_Model_Order_Payment $payment - * @return $this - */ - public function cancel(Varien_Object $payment) - { - $this->void($payment); - - return $this; - } - - /** - * Whether payment can be reviewed - * - * @param Mage_Sales_Model_Order_Payment $payment - * @return bool - */ - public function canReviewPayment(Mage_Payment_Model_Info $payment) - { - return parent::canReviewPayment($payment) && $this->_pro->canReviewPayment($payment); - } - - /** - * Attempt to accept a pending payment - * - * @param Mage_Sales_Model_Order_Payment $payment - * @return bool - */ - public function acceptPayment(Mage_Payment_Model_Info $payment) - { - parent::acceptPayment($payment); - return $this->_pro->reviewPayment($payment, Mage_Paypal_Model_Pro::PAYMENT_REVIEW_ACCEPT); - } - - /** - * Attempt to deny a pending payment - * - * @param Mage_Sales_Model_Order_Payment $payment - * @return bool - */ - public function denyPayment(Mage_Payment_Model_Info $payment) - { - parent::denyPayment($payment); - return $this->_pro->reviewPayment($payment, Mage_Paypal_Model_Pro::PAYMENT_REVIEW_DENY); - } - - /** - * Set fallback API URL if not defined in configuration - * - * @return Mage_Centinel_Model_Service - */ - public function getCentinelValidator() - { - $validator = parent::getCentinelValidator(); - if (!$validator->getCustomApiEndpointUrl()) { - $validator->setCustomApiEndpointUrl($this->_pro->getConfig()->centinelDefaultApiUrl); - } - return $validator; - } - - /** - * Fetch transaction details info - * - * @param string $transactionId - * @return array - */ - public function fetchTransactionInfo(Mage_Payment_Model_Info $payment, $transactionId) - { - return $this->_pro->fetchTransactionInfo($payment, $transactionId); - } - - /** - * Place an order with authorization or capture action - * - * @param float $amount - * @return $this - */ - protected function _placeOrder(Mage_Sales_Model_Order_Payment $payment, $amount) - { - $order = $payment->getOrder(); - $api = $this->_pro->getApi() - ->setPaymentAction($this->_pro->getConfig()->paymentAction) - ->setIpAddress(Mage::app()->getRequest()->getClientIp(false)) - ->setAmount($amount) - ->setCurrencyCode($order->getBaseCurrencyCode()) - ->setInvNum($order->getIncrementId()) - ->setEmail($order->getCustomerEmail()) - ->setNotifyUrl(Mage::getUrl('paypal/ipn/', ['_store' => $order->getStore()->getStoreId()])) - ->setCreditCardType($payment->getCcType()) - ->setCreditCardNumber($payment->getCcNumber()) - ->setCreditCardExpirationDate( - $this->_getFormattedCcExpirationDate($payment->getCcExpMonth(), $payment->getCcExpYear()), - ) - ->setCreditCardCvv2($payment->getCcCid()) - ->setMaestroSoloIssueNumber($payment->getCcSsIssue()) - ; - if ($payment->getCcSsStartMonth() && $payment->getCcSsStartYear()) { - $year = sprintf('%02d', substr($payment->getCcSsStartYear(), -2, 2)); - $api->setMaestroSoloIssueDate( - $this->_getFormattedCcExpirationDate($payment->getCcSsStartMonth(), $year), - ); - } - if ($this->getIsCentinelValidationEnabled()) { - $this->getCentinelValidator()->exportCmpiData($api); - } - - // add shipping and billing addresses - if ($order->getIsVirtual()) { - $api->setAddress($order->getBillingAddress())->setSuppressShipping(true); - } else { - $api->setAddress($order->getShippingAddress()); - $api->setBillingAddress($order->getBillingAddress()); - } - - // add line items - $api->setPaypalCart(Mage::getModel('paypal/cart', [$order])) - ->setIsLineItemsEnabled($this->_pro->getConfig()->lineItemsEnabled) - ; - - // call api and import transaction and other payment information - $api->callDoDirectPayment(); - $this->_importResultToPayment($api, $payment); - - try { - $api->callGetTransactionDetails(); - } catch (Mage_Core_Exception $e) { - // if we receive errors, but DoDirectPayment response is Success, then set Pending status for transaction - $payment->setIsTransactionPending(true); - } - $this->_importResultToPayment($api, $payment); - return $this; - } - - /** - * Format credit card expiration date based on month and year values - * Format: mmyyyy - * - * @param string|int $month - * @param string|int $year - * @return string - */ - protected function _getFormattedCcExpirationDate($month, $year) - { - return sprintf('%02d%02d', $month, $year); - } - - /** - * Import direct payment results to payment - * - * @param Mage_Paypal_Model_Api_Nvp $api - * @param Mage_Sales_Model_Order_Payment $payment - */ - protected function _importResultToPayment($api, $payment) - { - $payment->setTransactionId($api->getTransactionId())->setIsTransactionClosed(0); - $this->_pro->importPaymentInfo($api, $payment); - } - - /** - * Check void availability - * - * @return bool - */ - public function canVoid(Varien_Object $payment) - { - if ($payment instanceof Mage_Sales_Model_Order_Invoice - || $payment instanceof Mage_Sales_Model_Order_Creditmemo - ) { - return false; - } - - return $this->_canVoid; - } -} diff --git a/app/code/core/Mage/Paypal/Model/Exception.php b/app/code/core/Mage/Paypal/Model/Exception.php new file mode 100644 index 00000000000..b484549297f --- /dev/null +++ b/app/code/core/Mage/Paypal/Model/Exception.php @@ -0,0 +1,32 @@ +_debugData = $debugData; + parent::__construct($message, 0, $previous); + } + + /** + * Get debug data + */ + public function getDebugData(): array + { + return $this->_debugData; + } +} diff --git a/app/code/core/Mage/Paypal/Model/Express.php b/app/code/core/Mage/Paypal/Model/Express.php deleted file mode 100644 index ea3a27ec7a1..00000000000 --- a/app/code/core/Mage/Paypal/Model/Express.php +++ /dev/null @@ -1,709 +0,0 @@ -_pro = $proInstance; - } else { - /** @var Mage_Paypal_Model_Pro $model */ - $model = Mage::getModel($this->_proType); - $this->_pro = $model; - } - $this->_pro->setMethod($this->_code); - $this->_setApiProcessableErrors(); - } - - /** - * Set processable error codes to API model - * - * @return Mage_Paypal_Model_Api_Nvp - */ - protected function _setApiProcessableErrors() - { - return $this->_pro->getApi()->setProcessableErrors( - [ - Mage_Paypal_Model_Api_ProcessableException::API_INTERNAL_ERROR, - Mage_Paypal_Model_Api_ProcessableException::API_UNABLE_PROCESS_PAYMENT_ERROR_CODE, - Mage_Paypal_Model_Api_ProcessableException::API_DO_EXPRESS_CHECKOUT_FAIL, - Mage_Paypal_Model_Api_ProcessableException::API_UNABLE_TRANSACTION_COMPLETE, - Mage_Paypal_Model_Api_ProcessableException::API_TRANSACTION_EXPIRED, - Mage_Paypal_Model_Api_ProcessableException::API_MAX_PAYMENT_ATTEMPTS_EXCEEDED, - Mage_Paypal_Model_Api_ProcessableException::API_COUNTRY_FILTER_DECLINE, - Mage_Paypal_Model_Api_ProcessableException::API_MAXIMUM_AMOUNT_FILTER_DECLINE, - Mage_Paypal_Model_Api_ProcessableException::API_OTHER_FILTER_DECLINE, - ], - ); - } - - /** - * Store setter - * Also updates store ID in config object - * - * @param Mage_Core_Model_Store|int $store - * @return $this - */ - public function setStore($store) - { - $this->setData('store', $store); - if ($store === null) { - $store = Mage::app()->getStore()->getId(); - } - $this->_pro->getConfig()->setStoreId(is_object($store) ? $store->getId() : $store); - return $this; - } - - /** - * Can be used in regular checkout - * - * @return bool - */ - public function canUseCheckout() - { - if (Mage::getStoreConfigFlag('payment/hosted_pro/active') - && !Mage::getStoreConfigFlag('payment/hosted_pro/display_ec') - ) { - return false; - } - return parent::canUseCheckout(); - } - - /** - * Whether method is available for specified currency - * - * @param string $currencyCode - * @return bool - */ - public function canUseForCurrency($currencyCode) - { - return $this->_pro->getConfig()->isCurrencyCodeSupported($currencyCode); - } - - /** - * Payment action getter compatible with payment model - * - * @see Mage_Sales_Model_Payment::place() - * @return string - */ - public function getConfigPaymentAction() - { - return $this->_pro->getConfig()->getPaymentAction(); - } - - /** - * Check whether payment method can be used - * @param Mage_Sales_Model_Quote|null $quote - * @return bool - */ - public function isAvailable($quote = null) - { - if (parent::isAvailable($quote) && $this->_pro->getConfig()->isMethodAvailable()) { - return true; - } - return false; - } - - /** - * Custom getter for payment configuration - * - * @param string $field - * @param int $storeId - * @return mixed - */ - public function getConfigData($field, $storeId = null) - { - return $this->_pro->getConfig()->$field; - } - - /** - * Order payment - * - * @param Mage_Sales_Model_Order_Payment $payment - * @param float $amount - * @return $this - */ - public function order(Varien_Object $payment, $amount) - { - $paypalTransactionData = Mage::getSingleton('checkout/session')->getPaypalTransactionData(); - if (!is_array($paypalTransactionData)) { - $this->_placeOrder($payment, $amount); - } else { - $this->_importToPayment($this->_pro->getApi()->setData($paypalTransactionData), $payment); - } - - $payment->setAdditionalInformation($this->_isOrderPaymentActionKey, true); - - if ($payment->getIsFraudDetected()) { - return $this; - } - - $order = $payment->getOrder(); - $orderTransactionId = $payment->getTransactionId(); - - $api = $this->_callDoAuthorize($amount, $payment, $orderTransactionId); - - $state = Mage_Sales_Model_Order::STATE_PROCESSING; - $status = true; - - $formatedPrice = $order->getBaseCurrency()->formatTxt($amount); - if ($payment->getIsTransactionPending()) { - $message = Mage::helper('paypal')->__('Ordering amount of %s is pending approval on gateway.', $formatedPrice); - $state = Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW; - } else { - $message = Mage::helper('paypal')->__('Ordered amount of %s.', $formatedPrice); - } - - $payment->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_ORDER, null, false, $message); - - $this->_pro->importPaymentInfo($api, $payment); - - if ($payment->getIsTransactionPending()) { - $message = Mage::helper('paypal')->__('Authorizing amount of %s is pending approval on gateway.', $formatedPrice); - $state = Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW; - if ($payment->getIsFraudDetected()) { - $status = Mage_Sales_Model_Order::STATUS_FRAUD; - } - } else { - $message = Mage::helper('paypal')->__('Authorized amount of %s.', $formatedPrice); - } - - $payment->resetTransactionAdditionalInfo(); - - $payment->setTransactionId($api->getTransactionId()); - $payment->setParentTransactionId($orderTransactionId); - - $transaction = $payment->addTransaction( - Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH, - null, - false, - $message, - ); - - $order->setState($state, $status); - - $payment->setSkipOrderProcessing(true); - return $this; - } - - /** - * Authorize payment - * - * @param Mage_Sales_Model_Order_Payment $payment - * @param float $amount - * @return $this - */ - public function authorize(Varien_Object $payment, $amount) - { - return $this->_placeOrder($payment, $amount); - } - - /** - * Void payment - * - * @param Mage_Sales_Model_Order_Payment $payment - * @return $this - */ - public function void(Varien_Object $payment) - { - //Switching to order transaction if needed - if ($payment->getAdditionalInformation($this->_isOrderPaymentActionKey) - && !$payment->getVoidOnlyAuthorization() - ) { - $orderTransaction = $payment->lookupTransaction( - false, - Mage_Sales_Model_Order_Payment_Transaction::TYPE_ORDER, - ); - if ($orderTransaction) { - $payment->setParentTransactionId($orderTransaction->getTxnId()); - $payment->setTransactionId($orderTransaction->getTxnId() . '-void'); - } - } - $this->_pro->void($payment); - return $this; - } - - /** - * Capture payment - * - * @param Mage_Sales_Model_Order_Payment $payment - * @param float $amount - * @return $this - */ - public function capture(Varien_Object $payment, $amount) - { - $authorizationTransaction = $payment->getAuthorizationTransaction(); - $authorizationPeriod = abs((int) $this->getConfigData('authorization_honor_period')); - $maxAuthorizationNumber = abs((int) $this->getConfigData('child_authorization_number')); - $order = $payment->getOrder(); - $isAuthorizationCreated = false; - - if ($payment->getAdditionalInformation($this->_isOrderPaymentActionKey)) { - $voided = false; - if (!$authorizationTransaction->getIsClosed() - && $this->_isTransactionExpired($authorizationTransaction, $authorizationPeriod) - ) { - //Save payment state and configure payment object for voiding - $isCaptureFinal = $payment->getShouldCloseParentTransaction(); - $captureTrxId = $payment->getTransactionId(); - $payment->setShouldCloseParentTransaction(false); - $payment->setParentTransactionId($authorizationTransaction->getTxnId()); - $payment->unsTransactionId(); - $payment->setVoidOnlyAuthorization(true); - $payment->void(new Varien_Object()); - - //Revert payment state after voiding - $payment->unsAuthorizationTransaction(); - $payment->unsTransactionId(); - $payment->setShouldCloseParentTransaction($isCaptureFinal); - $voided = true; - } - - if ($authorizationTransaction->getIsClosed() || $voided) { - if ($payment->getAdditionalInformation($this->_authorizationCountKey) > $maxAuthorizationNumber - 1) { - Mage::throwException(Mage::helper('paypal')->__('The maximum number of child authorizations is reached.')); - } - $api = $this->_callDoAuthorize( - $amount, - $payment, - $authorizationTransaction->getParentTxnId(), - ); - - //Adding authorization transaction - $this->_pro->importPaymentInfo($api, $payment); - $payment->setTransactionId($api->getTransactionId()); - $payment->setParentTransactionId($authorizationTransaction->getParentTxnId()); - $payment->setIsTransactionClosed(false); - - $formatedPrice = $order->getBaseCurrency()->formatTxt($amount); - - if ($payment->getIsTransactionPending()) { - $message = Mage::helper('paypal')->__('Authorizing amount of %s is pending approval on gateway.', $formatedPrice); - } else { - $message = Mage::helper('paypal')->__('Authorized amount of %s.', $formatedPrice); - } - - $transaction = $payment->addTransaction( - Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH, - null, - true, - $message, - ); - - $payment->setParentTransactionId($api->getTransactionId()); - $isAuthorizationCreated = true; - } - //close order transaction if needed - if ($payment->getShouldCloseParentTransaction()) { - $orderTransaction = $payment->lookupTransaction( - false, - Mage_Sales_Model_Order_Payment_Transaction::TYPE_ORDER, - ); - - if ($orderTransaction) { - $orderTransaction->setIsClosed(true); - $order->addRelatedObject($orderTransaction); - } - } - } - - if ($this->_pro->capture($payment, $amount) === false) { - $this->_placeOrder($payment, $amount); - } - - if ($isAuthorizationCreated && isset($transaction)) { - $transaction->setIsClosed(true); - } - - return $this; - } - - /** - * Refund capture - * - * @param Mage_Sales_Model_Order_Payment $payment - * @param float $amount - * @return $this - */ - public function refund(Varien_Object $payment, $amount) - { - $this->_pro->refund($payment, $amount); - return $this; - } - - /** - * Cancel payment - * - * @param Mage_Sales_Model_Order_Payment $payment - * @return $this - */ - public function cancel(Varien_Object $payment) - { - $this->void($payment); - - return $this; - } - - /** - * Whether payment can be reviewed - * - * @param Mage_Sales_Model_Order_Payment $payment - * @return bool - */ - public function canReviewPayment(Mage_Payment_Model_Info $payment) - { - return parent::canReviewPayment($payment) && $this->_pro->canReviewPayment($payment); - } - - /** - * Attempt to accept a pending payment - * - * @param Mage_Sales_Model_Order_Payment $payment - * @return bool - */ - public function acceptPayment(Mage_Payment_Model_Info $payment) - { - parent::acceptPayment($payment); - return $this->_pro->reviewPayment($payment, Mage_Paypal_Model_Pro::PAYMENT_REVIEW_ACCEPT); - } - - /** - * Attempt to deny a pending payment - * - * @param Mage_Sales_Model_Order_Payment $payment - * @return bool - */ - public function denyPayment(Mage_Payment_Model_Info $payment) - { - parent::denyPayment($payment); - return $this->_pro->reviewPayment($payment, Mage_Paypal_Model_Pro::PAYMENT_REVIEW_DENY); - } - - /** - * Checkout redirect URL getter for onepage checkout (hardcode) - * - * @see Mage_Checkout_OnepageController::savePaymentAction() - * @see Mage_Sales_Model_Quote_Payment::getCheckoutRedirectUrl() - * @return string - */ - public function getCheckoutRedirectUrl() - { - return Mage::getUrl('paypal/express/start'); - } - - /** - * Fetch transaction details info - * - * @param string $transactionId - * @return array - */ - public function fetchTransactionInfo(Mage_Payment_Model_Info $payment, $transactionId) - { - return $this->_pro->fetchTransactionInfo($payment, $transactionId); - } - - /** - * Validate RP data - */ - public function validateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile) - { - return $this->_pro->validateRecurringProfile($profile); - } - - /** - * Submit RP to the gateway - */ - public function submitRecurringProfile( - Mage_Payment_Model_Recurring_Profile $profile, - Mage_Payment_Model_Info $paymentInfo - ) { - $token = $paymentInfo-> - getAdditionalInformation(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_TOKEN); - $profile->setToken($token); - $this->_pro->submitRecurringProfile($profile, $paymentInfo); - } - - /** - * Fetch RP details - * - * @param string $referenceId - */ - public function getRecurringProfileDetails($referenceId, Varien_Object $result) - { - return $this->_pro->getRecurringProfileDetails($referenceId, $result); - } - - /** - * Whether can get recurring profile details - */ - public function canGetRecurringProfileDetails() - { - return true; - } - - /** - * Update RP data - */ - public function updateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile) - { - return $this->_pro->updateRecurringProfile($profile); - } - - /** - * Manage status - */ - public function updateRecurringProfileStatus(Mage_Payment_Model_Recurring_Profile $profile) - { - return $this->_pro->updateRecurringProfileStatus($profile); - } - - /** - * @inheritDoc - */ - public function assignData($data) - { - $result = parent::assignData($data); - $key = Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT; - if (is_array($data)) { - $this->getInfoInstance()->setAdditionalInformation($key, $data[$key] ?? null); - } elseif ($data instanceof Varien_Object) { - $this->getInfoInstance()->setAdditionalInformation($key, $data->getData($key)); - } - return $result; - } - - /** - * Place an order with authorization or capture action - * - * @param float $amount - * @return $this - */ - protected function _placeOrder(Mage_Sales_Model_Order_Payment $payment, $amount) - { - $order = $payment->getOrder(); - - // prepare api call - $token = $payment->getAdditionalInformation(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_TOKEN); - $api = $this->_pro->getApi() - ->setToken($token) - ->setPayerId($payment-> - getAdditionalInformation(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_PAYER_ID)) - ->setAmount($amount) - ->setPaymentAction($this->_pro->getConfig()->paymentAction) - ->setNotifyUrl(Mage::getUrl('paypal/ipn/')) - ->setInvNum($order->getIncrementId()) - ->setCurrencyCode($order->getBaseCurrencyCode()) - ->setPaypalCart(Mage::getModel('paypal/cart', [$order])) - ->setIsLineItemsEnabled($this->_pro->getConfig()->lineItemsEnabled); - - // call api and get details from it - $api->callDoExpressCheckoutPayment(); - - $this->_importToPayment($api, $payment); - return $this; - } - - /** - * Import payment info to payment - * - * @param Mage_Paypal_Model_Api_Nvp $api - * @param Mage_Sales_Model_Order_Payment $payment - */ - protected function _importToPayment($api, $payment) - { - $payment->setTransactionId($api->getTransactionId())->setIsTransactionClosed(0) - ->setAdditionalInformation( - Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_REDIRECT, - $api->getRedirectRequired(), - ); - - if ($api->getBillingAgreementId()) { - $payment->setBillingAgreementData([ - 'billing_agreement_id' => $api->getBillingAgreementId(), - 'method_code' => Mage_Paypal_Model_Config::METHOD_BILLING_AGREEMENT, - ]); - } - - $this->_pro->importPaymentInfo($api, $payment); - } - - /** - * Check void availability - * - * @return bool - */ - public function canVoid(Varien_Object $payment) - { - if ($payment instanceof Mage_Sales_Model_Order_Invoice - || $payment instanceof Mage_Sales_Model_Order_Creditmemo - ) { - return false; - } - $info = $this->getInfoInstance(); - if ($info->getAdditionalInformation($this->_isOrderPaymentActionKey)) { - $orderTransaction = $info->lookupTransaction( - false, - Mage_Sales_Model_Order_Payment_Transaction::TYPE_ORDER, - ); - if ($orderTransaction) { - $info->setParentTransactionId($orderTransaction->getTxnId()); - } - } - - return $this->_canVoid; - } - - /** - * Check capture availability - * - * @return bool - */ - public function canCapture() - { - $payment = $this->getInfoInstance(); - $this->_pro->getConfig()->setStoreId($payment->getOrder()->getStore()->getId()); - - if ($payment->getAdditionalInformation($this->_isOrderPaymentActionKey)) { - $orderTransaction = $payment->lookupTransaction( - false, - Mage_Sales_Model_Order_Payment_Transaction::TYPE_ORDER, - ); - if ($orderTransaction->getIsClosed()) { - return false; - } - - $orderValidPeriod = abs((int) $this->getConfigData('order_valid_period')); - - $dateCompass = new DateTime($orderTransaction->getCreatedAt()); - $dateCompass->modify('+' . $orderValidPeriod . ' days'); - $currentDate = new DateTime(); - - if ($currentDate > $dateCompass || $orderValidPeriod == 0) { - return false; - } - } - return $this->_canCapture; - } - - /** - * Call DoAuthorize - * - * @param int $amount - * @param Varien_Object $payment - * @param string $parentTransactionId - * @return Mage_Paypal_Model_Api_Abstract - * @throws Mage_Paypal_Model_Api_ProcessableException - */ - protected function _callDoAuthorize($amount, $payment, $parentTransactionId) - { - $apiData = $this->_pro->getApi()->getData(); - foreach ($apiData as $k => $v) { - if (is_object($v)) { - unset($apiData[$k]); - } - } - Mage::getSingleton('checkout/session')->setPaypalTransactionData($apiData); - $this->_pro->resetApi(); - $api = $this->_setApiProcessableErrors() - ->setAmount($amount) - ->setCurrencyCode($payment->getOrder()->getBaseCurrencyCode()) - ->setTransactionId($parentTransactionId) - ->callDoAuthorization(); - - $payment->setAdditionalInformation( - $this->_authorizationCountKey, - $payment->getAdditionalInformation($this->_authorizationCountKey) + 1, - ); - - return $api; - } - - /** - * Check transaction for expiration in PST - * - * @param int $period - * @return bool - */ - protected function _isTransactionExpired(Mage_Sales_Model_Order_Payment_Transaction $transaction, $period) - { - $period = (int) $period; - if ($period == 0) { - return true; - } - - $transactionClosingDate = new DateTime($transaction->getCreatedAt(), new DateTimeZone('GMT')); - $transactionClosingDate->setTimezone(new DateTimeZone('US/Pacific')); - /** - * 11:49:00 PayPal transactions closing time - */ - $transactionClosingDate->setTime(11, 49, 00); - $transactionClosingDate->modify('+' . $period . ' days'); - - $currentTime = new DateTime(null, new DateTimeZone('US/Pacific')); - - if ($currentTime > $transactionClosingDate) { - return true; - } - - return false; - } -} diff --git a/app/code/core/Mage/Paypal/Model/Express/Checkout.php b/app/code/core/Mage/Paypal/Model/Express/Checkout.php deleted file mode 100644 index 1ec4e942070..00000000000 --- a/app/code/core/Mage/Paypal/Model/Express/Checkout.php +++ /dev/null @@ -1,1072 +0,0 @@ -_quote = $params['quote']; - } else { - throw new Exception('Quote instance is required.'); - } - if (isset($params['config']) && $params['config'] instanceof Mage_Paypal_Model_Config) { - $this->_config = $params['config']; - } else { - throw new Exception('Config instance is required.'); - } - $this->_customerSession = isset($params['session']) && $params['session'] instanceof Mage_Customer_Model_Session - ? $params['session'] : Mage::getSingleton('customer/session'); - } - - /** - * Checkout with PayPal image URL getter - * Spares API calls of getting "pal" variable, by putting it into cache per store view - * @return string - */ - public function getCheckoutShortcutImageUrl() - { - // get "pal" thing from cache or lookup it via API - $pal = null; - if ($this->_config->areButtonsDynamic()) { - $cacheId = self::PAL_CACHE_ID . Mage::app()->getStore()->getId(); - $pal = Mage::app()->loadCache($cacheId); - if ($pal == -1) { - $pal = null; - } elseif (!$pal) { - $pal = null; - $this->_getApi(); - try { - $this->_api->callGetPalDetails(); - $pal = $this->_api->getPal(); - Mage::app()->saveCache($pal, $cacheId, [Mage_Core_Model_Config::CACHE_TAG]); - } catch (Exception $e) { - Mage::app()->saveCache(-1, $cacheId, [Mage_Core_Model_Config::CACHE_TAG]); - Mage::logException($e); - } - } - } - - return $this->_config->getExpressCheckoutShortcutImageUrl( - Mage::app()->getLocale()->getLocaleCode(), - $this->_quote->getBaseGrandTotal(), - $pal, - ); - } - - /** - * Setter that enables giropay redirects flow - * - * @param string $successUrl - payment success result - * @param string $cancelUrl - payment cancellation result - * @param string $pendingUrl - pending payment result - * @return $this - */ - public function prepareGiropayUrls($successUrl, $cancelUrl, $pendingUrl) - { - $this->_giropayUrls = [$successUrl, $cancelUrl, $pendingUrl]; - return $this; - } - - /** - * Set create billing agreement flag - * - * @param bool $flag - * @return $this - */ - public function setIsBillingAgreementRequested($flag) - { - $this->_isBARequested = $flag; - return $this; - } - - /** - * Setter for customer Id - * - * @param int $id - * @return $this - * @deprecated please use self::setCustomer - */ - public function setCustomerId($id) - { - $this->_customerId = $id; - return $this; - } - - /** - * Set flag that forces to use BillMeLater - * - * @param bool $isBml - */ - public function setIsBml($isBml) - { - $this->_isBml = $isBml; - } - - /** - * Setter for customer - * - * @param Mage_Customer_Model_Customer $customer - * @return $this - */ - public function setCustomer($customer) - { - $this->_quote->assignCustomer($customer); - $this->_customerId = $customer->getId(); - return $this; - } - - /** - * Setter for customer with billing and shipping address changing ability - * - * @param Mage_Customer_Model_Customer $customer - * @param Mage_Sales_Model_Quote_Address $billingAddress - * @param Mage_Sales_Model_Quote_Address $shippingAddress - * @return $this - */ - public function setCustomerWithAddressChange($customer, $billingAddress = null, $shippingAddress = null) - { - $this->_quote->assignCustomerWithAddressChange($customer, $billingAddress, $shippingAddress); - $this->_customerId = $customer->getId(); - return $this; - } - - /** - * Reserve order ID for specified quote and start checkout on PayPal - * - * @param string $returnUrl - * @param string $cancelUrl - * @param bool|null $button - * @return mixed - */ - public function start($returnUrl, $cancelUrl, $button = null) - { - $this->_quote->collectTotals(); - - if (!$this->_quote->getGrandTotal() && !$this->_quote->hasNominalItems()) { - Mage::throwException(Mage::helper('paypal')->__('PayPal does not support processing orders with zero amount. To complete your purchase, proceed to the standard checkout process.')); - } - - $this->_quote->reserveOrderId()->save(); - // prepare API - $this->_getApi(); - $solutionType = $this->_config->getMerchantCountry() == 'DE' - ? Mage_Paypal_Model_Config::EC_SOLUTION_TYPE_MARK : $this->_config->solutionType; - $this->_api->setAmount($this->_quote->getBaseGrandTotal()) - ->setCurrencyCode($this->_quote->getBaseCurrencyCode()) - ->setInvNum($this->_quote->getReservedOrderId()) - ->setReturnUrl($returnUrl) - ->setCancelUrl($cancelUrl) - ->setSolutionType($solutionType) - ->setPaymentAction($this->_config->paymentAction); - - if ($this->_giropayUrls) { - [$successUrl, $cancelUrl, $pendingUrl] = $this->_giropayUrls; - $this->_api->addData([ - 'giropay_cancel_url' => $cancelUrl, - 'giropay_success_url' => $successUrl, - 'giropay_bank_txn_pending_url' => $pendingUrl, - ]); - } - - if ($this->_isBml) { - $this->_api->setFundingSource('BML'); - } - - $this->_setBillingAgreementRequest(); - - if ($this->_config->requireBillingAddress == Mage_Paypal_Model_Config::REQUIRE_BILLING_ADDRESS_ALL) { - $this->_api->setRequireBillingAddress(1); - } - - // suppress or export shipping address - if ($this->_quote->getIsVirtual()) { - if ($this->_config->requireBillingAddress == Mage_Paypal_Model_Config::REQUIRE_BILLING_ADDRESS_VIRTUAL) { - $this->_api->setRequireBillingAddress(1); - } - $this->_api->setSuppressShipping(true); - } else { - $address = $this->_quote->getShippingAddress(); - $isOverriden = 0; - if ($address->validate() === true) { - $isOverriden = 1; - $this->_api->setAddress($address); - } - $this->_quote->getPayment()->setAdditionalInformation( - self::PAYMENT_INFO_TRANSPORT_SHIPPING_OVERRIDEN, - $isOverriden, - ); - $this->_quote->getPayment()->save(); - } - - // add line items - $paypalCart = Mage::getModel('paypal/cart', [$this->_quote]); - $this->_api->setPaypalCart($paypalCart) - ->setIsLineItemsEnabled($this->_config->lineItemsEnabled) - ; - - // add shipping options if needed and line items are available - if ($this->_config->lineItemsEnabled && $this->_config->transferShippingOptions && $paypalCart->getItems()) { - if (!$this->_quote->getIsVirtual() && !$this->_quote->hasNominalItems()) { - if ($options = $this->_prepareShippingOptions($address, true)) { - $this->_api->setShippingOptionsCallbackUrl( - Mage::getUrl('*/*/shippingOptionsCallback', ['quote_id' => $this->_quote->getId()]), - )->setShippingOptions($options); - } - } - } - - // add recurring payment profiles information - if ($profiles = $this->_quote->prepareRecurringPaymentProfiles()) { - foreach ($profiles as $profile) { - $profile->setMethodCode(Mage_Paypal_Model_Config::METHOD_WPP_EXPRESS); - if (!$profile->isValid()) { - Mage::throwException($profile->getValidationErrors(true, true)); - } - } - $this->_api->addRecurringPaymentProfiles($profiles); - } - - $this->_config->exportExpressCheckoutStyleSettings($this->_api); - - // call API and redirect with token - $this->_api->callSetExpressCheckout(); - $token = $this->_api->getToken(); - $this->_redirectUrl = $button ? $this->_config->getExpressCheckoutStartUrl($token) - : $this->_config->getPayPalBasicStartUrl($token); - - $this->_quote->getPayment()->unsAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT); - - // Set flag that we came from Express Checkout button - if (!empty($button)) { - $this->_quote->getPayment()->setAdditionalInformation(self::PAYMENT_INFO_BUTTON, 1); - } elseif ($this->_quote->getPayment()->hasAdditionalInformation(self::PAYMENT_INFO_BUTTON)) { - $this->_quote->getPayment()->unsAdditionalInformation(self::PAYMENT_INFO_BUTTON); - } - - $this->_quote->getPayment()->save(); - return $token; - } - - /** - * Check whether system can skip order review page before placing order - * - * @return bool - */ - public function canSkipOrderReviewStep() - { - $isOnepageCheckout = !$this->_quote->getPayment() - ->getAdditionalInformation(self::PAYMENT_INFO_BUTTON); - return $this->_config->isOrderReviewStepDisabled() && $isOnepageCheckout; - } - - /** - * Update quote when returned from PayPal - * rewrite billing address by paypal - * save old billing address for new customer - * export shipping address in case address absence - * - * @param string $token - */ - public function returnFromPaypal($token) - { - $this->_getApi(); - $this->_api->setToken($token) - ->callGetExpressCheckoutDetails(); - $quote = $this->_quote; - - $this->_ignoreAddressValidation(); - - // import shipping address - $exportedShippingAddress = $this->_api->getExportedShippingAddress(); - if (!$quote->getIsVirtual()) { - $shippingAddress = $quote->getShippingAddress(); - if ($shippingAddress) { - if ($exportedShippingAddress) { - $this->_setExportedAddressData($shippingAddress, $exportedShippingAddress); - - if ($quote->getPayment()->getAdditionalInformation(self::PAYMENT_INFO_BUTTON) == 1) { - // PayPal doesn't provide detailed shipping info: prefix, middlename, lastname, suffix - $shippingAddress->setPrefix(null); - $shippingAddress->setMiddlename(null); - $shippingAddress->setLastname(null); - $shippingAddress->setSuffix(null); - } - - $shippingAddress->setCollectShippingRates(true); - $shippingAddress->setSameAsBilling(0); - } - - // import shipping method - $code = ''; - if ($this->_api->getShippingRateCode()) { - if ($code = $this->_matchShippingMethodCode($shippingAddress, $this->_api->getShippingRateCode())) { - // possible bug of double collecting rates :-/ - $shippingAddress->setShippingMethod($code)->setCollectShippingRates(true); - } - } - $quote->getPayment()->setAdditionalInformation( - self::PAYMENT_INFO_TRANSPORT_SHIPPING_METHOD, - $code, - ); - } - } - - // import billing address - $portBillingFromShipping = $quote->getPayment()->getAdditionalInformation(self::PAYMENT_INFO_BUTTON) == 1 - && $this->_config->requireBillingAddress != Mage_Paypal_Model_Config::REQUIRE_BILLING_ADDRESS_ALL - && !$quote->isVirtual(); - if (isset($shippingAddress) && $portBillingFromShipping) { - $billingAddress = clone $shippingAddress; - $billingAddress->unsAddressId() - ->unsAddressType(); - $data = $billingAddress->getData(); - $data['save_in_address_book'] = 0; - $quote->getBillingAddress()->addData($data); - $quote->getShippingAddress()->setSameAsBilling(1); - } else { - $billingAddress = $quote->getBillingAddress(); - } - $exportedBillingAddress = $this->_api->getExportedBillingAddress(); - $this->_setExportedAddressData($billingAddress, $exportedBillingAddress); - $billingAddress->setCustomerNotes($exportedBillingAddress->getData('note')); - $quote->setBillingAddress($billingAddress); - - // import payment info - $payment = $quote->getPayment(); - $payment->setMethod($this->_methodType); - Mage::getSingleton('paypal/info')->importToPayment($this->_api, $payment); - $payment->setAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_PAYER_ID, $this->_api->getPayerId()) - ->setAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_TOKEN, $token) - ; - $quote->collectTotals()->save(); - } - - /** - * Check whether order review has enough data to initialize - * - * @param string $token - * @throws Mage_Core_Exception - */ - public function prepareOrderReview($token = null) - { - $payment = $this->_quote->getPayment(); - if (!$payment || !$payment->getAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_PAYER_ID)) { - Mage::throwException(Mage::helper('paypal')->__('Payer is not identified.')); - } - $this->_quote->setMayEditShippingAddress( - $this->_quote->getPayment()->getAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_SHIPPING_OVERRIDEN) != 1, - ); - $this->_quote->setMayEditShippingMethod( - $this->_quote->getPayment()->getAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_SHIPPING_METHOD) == '', - ); - $this->_ignoreAddressValidation(); - $this->_quote->collectTotals()->save(); - } - - /** - * Return callback response with shipping options - * - * @return string - */ - public function getShippingOptionsCallbackResponse(array $request) - { - // prepare debug data - $logger = Mage::getModel('core/log_adapter', 'payment_' . $this->_methodType . '.log'); - $debugData = ['request' => $request, 'response' => []]; - - try { - // obtain addresses - $this->_getApi(); - $address = $this->_api->prepareShippingOptionsCallbackAddress($request); - $quoteAddress = $this->_quote->getShippingAddress(); - - // compare addresses, calculate shipping rates and prepare response - $options = []; - if ($address && $quoteAddress && !$this->_quote->getIsVirtual()) { - foreach ($address->getExportedKeys() as $key) { - $quoteAddress->setDataUsingMethod($key, $address->getData($key)); - } - $quoteAddress->setCollectShippingRates(true)->collectTotals(); - $options = $this->_prepareShippingOptions($quoteAddress, false, true); - } - $response = $this->_api->setShippingOptions($options)->formatShippingOptionsCallback(); - - // log request and response - $debugData['response'] = $response; - $logger->log($debugData); - return $response; - } catch (Exception $e) { - $logger->log($debugData); - throw $e; - } - } - - /** - * Set shipping method to quote, if needed - * @param string $methodCode - */ - public function updateShippingMethod($methodCode) - { - if (!$this->_quote->getIsVirtual() && $shippingAddress = $this->_quote->getShippingAddress()) { - if ($methodCode != $shippingAddress->getShippingMethod()) { - $this->_ignoreAddressValidation(); - $shippingAddress->setShippingMethod($methodCode)->setCollectShippingRates(true); - $this->_quote->collectTotals()->save(); - } - } - } - - /** - * Place the order and recurring payment profiles when customer returned from paypal - * Until this moment all quote data must be valid - * - * @param string $token - * @param string $shippingMethodCode - */ - public function place($token, $shippingMethodCode = null) - { - if ($shippingMethodCode) { - $this->updateShippingMethod($shippingMethodCode); - } - - $isNewCustomer = false; - switch ($this->getCheckoutMethod()) { - case Mage_Checkout_Model_Type_Onepage::METHOD_GUEST: - $this->_prepareGuestQuote(); - break; - case Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER: - $this->_prepareNewCustomerQuote(); - $isNewCustomer = true; - break; - default: - $this->_prepareCustomerQuote(); - break; - } - - $this->_ignoreAddressValidation(); - $this->_quote->collectTotals(); - $service = Mage::getModel('sales/service_quote', $this->_quote); - $service->submitAll(); - $this->_quote->save(); - - if ($isNewCustomer) { - try { - $this->_involveNewCustomer(); - } catch (Exception $e) { - Mage::logException($e); - } - } - - $this->_recurringPaymentProfiles = $service->getRecurringPaymentProfiles(); - // TODO: send recurring profile emails - - /** @var Mage_Sales_Model_Order $order */ - $order = $service->getOrder(); - if (!$order) { - return; - } - $this->_billingAgreement = $order->getPayment()->getBillingAgreement(); - - // commence redirecting to finish payment, if paypal requires it - if ($order->getPayment()->getAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_REDIRECT)) { - $this->_redirectUrl = $this->_config->getExpressCheckoutCompleteUrl($token); - } - - switch ($order->getState()) { - // even after placement paypal can disallow to authorize/capture, but will wait until bank transfers money - case Mage_Sales_Model_Order::STATE_PENDING_PAYMENT: - // TODO - break; - // regular placement, when everything is ok - case Mage_Sales_Model_Order::STATE_PROCESSING: - case Mage_Sales_Model_Order::STATE_COMPLETE: - case Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW: - $order->queueNewOrderEmail(); - break; - } - $this->_order = $order; - } - - /** - * Make sure addresses will be saved without validation errors - */ - private function _ignoreAddressValidation() - { - $this->_quote->getBillingAddress()->setShouldIgnoreValidation(true); - if (!$this->_quote->getIsVirtual()) { - $this->_quote->getShippingAddress()->setShouldIgnoreValidation(true); - if (!$this->_config->requireBillingAddress && !$this->_quote->getBillingAddress()->getEmail()) { - $this->_quote->getBillingAddress()->setSameAsBilling(1); - } - } - } - - /** - * Determine whether redirect somewhere specifically is required - * - * @return string - */ - public function getRedirectUrl() - { - return $this->_redirectUrl; - } - - /** - * Return recurring payment profiles - * - * @return array - */ - public function getRecurringPaymentProfiles() - { - return $this->_recurringPaymentProfiles; - } - - /** - * Get created billing agreement - * - * @return Mage_Sales_Model_Billing_Agreement|null - */ - public function getBillingAgreement() - { - return $this->_billingAgreement; - } - - /** - * Return order - * - * @return Mage_Sales_Model_Order - */ - public function getOrder() - { - return $this->_order; - } - - /** - * Get checkout method - * - * @return string - */ - public function getCheckoutMethod() - { - if ($this->getCustomerSession()->isLoggedIn()) { - return Mage_Checkout_Model_Type_Onepage::METHOD_CUSTOMER; - } - if (!$this->_quote->getCheckoutMethod()) { - if (Mage::helper('checkout')->isAllowedGuestCheckout($this->_quote)) { - $this->_quote->setCheckoutMethod(Mage_Checkout_Model_Type_Onepage::METHOD_GUEST); - } else { - $this->_quote->setCheckoutMethod(Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER); - } - } - return $this->_quote->getCheckoutMethod(); - } - - /** - * Sets address data from exported address - * - * @param Mage_Sales_Model_Quote_Address $address - * @param array $exportedAddress - */ - protected function _setExportedAddressData($address, $exportedAddress) - { - // Exported data is more priority if we came from Express Checkout button - $isButton = (bool) $this->_quote->getPayment()->getAdditionalInformation(self::PAYMENT_INFO_BUTTON); - if (!$isButton) { - foreach ($exportedAddress->getExportedKeys() as $key) { - $oldData = $address->getDataUsingMethod($key); - $isEmpty = null; - if (is_array($oldData)) { - foreach ($oldData as $val) { - if (!empty($val)) { - $isEmpty = false; - break; - } - $isEmpty = true; - } - } - if (empty($oldData) || $isEmpty === true) { - $address->setDataUsingMethod($key, $exportedAddress->getData($key)); - } - } - } else { - foreach ($exportedAddress->getExportedKeys() as $key) { - $data = $exportedAddress->getData($key); - if (!empty($data)) { - $address->setDataUsingMethod($key, $data); - } - } - } - } - - /** - * Set create billing agreement flag to api call - * - * @return $this - */ - protected function _setBillingAgreementRequest() - { - if (!$this->_customerId || $this->_quote->hasNominalItems()) { - return $this; - } - - $isRequested = $this->_isBARequested || $this->_quote->getPayment() - ->getAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT); - - if (!($this->_config->allow_ba_signup == Mage_Paypal_Model_Config::EC_BA_SIGNUP_AUTO - || $isRequested && $this->_config->shouldAskToCreateBillingAgreement()) - ) { - return $this; - } - - if (!Mage::getModel('sales/billing_agreement')->needToCreateForCustomer($this->_customerId)) { - return $this; - } - $this->_api->setBillingType($this->_api->getBillingAgreementType()); - return $this; - } - - /** - * @return Mage_Paypal_Model_Api_Nvp - */ - protected function _getApi() - { - if ($this->_api === null) { - $this->_api = Mage::getModel($this->_apiType)->setConfigObject($this->_config); - } - return $this->_api; - } - - /** - * Attempt to collect address shipping rates and return them for further usage in instant update API - * Returns empty array if it was impossible to obtain any shipping rate - * If there are shipping rates obtained, the method must return one of them as default. - * - * @param bool $mayReturnEmpty - * @return array - */ - protected function _prepareShippingOptions( - Mage_Sales_Model_Quote_Address $address, - $mayReturnEmpty = false, - $calculateTax = false - ) { - $options = []; - $i = 0; - $iMin = false; - $min = false; - $userSelectedOption = null; - - foreach ($address->getGroupedAllShippingRates() as $group) { - foreach ($group as $rate) { - $amount = (float) $rate->getPrice(); - if ($rate->getErrorMessage()) { - continue; - } - $isDefault = $address->getShippingMethod() === $rate->getCode(); - $amountExclTax = Mage::helper('tax')->getShippingPrice($amount, false, $address); - $amountInclTax = Mage::helper('tax')->getShippingPrice($amount, true, $address); - - $options[$i] = new Varien_Object([ - 'is_default' => $isDefault, - 'name' => trim("{$rate->getCarrier()} - {$rate->getMethodTitle()}", ' -'), - 'code' => $rate->getCode(), - 'amount' => $amountExclTax, - ]); - if ($calculateTax) { - $options[$i]->setTaxAmount( - $amountInclTax - $amountExclTax - + $address->getTaxAmount() - $address->getShippingTaxAmount(), - ); - } - if ($isDefault) { - $userSelectedOption = $options[$i]; - } - if ($min === false || $amountInclTax < $min) { - $min = $amountInclTax; - $iMin = $i; - } - $i++; - } - } - - if ($mayReturnEmpty && is_null($userSelectedOption)) { - $options[] = new Varien_Object([ - 'is_default' => true, - 'name' => Mage::helper('paypal')->__('N/A'), - 'code' => 'no_rate', - 'amount' => 0.00, - ]); - if ($calculateTax) { - $options[$i]->setTaxAmount($address->getTaxAmount()); - } - } elseif (is_null($userSelectedOption) && isset($options[$iMin])) { - $options[$iMin]->setIsDefault(true); - } - - // Magento will transfer only first 10 cheapest shipping options if there are more than 10 available. - if (count($options) > 10) { - usort($options, [static::class,'cmpShippingOptions']); - array_splice($options, 10); - // User selected option will be always included in options list - if (!is_null($userSelectedOption) && !in_array($userSelectedOption, $options)) { - $options[9] = $userSelectedOption; - } - } - - return $options; - } - - /** - * Compare two shipping options based on their amounts - * - * This function is used as a callback comparison function in shipping options sorting process - * @see self::_prepareShippingOptions() - * - * @return int - */ - protected static function cmpShippingOptions(Varien_Object $option1, Varien_Object $option2) - { - return $option1->getAmount() <=> $option2->getAmount(); - } - - /** - * Try to find whether the code provided by PayPal corresponds to any of possible shipping rates - * This method was created only because PayPal has issues with returning the selected code. - * If in future the issue is fixed, we don't need to attempt to match it. It would be enough to set the method code - * before collecting shipping rates - * - * @param string $selectedCode - * @return string - */ - protected function _matchShippingMethodCode(Mage_Sales_Model_Quote_Address $address, $selectedCode) - { - $options = $this->_prepareShippingOptions($address, false); - foreach ($options as $option) { - if ($selectedCode === $option['code'] // the proper case as outlined in documentation - || $selectedCode === $option['name'] // workaround: PayPal may return name instead of the code - // workaround: PayPal may concatenate code and name, and return it instead of the code: - || $selectedCode === "{$option['code']} {$option['name']}" - ) { - return $option['code']; - } - } - return ''; - } - - /** - * Prepare quote for guest checkout order submit - * - * @return $this - */ - protected function _prepareGuestQuote() - { - $quote = $this->_quote; - $quote->setCustomerId(null) - ->setCustomerEmail($quote->getBillingAddress()->getEmail()) - ->setCustomerIsGuest(true) - ->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID); - return $this; - } - - /** - * Checks if customer with email coming from Express checkout exists - * - * @return int - */ - protected function _lookupCustomerId() - { - return Mage::getModel('customer/customer') - ->setWebsiteId(Mage::app()->getWebsite()->getId()) - ->loadByEmail($this->_quote->getCustomerEmail()) - ->getId(); - } - - /** - * Prepare quote for customer registration and customer order submit - * and restore magento customer data from quote - * - * @return $this - */ - protected function _prepareNewCustomerQuote() - { - $quote = $this->_quote; - $billing = $quote->getBillingAddress(); - $shipping = $quote->isVirtual() ? null : $quote->getShippingAddress(); - - $customerId = $this->_lookupCustomerId(); - if ($customerId && !$this->_customerEmailExists($quote->getCustomerEmail())) { - $this->getCustomerSession()->loginById($customerId); - return $this->_prepareCustomerQuote(); - } - - $customer = $quote->getCustomer(); - /** @var Mage_Customer_Model_Customer $customer */ - $customerBilling = $billing->exportCustomerAddress(); - $customer->addAddress($customerBilling); - $billing->setCustomerAddress($customerBilling); - $customerBilling->setIsDefaultBilling(true); - if ($shipping && !$shipping->getSameAsBilling()) { - $customerShipping = $shipping->exportCustomerAddress(); - $customer->addAddress($customerShipping); - $shipping->setCustomerAddress($customerShipping); - $customerShipping->setIsDefaultShipping(true); - } elseif ($shipping) { - $customerBilling->setIsDefaultShipping(true); - } - /** - * @todo integration with dynamica attributes customer_dob, customer_taxvat, customer_gender - */ - if ($quote->getCustomerDob() && !$billing->getCustomerDob()) { - $billing->setCustomerDob($quote->getCustomerDob()); - } - - if ($quote->getCustomerTaxvat() && !$billing->getCustomerTaxvat()) { - $billing->setCustomerTaxvat($quote->getCustomerTaxvat()); - } - - if ($quote->getCustomerGender() && !$billing->getCustomerGender()) { - $billing->setCustomerGender($quote->getCustomerGender()); - } - - Mage::helper('core')->copyFieldset('checkout_onepage_billing', 'to_customer', $billing, $customer); - $customer->setEmail($quote->getCustomerEmail()); - $customer->setPrefix($quote->getCustomerPrefix()); - $customer->setFirstname($quote->getCustomerFirstname()); - $customer->setMiddlename($quote->getCustomerMiddlename()); - $customer->setLastname($quote->getCustomerLastname()); - $customer->setSuffix($quote->getCustomerSuffix()); - $customer->setPassword($customer->decryptPassword($quote->getPasswordHash())); - $customer->setPasswordHash($customer->hashPassword($customer->getPassword())); - $customer->setPasswordCreatedAt(time()); - $customer->save(); - $quote->setCustomer($customer); - $quote->setPasswordHash(''); - - return $this; - } - - /** - * Prepare quote for customer order submit - * - * @return $this - */ - protected function _prepareCustomerQuote() - { - $quote = $this->_quote; - $billing = $quote->getBillingAddress(); - $shipping = $quote->isVirtual() ? null : $quote->getShippingAddress(); - - $customer = $this->getCustomerSession()->getCustomer(); - if (!$billing->getCustomerId() || $billing->getSaveInAddressBook()) { - $customerBilling = $billing->exportCustomerAddress(); - $customer->addAddress($customerBilling); - $billing->setCustomerAddress($customerBilling); - } - if ($shipping && ((!$shipping->getCustomerId() && !$shipping->getSameAsBilling()) - || (!$shipping->getSameAsBilling() && $shipping->getSaveInAddressBook())) - ) { - $customerShipping = $shipping->exportCustomerAddress(); - $customer->addAddress($customerShipping); - $shipping->setCustomerAddress($customerShipping); - } - - if (isset($customerBilling) && !$customer->getDefaultBilling()) { - $customerBilling->setIsDefaultBilling(true); - } - if ($shipping && isset($customerBilling) && !$customer->getDefaultShipping() && $shipping->getSameAsBilling()) { - $customerBilling->setIsDefaultShipping(true); - } elseif ($shipping && isset($customerShipping) && !$customer->getDefaultShipping()) { - $customerShipping->setIsDefaultShipping(true); - } - $quote->setCustomer($customer); - - return $this; - } - - /** - * Involve new customer to system - * - * @return $this - */ - protected function _involveNewCustomer() - { - $customer = $this->_quote->getCustomer(); - if ($customer->isConfirmationRequired()) { - $customer->sendNewAccountEmail('confirmation', '', $this->_quote->getStoreId()); - $url = Mage::helper('customer')->getEmailConfirmationUrl($customer->getEmail()); - $this->getCustomerSession()->addSuccess( - Mage::helper('customer')->__('Account confirmation is required. Please, check your e-mail for confirmation link. To resend confirmation email please click here.', $url), - ); - } else { - $customer->sendNewAccountEmail('registered', '', $this->_quote->getStoreId()); - $this->getCustomerSession()->loginById($customer->getId()); - } - return $this; - } - - /** - * Get customer session object - * - * @return Mage_Customer_Model_Session - */ - public function getCustomerSession() - { - return $this->_customerSession; - } - - /** - * Check if customer email exists - * - * @param string $email - * @return bool - */ - protected function _customerEmailExists($email) - { - $result = false; - $customer = Mage::getModel('customer/customer'); - $websiteId = Mage::app()->getStore()->getWebsiteId(); - if (!is_null($websiteId)) { - $customer->setWebsiteId($websiteId); - } - $customer->loadByEmail($email); - if (!is_null($customer->getId())) { - $result = true; - } - - return $result; - } -} diff --git a/app/code/core/Mage/Paypal/Model/Helper.php b/app/code/core/Mage/Paypal/Model/Helper.php new file mode 100644 index 00000000000..6dbe723049b --- /dev/null +++ b/app/code/core/Mage/Paypal/Model/Helper.php @@ -0,0 +1,376 @@ +_helper = Mage::helper('paypal'); + } + + /** + * Logs debug information for a PayPal API request if debugging is enabled. + * + * @param string $action Action being performed (e.g., 'Create Order'). + * @param Mage_Sales_Model_Order|Mage_Sales_Model_Quote $quote Quote or order object. + * @param array $request Request object or data sent to the API. + * @param ApiResponse|null $response API response, if available. + */ + public function logDebug( + string $action, + Mage_Sales_Model_Order|Mage_Sales_Model_Quote $quote, + array $request, + ?ApiResponse $response = null + ): void { + if (Mage::getStoreConfigFlag('payment/paypal/debug')) { + $requestData = json_encode($request); + $debug = Mage::getModel('paypal/debug'); + if ($quote instanceof Mage_Sales_Model_Quote) { + $debug->setQuoteId($quote->getId()); + } elseif ($quote instanceof Mage_Sales_Model_Order) { + $debug->setIncrementId($quote->getIncrementId()); + } + + $debug->setAction($action) + ->setRequestBody($requestData); + Mage::log($response, null, 'paypal.log'); + if ($response instanceof ApiResponse) { + $result = $response->getResult(); + if ($response->isError()) { + $debug->setTransactionId($result['debug_id']) + ->setResponseBody(json_encode($result)); + } else { + $debug->setTransactionId($response->getResult()->getId() ?? null) + ->setResponseBody(json_encode($response->getResult())); + } + } + $debug->save(); + } + } + + /** + * Logs an error message and exception details if debugging is enabled. + * + * @param string $message The error message. + * @param Exception $exception The exception object. + */ + public function logError(string $message, Exception $exception): void + { + if (Mage::getStoreConfigFlag('payment/paypal/debug')) { + $errorData = [ + 'message' => $message, + 'error' => $exception->getMessage(), + ]; + + if ($exception instanceof Mage_Paypal_Model_Exception) { + $errorData['debug_data'] = $exception->getDebugData(); + } + + Mage::log($errorData, Zend_Log::ERR, 'paypal.log', true); + } + } + + /** + * Validate quote for PayPal payment processing + * + * @throws Mage_Paypal_Model_Exception + */ + public function validateQuoteForPayment(Mage_Sales_Model_Quote $quote): void + { + $quote->collectTotals(); + + if (!$quote->getGrandTotal() && !$quote->hasNominalItems()) { + throw new Mage_Paypal_Model_Exception( + Mage::helper('paypal')->__(self::ERROR_ZERO_AMOUNT), + ); + } + } + + /** + * Handle API error response + * + * @param ApiResponse $response API response + * @param string $defaultMessage Default error message + * @throws Mage_Paypal_Model_Exception + */ + public function handleApiError(ApiResponse $response, string $defaultMessage): never + { + $errorMsg = $this->extractErrorMessage($response, $defaultMessage); + throw new Mage_Paypal_Model_Exception($errorMsg); + } + + /** + * Extract comprehensive error message from PayPal API response + * + * @param ApiResponse $response API response + * @param string $defaultMessage Default error message + */ + public function extractErrorMessage(ApiResponse $response, string $defaultMessage): string + { + $result = $response->getResult(); + if (is_array($result)) { + $errorMessage = $this->_extractFromArrayResponse($result, $defaultMessage); + if ($errorMessage !== $defaultMessage) { + return $errorMessage; + } + } + if (is_object($result)) { + $errorMessage = $this->_extractFromObjectResponse($result, $defaultMessage); + if ($errorMessage !== $defaultMessage) { + return $errorMessage; + } + } + if (is_string($result) && !empty($result)) { + return $result; + } + return $defaultMessage; + } + + /** + * Extract error message from array response structure + * + * @param array $result API result array + * @param string $defaultMessage Default error message + */ + private function _extractFromArrayResponse(array $result, string $defaultMessage): string + { + $mainMessage = $result['message'] ?? ''; + $detailedMessage = $this->_extractDetailedError($result); + if (!empty($detailedMessage)) { + return !empty($mainMessage) ? $mainMessage . ' ' . $detailedMessage : $detailedMessage; + } + + return !empty($mainMessage) ? $this->_helper->__($mainMessage) : $defaultMessage; + } + + /** + * Extract error message from object response structure + * + * @param object $result API result object + * @param string $defaultMessage Default error message + */ + private function _extractFromObjectResponse(object $result, string $defaultMessage): string + { + $getters = ['getMessage', 'getErrorMessage', 'getDescription']; + foreach ($getters as $getter) { + if (method_exists($result, $getter)) { + $message = $result->$getter(); + if (!empty($message)) { + return $message; + } + } + } + $properties = ['message', 'error_message', 'description']; + foreach ($properties as $property) { + if (property_exists($result, $property) && !empty($result->$property)) { + return $result->$property; + } + } + + return $defaultMessage; + } + + /** + * Extract detailed error information from PayPal error response + * + * @param array $result API result array + */ + private function _extractDetailedError(array $result): string + { + $errorMessages = []; + if (isset($result['details']) && is_array($result['details'])) { + foreach ($result['details'] as $detail) { + $issue = ''; + if (is_array($detail)) { + $issue = $detail['issue'] ?? ''; + } elseif (is_object($detail)) { + $issue = $detail->issue ?? ''; + } + if (!empty($issue)) { + $errorMessages[] = $this->_getReadableErrorMessage($issue); + } + } + } + + if (empty($errorMessages) && isset($result['message'])) { + $errorMessages[] = $result['message']; + } + return implode('; ', $errorMessages); + } + + /** + * Convert PayPal error codes to user-friendly messages + * + * @param string $errorCode PayPal error code + */ + private function _getReadableErrorMessage(string $errorCode): string + { + $errorMessages = [ + 'INSTRUMENT_DECLINED' => $this->_helper->__('The instrument presented was either declined by the processor or bank, or it can\'t be used for this payment.'), + ]; + + return $errorMessages[$errorCode] ?? $errorCode; + } + + /** + * Extract capture ID from API result + * + * @param mixed $result API result + */ + public function extractCaptureId(mixed $result): ?string + { + if ( + !method_exists($result, 'getPurchaseUnits') || + !is_array($result->getPurchaseUnits()) || + empty($result->getPurchaseUnits()) + ) { + return null; + } + + $purchaseUnit = $result->getPurchaseUnits()[0]; + $payments = $purchaseUnit->getPayments(); + + if ( + !method_exists($payments, 'getCaptures') || + !is_array($payments->getCaptures()) || + empty($payments->getCaptures()) + ) { + return null; + } + + return $payments->getCaptures()[0]->getId(); + } + + /** + * Prepare raw details for storage + * + * @param string $details JSON details object + * @return array + */ + public function prepareRawDetails(string $details): array + { + $decoded = json_decode($details, true); + if (isset($decoded['links'])) { + unset($decoded['links']); + } + return array_map( + fn($v) => is_array($v) ? json_encode($v) : $v, + $decoded ?? [], + ); + } + + /** + * Add order status comment + * + * @param string $action Action performed (captured, authorized, etc.) + * @param string|null $transactionId Transaction ID + */ + public function addOrderComment( + Mage_Sales_Model_Quote|Mage_Sales_Model_Order $quote, + string $action, + ?string $transactionId + ): void { + if ($quote instanceof Mage_Sales_Model_Order && $transactionId) { + $message = match ($action) { + 'captured' => 'PayPal payment captured successfully. Capture ID: %s', + 'authorized' => 'PayPal payment authorized successfully. Authorization ID: %s', + default => 'PayPal payment %s successfully. Transaction ID: %s' + }; + + $quote->addStatusHistoryComment( + Mage::helper('paypal')->__($message, $transactionId), + false, + ); + } + } + + /** + * Handle multishipping notification + */ + public function handleMultishippingNotification(?Mage_Sales_Model_Quote $quote): void + { + if ( + $quote?->getIsMultiShipping() && + Mage::getSingleton('paypal/config')->getPaymentAction() === strtolower(CheckoutPaymentIntent::AUTHORIZE) + ) { + Mage::getSingleton('core/session')->addNotice( + Mage::helper('paypal')->__( + 'PayPal will process multishipping orders as immediate capture regardless of your authorization setting.', + ), + ); + } + } + + /** + * Get payment intent based on payment action configuration + */ + public function getPaymentIntent(): string + { + // Always use capture for multishipping orders + if ($this->getQuote()->getIsMultiShipping()) { + return CheckoutPaymentIntent::CAPTURE; + } + + $paymentAction = Mage::getSingleton('paypal/config')->getPaymentAction(); + + return $paymentAction === strtolower(CheckoutPaymentIntent::AUTHORIZE) + ? CheckoutPaymentIntent::AUTHORIZE + : CheckoutPaymentIntent::CAPTURE; + } + + /** + * Get PayPal API instance + */ + public function getApi(): Mage_Paypal_Model_Api + { + return Mage::getSingleton('paypal/api'); + } + + /** + * Get current quote + */ + public function getQuote(): Mage_Sales_Model_Quote + { + return Mage::getSingleton('checkout/session')->getQuote(); + } + + + /** + * Retrieve PayPal Transaction PayPal-Request-Id if available + */ + public function getPaypalRequestId(Mage_Sales_Model_Quote $quote): ?string + { + $payment = $quote->getPayment(); + if ($payment && $payment->getAdditionalInformation(Mage_Paypal_Model_Payment::PAYPAL_REQUEST_ID)) { + return $payment->getAdditionalInformation(Mage_Paypal_Model_Payment::PAYPAL_REQUEST_ID); + } + return null; + } +} diff --git a/app/code/core/Mage/Paypal/Model/Hostedpro.php b/app/code/core/Mage/Paypal/Model/Hostedpro.php deleted file mode 100644 index 0b442662aae..00000000000 --- a/app/code/core/Mage/Paypal/Model/Hostedpro.php +++ /dev/null @@ -1,244 +0,0 @@ -_pro->getConfig()->getMerchantCountry(); - } - - /** - * Return iframe template value depending on config - * - * @return string - */ - public function getTemplate() - { - if ($this->getConfigData('mobile_optimized')) { - return self::MOBILE_LAYOUT_TEMPLATE; - } else { - return self::LAYOUT_TEMPLATE; - } - } - - /** - * Do not validate payment form using server methods - * - * @return bool - */ - public function validate() - { - return true; - } - - /** - * Instantiate state and set it to state object - * - * @param string $paymentAction - * @param Varien_Object $stateObject - */ - public function initialize($paymentAction, $stateObject) - { - switch ($paymentAction) { - case Mage_Paypal_Model_Config::PAYMENT_ACTION_AUTH: - case Mage_Paypal_Model_Config::PAYMENT_ACTION_SALE: - $payment = $this->getInfoInstance(); - $order = $payment->getOrder(); - $order->setCanSendNewEmailFlag(false); - $payment->setAmountAuthorized($order->getTotalDue()); - $payment->setBaseAmountAuthorized($order->getBaseTotalDue()); - - $this->_setPaymentFormUrl($payment); - - $stateObject->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT); - $stateObject->setStatus('pending_payment'); - $stateObject->setIsNotified(false); - break; - default: - break; - } - - return $this; - } - - /** - * Sends API request to PayPal to get form URL, then sets this URL to $payment object. - */ - protected function _setPaymentFormUrl(Mage_Payment_Model_Info $payment) - { - $request = $this->_buildFormUrlRequest($payment); - $response = $this->_sendFormUrlRequest($request); - if ($response) { - $payment->setAdditionalInformation('secure_form_url', $response); - } else { - Mage::throwException('Cannot get secure form URL from PayPal'); - } - } - - /** - * Returns request object with needed data for API request to PayPal to get form URL. - * - * @return Mage_Paypal_Model_Hostedpro_Request - */ - protected function _buildFormUrlRequest(Mage_Payment_Model_Info $payment) - { - return $this->_buildBasicRequest() - ->setOrder($payment->getOrder()) - ->setPaymentMethod($this); - } - - /** - * Returns form URL from request to PayPal. - * - * @return string | false - */ - protected function _sendFormUrlRequest(Mage_Paypal_Model_Hostedpro_Request $request) - { - $api = $this->_pro->getApi(); - $response = $api->call(self::BM_BUTTON_METHOD, $request->getRequestData()); - - return $response['EMAILLINK'] ?? false; - } - - /** - * Return request object with basic information - * - * @return Mage_Paypal_Model_Hostedpro_Request - */ - protected function _buildBasicRequest() - { - $request = Mage::getModel('paypal/hostedpro_request'); - $request->setData([ - 'METHOD' => self::BM_BUTTON_METHOD, - 'BUTTONCODE' => self::BM_BUTTON_CODE, - 'BUTTONTYPE' => self::BM_BUTTON_TYPE, - ]); - return $request; - } - - /** - * Get return URL - * - * @param int $storeId - * @return string - */ - public function getReturnUrl($storeId = null) - { - return $this->_getUrl('paypal/hostedpro/return', $storeId); - } - - /** - * Get notify (IPN) URL - * - * @param int $storeId - * @return string - */ - public function getNotifyUrl($storeId = null) - { - return $this->_getUrl('paypal/ipn', $storeId); - } - - /** - * Get cancel URL - * - * @param int $storeId - * @return string - */ - public function getCancelUrl($storeId = null) - { - return $this->_getUrl('paypal/hostedpro/cancel', $storeId); - } - - /** - * Build URL for store - * - * @param string $path - * @param int $storeId - * @param bool $secure - * @return string - */ - protected function _getUrl($path, $storeId, $secure = null) - { - $store = Mage::app()->getStore($storeId); - return Mage::getUrl($path, [ - '_store' => $store, - '_secure' => is_null($secure) ? $store->isCurrentlySecure() : $secure, - ]); - } -} diff --git a/app/code/core/Mage/Paypal/Model/Hostedpro/Request.php b/app/code/core/Mage/Paypal/Model/Hostedpro/Request.php deleted file mode 100644 index af1172e4f21..00000000000 --- a/app/code/core/Mage/Paypal/Model/Hostedpro/Request.php +++ /dev/null @@ -1,224 +0,0 @@ -_data)) { - // insert params to request as additional button variables, - // except special params from _notButtonVars list - $i = 0; - foreach ($this->_data as $key => $value) { - if (in_array($key, $this->_notButtonVars)) { - $requestData[$key] = $value; - } else { - $varKey = sprintf($this->_buttonVarFormat, $i); - $requestData[$varKey] = $key . '=' . $value; - $i++; - } - } - } - - return $requestData; - } - - /** - * Append payment data to request - * - * @param Mage_Paypal_Model_Hostedpro $paymentMethod - * @return $this - */ - public function setPaymentMethod($paymentMethod) - { - $this->_paymentMethod = $paymentMethod; - $requestData = $this->_getPaymentData($paymentMethod); - $this->addData($requestData); - - return $this; - } - - /** - * Append order data to request - * - * @param Mage_Sales_Model_Order $order - * @return $this - */ - public function setOrder($order) - { - $this->_order = $order; - $requestData = $this->_getOrderData($order); - $this->addData($requestData); - - return $this; - } - - /** - * Get peymet request data as array - * - * @return array - */ - protected function _getPaymentData(Mage_Paypal_Model_Hostedpro $paymentMethod) - { - return [ - 'paymentaction' => strtolower($paymentMethod->getConfigData('payment_action')), - 'notify_url' => $paymentMethod->getNotifyUrl(), - 'cancel_return' => $paymentMethod->getCancelUrl(), - 'return' => $paymentMethod->getReturnUrl(), - 'lc' => substr(Mage::app()->getLocale()->getLocaleCode(), -2), //gets language from locale code - - 'template' => $paymentMethod->getTemplate(), - 'showBillingAddress' => 'false', - 'showShippingAddress' => 'true', - 'showBillingEmail' => 'false', - 'showBillingPhone' => 'false', - 'showCustomerName' => 'false', - 'showCardInfo' => 'true', - 'showHostedThankyouPage' => 'false', - ]; - } - - /** - * Get order request data as array - * - * @return array - */ - protected function _getOrderData(Mage_Sales_Model_Order $order) - { - $request = [ - 'subtotal' => $this->_formatPrice($order->getBaseSubtotal()), - 'tax' => $this->_formatPrice($order->getBaseTaxAmount() + $order->getHiddenTaxAmount()), - 'shipping' => $this->_formatPrice($order->getBaseShippingAmount()), - 'invoice' => $order->getIncrementId(), - 'address_override' => 'true', - 'currency_code' => $order->getBaseCurrencyCode(), - 'buyer_email' => $order->getCustomerEmail(), - 'discount' => $this->_formatPrice( - $order->getBaseGiftCardsAmount() - + abs($order->getBaseDiscountAmount()) - + $order->getBaseCustomerBalanceAmount(), - ), - ]; - - // append to request billing address data - if ($billingAddress = $order->getBillingAddress()) { - $request = array_merge($request, $this->_getBillingAddress($billingAddress)); - } - - // append to request shipping address data - if ($shippingAddress = $order->getShippingAddress()) { - $request = array_merge($request, $this->_getShippingAddress($shippingAddress)); - } - - return $request; - } - - /** - * Get shipping address request data - * - * @return array - */ - protected function _getShippingAddress(Varien_Object $address) - { - $request = [ - 'first_name' => $address->getFirstname(), - 'last_name' => $address->getLastname(), - 'city' => $address->getCity(), - 'state' => $address->getRegionCode() ? $address->getRegionCode() : $address->getCity(), - 'zip' => $address->getPostcode(), - 'country' => $address->getCountry(), - ]; - - // convert streets to tow lines format - $street = Mage::helper('customer/address') - ->convertStreetLines($address->getStreet(), 2); - - $request['address1'] = $street[0] ?? ''; - $request['address2'] = $street[1] ?? ''; - - return $request; - } - - /** - * Get billing address request data - * - * @return array - */ - protected function _getBillingAddress(Varien_Object $address) - { - $request = [ - 'billing_first_name' => $address->getFirstname(), - 'billing_last_name' => $address->getLastname(), - 'billing_city' => $address->getCity(), - 'billing_state' => $address->getRegionCode() ? $address->getRegionCode() : $address->getCity(), - 'billing_zip' => $address->getPostcode(), - 'billing_country' => $address->getCountry(), - ]; - - // convert streets to tow lines format - $street = Mage::helper('customer/address') - ->convertStreetLines($address->getStreet(), 2); - - $request['billing_address1'] = $street[0] ?? ''; - $request['billing_address2'] = $street[1] ?? ''; - - return $request; - } - - /** - * Format price string - * - * @param mixed $string - * @return mixed - */ - protected function _formatPrice($string) - { - return sprintf('%.2F', $string); - } -} diff --git a/app/code/core/Mage/Paypal/Model/Info.php b/app/code/core/Mage/Paypal/Model/Info.php deleted file mode 100644 index 789ec6d9aa6..00000000000 --- a/app/code/core/Mage/Paypal/Model/Info.php +++ /dev/null @@ -1,579 +0,0 @@ - 'paypal_payer_id', - self::PAYER_EMAIL => 'paypal_payer_email', - self::PAYER_STATUS => 'paypal_payer_status', - self::ADDRESS_ID => 'paypal_address_id', - self::ADDRESS_STATUS => 'paypal_address_status', - self::PROTECTION_EL => 'paypal_protection_eligibility', - self::FRAUD_FILTERS => 'paypal_fraud_filters', - self::CORRELATION_ID => 'paypal_correlation_id', - self::AVS_CODE => 'paypal_avs_code', - self::CVV2_MATCH => 'paypal_cvv2_match', - self::CENTINEL_VPAS => self::CENTINEL_VPAS, - self::CENTINEL_ECI => self::CENTINEL_ECI, - self::BUYER_TAX_ID => self::BUYER_TAX_ID, - self::BUYER_TAX_ID_TYPE => self::BUYER_TAX_ID_TYPE, - ]; - - /** - * System information map - * - * @var array - */ - protected $_systemMap = [ - self::PAYMENT_STATUS => self::PAYMENT_STATUS_GLOBAL, - self::PENDING_REASON => self::PENDING_REASON_GLOBAL, - self::IS_FRAUD => self::IS_FRAUD_GLOBAL, - ]; - - /** - * PayPal payment status possible values - * - * @var string - */ - public const PAYMENTSTATUS_NONE = 'none'; - public const PAYMENTSTATUS_COMPLETED = 'completed'; - public const PAYMENTSTATUS_DENIED = 'denied'; - public const PAYMENTSTATUS_EXPIRED = 'expired'; - public const PAYMENTSTATUS_FAILED = 'failed'; - public const PAYMENTSTATUS_INPROGRESS = 'in_progress'; - public const PAYMENTSTATUS_PENDING = 'pending'; - public const PAYMENTSTATUS_REFUNDED = 'refunded'; - public const PAYMENTSTATUS_REFUNDEDPART = 'partially_refunded'; - public const PAYMENTSTATUS_REVERSED = 'reversed'; - public const PAYMENTSTATUS_UNREVERSED = 'canceled_reversal'; - public const PAYMENTSTATUS_PROCESSED = 'processed'; - public const PAYMENTSTATUS_VOIDED = 'voided'; - - /** - * PayPal payment transaction type - */ - public const TXN_TYPE_ADJUSTMENT = 'adjustment'; - public const TXN_TYPE_NEW_CASE = 'new_case'; - - /** - * PayPal payment reason code when payment_status is Reversed, Refunded, or Canceled_Reversal. - */ - public const PAYMENT_REASON_CODE_REFUND = 'refund'; - - /** - * PayPal order status for Reverse payment status - */ - public const ORDER_STATUS_REVERSED = 'paypal_reversed'; - - /** - * PayPal order status for Canceled Reversal payment status - */ - public const ORDER_STATUS_CANCELED_REVERSAL = 'paypal_canceled_reversal'; - - /** - * Map of payment information available to customer - * - * @var array - */ - protected $_paymentPublicMap = [ - 'paypal_payer_email', - self::BUYER_TAX_ID, - self::BUYER_TAX_ID_TYPE, - ]; - - /** - * Rendered payment map cache - * - * @var array - */ - protected $_paymentMapFull = []; - - /** - * All available payment info getter - * - * @param bool $labelValuesOnly - * @return array - */ - public function getPaymentInfo(Mage_Payment_Model_Info $payment, $labelValuesOnly = false) - { - // collect paypal-specific info - $result = $this->_getFullInfo(array_values($this->_paymentMap), $payment, $labelValuesOnly); - - // add last_trans_id - $label = Mage::helper('paypal')->__('Last Transaction ID'); - $value = $payment->getLastTransId(); - if ($labelValuesOnly) { - $result[$label] = $value; - } else { - $result['last_trans_id'] = ['label' => $label, 'value' => $value]; - } - - return $result; - } - - /** - * Public payment info getter - * - * @param bool $labelValuesOnly - * @return array - */ - public function getPublicPaymentInfo(Mage_Payment_Model_Info $payment, $labelValuesOnly = false) - { - return $this->_getFullInfo($this->_paymentPublicMap, $payment, $labelValuesOnly); - } - - /** - * Grab data from source and map it into payment - * - * @param array|Varien_Object|callback $from - */ - public function importToPayment($from, Mage_Payment_Model_Info $payment) - { - $fullMap = array_merge($this->_paymentMap, $this->_systemMap); - if (is_object($from)) { - $from = [$from, 'getDataUsingMethod']; - } - Varien_Object_Mapper::accumulateByMap($from, [$payment, 'setAdditionalInformation'], $fullMap); - } - - /** - * Grab data from payment and map it into target - * - * @param array|Varien_Object|callback $to - * @return array|Varien_Object - */ - public function &exportFromPayment(Mage_Payment_Model_Info $payment, $to, ?array $map = null) - { - $fullMap = array_merge($this->_paymentMap, $this->_systemMap); - Varien_Object_Mapper::accumulateByMap( - [$payment, 'getAdditionalInformation'], - $to, - $map ? $map : array_flip($fullMap), - ); - return $to; - } - - /** - * Check whether the payment is in review state - * - * @return bool - */ - public static function isPaymentReviewRequired(Mage_Payment_Model_Info $payment) - { - $paymentStatus = $payment->getAdditionalInformation(self::PAYMENT_STATUS_GLOBAL); - if (self::PAYMENTSTATUS_PENDING === $paymentStatus) { - $pendingReason = $payment->getAdditionalInformation(self::PENDING_REASON_GLOBAL); - return !in_array($pendingReason, ['authorization', 'order']); - } - return false; - } - - /** - * Check whether fraud order review detected and can be reviewed - * - * @return bool - */ - public static function isFraudReviewAllowed(Mage_Payment_Model_Info $payment) - { - return self::isPaymentReviewRequired($payment) - && $payment->getAdditionalInformation(self::IS_FRAUD_GLOBAL) == 1; - } - - /** - * Check whether the payment is completed - * - * @return bool - */ - public static function isPaymentCompleted(Mage_Payment_Model_Info $payment) - { - $paymentStatus = $payment->getAdditionalInformation(self::PAYMENT_STATUS_GLOBAL); - return self::PAYMENTSTATUS_COMPLETED === $paymentStatus; - } - - /** - * Check whether the payment was processed successfully - * - * @return bool - */ - public static function isPaymentSuccessful(Mage_Payment_Model_Info $payment) - { - $paymentStatus = $payment->getAdditionalInformation(self::PAYMENT_STATUS_GLOBAL); - if (in_array($paymentStatus, [ - self::PAYMENTSTATUS_COMPLETED, self::PAYMENTSTATUS_INPROGRESS, self::PAYMENTSTATUS_REFUNDED, - self::PAYMENTSTATUS_REFUNDEDPART, self::PAYMENTSTATUS_UNREVERSED, self::PAYMENTSTATUS_PROCESSED, - ]) - ) { - return true; - } - $pendingReason = $payment->getAdditionalInformation(self::PENDING_REASON_GLOBAL); - return self::PAYMENTSTATUS_PENDING === $paymentStatus - && in_array($pendingReason, ['authorization', 'order']); - } - - /** - * Check whether the payment was processed unsuccessfully or failed - * - * @return bool - */ - public static function isPaymentFailed(Mage_Payment_Model_Info $payment) - { - $paymentStatus = $payment->getAdditionalInformation(self::PAYMENT_STATUS_GLOBAL); - return in_array($paymentStatus, [ - self::PAYMENTSTATUS_DENIED, self::PAYMENTSTATUS_EXPIRED, self::PAYMENTSTATUS_FAILED, - self::PAYMENTSTATUS_REVERSED, self::PAYMENTSTATUS_VOIDED, - ]); - } - - /** - * Explain pending payment reason code - * - * @param string $code - * @return string - * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_html_IPNandPDTVariables - * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_GetTransactionDetails - */ - public static function explainPendingReason($code) - { - return match ($code) { - 'address' => Mage::helper('paypal')->__('Customer did not include a confirmed address.'), - 'authorization', 'order' => Mage::helper('paypal')->__('The payment is authorized but not settled.'), - 'echeck' => Mage::helper('paypal')->__('The payment eCheck is not yet cleared.'), - 'intl' => Mage::helper('paypal')->__('Merchant holds a non-U.S. account and does not have a withdrawal mechanism.'), - 'multi-currency', 'multi_currency', 'multicurrency' => Mage::helper('paypal')->__('The payment curency does not match any of the merchant\'s balances currency.'), - 'paymentreview' => Mage::helper('paypal')->__('The payment is pending while it is being reviewed by PayPal for risk.'), - 'unilateral' => Mage::helper('paypal')->__('The payment is pending because it was made to an email address that is not yet registered or confirmed.'), - 'verify' => Mage::helper('paypal')->__('The merchant account is not yet verified.'), - 'upgrade' => Mage::helper('paypal')->__('The payment was made via credit card. In order to receive funds merchant must upgrade account to Business or Premier status.'), - default => Mage::helper('paypal')->__('Unknown reason. Please contact PayPal customer service.'), - }; - } - - /** - * Explain the refund or chargeback reason code - * - * @param string $code - * @return string - * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_html_IPNandPDTVariables - * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_GetTransactionDetails - */ - public static function explainReasonCode($code) - { - $comments = [ - 'chargeback' => Mage::helper('paypal')->__('A reversal has occurred on this transaction due to a chargeback by your customer.'), - 'guarantee' => Mage::helper('paypal')->__('A reversal has occurred on this transaction due to your customer triggering a money-back guarantee.'), - 'buyer-complaint' => Mage::helper('paypal')->__('A reversal has occurred on this transaction due to a complaint about the transaction from your customer.'), - 'buyer_complaint' => Mage::helper('paypal')->__('A reversal has occurred on this transaction due to a complaint about the transaction from your customer.'), - 'refund' => Mage::helper('paypal')->__('A reversal has occurred on this transaction because you have given the customer a refund.'), - 'adjustment_reversal' => Mage::helper('paypal')->__('Reversal of an adjustment.'), - 'admin_fraud_reversal' => Mage::helper('paypal')->__('Transaction reversal due to fraud detected by PayPal administrators.'), - 'admin_reversal' => Mage::helper('paypal')->__('Transaction reversal by PayPal administrators.'), - 'chargeback_reimbursement' => Mage::helper('paypal')->__('Reimbursement for a chargeback.'), - 'chargeback_settlement' => Mage::helper('paypal')->__('Settlement of a chargeback.'), - 'unauthorized_spoof' => Mage::helper('paypal')->__('A reversal has occurred on this transaction because of a customer dispute suspecting unauthorized spoof.'), - 'non_receipt' => Mage::helper('paypal')->__('Buyer claims that he did not receive goods or service.'), - 'not_as_described' => Mage::helper('paypal')->__('Buyer claims that the goods or service received differ from merchant’s description of the goods or service.'), - 'unauthorized' => Mage::helper('paypal')->__('Buyer claims that he/she did not authorize transaction.'), - 'adjustment_reimburse' => Mage::helper('paypal')->__('A case that has been resolved and close requires a reimbursement.'), - 'duplicate' => Mage::helper('paypal')->__('Buyer claims that a possible duplicate payment was made to the merchant.'), - 'merchandise' => Mage::helper('paypal')->__('Buyer claims that the received merchandise is unsatisfactory, defective, or damaged.'), - ]; - return (array_key_exists($code, $comments) && !empty($comments[$code])) - ? $comments[$code] - : Mage::helper('paypal')->__('Unknown reason. Please contact PayPal customer service.'); - } - - /** - * Whether a reversal/refund can be disputed with PayPal - * - * @param string $code - * @return bool - */ - public static function isReversalDisputable($code) - { - return match ($code) { - 'none', 'other', 'chargeback', 'buyer-complaint', 'buyer_complaint', 'adjustment_reversal' => true, - default => false, - }; - } - - /** - * Render info item - * - * @param bool $labelValuesOnly - * @return array - */ - protected function _getFullInfo(array $keys, Mage_Payment_Model_Info $payment, $labelValuesOnly) - { - $result = []; - foreach ($keys as $key) { - if (!isset($this->_paymentMapFull[$key])) { - $this->_paymentMapFull[$key] = []; - } - if (!isset($this->_paymentMapFull[$key]['label'])) { - if (!$payment->hasAdditionalInformation($key)) { - $this->_paymentMapFull[$key]['label'] = false; - $this->_paymentMapFull[$key]['value'] = false; - } else { - $value = $payment->getAdditionalInformation($key); - $this->_paymentMapFull[$key]['label'] = $this->_getLabel($key); - $this->_paymentMapFull[$key]['value'] = $this->_getValue($value, $key); - } - } - if (!empty($this->_paymentMapFull[$key]['value'])) { - if ($labelValuesOnly) { - $result[$this->_paymentMapFull[$key]['label']] = $this->_paymentMapFull[$key]['value']; - } else { - $result[$key] = $this->_paymentMapFull[$key]; - } - } - } - return $result; - } - - /** - * Render info item labels - * - * @param string $key - * @return string - */ - protected function _getLabel($key) - { - return match ($key) { - 'paypal_payer_id' => Mage::helper('paypal')->__('Payer ID'), - 'paypal_payer_email' => Mage::helper('paypal')->__('Payer Email'), - 'paypal_payer_status' => Mage::helper('paypal')->__('Payer Status'), - 'paypal_address_id' => Mage::helper('paypal')->__('Payer Address ID'), - 'paypal_address_status' => Mage::helper('paypal')->__('Payer Address Status'), - 'paypal_protection_eligibility' => Mage::helper('paypal')->__('Merchant Protection Eligibility'), - 'paypal_fraud_filters' => Mage::helper('paypal')->__('Triggered Fraud Filters'), - 'paypal_correlation_id' => Mage::helper('paypal')->__('Last Correlation ID'), - 'paypal_avs_code' => Mage::helper('paypal')->__('Address Verification System Response'), - 'paypal_cvv2_match' => Mage::helper('paypal')->__('CVV2 Check Result by PayPal'), - self::BUYER_TAX_ID => Mage::helper('paypal')->__('Buyer\'s Tax ID'), - self::BUYER_TAX_ID_TYPE => Mage::helper('paypal')->__('Buyer\'s Tax ID Type'), - self::CENTINEL_VPAS => Mage::helper('paypal')->__('PayPal/Centinel Visa Payer Authentication Service Result'), - self::CENTINEL_ECI => Mage::helper('paypal')->__('PayPal/Centinel Electronic Commerce Indicator'), - default => '', - }; - } - - /** - * Get case type label - * - * @param string $key - * @return string - */ - public static function getCaseTypeLabel($key) - { - $labels = [ - 'chargeback' => Mage::helper('paypal')->__('Chargeback'), - 'complaint' => Mage::helper('paypal')->__('Complaint'), - 'dispute' => Mage::helper('paypal')->__('Dispute'), - ]; - return (array_key_exists($key, $labels) && !empty($labels[$key])) ? $labels[$key] : ''; - } - - /** - * Apply a filter upon value getting - * - * @param string $value - * @param string $key - * @return string - */ - protected function _getValue($value, $key) - { - $label = ''; - switch ($key) { - case 'paypal_avs_code': - $label = $this->_getAvsLabel($value); - break; - case 'paypal_cvv2_match': - $label = $this->_getCvv2Label($value); - break; - case self::CENTINEL_VPAS: - $label = $this->_getCentinelVpasLabel($value); - break; - case self::CENTINEL_ECI: - $label = $this->_getCentinelEciLabel($value); - break; - case self::BUYER_TAX_ID_TYPE: - $value = $this->_getBuyerIdTypeValue($value); - // no break - default: - return $value; - } - return sprintf('#%s%s', $value, $value == $label ? '' : ': ' . $label); - } - - /** - * Attempt to convert AVS check result code into label - * - * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_AVSResponseCodes - * @param string $value - * @return string - */ - protected function _getAvsLabel($value) - { - return match ($value) { - 'A', 'YN' => Mage::helper('paypal')->__('Matched Address only (no ZIP)'), - // international "A" - 'B' => Mage::helper('paypal')->__('Matched Address only (no ZIP). International'), - 'N' => Mage::helper('paypal')->__('No Details matched'), - // international "N" - 'C' => Mage::helper('paypal')->__('No Details matched. International'), - 'X' => Mage::helper('paypal')->__('Exact Match. Address and nine-digit ZIP code'), - // international "X" - 'D' => Mage::helper('paypal')->__('Exact Match. Address and Postal Code. International'), - // UK-specific "X" - 'F' => Mage::helper('paypal')->__('Exact Match. Address and Postal Code. UK-specific'), - 'E' => Mage::helper('paypal')->__('N/A. Not allowed for MOTO (Internet/Phone) transactions'), - 'G' => Mage::helper('paypal')->__('N/A. Global Unavailable'), - 'I' => Mage::helper('paypal')->__('N/A. International Unavailable'), - 'Z', 'NY' => Mage::helper('paypal')->__('Matched five-digit ZIP only (no Address)'), - 'P', 'NY' => Mage::helper('paypal')->__('Matched Postal Code only (no Address)'), - 'R' => Mage::helper('paypal')->__('N/A. Retry'), - 'S' => Mage::helper('paypal')->__('N/A. Service not Supported'), - 'U' => Mage::helper('paypal')->__('N/A. Unavailable'), - 'W' => Mage::helper('paypal')->__('Matched whole nine-didgit ZIP (no Address)'), - 'Y' => Mage::helper('paypal')->__('Yes. Matched Address and five-didgit ZIP'), - '0' => Mage::helper('paypal')->__('All the address information matched'), - '1' => Mage::helper('paypal')->__('None of the address information matched'), - '2' => Mage::helper('paypal')->__('Part of the address information matched'), - '3' => Mage::helper('paypal')->__('N/A. The merchant did not provide AVS information'), - '4' => Mage::helper('paypal')->__('N/A. Address not checked, or acquirer had no response. Service not available'), - default => $value, - }; - } - - /** - * Attempt to convert CVV2 check result code into label - * - * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_AVSResponseCodes - * @param string $value - * @return string - */ - protected function _getCvv2Label($value) - { - return match ($value) { - 'M' => Mage::helper('paypal')->__('Matched (CVV2CSC)'), - 'N' => Mage::helper('paypal')->__('No match'), - 'P' => Mage::helper('paypal')->__('N/A. Not processed'), - 'S' => Mage::helper('paypal')->__('N/A. Service not supported'), - 'U' => Mage::helper('paypal')->__('N/A. Service not available'), - 'X' => Mage::helper('paypal')->__('N/A. No response'), - '0' => Mage::helper('paypal')->__('Matched (CVV2)'), - '1' => Mage::helper('paypal')->__('No match'), - '2' => Mage::helper('paypal')->__('N/A. The merchant has not implemented CVV2 code handling'), - '3' => Mage::helper('paypal')->__('N/A. Merchant has indicated that CVV2 is not present on card'), - '4' => Mage::helper('paypal')->__('N/A. Service not available'), - default => $value, - }; - } - - /** - * Attempt to convert centinel VPAS result into label - * - * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_DoDirectPayment - * @param string $value - * @return string - */ - private function _getCentinelVpasLabel($value) - { - return match ($value) { - '2', 'D' => Mage::helper('paypal')->__('Authenticated, Good Result'), - '1' => Mage::helper('paypal')->__('Authenticated, Bad Result'), - '3', '6', '8', 'A', 'C' => Mage::helper('paypal')->__('Attempted Authentication, Good Result'), - '4', '7', '9' => Mage::helper('paypal')->__('Attempted Authentication, Bad Result'), - '', '0', 'B' => Mage::helper('paypal')->__('No Liability Shift'), - default => $value, - }; - } - - /** - * Attempt to convert centinel ECI result into label - * - * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_DoDirectPayment - * @param string $value - * @return string - */ - private function _getCentinelEciLabel($value) - { - return match ($value) { - '01', '07' => Mage::helper('paypal')->__('Merchant Liability'), - '02', '05', '06' => Mage::helper('paypal')->__('Issuer Liability'), - default => $value, - }; - } - - /** - * Retrieve buyer id type value based on code received from PayPal (Brazil only) - * - * @param string $code - * @return string - */ - protected function _getBuyerIdTypeValue($code) - { - $value = ''; - return match ($code) { - self::BUYER_TAX_ID_TYPE_CNPJ => Mage::helper('paypal')->__('CNPJ'), - self::BUYER_TAX_ID_TYPE_CPF => Mage::helper('paypal')->__('CPF'), - default => $value, - }; - } -} diff --git a/app/code/core/Mage/Paypal/Model/Ipn.php b/app/code/core/Mage/Paypal/Model/Ipn.php deleted file mode 100644 index 7c6a5af4b63..00000000000 --- a/app/code/core/Mage/Paypal/Model/Ipn.php +++ /dev/null @@ -1,761 +0,0 @@ -_request; - } - return $this->_request[$key] ?? null; - } - - /** - * Get ipn data, send verification to PayPal, run corresponding handler - * - * @throws Mage_Core_Exception - */ - public function processIpnRequest(array $request, ?Zend_Http_Client_Adapter_Interface $httpAdapter = null) - { - $this->_request = $request; - $this->_debugData = ['ipn' => $request]; - ksort($this->_debugData['ipn']); - - try { - if (isset($this->_request['txn_type']) && $this->_request['txn_type'] == 'recurring_payment') { - $this->_getRecurringProfile(); - if ($httpAdapter) { - $this->_postBack($httpAdapter); - } - $this->_processRecurringProfile(); - } else { - $this->_getOrder(); - if ($httpAdapter) { - $this->_postBack($httpAdapter); - } - $this->_processOrder(); - } - } catch (Exception $e) { - $this->_debugData['exception'] = $e->getMessage(); - $this->_debug(); - throw $e; - } - $this->_debug(); - } - - /** - * Post back to PayPal to check whether this request is a valid one - * - * @throws Exception - */ - protected function _postBack(Zend_Http_Client_Adapter_Interface $httpAdapter) - { - $postbackQuery = http_build_query($this->_request) . '&cmd=_notify-validate'; - $postbackUrl = $this->_config->getPostbackUrl(); - $this->_debugData['postback_to'] = $postbackUrl; - - $httpAdapter->setConfig(['verifypeer' => $this->_config->verifyPeer]); - $httpAdapter->write( - Zend_Http_Client::POST, - $postbackUrl, - '1.1', - ['Connection: close'], - $postbackQuery, - ); - - try { - $postbackResult = $httpAdapter->read(); - } catch (Exception $e) { - $this->_debugData['http_error'] = ['error' => $e->getMessage(), 'code' => $e->getCode()]; - throw $e; - } - - /* - * Handle errors on PayPal side. - */ - $responseCode = Zend_Http_Response::extractCode($postbackResult); - if (empty($postbackResult) || in_array($responseCode, ['500', '502', '503'])) { - if (empty($postbackResult)) { - $reason = 'Empty response.'; - } else { - $reason = 'Response code: ' . $responseCode . '.'; - } - $this->_debugData['exception'] = 'PayPal IPN postback failure. ' . $reason; - throw new Mage_Paypal_UnavailableException($reason); - } - - $response = preg_split('/^\r?$/m', $postbackResult); - $response = trim(end($response)); - if ($response != 'VERIFIED') { - $this->_debugData['postback'] = $postbackQuery; - $this->_debugData['postback_result'] = $postbackResult; - throw new Exception('PayPal IPN postback failure. See ' . self::DEFAULT_LOG_FILE . ' for details.'); - } - } - - /** - * Load and validate order, instantiate proper configuration - * - * - * @return Mage_Sales_Model_Order - * @throws Exception - * @SuppressWarnings("PHPMD.ExitExpression") - */ - protected function _getOrder() - { - if (empty($this->_order)) { - // get proper order - $id = $this->_request['invoice']; - $this->_order = Mage::getModel('sales/order')->loadByIncrementId($id); - if (!$this->_order->getId()) { - $this->_debugData['exception'] = sprintf('Wrong order ID: "%s".', $id); - $this->_debug(); - Mage::app()->getResponse() - ->setHeader('HTTP/1.1', '503 Service Unavailable') - ->sendResponse(); - exit; - } - // re-initialize config with the method code and store id - $methodCode = $this->_order->getPayment()->getMethod(); - $this->_config = Mage::getModel('paypal/config', [$methodCode, $this->_order->getStoreId()]); - if (!$this->_config->isMethodActive($methodCode) || !$this->_config->isMethodAvailable()) { - throw new Exception(sprintf('Method "%s" is not available.', $methodCode)); - } - - $this->_verifyOrder(); - } - return $this->_order; - } - - /** - * Load recurring profile - * - * @return Mage_Sales_Model_Recurring_Profile - * @throws Exception - */ - protected function _getRecurringProfile() - { - if (empty($this->_recurringProfile)) { - // get proper recurring profile - $internalReferenceId = $this->_request['rp_invoice_id']; - $this->_recurringProfile = Mage::getModel('sales/recurring_profile') - ->loadByInternalReferenceId($internalReferenceId); - if (!$this->_recurringProfile->getId()) { - throw new Exception( - sprintf('Wrong recurring profile INTERNAL_REFERENCE_ID: "%s".', $internalReferenceId), - ); - } - // re-initialize config with the method code and store id - $methodCode = $this->_recurringProfile->getMethodCode(); - $this->_config = Mage::getModel( - 'paypal/config', - [$methodCode, $this->_recurringProfile->getStoreId()], - ); - if (!$this->_config->isMethodActive($methodCode) || !$this->_config->isMethodAvailable()) { - throw new Exception(sprintf('Method "%s" is not available.', $methodCode)); - } - } - return $this->_recurringProfile; - } - - /** - * Validate incoming request data, as PayPal recommends - * - * @throws Exception - * @link https://cms.paypal.com/cgi-bin/marketingweb?cmd=_render-content&content_ID=developer/e_howto_admin_IPNIntro - */ - protected function _verifyOrder() - { - // verify merchant email intended to receive notification - $merchantEmail = $this->_config->businessAccount; - if ($merchantEmail) { - $receiverEmail = $this->getRequestData('business'); - if (!$receiverEmail) { - $receiverEmail = $this->getRequestData('receiver_email'); - } - if (strtolower($merchantEmail) != strtolower($receiverEmail)) { - throw new Exception( - sprintf( - 'Requested %s and configured %s merchant emails do not match.', - $receiverEmail, - $merchantEmail, - ), - ); - } - } - } - - /** - * IPN workflow implementation - * Everything should be added to order comments. In positive processing cases customer will get email notifications. - * Admin will be notified on errors. - */ - protected function _processOrder() - { - $this->_order = null; - $this->_getOrder(); - - $this->_info = Mage::getSingleton('paypal/info'); - try { - // Handle payment_status - $transactionType = $this->_request['txn_type'] ?? null; - match ($transactionType) { - Mage_Paypal_Model_Info::TXN_TYPE_NEW_CASE => $this->_registerDispute(), - Mage_Paypal_Model_Info::TXN_TYPE_ADJUSTMENT => $this->_registerAdjustment(), - default => $this->_registerTransaction(), - }; - } catch (Mage_Core_Exception $e) { - $comment = $this->_createIpnComment(Mage::helper('paypal')->__('Note: %s', $e->getMessage()), true); - $comment->save(); - throw $e; - } - } - - /** - * Process adjustment notification - */ - protected function _registerAdjustment() - { - $reasonCode = $this->_request['reason_code'] ?? null; - $reasonComment = $this->_info::explainReasonCode($reasonCode); - $notificationAmount = $this->_order->getBaseCurrency()->formatTxt($this->_request['mc_gross']); - /** - * Add IPN comment about registered dispute - */ - $message = Mage::helper('paypal')->__('IPN "%s". A dispute has been resolved and closed. %s Transaction amount %s.', ucfirst($reasonCode), $notificationAmount, $reasonComment); - $this->_order->addStatusHistoryComment($message) - ->setIsCustomerNotified(false) - ->save(); - } - - /** - * Process dispute notification - */ - protected function _registerDispute() - { - $reasonCode = $this->_request['reason_code'] ?? null; - $reasonComment = $this->_info::explainReasonCode($reasonCode); - $caseType = $this->_request['case_type'] ?? null; - $caseTypeLabel = $this->_info::getCaseTypeLabel($caseType); - $caseId = $this->_request['case_id'] ?? null; - /** - * Add IPN comment about registered dispute - */ - $message = Mage::helper('paypal')->__('IPN "%s". Case type "%s". Case ID "%s" %s', ucfirst($caseType), $caseTypeLabel, $caseId, $reasonComment); - $this->_order->addStatusHistoryComment($message) - ->setIsCustomerNotified(false) - ->save(); - } - - /** - * Process regular IPN notifications - */ - protected function _registerTransaction() - { - try { - // Handle payment_status - $paymentStatus = $this->_filterPaymentStatus($this->_request['payment_status']); - match ($paymentStatus) { - Mage_Paypal_Model_Info::PAYMENTSTATUS_COMPLETED => $this->_registerPaymentCapture(true), - Mage_Paypal_Model_Info::PAYMENTSTATUS_DENIED => $this->_registerPaymentDenial(), - // cancel order - Mage_Paypal_Model_Info::PAYMENTSTATUS_FAILED => $this->_registerPaymentFailure(), - Mage_Paypal_Model_Info::PAYMENTSTATUS_PENDING => $this->_registerPaymentPending(), - Mage_Paypal_Model_Info::PAYMENTSTATUS_PROCESSED => $this->_registerMasspaymentsSuccess(), - Mage_Paypal_Model_Info::PAYMENTSTATUS_REVERSED, Mage_Paypal_Model_Info::PAYMENTSTATUS_UNREVERSED => $this->_registerPaymentReversal(), - Mage_Paypal_Model_Info::PAYMENTSTATUS_REFUNDED => $this->_registerPaymentRefund(), - Mage_Paypal_Model_Info::PAYMENTSTATUS_EXPIRED, Mage_Paypal_Model_Info::PAYMENTSTATUS_VOIDED => $this->_registerPaymentVoid(), - default => throw new Exception("Cannot handle payment status '{$paymentStatus}'."), - }; - } catch (Mage_Core_Exception $e) { - $comment = $this->_createIpnComment(Mage::helper('paypal')->__('Note: %s', $e->getMessage()), true); - $comment->save(); - throw $e; - } - } - - /** - * Process notification from recurring profile payments - */ - protected function _processRecurringProfile() - { - $this->_recurringProfile = null; - $this->_getRecurringProfile(); - - try { - // handle payment_status - $paymentStatus = $this->_filterPaymentStatus($this->_request['payment_status']); - - match ($paymentStatus) { - Mage_Paypal_Model_Info::PAYMENTSTATUS_COMPLETED => $this->_registerRecurringProfilePaymentCapture(), - default => throw new Exception("Cannot handle payment status '{$paymentStatus}'."), - }; - } catch (Mage_Core_Exception $e) { - throw $e; - } - } - - /** - * Register recurring payment notification, create and process order - */ - protected function _registerRecurringProfilePaymentCapture() - { - $price = $this->getRequestData('mc_gross') - $this->getRequestData('tax') - $this->getRequestData('shipping'); - $productItemInfo = new Varien_Object(); - $type = trim($this->getRequestData('period_type')); - if ($type == 'Trial') { - $productItemInfo->setPaymentType(Mage_Sales_Model_Recurring_Profile::PAYMENT_TYPE_TRIAL); - } elseif ($type == 'Regular') { - $productItemInfo->setPaymentType(Mage_Sales_Model_Recurring_Profile::PAYMENT_TYPE_REGULAR); - } - $productItemInfo->setTaxAmount($this->getRequestData('tax')); - $productItemInfo->setShippingAmount($this->getRequestData('shipping')); - $productItemInfo->setPrice($price); - - $order = $this->_recurringProfile->createOrder($productItemInfo); - - $payment = $order->getPayment(); - $payment->setTransactionId($this->getRequestData('txn_id')) - ->setCurrencyCode($this->getRequestData('mc_currency')) - ->setPreparedMessage($this->_createIpnComment('')) - ->setIsTransactionClosed(0); - $order->save(); - $this->_recurringProfile->addOrderRelation($order->getId()); - $payment->registerCaptureNotification($this->getRequestData('mc_gross')); - $order->save(); - - $invoice = $payment->getCreatedInvoice(); - if ($invoice) { - // notify customer - $message = Mage::helper('paypal')->__('Notified customer about invoice #%s.', $invoice->getIncrementId()); - $order->queueNewOrderEmail()->addStatusHistoryComment($message) - ->setIsCustomerNotified(true) - ->save(); - } - } - - /** - * Process completed payment (either full or partial) - * - * @param bool $skipFraudDetection - */ - protected function _registerPaymentCapture($skipFraudDetection = false) - { - if ($this->getRequestData('transaction_entity') == 'auth') { - return; - } - $parentTransactionId = $this->getRequestData('parent_txn_id'); - $this->_importPaymentInformation(); - $payment = $this->_order->getPayment(); - $payment->setTransactionId($this->getRequestData('txn_id')) - ->setCurrencyCode($this->getRequestData('mc_currency')) - ->setPreparedMessage($this->_createIpnComment('')) - ->setParentTransactionId($parentTransactionId) - ->setShouldCloseParentTransaction($this->getRequestData('auth_status') === 'Completed') - ->setIsTransactionClosed(0) - ->registerCaptureNotification( - $this->getRequestData('mc_gross'), - $skipFraudDetection && $parentTransactionId, - ); - $this->_order->save(); - - // notify customer - $invoice = $payment->getCreatedInvoice(); - if ($invoice && !$this->_order->getEmailSent()) { - $this->_order->queueNewOrderEmail()->addStatusHistoryComment( - Mage::helper('paypal')->__('Notified customer about invoice #%s.', $invoice->getIncrementId()), - ) - ->setIsCustomerNotified(true) - ->save(); - } - } - - /** - * Process denied payment notification - */ - protected function _registerPaymentDenial() - { - $this->_importPaymentInformation(); - /** @var Mage_Sales_Model_Order_Payment $payment */ - $payment = $this->_order->getPayment(); - - $payment->setTransactionId($this->getRequestData('txn_id')) - ->setNotificationResult(true) - ->setIsTransactionClosed(true); - if (!$this->_order->isCanceled()) { - $payment->registerPaymentReviewAction(Mage_Sales_Model_Order_Payment::REVIEW_ACTION_DENY, false); - } else { - $transactionId = Mage::helper('paypal')->getHtmlTransactionId( - $payment->getMethodInstance()->getCode(), - $this->getRequestData('txn_id'), - ); - $comment = Mage::helper('paypal')->__('Transaction ID: "%s"', $transactionId); - $this->_order->addStatusHistoryComment($this->_createIpnComment($comment), false); - } - - $this->_order->save(); - } - - /** - * Treat failed payment as order cancellation - */ - protected function _registerPaymentFailure() - { - $this->_importPaymentInformation(); - - foreach ($this->_order->getInvoiceCollection() as $invoice) { - // phpcs:ignore Ecg.Performance.Loop.ModelLSD - $invoice->cancel()->save(); - } - - $this->_order - ->registerCancellation($this->_createIpnComment(''), false) - ->save(); - } - - /** - * Process a refund or a chargeback - */ - protected function _registerPaymentRefund() - { - $this->_importPaymentInformation(); - $reason = $this->getRequestData('reason_code'); - $isRefundFinal = !$this->_info::isReversalDisputable($reason); - - /** @var Mage_Sales_Model_Order_Payment $payment */ - $payment = $this->_order->getPayment(); - - $amount = $this->_order->getBaseCurrency()->formatTxt($payment->getBaseAmountRefundedOnline()); - - $transactionId = Mage::helper('paypal')->getHtmlTransactionId( - $payment->getMethodInstance()->getCode(), - $this->getRequestData('txn_id'), - ); - $comment = $this->_createIpnComment($this->_info::explainReasonCode($reason)) - . ' ' - . Mage::helper('paypal')->__('Refunded amount of %s. Transaction ID: "%s"', $amount, $transactionId); - - $payment->setPreparedMessage($comment) - ->setTransactionId($this->getRequestData('txn_id')) - ->setParentTransactionId($this->getRequestData('parent_txn_id')) - ->setIsTransactionClosed($isRefundFinal) - ->registerRefundNotification(-1 * (float) $this->getRequestData('mc_gross')); - $this->_order->addStatusHistoryComment($comment, false); - $this->_order->save(); - - // TODO: there is no way to close a capture right now - $creditmemo = $payment->getCreatedCreditmemo(); - if ($creditmemo) { - $creditmemo->sendEmail(); - $this->_order->addStatusHistoryComment( - Mage::helper('paypal')->__('Notified customer about creditmemo #%s.', $creditmemo->getIncrementId()), - ) - ->setIsCustomerNotified(true) - ->save(); - } - } - - /** - * Process payment reversal and cancelled reversal notification - */ - protected function _registerPaymentReversal() - { - $reasonCode = $this->_request['reason_code'] ?? null; - $reasonComment = $this->_info::explainReasonCode($reasonCode); - $notificationAmount = $this->_order - ->getBaseCurrency() - ->formatTxt($this->_request['mc_gross'] + $this->_request['mc_fee']); - $paymentStatus = $this->_filterPaymentStatus($this->_request['payment_status'] ?? null); - $orderStatus = ($paymentStatus == Mage_Paypal_Model_Info::PAYMENTSTATUS_REVERSED) - ? Mage_Paypal_Model_Info::ORDER_STATUS_REVERSED - : Mage_Paypal_Model_Info::ORDER_STATUS_CANCELED_REVERSAL; - /** - * Change order status to PayPal Reversed/PayPal Cancelled Reversal if it is possible. - */ - $transactionId = Mage::helper('paypal')->getHtmlTransactionId( - $this->_config->getMethodCode(), - $this->_request['txn_id'], - ); - $message = Mage::helper('paypal')->__('IPN "%s". %s Transaction amount %s. Transaction ID: "%s"', $this->_request['payment_status'], $reasonComment, $notificationAmount, $transactionId); - $this->_order->setStatus($orderStatus); - $this->_order->save(); - $this->_order->addStatusHistoryComment($message, $orderStatus) - ->setIsCustomerNotified(false) - ->save(); - } - - /** - * Process payment pending notification - * - * @throws Exception - */ - public function _registerPaymentPending() - { - $reason = $this->getRequestData('pending_reason'); - if ($reason === 'authorization') { - $this->_registerPaymentAuthorization(); - return; - } - if ($reason === 'order') { - throw new Exception('The "order" authorizations are not implemented.'); - } - - // case when was placed using PayPal standard - if (Mage_Sales_Model_Order::STATE_PENDING_PAYMENT == $this->_order->getState() - && !$this->getRequestData('transaction_entity') - ) { - $this->_registerPaymentCapture(); - return; - } - - $this->_importPaymentInformation(); - - $this->_order->getPayment() - ->setPreparedMessage($this->_createIpnComment($this->_info::explainPendingReason($reason))) - ->setTransactionId($this->getRequestData('txn_id')) - ->setIsTransactionClosed(0) - ->registerPaymentReviewAction(Mage_Sales_Model_Order_Payment::REVIEW_ACTION_UPDATE, false); - $this->_order->save(); - } - - /** - * Register authorized payment - */ - protected function _registerPaymentAuthorization() - { - $this->_importPaymentInformation(); - - $this->_order->getPayment() - ->setPreparedMessage($this->_createIpnComment('')) - ->setTransactionId($this->getRequestData('txn_id')) - ->setParentTransactionId($this->getRequestData('parent_txn_id')) - ->setCurrencyCode($this->getRequestData('mc_currency')) - ->setIsTransactionClosed(0) - ->registerAuthorizationNotification($this->getRequestData('mc_gross')); - - if (!$this->_order->getEmailSent()) { - $this->_order->queueNewOrderEmail(); - } - $this->_order->save(); - } - - /** - * Process voided authorization - */ - protected function _registerPaymentVoid() - { - $this->_importPaymentInformation(); - - $parentTxnId = $this->getRequestData('transaction_entity') == 'auth' - ? $this->getRequestData('txn_id') : $this->getRequestData('parent_txn_id'); - - $this->_order->getPayment() - ->setPreparedMessage($this->_createIpnComment('')) - ->setParentTransactionId($parentTxnId) - ->registerVoidNotification(); - - $this->_order->save(); - } - - /** - * TODO - * The status "Processed" is used when all Masspayments are successful - */ - protected function _registerMasspaymentsSuccess() - { - $comment = $this->_createIpnComment('', true); - $comment->save(); - } - - /** - * Generate an "IPN" comment with additional explanation. - * Returns the generated comment or order status history object - * - * @param string $comment - * @param bool $addToHistory - * @return string|Mage_Sales_Model_Order_Status_History - */ - protected function _createIpnComment($comment = '', $addToHistory = false) - { - $paymentStatus = $this->getRequestData('payment_status'); - $message = Mage::helper('paypal')->__('IPN "%s".', $paymentStatus); - if ($comment) { - $message .= ' ' . $comment; - } - if ($addToHistory) { - $message = $this->_order->addStatusHistoryComment($message); - $message->setIsCustomerNotified(null); - } - return $message; - } - - /** - * Map payment information from IPN to payment object - * Returns true if there were changes in information - * - * @return bool - */ - protected function _importPaymentInformation() - { - $payment = $this->_order->getPayment(); - $was = $payment->getAdditionalInformation(); - - // collect basic information - $from = []; - foreach ([ - Mage_Paypal_Model_Info::PAYER_ID, - 'payer_email' => Mage_Paypal_Model_Info::PAYER_EMAIL, - Mage_Paypal_Model_Info::PAYER_STATUS, - Mage_Paypal_Model_Info::ADDRESS_STATUS, - Mage_Paypal_Model_Info::PROTECTION_EL, - Mage_Paypal_Model_Info::PAYMENT_STATUS, - Mage_Paypal_Model_Info::PENDING_REASON, - ] as $privateKey => $publicKey - ) { - if (is_int($privateKey)) { - $privateKey = $publicKey; - } - $value = $this->getRequestData($privateKey); - if ($value) { - $from[$publicKey] = $value; - } - } - if (isset($from['payment_status'])) { - $from['payment_status'] = $this->_filterPaymentStatus($this->getRequestData('payment_status')); - } - - // collect fraud filters - $fraudFilters = []; - for ($i = 1; $value = $this->getRequestData("fraud_management_pending_filters_{$i}"); $i++) { - $fraudFilters[] = $value; - } - if ($fraudFilters) { - $from[Mage_Paypal_Model_Info::FRAUD_FILTERS] = $fraudFilters; - } - - $this->_info->importToPayment($from, $payment); - - /** - * Detect pending payment, frauds - * TODO: implement logic in one place - * @see Mage_Paypal_Model_Pro::importPaymentInfo() - */ - if ($this->_info::isPaymentReviewRequired($payment)) { - $payment->setIsTransactionPending(true); - if ($fraudFilters) { - $payment->setIsFraudDetected(true); - } - } - if ($this->_info::isPaymentSuccessful($payment)) { - $payment->setIsTransactionApproved(true); - } elseif ($this->_info::isPaymentFailed($payment)) { - $payment->setIsTransactionDenied(true); - } - - return $was != $payment->getAdditionalInformation(); - } - - /** - * Filter payment status from NVP into paypal/info format - * - * @param string $ipnPaymentStatus - * @return string - */ - protected function _filterPaymentStatus($ipnPaymentStatus) - { - return match ($ipnPaymentStatus) { - 'Created', 'Completed' => Mage_Paypal_Model_Info::PAYMENTSTATUS_COMPLETED, - 'Denied' => Mage_Paypal_Model_Info::PAYMENTSTATUS_DENIED, - 'Expired' => Mage_Paypal_Model_Info::PAYMENTSTATUS_EXPIRED, - 'Failed' => Mage_Paypal_Model_Info::PAYMENTSTATUS_FAILED, - 'Pending' => Mage_Paypal_Model_Info::PAYMENTSTATUS_PENDING, - 'Refunded' => Mage_Paypal_Model_Info::PAYMENTSTATUS_REFUNDED, - 'Reversed' => Mage_Paypal_Model_Info::PAYMENTSTATUS_REVERSED, - 'Canceled_Reversal' => Mage_Paypal_Model_Info::PAYMENTSTATUS_UNREVERSED, - 'Processed' => Mage_Paypal_Model_Info::PAYMENTSTATUS_PROCESSED, - 'Voided' => Mage_Paypal_Model_Info::PAYMENTSTATUS_VOIDED, - default => '', - }; - // documented in NVP, but not documented in IPN: - //Mage_Paypal_Model_Info::PAYMENTSTATUS_NONE - //Mage_Paypal_Model_Info::PAYMENTSTATUS_INPROGRESS - //Mage_Paypal_Model_Info::PAYMENTSTATUS_REFUNDEDPART - } - - /** - * Log debug data to file - */ - protected function _debug() - { - if ($this->_config && $this->_config->debug) { - $file = $this->_config->getMethodCode() ? "payment_{$this->_config->getMethodCode()}.log" - : self::DEFAULT_LOG_FILE; - Mage::getModel('core/log_adapter', $file)->log($this->_debugData); - } - } -} diff --git a/app/code/core/Mage/Paypal/Model/Method/Agreement.php b/app/code/core/Mage/Paypal/Model/Method/Agreement.php deleted file mode 100644 index 56e6408437a..00000000000 --- a/app/code/core/Mage/Paypal/Model/Method/Agreement.php +++ /dev/null @@ -1,325 +0,0 @@ -_pro = $proInstance; - } else { - $this->_pro = Mage::getModel('paypal/pro'); - } - $this->_pro->setMethod($this->_code); - } - - /** - * Store setter - * Also updates store ID in config object - * - * @param Mage_Core_Model_Store|int $store - * @return $this - */ - public function setStore($store) - { - $this->setData('store', $store); - if ($store === null) { - $store = Mage::app()->getStore()->getId(); - } - $this->_pro->getConfig()->setStoreId(is_object($store) ? $store->getId() : $store); - return $this; - } - - /** - * Init billing agreement - * - * @return $this - */ - public function initBillingAgreementToken(Mage_Payment_Model_Billing_AgreementAbstract $agreement) - { - $api = $this->_pro->getApi() - ->setReturnUrl($agreement->getReturnUrl()) - ->setCancelUrl($agreement->getCancelUrl()) - ->setBillingType($this->_pro->getApi()->getBillingAgreementType()); - - $api->callSetCustomerBillingAgreement(); - $agreement->setRedirectUrl( - $this->_pro->getConfig()->getStartBillingAgreementUrl($api->getToken()), - ); - return $this; - } - - /** - * Retrieve billing agreement customer details by token - * - * @return array - */ - public function getBillingAgreementTokenInfo(Mage_Payment_Model_Billing_AgreementAbstract $agreement) - { - $api = $this->_pro->getApi() - ->setToken($agreement->getToken()); - $api->callGetBillingAgreementCustomerDetails(); - $responseData = [ - 'token' => $api->getData('token'), - 'email' => $api->getData('email'), - 'payer_id' => $api->getData('payer_id'), - 'payer_status' => $api->getData('payer_status'), - ]; - $agreement->addData($responseData); - return $responseData; - } - - /** - * Create billing agreement by token specified in request - * - * @return $this - */ - public function placeBillingAgreement(Mage_Payment_Model_Billing_AgreementAbstract $agreement) - { - $api = $this->_pro->getApi() - ->setToken($agreement->getToken()); - $api->callCreateBillingAgreement(); - $agreement->setBillingAgreementId($api->getData('billing_agreement_id')); - return $this; - } - - /** - * Update billing agreement status - * - * @return $this - */ - public function updateBillingAgreementStatus(Mage_Payment_Model_Billing_AgreementAbstract $agreement) - { - $targetStatus = $agreement->getStatus(); - $api = $this->_pro->getApi() - ->setReferenceId($agreement->getReferenceId()) - ->setBillingAgreementStatus($targetStatus); - try { - $api->callUpdateBillingAgreement(); - } catch (Mage_Core_Exception $e) { - // when BA was already canceled, just pretend that the operation succeeded - if (!(Mage_Sales_Model_Billing_Agreement::STATUS_CANCELED == $targetStatus - && $api->getIsBillingAgreementAlreadyCancelled()) - ) { - throw $e; - } - } - return $this; - } - - /** - * Authorize payment - * - * @param float $amount - * @return $this - */ - public function authorize(Varien_Object $payment, $amount) - { - return $this->_placeOrder($payment, $amount); - } - - /** - * Void payment - * - * @param Mage_Sales_Model_Order_Payment $payment - * @return $this - */ - public function void(Varien_Object $payment) - { - $this->_pro->void($payment); - return $this; - } - - /** - * Capture payment - * - * @param Mage_Sales_Model_Order_Payment $payment - * @param float $amount - * @return $this - */ - public function capture(Varien_Object $payment, $amount) - { - if ($this->_pro->capture($payment, $amount) === false) { - $this->_placeOrder($payment, $amount); - } - return $this; - } - - /** - * Refund capture - * - * @param Mage_Sales_Model_Order_Payment $payment - * @param float $amount - * @return $this - */ - public function refund(Varien_Object $payment, $amount) - { - $this->_pro->refund($payment, $amount); - return $this; - } - - /** - * Cancel payment - * - * @param Mage_Sales_Model_Order_Payment $payment - * @return $this - */ - public function cancel(Varien_Object $payment) - { - $this->_pro->cancel($payment); - return $this; - } - - /** - * Whether payment can be reviewed - * - * @param Mage_Sales_Model_Order_Payment $payment - * @return bool - */ - public function canReviewPayment(Mage_Payment_Model_Info $payment) - { - return parent::canReviewPayment($payment) && $this->_pro->canReviewPayment($payment); - } - - /** - * Attempt to accept a pending payment - * - * @param Mage_Sales_Model_Order_Payment $payment - * @return bool - */ - public function acceptPayment(Mage_Payment_Model_Info $payment) - { - parent::acceptPayment($payment); - return $this->_pro->reviewPayment($payment, Mage_Paypal_Model_Pro::PAYMENT_REVIEW_ACCEPT); - } - - /** - * Attempt to deny a pending payment - * - * @param Mage_Sales_Model_Order_Payment $payment - * @return bool - */ - public function denyPayment(Mage_Payment_Model_Info $payment) - { - parent::denyPayment($payment); - return $this->_pro->reviewPayment($payment, Mage_Paypal_Model_Pro::PAYMENT_REVIEW_DENY); - } - - /** - * Fetch transaction details info - * - * @param string $transactionId - * @return array - */ - public function fetchTransactionInfo(Mage_Payment_Model_Info $payment, $transactionId) - { - return $this->_pro->fetchTransactionInfo($payment, $transactionId); - } - - /** - * Place an order with authorization or capture action - * - * @param float $amount - * @return $this - */ - protected function _placeOrder(Mage_Sales_Model_Order_Payment $payment, $amount) - { - $order = $payment->getOrder(); - $billingAgreement = Mage::getModel('sales/billing_agreement')->load( - $payment->getAdditionalInformation( - Mage_Sales_Model_Payment_Method_Billing_AgreementAbstract::TRANSPORT_BILLING_AGREEMENT_ID, - ), - ); - - $proConfig = $this->_pro->getConfig(); - $api = $this->_pro->getApi() - ->setReferenceId($billingAgreement->getReferenceId()) - ->setPaymentAction($proConfig->paymentAction) - ->setAmount($amount) - ->setCurrencyCode($payment->getOrder()->getBaseCurrencyCode()) - ->setNotifyUrl(Mage::getUrl('paypal/ipn/')) - ->setPaypalCart(Mage::getModel('paypal/cart', [$order])) - ->setIsLineItemsEnabled($proConfig->lineItemsEnabled) - ->setInvNum($order->getIncrementId()) - ; - - // call api and import transaction and other payment information - $api->callDoReferenceTransaction(); - $this->_pro->importPaymentInfo($api, $payment); - $api->callGetTransactionDetails(); - $this->_pro->importPaymentInfo($api, $payment); - - $payment->setTransactionId($api->getTransactionId()) - ->setIsTransactionClosed(0); - - if ($api->getBillingAgreementId()) { - $order->addRelatedObject($billingAgreement); - $billingAgreement->setIsObjectChanged(true); - $billingAgreement->addOrderRelation($order); - } - - return $this; - } - - protected function _isAvailable($quote) - { - return $this->_pro->getConfig()->isMethodAvailable($this->_code); - } - - /** - * Payment action getter compatible with payment model - * - * @see Mage_Sales_Model_Payment::place() - * @return string - */ - public function getConfigPaymentAction() - { - return $this->_pro->getConfig()->getPaymentAction(); - } -} diff --git a/app/code/core/Mage/Paypal/Model/Mysql4/Cert.php b/app/code/core/Mage/Paypal/Model/Mysql4/Cert.php deleted file mode 100644 index e3d8791a3f4..00000000000 --- a/app/code/core/Mage/Paypal/Model/Mysql4/Cert.php +++ /dev/null @@ -1,16 +0,0 @@ -getSftpCredentials(true); - foreach ($credentials as $config) { - try { - $reports->fetchAndSave($config); - } catch (Exception $e) { - Mage::logException($e); - } - } - } catch (Exception $e) { - Mage::logException($e); - } - } - - /** - * Clean unfinished transaction - * - * @deprecated since 1.6.2.0 - * @return $this - */ - public function cleanTransactions() - { - return $this; - } - - /** - * Save order into registry to use it in the overloaded controller. - * - * @return $this - */ - public function saveOrderAfterSubmit(Varien_Event_Observer $observer) - { - /** @var Mage_Sales_Model_Order $order */ - $order = $observer->getEvent()->getData('order'); - Mage::register('hss_order', $order, true); - - return $this; - } - - /** - * Set data for response of frontend saveOrder action - * - * @return $this - */ - public function setResponseAfterSaveOrder(Varien_Event_Observer $observer) - { - /** @var Mage_Sales_Model_Order $order */ - $order = Mage::registry('hss_order'); - - if ($order && $order->getId()) { - $payment = $order->getPayment(); - if ($payment && in_array($payment->getMethod(), Mage::helper('paypal/hss')->getHssMethods())) { - /** @var Mage_Core_Controller_Varien_Action $controller */ - $controller = $observer->getEvent()->getData('controller_action'); - $result = Mage::helper('core')->jsonDecode( - $controller->getResponse()->getBody('default'), - Zend_Json::TYPE_ARRAY, - ); - - if (empty($result['error'])) { - $controller->loadLayout('checkout_onepage_review'); - $html = $controller->getLayout()->getBlock('paypal.iframe')->toHtml(); - $result['update_section'] = [ - 'name' => 'paypaliframe', - 'html' => $html, - ]; - $result['redirect'] = false; - $result['success'] = false; - $controller->getResponse()->clearHeader('Location'); - $controller->getResponse()->setBody(Mage::helper('core')->jsonEncode($result)); - } - } - } - - return $this; - } - - /** - * Load country dependent PayPal solutions system configuration - */ - public function loadCountryDependentSolutionsConfig(Varien_Event_Observer $observer) - { - $countryCode = Mage::helper('paypal')->getConfigurationCountryCode(); - $paymentGroups = $observer->getEvent()->getConfig()->getNode('sections/payment/groups'); - $paymentsConfigs = $paymentGroups->xpath('paypal_payments/*/backend_config/' . $countryCode); - if ($paymentsConfigs) { - foreach ($paymentsConfigs as $config) { - $parent = $config->getParent()->getParent(); - $parent->extend($config, true); - } - } - - $payments = $paymentGroups->xpath('paypal_payments/*'); - foreach ($payments as $payment) { - if ((int) $payment->include) { - $fields = $paymentGroups->xpath((string) $payment->group . '/fields'); - if (isset($fields[0])) { - $fields[0]->appendChild($payment, true); - } - } - } - } - - /** - * Update transaction with HTML representation of txn_id - */ - public function observeHtmlTransactionId(Varien_Event_Observer $observer) - { - /** @var Varien_Object $transaction */ - $transaction = $observer->getEvent()->getTransaction(); - $transaction->setHtmlTxnId(Mage::helper('paypal')->getHtmlTransactionId( - $observer->getEvent()->getPayment()->getMethodInstance()->getCode(), - $transaction->getTxnId(), - )); - } -} diff --git a/app/code/core/Mage/Paypal/Model/Order.php b/app/code/core/Mage/Paypal/Model/Order.php new file mode 100644 index 00000000000..12419a96762 --- /dev/null +++ b/app/code/core/Mage/Paypal/Model/Order.php @@ -0,0 +1,364 @@ +getHelper()->validateQuoteForPayment($quote); + $quote->reserveOrderId()->save(); + $api = $this->getHelper()->getApi(); + $orderRequest = $this->buildOrderRequest($quote, $quote->getReservedOrderId(), $fundingSource); + $paypalRequestId = $this->getHelper()->getPaypalRequestId($quote) ?? bin2hex(random_bytes(16)); + $response = $api->createOrder($quote, $orderRequest, $paypalRequestId); + $result = $response->getResult(); + + if ($response->isError()) { + $this->getHelper()->handleApiError($response, 'Error creating PayPal order'); + } + + $this->updatePaymentWithOrderInfo($quote->getPayment(), $response, $paypalRequestId, $fundingSource); + + return [ + 'success' => true, + 'id' => $result->getId(), + ]; + } catch (Exception $e) { + Mage::logException($e); + return [ + 'success' => false, + 'error' => $e->getMessage(), + ]; + } + } + + /** + * Build a complete PayPal order request using SDK builders + * + * @param string|null $referenceId Optional reference ID + * @param string|null $fundingSource Optional funding source for the order + * @return object The built order request object + */ + public function buildOrderRequest(Mage_Sales_Model_Quote $quote, ?string $referenceId = null, ?string $fundingSource = null): object + { + $purchaseUnit = $this->buildPurchaseUnit($quote, $referenceId); + $orderRequestBuilder = OrderRequestBuilder::init( + $this->getHelper()->getPaymentIntent(), + [$purchaseUnit], + ); + + /** + * @var PaypalServerSdkLib\Models\Payer $payer + */ + $payer = $this->buildPayerFromBillingAddress($quote); + if ($payer !== null) { + $orderRequestBuilder->payer($payer); + } + if ($fundingSource) { + $paymentSource = $this->_buildPaymentSource($fundingSource, $payer); + if ($paymentSource !== null) { + $orderRequestBuilder->paymentSource($paymentSource); + } + } + return $orderRequestBuilder->build(); + } + + /** + * Build a PayPal payment source based on funding source type + * + * @param string $fundingSource The funding source type + * @param object $payer The payer object containing customer information + * @return object|null The built payment source object, or null for default payment methods + */ + private function _buildPaymentSource(string $fundingSource, object $payer): ?object + { + $paymentSourceBuilder = PaymentSourceBuilder::init(); + $nameObj = $payer->getName(); + $addressObj = $payer->getAddress(); + $name = $nameObj->getGivenName() . ' ' . $nameObj->getSurname(); + $country = $addressObj->getCountryCode(); + $email = $payer->getEmailAddress() ?? 'noreply@example.com'; + switch ($fundingSource) { + // Payment methods requiring name and country + case 'mybank': + $paymentSourceBuilder->mybank(MybankPaymentRequestBuilder::init($name, $country)->build()); + break; + case 'bancontact': + $paymentSourceBuilder->bancontact(BancontactPaymentRequestBuilder::init($name, $country)->build()); + break; + case 'blik': + $paymentSourceBuilder->blik(BlikPaymentRequestBuilder::init($name, $country)->build()); + break; + case 'eps': + $paymentSourceBuilder->eps(EpsPaymentRequestBuilder::init($name, $country)->build()); + break; + case 'giropay': + $paymentSourceBuilder->giropay(GiropayPaymentRequestBuilder::init($name, $country)->build()); + break; + case 'ideal': + $paymentSourceBuilder->ideal(IdealPaymentRequestBuilder::init($name, $country)->build()); + break; + case 'sofort': + $paymentSourceBuilder->sofort(SofortPaymentRequestBuilder::init($name, $country)->build()); + break; + + // Payment methods requiring name, email, and country + case 'p24': + $paymentSourceBuilder->p24(P24PaymentRequestBuilder::init($name, $email, $country)->build()); + break; + case 'trustly': + $paymentSourceBuilder->trustly(TrustlyPaymentRequestBuilder::init($name, $country, $email)->build()); + break; + + // Payment methods requiring no init parameters + case 'applepay': + $paymentSourceBuilder->applePay(ApplePayRequestBuilder::init()->build()); + break; + case 'googlepay': + $paymentSourceBuilder->googlePay(GooglePayRequestBuilder::init()->build()); + break; + case 'venmo': + $paymentSourceBuilder->venmo(VenmoWalletRequestBuilder::init()->build()); + break; + + // Default payment methods (PayPal, card) don't need explicit payment source + case 'paypal': + case 'card': + default: + return null; + } + + return $paymentSourceBuilder->build(); + } + + /** + * Build a purchase unit using PayPal SDK builders + */ + public function buildPurchaseUnit(Mage_Sales_Model_Quote $quote, ?string $referenceId = null): object + { + $cart = Mage::getModel('paypal/cart', [$quote]); + $currency = $quote->getOrderCurrencyCode() ?: $quote->getQuoteCurrencyCode(); + + $adjustedCartData = $this->adjustCartTotalsForTaxDiscrepancy($cart, $currency); + $totals = $adjustedCartData['totals']; + $items = $adjustedCartData['items']; + + $breakdown = $this->buildAmountBreakdown($totals); + $amount = $this->buildAmountWithBreakdown($currency, $quote->getGrandTotal(), $breakdown); + + $purchaseUnitBuilder = PurchaseUnitRequestBuilder::init($amount) + ->items($items) + ->referenceId($referenceId ?: (string) $quote->getId()) + ->invoiceId($referenceId ?: (string) $quote->getId()); + + return $purchaseUnitBuilder->build(); + } + + /** + * Build amount breakdown from cart totals + * + * @param array $totals Cart totals + * @return object Built breakdown object + */ + public function buildAmountBreakdown(array $totals): object + { + $breakdownBuilder = AmountBreakdownBuilder::init(); + + if (isset($totals[Mage_Paypal_Model_Cart::TOTAL_SUBTOTAL])) { + $breakdownBuilder->itemTotal($totals[Mage_Paypal_Model_Cart::TOTAL_SUBTOTAL]); + } + + if (isset($totals[Mage_Paypal_Model_Cart::TOTAL_TAX])) { + $breakdownBuilder->taxTotal($totals[Mage_Paypal_Model_Cart::TOTAL_TAX]); + } + + if (isset($totals[Mage_Paypal_Model_Cart::TOTAL_SHIPPING])) { + $breakdownBuilder->shipping($totals[Mage_Paypal_Model_Cart::TOTAL_SHIPPING]); + } + + if ( + isset($totals[Mage_Paypal_Model_Cart::TOTAL_DISCOUNT]) && + $totals[Mage_Paypal_Model_Cart::TOTAL_DISCOUNT]->getValue() > 0 + ) { + $breakdownBuilder->discount($totals[Mage_Paypal_Model_Cart::TOTAL_DISCOUNT]); + } + + return $breakdownBuilder->build(); + } + + /** + * Build amount with breakdown + * + * @param object $breakdown Built breakdown object + */ + public function buildAmountWithBreakdown(string $currency, float $totalAmount, object $breakdown): object + { + $formattedTotal = number_format($totalAmount, 2, '.', ''); + + return AmountWithBreakdownBuilder::init($currency, $formattedTotal) + ->breakdown($breakdown) + ->build(); + } + + /** + * Build payer object from billing address + */ + public function buildPayerFromBillingAddress(Mage_Sales_Model_Quote $quote): ?object + { + $billingAddress = $quote->getBillingAddress(); + + if ($billingAddress->validate() !== true) { + return null; + } + + $name = NameBuilder::init() + ->givenName($billingAddress->getFirstname()) + ->surname($billingAddress->getLastname()) + ->build(); + + $address = AddressBuilder::init($billingAddress->getCountryId()) + ->addressLine1($billingAddress->getStreetLine(1)) + ->addressLine2($billingAddress->getStreetLine(2)) + ->adminArea2($billingAddress->getCity()) + ->adminArea1($billingAddress->getRegionCode()) + ->postalCode($billingAddress->getPostcode()) + ->build(); + + return PayerBuilder::init() + ->emailAddress($quote->getEmail()) + ->name($name) + ->address($address) + ->build(); + } + + /** + * Adjust tax totals and items for rounding discrepancies + * + * @return array{totals: array, items: array} + */ + public function adjustCartTotalsForTaxDiscrepancy(Mage_Paypal_Model_Cart $cart, string $currency): array + { + $totals = $cart->getAmounts(); + $items = $cart->getAllItems(); + + $taxCalculated = 0.00; + $taxAmount = isset($totals[Mage_Paypal_Model_Cart::TOTAL_TAX]) + ? (float) $totals[Mage_Paypal_Model_Cart::TOTAL_TAX]->getValue() + : 0.00; + + foreach ($items as $item) { + /** @var PaypalServerSdkLib\Models\Item $item */ + if ($item->getTax()) { + $qty = (int) $item->getQuantity(); + $taxValue = (float) $item->getTax()->getValue(); + $taxCalculated += $taxValue * $qty; + } + } + + $taxDifference = round($taxAmount - $taxCalculated, 2); + + if ($taxDifference < 0) { + $totals[Mage_Paypal_Model_Cart::TOTAL_TAX]->setValue(number_format($taxCalculated, 2, '.', '')); + + if (isset($totals[Mage_Paypal_Model_Cart::TOTAL_DISCOUNT])) { + $totalDiscount = (float) $totals[Mage_Paypal_Model_Cart::TOTAL_DISCOUNT]->getValue(); + $totals[Mage_Paypal_Model_Cart::TOTAL_DISCOUNT]->setValue( + number_format(abs($taxDifference) + $totalDiscount, 2, '.', ''), + ); + } else { + $totals[Mage_Paypal_Model_Cart::TOTAL_DISCOUNT] = MoneyBuilder::init( + $currency, + number_format(abs($taxDifference), 2, '.', ''), + )->build(); + } + } elseif ($taxDifference > 0) { + $moneyBuilder = MoneyBuilder::init($currency, number_format(abs($taxDifference), 2, '.', '')); + $roundingItem = ItemBuilder::init( + Mage::helper('paypal')->__('Rounding'), + $moneyBuilder->build(), + '1', + ) + ->sku(Mage::helper('paypal')->__('Rounding')) + ->category(ItemCategory::DIGITAL_GOODS) + ->build(); + + $items[] = $roundingItem; + $totals[Mage_Paypal_Model_Cart::TOTAL_TAX]->setValue(number_format($taxCalculated, 2, '.', '')); + } + + return ['totals' => $totals, 'items' => $items]; + } + + /** + * Update payment object with PayPal order information + */ + public function updatePaymentWithOrderInfo(Mage_Sales_Model_Quote_Payment $payment, ApiResponse $response, string $paypalRequestId, string $fundingSource): void + { + $result = $response->getResult(); + $payment->setPaypalCorrelationId($result->getId()) + ->setAdditionalInformation( + Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, + $this->getHelper()->prepareRawDetails($response->getBody()), + )->setAdditionalInformation( + Mage_Paypal_Model_Payment::PAYPAL_REQUEST_ID, + $paypalRequestId, + )->setAdditionalInformation( + Mage_Paypal_Model_Payment::PAYPAL_PAYMENT_SOURCE, + $fundingSource, + )->save(); + } + + /** + * Get PayPal Helper instance + */ + private function getHelper(): Mage_Paypal_Model_Helper + { + return Mage::getSingleton('paypal/helper'); + } +} diff --git a/app/code/core/Mage/Paypal/Model/Payflow/Request.php b/app/code/core/Mage/Paypal/Model/Payflow/Request.php deleted file mode 100644 index fbbdc0d7524..00000000000 --- a/app/code/core/Mage/Paypal/Model/Payflow/Request.php +++ /dev/null @@ -1,40 +0,0 @@ -_underscore(substr($method, 3)); - if (isset($args[0]) && (strstr($args[0], '=') || strstr($args[0], '&'))) { - $key .= '[' . strlen($args[0]) . ']'; - } - return match (substr($method, 0, 3)) { - 'get' => $this->getData($key, $args[0] ?? null), - 'set' => $this->setData($key, $args[0] ?? null), - 'uns' => $this->unsetData($key), - 'has' => isset($this->_data[$key]), - default => throw new Varien_Exception('Invalid method ' . static::class . '::' . $method . '(' . print_r($args, true) . ')'), - }; - } -} diff --git a/app/code/core/Mage/Paypal/Model/Payflowadvanced.php b/app/code/core/Mage/Paypal/Model/Payflowadvanced.php deleted file mode 100644 index eee6adee684..00000000000 --- a/app/code/core/Mage/Paypal/Model/Payflowadvanced.php +++ /dev/null @@ -1,44 +0,0 @@ - 'billtofirstname', - 'lastname' => 'billtolastname', - 'address' => 'billtostreet', - 'city' => 'billtocity', - 'state' => 'billtostate', - 'zip' => 'billtozip', - 'country' => 'billtocountry', - 'phone' => 'billtophone', - 'email' => 'billtoemail', - 'nametoship' => 'shiptofirstname', - 'addresstoship' => 'shiptostreet', - 'citytoship' => 'shiptocity', - 'statetoship' => 'shiptostate', - 'ziptoship' => 'shiptozip', - 'countrytoship' => 'shiptocountry', - 'phonetoship' => 'shiptophone', - 'emailtoship' => 'shiptoemail', - 'faxtoship' => 'shiptofax', - 'method' => 'tender', - 'cscmatch' => 'cvv2match', - 'type' => 'trxtype', - ]; - - /** - * Payment method code - */ - protected $_code = Mage_Paypal_Model_Config::METHOD_PAYFLOWLINK; - - protected $_formBlockType = 'paypal/payflow_link_form'; - protected $_infoBlockType = 'paypal/payflow_link_info'; - - /** - * Availability options - */ - protected $_canUseInternal = false; - protected $_canUseForMultishipping = false; - protected $_isInitializeNeeded = true; - - /** - * Request & response model - * @var Mage_Paypal_Model_Payflow_Request - */ - protected $_response; - - /** - * Gateway request URL - * @var string - */ - public const TRANSACTION_PAYFLOW_URL = 'https://payflowlink.paypal.com/'; - - /** - * Error message - * @var string - */ - public const RESPONSE_ERROR_MSG = 'Payment error. %s was not found.'; - - /** - * Key for storing secure hash in additional information of payment model - * - * @var string - */ - protected $_secureSilentPostHashKey = 'secure_silent_post_hash'; - - /** - * Do not validate payment form using server methods - * - * @return bool - */ - public function validate() - { - return true; - } - - /** - * Check whether payment method can be used - * - * @param Mage_Sales_Model_Quote|null $quote - * @return bool - */ - public function isAvailable($quote = null) - { - $storeId = Mage::app()->getStore($this->getStore())->getId(); - $config = Mage::getModel('paypal/config')->setStoreId($storeId); - if (Mage_Payment_Model_Method_Abstract::isAvailable($quote) && $config->isMethodAvailable($this->getCode())) { - return true; - } - return false; - } - - /** - * Return iframe template value depending on config - * - * @return string - */ - public function getTemplate() - { - if ($this->getConfigData('mobile_optimized')) { - return self::MOBILE_LAYOUT_TEMPLATE; - } else { - return self::LAYOUT_TEMPLATE; - } - } - - /** - * Instantiate state and set it to state object - * - * @param string $paymentAction - * @param Varien_Object $stateObject - * @return $this - */ - public function initialize($paymentAction, $stateObject) - { - switch ($paymentAction) { - case Mage_Paypal_Model_Config::PAYMENT_ACTION_AUTH: - case Mage_Paypal_Model_Config::PAYMENT_ACTION_SALE: - $payment = $this->getInfoInstance(); - $order = $payment->getOrder(); - $order->setCanSendNewEmailFlag(false); - $payment->setAmountAuthorized($order->getTotalDue()); - $payment->setBaseAmountAuthorized($order->getBaseTotalDue()); - $this->_generateSecureSilentPostHash($payment); - $request = $this->_buildTokenRequest($payment); - $response = $this->_postRequest($request); - $this->_processTokenErrors($response, $payment); - - $order = $payment->getOrder(); - $order->setCanSendNewEmailFlag(false); - - $stateObject->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT); - $stateObject->setStatus('pending_payment'); - $stateObject->setIsNotified(false); - break; - default: - break; - } - return $this; - } - - /** - * Return response model. - * - * @return Mage_Paypal_Model_Payflow_Request - */ - public function getResponse() - { - if (!$this->_response) { - $this->_response = Mage::getModel('paypal/payflow_request'); - } - - return $this->_response; - } - - /** - * Fill response with data. - * - * @return $this - */ - public function setResponseData(array $postData) - { - foreach ($postData as $key => $val) { - $this->getResponse()->setData(strtolower($key), $val); - } - foreach ($this->_responseParamsMappings as $originKey => $key) { - $data = $this->getResponse()->getData($key); - if (isset($data)) { - $this->getResponse()->setData($originKey, $data); - } - } - // process AVS data separately - $avsAddr = $this->getResponse()->getData('avsaddr'); - $avsZip = $this->getResponse()->getData('avszip'); - if (isset($avsAddr) && isset($avsZip)) { - $this->getResponse()->setData('avsdata', $avsAddr . $avsZip); - } - // process Name separately - $firstnameParameter = $this->getResponse()->getData('billtofirstname'); - $lastnameParameter = $this->getResponse()->getData('billtolastname'); - if (isset($firstnameParameter) && isset($lastnameParameter)) { - $this->getResponse()->setData('name', $firstnameParameter . ' ' . $lastnameParameter); - } - - return $this; - } - - /** - * Operate with order using data from $_POST which came from Silent Post Url. - * - * @param array $responseData - * @throws Mage_Core_Exception in case of validation error or order creation error - */ - public function process($responseData) - { - $debugData = [ - 'response' => $responseData, - ]; - $this->_debug($debugData); - - $this->setResponseData($responseData); - $order = $this->_getOrderFromResponse(); - - if ($order) { - $this->_processOrder($order); - } - } - - /** - * Operate with order using information from silent post - */ - protected function _processOrder(Mage_Sales_Model_Order $order) - { - $response = $this->getResponse(); - $payment = $order->getPayment(); - $payment->setTransactionId($response->getPnref()) - ->setIsTransactionClosed(0); - $canSendNewOrderEmail = true; - - if ($response->getResult() == self::RESPONSE_CODE_FRAUDSERVICE_FILTER || - $response->getResult() == self::RESPONSE_CODE_DECLINED_BY_FILTER - ) { - $canSendNewOrderEmail = false; - $fraudMessage = $this->_getFraudMessage() ? - $response->getFraudMessage() : $response->getRespmsg(); - $payment->setIsTransactionPending(true) - ->setIsFraudDetected(true) - ->setAdditionalInformation('paypal_fraud_filters', $fraudMessage); - } - - if ($response->getAvsdata() && strstr(substr($response->getAvsdata(), 0, 2), 'N')) { - $payment->setAdditionalInformation('paypal_avs_code', substr($response->getAvsdata(), 0, 2)); - } - if ($response->getCvv2match() && $response->getCvv2match() != 'Y') { - $payment->setAdditionalInformation('paypal_cvv2_match', $response->getCvv2match()); - } - - switch ($response->getType()) { - case self::TRXTYPE_AUTH_ONLY: - $payment->registerAuthorizationNotification($payment->getBaseAmountAuthorized()); - break; - case self::TRXTYPE_SALE: - $payment->registerCaptureNotification($payment->getBaseAmountAuthorized()); - break; - } - $order->save(); - - try { - if ($canSendNewOrderEmail) { - $order->queueNewOrderEmail(); - } - Mage::getModel('sales/quote') - ->load($order->getQuoteId()) - ->setIsActive(false) - ->save(); - } catch (Exception $e) { - Mage::throwException(Mage::helper('paypal')->__('Can not send new order email.')); - } - } - - /** - * Get fraud message from response - * - * @return string|bool - */ - protected function _getFraudMessage() - { - if ($this->getResponse()->getFpsPrexmldata()) { - $xml = new SimpleXMLElement($this->getResponse()->getFpsPrexmldata()); - $this->getResponse()->setFraudMessage((string) $xml->rule->triggeredMessage); - return $this->getResponse()->getFraudMessage(); - } - - return false; - } - - /** - * Check response from Payflow gateway. - * - * @return false|Mage_Sales_Model_Order in case of validation passed - * @throws Mage_Core_Exception in other cases - */ - protected function _getOrderFromResponse() - { - $response = $this->getResponse(); - - $order = Mage::getModel('sales/order') - ->loadByIncrementId($response->getInvnum()); - - if ($this->_getSecureSilentPostHash($order->getPayment()) != $response->getUser2() - || $this->_code != $order->getPayment()->getMethodInstance()->getCode() - ) { - return false; - } - - if ($response->getResult() != self::RESPONSE_CODE_FRAUDSERVICE_FILTER - && $response->getResult() != self::RESPONSE_CODE_DECLINED_BY_FILTER - && $response->getResult() != self::RESPONSE_CODE_APPROVED - ) { - if ($order->getState() != Mage_Sales_Model_Order::STATE_CANCELED) { - $order->registerCancellation($response->getRespmsg())->save(); - } - Mage::throwException($response->getRespmsg()); - } - - $amountCompared = $response->getAmt() == $order->getPayment()->getBaseAmountAuthorized(); - if (!$order->getId() - || $order->getState() != Mage_Sales_Model_Order::STATE_PENDING_PAYMENT - || !$amountCompared - ) { - Mage::throwException($this->_formatStr(self::RESPONSE_ERROR_MSG, 'Order')); - } - - $fetchData = $this->fetchTransactionInfo($order->getPayment(), $response->getPnref()); - if (!isset($fetchData['custref']) || $fetchData['custref'] != $order->getIncrementId()) { - Mage::throwException($this->_formatStr(self::RESPONSE_ERROR_MSG, 'Transaction')); - } - - return $order; - } - - /** - * Build request for getting token - * - * @return Mage_Paypal_Model_Payflow_Request - */ - protected function _buildTokenRequest(Mage_Sales_Model_Order_Payment $payment) - { - $request = $this->_buildBasicRequest($payment); - $request->setCreatesecuretoken('Y') - ->setSecuretokenid($this->_generateSecureTokenId()) - ->setTrxtype($this->_getTrxTokenType()) - ->setAmt($this->_formatStr('%.2F', $payment->getOrder()->getBaseTotalDue())) - ->setCurrency($payment->getOrder()->getBaseCurrencyCode()) - ->setInvnum($payment->getOrder()->getIncrementId()) - ->setCustref($payment->getOrder()->getIncrementId()) - ->setPonum($payment->getOrder()->getId()); - //This is PaPal issue with taxes and shipping - //->setSubtotal($this->_formatStr('%.2F', $payment->getOrder()->getBaseSubtotal())) - //->setTaxamt($this->_formatStr('%.2F', $payment->getOrder()->getBaseTaxAmount())) - //->setFreightamt($this->_formatStr('%.2F', $payment->getOrder()->getBaseShippingAmount())); - - $order = $payment->getOrder(); - if (empty($order)) { - return $request; - } - - $billing = $order->getBillingAddress(); - if (!empty($billing)) { - $request->setFirstname($billing->getFirstname()) - ->setLastname($billing->getLastname()) - ->setStreet(implode(' ', $billing->getStreet())) - ->setCity($billing->getCity()) - ->setState($billing->getRegionCode()) - ->setZip($billing->getPostcode()) - ->setCountry($billing->getCountry()) - ->setEmail($order->getCustomerEmail()); - } - $shipping = $order->getShippingAddress(); - if (!empty($shipping)) { - $this->_applyCountryWorkarounds($shipping); - $request->setShiptofirstname($shipping->getFirstname()) - ->setShiptolastname($shipping->getLastname()) - ->setShiptostreet(implode(' ', $shipping->getStreet())) - ->setShiptocity($shipping->getCity()) - ->setShiptostate($shipping->getRegionCode()) - ->setShiptozip($shipping->getPostcode()) - ->setShiptocountry($shipping->getCountry()); - } - //pass store Id to request - $request->setUser1($order->getStoreId()) - ->setUser2($this->_getSecureSilentPostHash($payment)); - - return $request; - } - - /** - * Get store id from response if exists - * or default - * - * @return int - */ - protected function _getStoreId() - { - $response = $this->getResponse(); - if ($response->getUser1()) { - return (int) $response->getUser1(); - } - - return Mage::app()->getStore($this->getStore())->getId(); - } - - /** - * Return request object with basic information for gateway request - * - * @return Mage_Paypal_Model_Payflow_Request - */ - protected function _buildBasicRequest(Varien_Object $payment) - { - $request = Mage::getModel('paypal/payflow_request'); - $cscEditable = $this->getConfigData('csc_editable'); - $bnCode = Mage::getModel('paypal/config')->getBuildNotationCode(); - $request - ->setUser($this->getConfigData('user', $this->_getStoreId())) - ->setVendor($this->getConfigData('vendor', $this->_getStoreId())) - ->setPartner($this->getConfigData('partner', $this->_getStoreId())) - ->setPwd($this->getConfigData('pwd', $this->_getStoreId())) - ->setVerbosity($this->getConfigData('verbosity', $this->_getStoreId())) - ->setData('BNCODE', $bnCode) - ->setTender(self::TENDER_CC) - ->setCancelurl($this->_getCallbackUrl('cancelPayment')) - ->setErrorurl($this->_getCallbackUrl('returnUrl')) - ->setSilentpost('TRUE') - ->setSilentposturl($this->_getCallbackUrl('silentPost')) - ->setReturnurl($this->_getCallbackUrl('returnUrl')) - ->setTemplate($this->getTemplate()) - ->setDisablereceipt('TRUE') - ->setCscrequired($cscEditable && $this->getConfigData('csc_required') ? 'TRUE' : 'FALSE') - ->setCscedit($cscEditable ? 'TRUE' : 'FALSE') - ->setEmailcustomer($this->getConfigData('email_confirmation') ? 'TRUE' : 'FALSE') - ->setUrlmethod($this->getConfigData('url_method')); - return $request; - } - - /** - * Get payment action code - * - * @return string - */ - protected function _getTrxTokenType() - { - return match ($this->getConfigData('payment_action')) { - Mage_Paypal_Model_Config::PAYMENT_ACTION_AUTH => self::TRXTYPE_AUTH_ONLY, - Mage_Paypal_Model_Config::PAYMENT_ACTION_SALE => self::TRXTYPE_SALE, - default => '', - }; - } - - /** - * Return unique value for secure token id - * - * @return string - */ - protected function _generateSecureTokenId() - { - return Mage::helper('core')->uniqHash(); - } - - /** - * Format values - * - * @param mixed $format - * @param mixed $string - * @return string - */ - protected function _formatStr($format, $string) - { - return sprintf($format, $string); - } - - /** - * If response is failed throw exception - * Set token data in payment object - * - * @param Varien_Object $response - * @param Mage_Payment_Model_Info|Mage_Sales_Model_Order_Payment $payment - * @throws Mage_Core_Exception - */ - protected function _processTokenErrors($response, $payment) - { - if (!$response->getSecuretoken() && - $response->getResult() != self::RESPONSE_CODE_APPROVED && - $response->getResult() != self::RESPONSE_CODE_FRAUDSERVICE_FILTER - ) { - Mage::throwException($response->getRespmsg()); - } else { - $payment->setAdditionalInformation('secure_token_id', $response->getSecuretokenid()) - ->setAdditionalInformation('secure_token', $response->getSecuretoken()); - } - } - - /** - * Return secure hash value for silent post request - * - * @param Mage_Sales_Model_Order_Payment $payment - * @return string - */ - protected function _getSecureSilentPostHash($payment) - { - return $payment->getAdditionalInformation($this->_secureSilentPostHashKey); - } - - /** - * Generate end return new secure hash value - * - * @param Mage_Payment_Model_Info $payment - * @return string - */ - protected function _generateSecureSilentPostHash($payment) - { - $secureHash = md5(Mage::helper('core')->getRandomString(10)); - $payment->setAdditionalInformation($this->_secureSilentPostHashKey, $secureHash); - return $secureHash; - } - - /** - * Add transaction with correct transaction Id - * - * @deprecated since 1.6.2.0 - * @param Varien_Object $payment - * @param string $txnId - */ - protected function _addTransaction($payment, $txnId) {} - - /** - * Initialize request - * - * @deprecated since 1.6.2.0 - * @param mixed $amount - * @return $this - */ - protected function _initialize(Varien_Object $payment, $amount) - { - return $this; - } - - /** - * Check whether order review has enough data to initialize - * - * @deprecated since 1.6.2.0 - * @param string $token - */ - public function prepareOrderReview($token = null) {} - - /** - * Additional authorization logic for Account Verification - * - * @deprecated since 1.6.2.0 - * @param mixed $amount - * @param Mage_Paypal_Model_Payment_Transaction $transaction - * @param string $txnId - * @return $this - */ - protected function _authorize(Varien_Object $payment, $amount, $transaction, $txnId) - { - return $this; - } - - /** - * Operate with order or quote using information from silent post - * - * @deprecated since 1.6.2.0 - */ - protected function _process(Varien_Object $document) {} - - /** - * Check Transaction - * - * @deprecated since 1.6.2.0 - * @param Mage_Paypal_Model_Payment_Transaction $transaction - * @param mixed $amount - * @return $this - */ - protected function _checkTransaction($transaction, $amount) - { - return $this; - } - - /** - * Check response from Payflow gateway. - * - * @deprecated since 1.6.2.0 - * @return null - */ - protected function _getDocumentFromResponse() - { - return null; - } - - /** - * Get callback controller - * - * @return string - */ - public function getCallbackController() - { - return $this->_callbackController; - } - - /** - * Get callback url - * - * @param string $actionName - * @return string - */ - protected function _getCallbackUrl($actionName) - { - $request = Mage::app()->getRequest(); - if ($request->getParam('website')) { - $website = Mage::getModel('core/website')->load($request->getParam('website')); - $secure = Mage::getStoreConfigFlag( - Mage_Core_Model_Url::XML_PATH_SECURE_IN_FRONT, - $website->getDefaultStore(), - ); - $path = $secure - ? Mage_Core_Model_Store::XML_PATH_SECURE_BASE_LINK_URL - : Mage_Core_Model_Store::XML_PATH_UNSECURE_BASE_LINK_URL; - $websiteUrl = Mage::getStoreConfig($path, $website->getDefaultStore()); - } else { - $secure = Mage::getStoreConfigFlag(Mage_Core_Model_Url::XML_PATH_SECURE_IN_FRONT); - $websiteUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK, $secure); - } - - return $websiteUrl . 'paypal/' . $this->getCallbackController() . '/' . $actionName; - } -} diff --git a/app/code/core/Mage/Paypal/Model/Payflowpro.php b/app/code/core/Mage/Paypal/Model/Payflowpro.php deleted file mode 100644 index 1bc12df748c..00000000000 --- a/app/code/core/Mage/Paypal/Model/Payflowpro.php +++ /dev/null @@ -1,550 +0,0 @@ - 'MPIVENDOR3DS', - 'centinel_authstatus' => 'AUTHSTATUS3DS', - 'centinel_cavv' => 'CAVV', - 'centinel_eci' => 'ECI', - 'centinel_xid' => 'XID', - ]; - - /** - * Check whether payment method can be used - * - * @param Mage_Sales_Model_Quote|null $quote - * @return bool - */ - public function isAvailable($quote = null) - { - $storeId = Mage::app()->getStore($this->getStore())->getId(); - $config = Mage::getModel('paypal/config')->setStoreId($storeId); - if (parent::isAvailable($quote) && $config->isMethodAvailable($this->getCode())) { - return true; - } - return false; - } - - /** - * Payment action getter compatible with payment model - * - * @see Mage_Sales_Model_Payment::place() - * @return string - */ - public function getConfigPaymentAction() - { - return match ($this->getConfigData('payment_action')) { - Mage_Paypal_Model_Config::PAYMENT_ACTION_AUTH => Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE, - Mage_Paypal_Model_Config::PAYMENT_ACTION_SALE => Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE, - default => '', - }; - } - - /** - * Authorize payment - * - * @param Mage_Sales_Model_Order_Payment $payment - * @return $this - */ - public function authorize(Varien_Object $payment, $amount) - { - $request = $this->_buildPlaceRequest($payment, $amount); - $request->setTrxtype(self::TRXTYPE_AUTH_ONLY); - $this->_setReferenceTransaction($payment, $request); - $response = $this->_postRequest($request); - $this->_processErrors($response); - - switch ($response->getResultCode()) { - case self::RESPONSE_CODE_APPROVED: - $payment->setTransactionId($response->getPnref())->setIsTransactionClosed(0); - break; - case self::RESPONSE_CODE_FRAUDSERVICE_FILTER: - $payment->setTransactionId($response->getPnref())->setIsTransactionClosed(0); - $payment->setIsTransactionPending(true); - $payment->setIsFraudDetected(true); - break; - } - return $this; - } - - /** - * Get capture amount - * - * @param float $amount - * @return float - */ - protected function _getCaptureAmount($amount) - { - $infoInstance = $this->getInfoInstance(); - $amountToPay = round($amount, 2); - $authorizedAmount = round($infoInstance->getAmountAuthorized(), 2); - return $amountToPay != $authorizedAmount ? $amountToPay : 0; - } - - /** - * Capture payment - * - * @param Mage_Sales_Model_Order_Payment $payment - * @return $this - */ - public function capture(Varien_Object $payment, $amount) - { - if ($payment->getReferenceTransactionId()) { - $request = $this->_buildPlaceRequest($payment, $amount); - $request->setTrxtype(self::TRXTYPE_SALE); - $request->setOrigid($payment->getReferenceTransactionId()); - } elseif ($payment->getParentTransactionId()) { - $request = $this->_buildBasicRequest($payment); - $request->setOrigid($payment->getParentTransactionId()); - $captureAmount = $this->_getCaptureAmount($amount); - if ($captureAmount) { - $request->setAmt($captureAmount); - } - $trxType = $this->getInfoInstance()->hasAmountPaid() ? self::TRXTYPE_SALE : self::TRXTYPE_DELAYED_CAPTURE; - $request->setTrxtype($trxType); - } else { - $request = $this->_buildPlaceRequest($payment, $amount); - $request->setTrxtype(self::TRXTYPE_SALE); - } - - $response = $this->_postRequest($request); - $this->_processErrors($response); - - switch ($response->getResultCode()) { - case self::RESPONSE_CODE_APPROVED: - $payment->setTransactionId($response->getPnref())->setIsTransactionClosed(0); - break; - case self::RESPONSE_CODE_FRAUDSERVICE_FILTER: - $payment->setTransactionId($response->getPnref())->setIsTransactionClosed(0); - $payment->setIsTransactionPending(true); - $payment->setIsFraudDetected(true); - break; - } - return $this; - } - - /** - * Void payment - * - * @param Mage_Sales_Model_Order_Payment $payment - * @return $this - */ - public function void(Varien_Object $payment) - { - $request = $this->_buildBasicRequest($payment); - $request->setTrxtype(self::TRXTYPE_DELAYED_VOID); - $request->setOrigid($payment->getParentTransactionId()); - $response = $this->_postRequest($request); - $this->_processErrors($response); - - if ($response->getResultCode() == self::RESPONSE_CODE_APPROVED) { - $payment->setTransactionId($response->getPnref()) - ->setIsTransactionClosed(1) - ->setShouldCloseParentTransaction(1); - } - - return $this; - } - - /** - * Check void availability - * - * @return bool - */ - public function canVoid(Varien_Object $payment) - { - if ($payment instanceof Mage_Sales_Model_Order_Invoice - || $payment instanceof Mage_Sales_Model_Order_Creditmemo - ) { - return false; - } - if ($payment->getAmountPaid()) { - $this->_canVoid = false; - } - - return $this->_canVoid; - } - - /** - * Attempt to void the authorization on cancelling - * - * @return $this|false - */ - public function cancel(Varien_Object $payment) - { - if (!$payment->getOrder()->getInvoiceCollection()->count()) { - return $this->void($payment); - } - - return false; - } - - /** - * Refund capture - * - * @param Mage_Sales_Model_Order_Payment $payment - * @return $this - */ - public function refund(Varien_Object $payment, $amount) - { - $request = $this->_buildBasicRequest($payment); - $request->setTrxtype(self::TRXTYPE_CREDIT); - $request->setOrigid($payment->getParentTransactionId()); - $request->setAmt(round((float) $amount, 2)); - $response = $this->_postRequest($request); - $this->_processErrors($response); - - if ($response->getResultCode() == self::RESPONSE_CODE_APPROVED) { - $payment->setTransactionId($response->getPnref()) - ->setIsTransactionClosed(1); - $payment->setShouldCloseParentTransaction(!$payment->getCreditmemo()->getInvoice()->canRefund()); - } - return $this; - } - - /** - * Fetch transaction details info - * - * @param string $transactionId - * @return array - */ - public function fetchTransactionInfo(Mage_Payment_Model_Info $payment, $transactionId) - { - $request = $this->_buildBasicRequest($payment); - $request->setTrxtype(self::TRXTYPE_DELAYED_INQUIRY); - $request->setOrigid($transactionId); - $response = $this->_postRequest($request); - - $this->_processErrors($response); - - if (!self::_isTransactionUnderReview($response->getOrigresult())) { - $payment->setTransactionId($response->getOrigpnref()) - ->setIsTransactionClosed(0); - if ($response->getOrigresult() == self::RESPONSE_CODE_APPROVED) { - $payment->setIsTransactionApproved(true); - } elseif ($response->getOrigresult() == self::RESPONSE_CODE_DECLINED_BY_MERCHANT) { - $payment->setIsTransactionDenied(true); - } - } - - $rawData = $response->getData(); - return ($rawData) ? $rawData : []; - } - - /** - * Check whether the transaction is in payment review status - * - * @param string $status - * @return bool - */ - protected static function _isTransactionUnderReview($status) - { - if (in_array($status, [self::RESPONSE_CODE_APPROVED, self::RESPONSE_CODE_DECLINED_BY_MERCHANT])) { - return false; - } - return true; - } - - /** - * Getter for URL to perform Payflow requests, based on test mode by default - * - * @param bool $testMode Ability to specify test mode using - * @return string - */ - protected function _getTransactionUrl($testMode = null) - { - $testMode = is_null($testMode) ? $this->getConfigData('sandbox_flag') : (bool) $testMode; - if ($testMode) { - return self::TRANSACTION_URL_TEST_MODE; - } - return self::TRANSACTION_URL; - } - - /** - * Post request to gateway and return response - * - * @return Varien_Object - */ - protected function _postRequest(Varien_Object $request) - { - $debugData = ['request' => $request->getData()]; - - $client = new Varien_Http_Client(); - $result = new Varien_Object(); - - $_config = [ - 'maxredirects' => 5, - 'timeout' => 30, - 'verifypeer' => $this->getConfigData('verify_peer'), - ]; - - //checking proxy - $_isProxy = $this->getConfigData('use_proxy', false); - if ($_isProxy) { - $_config['proxy'] = $this->getConfigData('proxy_host') - . ':' - . $this->getConfigData('proxy_port');//http://proxy.shr.secureserver.net:3128', - $_config['httpproxytunnel'] = true; - $_config['proxytype'] = CURLPROXY_HTTP; - } - - $client->setUri($this->_getTransactionUrl()) - ->setConfig($_config) - ->setMethod(Zend_Http_Client::POST) - ->setParameterPost($request->getData()) - ->setHeaders('X-VPS-VIT-CLIENT-CERTIFICATION-ID: 33baf5893fc2123d8b191d2d011b7fdc') - ->setHeaders('X-VPS-Request-ID: ' . $request->getRequestId()) - ->setHeaders('X-VPS-CLIENT-TIMEOUT: ' . $this->_clientTimeout); - - try { - /** - * we are sending request to payflow pro without url encoding - * so we set up _urlEncodeBody flag to false - */ - $response = $client->setUrlEncodeBody(false)->request(); - } catch (Exception $e) { - $result->setResponseCode(-1) - ->setResponseReasonCode($e->getCode()) - ->setResponseReasonText($e->getMessage()); - - $debugData['result'] = $result->getData(); - $this->_debug($debugData); - throw $e; - } - - $response = strstr($response->getBody(), 'RESULT'); - $valArray = explode('&', $response); - - foreach ($valArray as $val) { - $valArray2 = explode('=', $val); - $result->setData(strtolower($valArray2[0]), $valArray2[1]); - } - - $result->setResultCode($result->getResult()) - ->setRespmsg($result->getRespmsg()); - - $debugData['result'] = $result->getData(); - $this->_debug($debugData); - - return $result; - } - - /** - * Return request object with information for 'authorization' or 'sale' action - * - * @param Mage_Sales_Model_Order_Payment $payment - * @param float $amount - * @return Varien_Object - */ - protected function _buildPlaceRequest(Varien_Object $payment, $amount) - { - $request = $this->_buildBasicRequest($payment); - $request->setAmt(round($amount, 2)); - $request->setAcct($payment->getCcNumber()); - $request->setExpdate(sprintf('%02d', $payment->getCcExpMonth()) . substr($payment->getCcExpYear(), -2, 2)); - $request->setCvv2($payment->getCcCid()); - - if ($this->getIsCentinelValidationEnabled()) { - $params = []; - $params = $this->getCentinelValidator()->exportCmpiData($params); - /** @var Varien_Object $request */ - $request = Varien_Object_Mapper::accumulateByMap($params, $request, $this->_centinelFieldMap); - } - - $order = $payment->getOrder(); - if (!empty($order)) { - $orderIncrementId = $order->getIncrementId(); - - $request->setCurrency($order->getBaseCurrencyCode()) - ->setInvnum($orderIncrementId) - ->setPonum($order->getId()) - ->setComment1($orderIncrementId); - - $customerId = $order->getCustomerId(); - if ($customerId) { - $request->setCustref($customerId); - } - - $billing = $order->getBillingAddress(); - if (!empty($billing)) { - $request->setFirstname($billing->getFirstname()) - ->setLastname($billing->getLastname()) - ->setStreet(implode(' ', $billing->getStreet())) - ->setCity($billing->getCity()) - ->setState($billing->getRegionCode()) - ->setZip($billing->getPostcode()) - ->setCountry($billing->getCountry()) - ->setEmail($payment->getOrder()->getCustomerEmail()); - } - $shipping = $order->getShippingAddress(); - if (!empty($shipping)) { - $this->_applyCountryWorkarounds($shipping); - $request->setShiptofirstname($shipping->getFirstname()) - ->setShiptolastname($shipping->getLastname()) - ->setShiptostreet(implode(' ', $shipping->getStreet())) - ->setShiptocity($shipping->getCity()) - ->setShiptostate($shipping->getRegionCode()) - ->setShiptozip($shipping->getPostcode()) - ->setShiptocountry($shipping->getCountry()); - } - } - return $request; - } - - /** - * Return request object with basic information for gateway request - * - * @param Mage_Sales_Model_Order_Payment $payment - * @return Varien_Object - */ - protected function _buildBasicRequest(Varien_Object $payment) - { - $request = new Varien_Object(); - $bnCode = Mage::getModel('paypal/config')->getBuildNotationCode(); - $request - ->setUser($this->getConfigData('user')) - ->setVendor($this->getConfigData('vendor')) - ->setPartner($this->getConfigData('partner')) - ->setPwd($this->getConfigData('pwd')) - ->setVerbosity($this->getConfigData('verbosity')) - ->setData('BNCODE', $bnCode) - ->setTender(self::TENDER_CC) - ->setRequestId($this->_generateRequestId()); - return $request; - } - - /** - * Return unique value for request - * - * @return string - */ - protected function _generateRequestId() - { - return Mage::helper('core')->uniqHash(); - } - - /** - * If response is failed throw exception - * - * @throws Mage_Core_Exception - */ - protected function _processErrors(Varien_Object $response) - { - if ($response->getResultCode() == self::RESPONSE_CODE_VOID_ERROR) { - throw new Mage_Paypal_Exception(Mage::helper('paypal')->__('You cannot void a verification transaction')); - } elseif ($response->getResultCode() != self::RESPONSE_CODE_APPROVED - && $response->getResultCode() != self::RESPONSE_CODE_FRAUDSERVICE_FILTER - ) { - Mage::throwException($response->getRespmsg()); - } - } - - /** - * Adopt specified address object to be compatible with Paypal - * Puerto Rico should be as state of USA and not as a country - */ - protected function _applyCountryWorkarounds(Varien_Object $address) - { - if ($address->getCountry() == 'PR') { - $address->setCountry('US'); - $address->setRegionCode('PR'); - } - } - - /** - * Set reference transaction data into request - * - * @param Varien_Object $request - * @return $this - */ - protected function _setReferenceTransaction(Varien_Object $payment, $request) - { - return $this; - } -} diff --git a/app/code/core/Mage/Paypal/Model/Payment.php b/app/code/core/Mage/Paypal/Model/Payment.php new file mode 100644 index 00000000000..afe2a96be18 --- /dev/null +++ b/app/code/core/Mage/Paypal/Model/Payment.php @@ -0,0 +1,241 @@ +getHelper()->getApi(); + $requestId = $this->getHelper()->getPaypalRequestId($quote); + $response = $api->captureOrder($orderId, $quote, $requestId); + $captureId = $this->getHelper()->extractCaptureId($response->getResult()); + if ($response->isError()) { + $this->getHelper()->handleApiError($response, 'Capture order failed'); + } + $this->getTransactionManager()->updatePaymentAfterCapture($quote->getPayment(), $response, $captureId); + $quote->collectTotals()->save(); + } + + /** + * Authorize PayPal payment via API + * + * @param string $orderId PayPal order ID + * @throws Mage_Paypal_Model_Exception + */ + public function authorizePayment(string $orderId, Mage_Sales_Model_Quote $quote): void + { + $api = $this->getHelper()->getApi(); + $response = $api->authorizeOrder($orderId, $quote); + $result = $response->getResult(); + + if ($response->isError()) { + $this->getHelper()->handleApiError($response, 'Authorization failed'); + } + + $this->getTransactionManager()->updatePaymentAfterAuthorization($quote->getPayment(), $response); + $quote->collectTotals()->save(); + + $authorization = $result->getPurchaseUnits()[0]->getPayments()->getAuthorizations()[0]; + $this->getHelper()->addOrderComment($quote, 'authorized', $authorization->getId()); + } + + /** + * Reauthorize a payment after the initial authorization has expired + * + * @param string $orderId PayPal order ID + * @param Mage_Sales_Model_Order $order Magento order + */ + public function reauthorizePayment(string $orderId, Mage_Sales_Model_Order $order): string + { + $api = $this->getHelper()->getApi(); + $response = $api->reAuthorizeOrder($orderId, $order); + + if ($response->isError()) { + $this->getHelper()->handleApiError($response, 'Reauthorization failed'); + } + + $payment = $order->getPayment(); + $payment->setAdditionalInformation( + self::PAYPAL_PAYMENT_AUTHORIZATION_REAUTHORIZED, + true, + ); + $payment->save(); + + $order->addStatusHistoryComment( + Mage::helper('paypal')->__( + 'PayPal payment has been reauthorized. Capture is required.', + ), + false, + )->save(); + return $response->getResult()->getBody(); + } + + /** + * Process refund payment method + * + * @param Varien_Object $payment Payment object + * @param float $amount Refund amount + * @throws Mage_Paypal_Model_Exception + */ + public function processRefund(Varien_Object $payment, $amount): static + { + try { + if (is_string($amount)) { + $amount = (float) $amount; + } + $response = $this->getHelper()->getApi()->refundCapturedPayment( + $payment->getParentTransactionId(), + $amount, + $payment->getOrder()->getOrderCurrencyCode(), + $payment->getOrder(), + ); + + if ($response->isError()) { + throw new Mage_Paypal_Model_Exception($response->getResult()->getMessage()); + } + + $result = $response->getResult(); + $this->getTransactionManager()->updatePaymentAfterRefund($payment, $result); + $this->getTransactionManager()->createRefundTransaction($payment, $response); + } catch (Exception $e) { + Mage::logException($e); + throw new Mage_Paypal_Model_Exception(Mage::helper('paypal')->__('Refund error: %s', $e->getMessage()), [], $e); + } + + return $this; + } + + /** + * Process capture payment method + * + * @param Varien_Object $payment Payment object + * @param float $amount Capture amount + * @throws Mage_Paypal_Model_Exception + */ + public function processCapture(Varien_Object $payment, $amount): static + { + $addInfo = $payment->getAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS); + if (($addInfo['intent'] ?? null) === CheckoutPaymentIntent::CAPTURE) { + return $this; + } + + $order = $payment->getOrder(); + $authorizationId = $payment->getAdditionalInformation(self::PAYPAL_PAYMENT_AUTHORIZATION_ID); + + if (!$authorizationId) { + throw new Mage_Paypal_Model_Exception( + Mage::helper('paypal')->__(self::ERROR_NO_AUTHORIZATION_ID), + ); + } + + $api = $this->getHelper()->getApi(); + $response = $api->captureAuthorizedPayment($authorizationId, $order); + + if ($response->isError()) { + $this->getHelper()->handleApiError($response, 'Capture failed'); + } + + $this->getTransactionManager()->updatePaymentAfterAuthorizedCapture($payment, $response, $authorizationId); + $this->getTransactionManager()->createCaptureTransaction($payment, $response, $authorizationId); + + return $this; + } + + /** + * Process void payment method + * + * @param Varien_Object $payment Payment object + * @throws Mage_Paypal_Model_Exception + */ + public function processVoid(Varien_Object $payment): static + { + $transactionId = str_contains($payment->getTransactionId(), '-void') + ? str_replace('-void', '', $payment->getTransactionId()) + : $payment->getTransactionId(); + + try { + $response = $this->getHelper()->getApi()->voidPayment($transactionId, $payment->getOrder()); + + if ($response->isError()) { + throw new Mage_Paypal_Model_Exception($response->getResult()->getMessage()); + } + + $this->getTransactionManager()->updatePaymentAfterVoid($payment); + $this->getTransactionManager()->createVoidTransaction($payment, $response); + $payment->getOrder()->addStatusHistoryComment( + Mage::helper('paypal')->__('PayPal payment voided successfully. Transaction ID: %s', $transactionId), + false, + )->save(); + } catch (Exception $e) { + Mage::logException($e); + throw new Mage_Paypal_Model_Exception(Mage::helper('paypal')->__('Void error: %s', $e->getMessage()), [], $e); + } + + return $this; + } + + /** + * Process cancel payment method + * + * @param Varien_Object $payment Payment object + * @throws Mage_Paypal_Model_Exception + */ + public function processCancel(Varien_Object $payment): static + { + if ($payment->getIsTransactionClosed() && $payment->getShouldCloseParentTransaction()) { + return $this; + } + $this->processVoid($payment); + return $this; + } + + /** + * Get PayPal Helper instance + */ + private function getHelper(): Mage_Paypal_Model_Helper + { + return Mage::getSingleton('paypal/helper'); + } + + /** + * Get PayPal Transaction Manager instance + */ + private function getTransactionManager(): Mage_Paypal_Model_Transaction + { + return Mage::getSingleton('paypal/transaction'); + } +} diff --git a/app/code/core/Mage/Paypal/Model/Payment/Transaction.php b/app/code/core/Mage/Paypal/Model/Payment/Transaction.php deleted file mode 100644 index 390329b61ec..00000000000 --- a/app/code/core/Mage/Paypal/Model/Payment/Transaction.php +++ /dev/null @@ -1,219 +0,0 @@ -_init('paypal/payment_transaction'); - parent::_construct(); - } - - /** - * Transaction ID setter - * @param string $txnId - * @return $this - */ - public function setTxnId($txnId) - { - $this->_verifyTxnId($txnId); - return $this->setData('txn_id', $txnId); - } - - /** - * Check object before loading by by specified transaction ID - * @param string $txnId - * @return $this - */ - protected function _beforeLoadByTxnId($txnId) - { - Mage::dispatchEvent( - $this->_eventPrefix . '_load_by_txn_id_before', - $this->_getEventData() + ['txn_id' => $txnId], - ); - return $this; - } - - /** - * Load self by specified transaction ID. Requires the valid payment object to be set - * @param string $txnId - * @return $this - */ - public function loadByTxnId($txnId) - { - $this->_beforeLoadByTxnId($txnId); - $this->getResource()->loadObjectByTxnId( - $this, - $txnId, - ); - $this->_afterLoadByTxnId(); - return $this; - } - - /** - * Check object after loading by by specified transaction ID - * - * @return $this - */ - protected function _afterLoadByTxnId() - { - Mage::dispatchEvent($this->_eventPrefix . '_load_by_txn_id_after', $this->_getEventData()); - return $this; - } - - /** - * Additional information setter - * Updates data inside the 'additional_information' array - * Doesn't allow to set arrays - * - * @param string $key - * @param mixed $value - * @return $this - * @throws Mage_Core_Exception - */ - public function setAdditionalInformation($key, $value) - { - if (is_object($value)) { - Mage::throwException(Mage::helper('paypal')->__('Payment transactions disallow storing objects.')); - } - $info = $this->_getData('additional_information'); - if (!$info) { - $info = []; - } - $info[$key] = $value; - return $this->setData('additional_information', $info); - } - - /** - * Getter for entire additional_information value or one of its element by key - * @param string $key - * @return array|null|mixed - */ - public function getAdditionalInformation($key = null) - { - $info = $this->_getData('additional_information'); - if (!$info) { - $info = []; - } - if ($key) { - return $info[$key] ?? null; - } - return $info; - } - - /** - * Unsetter for entire additional_information value or one of its element by key - * @param string $key - * @return $this - */ - public function unsAdditionalInformation($key = null) - { - if ($key) { - $info = $this->_getData('additional_information'); - if (is_array($info)) { - unset($info[$key]); - } - } else { - $info = []; - } - return $this->setData('additional_information', $info); - } - - /** - * Setter/Getter whether transaction is supposed to prevent exceptions on saving - * - * @param bool|null $setFailsafe - * @return bool|$this - */ - public function isFailsafe($setFailsafe = null) - { - if ($setFailsafe === null) { - return $this->_isFailsafe; - } - $this->_isFailsafe = (bool) $setFailsafe; - return $this; - } - - /** - * Verify data required for saving - * @return $this - */ - protected function _beforeSave() - { - if (!$this->getId()) { - $this->setCreatedAt(Mage::getModel('core/date')->gmtDate()); - } - return parent::_beforeSave(); - } - - /** - * Check whether specified transaction ID is valid - * @param string $txnId - * @throws Mage_Core_Exception - */ - protected function _verifyTxnId($txnId) - { - if ($txnId !== null && strlen($txnId) == 0) { - Mage::throwException(Mage::helper('paypal')->__('Transaction ID must not be empty.')); - } - } - - /** - * Make sure this object is a valid transaction - * TODO for more restriction we can check for data consistency - * @throws Mage_Core_Exception - */ - protected function _verifyThisTransactionExists() - { - if (!$this->getId()) { - Mage::throwException(Mage::helper('paypal')->__('This operation requires an existing transaction object.')); - } - } -} diff --git a/app/code/core/Mage/Paypal/Model/Paypal.php b/app/code/core/Mage/Paypal/Model/Paypal.php new file mode 100644 index 00000000000..7f7aff10a68 --- /dev/null +++ b/app/code/core/Mage/Paypal/Model/Paypal.php @@ -0,0 +1,179 @@ +getOrderHandler()->createOrder($quote, $fundingSource); + } + + /** + * Capture PayPal payment via API + * + * @param string $orderId PayPal order ID + * @throws Mage_Paypal_Model_Exception + */ + public function captureOrder(string $orderId, Mage_Sales_Model_Quote|Mage_Sales_Model_Order $quote): void + { + $this->getPaymentProcessor()->captureOrder($orderId, $quote); + } + + /** + * Authorize PayPal payment via API + * + * @param string $orderId PayPal order ID + * @throws Mage_Paypal_Model_Exception + */ + public function authorizePayment(string $orderId, Mage_Sales_Model_Quote $quote): void + { + $this->getPaymentProcessor()->authorizePayment($orderId, $quote); + } + + /** + * Reauthorize a payment after the initial authorization has expired + * + * @param string $orderId PayPal order ID + * @param Mage_Sales_Model_Order $order Magento order + */ + public function reauthorizePayment(string $orderId, Mage_Sales_Model_Order $order): string + { + return $this->getPaymentProcessor()->reauthorizePayment($orderId, $order); + } + + /** + * Validate payment method information object + */ + public function validate(): static + { + parent::validate(); + return $this; + } + + /** + * Refund payment method + * + * @param Varien_Object $payment Payment object + * @param float $amount Refund amount + * @throws Mage_Paypal_Model_Exception + */ + public function refund(Varien_Object $payment, $amount): static + { + $this->getPaymentProcessor()->processRefund($payment, $amount); + return $this; + } + + /** + * Capture payment method + * + * @param Varien_Object $payment Payment object + * @param float $amount Capture amount + * @throws Mage_Paypal_Model_Exception + */ + public function capture(Varien_Object $payment, $amount): static + { + $this->getPaymentProcessor()->processCapture($payment, $amount); + return $this; + } + + /** + * Void payment method + * + * @param Varien_Object $payment Payment object + * @throws Mage_Paypal_Model_Exception + */ + public function void(Varien_Object $payment): static + { + $this->getPaymentProcessor()->processVoid($payment); + return $this; + } + + /** + * Cancel payment method + * + * @param Varien_Object $payment Payment object + * @throws Mage_Paypal_Model_Exception + */ + public function cancel(Varien_Object $payment): static + { + $this->getPaymentProcessor()->processCancel($payment); + return $this; + } + + /** + * Check if payment method is available + * + * @param Mage_Sales_Model_Quote|null $quote + */ + public function isAvailable($quote = null): bool + { + if (!$this->getConfigData('client_id') || !$this->getConfigData('client_secret')) { + return false; + } + + $this->getHelper()->handleMultishippingNotification($quote); + + return parent::isAvailable($quote); + } + + /** + * Get PayPal Order Handler instance + */ + private function getOrderHandler(): Mage_Paypal_Model_Order + { + return Mage::getSingleton('paypal/order'); + } + + /** + * Get PayPal Payment Processor instance + */ + private function getPaymentProcessor(): Mage_Paypal_Model_Payment + { + return Mage::getSingleton('paypal/payment'); + } + + /** + * Get PayPal Helper instance + */ + private function getHelper(): Mage_Paypal_Model_Helper + { + return Mage::getSingleton('paypal/helper'); + } +} diff --git a/app/code/core/Mage/Paypal/Model/Pro.php b/app/code/core/Mage/Paypal/Model/Pro.php deleted file mode 100644 index 34b6376a42c..00000000000 --- a/app/code/core/Mage/Paypal/Model/Pro.php +++ /dev/null @@ -1,449 +0,0 @@ -_config === null) { - $params = [$code]; - if ($storeId !== null) { - $params[] = $storeId; - } - - /** @var Mage_Paypal_Model_Config $model */ - $model = Mage::getModel($this->_configType, $params); - $this->_config = $model; - } else { - $this->_config->setMethod($code); - if ($storeId !== null) { - $this->_config->setStoreId($storeId); - } - } - return $this; - } - - /** - * Config instance setter - * - * @param int $storeId - * @return $this - */ - public function setConfig(Mage_Paypal_Model_Config $instace, $storeId = null) - { - $this->_config = $instace; - if ($storeId !== null) { - $this->_config->setStoreId($storeId); - } - return $this; - } - - /** - * Config instance getter - * - * @return Mage_Paypal_Model_Config - */ - public function getConfig() - { - return $this->_config; - } - - /** - * API instance getter - * Sets current store id to current config instance and passes it to API - * - * @return Mage_Paypal_Model_Api_Nvp - */ - public function getApi() - { - if ($this->_api === null) { - $this->_api = Mage::getModel($this->_apiType); - } - $this->_api->setConfigObject($this->_config); - return $this->_api; - } - - /** - * Destroy existing NVP Api object - * - * @return $this - */ - public function resetApi() - { - $this->_api = null; - - return $this; - } - - /** - * Instantiate and return info model - * - * @return Mage_Paypal_Model_Info - */ - public function getInfo() - { - if ($this->_infoInstance === null) { - $this->_infoInstance = Mage::getModel('paypal/info'); - } - return $this->_infoInstance; - } - - /** - * Transfer transaction/payment information from API instance to order payment - * - * @param Mage_Paypal_Model_Api_Abstract $from - * @return $this - */ - public function importPaymentInfo(Varien_Object $from, Mage_Payment_Model_Info $to) - { - // update PayPal-specific payment information in the payment object - $this->getInfo()->importToPayment($from, $to); - - /** - * Detect payment review and/or frauds - * PayPal pro API returns fraud results only in the payment call response - */ - if ($from->getDataUsingMethod(Mage_Paypal_Model_Info::IS_FRAUD)) { - $to->setIsTransactionPending(true); - $to->setIsFraudDetected(true); - } elseif ($this->getInfo()->isPaymentReviewRequired($to)) { - $to->setIsTransactionPending(true); - } - - // give generic info about transaction state - if ($this->getInfo()->isPaymentSuccessful($to)) { - $to->setIsTransactionApproved(true); - } elseif ($this->getInfo()->isPaymentFailed($to)) { - $to->setIsTransactionDenied(true); - } - - return $this; - } - - /** - * Void transaction - */ - public function void(Varien_Object $payment) - { - if ($authTransactionId = $this->_getParentTransactionId($payment)) { - $api = $this->getApi(); - $api->setPayment($payment)->setAuthorizationId($authTransactionId)->callDoVoid(); - $this->importPaymentInfo($api, $payment); - } else { - Mage::throwException(Mage::helper('paypal')->__('Authorization transaction is required to void.')); - } - } - - /** - * Attempt to capture payment - * Will return false if the payment is not supposed to be captured - * - * @param float $amount - * @return false|null - */ - public function capture(Varien_Object $payment, $amount) - { - $authTransactionId = $this->_getParentTransactionId($payment); - if (!$authTransactionId) { - return false; - } - $api = $this->getApi() - ->setAuthorizationId($authTransactionId) - ->setIsCaptureComplete($payment->getShouldCloseParentTransaction()) - ->setAmount($amount) - ->setCurrencyCode($payment->getOrder()->getBaseCurrencyCode()) - ->setInvNum($payment->getOrder()->getIncrementId()) - // TODO: pass 'NOTE' to API - ; - - $api->callDoCapture(); - $this->_importCaptureResultToPayment($api, $payment); - } - - /** - * Refund a capture transaction - * - * @param float $amount - */ - public function refund(Varien_Object $payment, $amount) - { - $captureTxnId = $this->_getParentTransactionId($payment); - if ($captureTxnId) { - $api = $this->getApi(); - $order = $payment->getOrder(); - $api->setPayment($payment) - ->setTransactionId($captureTxnId) - ->setAmount($amount) - ->setCurrencyCode($order->getBaseCurrencyCode()) - ; - $canRefundMore = $payment->getCreditmemo()->getInvoice()->canRefund(); - $isFullRefund = !$canRefundMore - && (((float) $order->getBaseTotalOnlineRefunded() + (float) $order->getBaseTotalOfflineRefunded()) == 0); - $api->setRefundType($isFullRefund ? Mage_Paypal_Model_Config::REFUND_TYPE_FULL - : Mage_Paypal_Model_Config::REFUND_TYPE_PARTIAL); - $api->callRefundTransaction(); - $this->_importRefundResultToPayment($api, $payment, $canRefundMore); - } else { - Mage::throwException(Mage::helper('paypal')->__('Impossible to issue a refund transaction because the capture transaction does not exist.')); - } - } - - /** - * Cancel payment - */ - public function cancel(Varien_Object $payment) - { - if (!$payment->getOrder()->getInvoiceCollection()->count()) { - $this->void($payment); - } - } - - /** - * - * @param Mage_Sales_Model_Order_Payment $payment - * @return bool - */ - public function canReviewPayment(Mage_Payment_Model_Info $payment) - { - return Mage_Paypal_Model_Info::isPaymentReviewRequired($payment); - } - - /** - * Perform the payment review - * - * @param string $action - * @return bool - */ - public function reviewPayment(Mage_Payment_Model_Info $payment, $action) - { - $api = $this->getApi()->setTransactionId($payment->getLastTransId()); - - // check whether the review is still needed - $api->callGetTransactionDetails(); - $this->importPaymentInfo($api, $payment); - if (!$this->getInfo()->isPaymentReviewRequired($payment)) { - return false; - } - - // perform the review action - $api->setAction($action)->callManagePendingTransactionStatus(); - $api->callGetTransactionDetails(); - $this->importPaymentInfo($api, $payment); - return true; - } - - /** - * Fetch transaction details info - * - * @param string $transactionId - * @return array - */ - public function fetchTransactionInfo(Mage_Payment_Model_Info $payment, $transactionId) - { - $api = $this->getApi() - ->setTransactionId($transactionId) - ->setRawResponseNeeded(true); - $api->callGetTransactionDetails(); - $this->importPaymentInfo($api, $payment); - $data = $api->getRawSuccessResponseData(); - return ($data) ? $data : []; - } - - /** - * Validate RP data - * - * @throws Mage_Core_Exception - */ - public function validateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile) - { - $errors = []; - if (strlen($profile->getSubscriberName()) > 32) { // up to 32 single-byte chars - $errors[] = Mage::helper('paypal')->__('Subscriber name is too long.'); - } - $refId = $profile->getInternalReferenceId(); // up to 127 single-byte alphanumeric - if (strlen($refId) > 127) { // || !preg_match('/^[a-z\d\s]+$/i', $refId) - $errors[] = Mage::helper('paypal')->__('Merchant reference ID format is not supported.'); - } - $scheduleDescr = $profile->getScheduleDescription(); // up to 127 single-byte alphanumeric - if (strlen($refId) > 127) { // || !preg_match('/^[a-z\d\s]+$/i', $scheduleDescr) - $errors[] = Mage::helper('paypal')->__('Schedule description is too long.'); - } - if ($errors) { - Mage::throwException(implode(' ', $errors)); - } - } - - /** - * Submit RP to the gateway - * - * @throws Mage_Core_Exception - */ - public function submitRecurringProfile( - Mage_Payment_Model_Recurring_Profile $profile, - Mage_Payment_Model_Info $paymentInfo - ) { - $api = $this->getApi(); - Varien_Object_Mapper::accumulateByMap($profile, $api, [ - 'token', // EC fields - // TODO: DP fields - // profile fields - 'subscriber_name', 'start_datetime', 'internal_reference_id', 'schedule_description', - 'suspension_threshold', 'bill_failed_later', 'period_unit', 'period_frequency', 'period_max_cycles', - 'billing_amount' => 'amount', 'trial_period_unit', 'trial_period_frequency', 'trial_period_max_cycles', - 'trial_billing_amount', 'currency_code', 'shipping_amount', 'tax_amount', 'init_amount', 'init_may_fail', - ]); - $api->callCreateRecurringPaymentsProfile(); - $profile->setReferenceId($api->getRecurringProfileId()); - if ($api->getIsProfileActive()) { - $profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE); - } elseif ($api->getIsProfilePending()) { - $profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_PENDING); - } - } - - /** - * Fetch RP details - * - * @param string $referenceId - */ - public function getRecurringProfileDetails($referenceId, Varien_Object $result) - { - $api = $this->getApi(); - $api->setRecurringProfileId($referenceId) - ->callGetRecurringPaymentsProfileDetails($result) - ; - } - - /** - * Update RP data - */ - public function updateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile) {} - - /** - * Manage status - */ - public function updateRecurringProfileStatus(Mage_Payment_Model_Recurring_Profile $profile) - { - $api = $this->getApi(); - $action = null; - switch ($profile->getNewState()) { - case Mage_Sales_Model_Recurring_Profile::STATE_CANCELED: - $action = 'cancel'; - break; - case Mage_Sales_Model_Recurring_Profile::STATE_SUSPENDED: - $action = 'suspend'; - break; - case Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE: - $action = 'activate'; - break; - } - $state = $profile->getState(); - $api->setRecurringProfileId($profile->getReferenceId()) - ->setIsAlreadyCanceled($state == Mage_Sales_Model_Recurring_Profile::STATE_CANCELED) - ->setIsAlreadySuspended($state == Mage_Sales_Model_Recurring_Profile::STATE_SUSPENDED) - ->setIsAlreadyActive($state == Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE) - ->setAction($action) - ->callManageRecurringPaymentsProfileStatus() - ; - } - - /** - * Import capture results to payment - * - * @param Mage_Paypal_Model_Api_Nvp $api - * @param Mage_Sales_Model_Order_Payment $payment - */ - protected function _importCaptureResultToPayment($api, $payment) - { - $payment->setTransactionId($api->getTransactionId())->setIsTransactionClosed(false); - $this->importPaymentInfo($api, $payment); - } - - /** - * Import refund results to payment - * - * @param Mage_Paypal_Model_Api_Nvp $api - * @param Mage_Sales_Model_Order_Payment $payment - * @param bool $canRefundMore - */ - protected function _importRefundResultToPayment($api, $payment, $canRefundMore) - { - $payment->setTransactionId($api->getRefundTransactionId()) - ->setIsTransactionClosed(1) // refund initiated by merchant - ->setShouldCloseParentTransaction(!$canRefundMore) - ; - $this->importPaymentInfo($api, $payment); - } - - /** - * Parent transaction id getter - * - * @return string - */ - protected function _getParentTransactionId(Varien_Object $payment) - { - return $payment->getParentTransactionId() ? $payment->getParentTransactionId() : $payment->getLastTransId(); - } -} diff --git a/app/code/core/Mage/Paypal/Model/Report/Settlement.php b/app/code/core/Mage/Paypal/Model/Report/Settlement.php deleted file mode 100644 index c10b79fd910..00000000000 --- a/app/code/core/Mage/Paypal/Model/Report/Settlement.php +++ /dev/null @@ -1,421 +0,0 @@ - [ - 'section_columns' => [ - '' => 0, - 'TransactionID' => 1, - 'InvoiceID' => 2, - 'PayPalReferenceID' => 3, - 'PayPalReferenceIDType' => 4, - 'TransactionEventCode' => 5, - 'TransactionInitiationDate' => 6, - 'TransactionCompletionDate' => 7, - 'TransactionDebitOrCredit' => 8, - 'GrossTransactionAmount' => 9, - 'GrossTransactionCurrency' => 10, - 'FeeDebitOrCredit' => 11, - 'FeeAmount' => 12, - 'FeeCurrency' => 13, - 'CustomField' => 14, - 'ConsumerID' => 15, - ], - 'rowmap' => [ - 'TransactionID' => 'transaction_id', - 'InvoiceID' => 'invoice_id', - 'PayPalReferenceID' => 'paypal_reference_id', - 'PayPalReferenceIDType' => 'paypal_reference_id_type', - 'TransactionEventCode' => 'transaction_event_code', - 'TransactionInitiationDate' => 'transaction_initiation_date', - 'TransactionCompletionDate' => 'transaction_completion_date', - 'TransactionDebitOrCredit' => 'transaction_debit_or_credit', - 'GrossTransactionAmount' => 'gross_transaction_amount', - 'GrossTransactionCurrency' => 'gross_transaction_currency', - 'FeeDebitOrCredit' => 'fee_debit_or_credit', - 'FeeAmount' => 'fee_amount', - 'FeeCurrency' => 'fee_currency', - 'CustomField' => 'custom_field', - 'ConsumerID' => 'consumer_id', - ], - ], - 'new' => [ - 'section_columns' => [ - '' => 0, - 'Transaction ID' => 1, - 'Invoice ID' => 2, - 'PayPal Reference ID' => 3, - 'PayPal Reference ID Type' => 4, - 'Transaction Event Code' => 5, - 'Transaction Initiation Date' => 6, - 'Transaction Completion Date' => 7, - 'Transaction Debit or Credit' => 8, - 'Gross Transaction Amount' => 9, - 'Gross Transaction Currency' => 10, - 'Fee Debit or Credit' => 11, - 'Fee Amount' => 12, - 'Fee Currency' => 13, - 'Custom Field' => 14, - 'Consumer ID' => 15, - 'Payment Tracking ID' => 16, - 'Store ID' => 17, - ], - 'rowmap' => [ - 'Transaction ID' => 'transaction_id', - 'Invoice ID' => 'invoice_id', - 'PayPal Reference ID' => 'paypal_reference_id', - 'PayPal Reference ID Type' => 'paypal_reference_id_type', - 'Transaction Event Code' => 'transaction_event_code', - 'Transaction Initiation Date' => 'transaction_initiation_date', - 'Transaction Completion Date' => 'transaction_completion_date', - 'Transaction Debit or Credit' => 'transaction_debit_or_credit', - 'Gross Transaction Amount' => 'gross_transaction_amount', - 'Gross Transaction Currency' => 'gross_transaction_currency', - 'Fee Debit or Credit' => 'fee_debit_or_credit', - 'Fee Amount' => 'fee_amount', - 'Fee Currency' => 'fee_currency', - 'Custom Field' => 'custom_field', - 'Consumer ID' => 'consumer_id', - 'Payment Tracking ID' => 'payment_tracking_id', - 'Store ID' => 'store_id', - ], - ], - ]; - - protected function _construct() - { - $this->_init('paypal/report_settlement'); - } - - /** - * Stop saving process if file with same report date, account ID and last modified date was already ferched - * - * @return Mage_Core_Model_Abstract - */ - protected function _beforeSave() - { - $this->_dataSaveAllowed = true; - if ($this->getId()) { - if ($this->getLastModified() == $this->getReportLastModified()) { - $this->_dataSaveAllowed = false; - } - } - $this->setLastModified($this->getReportLastModified()); - return parent::_beforeSave(); - } - - /** - * Goes to specified host/path and fetches reports from there. - * Save reports to database. - * - * @param array $config SFTP credentials - * @return int Number of report rows that were fetched and saved successfully - * - * @SuppressWarnings("PHPMD.ErrorControlOperator") - */ - public function fetchAndSave($config) - { - $connection = new Varien_Io_Sftp(); - $connection->open([ - 'host' => $config['hostname'], - 'username' => $config['username'], - 'password' => $config['password'], - ]); - $connection->cd($config['path']); - $fetched = 0; - $listing = $this->_filterReportsList($connection->rawls()); - foreach ($listing as $filename => $attributes) { - $localCsv = tempnam(Mage::getConfig()->getOptions()->getTmpDir(), 'PayPal_STL'); - if ($connection->read($filename, $localCsv)) { - if (!is_writable($localCsv)) { - Mage::throwException(Mage::helper('paypal')->__('Cannot create target file for reading reports.')); - } - - $encoded = file_get_contents($localCsv); - $csvFormat = 'new'; - - $fileEncoding = mb_detect_encoding($encoded); - - if (self::FILES_OUT_CHARSET != $fileEncoding) { - $decoded = @iconv($fileEncoding, self::FILES_OUT_CHARSET . '//IGNORE', $encoded); - file_put_contents($localCsv, $decoded); - $csvFormat = 'old'; - } - - // Set last modified date, this value will be overwritten during parsing - if (isset($attributes['mtime'])) { - $lastModified = new Zend_Date($attributes['mtime']); - $this->setReportLastModified($lastModified->toString(Varien_Date::DATETIME_INTERNAL_FORMAT)); - } - - $this->setReportDate($this->_fileNameToDate($filename)) - ->setFilename($filename) - ->parseCsv($localCsv, $csvFormat); - - if ($this->getAccountId()) { - $this->save(); - } - - if ($this->_dataSaveAllowed) { - $fetched += count($this->_rows); - } - // clean object and remove parsed file - $this->unsetData(); - unlink($localCsv); - } - } - return $fetched; - } - - /** - * Parse CSV file and collect report rows - * - * @param string $localCsv Path to CSV file - * @param string $format CSV format(column names) - * @return $this - */ - public function parseCsv($localCsv, $format = 'new') - { - $this->_rows = []; - - $sectionColumns = $this->_csvColumns[$format]['section_columns']; - $rowMap = $this->_csvColumns[$format]['rowmap']; - - $flippedSectionColumns = array_flip($sectionColumns); - $fp = fopen($localCsv, 'r'); - while ($line = fgetcsv($fp)) { - if (empty($line)) { // The line was empty, so skip it. - continue; - } - $lineType = $line[0]; - switch ($lineType) { - case 'RH': // Report header. - $lastModified = new Zend_Date($line[1]); - $this->setReportLastModified($lastModified->toString(Varien_Date::DATETIME_INTERNAL_FORMAT)); - //$this->setAccountId($columns[2]); -- probably we'll just take that from the section header... - break; - case 'FH': // File header. - // Nothing interesting here, move along - break; - case 'SH': // Section header. - $this->setAccountId($line[3]); - $this->loadByAccountAndDate(); - break; - case 'CH': // Section columns. - // In case ever the column order is changed, we will have the items recorded properly - // anyway. We have named, not numbered columns. - $counter = count($line); - // Section columns. - // In case ever the column order is changed, we will have the items recorded properly - // anyway. We have named, not numbered columns. - for ($i = 1; $i < $counter; $i++) { - $sectionColumns[$line[$i]] = $i; - } - $flippedSectionColumns = array_flip($sectionColumns); - break; - case 'SB': // Section body. - $bodyItem = []; - $counter = count($line); - for ($i = 1; $i < $counter; $i++) { - $bodyItem[$rowMap[$flippedSectionColumns[$i]]] = $line[$i]; - } - $this->_rows[] = $bodyItem; - break; - case 'SC': // Section records count. - case 'RC': // Report records count. - case 'SF': // Section footer. - case 'FF': // File footer. - case 'RF': // Report footer. - // Nothing to see here, move along - break; - } - } - return $this; - } - - /** - * Load report by unique key (account + report date) - * - * @return $this - */ - public function loadByAccountAndDate() - { - $this->getResource()->loadByAccountAndDate($this, $this->getAccountId(), $this->getReportDate()); - return $this; - } - - /** - * Return collected rows for further processing. - * - * @return array - */ - public function getRows() - { - return $this->_rows; - } - - /** - * Return name for row column - * - * @param string $field Field name in row model - * @return string - */ - public function getFieldLabel($field) - { - return match ($field) { - 'report_date' => Mage::helper('paypal')->__('Report Date'), - 'account_id' => Mage::helper('paypal')->__('Merchant Account'), - 'transaction_id' => Mage::helper('paypal')->__('Transaction ID'), - 'invoice_id' => Mage::helper('paypal')->__('Invoice ID'), - 'paypal_reference_id' => Mage::helper('paypal')->__('PayPal Reference ID'), - 'paypal_reference_id_type' => Mage::helper('paypal')->__('PayPal Reference ID Type'), - 'transaction_event_code' => Mage::helper('paypal')->__('Event Code'), - 'transaction_event' => Mage::helper('paypal')->__('Event'), - 'transaction_initiation_date' => Mage::helper('paypal')->__('Initiation Date'), - 'transaction_completion_date' => Mage::helper('paypal')->__('Completion Date'), - 'transaction_debit_or_credit' => Mage::helper('paypal')->__('Debit or Credit'), - 'gross_transaction_amount' => Mage::helper('paypal')->__('Gross Amount'), - 'fee_debit_or_credit' => Mage::helper('paypal')->__('Fee Debit or Credit'), - 'fee_amount' => Mage::helper('paypal')->__('Fee Amount'), - 'custom_field' => Mage::helper('paypal')->__('Custom'), - default => $field, - }; - } - - /** - * Iterate through website configurations and collect all SFTP configurations - * Filter config values if necessary - * - * @param bool $automaticMode Whether to skip settings with disabled Automatic Fetching or not - * @return array - */ - public function getSftpCredentials($automaticMode = false) - { - $configs = []; - $uniques = []; - foreach (Mage::app()->getStores() as $store) { - /*@var $store Mage_Core_Model_Store */ - $active = (bool) $store->getConfig('paypal/fetch_reports/active'); - if (!$active && $automaticMode) { - continue; - } - $cfg = [ - 'hostname' => $store->getConfig('paypal/fetch_reports/ftp_ip'), - 'path' => $store->getConfig('paypal/fetch_reports/ftp_path'), - 'username' => $store->getConfig('paypal/fetch_reports/ftp_login'), - 'password' => $store->getConfig('paypal/fetch_reports/ftp_password'), - 'sandbox' => $store->getConfig('paypal/fetch_reports/ftp_sandbox'), - ]; - if (empty($cfg['username']) || empty($cfg['password'])) { - continue; - } - if (empty($cfg['hostname']) || $cfg['sandbox']) { - $cfg['hostname'] = $cfg['sandbox'] ? self::SANDBOX_REPORTS_HOSTNAME : self::REPORTS_HOSTNAME; - } - if (empty($cfg['path']) || $cfg['sandbox']) { - $cfg['path'] = self::REPORTS_PATH; - } - // avoid duplicates - if (in_array(serialize($cfg), $uniques)) { - continue; - } - $uniques[] = serialize($cfg); - $configs[] = $cfg; - } - return $configs; - } - - /** - * Converts a filename to date of report. - * - * @param string $filename - * @return string - */ - protected function _fileNameToDate($filename) - { - // Currently filenames look like STL-YYYYMMDD, so that is what we care about. - $dateSnippet = substr(basename($filename), 4, 8); - return substr($dateSnippet, 0, 4) . '-' . substr($dateSnippet, 4, 2) . '-' . substr($dateSnippet, 6, 2); - } - - /** - * Filter SFTP file list by filename format - * - * @param array $list List of files as per $connection->rawls() - * @return array Trimmed down list of files - */ - protected function _filterReportsList($list) - { - $result = []; - $pattern = '/^STL-(\d{8,8})\.(\d{2,2})\.(.{3,3})\.CSV$/'; - foreach ($list as $filename => $data) { - if (preg_match($pattern, $filename)) { - $result[$filename] = $data; - } - } - return $result; - } -} diff --git a/app/code/core/Mage/Paypal/Model/Report/Settlement/Row.php b/app/code/core/Mage/Paypal/Model/Report/Settlement/Row.php deleted file mode 100644 index c6d26712932..00000000000 --- a/app/code/core/Mage/Paypal/Model/Report/Settlement/Row.php +++ /dev/null @@ -1,266 +0,0 @@ - label - * - * @var array - */ - protected static $_eventList = []; - - /** - * Casted amount keys registry - * - * @var array - */ - protected $_castedAmounts = []; - - protected function _construct() - { - $this->_init('paypal/report_settlement_row'); - } - - /** - * Return description of Reference ID Type - * If no code specified, return full list of codes with their description - * - * @param string|null $code - * @return string|array - */ - public function getReferenceType($code = null) - { - $types = [ - 'TXN' => Mage::helper('paypal')->__('Transaction ID'), - 'ODR' => Mage::helper('paypal')->__('Order ID'), - 'SUB' => Mage::helper('paypal')->__('Subscription ID'), - 'PAP' => Mage::helper('paypal')->__('Preapproved Payment ID'), - ]; - if ($code === null) { - asort($types); - return $types; - } - return $types[$code] ?? $code; - } - - /** - * Get native description for transaction code - * - * @param string $code - * @return string - */ - public function getTransactionEvent($code) - { - $this->_generateEventLabels(); - return self::$_eventList[$code] ?? $code; - } - - /** - * Get full list of codes with their description - * - * @return array - */ - public function &getTransactionEvents() - { - $this->_generateEventLabels(); - return self::$_eventList; - } - - /** - * Return description of "Debit or Credit" value - * If no code specified, return full list of codes with their description - * - * @param string|null $code - * @return string|array - */ - public function getDebitCreditText($code = null) - { - $options = [ - 'CR' => Mage::helper('paypal')->__('Credit'), - 'DR' => Mage::helper('paypal')->__('Debit'), - ]; - if ($code === null) { - return $options; - } - return $options[$code] ?? $code; - } - - /** - * Invoke casting some amounts - * - * @param mixed $key - * @param mixed $index - * @return mixed - */ - public function getData($key = '', $index = null) - { - $this->_castAmount('fee_amount', 'fee_debit_or_credit'); - $this->_castAmount('gross_transaction_amount', 'transaction_debit_or_credit'); - return parent::getData($key, $index); - } - - /** - * Cast amounts of the specified keys - * - * PayPal settlement reports contain amounts in cents, hence the values need to be divided by 100 - * Also if the "credit" value is detected, it will be casted to negative amount - * - * @param string $key - * @param string $creditKey - */ - public function _castAmount($key, $creditKey) - { - if (isset($this->_castedAmounts[$key]) || !isset($this->_data[$key]) || !isset($this->_data[$creditKey])) { - return; - } - if (empty($this->_data[$key])) { - return; - } - $amount = $this->_data[$key] / 100; - if ($this->_data[$creditKey] === 'CR') { - $amount = -1 * $amount; - } - $this->_data[$key] = $amount; - $this->_castedAmounts[$key] = true; - } - - /** - * Fill/translate and sort all event codes/labels - */ - protected function _generateEventLabels() - { - if (!self::$_eventList) { - self::$_eventList = [ - 'T0000' => Mage::helper('paypal')->__('General: received payment of a type not belonging to the other T00xx categories'), - 'T0001' => Mage::helper('paypal')->__('Mass Pay Payment'), - 'T0002' => Mage::helper('paypal')->__('Subscription Payment, either payment sent or payment received'), - 'T0003' => Mage::helper('paypal')->__('Preapproved Payment (BillUser API), either sent or received'), - 'T0004' => Mage::helper('paypal')->__('eBay Auction Payment'), - 'T0005' => Mage::helper('paypal')->__('Direct Payment API'), - 'T0006' => Mage::helper('paypal')->__('Express Checkout APIs'), - 'T0007' => Mage::helper('paypal')->__('Website Payments Standard Payment'), - 'T0008' => Mage::helper('paypal')->__('Postage Payment to either USPS or UPS'), - 'T0009' => Mage::helper('paypal')->__('Gift Certificate Payment: purchase of Gift Certificate'), - 'T0010' => Mage::helper('paypal')->__('Auction Payment other than through eBay'), - 'T0011' => Mage::helper('paypal')->__('Mobile Payment (made via a mobile phone)'), - 'T0012' => Mage::helper('paypal')->__('Virtual Terminal Payment'), - 'T0100' => Mage::helper('paypal')->__('General: non-payment fee of a type not belonging to the other T01xx categories'), - 'T0101' => Mage::helper('paypal')->__('Fee: Web Site Payments Pro Account Monthly'), - 'T0102' => Mage::helper('paypal')->__('Fee: Foreign ACH Withdrawal'), - 'T0103' => Mage::helper('paypal')->__('Fee: WorldLink Check Withdrawal'), - 'T0104' => Mage::helper('paypal')->__('Fee: Mass Pay Request'), - 'T0200' => Mage::helper('paypal')->__('General Currency Conversion'), - 'T0201' => Mage::helper('paypal')->__('User-initiated Currency Conversion'), - 'T0202' => Mage::helper('paypal')->__('Currency Conversion required to cover negative balance'), - 'T0300' => Mage::helper('paypal')->__('General Funding of PayPal Account '), - 'T0301' => Mage::helper('paypal')->__('PayPal Balance Manager function of PayPal account'), - 'T0302' => Mage::helper('paypal')->__('ACH Funding for Funds Recovery from Account Balance'), - 'T0303' => Mage::helper('paypal')->__('EFT Funding (German banking)'), - 'T0400' => Mage::helper('paypal')->__('General Withdrawal from PayPal Account'), - 'T0401' => Mage::helper('paypal')->__('AutoSweep'), - 'T0500' => Mage::helper('paypal')->__('General: Use of PayPal account for purchasing as well as receiving payments'), - 'T0501' => Mage::helper('paypal')->__('Virtual PayPal Debit Card Transaction'), - 'T0502' => Mage::helper('paypal')->__('PayPal Debit Card Withdrawal from ATM'), - 'T0503' => Mage::helper('paypal')->__('Hidden Virtual PayPal Debit Card Transaction'), - 'T0504' => Mage::helper('paypal')->__('PayPal Debit Card Cash Advance'), - 'T0600' => Mage::helper('paypal')->__('General: Withdrawal from PayPal Account'), - 'T0700' => Mage::helper('paypal')->__('General (Purchase with a credit card)'), - 'T0701' => Mage::helper('paypal')->__('Negative Balance'), - 'T0800' => Mage::helper('paypal')->__('General: bonus of a type not belonging to the other T08xx categories'), - 'T0801' => Mage::helper('paypal')->__('Debit Card Cash Back'), - 'T0802' => Mage::helper('paypal')->__('Merchant Referral Bonus'), - 'T0803' => Mage::helper('paypal')->__('Balance Manager Account Bonus'), - 'T0804' => Mage::helper('paypal')->__('PayPal Buyer Warranty Bonus'), - 'T0805' => Mage::helper('paypal')->__('PayPal Protection Bonus'), - 'T0806' => Mage::helper('paypal')->__('Bonus for first ACH Use'), - 'T0900' => Mage::helper('paypal')->__('General Redemption'), - 'T0901' => Mage::helper('paypal')->__('Gift Certificate Redemption'), - 'T0902' => Mage::helper('paypal')->__('Points Incentive Redemption'), - 'T0903' => Mage::helper('paypal')->__('Coupon Redemption'), - 'T0904' => Mage::helper('paypal')->__('Reward Voucher Redemption'), - 'T1000' => Mage::helper('paypal')->__('General. Product no longer supported'), - 'T1100' => Mage::helper('paypal')->__('General: reversal of a type not belonging to the other T11xx categories'), - 'T1101' => Mage::helper('paypal')->__('ACH Withdrawal'), - 'T1102' => Mage::helper('paypal')->__('Debit Card Transaction'), - 'T1103' => Mage::helper('paypal')->__('Reversal of Points Usage'), - 'T1104' => Mage::helper('paypal')->__('ACH Deposit (Reversal)'), - 'T1105' => Mage::helper('paypal')->__('Reversal of General Account Hold'), - 'T1106' => Mage::helper('paypal')->__('Account-to-Account Payment, initiated by PayPal'), - 'T1107' => Mage::helper('paypal')->__('Payment Refund initiated by merchant'), - 'T1108' => Mage::helper('paypal')->__('Fee Reversal'), - 'T1110' => Mage::helper('paypal')->__('Hold for Dispute Investigation'), - 'T1111' => Mage::helper('paypal')->__('Reversal of hold for Dispute Investigation'), - 'T1200' => Mage::helper('paypal')->__('General: adjustment of a type not belonging to the other T12xx categories'), - 'T1201' => Mage::helper('paypal')->__('Chargeback'), - 'T1202' => Mage::helper('paypal')->__('Reversal'), - 'T1203' => Mage::helper('paypal')->__('Charge-off'), - 'T1204' => Mage::helper('paypal')->__('Incentive'), - 'T1205' => Mage::helper('paypal')->__('Reimbursement of Chargeback'), - 'T1300' => Mage::helper('paypal')->__('General (Authorization)'), - 'T1301' => Mage::helper('paypal')->__('Reauthorization'), - 'T1302' => Mage::helper('paypal')->__('Void'), - 'T1400' => Mage::helper('paypal')->__('General (Dividend)'), - 'T1500' => Mage::helper('paypal')->__('General: temporary hold of a type not belonging to the other T15xx categories'), - 'T1501' => Mage::helper('paypal')->__('Open Authorization'), - 'T1502' => Mage::helper('paypal')->__('ACH Deposit (Hold for Dispute or Other Investigation)'), - 'T1503' => Mage::helper('paypal')->__('Available Balance'), - 'T1600' => Mage::helper('paypal')->__('Funding'), - 'T1700' => Mage::helper('paypal')->__('General: Withdrawal to Non-Bank Entity'), - 'T1701' => Mage::helper('paypal')->__('WorldLink Withdrawal'), - 'T1800' => Mage::helper('paypal')->__('Buyer Credit Payment'), - 'T1900' => Mage::helper('paypal')->__('General Adjustment without businessrelated event'), - 'T2000' => Mage::helper('paypal')->__('General (Funds Transfer from PayPal Account to Another)'), - 'T2001' => Mage::helper('paypal')->__('Settlement Consolidation'), - 'T9900' => Mage::helper('paypal')->__('General: event not yet categorized'), - ]; - asort(self::$_eventList); - } - } -} diff --git a/app/code/core/Mage/Paypal/Model/Resource/Cert.php b/app/code/core/Mage/Paypal/Model/Resource/Cert.php deleted file mode 100644 index 83683eb6816..00000000000 --- a/app/code/core/Mage/Paypal/Model/Resource/Cert.php +++ /dev/null @@ -1,59 +0,0 @@ -_init('paypal/cert', 'cert_id'); - } - - /** - * Set date of last update - * - * @return Mage_Core_Model_Resource_Db_Abstract - */ - protected function _beforeSave(Mage_Core_Model_Abstract $object) - { - $object->setUpdatedAt($this->formatDate(Mage::getSingleton('core/date')->gmtDate())); - return parent::_beforeSave($object); - } - - /** - * Load model by website id - * - * @param Mage_Paypal_Model_Cert $object - * @param bool $strictLoad - * @return Mage_Paypal_Model_Cert - */ - public function loadByWebsite($object, $strictLoad = true) - { - $adapter = $this->_getReadAdapter(); - $select = $adapter->select()->from(['main_table' => $this->getMainTable()]); - - if ($strictLoad) { - $select->where('main_table.website_id =?', $object->getWebsiteId()); - } else { - $select->where('main_table.website_id IN(0, ?)', $object->getWebsiteId()) - ->order('main_table.website_id DESC') - ->limit(1); - } - - $data = $adapter->fetchRow($select); - if ($data) { - $object->setData($data); - } - return $object; - } -} diff --git a/app/code/core/Mage/Paypal/Model/Resource/Debug.php b/app/code/core/Mage/Paypal/Model/Resource/Debug.php new file mode 100644 index 00000000000..98465ec252b --- /dev/null +++ b/app/code/core/Mage/Paypal/Model/Resource/Debug.php @@ -0,0 +1,19 @@ +_init('paypal/debug', 'entity_id'); + } +} diff --git a/app/code/core/Mage/Paypal/Model/Resource/Debug/Collection.php b/app/code/core/Mage/Paypal/Model/Resource/Debug/Collection.php new file mode 100644 index 00000000000..360cc736dca --- /dev/null +++ b/app/code/core/Mage/Paypal/Model/Resource/Debug/Collection.php @@ -0,0 +1,87 @@ +_init('paypal/debug'); + } + + /** + * Adds a filter to the collection for a specific quote ID. + * + * @param int $quoteId The quote ID to filter by. + * @return $this + */ + public function addQuoteIdFilter(int $quoteId): self + { + $this->addFieldToFilter('quote_id', $quoteId); + return $this; + } + + /** + * Adds a filter to the collection for a specific transaction ID. + * + * @param string $transactionId The transaction ID to filter by. + * @return $this + */ + public function addTransactionIdFilter(string $transactionId): self + { + $this->addFieldToFilter('transaction_id', $transactionId); + return $this; + } + + /** + * Adds a filter to the collection for a specific action. + * + * @param string $action The action string to filter by. + * @return $this + */ + public function addActionFilter(string $action): self + { + $this->addFieldToFilter('action', $action); + return $this; + } + + /** + * Adds a date range filter to the collection based on the 'created_at' field. + * + * @param string|null $from The start date of the range. + * @param string|null $to The end date of the range. + * @return $this + */ + public function addDateRangeFilter(?string $from, ?string $to): self + { + if ($from) { + $this->addFieldToFilter('created_at', ['gteq' => $from]); + } + if ($to) { + $this->addFieldToFilter('created_at', ['lteq' => $to]); + } + return $this; + } + + /** + * Initializes the select object for the collection, setting the default order. + * + * @return $this + */ + protected function _initSelect(): self + { + parent::_initSelect(); + $this->getSelect()->order('created_at DESC'); + return $this; + } +} diff --git a/app/code/core/Mage/Paypal/Model/Resource/Payment/Transaction.php b/app/code/core/Mage/Paypal/Model/Resource/Payment/Transaction.php deleted file mode 100644 index 86cee095adc..00000000000 --- a/app/code/core/Mage/Paypal/Model/Resource/Payment/Transaction.php +++ /dev/null @@ -1,122 +0,0 @@ - [null, []], - ]; - - /** - * Initialize main table and the primary key field name - * - */ - protected function _construct() - { - $this->_init('paypal/payment_transaction', 'transaction_id'); - } - - /** - * @see Mage_Core_Model_Resource_Abstract::_unserializeField() - */ - protected function _unserializeField(Varien_Object $object, $field, $defaultValue = null) - { - $value = $object->getData($field); - if (empty($value)) { - $object->setData($field, $defaultValue); - } elseif (!is_array($value) && !is_object($value)) { - $unserializedValue = false; - try { - $unserializedValue = Mage::helper('core/unserializeArray') - ->unserialize($value); - } catch (Exception $e) { - Mage::logException($e); - } - $object->setData($field, $unserializedValue); - } - } - - /** - * Load the transaction object by specified txn_id - * - * @param string $txnId - */ - public function loadObjectByTxnId(Mage_Paypal_Model_Payment_Transaction $transaction, $txnId) - { - $select = $this->_getLoadByUniqueKeySelect($txnId); - $data = $this->_getWriteAdapter()->fetchRow($select); - $transaction->setData($data); - $this->unserializeFields($transaction); - $this->_afterLoad($transaction); - } - - /** - * Serialize additional information, if any - * - * @param Mage_Paypal_Model_Payment_Transaction $transaction - * @return $this - */ - protected function _beforeSave(Mage_Core_Model_Abstract $transaction) - { - $txnId = $transaction->getData('txn_id'); - $idFieldName = $this->getIdFieldName(); - - // make sure unique key won't cause trouble - if ($transaction->isFailsafe()) { - $autoincrementId = (int) $this->_lookupByTxnId($txnId, $idFieldName); - if ($autoincrementId) { - $transaction->setData($idFieldName, $autoincrementId)->isObjectNew(false); - } - } - - return parent::_beforeSave($transaction); - } - - /** - * Load cell/row by specified unique key parts - * - * @param string $txnId - * @param array|string|object $columns - * @param bool $isRow - * @return array|string - */ - private function _lookupByTxnId($txnId, $columns, $isRow = false) - { - $select = $this->_getLoadByUniqueKeySelect($txnId, $columns); - if ($isRow) { - return $this->_getWriteAdapter()->fetchRow($select); - } - return $this->_getWriteAdapter()->fetchOne($select); - } - - /** - * Get select object for loading transaction by the unique key of order_id, payment_id, txn_id - * - * @param string $txnId - * @param string|array|Zend_Db_Expr $columns - * @return Varien_Db_Select - */ - private function _getLoadByUniqueKeySelect($txnId, $columns = '*') - { - return $this->_getWriteAdapter()->select() - ->from($this->getMainTable(), $columns) - ->where('txn_id = ?', $txnId); - } -} diff --git a/app/code/core/Mage/Paypal/Model/Resource/Payment/Transaction/Collection.php b/app/code/core/Mage/Paypal/Model/Resource/Payment/Transaction/Collection.php deleted file mode 100644 index 8c8cfb623e7..00000000000 --- a/app/code/core/Mage/Paypal/Model/Resource/Payment/Transaction/Collection.php +++ /dev/null @@ -1,77 +0,0 @@ -_init('paypal/payment_transaction'); - parent::_construct(); - } - - /** - * CreatedAt filter setter - * - * @param string $date - * @return $this - */ - public function addCreatedBeforeFilter($date) - { - $this->_createdBefore = $date; - return $this; - } - - /** - * Prepare filters - * - * @return $this - */ - protected function _beforeLoad() - { - parent::_beforeLoad(); - - if ($this->isLoaded()) { - return $this; - } - - // filters - if ($this->_createdBefore) { - $this->getSelect()->where('main_table.created_at < ?', $this->_createdBefore); - } - return $this; - } - - /** - * Unserialize additional_information in each item - * - * @return $this - */ - protected function _afterLoad() - { - foreach ($this->_items as $item) { - $this->getResource()->unserializeFields($item); - } - return parent::_afterLoad(); - } -} diff --git a/app/code/core/Mage/Paypal/Model/Resource/Report/Settlement.php b/app/code/core/Mage/Paypal/Model/Resource/Report/Settlement.php deleted file mode 100644 index ccdbfde4ab1..00000000000 --- a/app/code/core/Mage/Paypal/Model/Resource/Report/Settlement.php +++ /dev/null @@ -1,105 +0,0 @@ -_init('paypal/settlement_report', 'report_id'); - $this->_rowsTable = $this->getTable('paypal/settlement_report_row'); - } - - /** - * Save report rows collected in settlement model - * - * @param Mage_Paypal_Model_Report_Settlement $object - * @return $this - */ - protected function _afterSave(Mage_Core_Model_Abstract $object) - { - $rows = $object->getRows(); - if (is_array($rows)) { - $adapter = $this->_getWriteAdapter(); - $reportId = (int) $object->getId(); - $adapter->beginTransaction(); - try { - if ($reportId) { - $adapter->delete($this->_rowsTable, ['report_id = ?' => $reportId]); - } - /** @var Mage_Core_Model_Date $date */ - $date = Mage::getSingleton('core/date'); - - foreach (array_keys($rows) as $key) { - /* - * Converting dates - */ - $completionDate = new Zend_Date($rows[$key]['transaction_completion_date']); - $rows[$key]['transaction_completion_date'] = $date->date(null, $completionDate->getTimestamp()); - $initiationDate = new Zend_Date($rows[$key]['transaction_initiation_date']); - $rows[$key]['transaction_initiation_date'] = $date->date(null, $initiationDate->getTimestamp()); - /* - * Converting numeric - */ - $rows[$key]['fee_amount'] = (float) $rows[$key]['fee_amount']; - /* - * Setting reportId - */ - $rows[$key]['report_id'] = $reportId; - } - if (!empty($rows)) { - $adapter->insertMultiple($this->_rowsTable, $rows); - } - $adapter->commit(); - } catch (Exception $e) { - $adapter->rollBack(); - } - } - - return $this; - } - - /** - * Check if report with same account and report date already fetched - * - * @param string $accountId - * @param string $reportDate - * @return $this - */ - public function loadByAccountAndDate(Mage_Paypal_Model_Report_Settlement $report, $accountId, $reportDate) - { - $adapter = $this->_getReadAdapter(); - $select = $adapter->select() - ->from($this->getMainTable()) - ->where('account_id = :account_id') - ->where('report_date = :report_date'); - - $data = $adapter->fetchRow($select, [':account_id' => $accountId, ':report_date' => $reportDate]); - if ($data) { - $report->addData($data); - } - - return $this; - } -} diff --git a/app/code/core/Mage/Paypal/Model/Resource/Report/Settlement/Row/Collection.php b/app/code/core/Mage/Paypal/Model/Resource/Report/Settlement/Row/Collection.php deleted file mode 100644 index 319884af038..00000000000 --- a/app/code/core/Mage/Paypal/Model/Resource/Report/Settlement/Row/Collection.php +++ /dev/null @@ -1,54 +0,0 @@ -_init('paypal/report_settlement_row'); - } - - /** - * Join reports info table - * - * @return $this - */ - protected function _initSelect() - { - parent::_initSelect(); - $this->getSelect() - ->join( - ['report' => $this->getTable('paypal/settlement_report')], - 'report.report_id = main_table.report_id', - ['report.account_id', 'report.report_date'], - ); - return $this; - } - - /** - * Filter items collection by account ID - * - * @param string $accountId - * @return $this - */ - public function addAccountFilter($accountId) - { - $this->getSelect()->where('report.account_id = ?', $accountId); - return $this; - } -} diff --git a/app/code/core/Mage/Paypal/Model/Resource/Setup.php b/app/code/core/Mage/Paypal/Model/Resource/Setup.php index b880552d0c9..afbdddd6138 100644 --- a/app/code/core/Mage/Paypal/Model/Resource/Setup.php +++ b/app/code/core/Mage/Paypal/Model/Resource/Setup.php @@ -1,5 +1,6 @@ init('paypal'); - } -} diff --git a/app/code/core/Mage/Paypal/Model/Standard.php b/app/code/core/Mage/Paypal/Model/Standard.php deleted file mode 100644 index b19f21c9bd5..00000000000 --- a/app/code/core/Mage/Paypal/Model/Standard.php +++ /dev/null @@ -1,199 +0,0 @@ -getConfig()->isCurrencyCodeSupported($currencyCode); - } - - /** - * Get paypal session namespace - * - * @return Mage_Paypal_Model_Session - */ - public function getSession() - { - return Mage::getSingleton('paypal/session'); - } - - /** - * Get checkout session namespace - * - * @return Mage_Checkout_Model_Session - */ - public function getCheckout() - { - return Mage::getSingleton('checkout/session'); - } - - /** - * Get current quote - * - * @return Mage_Sales_Model_Quote - */ - public function getQuote() - { - return $this->getCheckout()->getQuote(); - } - - /** - * Create main block for standard form - * - */ - public function createFormBlock($name) - { - return $this->getLayout()->createBlock('paypal/standard_form', $name) - ->setMethod('paypal_standard') - ->setPayment($this->getPayment()) - ->setTemplate('paypal/standard/form.phtml'); - } - - /** - * Return Order place redirect url - * - * @return string - */ - public function getOrderPlaceRedirectUrl() - { - return Mage::getUrl('paypal/standard/redirect', ['_secure' => true]); - } - - /** - * Return form field array - * - * @return array - */ - public function getStandardCheckoutFormFields() - { - $orderIncrementId = $this->getCheckout()->getLastRealOrderId(); - $order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId); - /** @var Mage_Paypal_Model_Api_Standard $api */ - $api = Mage::getModel('paypal/api_standard')->setConfigObject($this->getConfig()); - $api->setOrderId($orderIncrementId) - ->setCurrencyCode($order->getBaseCurrencyCode()) - //->setPaymentAction() - ->setOrder($order) - ->setNotifyUrl(Mage::getUrl('paypal/ipn/')) - ->setReturnUrl(Mage::getUrl('paypal/standard/success')) - ->setCancelUrl(Mage::getUrl('paypal/standard/cancel')); - - // export address - $isOrderVirtual = $order->getIsVirtual(); - $address = $isOrderVirtual ? $order->getBillingAddress() : $order->getShippingAddress(); - if ($isOrderVirtual) { - $api->setNoShipping(true); - } elseif ($address->validate()) { - $api->setAddress($address); - } - - // add cart totals and line items - $api->setPaypalCart(Mage::getModel('paypal/cart', [$order])) - ->setIsLineItemsEnabled($this->_config->lineItemsEnabled) - ; - $api->setCartSummary($this->_getAggregatedCartSummary()); - $api->setLocale($api->getLocaleCode()); - return $api->getStandardCheckoutRequest(); - } - - /** - * Instantiate state and set it to state object - * @param string $paymentAction - * @param Varien_Object $stateObject - */ - public function initialize($paymentAction, $stateObject) - { - $state = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT; - $stateObject->setState($state); - $stateObject->setStatus('pending_payment'); - $stateObject->setIsNotified(false); - - return $this; - } - - /** - * Config instance getter - * @return Mage_Paypal_Model_Config - */ - public function getConfig() - { - if ($this->_config === null) { - $params = [$this->_code]; - if ($store = $this->getStore()) { - $params[] = is_object($store) ? $store->getId() : $store; - } - $this->_config = Mage::getModel('paypal/config', $params); - } - return $this->_config; - } - - /** - * Check whether payment method can be used - * @param Mage_Sales_Model_Quote|null $quote - * @return bool - */ - public function isAvailable($quote = null) - { - if (parent::isAvailable($quote) && $this->getConfig()->isMethodAvailable()) { - return true; - } - return false; - } - - /** - * Custom getter for payment configuration - * - * @param string $field - * @param int $storeId - * @return mixed - */ - public function getConfigData($field, $storeId = null) - { - return $this->getConfig()->$field; - } - - /** - * Aggregated cart summary label getter - * - * @return string - */ - private function _getAggregatedCartSummary() - { - if ($this->_config->lineItemsSummary) { - return $this->_config->lineItemsSummary; - } - return Mage::app()->getStore($this->getStore())->getFrontendName(); - } -} diff --git a/app/code/core/Mage/Paypal/Model/System/Config/Backend/Cert.php b/app/code/core/Mage/Paypal/Model/System/Config/Backend/Cert.php deleted file mode 100644 index 77f41272544..00000000000 --- a/app/code/core/Mage/Paypal/Model/System/Config/Backend/Cert.php +++ /dev/null @@ -1,58 +0,0 @@ -getValue(); - if (is_array($value) && !empty($value['delete'])) { - $this->setValue(''); - Mage::getModel('paypal/cert')->loadByWebsite($this->getScopeId())->delete(); - } - - if (!isset($_FILES['groups']['tmp_name'][$this->getGroupId()]['fields'][$this->getField()]['value'])) { - return $this; - } - $tmpPath = $_FILES['groups']['tmp_name'][$this->getGroupId()]['fields'][$this->getField()]['value']; - if ($tmpPath && file_exists($tmpPath)) { - if (!filesize($tmpPath)) { - Mage::throwException(Mage::helper('paypal')->__('PayPal certificate file is empty.')); - } - $this->setValue($_FILES['groups']['name'][$this->getGroupId()]['fields'][$this->getField()]['value']); - $content = Mage::helper('core')->encrypt(file_get_contents($tmpPath)); - Mage::getModel('paypal/cert')->loadByWebsite($this->getScopeId()) - ->setContent($content) - ->save(); - } - return $this; - } - - /** - * Process object after delete data - * - * @return $this - */ - protected function _afterDelete() - { - Mage::getModel('paypal/cert')->loadByWebsite($this->getScopeId())->delete(); - return $this; - } -} diff --git a/app/code/core/Mage/Paypal/Model/System/Config/Backend/Cron.php b/app/code/core/Mage/Paypal/Model/System/Config/Backend/Cron.php deleted file mode 100644 index 685bf8b4daf..00000000000 --- a/app/code/core/Mage/Paypal/Model/System/Config/Backend/Cron.php +++ /dev/null @@ -1,40 +0,0 @@ -load('paypal/fetch_reports/time', 'path')->getValue()); - if (Mage::getModel('core/config_data')->load('paypal/fetch_reports/active', 'path')->getValue()) { - $interval = Mage::getModel('core/config_data')->load(self::CRON_MODEL_PATH_INTERVAL, 'path')->getValue(); - $cronExprString = "{$time[1]} {$time[0]} */{$interval} * *"; - } - - Mage::getModel('core/config_data') - ->load(self::CRON_STRING_PATH, 'path') - ->setValue($cronExprString) - ->setPath(self::CRON_STRING_PATH) - ->save(); - - return parent::_afterSave(); - } -} diff --git a/app/code/core/Mage/Paypal/Model/System/Config/Backend/MerchantCountry.php b/app/code/core/Mage/Paypal/Model/System/Config/Backend/MerchantCountry.php index 08ee4a80092..3edf491720d 100644 --- a/app/code/core/Mage/Paypal/Model/System/Config/Backend/MerchantCountry.php +++ b/app/code/core/Mage/Paypal/Model/System/Config/Backend/MerchantCountry.php @@ -1,5 +1,6 @@ getValue(); - if (empty($value)) { - if ($this->getWebsite()) { - $defaultCountry = Mage::app()->getWebsite($this->getWebsite()) - ->getConfig(Mage_Core_Helper_Data::XML_PATH_DEFAULT_COUNTRY); - } else { - $defaultCountry = Mage::helper('core')->getDefaultCountry($this->getStore()); - } - $this->setValue($defaultCountry); + $value = $this->getValue(); + if (!$value) { + $this->setValue(Mage::getStoreConfig('general/country/default')); } - return $this; + return parent::_beforeSave(); } } diff --git a/app/code/core/Mage/Paypal/Model/System/Config/Source/AuthorizationAmounts.php b/app/code/core/Mage/Paypal/Model/System/Config/Source/AuthorizationAmounts.php deleted file mode 100644 index 8140ca5d62f..00000000000 --- a/app/code/core/Mage/Paypal/Model/System/Config/Source/AuthorizationAmounts.php +++ /dev/null @@ -1,27 +0,0 @@ - Mage::helper('paypal')->__('Header (center)'), - '1' => Mage::helper('paypal')->__('Sidebar (right)'), - ]; - } - - /** - * Bml positions source getter for Catalog Category Page - * - * @return array - */ - public function getBmlPositionsCCP() - { - return [ - '0' => Mage::helper('paypal')->__('Header (center)'), - '1' => Mage::helper('paypal')->__('Sidebar (right)'), - ]; - } - - /** - * Bml positions source getter for Catalog Product Page - * - * @return array - */ - public function getBmlPositionsCPP() - { - return [ - '0' => Mage::helper('paypal')->__('Header (center)'), - '1' => Mage::helper('paypal')->__('Near Paypal Credit checkout button'), - ]; - } - - /** - * Bml positions source getter for Checkout Cart Page - * - * @return array - */ - public function getBmlPositionsCheckout() - { - return [ - '0' => Mage::helper('paypal')->__('Header (center)'), - '1' => Mage::helper('paypal')->__('Near Paypal Credit checkout button'), - ]; - } -} diff --git a/app/code/core/Mage/Paypal/Model/System/Config/Source/BmlSize.php b/app/code/core/Mage/Paypal/Model/System/Config/Source/BmlSize.php deleted file mode 100644 index 4fca9430925..00000000000 --- a/app/code/core/Mage/Paypal/Model/System/Config/Source/BmlSize.php +++ /dev/null @@ -1,151 +0,0 @@ - Mage::helper('paypal')->__('190 x 100'), - '234x60' => Mage::helper('paypal')->__('234 x 60'), - '300x50' => Mage::helper('paypal')->__('300 x 50'), - '468x60' => Mage::helper('paypal')->__('468 x 60'), - '728x90' => Mage::helper('paypal')->__('728 x 90'), - '800x66' => Mage::helper('paypal')->__('800 x 66'), - ]; - } - - /** - * Options getter for Home Page and position Sidebar (right) - * - * @return array - */ - public function getBmlSizeHPS() - { - return [ - '120x90' => Mage::helper('paypal')->__('120 x 90'), - '190x100' => Mage::helper('paypal')->__('190 x 100'), - '234x60' => Mage::helper('paypal')->__('234 x 60'), - '120x240' => Mage::helper('paypal')->__('120 x 240'), - '120x600' => Mage::helper('paypal')->__('120 x 600'), - '234x400' => Mage::helper('paypal')->__('234 x 400'), - '250x250' => Mage::helper('paypal')->__('250 x 250'), - ]; - } - - /** - * Options getter for Catalog Category Page and position Center - * - * @return array - */ - public function getBmlSizeCCPC() - { - return [ - '190x100' => Mage::helper('paypal')->__('190 x 100'), - '234x60' => Mage::helper('paypal')->__('234 x 60'), - '300x50' => Mage::helper('paypal')->__('300 x 50'), - '468x60' => Mage::helper('paypal')->__('468 x 60'), - '728x90' => Mage::helper('paypal')->__('728 x 90'), - '800x66' => Mage::helper('paypal')->__('800 x 66'), - ]; - } - - /** - * Options getter for Catalog Category Page and position Sidebar (right) - * - * @return array - */ - public function getBmlSizeCCPS() - { - return [ - '120x90' => Mage::helper('paypal')->__('120 x 90'), - '190x100' => Mage::helper('paypal')->__('190 x 100'), - '234x60' => Mage::helper('paypal')->__('234 x 60'), - '120x240' => Mage::helper('paypal')->__('120 x 240'), - '120x600' => Mage::helper('paypal')->__('120 x 600'), - '234x400' => Mage::helper('paypal')->__('234 x 400'), - '250x250' => Mage::helper('paypal')->__('250 x 250'), - ]; - } - - /** - * Options getter for Catalog Product Page and position Center - * - * @return array - */ - public function getBmlSizeCPPC() - { - return [ - '190x100' => Mage::helper('paypal')->__('190 x 100'), - '234x60' => Mage::helper('paypal')->__('234 x 60'), - '300x50' => Mage::helper('paypal')->__('300 x 50'), - '468x60' => Mage::helper('paypal')->__('468 x 60'), - '728x90' => Mage::helper('paypal')->__('728 x 90'), - '800x66' => Mage::helper('paypal')->__('800 x 66'), - ]; - } - - /** - * Options getter for Catalog Product Page and position Near Bill Me Later checkout button - * - * @return array - */ - public function getBmlSizeCPPN() - { - return [ - '120x90' => Mage::helper('paypal')->__('120 x 90'), - '190x100' => Mage::helper('paypal')->__('190 x 100'), - '234x60' => Mage::helper('paypal')->__('234 x 60'), - '120x240' => Mage::helper('paypal')->__('120 x 240'), - '120x600' => Mage::helper('paypal')->__('120 x 600'), - '234x400' => Mage::helper('paypal')->__('234 x 400'), - '250x250' => Mage::helper('paypal')->__('250 x 250'), - ]; - } - - /** - * Options getter for Checkout Cart Page and position Center - * - * @return array - */ - public function getBmlSizeCheckoutC() - { - return [ - '234x60' => Mage::helper('paypal')->__('234 x 60'), - '300x50' => Mage::helper('paypal')->__('300 x 50'), - '468x60' => Mage::helper('paypal')->__('468 x 60'), - '728x90' => Mage::helper('paypal')->__('728 x 90'), - '800x66' => Mage::helper('paypal')->__('800 x 66'), - ]; - } - - /** - * Options getter for Checkout Cart Page and position Near Bill Me Later checkout button - * - * @return array - */ - public function getBmlSizeCheckoutN() - { - return [ - '234x60' => Mage::helper('paypal')->__('234 x 60'), - '300x50' => Mage::helper('paypal')->__('300 x 50'), - '468x60' => Mage::helper('paypal')->__('468 x 60'), - ]; - } -} diff --git a/app/code/core/Mage/Paypal/Model/System/Config/Source/ButtonColors.php b/app/code/core/Mage/Paypal/Model/System/Config/Source/ButtonColors.php new file mode 100644 index 00000000000..c455e3cb6f6 --- /dev/null +++ b/app/code/core/Mage/Paypal/Model/System/Config/Source/ButtonColors.php @@ -0,0 +1,39 @@ + Mage_Paypal_Model_Config::BUTTON_COLOR_GOLD, + 'label' => Mage::helper('paypal')->__('Gold'), + ], + [ + 'value' => Mage_Paypal_Model_Config::BUTTON_COLOR_BLUE, + 'label' => Mage::helper('paypal')->__('Blue'), + ], + [ + 'value' => Mage_Paypal_Model_Config::BUTTON_COLOR_SILVER, + 'label' => Mage::helper('paypal')->__('Silver'), + ], + [ + 'value' => Mage_Paypal_Model_Config::BUTTON_COLOR_WHITE, + 'label' => Mage::helper('paypal')->__('White'), + ], + [ + 'value' => Mage_Paypal_Model_Config::BUTTON_COLOR_BLACK, + 'label' => Mage::helper('paypal')->__('Black'), + ], + ]; + } +} diff --git a/app/code/core/Mage/Paypal/Model/System/Config/Source/ButtonLabels.php b/app/code/core/Mage/Paypal/Model/System/Config/Source/ButtonLabels.php new file mode 100644 index 00000000000..f4de53c0582 --- /dev/null +++ b/app/code/core/Mage/Paypal/Model/System/Config/Source/ButtonLabels.php @@ -0,0 +1,39 @@ + Mage_Paypal_Model_Config::BUTTON_LABEL_PAYPAL, + 'label' => Mage::helper('paypal')->__('PayPal (Recommended)'), + ], + [ + 'value' => Mage_Paypal_Model_Config::BUTTON_LABEL_CHECKOUT, + 'label' => Mage::helper('paypal')->__('Checkout'), + ], + [ + 'value' => Mage_Paypal_Model_Config::BUTTON_LABEL_BUYNOW, + 'label' => Mage::helper('paypal')->__('Buy Now'), + ], + [ + 'value' => Mage_Paypal_Model_Config::BUTTON_LABEL_PAY, + 'label' => Mage::helper('paypal')->__('Pay with PayPal'), + ], + [ + 'value' => Mage_Paypal_Model_Config::BUTTON_LABEL_INSTALLMENT, + 'label' => Mage::helper('paypal')->__('PayPal Installment'), + ], + ]; + } +} diff --git a/app/code/core/Mage/Paypal/Model/System/Config/Source/ButtonLayouts.php b/app/code/core/Mage/Paypal/Model/System/Config/Source/ButtonLayouts.php new file mode 100644 index 00000000000..131632e9efd --- /dev/null +++ b/app/code/core/Mage/Paypal/Model/System/Config/Source/ButtonLayouts.php @@ -0,0 +1,26 @@ + Mage_Paypal_Model_Config::BUTTON_LAYOUT_VERTICAL, + 'label' => Mage::helper('paypal')->__('Vertical'), + ], + [ + 'value' => Mage_Paypal_Model_Config::BUTTON_LAYOUT_HORIZONTAL, + 'label' => Mage::helper('paypal')->__('Horizontal'), + ], + ]; + } +} diff --git a/app/code/core/Mage/Paypal/Model/System/Config/Source/ButtonShapes.php b/app/code/core/Mage/Paypal/Model/System/Config/Source/ButtonShapes.php new file mode 100644 index 00000000000..443560fafee --- /dev/null +++ b/app/code/core/Mage/Paypal/Model/System/Config/Source/ButtonShapes.php @@ -0,0 +1,30 @@ + Mage_Paypal_Model_Config::BUTTON_SHAPE_RECT, + 'label' => Mage::helper('paypal')->__('Rectangle'), + ], + [ + 'value' => Mage_Paypal_Model_Config::BUTTON_SHAPE_PILL, + 'label' => Mage::helper('paypal')->__('Pill'), + ], + [ + 'value' => Mage_Paypal_Model_Config::BUTTON_SHAPE_SHARP, + 'label' => Mage::helper('paypal')->__('Sharp'), + ], + ]; + } +} diff --git a/app/code/core/Mage/Paypal/Model/System/Config/Source/BuyerCountry.php b/app/code/core/Mage/Paypal/Model/System/Config/Source/BuyerCountry.php deleted file mode 100644 index 7066b47e52a..00000000000 --- a/app/code/core/Mage/Paypal/Model/System/Config/Source/BuyerCountry.php +++ /dev/null @@ -1,25 +0,0 @@ -getSupportedBuyerCountryCodes(); - return Mage::getResourceModel('directory/country_collection') - ->addCountryCodeFilter($supported, 'iso2') - ->loadData() - ->toOptionArray($isMultiselect ? false : Mage::helper('adminhtml')->__('--Please Select--')); - } -} diff --git a/app/code/core/Mage/Paypal/Model/System/Config/Source/FetchingSchedule.php b/app/code/core/Mage/Paypal/Model/System/Config/Source/FetchingSchedule.php deleted file mode 100644 index 83ddd18c4a0..00000000000 --- a/app/code/core/Mage/Paypal/Model/System/Config/Source/FetchingSchedule.php +++ /dev/null @@ -1,29 +0,0 @@ - Mage::helper('paypal')->__('Daily'), - 3 => Mage::helper('paypal')->__('Every 3 days'), - 7 => Mage::helper('paypal')->__('Every 7 days'), - 10 => Mage::helper('paypal')->__('Every 10 days'), - 14 => Mage::helper('paypal')->__('Every 14 days'), - 30 => Mage::helper('paypal')->__('Every 30 days'), - 40 => Mage::helper('paypal')->__('Every 40 days'), - ]; - } -} diff --git a/app/code/core/Mage/Paypal/Model/System/Config/Source/Logo.php b/app/code/core/Mage/Paypal/Model/System/Config/Source/Logo.php deleted file mode 100644 index 32e94224fd9..00000000000 --- a/app/code/core/Mage/Paypal/Model/System/Config/Source/Logo.php +++ /dev/null @@ -1,22 +0,0 @@ - Mage::helper('paypal')->__('No Logo')]; - return $result + Mage::getModel('paypal/config')->getAdditionalOptionsLogoTypes(); - } -} diff --git a/app/code/core/Mage/Paypal/Model/System/Config/Source/MerchantCountry.php b/app/code/core/Mage/Paypal/Model/System/Config/Source/MerchantCountry.php index 93fea12a7fe..ce4a499e8d3 100644 --- a/app/code/core/Mage/Paypal/Model/System/Config/Source/MerchantCountry.php +++ b/app/code/core/Mage/Paypal/Model/System/Config/Source/MerchantCountry.php @@ -1,5 +1,6 @@ getSupportedMerchantCountryCodes(); - return Mage::getResourceModel('directory/country_collection') - ->addCountryCodeFilter($supported, 'iso2') - ->loadData() - ->toOptionArray($isMultiselect ? false : Mage::helper('adminhtml')->__('--Please Select--')); + $countries = Mage::getSingleton('adminhtml/system_config_source_country') + ->toOptionArray(); + + $supportedCountries = [ + 'AL', + 'DZ', + 'AD', + 'AG', + 'AR', + 'AU', + 'AT', + 'BS', + 'BH', + 'BB', + 'BE', + 'BZ', + 'BA', + 'BW', + 'BR', + 'BG', + 'CA', + 'CL', + 'CN', + 'CR', + 'HR', + 'CY', + 'CZ', + 'DK', + 'DO', + 'EC', + 'EG', + 'SV', + 'EE', + 'FI', + 'FR', + 'DE', + 'GR', + 'GT', + 'HN', + 'HK', + 'HU', + 'IS', + 'IN', + 'ID', + 'IE', + 'IT', + 'JM', + 'JP', + 'JO', + 'KE', + 'KW', + 'LV', + 'LI', + 'LT', + 'LU', + 'MY', + 'MT', + 'MX', + 'MD', + 'MC', + 'NL', + 'NZ', + 'NO', + 'OM', + 'PA', + 'PE', + 'PH', + 'PL', + 'PT', + 'QA', + 'RO', + 'RU', + 'SA', + 'RS', + 'SG', + 'SK', + 'SI', + 'ZA', + 'KR', + 'ES', + 'SE', + 'CH', + 'TW', + 'TH', + 'TT', + 'AE', + 'GB', + 'US', + 'UY', + 'VN', + ]; + + return array_filter($countries, function ($country) use ($supportedCountries) { + return in_array($country['value'], $supportedCountries); + }); } } diff --git a/app/code/core/Mage/Paypal/Model/System/Config/Source/PaymentActions.php b/app/code/core/Mage/Paypal/Model/System/Config/Source/PaymentActions.php index 4c52c4dbd7c..4c4a4544a78 100644 --- a/app/code/core/Mage/Paypal/Model/System/Config/Source/PaymentActions.php +++ b/app/code/core/Mage/Paypal/Model/System/Config/Source/PaymentActions.php @@ -1,5 +1,6 @@ getPaymentActions(); + return [ + [ + 'value' => strtolower(CheckoutPaymentIntent::AUTHORIZE), + 'label' => Mage::helper('paypal')->__('Authorize'), + ], + [ + 'value' => strtolower(CheckoutPaymentIntent::CAPTURE), + 'label' => Mage::helper('paypal')->__('Capture'), + ], + ]; } } diff --git a/app/code/core/Mage/Paypal/Model/System/Config/Source/PaymentActions/Express.php b/app/code/core/Mage/Paypal/Model/System/Config/Source/PaymentActions/Express.php deleted file mode 100644 index e76fe4c6830..00000000000 --- a/app/code/core/Mage/Paypal/Model/System/Config/Source/PaymentActions/Express.php +++ /dev/null @@ -1,26 +0,0 @@ -setMethod(Mage_Paypal_Model_Config::METHOD_WPP_EXPRESS); - return $configModel->getPaymentActions(); - } -} diff --git a/app/code/core/Mage/Paypal/Model/System/Config/Source/RequireBillingAddress.php b/app/code/core/Mage/Paypal/Model/System/Config/Source/RequireBillingAddress.php deleted file mode 100644 index 325226316e6..00000000000 --- a/app/code/core/Mage/Paypal/Model/System/Config/Source/RequireBillingAddress.php +++ /dev/null @@ -1,28 +0,0 @@ -getRequireBillingAddressOptions(); - } -} diff --git a/app/code/core/Mage/Paypal/Model/System/Config/Source/UrlMethod.php b/app/code/core/Mage/Paypal/Model/System/Config/Source/UrlMethod.php deleted file mode 100644 index 3ce0cb9f03f..00000000000 --- a/app/code/core/Mage/Paypal/Model/System/Config/Source/UrlMethod.php +++ /dev/null @@ -1,27 +0,0 @@ - 'GET', 'label' => 'GET'], - ['value' => 'POST', 'label' => 'POST'], - ]; - } -} diff --git a/app/code/core/Mage/Paypal/Model/System/Config/Source/YesnoShortcut.php b/app/code/core/Mage/Paypal/Model/System/Config/Source/YesnoShortcut.php deleted file mode 100644 index df9aac37252..00000000000 --- a/app/code/core/Mage/Paypal/Model/System/Config/Source/YesnoShortcut.php +++ /dev/null @@ -1,27 +0,0 @@ - 1, 'label' => Mage::helper('paypal')->__('Yes (PayPal recommends this option)')], - ['value' => 0, 'label' => Mage::helper('paypal')->__('No')], - ]; - } -} diff --git a/app/code/core/Mage/Paypal/Model/Transaction.php b/app/code/core/Mage/Paypal/Model/Transaction.php new file mode 100644 index 00000000000..3b4e2149353 --- /dev/null +++ b/app/code/core/Mage/Paypal/Model/Transaction.php @@ -0,0 +1,276 @@ +getResult(); + $transaction = $this->getTransaction(); + /** + * @var Mage_Sales_Model_Order_Payment $payment + */ + $transaction->setOrderPaymentObject($payment) + ->setTxnId($result->getId()) + ->setParentTxnId($payment->getParentTransactionId()) + ->setTxnType(Mage_Sales_Model_Order_Payment_Transaction::TYPE_REFUND) + ->setIsClosed(1) + ->setAdditionalInformation( + Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, + $this->getHelper()->prepareRawDetails($response->getBody()), + ); + + $transaction->save(); + } + + /** + * Create capture transaction record + * + * @param Varien_Object $payment Payment object + * @param ApiResponse $response API response + * @param string $authorizationId Authorization ID + */ + public function createCaptureTransaction(Varien_Object $payment, ApiResponse $response, string $authorizationId): void + { + $result = $response->getResult(); + $transaction = $this->getTransaction(); + /** + * @var Mage_Sales_Model_Order_Payment $payment + */ + $transaction->setOrderPaymentObject($payment) + ->setTxnId($result->getId()) + ->setParentTxnId($authorizationId) + ->setTxnType(Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE) + ->setIsClosed(1) + ->setAdditionalInformation( + Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, + $this->getHelper()->prepareRawDetails($response->getBody()), + ); + + $transaction->save(); + } + + /** + * Create void transaction record + * + * @param Varien_Object $payment Payment object + * @param ApiResponse $response API response + */ + public function createVoidTransaction(Varien_Object $payment, ApiResponse $response): void + { + $transaction = $this->getTransaction(); + $result = $response->getResult(); + /** + * @var Mage_Sales_Model_Order_Payment $payment + */ + $transaction->setOrderPaymentObject($payment) + ->setTxnId($payment->getTransactionId()) + ->setParentTxnId($result->getId()) + ->setTxnType(Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID) + ->setIsClosed(1) + ->setAdditionalInformation( + Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, + $this->getHelper()->prepareRawDetails($response->getBody()), + ); + $transaction->save(); + + $parentTxn = $transaction->loadByTxnId($result->getId()); + if ($parentTxn->getId()) { + $parentTxn->setIsClosed(1); + $parentTxn->save(); + } + } + + /** + * Update payment object after successful capture + * + * @param ApiResponse $response API result + * @param string $captureId Capture ID + */ + public function updatePaymentAfterCapture( + Mage_Sales_Model_Quote_Payment|Mage_Sales_Model_Order_Payment $payment, + ApiResponse $response, + string $captureId + ): void { + $result = $response->getResult(); + $payment->setMethod('paypal') + ->setPaypalCorrelationId($captureId) + ->setTransactionId($captureId) + ->setIsTransactionClosed(true) + ->setAdditionalInformation( + Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, + $this->getHelper()->prepareRawDetails($response->getBody()), + ); + $paymentSource = $result->getPaymentSource(); + if (isset($paymentSource) && $paymentSource->getPaypal() instanceof PaypalWalletResponse) { + $paypalWallet = $paymentSource->getPaypal(); + $payment->setPaypalPayerId($paypalWallet->getAccountId()) + ->setPaypalPayerStatus($paypalWallet->getAccountStatus()); + } + + $payment->save(); + } + + /** + * Update payment object after successful authorization + * + * @param ApiResponse $response API result + */ + public function updatePaymentAfterAuthorization(Mage_Sales_Model_Quote_Payment $payment, ApiResponse $response): void + { + $result = $response->getResult(); + $authorization = $result->getPurchaseUnits()[0]->getPayments()->getAuthorizations()[0]; + $paymentSource = $result->getPaymentSource(); + + if ($paymentSource->getPaypal() instanceof PaypalWalletResponse) { + $paypalWallet = $paymentSource->getPaypal(); + $payment->setPaypalPayerId($paypalWallet->getAccountId()) + ->setPaypalPayerStatus($paypalWallet->getAccountStatus()); + } + + $payment->setAdditionalInformation([ + self::PAYPAL_PAYMENT_STATUS => $authorization->getStatus(), + self::PAYPAL_PAYMENT_AUTHORIZATION_ID => $authorization->getId(), + self::PAYPAL_PAYMENT_AUTHORIZATION_EXPIRATION_TIME => $authorization->getExpirationTime(), + Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS => $this->getHelper()->prepareRawDetails($response->getBody()), + ]); + $payment->save(); + } + + /** + * Update payment after refund + * + * @param Varien_Object $payment Payment object + * @param Refund $result API result + */ + public function updatePaymentAfterRefund(Varien_Object $payment, Refund $result): void + { + $payment->setTransactionId($result->getId()) + ->setIsTransactionClosed(1) + ->setShouldCloseParentTransaction(1) + ->setSkipTransactionCreation(true); + } + + /** + * Update payment after authorized capture + * + * @param Varien_Object $payment Payment object + * @param ApiResponse $response API response + * @param string $authorizationId Authorization ID + */ + public function updatePaymentAfterAuthorizedCapture(Varien_Object $payment, ApiResponse $response, string $authorizationId): void + { + /** + * @var Mage_Sales_Model_Order_Payment $payment + */ + $result = $response->getResult(); + $captureId = $result->getId(); + $additionalInfo = $payment->getAdditionalInformation(); + unset($additionalInfo[self::PAYPAL_PAYMENT_STATUS]); + unset($additionalInfo[self::PAYPAL_PAYMENT_AUTHORIZATION_ID]); + unset($additionalInfo[self::PAYPAL_PAYMENT_AUTHORIZATION_EXPIRATION_TIME]); + $payment->setAdditionalInformation($additionalInfo); + $payment->setTransactionId($captureId) + ->setParentTransactionId($authorizationId) + ->setIsTransactionClosed(true) + ->setShouldCloseParentTransaction(true) + ->setAdditionalInformation( + Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, + $this->getHelper()->prepareRawDetails($response->getBody()), + ); + } + + /** + * Update payment after void + * + * @param Varien_Object $payment Payment object + */ + public function updatePaymentAfterVoid(Varien_Object $payment): void + { + $additionalInfo = $payment->getAdditionalInformation(); + unset($additionalInfo[self::PAYPAL_PAYMENT_STATUS]); + unset($additionalInfo[self::PAYPAL_PAYMENT_AUTHORIZATION_ID]); + unset($additionalInfo[self::PAYPAL_PAYMENT_AUTHORIZATION_EXPIRATION_TIME]); + $payment->setAdditionalInformation($additionalInfo); + $payment->setIsTransactionClosed(1) + ->setShouldCloseParentTransaction(1) + ->setSkipTransactionCreation(true); + } + + /** + * Update expired transaction record + * + * @param Varien_Object $payment Payment object + */ + public function updateExpiredTransaction(Varien_Object $payment): void + { + $transaction = $this->getTransaction(); + $transactionId = $payment->getLastTransId() . '-expired'; + + /** + * @var Mage_Sales_Model_Order_Payment $payment + */ + $transaction->setOrderPaymentObject($payment) + ->setTxnId($transactionId) + ->setParentTxnId($payment->getTransactionId()) + ->setTxnType(Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID) + ->setIsClosed(1); + $transaction->save(); + $payment->setLastTransId($transactionId) + ->setAdditionalInformation(self::PAYPAL_PAYMENT_STATUS, 'EXPIRED') + ->save(); + + $parentTxn = $transaction->loadByTxnId($payment->getLastTransId()); + if ($parentTxn->getId()) { + $parentTxn->setIsClosed(1); + $parentTxn->save(); + } + } + + /** + * Get order payment transaction model + * + * @throws Mage_Paypal_Model_Exception + */ + public function getTransaction(): Mage_Sales_Model_Order_Payment_Transaction + { + return Mage::getModel('sales/order_payment_transaction'); + } + + /** + * Get PayPal Helper instance + */ + private function getHelper(): Mage_Paypal_Model_Helper + { + return Mage::getSingleton('paypal/helper'); + } +} diff --git a/app/code/core/Mage/Paypal/UnavailableException.php b/app/code/core/Mage/Paypal/UnavailableException.php deleted file mode 100644 index cb61b23a2fb..00000000000 --- a/app/code/core/Mage/Paypal/UnavailableException.php +++ /dev/null @@ -1,13 +0,0 @@ -loadLayout() + ->_setActiveMenu('report/paypal/debug') + ->_addBreadcrumb( + Mage::helper('paypal')->__('Reports'), + Mage::helper('paypal')->__('PayPal Debug Log'), + ); + return $this; + } + + /** + * Renders the PayPal debug log grid page. + */ + public function indexAction(): void + { + $this->_initAction() + ->_addContent($this->getLayout()->createBlock('paypal/adminhtml_debug')) + ->renderLayout(); + } + + /** + * Renders the debug log grid for AJAX requests. + */ + public function gridAction(): void + { + $this->loadLayout(); + $this->getResponse()->setBody( + $this->getLayout()->createBlock('paypal/adminhtml_debug_grid')->toHtml(), + ); + } + + /** + * Handles the mass deletion of selected debug log entries. + */ + public function massDeleteAction(): void + { + $debugIds = $this->getRequest()->getParam('debug'); + if (!is_array($debugIds)) { + $this->_getSession()->addError($this->__('Please select log(s) to delete.')); + } else { + try { + foreach ($debugIds as $debugId) { + Mage::getModel('paypal/debug')->load($debugId)->delete(); + } + $this->_getSession()->addSuccess( + $this->__('Total of %d record(s) have been deleted.', count($debugIds)), + ); + } catch (Exception $e) { + $this->_getSession()->addError($e->getMessage()); + } + } + $this->_redirect('*/*/index'); + } + + /** + * Handles the deletion of all debug log entries. + */ + public function deleteAllAction(): void + { + try { + $collection = Mage::getModel('paypal/debug')->getCollection(); + foreach ($collection as $item) { + $item->delete(); + } + $this->_getSession()->addSuccess($this->__('All debug logs have been deleted.')); + } catch (Exception $e) { + $this->_getSession()->addError($e->getMessage()); + } + $this->_redirect('*/*/index'); + } + + /** + * Checks if the current user has permission to access this controller. + */ + protected function _isAllowed(): bool + { + return Mage::getSingleton('admin/session')->isAllowed('report/paypal/debug'); + } +} diff --git a/app/code/core/Mage/Paypal/controllers/Adminhtml/Paypal/ReportsController.php b/app/code/core/Mage/Paypal/controllers/Adminhtml/Paypal/ReportsController.php deleted file mode 100644 index a5f3b6c381a..00000000000 --- a/app/code/core/Mage/Paypal/controllers/Adminhtml/Paypal/ReportsController.php +++ /dev/null @@ -1,118 +0,0 @@ -_initAction() - ->_addContent($this->getLayout()->createBlock('paypal/adminhtml_settlement_report')) - ->renderLayout(); - } - - /** - * Ajax callback for grid actions - */ - public function gridAction() - { - $this->loadLayout(); - $this->getResponse()->setBody( - $this->getLayout()->createBlock('paypal/adminhtml_settlement_report_grid')->toHtml(), - ); - } - - /** - * View transaction details action - */ - public function detailsAction() - { - $rowId = $this->getRequest()->getParam('id'); - $row = Mage::getModel('paypal/report_settlement_row')->load($rowId); - if (!$row->getId()) { - $this->_redirect('*/*/'); - return; - } - Mage::register('current_transaction', $row); - $this->_initAction() - ->_title($this->__('View Transaction')) - ->_addContent($this->getLayout()->createBlock('paypal/adminhtml_settlement_details', 'settlementDetails')) - ->renderLayout(); - } - - /** - * Forced fetch reports action - */ - public function fetchAction() - { - try { - $reports = Mage::getModel('paypal/report_settlement'); - /** @var Mage_Paypal_Model_Report_Settlement $reports */ - $credentials = $reports->getSftpCredentials(); - if (empty($credentials)) { - Mage::throwException(Mage::helper('paypal')->__('Nothing to fetch because of an empty configuration.')); - } - foreach ($credentials as $config) { - try { - $fetched = $reports->fetchAndSave($config); - $this->_getSession()->addSuccess( - Mage::helper('paypal')->__("Fetched %s report rows from '%s@%s'.", $fetched, $config['username'], $config['hostname']), - ); - } catch (Exception $e) { - $this->_getSession()->addError( - Mage::helper('paypal')->__("Failed to fetch reports from '%s@%s'.", $config['username'], $config['hostname']), - ); - Mage::logException($e); - } - } - } catch (Mage_Core_Exception $e) { - $this->_getSession()->addError($e->getMessage()); - } catch (Exception $e) { - Mage::logException($e); - } - $this->_redirect('*/*/index'); - } - - /** - * Initialize titles, navigation - * @return $this - */ - protected function _initAction() - { - $this->_title($this->__('Reports'))->_title($this->__('Sales'))->_title($this->__('PayPal Settlement Reports')); - $this->loadLayout() - ->_setActiveMenu('report/salesroot/paypal_settlement_reports') - ->_addBreadcrumb(Mage::helper('paypal')->__('Reports'), Mage::helper('paypal')->__('Reports')) - ->_addBreadcrumb(Mage::helper('paypal')->__('Sales'), Mage::helper('paypal')->__('Sales')) - ->_addBreadcrumb(Mage::helper('paypal')->__('PayPal Settlement Reports'), Mage::helper('paypal')->__('PayPal Settlement Reports')); - return $this; - } - - /** - * @inheritDoc - */ - protected function _isAllowed() - { - $action = strtolower($this->getRequest()->getActionName()); - $aclPath = match ($action) { - 'index', 'details' => 'report/salesroot/paypal_settlement_reports/view', - 'fetch' => 'report/salesroot/paypal_settlement_reports/fetch', - default => 'report/salesroot/paypal_settlement_reports', - }; - - return Mage::getSingleton('admin/session')->isAllowed($aclPath); - } -} diff --git a/app/code/core/Mage/Paypal/controllers/BmlController.php b/app/code/core/Mage/Paypal/controllers/BmlController.php deleted file mode 100644 index e4563fd3c05..00000000000 --- a/app/code/core/Mage/Paypal/controllers/BmlController.php +++ /dev/null @@ -1,27 +0,0 @@ -_forward('start', 'express', 'paypal', [ - 'bml' => 1, - 'button' => $this->getRequest()->getParam('button'), - ]); - } -} diff --git a/app/code/core/Mage/Paypal/controllers/ExpressController.php b/app/code/core/Mage/Paypal/controllers/ExpressController.php deleted file mode 100644 index f3572501839..00000000000 --- a/app/code/core/Mage/Paypal/controllers/ExpressController.php +++ /dev/null @@ -1,35 +0,0 @@ -_getCheckout(); - //TODO: some actions with order - if ($session->getLastRealOrderId()) { - $this->_redirect('checkout/onepage/success'); - } - } - - /** - * When a customer cancel payment from gateway. - */ - public function cancelAction() - { - $gotoSection = $this->_cancelPayment(); - $redirectBlock = $this->_getIframeBlock() - ->setGotoSection($gotoSection) - ->setTemplate('paypal/hss/redirect.phtml'); - //TODO: clarify return logic whether customer will be returned in iframe or in parent window - $this->getResponse()->setBody($redirectBlock->toHtml()); - } - - /** - * Cancel order, return quote to customer - * - * @param string $errorMsg - * @return false|string - */ - protected function _cancelPayment($errorMsg = '') - { - $gotoSection = false; - /** @var Mage_Paypal_Helper_Checkout $helper */ - $helper = Mage::helper('paypal/checkout'); - $helper->cancelCurrentOrder($errorMsg); - if ($helper->restoreQuote()) { - $gotoSection = 'payment'; - } - return $gotoSection; - } - - /** - * Get frontend checkout session object - * - * @return Mage_Checkout_Model_Session - */ - protected function _getCheckout() - { - return Mage::getSingleton('checkout/session'); - } - - /** - * Get iframe block - * - * @return Mage_Paypal_Block_Hosted_Pro_Iframe - */ - protected function _getIframeBlock() - { - $this->loadLayout('paypal_hosted_pro_iframe'); - /** @var Mage_Paypal_Block_Hosted_Pro_Iframe $block */ - $block = $this->getLayout()->getBlock('hosted.pro.iframe'); - return $block; - } -} diff --git a/app/code/core/Mage/Paypal/controllers/IpnController.php b/app/code/core/Mage/Paypal/controllers/IpnController.php deleted file mode 100644 index bacb5ece04b..00000000000 --- a/app/code/core/Mage/Paypal/controllers/IpnController.php +++ /dev/null @@ -1,40 +0,0 @@ -getRequest()->isPost()) { - return; - } - - try { - $data = $this->getRequest()->getPost(); - Mage::getModel('paypal/ipn')->processIpnRequest($data, new Varien_Http_Adapter_Curl()); - } catch (Mage_Paypal_UnavailableException $e) { - Mage::logException($e); - $this->getResponse()->setHeader('HTTP/1.1', '503 Service Unavailable')->sendResponse(); - exit; - } catch (Exception $e) { - Mage::logException($e); - $this->getResponse()->setHttpResponseCode(500); - } - } -} diff --git a/app/code/core/Mage/Paypal/controllers/PayflowController.php b/app/code/core/Mage/Paypal/controllers/PayflowController.php deleted file mode 100644 index f97066bc67d..00000000000 --- a/app/code/core/Mage/Paypal/controllers/PayflowController.php +++ /dev/null @@ -1,132 +0,0 @@ -_cancelPayment(); - $redirectBlock = $this->_getIframeBlock() - ->setGotoSection($gotoSection) - ->setTemplate('paypal/payflowlink/redirect.phtml'); - $this->getResponse()->setBody($redirectBlock->toHtml()); - } - - /** - * When a customer return to website from payflow gateway. - */ - public function returnUrlAction() - { - $redirectBlock = $this->_getIframeBlock() - ->setTemplate('paypal/payflowlink/redirect.phtml'); - - $session = $this->_getCheckout(); - if ($session->getLastRealOrderId()) { - $order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId()); - - if ($order && $order->getIncrementId() == $session->getLastRealOrderId()) { - $allowedOrderStates = [ - Mage_Sales_Model_Order::STATE_PROCESSING, - Mage_Sales_Model_Order::STATE_COMPLETE, - ]; - if (in_array($order->getState(), $allowedOrderStates)) { - $session->unsLastRealOrderId(); - $redirectBlock->setGotoSuccessPage(true); - } else { - $gotoSection = $this->_cancelPayment( - Mage::helper('core') - ->stripTags( - (string) $this->getRequest()->getParam('RESPMSG'), - ), - ); - $redirectBlock->setGotoSection($gotoSection); - $redirectBlock->setErrorMsg($this->__('Payment has been declined. Please try again.')); - } - } - } - - $this->getResponse()->setBody($redirectBlock->toHtml()); - } - - /** - * Submit transaction to Payflow getaway into iframe - */ - public function formAction() - { - $this->getResponse()->setHeader('P3P', 'CP="CAO PSA OUR"'); - $this->getResponse() - ->setBody($this->_getIframeBlock()->toHtml()); - } - - /** - * Get response from PayPal by silent post method - */ - public function silentPostAction() - { - $data = $this->getRequest()->getPost(); - if (isset($data['INVNUM'])) { - /** @var Mage_Paypal_Model_Payflowlink $paymentModel */ - $paymentModel = Mage::getModel('paypal/payflowlink'); - try { - $paymentModel->process($data); - } catch (Exception $e) { - Mage::logException($e); - } - } - } - - /** - * Cancel order, return quote to customer - * - * @param string $errorMsg - * @return false|string - */ - protected function _cancelPayment($errorMsg = '') - { - $gotoSection = false; - /** @var Mage_Paypal_Helper_Checkout $helper */ - $helper = Mage::helper('paypal/checkout'); - $helper->cancelCurrentOrder($errorMsg); - if ($helper->restoreQuote()) { - $gotoSection = 'payment'; - } - return $gotoSection; - } - - /** - * Get frontend checkout session object - * - * @return Mage_Checkout_Model_Session - */ - protected function _getCheckout() - { - return Mage::getSingleton('checkout/session'); - } - - /** - * Get iframe block - * - * @return Mage_Paypal_Block_Payflow_Link_Iframe - */ - protected function _getIframeBlock() - { - $this->loadLayout('paypal_payflow_link_iframe'); - /** @var Mage_Paypal_Block_Payflow_Link_Iframe $block */ - $block = $this->getLayout()->getBlock('payflow.link.iframe'); - return $block; - } -} diff --git a/app/code/core/Mage/Paypal/controllers/PayflowadvancedController.php b/app/code/core/Mage/Paypal/controllers/PayflowadvancedController.php deleted file mode 100644 index c1ae5cd2cf7..00000000000 --- a/app/code/core/Mage/Paypal/controllers/PayflowadvancedController.php +++ /dev/null @@ -1,152 +0,0 @@ -_cancelPayment(); - $redirectBlock = $this->_getIframeBlock() - ->setGotoSection($gotoSection) - ->setTemplate('paypal/payflowadvanced/redirect.phtml'); - $this->getResponse()->setBody($redirectBlock->toHtml()); - } - - /** - * When a customer return to website from payflow gateway. - */ - public function returnUrlAction() - { - $redirectBlock = $this->_getIframeBlock() - ->setTemplate('paypal/payflowadvanced/redirect.phtml'); - - $session = $this->_getCheckout(); - if ($session->getLastRealOrderId()) { - $order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId()); - - if ($order && $order->getIncrementId() == $session->getLastRealOrderId()) { - $allowedOrderStates = [ - Mage_Sales_Model_Order::STATE_PROCESSING, - Mage_Sales_Model_Order::STATE_COMPLETE, - ]; - if (in_array($order->getState(), $allowedOrderStates)) { - $session->unsLastRealOrderId(); - $redirectBlock->setGotoSuccessPage(true); - } else { - $gotoSection = $this->_cancelPayment( - Mage::helper('core') - ->stripTags( - (string) $this->getRequest()->getParam('RESPMSG'), - ), - ); - $redirectBlock->setGotoSection($gotoSection); - $redirectBlock->setErrorMsg($this->__('Payment has been declined. Please try again.')); - } - } - } - - $this->getResponse()->setBody($redirectBlock->toHtml()); - } - - /** - * Submit transaction to Payflow getaway into iframe - */ - public function formAction() - { - $this->getResponse() - ->setBody($this->_getIframeBlock()->toHtml()); - } - - /** - * Get response from PayPal by silent post method - */ - public function silentPostAction() - { - $data = $this->getRequest()->getPost(); - if (isset($data['INVNUM'])) { - /** @var Mage_Paypal_Model_Payflowadvanced $paymentModel */ - $paymentModel = Mage::getModel('paypal/payflowadvanced'); - try { - $paymentModel->process($data); - } catch (Exception $e) { - Mage::logException($e); - } - } - } - - /** - * Cancel order, return quote to customer - * - * @param string $errorMsg - * @return bool|string - */ - protected function _cancelPayment($errorMsg = '') - { - $gotoSection = false; - /** @var Mage_Paypal_Helper_Checkout $helper */ - $helper = Mage::helper('paypal/checkout'); - $helper->cancelCurrentOrder($errorMsg); - if ($helper->restoreQuote()) { - $gotoSection = 'payment'; - } - return $gotoSection; - } - - /** - * Get frontend checkout session object - * - * @return Mage_Checkout_Model_Session - */ - protected function _getCheckout() - { - return Mage::getSingleton('checkout/session'); - } - - /** - * Get iframe block - * - * @return Mage_Paypal_Block_Payflow_Advanced_Iframe - */ - protected function _getIframeBlock() - { - $this->loadLayout('paypal_payflow_advanced_iframe'); - /** @var Mage_Paypal_Block_Payflow_Advanced_Iframe $block */ - $block = $this->getLayout()->getBlock('payflow.advanced.iframe'); - return $block; - } -} diff --git a/app/code/core/Mage/Paypal/controllers/PaymentController.php b/app/code/core/Mage/Paypal/controllers/PaymentController.php new file mode 100644 index 00000000000..f50f51fabdc --- /dev/null +++ b/app/code/core/Mage/Paypal/controllers/PaymentController.php @@ -0,0 +1,510 @@ +_validateFormKey()) { + Mage::throwException(Mage::helper('paypal')->__('Invalid form key.')); + } + + if (!$this->_getQuote()->hasItems() || $this->_getQuote()->getHasError()) { + $this->getResponse()->setHeader('HTTP/1.1', '403 Forbidden'); + Mage::throwException(Mage::helper('paypal')->__('Unable to initialize Express Checkout.')); + } + + if (!$this->_getQuote()->getQuoteCurrencyCode()) { + $this->_getQuote()->setQuoteCurrencyCode(Mage::app()->getStore()->getCurrentCurrencyCode()); + $this->_getQuote()->save(); + } + + if ($this->_getQuote()->getIsMultiShipping()) { + $this->_getQuote()->setIsMultiShipping(false); + $this->_getQuote()->removeAllAddresses(); + } + + $fundingSource = $this->getRequest()->getParam('funding_source'); + + $customer = $this->_getCustomerSession()->getCustomer(); + $quoteCheckoutMethod = Mage::getSingleton('checkout/type_onepage')->getCheckoutMethod(); + if ($customer && $customer->getId()) { + $this->_getQuote()->assignCustomerWithAddressChange($customer, $this->_getQuote()->getBillingAddress(), $this->_getQuote()->getShippingAddress()); + } elseif ((!$quoteCheckoutMethod + || $quoteCheckoutMethod != Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER) + && !Mage::helper('checkout')->isAllowedGuestCheckout( + $this->_getQuote(), + $this->_getQuote()->getStoreId(), + ) + ) { + Mage::getSingleton('core/session')->addNotice( + Mage::helper('paypal')->__('To proceed to Checkout, please log in using your email address.'), + ); + $this->_redirectLogin(); + $this->_getCustomerSession()->setBeforeAuthUrl(Mage::getUrl('*/*/*', ['_current' => true])); + return; + } + + $result = $this->_getPaypal()->create($this->_getQuote(), $fundingSource); + $this->getResponse() + ->setHeader('Content-Type', self::CONTENT_TYPE_JSON) + ->setBody(Mage::helper('core')->jsonEncode($result)); + } catch (Exception $e) { + Mage::logException($e); + $this->getResponse() + ->setHeader('Content-Type', self::CONTENT_TYPE_JSON) + ->setBody(Mage::helper('core')->jsonEncode([ + 'success' => false, + 'message' => $e->getMessage(), + ])); + } + } + + /** + * Processes the PayPal payment after customer approval on the PayPal side. + * This action will either authorize or capture the payment based on the store's configuration. + * + * @throws Exception + */ + public function processAction(): void + { + try { + if (!$this->_validateFormKey()) { + Mage::throwException(Mage::helper('paypal')->__('Invalid form key.')); + } + $orderId = $this->getRequest()->getParam('order_id'); + $paymentAction = Mage::getSingleton('paypal/config')->getPaymentAction(); + + if (!$orderId) { + Mage::throwException(Mage::helper('paypal')->__('PayPal order ID is required')); + } + if ($paymentAction === strtolower(CheckoutPaymentIntent::AUTHORIZE)) { + $this->_getPaypal()->authorizePayment($orderId, $this->_getQuote()); + } else { + $this->_getPaypal()->captureOrder($orderId, $this->_getQuote()); + } + + $this->getResponse() + ->setHeader('Content-Type', self::CONTENT_TYPE_JSON)->setBody(Mage::helper('core')->jsonEncode([ + 'success' => true, + ])); + } catch (Exception $e) { + Mage::logException($e); + + $this->getResponse() + ->setHeader('Content-Type', self::CONTENT_TYPE_JSON)->setBody(Mage::helper('core')->jsonEncode([ + 'success' => false, + 'message' => $e->getMessage(), + ])); + } + } + + /** + * Places the Magento order after the PayPal payment has been successfully processed. + * It handles guest, new customer, and existing customer checkouts, creates the order, + * and redirects to the success or cart page. + */ + public function placeOrderAction(): void + { + try { + if (!$this->_validateFormKey()) { + Mage::throwException(Mage::helper('paypal')->__('Invalid form key.')); + } + $isNewCustomer = false; + switch (Mage::getSingleton('checkout/type_onepage')->getCheckoutMethod()) { + case Mage_Checkout_Model_Type_Onepage::METHOD_GUEST: + $this->_prepareGuestQuote(); + break; + case Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER: + $this->_prepareNewCustomerQuote(); + $isNewCustomer = true; + break; + default: + $this->_prepareCustomerQuote(); + break; + } + $this->_ignoreAddressValidation(); + $this->_getQuote()->collectTotals(); + $session = $this->_getCheckoutSession(); + $service = Mage::getModel('sales/service_quote', $this->_getQuote()); + + $service->submitAll(); + $this->_getQuote()->save(); + if ($isNewCustomer) { + try { + $this->_involveNewCustomer(); + } catch (Exception $e) { + Mage::logException($e); + } + } + + /** @var Mage_Sales_Model_Order $order */ + $order = $service->getOrder(); + if (!$order) { + return; + } + + $quotePayment = $this->_getQuote()->getPayment(); + $orderPayment = $order->getPayment(); + $orderPayment->setQuotePaymentId($quotePayment->getId()) + ->setLastTransId($quotePayment->getPaypalCorrelationId()); + foreach ($quotePayment->getAdditionalInformation() as $key => $value) { + $orderPayment->setAdditionalInformation($key, $value); + } + $orderPayment->save(); + + $paymentAction = Mage::getSingleton('paypal/config')->getPaymentAction(); + $isAuthorize = ($paymentAction === strtolower(PaypalServerSdkLib\Models\CheckoutPaymentIntent::AUTHORIZE)); + $transaction = Mage::getModel('sales/order_payment_transaction'); + foreach ($orderPayment->getAdditionalInformation() as $key => $value) { + $transaction->setAdditionalInformation($key, $value); + } + if ($isAuthorize) { + $transaction->setOrderPaymentObject($orderPayment) + ->setTxnId($orderPayment->getAdditionalInformation(Mage_Paypal_Model_Transaction::PAYPAL_PAYMENT_AUTHORIZATION_ID)) + ->setTxnType(Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH) + ->setIsClosed(false); + $storeTimezone = Mage::app()->getStore()->getConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_TIMEZONE); + $expirationTime = $orderPayment->getAdditionalInformation(Mage_Paypal_Model_Transaction::PAYPAL_PAYMENT_AUTHORIZATION_EXPIRATION_TIME); + + $date = new DateTime($expirationTime, new DateTimeZone('UTC')); + $date->setTimezone(new DateTimeZone($storeTimezone)); + + $order->addStatusHistoryComment( + Mage::helper('paypal')->__('Paypal payment has been authorized, capture is required before date ' . $date->format('Y-m-d H:i:s')), + false, + ); + $order->setState( + Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, + true, + Mage::helper('paypal')->__('Payment has been authorized. Capture is required.'), + )->save(); + } else { + $transaction->setOrderPaymentObject($orderPayment) + ->setTxnId($quotePayment->getPaypalCorrelationId()) + ->setTxnType(Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE) + ->setIsClosed($orderPayment->getIsTransactionClosed()); + $order->addStatusHistoryComment( + Mage::helper('paypal')->__('PayPal payment captured successfully. Capture ID: %s', $transaction->getTxnId()), + false, + ); + } + $transaction->save(); + + if (!$isAuthorize && $order->canInvoice()) { + $invoice = $order->prepareInvoice(); + $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE); + $invoice->register()->setIsPaid(true)->setIsTransactionPending(false)->setTransactionId($transaction->getTxnId()); + Mage::getModel('core/resource_transaction') + ->addObject($invoice) + ->addObject($order) + ->save(); + } + + $session->clearHelperData(); + $session->setLastQuoteId($this->_getQuote()->getId()) + ->setLastSuccessQuoteId($this->_getQuote()->getId()) + ->setLastOrderId($order->getId()) + ->setLastRealOrderId($order->getIncrementId()); + $order->queueNewOrderEmail(); + + $this->_redirect('checkout/onepage/success'); + return; + } catch (Exception $e) { + Mage::logException($e); + Mage::helper('checkout')->sendPaymentFailedEmail($this->_getQuote(), $e->getMessage()); + $this->_getCheckoutSession()->addError($e->getMessage()); + $this->_redirect('checkout/cart'); + } + } + + /** + * Cancel Payment + * + */ + public function cancelAction(): void + { + try { + if (!$this->_validateFormKey()) { + Mage::throwException(Mage::helper('paypal')->__('Invalid form key.')); + } + $payment = $this->_getQuote()->getPayment(); + $additionalInfo = $payment->getAdditionalInformation(); + foreach ($additionalInfo as $key => $value) { + $payment->unsAdditionalInformation($key); + } + $payment->setPaypalCorrelationId('')->save(); + $this->_getQuote()->setReservedOrderId(null)->save(); + $this->getResponse() + ->setHeader('Content-Type', self::CONTENT_TYPE_JSON) + ->setBody(Mage::helper('core')->jsonEncode(['success' => true])); + } catch (Exception $e) { + Mage::logException($e); + $this->getResponse() + ->setHeader('Content-Type', self::CONTENT_TYPE_JSON) + ->setBody(Mage::helper('core')->jsonEncode([ + 'success' => false, + 'message' => $e->getMessage(), + ])); + } + } + + /** + * Retrieves the checkout session model. + */ + protected function _getCheckoutSession(): Mage_Checkout_Model_Session + { + return Mage::getSingleton('checkout/session'); + } + + /** + * Return checkout quote object + */ + private function _getQuote(): Mage_Sales_Model_Quote + { + if (!$this->_quote) { + $this->_quote = $this->_getCheckoutSession()->getQuote(); + } + return $this->_quote; + } + + /** + * Retrieves the PayPal model instance. + */ + private function _getPaypal(): Mage_Paypal_Model_Paypal + { + if (!$this->_paypal) { + $this->_paypal = Mage::getModel('paypal/paypal'); + } + return $this->_paypal; + } + + /** + * Prepares the quote for a guest checkout. + */ + protected function _prepareGuestQuote(): self + { + $quote = $this->_getQuote(); + $quote->setCustomerEmail($quote->getBillingAddress()->getEmail()) + ->setCustomerIsGuest(1) + ->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID); + return $this; + } + + /** + * Prepares the quote for a new customer registration during checkout. + */ + protected function _prepareNewCustomerQuote(): self + { + $quote = $this->_getQuote(); + $billing = $quote->getBillingAddress(); + $shipping = $quote->isVirtual() ? null : $quote->getShippingAddress(); + + $customerId = $this->_lookupCustomerId(); + if ($customerId && !$this->_customerEmailExists($quote->getCustomerEmail())) { + $this->_getCustomerSession()->loginById($customerId); + return $this->_prepareCustomerQuote(); + } + + $customer = $quote->getCustomer(); + /** @var Mage_Customer_Model_Customer $customer */ + $customerBilling = $billing->exportCustomerAddress(); + $customer->addAddress($customerBilling); + $billing->setCustomerAddress($customerBilling); + $customerBilling->setIsDefaultBilling(true); + if ($shipping && !$shipping->getSameAsBilling()) { + $customerShipping = $shipping->exportCustomerAddress(); + $customer->addAddress($customerShipping); + $shipping->setCustomerAddress($customerShipping); + $customerShipping->setIsDefaultShipping(true); + } elseif ($shipping) { + $customerBilling->setIsDefaultShipping(true); + } + + $dynamicAttributes = ['customer_dob', 'customer_taxvat', 'customer_gender']; + foreach ($dynamicAttributes as $attributeCode) { + $quoteValue = $quote->getData($attributeCode); + $billingValue = $billing->getData($attributeCode); + + if ($quoteValue && !$billingValue) { + $billing->setData($attributeCode, $quoteValue); + } + } + + Mage::helper('core')->copyFieldset('checkout_onepage_billing', 'to_customer', $billing, $customer); + $customer->setEmail($quote->getCustomerEmail()); + $customer->setPrefix($quote->getCustomerPrefix()); + $customer->setFirstname($quote->getCustomerFirstname()); + $customer->setMiddlename($quote->getCustomerMiddlename()); + $customer->setLastname($quote->getCustomerLastname()); + $customer->setSuffix($quote->getCustomerSuffix()); + $customer->setPassword($customer->decryptPassword($quote->getPasswordHash())); + $customer->setPasswordHash($customer->hashPassword($customer->getPassword())); + $customer->setPasswordCreatedAt(time()); + $customer->save(); + $quote->setCustomer($customer); + $quote->setPasswordHash(''); + + return $this; + } + + /** + * Prepares the quote for an existing, logged-in customer. + */ + protected function _prepareCustomerQuote(): self + { + $quote = $this->_getQuote(); + $billing = $quote->getBillingAddress(); + $shipping = $quote->isVirtual() ? null : $quote->getShippingAddress(); + + $customer = $this->_getCustomerSession()->getCustomer(); + if (!$billing->getCustomerId() || $billing->getSaveInAddressBook()) { + $customerBilling = $billing->exportCustomerAddress(); + $customer->addAddress($customerBilling); + $billing->setCustomerAddress($customerBilling); + } + if ( + $shipping && ((!$shipping->getCustomerId() && !$shipping->getSameAsBilling()) + || (!$shipping->getSameAsBilling() && $shipping->getSaveInAddressBook())) + ) { + $customerShipping = $shipping->exportCustomerAddress(); + $customer->addAddress($customerShipping); + $shipping->setCustomerAddress($customerShipping); + } + + if (isset($customerBilling) && !$customer->getDefaultBilling()) { + $customerBilling->setIsDefaultBilling(true); + } + if ($shipping && isset($customerBilling) && !$customer->getDefaultShipping() && $shipping->getSameAsBilling()) { + $customerBilling->setIsDefaultShipping(true); + } elseif ($shipping && isset($customerShipping) && !$customer->getDefaultShipping()) { + $customerShipping->setIsDefaultShipping(true); + } + $quote->setCustomer($customer); + + return $this; + } + + /** + * Retrieves the customer session model. + */ + private function _getCustomerSession(): Mage_Customer_Model_Session + { + if (is_null($this->_customerSession)) { + $this->_customerSession = Mage::getSingleton('customer/session'); + } + return $this->_customerSession; + } + + /** + * Checks if a customer with the given email address already exists for the current website. + * + * @param string $email The customer email to check. + */ + protected function _customerEmailExists(string $email): bool + { + $result = false; + $customer = Mage::getModel('customer/customer'); + $websiteId = Mage::app()->getStore()->getWebsiteId(); + if (!is_null($websiteId)) { + $customer->setWebsiteId($websiteId); + } + $customer->loadByEmail($email); + if (!is_null($customer->getId())) { + $result = true; + } + + return $result; + } + + /** + * Looks up a customer ID by the email address stored in the quote. + * + * @return int|null The customer ID if found, otherwise null. + */ + protected function _lookupCustomerId(): ?int + { + return Mage::getModel('customer/customer') + ->setWebsiteId(Mage::app()->getWebsite()->getId()) + ->loadByEmail($this->_getQuote()->getCustomerEmail()) + ->getId(); + } + + /** + * Sets the quote addresses to ignore validation during the order placement process. + */ + private function _ignoreAddressValidation(): void + { + $this->_getQuote()->getBillingAddress()->setShouldIgnoreValidation(true); + if (!$this->_getQuote()->getIsVirtual()) { + $this->_getQuote()->getShippingAddress()->setShouldIgnoreValidation(true); + } + } + /** + * Redirects the user to the customer login page. + */ + protected function _redirectLogin(): void + { + $this->setFlag('', 'no-dispatch', true); + $this->getResponse()->setRedirect( + Mage::helper('core/url')->addRequestParam( + Mage::helper('customer')->getLoginUrl(), + ['context' => 'checkout'], + ), + ); + } + + /** + * Handles the post-order actions for a newly registered customer, such as sending confirmation emails. + */ + protected function _involveNewCustomer(): self + { + $customer = $this->_getQuote()->getCustomer(); + if ($customer->isConfirmationRequired()) { + $customer->sendNewAccountEmail('confirmation', '', $this->_getQuote()->getStoreId()); + $url = Mage::helper('customer')->getEmailConfirmationUrl($customer->getEmail()); + $this->_getCustomerSession()->addSuccess( + Mage::helper('customer')->__('Account confirmation is required. Please, check your e-mail for confirmation link. To resend confirmation email please click here.', $url), + ); + } else { + $customer->sendNewAccountEmail('registered', '', $this->_getQuote()->getStoreId()); + $this->_getCustomerSession()->loginById($customer->getId()); + } + return $this; + } +} diff --git a/app/code/core/Mage/Paypal/controllers/StandardController.php b/app/code/core/Mage/Paypal/controllers/StandardController.php deleted file mode 100644 index f5c143e38dc..00000000000 --- a/app/code/core/Mage/Paypal/controllers/StandardController.php +++ /dev/null @@ -1,98 +0,0 @@ -_order; - } - - /** - * Send expire header to ajax response - * - * @SuppressWarnings("PHPMD.ExitExpression") - */ - protected function _expireAjax() - { - if (!Mage::getSingleton('checkout/session')->getQuote()->hasItems()) { - $this->getResponse()->setHeader('HTTP/1.1', '403 Session Expired'); - exit; - } - } - - /** - * Get singleton with PayPal standard order transaction information - * - * @return Mage_Paypal_Model_Standard - */ - public function getStandard() - { - return Mage::getSingleton('paypal/standard'); - } - - /** - * When a customer chooses Paypal on Checkout/Payment page - * - */ - public function redirectAction() - { - $session = Mage::getSingleton('checkout/session'); - $session->setPaypalStandardQuoteId($session->getQuoteId()); - $this->getResponse()->setBody($this->getLayout()->createBlock('paypal/standard_redirect')->toHtml()); - $session->unsQuoteId(); - $session->unsRedirectUrl(); - } - - /** - * When a customer cancel payment from paypal. - */ - public function cancelAction() - { - $session = Mage::getSingleton('checkout/session'); - $session->setQuoteId($session->getPaypalStandardQuoteId(true)); - if ($session->getLastRealOrderId()) { - $order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId()); - if ($order->getId()) { - $order->cancel()->save(); - } - Mage::helper('paypal/checkout')->restoreQuote(); - } - $this->_redirect('checkout/cart'); - } - - /** - * when paypal returns - * The order information at this point is in POST - * variables. However, you don't want to "process" the order until you - * get validation from the IPN. - */ - public function successAction() - { - $session = Mage::getSingleton('checkout/session'); - $session->setQuoteId($session->getPaypalStandardQuoteId(true)); - Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save(); - $this->_redirect('checkout/onepage/success', ['_secure' => true]); - } -} diff --git a/app/code/core/Mage/Paypal/data/paypal_setup/data-install-1.6.0.5.php b/app/code/core/Mage/Paypal/data/paypal_setup/data-install-1.6.0.5.php deleted file mode 100644 index bf64ceac2d9..00000000000 --- a/app/code/core/Mage/Paypal/data/paypal_setup/data-install-1.6.0.5.php +++ /dev/null @@ -1,36 +0,0 @@ -getConnection(); -$installer->startSetup(); -$data = [ - ['paypal_reversed', 'PayPal Reversed'], - ['paypal_canceled_reversal', 'PayPal Canceled Reversal'], -]; -$connection = $installer->getConnection()->insertArray( - $installer->getTable('sales/order_status'), - ['status', 'label'], - $data, -); -/** - * Set default value for "skip order review page" option for Express Checkout for new installations - */ -$ecSkipOrderReviewStepFlagPath = 'payment/paypal_express/skip_order_review_step'; -Mage::getConfig()->saveConfig($ecSkipOrderReviewStepFlagPath, '1'); - -/** - * Set default value for "Mobile Optimized" option for Payflow Link/Advanced/Hosted Pro for new installations - */ -$paymentCode = ['payflow_link', 'payflow_advanced', 'hosted_pro']; -foreach ($paymentCode as $value) { - Mage::getConfig()->saveConfig("payment/{$value}/mobile_optimized", '1'); -} -$installer->endSetup(); diff --git a/app/code/core/Mage/Paypal/data/paypal_setup/data-upgrade-1.6.0.2-1.6.0.3.php b/app/code/core/Mage/Paypal/data/paypal_setup/data-upgrade-1.6.0.2-1.6.0.3.php deleted file mode 100644 index 2863283e993..00000000000 --- a/app/code/core/Mage/Paypal/data/paypal_setup/data-upgrade-1.6.0.2-1.6.0.3.php +++ /dev/null @@ -1,23 +0,0 @@ -getConnection(); -$installer->startSetup(); -$data = [ - ['paypal_reversed', 'PayPal Reversed'], - ['paypal_canceled_reversal', 'PayPal Canceled Reversal'], -]; -$connection = $installer->getConnection()->insertArray( - $installer->getTable('sales/order_status'), - ['status', 'label'], - $data, -); -$installer->endSetup(); diff --git a/app/code/core/Mage/Paypal/data/paypal_setup/data-upgrade-1.6.0.4-1.6.0.5.php b/app/code/core/Mage/Paypal/data/paypal_setup/data-upgrade-1.6.0.4-1.6.0.5.php deleted file mode 100644 index 54d66a528d6..00000000000 --- a/app/code/core/Mage/Paypal/data/paypal_setup/data-upgrade-1.6.0.4-1.6.0.5.php +++ /dev/null @@ -1,14 +0,0 @@ -saveConfig($ecSkipOrderReviewStepFlagPath, '0'); diff --git a/app/code/core/Mage/Paypal/data/paypal_setup/data-upgrade-1.6.0.5-1.6.0.6.php b/app/code/core/Mage/Paypal/data/paypal_setup/data-upgrade-1.6.0.5-1.6.0.6.php deleted file mode 100644 index 308f6de79b5..00000000000 --- a/app/code/core/Mage/Paypal/data/paypal_setup/data-upgrade-1.6.0.5-1.6.0.6.php +++ /dev/null @@ -1,30 +0,0 @@ -getConnection(); -$select = $connection->select() - ->from( - ['config' => $installer->getTable('core/config_data')], - ['scope_id' => 'config.scope_id'], - ) - ->where('config.path=?', 'paypal/general/merchant_country') - ->where('config.value<>?', 'US'); - -$result = $connection->fetchAll($select); -foreach ($result as $row) { - $connection->delete( - $installer->getTable('core/config_data'), - 'path LIKE "%express_bml%"' - . $connection->quoteInto(' AND scope_id = ?', $row['scope_id']), - ); -} - -$installer->endSetup(); diff --git a/app/code/core/Mage/Paypal/etc/adminhtml.xml b/app/code/core/Mage/Paypal/etc/adminhtml.xml index 2bbaff0612d..fa0fa3ce0f7 100644 --- a/app/code/core/Mage/Paypal/etc/adminhtml.xml +++ b/app/code/core/Mage/Paypal/etc/adminhtml.xml @@ -3,7 +3,7 @@ /** * @copyright For copyright and license information, read the COPYING.txt file. * @link /COPYING.txt - * @license Academic Free License (AFL 3.0) + * @license Open Software License (OSL 3.0) * @package Mage_Paypal */ --> @@ -11,15 +11,17 @@ - + + PayPal + 100 - - PayPal Settlement Reports - adminhtml/paypal_reports - 100 - + + Debug Log + adminhtml/paypal_debug + 10 + - + @@ -31,34 +33,33 @@ - - PayPal - + + + + PayPal Settings + + + - + + PayPal + 100 - - PayPal Settlement Reports - - - View - - - Fetch - - - + + Debug Log + 10 + - + - + \ No newline at end of file diff --git a/app/code/core/Mage/Paypal/etc/config.xml b/app/code/core/Mage/Paypal/etc/config.xml index 7bb8813f960..bc3f5bd20a8 100644 --- a/app/code/core/Mage/Paypal/etc/config.xml +++ b/app/code/core/Mage/Paypal/etc/config.xml @@ -3,27 +3,17 @@ /** * @copyright For copyright and license information, read the COPYING.txt file. * @link /COPYING.txt - * @license Academic Free License (AFL 3.0) + * @license Open Software License (OSL 3.0) * @package Mage_Paypal */ --> - 1.6.0.6 + 2.0.0.0 - - - - - paypal/observer - observeHtmlTransactionId - - - - Mage_Paypal_Model @@ -31,76 +21,58 @@ Mage_Paypal_Model_Resource - paypal_mysql4 - - paypal_api_debug
-
- - paypal_settlement_report
-
- - paypal_settlement_report_row
-
- - paypal_cert
-
- - paypal_payment_transaction
-
+ + paypal_debug
+
- - - - Mage_Paypal - Mage_Paypal_Model_Resource_Setup - - - Mage_Paypal_Block + + + Mage_Paypal_Helper + + - - - - - + + + 1 + + + 1 + + - - - - - SM - Switch/Maestro - 60 - - - SO - Solo - 61 - - - - - - - PayPal - - + + + + Mage_Paypal + Mage_Paypal_Model_Resource_Setup + + + core_setup + + + + + core_write + + + + + core_read + + +
- - /paypal/express - /paypal/standard - /paypal/ipn - standard @@ -124,44 +96,10 @@ paypal.xml - - bml.xml - - - paypal/express/callbackshippingoptions - - - - - - paypal/observer - saveOrderAfterSubmit - - - - - - - paypal/observer - setResponseAfterSaveOrder - - - - - - - - - paypal/observer - loadCountryDependentSolutionsConfig - - - - @@ -172,157 +110,6 @@ - - - Magento_Cart_Community - - - - - - dynamic - - - - - - - - - 1 - - - - - - paypal/express - PayPal Express Checkout - Authorization - Mark - 1 - 1 - 1 - never - paypal - 3 - 29 - 1 - 1 - 1 - - - paypal/bml - Paypal Credit - paypal - - - paypal/direct - PayPal Payments Pro - Authorization - VI,MC - 1 - paypal - 1 - - - paypal/standard - PayPal Website Payments Standard - Sale - 1 - paypal - 1 - - - PayPal Express Checkout Payflow Edition - Authorization - 1 - 1 - 1 - paypal - 1 - - - PayPal Payments Pro Payflow Edition - Authorization - VI,MC,AE - 1 - paypal - 1 - - - paypal/payflowpro - Payflow Pro - Authorization - AE,VI - 1 - C - MEDIUM - - - paypal - 1 - - - 1 - 1 - paypal/method_agreement - PayPal Billing Agreement - paypal - 1 - - - paypal/payflowlink - Authorization - HIGH - - paypal - Credit Card - 1 - 1 - GET - 0 - 1 - 0 - - - paypal/payflowadvanced - Authorization - HIGH - - paypal - Credit Card - PayPal - PayPal - PayPal - 1 - 1 - GET - 0 - 1 - 0 - - - paypal/hostedpro - Payment by cards or by PayPal account - Authorization - paypal - 0 - 1 - 0 - - - - - - - - paypal/observer::fetchReports - - - - @@ -334,4 +121,34 @@ -
+ + + + paypal/paypal + PayPal Express Checkout + US + 0 + 1 + capture + 0 + rect + gold + vertical + paypal + 1 + + + + + + + + 0 */3 * * * + + + paypal/cron::processAuthorizationLifecycle + + + + + \ No newline at end of file diff --git a/app/code/core/Mage/Paypal/etc/system.xml b/app/code/core/Mage/Paypal/etc/system.xml index b0afeeed0e6..71e0b5fc3d6 100644 --- a/app/code/core/Mage/Paypal/etc/system.xml +++ b/app/code/core/Mage/Paypal/etc/system.xml @@ -3,4338 +3,202 @@ /** * @copyright For copyright and license information, read the COPYING.txt file. * @link /COPYING.txt - * @license Academic Free License (AFL 3.0) + * @license Open Software License (OSL 3.0) * @package Mage_Paypal */ --> - + - - paypal/adminhtml_system_config_fieldset_hint - https://www.paypal-marketing.com/emarketing/partner/na/merchantlineup/home.page#mainTab=checkoutlineup&subTab=newlineup - 0 + + 1 1 1 - - - - paypal-config + 10 1 - 5 - 1 - 1 - paypal/adminhtml_system_config_fieldset_location + Accept payments with PayPal Express Checkout. + + + + select + adminhtml/system_config_source_yesno + 5 + 1 + 1 + If you want to use PayPal Express Checkout, you must complete + the settings below. + - paypal/general/merchant_country - If not specified, Default Country from General Config will be used + Learn more about PayPal Supported Countries.]]> select - paypal/adminhtml_system_config_field_country paypal/system_config_source_merchantCountry paypal/system_config_backend_merchantCountry 1 1 - 5 + 10 + + 1 + + 1 + + <label>Title</label> + <frontend_type>text</frontend_type> + <sort_order>15</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <comment>Enter the title for the PayPal Express Checkout button.</comment> + <depends> + <active>1</active> + </depends> + <required>1</required> + + + + text + 20 + 1 + 1 + Learn more about PayPal API credentials]]> + + 1 + + 1 + + + + obscure + adminhtml/system_config_backend_encrypted + 30 + 1 + 1 + Learn more about PayPal API credentials]]> + + 1 + + 1 + + + + select + adminhtml/system_config_source_yesno + 40 + 1 + 1 + Enable this option to use the PayPal Sandbox environment for + testing. + + 1 + + 1 + + + + select + paypal/system_config_source_paymentActions + 50 + 1 + 1 + Select whether to authorize or capture the payment immediately. + Note: Authorization is not supported for multishipping orders and + will automatically use capture instead.

When using + Authorize, funds are reserved for up to 29 days, but it's best to + capture within 3 days.
+ + 1 + + 1 +
+ + + select + adminhtml/system_config_source_yesno + 60 + 1 + 1 + Enable this option to log PayPal API requests and responses. + + 1 + + 1 + + + + select + paypal/system_config_source_buttonShapes + 70 + 1 + 1 + Learn more about PayPal button shapes]]> + + 1 + + 1 + + + + select + paypal/system_config_source_buttonColors + 80 + 1 + 1 + Learn more about PayPal button colors]]> + + 1 + + 1 + + + + select + paypal/system_config_source_buttonLayouts + 90 + 1 + 1 + Learn more about PayPal button layouts]]> + + 1 + + 1 + + + + select + paypal/system_config_source_buttonLabels + 100 + 1 + 1 + + Learn more about PayPal button labels]]> + + + 1 + + 1 + + + + select + adminhtml/system_config_source_yesno + 110 + 1 + 1 + Learn more about PayPal button messages]]> + + 1 + + 1 +
-
- - - - 1 - 10 - 1 - 1 - 1 - complex - paypal/adminhtml_system_config_fieldset_group - Choose a secure bundled payment solution for your business. - https://www.paypal-marketing.com/emarketing/partner/na/merchantlineup/home.page#mainTab=checkoutlineup&subTab=newlineup - - - - - 15 - 1 - 1 - 1 - complex - paypal/adminhtml_system_config_fieldset_group - Process payments using your own internet merchant account. - https://merchant.paypal.com/cgi-bin/marketingweb?cmd=_render-content&content_ID=merchant/payment_gateway - - - - - 20 - 1 - 1 - 1 - 1 - complex - paypal/adminhtml_system_config_fieldset_group - Add another payment method to your existing solution or as a stand-alone option. - Select a Payment Solution - https://merchant.paypal.com/cgi-bin/marketingweb?cmd=_render-content&content_ID=merchant/express_checkout - - - - - 10 - 1 - 1 - 1 - 1 - complex - paypal/adminhtml_system_config_fieldset_group - Add another payment method to your existing solution or as a stand-alone option. - Select a Payment Solution - https://www.paypal-marketing.com/emarketing/partner/na/merchantlineup/home.page#mainTab=checkoutlineup&subTab=newlineup - - - - - - - 1 - 1 - 1 - 30 - pp-method-general - paypal/adminhtml_system_config_fieldset_payment - https://www.paypal.com/webapps/mpp/referral/paypal-payments-advanced?partner_id=NB9WWHYEMVUMS - Accept payments with a PCI-compliant checkout that keeps customers on your site. - paypal_group_all_in_one - payment/payflow_advanced/active - - - 1 - - - - - - 1 - 1 - paypal/adminhtml_system_config_fieldset_expanded - 10 - - - - 1 - 1 - paypal/adminhtml_system_config_fieldset_expanded - 10 - - - - payment/payflow_advanced/partner - 10 - 1 - 1 - - - - payment/payflow_advanced/vendor - 20 - 1 - 1 - - - - PayPal recommends that you set up an additional User on your account at manager.paypal.com - PayPal recommends you set up an additional User on your account at manager.paypal.com, instead of entering your admin username and password here. This will enhance your security and prevent service interruptions if you later change your password. If you do not want to set up an additional User, you can re-enter your Merchant Login here. - payment/payflow_advanced/user - 30 - 1 - 1 - - - - payment/payflow_advanced/pwd - obscure - adminhtml/system_config_backend_encrypted - 40 - 1 - 1 - - - - payment/payflow_advanced/sandbox_flag - select - adminhtml/system_config_source_yesno - 50 - 1 - 1 - 1 - - - - payment/payflow_advanced/use_proxy - select - adminhtml/system_config_source_yesno - 60 - 1 - 1 - - - - payment/payflow_advanced/proxy_host - 70 - 1 - 1 - 1 - - - - payment/payflow_advanced/proxy_port - 80 - 1 - 1 - 1 - - - paypal/adminhtml_system_config_payflowlink_advanced - 1 - 1 - 1 - 90 - - - - - - 1 - 1 - paypal/adminhtml_system_config_fieldset_expanded - 20 - - - - Don't have a PayPal account? Simply enter your email address. - paypal/general/business_account - 1 - 1 - 10 - validate-email - 1 - - - - paypal/wpp/api_authentication - select - paypal/config::getApiAuthenticationMethods - 20 - 1 - 1 - 1 - - - - paypal/wpp/api_username - obscure - adminhtml/system_config_backend_encrypted - 30 - 1 - 1 - 1 - - - - paypal/wpp/api_password - obscure - adminhtml/system_config_backend_encrypted - 40 - 1 - 1 - 1 - - - - paypal/wpp/api_signature - adminhtml/system_config_backend_encrypted - obscure - 50 - 1 - 1 - 0 - 1 - - - - paypal/wpp/api_cert - file - paypal/system_config_backend_cert - 60 - 1 - 1 - 1 - 1 - - - - Get Credentials from PayPal - - Sandbox Credentials - - paypal/adminhtml_system_config_apiWizard - 70 - 1 - 1 - - - - paypal/wpp/sandbox_flag - select - adminhtml/system_config_source_yesno - 80 - 1 - 1 - 1 - - - - paypal/wpp/use_proxy - select - adminhtml/system_config_source_yesno - 90 - 1 - 1 - 1 - - - - paypal/wpp/proxy_host - 100 - 1 - 1 - 1 - 1 - - - - paypal/wpp/proxy_port - 110 - 1 - 1 - 1 - 1 - - - - - - payment/payflow_advanced/active - select - adminhtml/system_config_source_yesno - 30 - 1 - 1 - Both section above must be complete. - express,payments_advanced - paypal-enabler - - - Learn More]]> - - 31 - required_settings_enable_payflow_advanced - - - - - Why Advertise Financing?
- Give your sales a boost when you advertise financing.
PayPal helps turn browsers into buyers with financing - from Paypal Credit®. Your customers have more time to pay, while you get paid up front – at no additional cost to you. - Use PayPal’s free banner ads that let you advertise Paypal Credit® financing as a payment option when your customers check out with PayPal. - The PayPal Advertising Program has been shown to generate additional purchases as well as increase consumer's average purchase sizes by 15% - or more. See Details.]]> -
- 1 - 1 - 32 - - - - - - 1 - 1 - 1 - 20 - - - - - - payment/paypal_express_bml/homepage_size - select - paypal/system_config_source_bmlSize::getBmlSizeHPH - 1 - 1 - 30 - 1 - 0 - - - paypal/system_config_source_bmlSize::getBmlSizeHPS - 1 - - - - - - 1 - 1 - 1 - 30 - - - - - - payment/paypal_express_bml/categorypage_size - select - paypal/system_config_source_bmlSize::getBmlSizeCCPC - 1 - 1 - 30 - 1 - 0 - - - paypal/system_config_source_bmlSize::getBmlSizeCCPS - 1 - - - - - - - 1 - 1 - 1 - 40 - - - - - - payment/paypal_express_bml/productpage_size - select - paypal/system_config_source_bmlSize::getBmlSizeCPPC - 1 - 1 - 30 - 1 - 0 - - - paypal/system_config_source_bmlSize::getBmlSizeCPPN - 1 - - - - - - - 1 - 1 - 1 - 50 - - - - - - payment/paypal_express_bml/checkout_size - select - paypal/system_config_source_bmlSize::getBmlSizeCheckoutC - 1 - 1 - 30 - 1 - 0 - - - paypal/system_config_source_bmlSize::getBmlSizeCheckoutN - 1 - 1 - - - - - -
-
-
- - - - 1 - 1 - 1 - paypal/adminhtml_system_config_fieldset_expanded - 20 - - - <label>Title</label> - <comment>It is recommended to set this value to "Debit or Credit Card" per store views.</comment> - <config_path>payment/payflow_advanced/title</config_path> - <sort_order>10</sort_order> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - - - - payment/payflow_advanced/sort_order - 20 - 1 - 1 - 1 - validate-number - - - - payment/payflow_advanced/payment_action - select - paypal/system_config_source_paymentActions - 30 - 1 - 1 - - - - config-advanced - 1 - 1 - 1 - 40 - - - - payment/payflow_advanced/allowspecific - select - adminhtml/system_config_source_payment_allspecificcountries - 20 - 1 - 1 - - - - payment/payflow_advanced/specificcountry - multiselect - paypal/system_config_source_buyerCountry - 25 - 1 - 1 - 1 - - - - payment/payflow_advanced/debug - select - adminhtml/system_config_source_yesno - 30 - 1 - 1 - - - - payment/payflow_advanced/verify_peer - select - adminhtml/system_config_source_yesno - 35 - 1 - 1 - - - - payment/payflow_advanced/csc_editable - select - adminhtml/system_config_source_yesno - 40 - 1 - 1 - - - - payment/payflow_advanced/csc_required - select - adminhtml/system_config_source_yesno - 50 - 1 - 1 - 1 - - - - payment/payflow_advanced/email_confirmation - select - adminhtml/system_config_source_yesno - 60 - 1 - 1 - - - - payment/payflow_advanced/url_method - select - paypal/system_config_source_urlMethod - 70 - 1 - 1 - - - - payment/payflow_advanced/mobile_optimized - select - adminhtml/system_config_source_yesno - 75 - 1 - 1 - - - - 1 - 1 - 1 - 80 - - - - - payment/paypal_billing_agreement/active - select - adminhtml/system_config_source_yesno - 10 - 1 - 1 - 1 - - - <label>Title</label> - <config_path>payment/paypal_billing_agreement/title</config_path> - <sort_order>20</sort_order> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - <shared>1</shared> - - - - payment/paypal_billing_agreement/sort_order - 30 - 1 - 1 - 1 - validate-number - 1 - - - - payment/paypal_billing_agreement/payment_action - select - paypal/system_config_source_paymentActions - 40 - 1 - 1 - 1 - - - - payment/paypal_billing_agreement/allowspecific - select - adminhtml/system_config_source_payment_allspecificcountries - 50 - 1 - 1 - 1 - - - - payment/paypal_billing_agreement/specificcountry - multiselect - paypal/system_config_source_buyerCountry - 60 - 1 - 1 - 1 - 1 - - - - payment/paypal_billing_agreement/debug - select - adminhtml/system_config_source_yesno - 70 - 1 - 1 - 1 - - - - payment/paypal_billing_agreement/verify_peer - select - adminhtml/system_config_source_yesno - 75 - 1 - 1 - 1 - - - - payment/paypal_billing_agreement/line_items_enabled - select - adminhtml/system_config_source_yesno - 80 - 1 - 1 - 1 - - - - payment/paypal_billing_agreement/allow_billing_agreement_wizard - select - adminhtml/system_config_source_yesno - 90 - 1 - 1 - 1 - - - - - - 1 - 1 - 90 - - - - adminhtml/system_config_form_field_heading - 10 - 1 - 1 - - - - paypal/fetch_reports/ftp_login - obscure - adminhtml/system_config_backend_encrypted - 20 - 1 - 1 - 1 - - - - paypal/fetch_reports/ftp_password - obscure - adminhtml/system_config_backend_encrypted - 30 - 1 - 1 - 1 - - - - paypal/fetch_reports/ftp_sandbox - select - adminhtml/system_config_source_yesno - 40 - 1 - 1 - 1 - - - - By default it is "reports.paypal.com". - Use colon to specify port. For example: "test.example.com:5224". - paypal/fetch_reports/ftp_ip - 50 - 1 - 1 - 0 - 1 - - - - By default it is "/ppreports/outgoing". - paypal/fetch_reports/ftp_path - 60 - 1 - 1 - 0 - 1 - - - - adminhtml/system_config_form_field_heading - 70 - 1 - 1 - 1 - - - - paypal/fetch_reports/active - select - adminhtml/system_config_source_yesno - 80 - 1 - 1 - 1 - - - - PayPal retains reports for 45 days. - paypal/fetch_reports/schedule - select - paypal/system_config_source_fetchingSchedule - 90 - 1 - 1 - - - - paypal/fetch_reports/time - time - 100 - 1 - 1 - - - - - - 1 - 1 - 1 - 100 - - - - Displays on catalog pages and homepage. - paypal/style/logo - select - paypal/system_config_source_logo - 10 - 1 - 1 - 1 - 1 - - - - adminhtml/system_config_form_field_heading - 20 - 1 - 1 - 1 - 1 - - - - paypal/style/page_style - - 30 - 1 - 1 - 1 - 1 - - - - paypal/style/paypal_hdrimg - https is highly encouraged.]]> - 40 - 1 - 1 - 1 - 1 - - - - paypal/style/paypal_hdrbackcolor - - 50 - 1 - 1 - 1 - 1 - - - - paypal/style/paypal_hdrbordercolor - 2-pixel perimeter around the header space. - 60 - 1 - 1 - 1 - 1 - - - - paypal/style/paypal_payflowcolor - - 70 - 1 - 1 - 1 - 1 - - - - - - - - - - 1 - 1 - 1 - paypal/adminhtml_system_config_fieldset_expanded - 30 - - - <label>Title</label> - <comment>It is recommended to set this value to "PayPal" per store views.</comment> - <config_path>payment/paypal_express/title</config_path> - <sort_order>10</sort_order> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - <shared>1</shared> - - - - payment/paypal_express/sort_order - 20 - 1 - 1 - 1 - validate-number - 1 - - - - payment/paypal_express/payment_action - select - paypal/system_config_source_paymentActions_express - 30 - 1 - 1 - 1 - - - - payment/paypal_express/visible_on_product - select - adminhtml/system_config_source_yesno - 40 - 1 - 1 - 1 - 1 - - - - Specifies what the Authorization Honor Period is on the merchant’s PayPal account. It must mirror the setting in PayPal. - payment/paypal_express/authorization_honor_period - 50 - 1 - 1 - 1 - Order - - - - Specifies what the Order Valid Period is on the merchant’s PayPal account. It must mirror the setting in PayPal. - payment/paypal_express/order_valid_period - 60 - 1 - 1 - 1 - Order - - - - The default number of child authorizations in your PayPal account is 1. To do multiple authorizations please contact PayPal to request an increase. - payment/paypal_express/child_authorization_number - 70 - 1 - 1 - 1 - Order - - - - config-advanced - 1 - 1 - 1 - 80 - - - - payment/paypal_express/visible_on_cart - Also affects mini-shopping cart. - select - paypal/system_config_source_yesnoShortcut - 5 - 1 - 1 - 1 - 1 - - - - payment/paypal_express/allowspecific - select - adminhtml/system_config_source_payment_allspecificcountries - 10 - 1 - 1 - 1 - - - - payment/paypal_express/specificcountry - multiselect - paypal/system_config_source_buyerCountry - 20 - 1 - 1 - 1 - 1 - - - - payment/paypal_express/debug - select - adminhtml/system_config_source_yesno - 30 - 1 - 1 - 1 - - - - payment/paypal_express/verify_peer - select - adminhtml/system_config_source_yesno - 35 - 1 - 1 - 1 - - - - payment/paypal_express/line_items_enabled - select - adminhtml/system_config_source_yesno - 40 - 1 - 1 - 1 - - - - payment/paypal_express/transfer_shipping_options - If this option is enabled, customer can change shipping address and shipping method on PayPal website. In live mode works via HTTPS protocol only. - Notice that PayPal can handle up to 10 shipping options. That is why Magento will transfer only first 10 cheapest shipping options if there are more than 10 available. - select - adminhtml/system_config_source_yesno - 50 - 1 - 1 - 1 - 1 - - - - paypal/wpp/button_flavor - select - paypal/config::getExpressCheckoutButtonFlavors - 60 - 1 - 1 - 1 - 1 - - - - Ability for buyer to purchase without PayPal account. - payment/paypal_express/solution_type - select - paypal/adminhtml_system_config_field_solutionType - paypal/config::getExpressCheckoutSolutionTypes - 70 - 1 - 1 - 1 - - - - This feature needs be enabled first for the merchant account through PayPal technical support. - payment/paypal_express/require_billing_address - select - paypal/system_config_source_requireBillingAddress - 80 - 1 - 1 - 1 - - - - Whether to create a billing agreement, if there are no active billing agreements available. - - payment/paypal_express/allow_ba_signup - select - paypal/config::getExpressCheckoutBASignupOptions - 90 - 1 - 1 - 1 - - - - payment/paypal_express/skip_order_review_step - select - adminhtml/system_config_source_yesno - 95 - 1 - 1 - 1 - - - - - -
-
- - - 1 - 1 - 1 - 40 - paypal_payment_solutions - pp-method-general - paypal/adminhtml_system_config_fieldset_payment - Accept payments with a completely customizable checkout. - payment/paypal_direct/active - https://www.paypal.com/webapps/mpp/referral/website-payments-pro?partner_id=NB9WWHYEMVUMS - - - 1 - 10 - - - 1 - paypal_group_all_in_one - pp-general-uk - 20 - https://www.paypal-business.co.uk/process-online-payments-with-paypal/index.htm - http://www.youtube.com/watch?v=LBe-TW87eGI&list=PLF18B1094ABCD7CE8&index=1&feature=plpp_video - Accept payments with a completely customizable checkout page. - - - - 1 - paypal_group_all_in_one - - - - - - - - Learn More]]> - - 21 - wpp_required_settings_enable_wpp - - - - - Why Advertise Financing?
- Give your sales a boost when you advertise financing.
PayPal helps turn browsers into buyers with financing - from Paypal Credit®. Your customers have more time to pay, while you get paid up front – at no additional cost to you. - Use PayPal’s free banner ads that let you advertise Paypal Credit® financing as a payment option when your customers check out with PayPal. - The PayPal Advertising Program has been shown to generate additional purchases as well as increase consumer's average purchase sizes by 15% - or more. See Details.]]> -
- 1 - 1 - 22 - - - - - - 1 - 1 - 1 - 20 - - - - - - payment/paypal_express_bml/homepage_size - select - paypal/system_config_source_bmlSize::getBmlSizeHPH - 1 - 1 - 30 - 1 - 0 - - - paypal/system_config_source_bmlSize::getBmlSizeHPS - 1 - - - - - - 1 - 1 - 1 - 30 - - - - - - payment/paypal_express_bml/categorypage_size - select - paypal/system_config_source_bmlSize::getBmlSizeCCPC - 1 - 1 - 30 - 1 - 0 - - - paypal/system_config_source_bmlSize::getBmlSizeCCPS - 1 - - - - - - - 1 - 1 - 1 - 40 - - - - - - payment/paypal_express_bml/productpage_size - select - paypal/system_config_source_bmlSize::getBmlSizeCPPC - 1 - 1 - 30 - 1 - 0 - - - paypal/system_config_source_bmlSize::getBmlSizeCPPN - 1 - - - - - - - 1 - 1 - 1 - 50 - - - - - - payment/paypal_express_bml/checkout_size - select - paypal/system_config_source_bmlSize::getBmlSizeCheckoutC - 1 - 1 - 30 - 1 - 0 - - - paypal/system_config_source_bmlSize::getBmlSizeCheckoutN - 1 - 1 - - - - - -
-
-
- - - -
-
-
- - - - 1 - 1 - paypal/adminhtml_system_config_fieldset_expanded - 10 - - - - 1 - 1 - paypal/adminhtml_system_config_fieldset_expanded - 10 - - - - - - - - - - - - - - - - - - payment/paypal_direct/active - select - adminhtml/system_config_source_yesno - 20 - 1 - 1 - wpp_and_express_checkout - paypal-enabler - - - - - - - - 1 - 1 - 1 - paypal/adminhtml_system_config_fieldset_expanded - 20 - - - <label>Title</label> - <comment>It is recommended to set this value to "Debit or Credit Card" per store views.</comment> - <config_path>payment/paypal_direct/title</config_path> - <sort_order>10</sort_order> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - - - - payment/paypal_direct/sort_order - 20 - 1 - 1 - 1 - validate-number - - - - payment/paypal_direct/payment_action - select - paypal/system_config_source_paymentActions - 30 - 1 - 1 - - - - adminhtml/system_config_form_field_heading - 40 - 1 - 1 - - - - http://www.paypal.com/amexupdate.]]> - payment/paypal_direct/cctypes - multiselect - paypal/config::getWppCcTypesAsOptionArray - 50 - 1 - 1 - - - - config-advanced - 1 - 1 - 1 - 60 - - - - payment/paypal_direct/allowspecific - select - adminhtml/system_config_source_payment_allspecificcountries - 20 - 1 - 1 - - - - payment/paypal_direct/specificcountry - multiselect - paypal/system_config_source_buyerCountry - 25 - 1 - 1 - 1 - - - - payment/paypal_direct/debug - select - adminhtml/system_config_source_yesno - 30 - 1 - 1 - - - - payment/paypal_direct/verify_peer - select - adminhtml/system_config_source_yesno - 35 - 1 - 1 - - - - payment/paypal_direct/line_items_enabled - select - adminhtml/system_config_source_yesno - 40 - 1 - 1 - - - - payment/paypal_direct/useccv - select - adminhtml/system_config_source_yesno - 50 - 1 - 1 - - - - adminhtml/system_config_form_field_heading - 55 - 1 - 1 - - - - payment/paypal_direct/centinel - select - adminhtml/system_config_source_yesno - 60 - 1 - 1 - - - - payment/paypal_direct/centinel_is_mode_strict - Severe Validation Removes Chargeback Liability on Merchant - select - adminhtml/system_config_source_yesno - 65 - 1 - 1 - 1 - - - - payment/paypal_direct/centinel_api_url - If empty, a default value will be used. Custom URL may be provided by CardinalCommerce agreement. - adminhtml/system_config_source_yesno - 70 - 1 - 1 - 1 - - - - 1 - 1 - 1 - 80 - - - - <sort_order extends="//paypal_payments/payflow_advanced//billing_agreement/*/sort_order" /> - <payment_action extends="//paypal_payments/payflow_advanced//billing_agreement/*/payment_action" /> - <allowspecific extends="//paypal_payments/payflow_advanced//billing_agreement/*/allowspecific" /> - <specificcountry extends="//paypal_payments/payflow_advanced//billing_agreement/*/specificcountry" /> - <debug extends="//paypal_payments/payflow_advanced//billing_agreement/*/debug" /> - <verify_peer extends="//paypal_payments/payflow_advanced//billing_agreement/*/verify_peer" /> - <line_items_enabled extends="//paypal_payments/payflow_advanced//billing_agreement/*/line_items_enabled" /> - <allow_billing_agreement_wizard extends="//paypal_payments/payflow_advanced//billing_agreement/*/allow_billing_agreement_wizard" /> - </fields> - </wpp_billing_agreement> - <wpp_settlement_report type="group" translate="label"> - <label>Settlement Report Settings</label> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <sort_order>90</sort_order> - <fields> - <heading_sftp extends="//paypal_payments/payflow_advanced//settlement_report/*/heading_sftp" /> - <settlement_reports_ftp_login extends="//paypal_payments/payflow_advanced//settlement_report/*/settlement_reports_ftp_login" /> - <settlement_reports_ftp_password extends="//paypal_payments/payflow_advanced//settlement_report/*/settlement_reports_ftp_password" /> - <settlement_reports_ftp_sandbox extends="//paypal_payments/payflow_advanced//settlement_report/*/settlement_reports_ftp_sandbox" /> - <settlement_reports_ftp_ip extends="//paypal_payments/payflow_advanced//settlement_report/*/settlement_reports_ftp_ip" /> - <settlement_reports_ftp_path extends="//paypal_payments/payflow_advanced//settlement_report/*/settlement_reports_ftp_path" /> - <heading_schedule extends="//paypal_payments/payflow_advanced//settlement_report/*/heading_schedule" /> - <settlement_reports_active extends="//paypal_payments/payflow_advanced//settlement_report/*/settlement_reports_active" /> - <settlement_reports_schedule extends="//paypal_payments/payflow_advanced//settlement_report/*/settlement_reports_schedule" /> - <settlement_reports_time extends="//paypal_payments/payflow_advanced//settlement_report/*/settlement_reports_time" /> - </fields> - </wpp_settlement_report> - <wpp_frontend type="group" translate="label"> - <label>Frontend Experience Settings</label> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - <sort_order>100</sort_order> - <fields> - <logo extends="//paypal_payments/payflow_advanced//frontend/*/logo" /> - <paypal_pages extends="//paypal_payments/payflow_advanced//frontend/*/paypal_pages" /> - <page_style extends="//paypal_payments/payflow_advanced//frontend/*/page_style" /> - <paypal_hdrimg extends="//paypal_payments/payflow_advanced//frontend/*/paypal_hdrimg" /> - <paypal_hdrbackcolor extends="//paypal_payments/payflow_advanced//frontend/*/paypal_hdrbackcolor" /> - <paypal_hdrbordercolor extends="//paypal_payments/payflow_advanced//frontend/*/paypal_hdrbordercolor" /> - <paypal_payflowcolor extends="//paypal_payments/payflow_advanced//frontend/*/paypal_payflowcolor" /> - </fields> - </wpp_frontend> - </fields> - </wpp_settings_advanced> - </fields> - </wpp_settings> - - <wpp_settings_express_checkout type="group" translate="label"> - <label>Basic Settings - PayPal Express Checkout</label> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - <frontend_model>paypal/adminhtml_system_config_fieldset_expanded</frontend_model> - <sort_order>30</sort_order> - <fields> - <title extends="//paypal_payments/payflow_advanced//settings_express_checkout/*/title" /> - <sort_order extends="//paypal_payments/payflow_advanced//settings_express_checkout/*/sort_order" /> - <payment_action extends="//paypal_payments/payflow_advanced//settings_express_checkout/*/payment_action" /> - <visible_on_product extends="//paypal_payments/payflow_advanced//settings_express_checkout/*/visible_on_product" /> - <authorization_honor_period extends="//paypal_payments/payflow_advanced//settings_express_checkout/*/authorization_honor_period" /> - <order_valid_period extends="//paypal_payments/payflow_advanced//settings_express_checkout/*/order_valid_period" /> - <child_authorization_number extends="//paypal_payments/payflow_advanced//settings_express_checkout/*/child_authorization_number" /> - - <wpp_settings_express_checkout_advanced type="group" translate="label"> - <label>Advanced Settings</label> - <frontend_class>config-advanced</frontend_class> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - <sort_order>80</sort_order> - <fields> - <visible_on_cart extends="//paypal_payments/payflow_advanced//settings_express_checkout//visible_on_cart" /> - <allowspecific extends="//paypal_payments/payflow_advanced//settings_express_checkout//allowspecific" /> - <specificcountry extends="//paypal_payments/payflow_advanced//settings_express_checkout//specificcountry" /> - <debug extends="//paypal_payments/payflow_advanced//settings_express_checkout//debug" /> - <verify_peer extends="//paypal_payments/payflow_advanced//settings_express_checkout//verify_peer" /> - <line_items_enabled extends="//paypal_payments/payflow_advanced//settings_express_checkout//line_items_enabled" /> - <transfer_shipping_options extends="//paypal_payments/payflow_advanced//settings_express_checkout//transfer_shipping_options" /> - <button_flavor extends="//paypal_payments/payflow_advanced//settings_express_checkout//button_flavor" /> - <solution_type extends="//paypal_payments/payflow_advanced//settings_express_checkout//solution_type" /> - <require_billing_address extends="//paypal_payments/payflow_advanced//settings_express_checkout//require_billing_address" /> - <allow_ba_signup extends="//paypal_payments/payflow_advanced//settings_express_checkout//allow_ba_signup" /> - <skip_order_review_step extends="//paypal_payments/payflow_advanced//settings_express_checkout//skip_order_review_step" /> - </fields> - </wpp_settings_express_checkout_advanced> - </fields> - </wpp_settings_express_checkout> - </fields> - </wpp> - <wps type="group" translate="label comment"> - <label>Website Payments Standard</label> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - <sort_order>50</sort_order> - <group>paypal_payment_solutions</group> - <include>1</include> - <frontend_class>pp-method-general</frontend_class> - <frontend_model>paypal/adminhtml_system_config_fieldset_deprecated</frontend_model> - <was_enabled_path>payment/paypal_standard/was_active</was_enabled_path> - <comment>Accept credit card and PayPal payments securely.</comment> - <activity_path>payment/paypal_standard/active</activity_path> - <learn_more_link>https://www.paypal.com/webapps/mpp/referral/website-payments-standard?partner_id=NB9WWHYEMVUMS</learn_more_link> - <backend_config> - <AU> - <sort_order>20</sort_order> - </AU> - <CA> - <sort_order>20</sort_order> - </CA> - <US translate="label"> - <label>Payments Standard</label> - <group>paypal_group_all_in_one</group> - <fields> - <settings_payments_standart translate="label"> - <label>Basic Settings - PayPal Payments Standard</label> - </settings_payments_standart> - </fields> - </US> - <GB translate="comment"> - <group>paypal_group_all_in_one</group> - <frontend_class>pp-general-uk</frontend_class> - <sort_order>10</sort_order> - <learn_more_link>https://www.paypal-business.co.uk/accept-online-payments-with-paypal/index.htm</learn_more_link> - <demo_link>http://www.youtube.com/watch?v=mdPjvziH_rk&list=PLF18B1094ABCD7CE8&index=6&feature=plpp_video</demo_link> - <comment>Accept credit cards, debit cards and PayPal payments securely.</comment> - </GB> - </backend_config> - <fields> - <wps_required_settings type="group" translate="label"> - <label>Required PayPal Settings</label> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <frontend_model>paypal/adminhtml_system_config_fieldset_expanded</frontend_model> - <sort_order>10</sort_order> - <fields> - <business_account extends="//paypal_payments/payflow_advanced//business_account" /> - <enable_wps translate="label"> - <label>Enable this Solution</label> - <config_path>payment/paypal_standard/active</config_path> - <frontend_type>select</frontend_type> - <source_model>adminhtml/system_config_source_yesno</source_model> - <sort_order>20</sort_order> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <requires>wps_required_settings_business_account</requires> - <frontend_class>paypal-enabler paypal-ec-conflicts</frontend_class> - </enable_wps> - </fields> - </wps_required_settings> - <settings_payments_standart type="group" translate="label"> - <label>Basic Settings - PayPal Website Payments Standard</label> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - <frontend_model>paypal/adminhtml_system_config_fieldset_expanded</frontend_model> - <sort_order>20</sort_order> - <fields> - <title translate="label comment"> - <label>Title</label> - <comment>It is recommended to set this value to "PayPal" per store views.</comment> - <config_path>payment/paypal_standard/title</config_path> - <sort_order>10</sort_order> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - - - - payment/paypal_standard/sort_order - 20 - 1 - 1 - 1 - validate-number - - - - payment/paypal_standard/payment_action - select - paypal/system_config_source_paymentActions - 30 - 1 - 1 - - - - config-advanced - 1 - 1 - 40 - - - - payment/paypal_standard/allowspecific - select - adminhtml/system_config_source_payment_allspecificcountries - 10 - 1 - 1 - - - - payment/paypal_standard/specificcountry - multiselect - paypal/system_config_source_buyerCountry - 20 - 1 - 1 - 1 - - - - payment/paypal_standard/sandbox_flag - select - adminhtml/system_config_source_yesno - 30 - 1 - 1 - - - - payment/paypal_standard/line_items_enabled - select - adminhtml/system_config_source_yesno - 40 - 1 - 1 - - - - payment/paypal_standard/line_items_summary - Uses store frontend name by default. - 50 - 1 - 1 - 1 - 0 - - - - payment/paypal_standard/debug - select - adminhtml/system_config_source_yesno - 60 - 1 - 1 - - - - payment/paypal_standard/verify_peer - select - adminhtml/system_config_source_yesno - 70 - 1 - 1 - - - - - - - - - - 1 - 1 - 1 - 50 - paypal_payment_solutions - 1 - pp-method-general - paypal/adminhtml_system_config_fieldset_pathDependent - payment/paypal_standard/active - Add PayPal as an additional payment method to your checkout page. - payment/paypal_wps_express/active - https://www.paypal.com/webapps/mpp/referral/paypal-express-checkout?partner_id=NB9WWHYEMVUMS - - - 20 - - - 20 - - - - paypal_group_all_in_one - - - - - - - - wps_express_checkout_required_enable_wps_express_checkout - - - - - Why Advertise Financing?
- Give your sales a boost when you advertise financing.
PayPal helps turn browsers into buyers with financing - from Paypal Credit®. Your customers have more time to pay, while you get paid up front – at no additional cost to you. - Use PayPal’s free banner ads that let you advertise Paypal Credit® financing as a payment option when your customers check out with PayPal. - The PayPal Advertising Program has been shown to generate additional purchases as well as increase consumer's average purchase sizes by 15% - or more. See Details.]]> -
- 1 - 1 - 32 - - - - - - 1 - 1 - 1 - 20 - - - - - - payment/paypal_express_bml/homepage_size - select - paypal/system_config_source_bmlSize::getBmlSizeHPH - 1 - 1 - 30 - 1 - 0 - - - 1 - - - - - - 1 - 1 - 1 - 30 - - - - - - payment/paypal_express_bml/categorypage_size - select - paypal/system_config_source_bmlSize::getBmlSizeCCPC - 1 - 1 - 30 - 1 - 0 - - - paypal/system_config_source_bmlSize::getBmlSizeCCPS - 1 - - - - - - - 1 - 1 - 1 - 40 - - - - - - payment/paypal_express_bml/productpage_size - select - paypal/system_config_source_bmlSize::getBmlSizeCPPC - 1 - 1 - 30 - 1 - 0 - - - paypal/system_config_source_bmlSize::getBmlSizeCPPN - 1 - - - - - - - 1 - 1 - 1 - 50 - - - - - - payment/paypal_express_bml/checkout_size - select - paypal/system_config_source_bmlSize::getBmlSizeCheckoutC - 1 - 1 - 30 - 1 - 0 - - - paypal/system_config_source_bmlSize::getBmlSizeCheckoutN - 1 - 1 - - - - -
-
-
- - - -
-
- - https://www.paypal-business.co.uk/add-paypal-to-online-shop/index.htm - http://www.youtube.com/watch?v=WgnfZ2Bj6hQ - Add PayPal as an additional payment method to your checkout page to increase your sales. - -
- - - - 1 - 1 - 10 - paypal/adminhtml_system_config_fieldset_expanded - - - - 1 - 1 - paypal/adminhtml_system_config_fieldset_expanded - 10 - - - - - - - - - - - - - - - - - payment/paypal_wps_express/active - select - adminhtml/system_config_source_yesno - 20 - 1 - 1 - 1 - wps_express_checkout_required_express_checkout - paypal-enabler - - - - - - 1 - 1 - 1 - paypal/adminhtml_system_config_fieldset_expanded - 20 - - - <sort_order extends="//paypal_payments/payflow_advanced//settings_express_checkout/*/sort_order" /> - <payment_action extends="//paypal_payments/payflow_advanced//settings_express_checkout/*/payment_action" /> - <visible_on_product extends="//paypal_payments/payflow_advanced//settings_express_checkout/*/visible_on_product" /> - <authorization_honor_period extends="//paypal_payments/payflow_advanced//settings_express_checkout/*/authorization_honor_period" /> - <order_valid_period extends="//paypal_payments/payflow_advanced//settings_express_checkout/*/order_valid_period" /> - <child_authorization_number extends="//paypal_payments/payflow_advanced//settings_express_checkout/*/child_authorization_number" /> - - <settings_wps_express_advanced type="group" translate="label"> - <label>Advanced Settings</label> - <frontend_class>config-advanced</frontend_class> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - <sort_order>80</sort_order> - <fields> - <visible_on_cart extends="//paypal_payments/payflow_advanced//settings_express_checkout//visible_on_cart" /> - <allowspecific extends="//paypal_payments/payflow_advanced//settings_express_checkout//allowspecific" /> - <specificcountry extends="//paypal_payments/payflow_advanced//settings_express_checkout//specificcountry" /> - <debug extends="//paypal_payments/payflow_advanced//settings_express_checkout//debug" /> - <verify_peer extends="//paypal_payments/payflow_advanced//settings_express_checkout//verify_peer" /> - <line_items_enabled extends="//paypal_payments/payflow_advanced//settings_express_checkout//line_items_enabled" /> - <transfer_shipping_options extends="//paypal_payments/payflow_advanced//settings_express_checkout//transfer_shipping_options" /> - <button_flavor extends="//paypal_payments/payflow_advanced//settings_express_checkout//button_flavor" /> - <solution_type extends="//paypal_payments/payflow_advanced//settings_express_checkout//solution_type" /> - <require_billing_address extends="//paypal_payments/payflow_advanced//settings_express_checkout//require_billing_address" /> - <allow_ba_signup extends="//paypal_payments/payflow_advanced//settings_express_checkout//allow_ba_signup" /> - <skip_order_review_step extends="//paypal_payments/payflow_advanced//settings_express_checkout//skip_order_review_step" /> - - <wps_express_billing_agreement type="group" translate="label"> - <label>PayPal Billing Agreement Settings</label> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - <sort_order>100</sort_order> - <fields> - <active extends="//paypal_payments/payflow_advanced//billing_agreement/*/active" /> - <title extends="//paypal_payments/payflow_advanced//billing_agreement/*/title" /> - <sort_order extends="//paypal_payments/payflow_advanced//billing_agreement/*/sort_order" /> - <payment_action extends="//paypal_payments/payflow_advanced//billing_agreement/*/payment_action" /> - <allowspecific extends="//paypal_payments/payflow_advanced//billing_agreement/*/allowspecific" /> - <specificcountry extends="//paypal_payments/payflow_advanced//billing_agreement/*/specificcountry" /> - <debug extends="//paypal_payments/payflow_advanced//billing_agreement/*/debug" /> - <verify_peer extends="//paypal_payments/payflow_advanced//billing_agreement/*/verify_peer" /> - <line_items_enabled extends="//paypal_payments/payflow_advanced//billing_agreement/*/line_items_enabled" /> - <allow_billing_agreement_wizard extends="//paypal_payments/payflow_advanced//billing_agreement/*/allow_billing_agreement_wizard" /> - </fields> - </wps_express_billing_agreement> - <wps_express_settlement_report type="group" translate="label"> - <label>Settlement Report Settings</label> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <sort_order>110</sort_order> - <fields> - <heading_sftp extends="//paypal_payments/payflow_advanced//settlement_report/*/heading_sftp" /> - <settlement_reports_ftp_login extends="//paypal_payments/payflow_advanced//settlement_report/*/settlement_reports_ftp_login" /> - <settlement_reports_ftp_password extends="//paypal_payments/payflow_advanced//settlement_report/*/settlement_reports_ftp_password" /> - <settlement_reports_ftp_sandbox extends="//paypal_payments/payflow_advanced//settlement_report/*/settlement_reports_ftp_sandbox" /> - <settlement_reports_ftp_ip extends="//paypal_payments/payflow_advanced//settlement_report/*/settlement_reports_ftp_ip" /> - <settlement_reports_ftp_path extends="//paypal_payments/payflow_advanced//settlement_report/*/settlement_reports_ftp_path" /> - <heading_schedule extends="//paypal_payments/payflow_advanced//settlement_report/*/heading_schedule" /> - <settlement_reports_active extends="//paypal_payments/payflow_advanced//settlement_report/*/settlement_reports_active" /> - <settlement_reports_schedule extends="//paypal_payments/payflow_advanced//settlement_report/*/settlement_reports_schedule" /> - <settlement_reports_time extends="//paypal_payments/payflow_advanced//settlement_report/*/settlement_reports_time" /> - </fields> - </wps_express_settlement_report> - <wps_express_frontend type="group" translate="label"> - <label>Frontend Experience Settings</label> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - <sort_order>120</sort_order> - <fields> - <logo extends="//paypal_payments/payflow_advanced//frontend/*/logo" /> - <paypal_pages extends="//paypal_payments/payflow_advanced//frontend/*/paypal_pages" /> - <page_style extends="//paypal_payments/payflow_advanced//frontend/*/page_style" /> - <paypal_hdrimg extends="//paypal_payments/payflow_advanced//frontend/*/paypal_hdrimg" /> - <paypal_hdrbackcolor extends="//paypal_payments/payflow_advanced//frontend/*/paypal_hdrbackcolor" /> - <paypal_hdrbordercolor extends="//paypal_payments/payflow_advanced//frontend/*/paypal_hdrbordercolor" /> - <paypal_payflowcolor extends="//paypal_payments/payflow_advanced//frontend/*/paypal_payflowcolor" /> - </fields> - </wps_express_frontend> - </fields> - </settings_wps_express_advanced> - </fields> - </settings_wps_express> - </fields> - </wps_express> - <paypal_verisign type="group" translate="label comment"> - <label>Payflow Pro</label> - <frontend_model>paypal/adminhtml_system_config_fieldset_payment</frontend_model> - <frontend_class>pp-method-payflow</frontend_class> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - <sort_order>10</sort_order> - <group>paypal_payment_solutions</group> - <comment>Connect your merchant account with a fully customizable gateway that lets customers pay without leaving your site.</comment> - <activity_path>payment/verisign/active</activity_path> - <learn_more_link>https://www.paypal.com/webapps/mpp/referral/paypal-payflow-pro?partner_id=NB9WWHYEMVUMS</learn_more_link> - <paypal_ec_separate>1</paypal_ec_separate> - <backend_config> - <CA> - <include>1</include> - <sort_order>30</sort_order> - </CA> - <AU> - <include>1</include> - <sort_order>20</sort_order> - </AU> - <NZ> - <include>1</include> - <sort_order>20</sort_order> - </NZ> - </backend_config> - <fields> - <paypal_payflow_required type="group" translate="label"> - <label>Required PayPal Settings</label> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <frontend_model>paypal/adminhtml_system_config_fieldset_expanded</frontend_model> - <sort_order>10</sort_order> - <fields> - <paypal_payflow_api_settings type="group" translate="label"> - <label>Payflow Pro</label> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <frontend_model>paypal/adminhtml_system_config_fieldset_expanded</frontend_model> - <sort_order>10</sort_order> - <fields> - <partner translate="label"> - <label>Partner</label> - <config_path>payment/verisign/partner</config_path> - <sort_order>20</sort_order> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - </partner> - <user translate="label"> - <label>User</label> - <config_path>payment/verisign/user</config_path> - <frontend_type>obscure</frontend_type> - <backend_model>adminhtml/system_config_backend_encrypted</backend_model> - <sort_order>30</sort_order> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - </user> - <vendor translate="label"> - <label>Vendor</label> - <config_path>payment/verisign/vendor</config_path> - <sort_order>40</sort_order> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - </vendor> - <pwd translate="label"> - <label>Password</label> - <config_path>payment/verisign/pwd</config_path> - <frontend_type>obscure</frontend_type> - <backend_model>adminhtml/system_config_backend_encrypted</backend_model> - <sort_order>50</sort_order> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - </pwd> - <sandbox_flag translate="label"> - <label>Test Mode</label> - <config_path>payment/verisign/sandbox_flag</config_path> - <frontend_type>select</frontend_type> - <source_model>adminhtml/system_config_source_yesno</source_model> - <sort_order>60</sort_order> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - </sandbox_flag> - <use_proxy translate="label"> - <label>Use Proxy</label> - <config_path>payment/verisign/use_proxy</config_path> - <frontend_type>select</frontend_type> - <source_model>adminhtml/system_config_source_yesno</source_model> - <sort_order>70</sort_order> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - </use_proxy> - <proxy_host translate="label"> - <label>Proxy Host</label> - <config_path>payment/verisign/proxy_host</config_path> - <sort_order>80</sort_order> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <depends><use_proxy>1</use_proxy></depends> - </proxy_host> - <proxy_port translate="label"> - <label>Proxy Port</label> - <config_path>payment/verisign/proxy_port</config_path> - <sort_order>90</sort_order> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <depends><use_proxy>1</use_proxy></depends> - </proxy_port> - </fields> - </paypal_payflow_api_settings> - <enable_paypal_payflow translate="label"> - <label>Enable this Solution</label> - <config_path>payment/verisign/active</config_path> - <frontend_type>select</frontend_type> - <source_model>adminhtml/system_config_source_yesno</source_model> - <sort_order>20</sort_order> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <requires>paypal_payflow_api_settings</requires> - <frontend_class>paypal-enabler paypal-ec-separate</frontend_class> - </enable_paypal_payflow> - </fields> - </paypal_payflow_required> - <settings_paypal_payflow type="group" translate="label"> - <label>Basic Settings - PayPal Payflow Pro</label> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - <frontend_model>paypal/adminhtml_system_config_fieldset_expanded</frontend_model> - <sort_order>20</sort_order> - <fields> - <title translate="label comment"> - <label>Title</label> - <comment>It is recommended to set this value to "Debit or Credit Card" per store views.</comment> - <config_path>payment/verisign/title</config_path> - <sort_order>10</sort_order> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - - - - payment/verisign/sort_order - 20 - 1 - 1 - 1 - validate-number - - - - payment/verisign/payment_action - select - paypal/system_config_source_paymentActions - 30 - 1 - 1 - - - - adminhtml/system_config_form_field_heading - 40 - 1 - 1 - - - - http://www.paypal.com/amexupdate.]]> - payment/verisign/cctypes - multiselect - paypal/config::getPayflowproCcTypesAsOptionArray - 50 - 1 - 1 - - - - config-advanced - 1 - 1 - 1 - 60 - - - - payment/verisign/allowspecific - select - 10 - adminhtml/system_config_source_payment_allspecificcountries - 1 - 1 - - - - payment/verisign/specificcountry - multiselect - 20 - paypal/system_config_source_buyerCountry - 1 - 1 - 1 - - - - payment/verisign/debug - select - adminhtml/system_config_source_yesno - 30 - 1 - 1 - - - - payment/verisign/verify_peer - select - adminhtml/system_config_source_yesno - 35 - 1 - 1 - - - - payment/verisign/useccv - select - adminhtml/system_config_source_yesno - 40 - 1 - 1 - - - - adminhtml/system_config_form_field_heading - 50 - 1 - 1 - - - - payment/verisign/centinel - select - adminhtml/system_config_source_yesno - 60 - 1 - 1 - - - - payment/verisign/centinel_is_mode_strict - Severe validation removes chargeback liability on merchant. - select - adminhtml/system_config_source_yesno - 70 - 1 - 1 - 1 - - - - payment/verisign/centinel_api_url - A value is required for live mode. Refer to your CardinalCommerce agreement. - adminhtml/system_config_source_yesno - 80 - 1 - 1 - 1 - - - - 1 - 1 - 90 - - - - - - - - - - - - - - - - - - - - - - 0 - - - 0 - - - 0 - - - 1 - paypal_payment_gateways - - - - - - - 10 - not-required - - - - - - paypal-enabler paypal-ec-pe - - - - Learn More]]> - - payment/paypaluk_express_bml/active - select - adminhtml/system_config_source_yesno - 21 - 1 - 1 - 1 - paypal-bml - paypal_payflow_required_enable_paypal_payflow - - - - - Why Advertise Financing?
- Give your sales a boost when you advertise financing.
PayPal helps turn browsers into buyers with financing - from Paypal Credit®. Your customers have more time to pay, while you get paid up front – at no additional cost to you. - Use PayPal’s free banner ads that let you advertise Paypal Credit® financing as a payment option when your customers check out with PayPal. - The PayPal Advertising Program has been shown to generate additional purchases as well as increase consumer's average purchase sizes by 15% - or more. See Details.]]> -
- 1 - 1 - 22 - - - - - - 1 - 1 - 1 - 20 - - - - - - payment/paypal_express_bml/homepage_size - select - paypal/system_config_source_bmlSize::getBmlSizeHPH - 1 - 1 - 30 - 1 - 0 - - - paypal/system_config_source_bmlSize::getBmlSizeHPS - 1 - - - - - - 1 - 1 - 1 - 30 - - - - - - payment/paypal_express_bml/categorypage_size - select - paypal/system_config_source_bmlSize::getBmlSizeCCPC - 1 - 1 - 30 - 1 - 0 - - - paypal/system_config_source_bmlSize::getBmlSizeCCPS - 1 - - - - - - - 1 - 1 - 1 - 40 - - - - - - payment/paypal_express_bml/productpage_size - select - paypal/system_config_source_bmlSize::getBmlSizeCPPC - 1 - 1 - 30 - 1 - 0 - - - paypal/system_config_source_bmlSize::getBmlSizeCPPN - 1 - - - - - - - 1 - 1 - 1 - 50 - - - - - - payment/paypal_express_bml/checkout_size - select - paypal/system_config_source_bmlSize::getBmlSizeCheckoutC - 1 - 1 - 30 - 1 - 0 - - - paypal/system_config_source_bmlSize::getBmlSizeCheckoutN - 1 - 1 - - - - - -
- -
-
-
-
- - 0 - -
- - - - 1 - 1 - 10 - - - - - - - - - - - - - 1 - 1 - 1 - 100 - - - - - - - - - - - - - - - - - 1 - 1 - 1 - paypal/adminhtml_system_config_fieldset_expanded - 30 - - - payment/paypaluk_express/active - select - paypal/adminhtml_system_config_field_hidden - paypal-ec-payflow-enabler - adminhtml/system_config_source_yesno - 1 - 1 - - - <label>Title</label> - <config_path>payment/paypaluk_express/title</config_path> - <sort_order>10</sort_order> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - - - - payment/paypaluk_express/sort_order - 20 - 1 - 1 - 1 - validate-number - - - - payment/paypaluk_express/payment_action - select - paypal/system_config_source_paymentActions - 30 - 1 - 1 - - - - payment/paypaluk_express/visible_on_product - select - adminhtml/system_config_source_yesno - 50 - 1 - 1 - 1 - - - - config-advanced - 1 - 1 - 60 - - - - Also affects mini-shopping cart. - payment/paypaluk_express/visible_on_cart - select - paypal/system_config_source_yesnoShortcut - 5 - 1 - 1 - 1 - - - - payment/paypaluk_express/allowspecific - select - 10 - adminhtml/system_config_source_payment_allspecificcountries - 1 - 1 - - - - payment/paypaluk_express/specificcountry - multiselect - 20 - paypal/system_config_source_buyerCountry - 1 - 1 - 1 - - - - payment/paypaluk_express/debug - select - adminhtml/system_config_source_yesno - 30 - 1 - 1 - - - - payment/paypaluk_express/verify_peer - select - adminhtml/system_config_source_yesno - 35 - 1 - 1 - - - - payment/paypaluk_express/line_items_enabled - select - adminhtml/system_config_source_yesno - 40 - 1 - 1 - - - - - - -
- - - 1 - 1 - 1 - 20 - paypal_payment_solutions - paypal/adminhtml_system_config_fieldset_payment - pp-method-payflow - Connect your merchant account with a PCI-compliant gateway that lets customers pay without leaving your site. - payment/payflow_link/active - https://www.paypal.com/webapps/mpp/referral/paypal-payflow-link?partner_id=NB9WWHYEMVUMS - - - 1 - 40 - - - 1 - paypal_payment_gateways - - - - - Learn More]]> - - 41 - payflow_link_required_enable_express_checkout - - - - - Why Advertise Financing?
- Give your sales a boost when you advertise financing.
PayPal helps turn browsers into buyers with financing - from Paypal Credit®. Your customers have more time to pay, while you get paid up front – at no additional cost to you. - Use PayPal’s free banner ads that let you advertise Paypal Credit® financing as a payment option when your customers check out with PayPal. - The PayPal Advertising Program has been shown to generate additional purchases as well as increase consumer's average purchase sizes by 15% - or more. See Details.]]> -
- 1 - 1 - 42 - - - - - - 1 - 1 - 1 - 20 - - - - - - payment/paypal_express_bml/homepage_size - select - paypal/system_config_source_bmlSize::getBmlSizeHPH - 1 - 1 - 30 - 1 - 0 - - - paypal/system_config_source_bmlSize::getBmlSizeHPS - 1 - - - - - - 1 - 1 - 1 - 30 - - - - - - payment/paypal_express_bml/categorypage_size - select - paypal/system_config_source_bmlSize::getBmlSizeCCPC - 1 - 1 - 30 - 1 - 0 - - - paypal/system_config_source_bmlSize::getBmlSizeCCPS - 1 - - - - - - - 1 - 1 - 1 - 40 - - - - - - payment/paypal_express_bml/productpage_size - select - paypal/system_config_source_bmlSize::getBmlSizeCPPC - 1 - 1 - 30 - 1 - 0 - - - paypal/system_config_source_bmlSize::getBmlSizeCPPN - 1 - - - - - - - 1 - 1 - 1 - 50 - - - - - - payment/paypal_express_bml/checkout_size - select - paypal/system_config_source_bmlSize::getBmlSizeCheckoutC - 1 - 1 - 30 - 1 - 0 - - - paypal/system_config_source_bmlSize::getBmlSizeCheckoutN - 1 - 1 - - - - - -
-
-
-
-
-
- - - - 1 - 1 - paypal/adminhtml_system_config_fieldset_expanded - 10 - - - - 1 - 1 - paypal/adminhtml_system_config_fieldset_expanded - 10 - - - - payment/payflow_link/partner - 10 - 1 - 1 - - - - payment/payflow_link/vendor - 20 - 1 - 1 - - - - If you do not have multiple users set up on your account, please re-enter your Vendor/Merchant Login here. - payment/payflow_link/user - 30 - 1 - 1 - - - - payment/payflow_link/pwd - obscure - adminhtml/system_config_backend_encrypted - 40 - 1 - 1 - - - - payment/payflow_link/sandbox_flag - select - adminhtml/system_config_source_yesno - 50 - 1 - 1 - - - - payment/payflow_link/use_proxy - select - adminhtml/system_config_source_yesno - 60 - 1 - 1 - - - - payment/payflow_link/proxy_host - 70 - 1 - 1 - 1 - - - - payment/payflow_link/proxy_port - 80 - 1 - 1 - 1 - - - paypal/adminhtml_system_config_payflowlink_info - 1 - 1 - 1 - 90 - - - - - - payment/payflow_link/active - select - adminhtml/system_config_source_yesno - 20 - 1 - 1 - payflow_link_payflow_link - paypal-enabler paypal-ec-independent - - - - 1 - 1 - paypal/adminhtml_system_config_fieldset_expanded - 30 - - - - - - - - - - - - - - - - - payment/paypal_express/active - select - adminhtml/system_config_source_yesno - 40 - 1 - 1 - 1 - payflow_link_required_enable_payflow_link,payflow_link_express_checkout - paypal-enabler paypal-ec-enabler - - - - - - - 1 - 1 - 1 - paypal/adminhtml_system_config_fieldset_expanded - 20 - - - <label>Title</label> - <comment>It is recommended to set this value to "Debit or Credit Card" per store views.</comment> - <config_path>payment/payflow_link/title</config_path> - <sort_order>10</sort_order> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - - - - payment/payflow_link/sort_order - 20 - 1 - 1 - 1 - validate-number - - - - payment/payflow_link/payment_action - select - paypal/system_config_source_paymentActions - 30 - 1 - 1 - - - - config-advanced - 1 - 1 - 1 - 40 - - - - payment/payflow_link/allowspecific - select - adminhtml/system_config_source_payment_allspecificcountries - 10 - 1 - 1 - - - - payment/payflow_link/specificcountry - multiselect - paypal/system_config_source_buyerCountry - 20 - 1 - 1 - 1 - - - - payment/payflow_link/debug - select - adminhtml/system_config_source_yesno - 30 - 1 - 1 - - - - payment/payflow_link/verify_peer - select - adminhtml/system_config_source_yesno - 35 - 1 - 1 - - - - payment/payflow_link/csc_editable - select - adminhtml/system_config_source_yesno - 40 - 1 - 1 - - - - payment/payflow_link/csc_required - select - adminhtml/system_config_source_yesno - 50 - 1 - 1 - 1 - - - - payment/payflow_link/email_confirmation - select - adminhtml/system_config_source_yesno - 60 - 1 - 1 - - - - payment/payflow_link/url_method - select - paypal/system_config_source_urlMethod - 70 - 1 - 1 - - - - payment/payflow_link/mobile_optimized - select - adminhtml/system_config_source_yesno - 75 - 1 - 1 - - - - 1 - 1 - 80 - - - - - - - - - - - - - - - - 1 - 1 - 1 - 90 - - - - - - - - - - - - - - - - - 1 - 1 - 1 - paypal/adminhtml_system_config_fieldset_expanded - 30 - - - <sort_order extends="//paypal_payments/payflow_advanced//settings_express_checkout/*/sort_order" /> - <payment_action extends="//paypal_payments/payflow_advanced//settings_express_checkout/*/payment_action" /> - <visible_on_product extends="//paypal_payments/payflow_advanced//settings_express_checkout/*/visible_on_product" /> - <authorization_honor_period extends="//paypal_payments/payflow_advanced//settings_express_checkout/*/authorization_honor_period" /> - <order_valid_period extends="//paypal_payments/payflow_advanced//settings_express_checkout/*/order_valid_period" /> - <child_authorization_number extends="//paypal_payments/payflow_advanced//settings_express_checkout/*/child_authorization_number" /> - - <settings_payflow_link_express_checkout_advanced type="group" translate="label"> - <label>Advanced Settings</label> - <frontend_class>config-advanced</frontend_class> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - <sort_order>80</sort_order> - <fields> - <visible_on_cart extends="//paypal_payments/payflow_advanced//settings_express_checkout//visible_on_cart" /> - <allowspecific extends="//paypal_payments/payflow_advanced//settings_express_checkout//allowspecific" /> - <specificcountry extends="//paypal_payments/payflow_advanced//settings_express_checkout//specificcountry" /> - <debug extends="//paypal_payments/payflow_advanced//settings_express_checkout//debug" /> - <verify_peer extends="//paypal_payments/payflow_advanced//settings_express_checkout//verify_peer" /> - <line_items_enabled extends="//paypal_payments/payflow_advanced//settings_express_checkout//line_items_enabled" /> - <transfer_shipping_options extends="//paypal_payments/payflow_advanced//settings_express_checkout//transfer_shipping_options" /> - <button_flavor extends="//paypal_payments/payflow_advanced//settings_express_checkout//button_flavor" /> - <solution_type extends="//paypal_payments/payflow_advanced//settings_express_checkout//solution_type" /> - <require_billing_address extends="//paypal_payments/payflow_advanced//settings_express_checkout//require_billing_address" /> - <allow_ba_signup extends="//paypal_payments/payflow_advanced//settings_express_checkout//allow_ba_signup" /> - <skip_order_review_step extends="//paypal_payments/payflow_advanced//settings_express_checkout//skip_order_review_step" /> - - <payflow_link_billing_agreement type="group" translate="label"> - <label>PayPal Billing Agreement Settings</label> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - <sort_order>100</sort_order> - <fields> - <active extends="//paypal_payments/payflow_advanced//billing_agreement/*/active" /> - <title extends="//paypal_payments/payflow_advanced//billing_agreement/*/title" /> - <sort_order extends="//paypal_payments/payflow_advanced//billing_agreement/*/sort_order" /> - <payment_action extends="//paypal_payments/payflow_advanced//billing_agreement/*/payment_action" /> - <allowspecific extends="//paypal_payments/payflow_advanced//billing_agreement/*/allowspecific" /> - <specificcountry extends="//paypal_payments/payflow_advanced//billing_agreement/*/specificcountry" /> - <debug extends="//paypal_payments/payflow_advanced//billing_agreement/*/debug" /> - <verify_peer extends="//paypal_payments/payflow_advanced//billing_agreement/*/verify_peer" /> - <line_items_enabled extends="//paypal_payments/payflow_advanced//billing_agreement/*/line_items_enabled" /> - <allow_billing_agreement_wizard extends="//paypal_payments/payflow_advanced//billing_agreement/*/allow_billing_agreement_wizard" /> - </fields> - </payflow_link_billing_agreement> - </fields> - </settings_payflow_link_express_checkout_advanced> - </fields> - </settings_payflow_link_express_checkout> - </fields> - </payflow_link> - <payments_pro_payflow_edition type="group" translate="label comment"> - <label>Website Payments Pro Payflow Edition (Includes Express Checkout)</label> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - <sort_order>40</sort_order> - <group>paypal_group_all_in_one</group> - <frontend_class>pp-general-uk</frontend_class> - <frontend_model>paypal/adminhtml_system_config_fieldset_deprecated</frontend_model> - <was_enabled_path>payment/paypaluk_direct/was_active</was_enabled_path> - <activity_path>payment/paypaluk_direct/active</activity_path> - <comment>Accept payments in your shopping cart. PayPal will process your card payments through the Payflow Gateway.</comment> - <backend_config> - <GB> - <include>1</include> - </GB> - </backend_config> - <fields> - <pp_pe_required_settings type="group" translate="label"> - <label>Required Settings</label> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <frontend_model>paypal/adminhtml_system_config_fieldset_expanded</frontend_model> - <sort_order>10</sort_order> - <fields> - <pp_pe_api_settings type="group" translate="label"> - <label>Website Payments Pro Payflow Edition and Express Checkout</label> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <frontend_model>paypal/adminhtml_system_config_fieldset_expanded</frontend_model> - <sort_order>10</sort_order> - <fields> - <business_account extends="//paypal_payments/payflow_advanced//business_account" translate="label"> - <sort_order>10</sort_order> - <frontend_class>not-required</frontend_class> - <label>Email Associated with PayPal Merchant Account (Optional)</label> - </business_account> - <partner translate="label"> - <label>Partner</label> - <config_path>paypal/wpuk/partner</config_path> - <sort_order>20</sort_order> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - </partner> - <user translate="label"> - <label>User</label> - <frontend_type>obscure</frontend_type> - <config_path>paypal/wpuk/user</config_path> - <backend_model>adminhtml/system_config_backend_encrypted</backend_model> - <sort_order>30</sort_order> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - </user> - <vendor translate="label"> - <label>Vendor</label> - <config_path>paypal/wpuk/vendor</config_path> - <sort_order>40</sort_order> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - </vendor> - <pwd translate="label"> - <label>Password</label> - <config_path>paypal/wpuk/pwd</config_path> - <frontend_type>obscure</frontend_type> - <backend_model>adminhtml/system_config_backend_encrypted</backend_model> - <sort_order>50</sort_order> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - </pwd> - <sandbox_flag translate="label"> - <label>Test Mode</label> - <config_path>paypal/wpuk/sandbox_flag</config_path> - <frontend_type>select</frontend_type> - <source_model>adminhtml/system_config_source_yesno</source_model> - <sort_order>60</sort_order> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - </sandbox_flag> - <use_proxy translate="label"> - <label>API Uses Proxy</label> - <config_path>paypal/wpuk/use_proxy</config_path> - <frontend_type>select</frontend_type> - <source_model>adminhtml/system_config_source_yesno</source_model> - <sort_order>70</sort_order> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - </use_proxy> - <proxy_host translate="label"> - <label>Proxy Host</label> - <config_path>paypal/wpuk/proxy_host</config_path> - <sort_order>80</sort_order> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <depends><use_proxy>1</use_proxy></depends> - </proxy_host> - <proxy_port translate="label"> - <label>Proxy Port</label> - <config_path>paypal/wpuk/proxy_port</config_path> - <sort_order>90</sort_order> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <depends><use_proxy>1</use_proxy></depends> - </proxy_port> - </fields> - </pp_pe_api_settings> - <enable_pp_pe translate="label"> - <label>Enable this Solution</label> - <config_path>payment/paypaluk_direct/active</config_path> - <frontend_type>select</frontend_type> - <source_model>adminhtml/system_config_source_yesno</source_model> - <sort_order>20</sort_order> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <requires>pp_pe_api_settings</requires> - <frontend_class>paypal-enabler paypal-ec-pe</frontend_class> - </enable_pp_pe> - - </fields> - </pp_pe_required_settings> - <settings_pp_pe type="group" translate="label"> - <label>Basic Settings - PayPal Website Payments Pro Payflow Edition</label> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - <frontend_model>paypal/adminhtml_system_config_fieldset_expanded</frontend_model> - <sort_order>20</sort_order> - <fields> - <title translate="label comment"> - <label>Title</label> - <comment>It is recommended to set this value to "Debit or Credit Card" per store views.</comment> - <config_path>payment/paypaluk_direct/title</config_path> - <sort_order>10</sort_order> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - - - - payment/paypaluk_direct/sort_order - 20 - 1 - 1 - 1 - validate-number - - - - payment/paypaluk_direct/payment_action - select - paypal/system_config_source_paymentActions - 30 - 1 - 1 - - - - adminhtml/system_config_form_field_heading - 40 - 1 - 1 - - - - - payment/paypaluk_direct/cctypes - multiselect - paypal/config::getWppPeCcTypesAsOptionArray - 50 - 1 - 1 - - - - config-advanced - 1 - 1 - 1 - 60 - - - - payment/paypaluk_direct/allowspecific - select - adminhtml/system_config_source_payment_allspecificcountries - 10 - 1 - 1 - - - - payment/paypaluk_direct/specificcountry - multiselect - paypal/system_config_source_buyerCountry - 20 - 1 - 1 - 1 - - - - payment/paypaluk_direct/debug - select - adminhtml/system_config_source_yesno - 30 - 1 - 1 - - - - payment/paypaluk_direct/verify_peer - select - adminhtml/system_config_source_yesno - 35 - 1 - 1 - - - - payment/paypaluk_direct/line_items_enabled - select - adminhtml/system_config_source_yesno - 37 - 1 - 1 - - - - payment/paypaluk_direct/useccv - select - adminhtml/system_config_source_yesno - 40 - 1 - 1 - - - - adminhtml/system_config_form_field_heading - 50 - 1 - 1 - - - - payment/paypaluk_direct/centinel - select - adminhtml/system_config_source_yesno - 60 - 1 - 1 - - - - payment/paypaluk_direct/centinel_is_mode_strict - Severe Validation Removes Chargeback Liability on Merchant - select - adminhtml/system_config_source_yesno - 70 - 1 - 1 - 1 - - - - payment/paypaluk_direct/centinel_api_url - If empty, a default value will be used. Custom URL may be provided by CardinalCommerce agreement. - adminhtml/system_config_source_yesno - 80 - 1 - 1 - 1 - - - - 1 - 1 - 90 - - - - - - - - - - - - - - - - 1 - 1 - 1 - 100 - - - - - - - - - - - - - - - - - 1 - 1 - 1 - paypal/adminhtml_system_config_fieldset_expanded - 30 - - - - <sort_order extends="//paypal_payments/paypal_verisign_with_express_checkout//paypal_payflow_express_checkout/*/sort_order" /> - <payment_action extends="//paypal_payments/paypal_verisign_with_express_checkout//paypal_payflow_express_checkout/*/payment_action" /> - <visible_on_product extends="//paypal_payments/paypal_verisign_with_express_checkout//paypal_payflow_express_checkout/*/visible_on_product" /> - <pp_pe_express_checkout_advanced type="group" extends="//paypal_payments/paypal_verisign_with_express_checkout//paypal_payflow_express_checkout_advanced" /> - </fields> - </settings_pp_pe_express_checkout> - </fields> - </payments_pro_payflow_edition> - <payments_pro_hosted_solution type="group" translate="label comment"> - <label>Website Payments Pro Hosted Solution</label> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - <sort_order>20</sort_order> - <group>paypal_payment_solutions</group> - <frontend_class>pp-method-general</frontend_class> - <frontend_model>paypal/adminhtml_system_config_fieldset_payment</frontend_model> - <activity_path>payment/hosted_pro/active</activity_path> - <comment>Accept payments with a PCI compliant checkout that keeps customers on your site.</comment> - <paypal_ec_separate>1</paypal_ec_separate> - <backend_config> - <JP translate="label"> - <label>Website Payments Plus</label> - <include>1</include> - <fields> - <pphs_required_settings> - <fields> - <pphs_required_settings_pphs translate="label"> - <label>Website Payments Plus</label> - </pphs_required_settings_pphs> - </fields> - </pphs_required_settings> - <pphs_settings translate="label"> - <label>Basic Settings - PayPal Website Payments Plus</label> - </pphs_settings> - </fields> - </JP> - <FR translate="label"> - <label>Integral Evolution</label> - <include>1</include> - <fields> - <pphs_required_settings> - <fields> - <pphs_required_settings_pphs translate="label"> - <label>Integral Evolution</label> - </pphs_required_settings_pphs> - </fields> - </pphs_required_settings> - <pphs_settings translate="label"> - <label>Basic Settings - PayPal Integral Evolution</label> - </pphs_settings> - </fields> - </FR> - <IT translate="label"> - <label>Pro</label> - <include>1</include> - <fields> - <pphs_required_settings> - <fields> - <pphs_required_settings_pphs translate="label"> - <label>PayPal Pro</label> - </pphs_required_settings_pphs> - </fields> - </pphs_required_settings> - <pphs_settings translate="label"> - <label>Basic Settings - PayPal Pro</label> - </pphs_settings> - </fields> - </IT> - <ES translate="label"> - <label>Pasarela integral</label> - <include>1</include> - <fields> - <pphs_required_settings> - <fields> - <pphs_required_settings_pphs translate="label"> - <label>Pasarela integral</label> - </pphs_required_settings_pphs> - </fields> - </pphs_required_settings> - <pphs_settings translate="label"> - <label>Basic Settings - PayPal Pasarela integral</label> - </pphs_settings> - </fields> - </ES> - <HK> - <include>1</include> - </HK> - <AU> - <include>1</include> - <sort_order>30</sort_order> - </AU> - </backend_config> - <fields> - <pphs_required_settings type="group" translate="label"> - <label>Required PayPal Settings</label> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <frontend_model>paypal/adminhtml_system_config_fieldset_expanded</frontend_model> - <sort_order>10</sort_order> - <fields> - <pphs_required_settings_pphs type="group" translate="label"> - <label>Payments Pro Hosted Solution</label> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <frontend_model>paypal/adminhtml_system_config_fieldset_expanded</frontend_model> - <sort_order>10</sort_order> - <fields> - <business_account extends="//paypal_payments/payflow_advanced//business_account" /> - <api_authentication extends="//paypal_payments/payflow_advanced//api_authentication" /> - <api_username extends="//paypal_payments/payflow_advanced//api_username" /> - <api_password extends="//paypal_payments/payflow_advanced//api_password" /> - <api_signature extends="//paypal_payments/payflow_advanced//api_signature" /> - <api_cert extends="//paypal_payments/payflow_advanced//api_cert" /> - <api_wizard extends="//paypal_payments/payflow_advanced//api_wizard" /> - <sandbox_flag extends="//paypal_payments/payflow_advanced//express//sandbox_flag" /> - <use_proxy extends="//paypal_payments/payflow_advanced//express//use_proxy" /> - <proxy_host extends="//paypal_payments/payflow_advanced//express//proxy_host" /> - <proxy_port extends="//paypal_payments/payflow_advanced//express//proxy_port" /> - </fields> - </pphs_required_settings_pphs> - <pphs_enable translate="label"> - <label>Enable this Solution</label> - <config_path>payment/hosted_pro/active</config_path> - <frontend_type>select</frontend_type> - <source_model>adminhtml/system_config_source_yesno</source_model> - <sort_order>20</sort_order> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <requires>pphs_required_settings_pphs</requires> - <frontend_class>paypal-enabler paypal-ec-separate</frontend_class> - </pphs_enable> - </fields> - </pphs_required_settings> - <pphs_settings type="group" translate="label"> - <label>Basic Settings - PayPal Payments Pro Hosted Solution</label> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - <frontend_model>paypal/adminhtml_system_config_fieldset_expanded</frontend_model> - <sort_order>20</sort_order> - <fields> - <title translate="label comment"> - <label>Title</label> - <comment>It is recommended to set this value to "PayPal" per store views.</comment> - <config_path>payment/hosted_pro/title</config_path> - <sort_order>10</sort_order> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - - - - payment/hosted_pro/sort_order - 20 - 1 - 1 - 1 - validate-number - - - - payment/hosted_pro/payment_action - select - paypal/system_config_source_paymentActions - 30 - 1 - 1 - - - - payment/hosted_pro/display_ec - select - adminhtml/system_config_source_yesno - 40 - 1 - 1 - - - - config-advanced - 1 - 1 - 1 - 50 - - - - payment/hosted_pro/allowspecific - select - adminhtml/system_config_source_payment_allspecificcountries - 10 - 1 - 1 - - - - payment/hosted_pro/specificcountry - multiselect - paypal/system_config_source_buyerCountry - 20 - 1 - 1 - 1 - - - - payment/hosted_pro/debug - select - adminhtml/system_config_source_yesno - 30 - 1 - 1 - - - - payment/hosted_pro/verify_peer - select - adminhtml/system_config_source_yesno - 35 - 1 - 1 - - - - payment/hosted_pro/mobile_optimized - select - adminhtml/system_config_source_yesno - 37 - 1 - 1 - - - - 1 - 1 - 45 - - - - - - - - - - - - - - - - - - - - - - 30 - paypal_group_all_in_one - pp-general-uk - https://cms.paypal.com/cms_content/GB/en_GB/files/developer/HostedSolution.pdf - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 1 - - - - - paypal-enabler - - - - - - - - - - - - - - - - - - - - - - 1 - 1 - 1 - 40 - - - - <sort_order extends="//paypal_payments/payflow_advanced//billing_agreement/*/sort_order" /> - <payment_action extends="//paypal_payments/payflow_advanced//billing_agreement/*/payment_action" /> - <allowspecific extends="//paypal_payments/payflow_advanced//billing_agreement/*/allowspecific" /> - <specificcountry extends="//paypal_payments/payflow_advanced//billing_agreement/*/specificcountry" /> - <debug extends="//paypal_payments/payflow_advanced//billing_agreement/*/debug" /> - <verify_peer extends="//paypal_payments/payflow_advanced//billing_agreement/*/verify_peer" /> - <line_items_enabled extends="//paypal_payments/payflow_advanced//billing_agreement/*/line_items_enabled" /> - <allow_billing_agreement_wizard extends="//paypal_payments/payflow_advanced//billing_agreement/*/allow_billing_agreement_wizard" /> - </fields> - </pphs_billing_agreement> - <pphs_frontend type="group" translate="label"> - <label>Frontend Experience Settings</label> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - <sort_order>50</sort_order> - <fields> - <logo extends="//paypal_payments/payflow_advanced//frontend/*/logo" /> - <paypal_pages extends="//paypal_payments/payflow_advanced//frontend/*/paypal_pages" /> - <page_style extends="//paypal_payments/payflow_advanced//frontend/*/page_style" /> - <paypal_hdrimg extends="//paypal_payments/payflow_advanced//frontend/*/paypal_hdrimg" /> - <paypal_hdrbackcolor extends="//paypal_payments/payflow_advanced//frontend/*/paypal_hdrbackcolor" /> - <paypal_hdrbordercolor extends="//paypal_payments/payflow_advanced//frontend/*/paypal_hdrbordercolor" /> - <paypal_payflowcolor extends="//paypal_payments/payflow_advanced//frontend/*/paypal_payflowcolor" /> - </fields> - </pphs_frontend> - </fields> - </pphs_settings_advanced> - </fields> - </pphs_settings> - <pphs_settings_express_checkout type="group" translate="label"> - <label>Basic Settings - PayPal Express Checkout</label> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - <frontend_model>paypal/adminhtml_system_config_fieldset_expanded</frontend_model> - <sort_order>30</sort_order> - <fields> - <title extends="//paypal_payments/payflow_advanced//settings_express_checkout/*/title" /> - <sort_order extends="//paypal_payments/payflow_advanced//settings_express_checkout/*/sort_order" /> - <payment_action extends="//paypal_payments/payflow_advanced//settings_express_checkout/*/payment_action" /> - <visible_on_product extends="//paypal_payments/payflow_advanced//settings_express_checkout/*/visible_on_product" /> - <authorization_honor_period extends="//paypal_payments/payflow_advanced//settings_express_checkout/*/authorization_honor_period" /> - <order_valid_period extends="//paypal_payments/payflow_advanced//settings_express_checkout/*/order_valid_period" /> - <child_authorization_number extends="//paypal_payments/payflow_advanced//settings_express_checkout/*/child_authorization_number" /> - - <pphs_settings_express_checkout_advanced type="group" translate="label"> - <label>Advanced Settings</label> - <frontend_class>config-advanced</frontend_class> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - <sort_order>80</sort_order> - <fields> - <visible_on_cart extends="//paypal_payments/payflow_advanced//settings_express_checkout//visible_on_cart" /> - <allowspecific extends="//paypal_payments/payflow_advanced//settings_express_checkout//allowspecific" /> - <specificcountry extends="//paypal_payments/payflow_advanced//settings_express_checkout//specificcountry" /> - <debug extends="//paypal_payments/payflow_advanced//settings_express_checkout//debug" /> - <verify_peer extends="//paypal_payments/payflow_advanced//settings_express_checkout//verify_peer" /> - <line_items_enabled extends="//paypal_payments/payflow_advanced//settings_express_checkout//line_items_enabled" /> - <transfer_shipping_options extends="//paypal_payments/payflow_advanced//settings_express_checkout//transfer_shipping_options" /> - <button_flavor extends="//paypal_payments/payflow_advanced//settings_express_checkout//button_flavor" /> - <solution_type extends="//paypal_payments/payflow_advanced//settings_express_checkout//solution_type" /> - <require_billing_address extends="//paypal_payments/payflow_advanced//settings_express_checkout//require_billing_address" /> - <allow_ba_signup extends="//paypal_payments/payflow_advanced//settings_express_checkout//allow_ba_signup" /> - <skip_order_review_step extends="//paypal_payments/payflow_advanced//settings_express_checkout//skip_order_review_step" /> - </fields> - </pphs_settings_express_checkout_advanced> - </fields> - </pphs_settings_express_checkout> - </fields> - </payments_pro_hosted_solution_with_express_checkout> - <express_checkout type="group" translate="label comment"> - <label>Express Checkout</label> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - <sort_order>60</sort_order> - <group>paypal_payment_solutions</group> - <frontend_model>paypal/adminhtml_system_config_fieldset_payment</frontend_model> - <frontend_class>pp-method-express</frontend_class> - <include>1</include> - <comment>Add PayPal as an additional payment method to your checkout page.</comment> - <activity_path>payment/paypal_express/active</activity_path> - <learn_more_link>https://www.paypal.com/webapps/mpp/referral/paypal-express-checkout?partner_id=NB9WWHYEMVUMS</learn_more_link> - <backend_config> - <US> - <group>paypal_alternative_payment_methods</group> - <fields> - <express_checkout_required> - <fields> - <enable_express_checkout_bml translate="label comment"> - <label>Enable Paypal Credit</label> - <comment><![CDATA[PayPal Express Checkout lets you give customers access to financing through Paypal Credit® - at no additional cost to you. - You get paid up front, even though customers have more time to pay. A pre-integrated payment button lets customers pay quickly with Paypal Credit®. - <a href="https://www.paypal.com/webapps/mpp/promotional-financing" target="_blank">Learn More</a>]]> - </comment> - <config_path>payment/paypal_express_bml/active</config_path> - <frontend_type>select</frontend_type> - <source_model>adminhtml/system_config_source_yesno</source_model> - <sort_order>21</sort_order> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <shared>1</shared> - <requires>express_checkout_required_enable_express_checkout</requires> - <frontend_class>paypal-bml</frontend_class> - </enable_express_checkout_bml> - <advertise_bml type="group" translate="label comment"> - <label>Advertise Paypal Credit</label> - <comment> - <![CDATA[<a href="https://financing.paypal.com/ppfinportal/content/whyUseFinancing" target="_blank">Why Advertise Financing?</a><br/> - <strong>Give your sales a boost when you advertise financing.</strong><br/>PayPal helps turn browsers into buyers with financing - from Paypal Credit®. Your customers have more time to pay, while you get paid up front – at no additional cost to you. - Use PayPal’s free banner ads that let you advertise Paypal Credit® financing as a payment option when your customers check out with PayPal. - The PayPal Advertising Program has been shown to generate additional purchases as well as increase consumer's average purchase sizes by 15% - or more. <a href="https://financing.paypal.com/ppfinportal/content/forrester" target="_blank">See Details</a>.]]> - </comment> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <sort_order>30</sort_order> - <fields> - <bml_publisher_id translate="label comment tooltip"> - <label>Publisher ID</label> - <comment><![CDATA[Required to display a banner]]></comment> - <config_path>payment/paypal_express_bml/publisher_id</config_path> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <sort_order>10</sort_order> - <shared>1</shared> - </bml_publisher_id> - <bml_wizard translate="button_label"> - <label></label> - <button_label>Get Publisher ID from PayPal</button_label> - <button_url><![CDATA[https://financing.paypal.com/ppfinportal/cart/index?dcp=4eff8563b9cc505e0b9afaff3256705081553c79]]></button_url> - <frontend_model>paypal/adminhtml_system_config_bmlApiWizard</frontend_model> - <sort_order>15</sort_order> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - </bml_wizard> - <settings_bml_homepage type="group" translate="label"> - <label>Home Page</label> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - <sort_order>20</sort_order> - <fields> - <bml_homepage_display translate="label"> - <label>Display</label> - <config_path>payment/paypal_express_bml/homepage_display</config_path> - <frontend_type>select</frontend_type> - <source_model>adminhtml/system_config_source_yesno</source_model> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <sort_order>10</sort_order> - <shared>1</shared> - </bml_homepage_display> - <bml_homepage_position translate="label"> - <label>Position</label> - <config_path>payment/paypal_express_bml/homepage_position</config_path> - <frontend_type>select</frontend_type> - <source_model>paypal/system_config_source_bmlPosition::getBmlPositionsHP</source_model> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <sort_order>20</sort_order> - <shared>1</shared> - </bml_homepage_position> - <bml_homepage_size1 translate="label"> - <label>Size</label> - <config_path>payment/paypal_express_bml/homepage_size</config_path> - <frontend_type>select</frontend_type> - <source_model>paypal/system_config_source_bmlSize::getBmlSizeHPH</source_model> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <sort_order>30</sort_order> - <shared>1</shared> - <depends><bml_homepage_position>0</bml_homepage_position></depends> - </bml_homepage_size1> - <bml_homepage_size2 extends="//paypal_payments/express_checkout//bml_homepage_size1"> - <source_model>paypal/system_config_source_bmlSize::getBmlSizeHPS</source_model> - <depends><bml_homepage_position>1</bml_homepage_position></depends> - </bml_homepage_size2> - </fields> - </settings_bml_homepage> - <settings_bml_categorypage type="group" translate="label"> - <label>Catalog Category Page</label> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - <sort_order>30</sort_order> - <fields> - <bml_categorypage_display translate="label"> - <label>Display</label> - <config_path>payment/paypal_express_bml/categorypage_display</config_path> - <frontend_type>select</frontend_type> - <source_model>adminhtml/system_config_source_yesno</source_model> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <sort_order>10</sort_order> - <shared>1</shared> - </bml_categorypage_display> - <bml_categorypage_position translate="label"> - <label>Position</label> - <config_path>payment/paypal_express_bml/categorypage_position</config_path> - <frontend_type>select</frontend_type> - <source_model>paypal/system_config_source_bmlPosition::getBmlPositionsCCP</source_model> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <sort_order>20</sort_order> - <shared>1</shared> - </bml_categorypage_position> - <bml_categorypage_size1 translate="label"> - <label>Size</label> - <config_path>payment/paypal_express_bml/categorypage_size</config_path> - <frontend_type>select</frontend_type> - <source_model>paypal/system_config_source_bmlSize::getBmlSizeCCPC</source_model> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <sort_order>30</sort_order> - <shared>1</shared> - <depends><bml_categorypage_position>0</bml_categorypage_position></depends> - </bml_categorypage_size1> - <bml_categorypage_size2 extends="//paypal_payments/express_checkout//bml_categorypage_size1"> - <source_model>paypal/system_config_source_bmlSize::getBmlSizeCCPS</source_model> - <depends><bml_categorypage_position>1</bml_categorypage_position></depends> - </bml_categorypage_size2> - </fields> - </settings_bml_categorypage> - <settings_bml_productpage type="group" translate="label"> - <label>Catalog Product Page</label> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - <sort_order>40</sort_order> - <fields> - <bml_productpage_display translate="label"> - <label>Display</label> - <config_path>payment/paypal_express_bml/productpage_display</config_path> - <frontend_type>select</frontend_type> - <source_model>adminhtml/system_config_source_yesno</source_model> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <sort_order>10</sort_order> - <shared>1</shared> - </bml_productpage_display> - <bml_productpage_position translate="label"> - <label>Position</label> - <config_path>payment/paypal_express_bml/productpage_position</config_path> - <frontend_type>select</frontend_type> - <source_model>paypal/system_config_source_bmlPosition::getBmlPositionsCPP</source_model> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <sort_order>20</sort_order> - <shared>1</shared> - </bml_productpage_position> - <bml_productpage_size1 translate="label"> - <label>Size</label> - <config_path>payment/paypal_express_bml/productpage_size</config_path> - <frontend_type>select</frontend_type> - <source_model>paypal/system_config_source_bmlSize::getBmlSizeCPPC</source_model> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <sort_order>30</sort_order> - <shared>1</shared> - <depends><bml_productpage_position>0</bml_productpage_position></depends> - </bml_productpage_size1> - <bml_productpage_size2 extends="//paypal_payments/express_checkout//bml_productpage_size1"> - <source_model>paypal/system_config_source_bmlSize::getBmlSizeCPPN</source_model> - <depends><bml_productpage_position>1</bml_productpage_position></depends> - </bml_productpage_size2> - </fields> - </settings_bml_productpage> - <settings_bml_checkout type="group" translate="label"> - <label>Checkout Cart Page</label> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - <sort_order>50</sort_order> - <fields> - <bml_checkout_display translate="label"> - <label>Display</label> - <config_path>payment/paypal_express_bml/checkout_display</config_path> - <frontend_type>select</frontend_type> - <source_model>adminhtml/system_config_source_yesno</source_model> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <sort_order>10</sort_order> - <shared>1</shared> - </bml_checkout_display> - <bml_checkout_position translate="label"> - <label>Position</label> - <config_path>payment/paypal_express_bml/checkout_position</config_path> - <frontend_type>select</frontend_type> - <source_model>paypal/system_config_source_bmlPosition::getBmlPositionsCheckout</source_model> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <sort_order>20</sort_order> - <shared>1</shared> - </bml_checkout_position> - <bml_checkout_size1 translate="label"> - <label>Size</label> - <config_path>payment/paypal_express_bml/checkout_size</config_path> - <frontend_type>select</frontend_type> - <source_model>paypal/system_config_source_bmlSize::getBmlSizeCheckoutC</source_model> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <sort_order>30</sort_order> - <shared>1</shared> - <depends><bml_checkout_position>0</bml_checkout_position></depends> - </bml_checkout_size1> - <bml_checkout_size2 extends="//paypal_payments/express_checkout//bml_checkout_size1"> - <source_model>paypal/system_config_source_bmlSize::getBmlSizeCheckoutN</source_model> - <shared>1</shared> - <depends><bml_checkout_position>1</bml_checkout_position></depends> - </bml_checkout_size2> - </fields> - </settings_bml_checkout> - </fields> - </advertise_bml> - </fields> - </express_checkout_required> - </fields> - </US> - <GB translate="comment"> - <group>paypal_alternative_payment_methods</group> - <learn_more_link>https://www.paypal-business.co.uk/add-paypal-to-online-shop/index.htm</learn_more_link> - <demo_link>http://www.youtube.com/watch?v=WgnfZ2Bj6hQ</demo_link> - <comment>Add PayPal as an additional payment method to your checkout page to increase your sales.</comment> - </GB> - </backend_config> - <fields> - <express_checkout_required type="group" translate="label"> - <label>Required PayPal Settings</label> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <sort_order>10</sort_order> - <frontend_model>paypal/adminhtml_system_config_fieldset_expanded</frontend_model> - <fields> - <express_checkout_required_express_checkout type="group" translate="label"> - <label>Express Checkout</label> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <frontend_model>paypal/adminhtml_system_config_fieldset_expanded</frontend_model> - <sort_order>10</sort_order> - <fields> - <business_account extends="//paypal_payments/payflow_advanced//business_account" /> - <api_authentication extends="//paypal_payments/payflow_advanced//api_authentication" /> - <api_username extends="//paypal_payments/payflow_advanced//api_username" /> - <api_password extends="//paypal_payments/payflow_advanced//api_password" /> - <api_signature extends="//paypal_payments/payflow_advanced//api_signature" /> - <api_cert extends="//paypal_payments/payflow_advanced//api_cert" /> - <api_wizard extends="//paypal_payments/payflow_advanced//api_wizard" /> - <sandbox_flag extends="//paypal_payments/payflow_advanced//express//sandbox_flag" /> - <use_proxy extends="//paypal_payments/payflow_advanced//express//use_proxy" /> - <proxy_host extends="//paypal_payments/payflow_advanced//express//proxy_host" /> - <proxy_port extends="//paypal_payments/payflow_advanced//express//proxy_port" /> - </fields> - </express_checkout_required_express_checkout> - <enable_express_checkout translate="label"> - <label>Enable this Solution</label> - <config_path>payment/paypal_express/active</config_path> - <frontend_type>select</frontend_type> - <source_model>adminhtml/system_config_source_yesno</source_model> - <sort_order>20</sort_order> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <shared>1</shared> - <requires>express_checkout_required_express_checkout</requires> - <frontend_class>paypal-enabler paypal-ec-enabler</frontend_class> - </enable_express_checkout> - - </fields> - </express_checkout_required> - <settings_ec type="group" translate="label"> - <label>Basic Settings - PayPal Express Checkout</label> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - <frontend_model>paypal/adminhtml_system_config_fieldset_expanded</frontend_model> - <sort_order>20</sort_order> - <fields> - <title extends="//paypal_payments/payflow_advanced//settings_express_checkout/*/title" /> - <sort_order extends="//paypal_payments/payflow_advanced//settings_express_checkout/*/sort_order" /> - <payment_action extends="//paypal_payments/payflow_advanced//settings_express_checkout/*/payment_action" /> - <visible_on_product extends="//paypal_payments/payflow_advanced//settings_express_checkout/*/visible_on_product" /> - <authorization_honor_period extends="//paypal_payments/payflow_advanced//settings_express_checkout/*/authorization_honor_period" /> - <order_valid_period extends="//paypal_payments/payflow_advanced//settings_express_checkout/*/order_valid_period" /> - <child_authorization_number extends="//paypal_payments/payflow_advanced//settings_express_checkout/*/child_authorization_number" /> - - <settings_ec_advanced type="group" translate="label"> - <label>Advanced Settings</label> - <frontend_class>config-advanced</frontend_class> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - <sort_order>80</sort_order> - <fields> - <visible_on_cart extends="//paypal_payments/payflow_advanced//settings_express_checkout//visible_on_cart" /> - <allowspecific extends="//paypal_payments/payflow_advanced//settings_express_checkout//allowspecific" /> - <specificcountry extends="//paypal_payments/payflow_advanced//settings_express_checkout//specificcountry" /> - <debug extends="//paypal_payments/payflow_advanced//settings_express_checkout//debug" /> - <verify_peer extends="//paypal_payments/payflow_advanced//settings_express_checkout//verify_peer" /> - <line_items_enabled extends="//paypal_payments/payflow_advanced//settings_express_checkout//line_items_enabled" /> - <transfer_shipping_options extends="//paypal_payments/payflow_advanced//settings_express_checkout//transfer_shipping_options" /> - <button_flavor extends="//paypal_payments/payflow_advanced//settings_express_checkout//button_flavor" /> - <solution_type extends="//paypal_payments/payflow_advanced//settings_express_checkout//solution_type" /> - <require_billing_address extends="//paypal_payments/payflow_advanced//settings_express_checkout//require_billing_address" /> - <allow_ba_signup extends="//paypal_payments/payflow_advanced//settings_express_checkout//allow_ba_signup" /> - <skip_order_review_step extends="//paypal_payments/payflow_advanced//settings_express_checkout//skip_order_review_step" /> - - <express_checkout_billing_agreement type="group" translate="label"> - <label>PayPal Billing Agreement Settings</label> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - <sort_order>100</sort_order> - <fields> - <active extends="//paypal_payments/payflow_advanced//billing_agreement/*/active" /> - <title extends="//paypal_payments/payflow_advanced//billing_agreement/*/title" /> - <sort_order extends="//paypal_payments/payflow_advanced//billing_agreement/*/sort_order" /> - <payment_action extends="//paypal_payments/payflow_advanced//billing_agreement/*/payment_action" /> - <allowspecific extends="//paypal_payments/payflow_advanced//billing_agreement/*/allowspecific" /> - <specificcountry extends="//paypal_payments/payflow_advanced//billing_agreement/*/specificcountry" /> - <debug extends="//paypal_payments/payflow_advanced//billing_agreement/*/debug" /> - <verify_peer extends="//paypal_payments/payflow_advanced//billing_agreement/*/verify_peer" /> - <line_items_enabled extends="//paypal_payments/payflow_advanced//billing_agreement/*/line_items_enabled" /> - <allow_billing_agreement_wizard extends="//paypal_payments/payflow_advanced//billing_agreement/*/allow_billing_agreement_wizard" /> - </fields> - </express_checkout_billing_agreement> - <express_checkout_settlement_report type="group" translate="label"> - <label>Settlement Report Settings</label> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <sort_order>110</sort_order> - <fields> - <heading_sftp extends="//paypal_payments/payflow_advanced//settlement_report/*/heading_sftp" /> - <settlement_reports_ftp_login extends="//paypal_payments/payflow_advanced//settlement_report/*/settlement_reports_ftp_login" /> - <settlement_reports_ftp_password extends="//paypal_payments/payflow_advanced//settlement_report/*/settlement_reports_ftp_password" /> - <settlement_reports_ftp_sandbox extends="//paypal_payments/payflow_advanced//settlement_report/*/settlement_reports_ftp_sandbox" /> - <settlement_reports_ftp_ip extends="//paypal_payments/payflow_advanced//settlement_report/*/settlement_reports_ftp_ip" /> - <settlement_reports_ftp_path extends="//paypal_payments/payflow_advanced//settlement_report/*/settlement_reports_ftp_path" /> - <heading_schedule extends="//paypal_payments/payflow_advanced//settlement_report/*/heading_schedule" /> - <settlement_reports_active extends="//paypal_payments/payflow_advanced//settlement_report/*/settlement_reports_active" /> - <settlement_reports_schedule extends="//paypal_payments/payflow_advanced//settlement_report/*/settlement_reports_schedule" /> - <settlement_reports_time extends="//paypal_payments/payflow_advanced//settlement_report/*/settlement_reports_time" /> - </fields> - </express_checkout_settlement_report> - <express_checkout_frontend type="group" translate="label"> - <label>Frontend Experience Settings</label> - <show_in_default>1</show_in_default> - <show_in_website>1</show_in_website> - <show_in_store>1</show_in_store> - <sort_order>120</sort_order> - <fields> - <logo extends="//paypal_payments/payflow_advanced//frontend/*/logo" /> - <paypal_pages extends="//paypal_payments/payflow_advanced//frontend/*/paypal_pages" /> - <page_style extends="//paypal_payments/payflow_advanced//frontend/*/page_style" /> - <paypal_hdrimg extends="//paypal_payments/payflow_advanced//frontend/*/paypal_hdrimg" /> - <paypal_hdrbackcolor extends="//paypal_payments/payflow_advanced//frontend/*/paypal_hdrbackcolor" /> - <paypal_hdrbordercolor extends="//paypal_payments/payflow_advanced//frontend/*/paypal_hdrbordercolor" /> - <paypal_payflowcolor extends="//paypal_payments/payflow_advanced//frontend/*/paypal_payflowcolor" /> - </fields> - </express_checkout_frontend> - </fields> - </settings_ec_advanced> - </fields> - </settings_ec> - </fields> - </express_checkout> - </paypal_payments> + </paypal> </groups> </payment> </sections> -</config> +</config> \ No newline at end of file diff --git a/app/code/core/Mage/Paypal/sql/paypal_setup/install-1.6.0.0.php b/app/code/core/Mage/Paypal/sql/paypal_setup/install-1.6.0.0.php index 36cd7e0b2cc..75f2f02645b 100644 --- a/app/code/core/Mage/Paypal/sql/paypal_setup/install-1.6.0.0.php +++ b/app/code/core/Mage/Paypal/sql/paypal_setup/install-1.6.0.0.php @@ -11,134 +11,6 @@ $installer = $this; $installer->startSetup(); -/** - * Create table 'paypal/settlement_report' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('paypal/settlement_report')) - ->addColumn('report_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, [ - 'identity' => true, - 'unsigned' => true, - 'nullable' => false, - 'primary' => true, - ], 'Report Id') - ->addColumn('report_date', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, [ - ], 'Report Date') - ->addColumn('account_id', Varien_Db_Ddl_Table::TYPE_TEXT, 64, [ - ], 'Account Id') - ->addColumn('filename', Varien_Db_Ddl_Table::TYPE_TEXT, 24, [ - ], 'Filename') - ->addColumn('last_modified', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, [ - ], 'Last Modified') - ->addIndex( - $installer->getIdxName('paypal/settlement_report', ['report_date', 'account_id'], Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE), - ['report_date', 'account_id'], - ['type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE], - ) - ->setComment('Paypal Settlement Report Table'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'paypal/settlement_report_row' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('paypal/settlement_report_row')) - ->addColumn('row_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, [ - 'identity' => true, - 'unsigned' => true, - 'nullable' => false, - 'primary' => true, - ], 'Row Id') - ->addColumn('report_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, [ - 'unsigned' => true, - 'nullable' => false, - ], 'Report Id') - ->addColumn('transaction_id', Varien_Db_Ddl_Table::TYPE_TEXT, 19, [ - ], 'Transaction Id') - ->addColumn('invoice_id', Varien_Db_Ddl_Table::TYPE_TEXT, 127, [ - ], 'Invoice Id') - ->addColumn('paypal_reference_id', Varien_Db_Ddl_Table::TYPE_TEXT, 19, [ - ], 'Paypal Reference Id') - ->addColumn('paypal_reference_id_type', Varien_Db_Ddl_Table::TYPE_TEXT, 3, [ - ], 'Paypal Reference Id Type') - ->addColumn('transaction_event_code', Varien_Db_Ddl_Table::TYPE_TEXT, 5, [ - ], 'Transaction Event Code') - ->addColumn('transaction_initiation_date', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, [ - ], 'Transaction Initiation Date') - ->addColumn('transaction_completion_date', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, [ - ], 'Transaction Completion Date') - ->addColumn('transaction_debit_or_credit', Varien_Db_Ddl_Table::TYPE_TEXT, 2, [ - 'nullable' => false, - 'default' => 'CR', - ], 'Transaction Debit Or Credit') - ->addColumn('gross_transaction_amount', Varien_Db_Ddl_Table::TYPE_DECIMAL, '20,6', [ - 'nullable' => false, - 'default' => '0.000000', - ], 'Gross Transaction Amount') - ->addColumn('gross_transaction_currency', Varien_Db_Ddl_Table::TYPE_TEXT, 3, [ - 'default' => '', - ], 'Gross Transaction Currency') - ->addColumn('fee_debit_or_credit', Varien_Db_Ddl_Table::TYPE_TEXT, 2, [ - ], 'Fee Debit Or Credit') - ->addColumn('fee_amount', Varien_Db_Ddl_Table::TYPE_DECIMAL, '20,6', [ - 'nullable' => false, - 'default' => '0.000000', - ], 'Fee Amount') - ->addColumn('fee_currency', Varien_Db_Ddl_Table::TYPE_TEXT, 3, [ - ], 'Fee Currency') - ->addColumn('custom_field', Varien_Db_Ddl_Table::TYPE_TEXT, 255, [ - ], 'Custom Field') - ->addColumn('consumer_id', Varien_Db_Ddl_Table::TYPE_TEXT, 127, [ - ], 'Consumer Id') - ->addIndex( - $installer->getIdxName('paypal/settlement_report_row', ['report_id']), - ['report_id'], - ) - ->addForeignKey( - $installer->getFkName('paypal/settlement_report_row', 'report_id', 'paypal/settlement_report', 'report_id'), - 'report_id', - $installer->getTable('paypal/settlement_report'), - 'report_id', - Varien_Db_Ddl_Table::ACTION_CASCADE, - Varien_Db_Ddl_Table::ACTION_CASCADE, - ) - ->setComment('Paypal Settlement Report Row Table'); -$installer->getConnection()->createTable($table); - -/** - * Create table 'paypal/cert' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('paypal/cert')) - ->addColumn('cert_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, [ - 'identity' => true, - 'unsigned' => true, - 'nullable' => false, - 'primary' => true, - ], 'Cert Id') - ->addColumn('website_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, [ - 'unsigned' => true, - 'nullable' => false, - 'default' => '0', - ], 'Website Id') - ->addColumn('content', Varien_Db_Ddl_Table::TYPE_TEXT, '64K', [ - ], 'Content') - ->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, [ - ], 'Updated At') - ->addIndex( - $installer->getIdxName('paypal/cert', ['website_id']), - ['website_id'], - ) - ->addForeignKey( - $installer->getFkName('paypal/cert', 'website_id', 'core/website', 'website_id'), - 'website_id', - $installer->getTable('core/website'), - 'website_id', - Varien_Db_Ddl_Table::ACTION_CASCADE, - Varien_Db_Ddl_Table::ACTION_CASCADE, - ) - ->setComment('Paypal Certificate Table'); -$installer->getConnection()->createTable($table); /** * Add paypal attributes to the: @@ -148,7 +20,6 @@ $installer->addAttribute('quote_payment', 'paypal_payer_id', []); $installer->addAttribute('quote_payment', 'paypal_payer_status', []); $installer->addAttribute('quote_payment', 'paypal_correlation_id', []); -$installer->addAttribute('order', 'paypal_ipn_customer_notified', ['type' => 'int', 'visible' => false, 'default' => 0]); /** * Prepare database after install diff --git a/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-install-0.7.0.php b/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-install-0.7.0.php deleted file mode 100644 index 1b887941bfa..00000000000 --- a/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-install-0.7.0.php +++ /dev/null @@ -1,32 +0,0 @@ -<?php - -/** - * @copyright For copyright and license information, read the COPYING.txt file. - * @link /COPYING.txt - * @license Open Software License (OSL 3.0) - * @package Mage_Paypal - */ - -/** @var Mage_Paypal_Model_Resource_Setup $installer */ -$installer = $this; -$installer->startSetup(); - -$installer->run(" - --- DROP TABLE IF EXISTS `{$this->getTable('paypal_api_debug')}`; -CREATE TABLE `{$this->getTable('paypal_api_debug')}` ( - `debug_id` int(10) unsigned NOT NULL auto_increment, - `debug_at` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, - `request_body` text, - `response_body` text, - PRIMARY KEY (`debug_id`), - KEY `debug_at` (`debug_at`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - "); - -$installer->endSetup(); - -$installer->addAttribute('quote_payment', 'paypal_payer_id', []); -$installer->addAttribute('quote_payment', 'paypal_payer_status', []); -$installer->addAttribute('quote_payment', 'paypal_correlation_id', []); diff --git a/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-install-1.4.0.0.php b/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-install-1.4.0.0.php deleted file mode 100644 index bccc98cffc0..00000000000 --- a/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-install-1.4.0.0.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php - -/** - * @copyright For copyright and license information, read the COPYING.txt file. - * @link /COPYING.txt - * @license Open Software License (OSL 3.0) - * @package Mage_Paypal - */ - -/** @var Mage_Paypal_Model_Resource_Setup $installer */ -$installer = $this; -$installer->startSetup(); - -$installer->run(" -CREATE TABLE `{$this->getTable('paypal_api_debug')}` ( - `debug_id` int(10) unsigned NOT NULL auto_increment, - `debug_at` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, - `request_body` text, - `response_body` text, - PRIMARY KEY (`debug_id`), - KEY `debug_at` (`debug_at`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8;"); - -$installer->addAttribute('quote_payment', 'paypal_payer_id', []); -$installer->addAttribute('quote_payment', 'paypal_payer_status', []); -$installer->addAttribute('quote_payment', 'paypal_correlation_id', []); -$installer->addAttribute('order', 'paypal_ipn_customer_notified', ['type' => 'int', 'visible' => false, 'default' => 0]); - -$installer->endSetup(); diff --git a/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-upgrade-0.7.1-0.7.2.php b/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-upgrade-0.7.1-0.7.2.php deleted file mode 100644 index c49ea70c033..00000000000 --- a/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-upgrade-0.7.1-0.7.2.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php - -/** - * @copyright For copyright and license information, read the COPYING.txt file. - * @link /COPYING.txt - * @license Open Software License (OSL 3.0) - * @package Mage_Paypal - */ - -/** @var Mage_Paypal_Model_Resource_Setup $installer */ -$installer = $this; -$installer->startSetup(); -$installer->addAttribute('order', 'paypal_ipn_customer_notified', ['type' => 'int', 'visible' => false, 'default' => 0]); -$installer->endSetup(); diff --git a/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-upgrade-0.7.2-0.7.3.php b/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-upgrade-0.7.2-0.7.3.php deleted file mode 100644 index fc931089afa..00000000000 --- a/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-upgrade-0.7.2-0.7.3.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php - -/** - * @copyright For copyright and license information, read the COPYING.txt file. - * @link /COPYING.txt - * @license Open Software License (OSL 3.0) - * @package Mage_Paypal - */ - -/** @var Mage_Paypal_Model_Resource_Setup $installer */ -$installer = $this; -$installer->startSetup(); - -$installer->addAttribute('order_payment', 'cc_secure_verify', []); - -// move paypal style settings to new paths -foreach ([ - 'paypal/wpp/page_style' => 'paypal/style/page_style', - 'paypal/wps/logo_url' => 'paypal/style/logo_url', -] as $from => $to -) { - $installer->run(" - UPDATE {$installer->getTable('core/config_data')} SET `path` = '{$to}' - WHERE `path` = '{$from}' - "); -} -$installer->endSetup(); diff --git a/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-upgrade-1.4.0.0-1.4.0.1.php b/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-upgrade-1.4.0.0-1.4.0.1.php deleted file mode 100644 index ba0c9c66c40..00000000000 --- a/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-upgrade-1.4.0.0-1.4.0.1.php +++ /dev/null @@ -1,53 +0,0 @@ -<?php - -/** - * @copyright For copyright and license information, read the COPYING.txt file. - * @link /COPYING.txt - * @license Open Software License (OSL 3.0) - * @package Mage_Paypal - */ - -/** @var Mage_Paypal_Model_Resource_Setup $installer */ -$installer = $this; -$installer->startSetup(); - -$installer->run(" - -CREATE TABLE `{$installer->getTable('paypal_settlement_report')}` ( - `report_id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `report_date` date NOT NULL, - `account_id` varchar(64) NOT NULL, - `filename` varchar(24) NOT NULL, - `last_modified` datetime NOT NULL, - PRIMARY KEY (`report_id`), - UNIQUE KEY `UNQ_REPORT_DATE_ACCOUNT` (`report_date`,`account_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE `{$installer->getTable('paypal_settlement_report_row')}` ( - `row_id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `report_id` int(10) unsigned NOT NULL, - `transaction_id` varchar(19) NOT NULL, - `invoice_id` varchar(127) DEFAULT NULL, - `paypal_reference_id` varchar(19) NOT NULL, - `paypal_reference_id_type` enum('ODR','TXN','SUB','PAP','') NOT NULL, - `transaction_event_code` char(5) NOT NULL DEFAULT '', - `transaction_initiation_date` datetime DEFAULT NULL, - `transaction_completion_date` datetime DEFAULT NULL, - `transaction_debit_or_credit` enum('CR','DR') NOT NULL DEFAULT 'CR', - `gross_transaction_amount` decimal(20,6) NOT NULL DEFAULT '0.000000', - `gross_transaction_currency` char(3) NOT NULL DEFAULT '', - `fee_debit_or_credit` enum('CR','DR') NOT NULL, - `fee_amount` decimal(20,6) NOT NULL DEFAULT '0.000000', - `fee_currency` char(3) NOT NULL, - `custom_field` varchar(255) DEFAULT NULL, - `consumer_id` varchar(127) NOT NULL DEFAULT '', - PRIMARY KEY (`row_id`), - KEY `IDX_REPORT_ID` (`report_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -ALTER TABLE `{$installer->getTable('paypal_settlement_report_row')}` - ADD CONSTRAINT `FK_PAYPAL_SETTLEMENT_ROW_REPORT` FOREIGN KEY (`report_id`) REFERENCES `{$installer->getTable('paypal_settlement_report')}` (`report_id`) ON DELETE CASCADE ON UPDATE CASCADE; - -"); - -$installer->endSetup(); diff --git a/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-upgrade-1.4.0.1-1.4.0.2.php b/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-upgrade-1.4.0.1-1.4.0.2.php deleted file mode 100644 index 5aa96a3e0d6..00000000000 --- a/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-upgrade-1.4.0.1-1.4.0.2.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php - -/** - * @copyright For copyright and license information, read the COPYING.txt file. - * @link /COPYING.txt - * @license Open Software License (OSL 3.0) - * @package Mage_Paypal - */ - -/** @var Mage_Paypal_Model_Resource_Setup $installer */ -$installer = $this; - -$installer->run(" -CREATE TABLE `{$installer->getTable('paypal/cert')}` ( - `cert_id` SMALLINT(5) UNSIGNED NOT NULL AUTO_INCREMENT, - `website_id` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0', - `content` MEDIUMBLOB NOT NULL, - `updated_at` datetime default NULL, - PRIMARY KEY (`cert_id`), - KEY `IDX_PAYPAL_CERT_WEBSITE` (`website_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -"); - -$installer->getConnection()->addConstraint( - 'FK_PAYPAL_CERT_WEBSITE', - $this->getTable('paypal/cert'), - 'website_id', - $this->getTable('core/website'), - 'website_id', -); diff --git a/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php b/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php deleted file mode 100644 index 2ff63751823..00000000000 --- a/app/code/core/Mage/Paypal/sql/paypal_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php +++ /dev/null @@ -1,286 +0,0 @@ -<?php - -/** - * @copyright For copyright and license information, read the COPYING.txt file. - * @link /COPYING.txt - * @license Open Software License (OSL 3.0) - * @package Mage_Paypal - */ - -/** @var Mage_Core_Model_Resource_Setup $installer */ -$installer = $this; -$installer->startSetup(); - -/** - * Drop foreign keys - */ -$installer->getConnection()->dropForeignKey( - $installer->getTable('paypal/cert'), - 'FK_PAYPAL_CERT_WEBSITE', -); - -$installer->getConnection()->dropForeignKey( - $installer->getTable('paypal/settlement_report_row'), - 'FK_PAYPAL_SETTLEMENT_ROW_REPORT', -); - -/** - * Drop indexes - */ -$installer->getConnection()->dropIndex( - $installer->getTable('paypal/cert'), - 'IDX_PAYPAL_CERT_WEBSITE', -); - -$installer->getConnection()->dropIndex( - $installer->getTable('paypal/settlement_report'), - 'UNQ_REPORT_DATE_ACCOUNT', -); - -$installer->getConnection()->dropIndex( - $installer->getTable('paypal/settlement_report_row'), - 'IDX_REPORT_ID', -); - -/** - * Change columns - */ -$tables = [ - $installer->getTable('paypal/settlement_report') => [ - 'columns' => [ - 'report_id' => [ - 'type' => Varien_Db_Ddl_Table::TYPE_INTEGER, - 'identity' => true, - 'unsigned' => true, - 'nullable' => false, - 'primary' => true, - 'comment' => 'Report Id', - ], - 'report_date' => [ - 'type' => Varien_Db_Ddl_Table::TYPE_TIMESTAMP, - 'comment' => 'Report Date', - ], - 'account_id' => [ - 'type' => Varien_Db_Ddl_Table::TYPE_TEXT, - 'length' => 64, - 'comment' => 'Account Id', - ], - 'filename' => [ - 'type' => Varien_Db_Ddl_Table::TYPE_TEXT, - 'length' => 24, - 'comment' => 'Filename', - ], - 'last_modified' => [ - 'type' => Varien_Db_Ddl_Table::TYPE_TIMESTAMP, - 'comment' => 'Last Modified', - ], - ], - 'comment' => 'Paypal Settlement Report Table', - ], - $installer->getTable('paypal/settlement_report_row') => [ - 'columns' => [ - 'row_id' => [ - 'type' => Varien_Db_Ddl_Table::TYPE_INTEGER, - 'identity' => true, - 'unsigned' => true, - 'nullable' => false, - 'primary' => true, - 'comment' => 'Row Id', - ], - 'report_id' => [ - 'type' => Varien_Db_Ddl_Table::TYPE_INTEGER, - 'unsigned' => true, - 'nullable' => false, - 'comment' => 'Report Id', - ], - 'transaction_id' => [ - 'type' => Varien_Db_Ddl_Table::TYPE_TEXT, - 'length' => 19, - 'comment' => 'Transaction Id', - ], - 'invoice_id' => [ - 'type' => Varien_Db_Ddl_Table::TYPE_TEXT, - 'length' => 127, - 'comment' => 'Invoice Id', - ], - 'paypal_reference_id' => [ - 'type' => Varien_Db_Ddl_Table::TYPE_TEXT, - 'length' => 19, - 'comment' => 'Paypal Reference Id', - ], - 'paypal_reference_id_type' => [ - 'type' => Varien_Db_Ddl_Table::TYPE_TEXT, - 'length' => 3, - 'comment' => 'Paypal Reference Id Type', - ], - 'transaction_event_code' => [ - 'type' => Varien_Db_Ddl_Table::TYPE_TEXT, - 'length' => 5, - 'comment' => 'Transaction Event Code', - ], - 'transaction_initiation_date' => [ - 'type' => Varien_Db_Ddl_Table::TYPE_TIMESTAMP, - 'comment' => 'Transaction Initiation Date', - ], - 'transaction_completion_date' => [ - 'type' => Varien_Db_Ddl_Table::TYPE_TIMESTAMP, - 'comment' => 'Transaction Completion Date', - ], - 'transaction_debit_or_credit' => [ - 'type' => Varien_Db_Ddl_Table::TYPE_TEXT, - 'length' => 2, - 'nullable' => false, - 'default' => 'CR', - 'comment' => 'Transaction Debit Or Credit', - ], - 'gross_transaction_amount' => [ - 'type' => Varien_Db_Ddl_Table::TYPE_DECIMAL, - 'scale' => 6, - 'precision' => 20, - 'nullable' => false, - 'default' => '0.000000', - 'comment' => 'Gross Transaction Amount', - ], - 'gross_transaction_currency' => [ - 'type' => Varien_Db_Ddl_Table::TYPE_TEXT, - 'length' => 3, - 'default' => '', - 'comment' => 'Gross Transaction Currency', - ], - 'fee_debit_or_credit' => [ - 'type' => Varien_Db_Ddl_Table::TYPE_TEXT, - 'length' => 2, - 'comment' => 'Fee Debit Or Credit', - ], - 'fee_amount' => [ - 'type' => Varien_Db_Ddl_Table::TYPE_DECIMAL, - 'scale' => 6, - 'precision' => 20, - 'nullable' => false, - 'default' => '0.000000', - 'comment' => 'Fee Amount', - ], - 'fee_currency' => [ - 'type' => Varien_Db_Ddl_Table::TYPE_TEXT, - 'length' => 3, - 'comment' => 'Fee Currency', - ], - 'custom_field' => [ - 'type' => Varien_Db_Ddl_Table::TYPE_TEXT, - 'length' => 255, - 'comment' => 'Custom Field', - ], - 'consumer_id' => [ - 'type' => Varien_Db_Ddl_Table::TYPE_TEXT, - 'length' => 127, - 'comment' => 'Consumer Id', - ], - ], - 'comment' => 'Paypal Settlement Report Row Table', - ], - $installer->getTable('paypal/cert') => [ - 'columns' => [ - 'cert_id' => [ - 'type' => Varien_Db_Ddl_Table::TYPE_SMALLINT, - 'identity' => true, - 'unsigned' => true, - 'nullable' => false, - 'primary' => true, - 'comment' => 'Cert Id', - ], - 'website_id' => [ - 'type' => Varien_Db_Ddl_Table::TYPE_SMALLINT, - 'unsigned' => true, - 'nullable' => false, - 'default' => '0', - 'comment' => 'Website Id', - ], - 'content' => [ - 'type' => Varien_Db_Ddl_Table::TYPE_TEXT, - 'length' => '64K', - 'comment' => 'Content', - ], - 'updated_at' => [ - 'type' => Varien_Db_Ddl_Table::TYPE_TIMESTAMP, - 'comment' => 'Updated At', - ], - ], - 'comment' => 'Paypal Certificate Table', - ], - $installer->getTable('sales/quote_payment') => [ - 'columns' => [ - 'paypal_payer_id' => [ - 'type' => Varien_Db_Ddl_Table::TYPE_TEXT, - 'length' => 255, - 'comment' => 'Paypal Payer Id', - ], - 'paypal_payer_status' => [ - 'type' => Varien_Db_Ddl_Table::TYPE_TEXT, - 'length' => 255, - 'comment' => 'Paypal Payer Status', - ], - 'paypal_correlation_id' => [ - 'type' => Varien_Db_Ddl_Table::TYPE_TEXT, - 'length' => 255, - 'comment' => 'Paypal Correlation Id', - ], - ], - ], - $installer->getTable('sales/order') => [ - 'columns' => [ - 'paypal_ipn_customer_notified' => [ - 'type' => Varien_Db_Ddl_Table::TYPE_INTEGER, - 'comment' => 'Paypal Ipn Customer Notified', - ], - ], - ], -]; - -$installer->getConnection()->modifyTables($tables); - -/** - * Add indexes - */ -$installer->getConnection()->addIndex( - $installer->getTable('paypal/cert'), - $installer->getIdxName('paypal/cert', ['website_id']), - ['website_id'], -); - -$installer->getConnection()->addIndex( - $installer->getTable('paypal/settlement_report'), - $installer->getIdxName( - 'paypal/settlement_report', - ['report_date', 'account_id'], - Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE, - ), - ['report_date', 'account_id'], - Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE, -); - -$installer->getConnection()->addIndex( - $installer->getTable('paypal/settlement_report_row'), - $installer->getIdxName('paypal/settlement_report_row', ['report_id']), - ['report_id'], -); - -/** - * Add foreign keys - */ -$installer->getConnection()->addForeignKey( - $installer->getFkName('paypal/settlement_report_row', 'report_id', 'paypal/settlement_report', 'report_id'), - $installer->getTable('paypal/settlement_report_row'), - 'report_id', - $installer->getTable('paypal/settlement_report'), - 'report_id', -); - -$installer->getConnection()->addForeignKey( - $installer->getFkName('paypal/cert', 'website_id', 'core/website', 'website_id'), - $installer->getTable('paypal/cert'), - 'website_id', - $installer->getTable('core/website'), - 'website_id', -); - -$installer->endSetup(); diff --git a/app/code/core/Mage/Paypal/sql/paypal_setup/upgrade-1.6.0.0-1.6.0.1.php b/app/code/core/Mage/Paypal/sql/paypal_setup/upgrade-1.6.0.0-1.6.0.1.php deleted file mode 100644 index 1a9e6361cdf..00000000000 --- a/app/code/core/Mage/Paypal/sql/paypal_setup/upgrade-1.6.0.0-1.6.0.1.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php - -/** - * @copyright For copyright and license information, read the COPYING.txt file. - * @link /COPYING.txt - * @license Open Software License (OSL 3.0) - * @package Mage_Paypal - */ - -/** @var Mage_Paypal_Model_Resource_Setup $installer */ -$installer = $this; - -/** - * Create table 'paypal/payment_transaction' - */ -$table = $installer->getConnection() - ->newTable($installer->getTable('paypal/payment_transaction')) - ->addColumn('transaction_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, [ - 'identity' => true, - 'unsigned' => true, - 'nullable' => false, - 'primary' => true, - ], 'Entity Id') - ->addColumn('txn_id', Varien_Db_Ddl_Table::TYPE_TEXT, 100, [ - ], 'Txn Id') - ->addColumn('additional_information', Varien_Db_Ddl_Table::TYPE_BLOB, '64K', [ - ], 'Additional Information') - ->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, [ - ], 'Created At') - ->addIndex( - $installer->getIdxName( - 'paypal/payment_transaction', - ['txn_id'], - Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE, - ), - ['txn_id'], - ['type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE], - ) - ->setComment('PayPal Payflow Link Payment Transaction'); -$installer->getConnection()->createTable($table); diff --git a/app/code/core/Mage/Paypal/sql/paypal_setup/upgrade-1.6.0.1-1.6.0.2.php b/app/code/core/Mage/Paypal/sql/paypal_setup/upgrade-1.6.0.1-1.6.0.2.php deleted file mode 100644 index 845c4da219f..00000000000 --- a/app/code/core/Mage/Paypal/sql/paypal_setup/upgrade-1.6.0.1-1.6.0.2.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -/** - * @copyright For copyright and license information, read the COPYING.txt file. - * @link /COPYING.txt - * @license Open Software License (OSL 3.0) - * @package Mage_Paypal - */ - -/** @var Mage_Paypal_Model_Resource_Setup $installer */ -$installer = $this; - -$installer->getConnection() - ->addColumn($installer->getTable('paypal/settlement_report_row'), 'payment_tracking_id', [ - 'type' => Varien_Db_Ddl_Table::TYPE_TEXT, - 'comment' => 'Payment Tracking ID', - 'length' => '255', - ]); diff --git a/app/code/core/Mage/Paypal/sql/paypal_setup/upgrade-1.6.0.3-1.6.0.4.php b/app/code/core/Mage/Paypal/sql/paypal_setup/upgrade-1.6.0.3-1.6.0.4.php deleted file mode 100644 index cde23eb8b74..00000000000 --- a/app/code/core/Mage/Paypal/sql/paypal_setup/upgrade-1.6.0.3-1.6.0.4.php +++ /dev/null @@ -1,17 +0,0 @@ -<?php - -/** - * @copyright For copyright and license information, read the COPYING.txt file. - * @link /COPYING.txt - * @license Open Software License (OSL 3.0) - * @package Mage_Paypal - */ - -/** @var Mage_Paypal_Model_Resource_Setup $installer */ -$installer = $this; - -$installer->getConnection() - ->addColumn($installer->getTable('paypal/settlement_report_row'), 'store_id', [ - 'type' => Varien_Db_Ddl_Table::TYPE_TEXT, - 'comment' => 'Store ID', - 'length' => '50']); diff --git a/app/code/core/Mage/Paypal/sql/paypal_setup/upgrade-1.6.0.6-2.0.0.0.php b/app/code/core/Mage/Paypal/sql/paypal_setup/upgrade-1.6.0.6-2.0.0.0.php new file mode 100644 index 00000000000..fd5b3a88bde --- /dev/null +++ b/app/code/core/Mage/Paypal/sql/paypal_setup/upgrade-1.6.0.6-2.0.0.0.php @@ -0,0 +1,207 @@ +<?php + +/** + * @copyright For copyright and license information, read the COPYING.txt file. + * @link /COPYING.txt + * @license Open Software License (OSL 3.0) + * @package Mage_Paypal + */ + +/** + * PayPal installation script + * + * @category Mage + * @package Mage_Paypal + */ +$installer = $this; +/* @var $installer Mage_Paypal_Model_Resource_Setup */ + +$installer->startSetup(); +$debugTableName = 'paypal/debug'; + +$installer->getConnection()->dropTable($installer->getTable($debugTableName)); + +$debugTable = $installer->getConnection() + ->newTable($installer->getTable($debugTableName)) + ->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, [ + 'identity' => true, + 'unsigned' => true, + 'nullable' => false, + 'primary' => true, + ], 'Entity ID') + ->addColumn('quote_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, [ + 'unsigned' => true, + 'nullable' => true, + ], 'Quote ID') + ->addColumn('increment_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 50, [ + 'nullable' => true, + ], 'Quote Increment ID') + ->addColumn('action', Varien_Db_Ddl_Table::TYPE_VARCHAR, 50, [ + 'nullable' => false, + ], 'Action') + ->addColumn('transaction_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, [ + 'nullable' => true, + ], 'Transaction ID') + ->addColumn('request_body', Varien_Db_Ddl_Table::TYPE_TEXT, null, [ + 'nullable' => true, + ], 'Request Body') + ->addColumn('response_body', Varien_Db_Ddl_Table::TYPE_TEXT, null, [ + 'nullable' => true, + ], 'Response Body') + ->addColumn('exception_message', Varien_Db_Ddl_Table::TYPE_TEXT, null, [ + 'nullable' => true, + ], 'Exception Message') + ->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, [ + 'nullable' => false, + 'default' => Varien_Db_Ddl_Table::TIMESTAMP_INIT, + ], 'Created At') + ->addIndex( + $installer->getIdxName($debugTableName, ['quote_id']), + ['quote_id'], + ) + ->addIndex( + $installer->getIdxName($debugTableName, ['increment_id']), + ['increment_id'], + )->addIndex( + $installer->getIdxName($debugTableName, ['transaction_id']), + ['transaction_id'], + ) + ->addForeignKey( + $installer->getFkName($debugTableName, 'quote_id', 'sales/quote', 'entity_id'), + 'quote_id', + $installer->getTable('sales/quote'), + 'entity_id', + Varien_Db_Ddl_Table::ACTION_CASCADE, + Varien_Db_Ddl_Table::ACTION_CASCADE, + ) + ->addForeignKey( + $installer->getFkName($debugTableName, 'increment_id', 'sales/order', 'increment_id'), + 'increment_id', + $installer->getTable('sales/order'), + 'increment_id', + Varien_Db_Ddl_Table::ACTION_SET_NULL, + Varien_Db_Ddl_Table::ACTION_NO_ACTION, + ) + ->setComment('PayPal Debug Table'); +$installer->getConnection()->createTable($debugTable); + +$installer->getConnection()->delete( + $installer->getTable('core_resource'), + $installer->getConnection()->quoteInto('code = ?', 'paypaluk_setup'), +); +$status = 'paypal_auth_expired'; +$statusLabel = 'PayPal Authorization Expired'; + +$installer->getConnection()->insert( + $installer->getTable('sales/order_status'), + [ + 'status' => $status, + 'label' => $statusLabel, + ], +); + +$installer->getConnection()->insert( + $installer->getTable('sales/order_status_state'), + [ + 'status' => $status, + 'state' => Mage_Sales_Model_Order::STATE_HOLDED, + 'is_default' => 0, + ], +); + +$installer->getConnection()->delete( + $installer->getTable('core/config_data'), + $installer->getConnection()->quoteInto('path IN (?)', [ + 'payment/paypal_billing_agreement/active', + 'payment/paypal_billing_agreement/sort_order', + 'payment/paypal_billing_agreement/payment_action', + 'payment/paypal_billing_agreement/allowspecific', + 'payment/paypal_billing_agreement/debug', + 'payment/paypal_billing_agreement/verify_peer', + 'payment/paypal_billing_agreement/line_items_enabled', + 'payment/paypal_billing_agreement/allow_billing_agreement_wizard', + 'payment/paypal_express/sort_order', + 'payment/paypal_express/payment_action', + 'payment/paypal_express/visible_on_cart', + 'payment/paypal_express/visible_on_product', + 'payment/paypal_express/allowspecific', + 'payment/paypal_express/debug', + 'payment/paypal_express/verify_peer', + 'payment/paypal_express/line_items_enabled', + 'payment/paypal_express/transfer_shipping_options', + 'payment/paypal_express/solution_type', + 'payment/paypal_express/require_billing_address', + 'payment/paypal_express/allow_ba_signup', + 'payment/paypal_direct/using_pbridge', + 'payment/paypal_direct/active', + 'payment/paypal_direct/sort_order', + 'payment/paypal_direct/payment_action', + 'payment/paypal_direct/cctypes', + 'payment/paypal_direct/allowspecific', + 'payment/paypal_direct/debug', + 'payment/paypal_direct/verify_peer', + 'payment/paypal_direct/line_items_enabled', + 'payment/paypal_direct/useccv', + 'payment/paypal_direct/centinel', + 'payment/paypal_standard/active', + 'payment/paypal_standard/sort_order', + 'payment/paypal_standard/payment_action', + 'payment/paypal_standard/allowspecific', + 'payment/paypal_standard/sandbox_flag', + 'payment/paypal_standard/line_items_enabled', + 'payment/paypal_standard/debug', + 'payment/paypal_standard/verify_peer', + 'payment/paypaluk_express/active', + 'payment/paypaluk_express/sort_order', + 'payment/paypaluk_express/payment_action', + 'payment/paypaluk_express/visible_on_cart', + 'payment/paypaluk_express/visible_on_product', + 'payment/paypaluk_express/allowspecific', + 'payment/paypaluk_express/debug', + 'payment/paypaluk_express/verify_peer', + 'payment/paypaluk_express/line_items_enabled', + 'payment/paypal_express/active', + 'payment/paypal_express/skip_order_review_step', + 'payment/paypal_express_bml/active', + 'payment/paypal_express_bml/publisher_id', + 'payment/paypal_express_bml/homepage_display', + 'payment/paypal_express_bml/homepage_position', + 'payment/paypal_express_bml/homepage_size', + 'payment/paypal_express_bml/categorypage_display', + 'payment/paypal_express_bml/categorypage_position', + 'payment/paypal_express_bml/categorypage_size', + 'payment/paypal_express_bml/productpage_display', + 'payment/paypal_express_bml/productpage_position', + 'payment/paypal_express_bml/productpage_size', + 'payment/paypal_express_bml/checkout_display', + 'payment/paypal_express_bml/checkout_position', + 'payment/paypal_express_bml/checkout_size', + 'payment/paypaluk_express_bml/active', + 'payment/paypal_standard/was_active', + 'payment/paypal_wps_express/active', + 'paypal/wpp/api_authentication', + 'paypal/wpp/api_username', + 'paypal/wpp/api_password', + 'paypal/wpp/api_signature', + 'paypal/wpp/sandbox_flag', + 'paypal/wpp/use_proxy', + 'paypal/fetch_reports/ftp_login', + 'paypal/fetch_reports/ftp_password', + 'paypal/fetch_reports/ftp_sandbox', + 'paypal/fetch_reports/ftp_ip', + 'paypal/fetch_reports/ftp_path', + 'paypal/fetch_reports/active', + 'paypal/fetch_reports/schedule', + 'paypal/fetch_reports/time', + 'paypal/style/logo', + 'paypal/style/page_style', + 'paypal/style/paypal_hdrimg', + 'paypal/style/paypal_hdrbackcolor', + 'paypal/style/paypal_hdrbordercolor', + 'paypal/style/paypal_payflowcolor', + 'paypal/wpp/button_flavor', + 'paypal/general/business_account', + ]), +); + +$installer->endSetup(); diff --git a/app/code/core/Mage/PaypalUk/Block/Bml/Form.php b/app/code/core/Mage/PaypalUk/Block/Bml/Form.php deleted file mode 100644 index 38819454c83..00000000000 --- a/app/code/core/Mage/PaypalUk/Block/Bml/Form.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php - -/** - * @copyright For copyright and license information, read the COPYING.txt file. - * @link /COPYING.txt - * @license Open Software License (OSL 3.0) - * @package Mage_PaypalUk - */ - -/** - * Bill Me Later payment form - * - * @package Mage_PaypalUk - */ -class Mage_PaypalUk_Block_Bml_Form extends Mage_Paypal_Block_Bml_Form -{ - /** - * Payment method code - * @var string - */ - protected $_methodCode = Mage_Paypal_Model_Config::METHOD_WPP_PE_BML; -} diff --git a/app/code/core/Mage/PaypalUk/Block/Express/Form.php b/app/code/core/Mage/PaypalUk/Block/Express/Form.php deleted file mode 100644 index c3028eacb74..00000000000 --- a/app/code/core/Mage/PaypalUk/Block/Express/Form.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php - -/** - * @copyright For copyright and license information, read the COPYING.txt file. - * @link /COPYING.txt - * @license Open Software License (OSL 3.0) - * @package Mage_PaypalUk - */ - -/** - * @package Mage_PaypalUk - */ -class Mage_PaypalUk_Block_Express_Form extends Mage_Paypal_Block_Express_Form -{ - /** - * Payment method code - * @var string - */ - protected $_methodCode = Mage_Paypal_Model_Config::METHOD_WPP_PE_EXPRESS; -} diff --git a/app/code/core/Mage/PaypalUk/Block/Express/Shortcut.php b/app/code/core/Mage/PaypalUk/Block/Express/Shortcut.php deleted file mode 100644 index 9689c74d1e0..00000000000 --- a/app/code/core/Mage/PaypalUk/Block/Express/Shortcut.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php - -/** - * @copyright For copyright and license information, read the COPYING.txt file. - * @link /COPYING.txt - * @license Open Software License (OSL 3.0) - * @package Mage_PaypalUk - */ - -/** - * Paypal expess checkout shortcut link - * - * @package Mage_PaypalUk - */ -class Mage_PaypalUk_Block_Express_Shortcut extends Mage_Paypal_Block_Express_Shortcut -{ - /** - * Payment method code - * - * @var string - */ - protected $_paymentMethodCode = Mage_Paypal_Model_Config::METHOD_WPP_PE_EXPRESS; - - /** - * Start express action - * - * @var string - */ - protected $_startAction = 'paypaluk/express/start/button/1'; - - /** - * Express checkout model factory name - * - * @var string - */ - protected $_checkoutType = 'paypaluk/express_checkout'; - - /** - * @param $quote - * @return $this - */ - protected function _getBmlShortcut($quote) - { - $bml = Mage::helper('payment')->getMethodInstance(Mage_Paypal_Model_Config::METHOD_WPP_PE_BML); - $isBmlEnabled = $bml && $bml->isAvailable($quote); - /** @var Mage_Core_Helper_Data $helper */ - $helper = $this->helper('core'); - $this->setBmlShortcutHtmlId($helper->uniqHash('ec_shortcut_bml_')) - ->setBmlCheckoutUrl($this->getUrl('paypaluk/bml/start/button/1')) - ->setBmlImageUrl('https://www.paypalobjects.com/webstatic/en_US/i/buttons/ppcredit-logo-medium.png') - ->setMarketMessage('https://www.paypalobjects.com/webstatic/en_US/btn/btn_bml_text.png') - ->setMarketMessageUrl('https://www.securecheckout.billmelater.com/paycapture-content/' - . 'fetch?hash=AU826TU8&content=/bmlweb/ppwpsiw.html') - ->setIsBmlEnabled($isBmlEnabled); - return $this; - } -} diff --git a/app/code/core/Mage/PaypalUk/Helper/Data.php b/app/code/core/Mage/PaypalUk/Helper/Data.php deleted file mode 100644 index 48a78bcd38f..00000000000 --- a/app/code/core/Mage/PaypalUk/Helper/Data.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -/** - * @copyright For copyright and license information, read the COPYING.txt file. - * @link /COPYING.txt - * @license Open Software License (OSL 3.0) - * @package Mage_PaypalUk - */ - -/** - * PaypalUk data helper - * - * @package Mage_PaypalUk - */ -class Mage_PaypalUk_Helper_Data extends Mage_Core_Helper_Abstract -{ - protected $_moduleName = 'Mage_PaypalUk'; -} diff --git a/app/code/core/Mage/PaypalUk/Model/Api/Express/Nvp.php b/app/code/core/Mage/PaypalUk/Model/Api/Express/Nvp.php deleted file mode 100644 index 325b241a5b0..00000000000 --- a/app/code/core/Mage/PaypalUk/Model/Api/Express/Nvp.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php - -/** - * @copyright For copyright and license information, read the COPYING.txt file. - * @link /COPYING.txt - * @license Open Software License (OSL 3.0) - * @package Mage_PaypalUk - */ - -/** - * Payflow Express NVP API wrappers model - * - * @package Mage_PaypalUk - */ -class Mage_PaypalUk_Model_Api_Express_Nvp extends Mage_PaypalUk_Model_Api_Nvp -{ - /** - * Set specific data when negative line item case - */ - protected function _setSpecificForNegativeLineItems() - { - $paypalNvp = new Mage_Paypal_Model_Api_Nvp(); - $this->_setExpressCheckoutResponse = $paypalNvp->_setExpressCheckoutResponse; - $index = array_search('PPREF', $this->_doExpressCheckoutPaymentResponse); - if ($index !== false) { - unset($this->_doExpressCheckoutPaymentResponse[$index]); - } - $this->_doExpressCheckoutPaymentResponse[] = 'PAYMENTINFO_0_TRANSACTIONID'; - $this->_requiredResponseParams[self::DO_EXPRESS_CHECKOUT_PAYMENT][] = 'PAYMENTINFO_0_TRANSACTIONID'; - } -} diff --git a/app/code/core/Mage/PaypalUk/Model/Api/Nvp.php b/app/code/core/Mage/PaypalUk/Model/Api/Nvp.php deleted file mode 100644 index e3a9f7aad0c..00000000000 --- a/app/code/core/Mage/PaypalUk/Model/Api/Nvp.php +++ /dev/null @@ -1,607 +0,0 @@ -<?php - -/** - * @copyright For copyright and license information, read the COPYING.txt file. - * @link /COPYING.txt - * @license Open Software License (OSL 3.0) - * @package Mage_PaypalUk - */ - -/** - * NVP API wrappers model - * - * @package Mage_PaypalUk - */ -class Mage_PaypalUk_Model_Api_Nvp extends Mage_Paypal_Model_Api_Nvp -{ - /** - * Transaction types declaration - * - * @var mixed - */ - public const TRXTYPE_AUTH_ONLY = 'A'; - public const TRXTYPE_SALE = 'S'; - public const TRXTYPE_CREDIT = 'C'; - public const TRXTYPE_DELAYED_CAPTURE = 'D'; - public const TRXTYPE_DELAYED_VOID = 'V'; - - /** - * Tender definition - * - * @var mixed - */ - public const TENDER_CC = 'C'; - public const TENDER_PAYPAL = 'P'; - - /** - * Express Checkout Actions - * - * @var string - */ - public const EXPRESS_SET = 'S'; - public const EXPRESS_GET = 'G'; - public const EXPRESS_DO_PAYMENT = 'D'; - - /** - * Response codes definition - * - * @var mixed - */ - public const RESPONSE_CODE_APPROVED = 0; - public const RESPONSE_CODE_FRAUD = 126; - - /** - * Capture types (make authorization close or remain open) - * - * @var string - */ - protected $_captureTypeComplete = 'Y'; - protected $_captureTypeNotcomplete = 'N'; - - /** - * Global public interface map - * - * @var array - */ - protected $_globalMap = [ - // each call - 'PARTNER' => 'partner', - 'VENDOR' => 'vendor', - 'USER' => 'user', - 'PWD' => 'password', - 'BUTTONSOURCE' => 'build_notation_code', - 'TENDER' => 'tender', - // commands - 'RETURNURL' => 'return_url', - 'CANCELURL' => 'cancel_url', - 'INVNUM' => 'inv_num', - 'TOKEN' => 'token', - 'CORRELATIONID' => 'correlation_id', - 'CUSTIP' => 'ip_address', - 'NOTIFYURL' => 'notify_url', - 'NOTE' => 'note', - // style settings - 'PAGESTYLE' => 'page_style', - 'HDRIMG' => 'hdrimg', - 'HDRBORDERCOLOR' => 'hdrbordercolor', - 'HDRBACKCOLOR' => 'hdrbackcolor', - 'PAYFLOWCOLOR' => 'payflowcolor', - 'LOCALECODE' => 'locale_code', - - // transaction info - 'PPREF' => 'paypal_transaction_id', //We need to store paypal trx id for correct IPN working - 'PAYMENTINFO_0_TRANSACTIONID' => 'paypal_transaction_id', - 'TRANSACTIONID' => 'paypal_transaction_id', - 'REFUNDTRANSACTIONID' => 'paypal_transaction_id', - - 'PNREF' => 'transaction_id', - 'ORIGID' => 'authorization_id', - 'CAPTURECOMPLETE' => 'complete_type', - 'AMT' => 'amount', - 'AVSADDR' => 'address_verification', - 'AVSZIP' => 'postcode_verification', - - // payment/billing info - 'CURRENCY' => 'currency_code', - 'PAYMENTSTATUS' => 'payment_status', - 'PENDINGREASON' => 'pending_reason', - 'PAYERID' => 'payer_id', - 'PAYERSTATUS' => 'payer_status', - 'EMAIL' => 'email', - // backwards compatibility - 'FIRSTNAME' => 'firstname', - 'LASTNAME' => 'lastname', - // paypal direct credit card information - 'ACCT' => 'credit_card_number', - 'EXPDATE' => 'credit_card_expiration_date', - 'CVV2' => 'credit_card_cvv2', - 'CARDSTART' => 'maestro_solo_issue_date', // MMYY, including leading zero - 'CARDISSUE' => 'maestro_solo_issue_number', - 'CVV2MATCH' => 'cvv2_check_result', - // cardinal centinel - 'AUTHSTATUS3DS' => 'centinel_authstatus', - 'MPIVENDOR3DS' => 'centinel_mpivendor', - 'CAVV' => 'centinel_cavv', - 'ECI' => 'centinel_eci', - 'XID' => 'centinel_xid', - 'VPAS' => 'centinel_vpas_result', - 'ECISUBMITTED3DS' => 'centinel_eci_result', - 'USERSELECTEDFUNDINGSOURCE' => 'funding_source', - ]; - - /** - * Fields that should be replaced in debug with '***' - * - * @var array - */ - protected $_debugReplacePrivateDataKeys = [ - 'ACCT', 'EXPDATE', 'CVV2', - 'PARTNER', 'USER', 'VENDOR', 'PWD', - ]; - - /** - * DoDirectPayment request/response map - * - * @var array - */ - protected $_doDirectPaymentRequest = [ - 'ACCT', 'EXPDATE', 'CVV2', 'CURRENCY', 'EMAIL', 'TENDER', 'NOTIFYURL', - 'AMT', 'CUSTIP', 'INVNUM', - 'CARDISSUE', 'CARDSTART', - 'AUTHSTATUS3DS', 'MPIVENDOR3DS', 'CAVV', 'ECI', 'XID',//cardinal centinel params - 'TAXAMT', 'FREIGHTAMT', - ]; - protected $_doDirectPaymentResponse = [ - 'PNREF', 'PPREF', 'CORRELATIONID', 'CVV2MATCH', 'AVSADDR', 'AVSZIP', 'PENDINGREASON', - ]; - - /** - * DoCapture request/response map - * - * @var array - */ - protected $_doCaptureRequest = ['ORIGID', 'CAPTURECOMPLETE', 'AMT', 'TENDER', 'NOTE', 'INVNUM']; - protected $_doCaptureResponse = ['PNREF', 'PPREF']; - - /** - * DoVoid request map - * - * @var array - */ - protected $_doVoidRequest = ['ORIGID', 'NOTE', 'TENDER']; - - /** - * Request map for each API call - * - * @var array - */ - protected $_eachCallRequest = ['PARTNER', 'USER', 'VENDOR', 'PWD', 'BUTTONSOURCE']; - - /** - * RefundTransaction request/response map - * - * @var array - */ - protected $_refundTransactionRequest = ['ORIGID', 'TENDER']; - protected $_refundTransactionResponse = ['PNREF', 'PPREF']; - - /** - * SetExpressCheckout request/response map - * - * @var array - */ - protected $_setExpressCheckoutRequest = [ - 'TENDER', 'AMT', 'CURRENCY', 'RETURNURL', 'CANCELURL', 'INVNUM', - 'PAGESTYLE', 'HDRIMG', 'HDRBORDERCOLOR', 'HDRBACKCOLOR', 'PAYFLOWCOLOR', 'LOCALECODE', - 'USERSELECTEDFUNDINGSOURCE', - ]; - protected $_setExpressCheckoutResponse = ['REPMSG', 'TOKEN']; - - /** - * GetExpressCheckoutDetails request/response map - * - * @var array - */ - protected $_getExpressCheckoutDetailsRequest = ['TENDER', 'TOKEN']; - - /** - * DoExpressCheckoutPayment request/response map - * - * @var array - */ - protected $_doExpressCheckoutPaymentRequest = [ - 'TENDER', 'TOKEN', 'PAYERID', 'AMT', 'CURRENCY', 'CUSTIP', 'BUTTONSOURCE', 'NOTIFYURL', - ]; - protected $_doExpressCheckoutPaymentResponse = [ - 'PNREF', 'PPREF', 'REPMSG', 'AMT', 'PENDINGREASON', - 'CVV2MATCH', 'AVSADDR', 'AVSZIP', 'CORRELATIONID', - ]; - - /** - * GetTransactionDetailsRequest - * - * @var array - */ - protected $_getTransactionDetailsRequest = ['ORIGID', 'TENDER']; - protected $_getTransactionDetailsResponse = [ - 'PAYERID', 'FIRSTNAME', 'LASTNAME', 'TRANSACTIONID', - 'PARENTTRANSACTIONID', 'CURRENCYCODE', 'AMT', 'PAYMENTSTATUS', - ]; - - /** - * Map for shipping address import/export (extends billing address mapper) - * - * @var array - */ - protected $_shippingAddressMap = [ - 'SHIPTOCOUNTRY' => 'country_id', - 'SHIPTOSTATE' => 'region', - 'SHIPTOCITY' => 'city', - 'SHIPTOSTREET' => 'street', - 'SHIPTOSTREET2' => 'street2', - 'SHIPTOZIP' => 'postcode', - 'SHIPTOPHONENUM' => 'telephone', // does not supported by PaypalUk - ]; - - /** - * Map for billing address import/export - * - * @var array - */ - protected $_billingAddressMap = [ - 'BUSINESS' => 'company', - 'NOTETEXT' => 'customer_notes', - 'EMAIL' => 'email', - 'FIRSTNAME' => 'firstname', - 'LASTNAME' => 'lastname', - 'MIDDLENAME' => 'middlename', - 'SALUTATION' => 'prefix', - 'SUFFIX' => 'suffix', - - 'COUNTRYCODE' => 'country_id', // iso-3166 two-character code - 'STATE' => 'region', - 'CITY' => 'city', - 'STREET' => 'street', - 'STREET2' => 'street2', - 'ZIP' => 'postcode', - 'PHONENUM' => 'telephone', - ]; - - /** - * Map for billing address to do request to PayPalUk - * - * @var array - */ - protected $_billingAddressMapRequest = [ - 'country_id' => 'COUNTRY', - ]; - - /** - * Line items export mapping settings - * - * @var array - */ - protected $_lineItemTotalExportMap = [ - Mage_Paypal_Model_Cart::TOTAL_TAX => 'TAXAMT', - Mage_Paypal_Model_Cart::TOTAL_SHIPPING => 'FREIGHTAMT', - ]; - - protected $_lineItemExportItemsFormat = [ - 'name' => 'L_NAME%d', - 'qty' => 'L_QTY%d', - 'amount' => 'L_COST%d', - ]; - - /** - * Payment information response specifically to be collected after some requests - * - * @var array - */ - protected $_paymentInformationResponse = [ - 'PAYERID', 'CORRELATIONID', 'ADDRESSID', 'ADDRESSSTATUS', - 'PAYMENTSTATUS', 'PENDINGREASON', 'PROTECTIONELIGIBILITY', 'EMAIL', - ]; - - /** - * Required fields in the response - * - * @var array - */ - protected $_requiredResponseParams = [ - self::DO_DIRECT_PAYMENT => ['RESULT', 'PNREF'], - ]; - - /** - * API endpoint getter - * - * @return string - */ - public function getApiEndpoint() - { - return sprintf('https://%spayflowpro.paypal.com/transaction', $this->_config->sandboxFlag ? 'pilot-' : ''); - } - - /** - * Return PaypalUk partner based on config data - * - * @return string - */ - public function getPartner() - { - return $this->_getDataOrConfig('partner'); - } - - /** - * Return PaypalUk user based on config data - * - * @return string - */ - public function getUser() - { - return $this->_getDataOrConfig('user'); - } - - /** - * Return PaypalUk password based on config data - * - * @return string - */ - public function getPassword() - { - return $this->_getDataOrConfig('pwd'); - } - - /** - * Return PaypalUk vendor based on config data - * - * @return string - */ - public function getVendor() - { - return $this->_getDataOrConfig('vendor'); - } - - /** - * Return PaypalUk tender based on config data - * - * @return string - */ - public function getTender() - { - if ($this->_config->getMethodCode() == Mage_Paypal_Model_Config::METHOD_WPP_PE_EXPRESS) { - return self::TENDER_PAYPAL; - } - return self::TENDER_CC; - } - - /** - * Override transaction id getting to process payflow accounts not assigned to paypal side - * - * @return string - */ - public function getPaypalTransactionId() - { - if ($this->getData('paypal_transaction_id')) { - return $this->getData('paypal_transaction_id'); - } - return $this->getTransactionId(); - } - - /** - * Add method to request array - * - * @param string $methodName - * @param array $request - * @return array - */ - protected function _addMethodToRequest($methodName, $request) - { - $request['TRXTYPE'] = $this->_mapPaypalMethodName($methodName); - if (!is_null($this->_getPaypalUkActionName($methodName))) { - $request['ACTION'] = $this->_getPaypalUkActionName($methodName); - } - return $request; - } - - /** - * Return Payflow Edition - * - * @param string $methodName - * @return string|null - */ - protected function _getPaypalUkActionName($methodName) - { - return match ($methodName) { - Mage_Paypal_Model_Api_Nvp::SET_EXPRESS_CHECKOUT => self::EXPRESS_SET, - Mage_Paypal_Model_Api_Nvp::GET_EXPRESS_CHECKOUT_DETAILS => self::EXPRESS_GET, - Mage_Paypal_Model_Api_Nvp::DO_EXPRESS_CHECKOUT_PAYMENT => self::EXPRESS_DO_PAYMENT, - default => null, - }; - } - - /** - * Map paypal method names - * - * @param string $methodName - * @return string|void - */ - protected function _mapPaypalMethodName($methodName) - { - switch ($methodName) { - case Mage_Paypal_Model_Api_Nvp::DO_EXPRESS_CHECKOUT_PAYMENT: - case Mage_Paypal_Model_Api_Nvp::GET_EXPRESS_CHECKOUT_DETAILS: - case Mage_Paypal_Model_Api_Nvp::SET_EXPRESS_CHECKOUT: - case Mage_Paypal_Model_Api_Nvp::DO_DIRECT_PAYMENT: - return ($this->_config->payment_action == Mage_Paypal_Model_Config::PAYMENT_ACTION_AUTH) - ? self::TRXTYPE_AUTH_ONLY - : self::TRXTYPE_SALE; - case Mage_Paypal_Model_Api_Nvp::DO_CAPTURE: - return self::TRXTYPE_DELAYED_CAPTURE; - case Mage_Paypal_Model_Api_Nvp::DO_VOID: - return self::TRXTYPE_DELAYED_VOID; - case Mage_Paypal_Model_Api_Nvp::REFUND_TRANSACTION: - return self::TRXTYPE_CREDIT; - } - } - - /** - * Catch success calls and collect warnings - * - * @param array $response - * @return bool success flag - */ - protected function _isCallSuccessful($response) - { - $this->_callWarnings = []; - if ($response['RESULT'] == self::RESPONSE_CODE_APPROVED) { - // collect warnings - if (!empty($response['RESPMSG']) && strtoupper($response['RESPMSG']) != 'APPROVED') { - $this->_callWarnings[] = $response['RESPMSG']; - } - return true; - } - return false; - } - - /** - * Handle logical errors - * - * @param array $response - */ - protected function _handleCallErrors($response) - { - if ($response['RESULT'] != self::RESPONSE_CODE_APPROVED) { - $message = $response['RESPMSG']; - $e = new Exception(sprintf('PayPal gateway errors: %s.', $message)); - Mage::logException($e); - Mage::throwException( - Mage::helper('paypal')->__('PayPal gateway rejected the request. %s', $message), - ); - } - } - - /** - * Build query string without urlencoding from request - * - * @param array $request - * @return string - */ - protected function _buildQuery($request) - { - $result = ''; - foreach ($request as $k => $v) { - $result .= '&' . $k . '=' . $v; - } - return trim($result, '&'); - } - - /** - * Generate Request ID - * - * @return string - */ - protected function getRequestId() - { - return Mage::helper('core')->uniqHash(); - } - - /** - * "GetTransactionDetails" method does not exists in PaypalUK - */ - public function callGetTransactionDetails() {} - - /** - * Get FMF results from response, if any - */ - protected function _importFraudFiltersResult(array $from, array $collectedWarnings) - { - if ($from['RESULT'] != self::RESPONSE_CODE_FRAUD) { - return; - } - $this->setIsPaymentPending(true); - } - - /** - * Return each call request fields - * (PayFlow edition doesn't support Unilateral payments) - * - * @param string $methodName Current method name - * @return array - */ - protected function _prepareEachCallRequest($methodName) - { - return $this->_eachCallRequest; - } - - /** - * Overwrite parent logic, simply return input data - * (PayFlow edition doesn't support Unilateral payments) - * - * @param array $requestFields Standard set of values - * @return array - */ - protected function _prepareExpressCheckoutCallRequest(&$requestFields) - { - return $requestFields; - } - - /** - * Adopt specified request array to be compatible with Paypal - * Puerto Rico should be as state of USA and not as a country - * - * @param array $request - */ - protected function _applyCountryWorkarounds(&$request) - { - if (isset($request['SHIPTOCOUNTRY']) && $request['SHIPTOCOUNTRY'] == 'PR') { - $request['SHIPTOCOUNTRY'] = 'US'; - $request['SHIPTOSTATE'] = 'PR'; - } - } - - /** - * Checking negative line items - * - * @param int $i - * @return bool|void - */ - protected function _exportLineItems(array &$request, $i = 0) - { - $requestBefore = $request; - $result = parent::_exportLineItems($request, $i); - if ($this->getIsLineItemsEnabled() && $this->_cart->hasNegativeItemAmount()) { - $this->_lineItemTotalExportMap = [ - Mage_Paypal_Model_Cart::TOTAL_TAX => 'TAXAMT', - Mage_Paypal_Model_Cart::TOTAL_SHIPPING => 'FREIGHTAMT', - 'amount' => 'PAYMENTREQUEST_0_ITEMAMT', - ]; - $this->_lineItemExportItemsFormat = [ - 'name' => 'L_PAYMENTREQUEST_0_NAME%d', - 'qty' => 'L_PAYMENTREQUEST_0_QTY%d', - 'amount' => 'L_PAYMENTREQUEST_0_AMT%d', - ]; - $request = $requestBefore; - $result = parent::_exportLineItems($request, $i); - $paypalNvp = new Mage_Paypal_Model_Api_Nvp(); - $this->_doCaptureResponse = $paypalNvp->_doCaptureResponse; - $this->_refundTransactionResponse = $paypalNvp->_refundTransactionResponse; - $this->_getTransactionDetailsResponse = $paypalNvp->_getTransactionDetailsResponse; - $this->_paymentInformationResponse = $paypalNvp->_paymentInformationResponse; - $this->_headers[] = 'PAYPAL-NVP: Y'; - $this->_setSpecificForNegativeLineItems(); - } - return $result; - } - - /** - * Set specific data when negative line item case - */ - protected function _setSpecificForNegativeLineItems() - { - $index = array_search('PPREF', $this->_doDirectPaymentResponse); - if ($index !== false) { - unset($this->_doDirectPaymentResponse[$index]); - } - $this->_doDirectPaymentResponse[] = 'TRANSACTIONID'; - } -} diff --git a/app/code/core/Mage/PaypalUk/Model/Bml.php b/app/code/core/Mage/PaypalUk/Model/Bml.php deleted file mode 100644 index 242af8512c3..00000000000 --- a/app/code/core/Mage/PaypalUk/Model/Bml.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php - -/** - * @copyright For copyright and license information, read the COPYING.txt file. - * @link /COPYING.txt - * @license Open Software License (OSL 3.0) - * @package Mage_PaypalUk - */ - -/** - * PayPal Bill Me Later method - * - * @package Mage_PaypalUk - */ -class Mage_PaypalUk_Model_Bml extends Mage_Paypal_Model_Bml -{ - /** - * Payment method code - * @var string - */ - protected $_code = Mage_Paypal_Model_Config::METHOD_WPP_PE_BML; - - /** - * Checkout payment form - * @var string - */ - protected $_formBlockType = 'paypaluk/bml_form'; - - /** - * Checkout redirect URL getter for onepage checkout - * - * @return string - */ - public function getCheckoutRedirectUrl() - { - return Mage::getUrl('paypaluk/bml/start'); - } -} diff --git a/app/code/core/Mage/PaypalUk/Model/Direct.php b/app/code/core/Mage/PaypalUk/Model/Direct.php deleted file mode 100644 index 9038f0b3b8c..00000000000 --- a/app/code/core/Mage/PaypalUk/Model/Direct.php +++ /dev/null @@ -1,86 +0,0 @@ -<?php - -/** - * @copyright For copyright and license information, read the COPYING.txt file. - * @link /COPYING.txt - * @license Open Software License (OSL 3.0) - * @package Mage_PaypalUk - */ - -/** - * PayPalUk Direct Module - * - * @package Mage_PaypalUk - */ -class Mage_PaypalUk_Model_Direct extends Mage_Paypal_Model_Direct -{ - protected $_code = Mage_Paypal_Model_Config::METHOD_WPP_PE_DIRECT; - - /** - * Transaction info fetching is not implemented in PayPal Uk - */ - protected $_canFetchTransactionInfo = false; - - /** - * Website Payments Pro instance type - * - * @var string - */ - protected $_proType = 'paypaluk/pro'; - - /** - * Return available CC types for gateway based on merchant country - * - * @return string - */ - public function getAllowedCcTypes() - { - return $this->_pro->getConfig()->cctypes; - } - - /** - * Merchant country limitation for 3d secure feature, rewrite for parent implementation - * - * @return bool - */ - public function getIsCentinelValidationEnabled() - { - if (!parent::getIsCentinelValidationEnabled()) { - return false; - } - // available only for US and UK merchants - if (in_array($this->_pro->getConfig()->getMerchantCountry(), ['US', 'GB'])) { - return true; - } - return false; - } - - /** - * Import direct payment results to payment - * - * @param Mage_Paypal_Model_Api_Nvp $api - * @param Mage_Sales_Model_Order_Payment $payment - */ - protected function _importResultToPayment($api, $payment) - { - $payment->setTransactionId($api->getPaypalTransactionId())->setIsTransactionClosed(0) - ->setIsTransactionPending($api->getIsPaymentPending()) - ->setTransactionAdditionalInfo(Mage_PaypalUk_Model_Pro::TRANSPORT_PAYFLOW_TXN_ID, $api->getTransactionId()) - ; - $payment->setPreparedMessage(Mage::helper('paypaluk')->__('Payflow PNREF: #%s.', $api->getTransactionId())); - $this->_pro->importPaymentInfo($api, $payment); - } - - /** - * Format credit card expiration date based on month and year values - * Format: mmyy - * - * @param string|int $month - * @param string|int $year - * @return string - */ - protected function _getFormattedCcExpirationDate($month, $year) - { - return sprintf('%02d', $month) . sprintf('%02d', substr($year, -2, 2)); - } -} diff --git a/app/code/core/Mage/PaypalUk/Model/Express.php b/app/code/core/Mage/PaypalUk/Model/Express.php deleted file mode 100644 index f749b649007..00000000000 --- a/app/code/core/Mage/PaypalUk/Model/Express.php +++ /dev/null @@ -1,86 +0,0 @@ -<?php - -/** - * @copyright For copyright and license information, read the COPYING.txt file. - * @link /COPYING.txt - * @license Open Software License (OSL 3.0) - * @package Mage_PaypalUk - */ - -/** - * @package Mage_PaypalUk - */ -class Mage_PaypalUk_Model_Express extends Mage_Paypal_Model_Express -{ - protected $_code = Mage_Paypal_Model_Config::METHOD_WPP_PE_EXPRESS; - protected $_formBlockType = 'paypaluk/express_form'; - protected $_canCreateBillingAgreement = false; - protected $_canManageRecurringProfiles = false; - - /** - * Website Payments Pro instance type - * - * @var string $_proType - */ - protected $_proType = 'paypaluk/express_pro'; - - /** - * Express Checkout payment method instance - * - * @var Mage_Payment_Model_Method_Abstract|false - */ - protected $_ecInstance = null; - - /** - * EC PE won't be available if the EC is available - * - * @param Mage_Sales_Model_Quote $quote - * @return bool - */ - public function isAvailable($quote = null) - { - if (!parent::isAvailable($quote)) { - return false; - } - if (!$this->_ecInstance) { - $this->_ecInstance = Mage::helper('payment') - ->getMethodInstance(Mage_Paypal_Model_Config::METHOD_WPP_EXPRESS); - } - if ($quote && $this->_ecInstance) { - $this->_ecInstance->setStore($quote->getStoreId()); - } - return $this->_ecInstance ? !$this->_ecInstance->isAvailable() : false; - } - - /** - * Import payment info to payment - * - * @param Mage_Paypal_Model_Api_Nvp $api - * @param Mage_Sales_Model_Order_Payment $payment - */ - protected function _importToPayment($api, $payment) - { - $payment->setTransactionId($api->getPaypalTransactionId())->setIsTransactionClosed(0) - ->setAdditionalInformation( - Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_REDIRECT, - $api->getRedirectRequired() || $api->getRedirectRequested(), - ) - ->setIsTransactionPending($api->getIsPaymentPending()) - ->setTransactionAdditionalInfo(Mage_PaypalUk_Model_Pro::TRANSPORT_PAYFLOW_TXN_ID, $api->getTransactionId()) - ; - $payment->setPreparedMessage(Mage::helper('paypaluk')->__('Payflow PNREF: #%s.', $api->getTransactionId())); - Mage::getModel('paypal/info')->importToPayment($api, $payment); - } - - /** - * Checkout redirect URL getter for onepage checkout (hardcode) - * - * @see Mage_Checkout_OnepageController::savePaymentAction() - * @see Mage_Sales_Model_Quote_Payment::getCheckoutRedirectUrl() - * @return string - */ - public function getCheckoutRedirectUrl() - { - return Mage::getUrl('paypaluk/express/start'); - } -} diff --git a/app/code/core/Mage/PaypalUk/Model/Express/Checkout.php b/app/code/core/Mage/PaypalUk/Model/Express/Checkout.php deleted file mode 100644 index bccd20c592b..00000000000 --- a/app/code/core/Mage/PaypalUk/Model/Express/Checkout.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php - -/** - * @copyright For copyright and license information, read the COPYING.txt file. - * @link /COPYING.txt - * @license Open Software License (OSL 3.0) - * @package Mage_PaypalUk - */ - -/** - * Wrapper that performs Paypal Express and Checkout communication - * Use current Paypal Express method instance - * - * @package Mage_PaypalUk - */ -class Mage_PaypalUk_Model_Express_Checkout extends Mage_Paypal_Model_Express_Checkout -{ - /** - * Api Model Type - * - * @var string - */ - protected $_apiType = 'paypaluk/api_express_nvp'; - - /** - * Payment method tpye - * @var string - */ - protected $_methodType = Mage_Paypal_Model_Config::METHOD_WPP_PE_EXPRESS; - - /** - * Set shipping method to quote, if needed - * @param string $methodCode - */ - public function updateShippingMethod($methodCode) - { - parent::updateShippingMethod($methodCode); - $this->_quote->save(); - } -} diff --git a/app/code/core/Mage/PaypalUk/Model/Express/Pro.php b/app/code/core/Mage/PaypalUk/Model/Express/Pro.php deleted file mode 100644 index f68fd914baf..00000000000 --- a/app/code/core/Mage/PaypalUk/Model/Express/Pro.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php - -/** - * @copyright For copyright and license information, read the COPYING.txt file. - * @link /COPYING.txt - * @license Open Software License (OSL 3.0) - * @package Mage_PaypalUk - */ - -/** - * PayPal Express (Payflow Edition) implementation for payment method instances - * - * @package Mage_PaypalUk - */ -class Mage_PaypalUk_Model_Express_Pro extends Mage_PaypalUk_Model_Pro -{ - /** - * Api model type - * - * @var string - */ - protected $_apiType = 'paypaluk/api_express_nvp'; -} diff --git a/app/code/core/Mage/PaypalUk/Model/Pro.php b/app/code/core/Mage/PaypalUk/Model/Pro.php deleted file mode 100644 index bb8edfb2b75..00000000000 --- a/app/code/core/Mage/PaypalUk/Model/Pro.php +++ /dev/null @@ -1,133 +0,0 @@ -<?php - -/** - * @copyright For copyright and license information, read the COPYING.txt file. - * @link /COPYING.txt - * @license Open Software License (OSL 3.0) - * @package Mage_PaypalUk - */ - -/** - * PayPal Website Payments Pro (Payflow Edition) implementation for payment method instances - * This model was created because right now PayPal Direct and PayPal Express payment - * (Payflow Edition) methods cannot have same abstract - * - * @package Mage_PaypalUk - */ -class Mage_PaypalUk_Model_Pro extends Mage_Paypal_Model_Pro -{ - /** - * Api model type - * - * @var string - */ - protected $_apiType = 'paypaluk/api_nvp'; - - /** - * Config model type - * - * @var string - */ - protected $_configType = 'paypal/config'; - - /** - * Payflow trx_id key in transaction info - * - * @var string - */ - public const TRANSPORT_PAYFLOW_TXN_ID = 'payflow_trxid'; - - /** - * Refund a capture transaction - * - * @param float $amount - */ - public function refund(Varien_Object $payment, $amount) - { - if ($captureTxnId = $this->_getParentTransactionId($payment)) { - $api = $this->getApi(); - $api->setAuthorizationId($captureTxnId); - } - parent::refund($payment, $amount); - } - - /** - * Is capture request needed on this transaction - * - * @return true - */ - protected function _isCaptureNeeded() - { - return true; - } - - /** - * Get payflow transaction id from parent transaction - * - * @return string - */ - protected function _getParentTransactionId(Varien_Object $payment) - { - if ($payment->getParentTransactionId()) { - return $payment->getTransaction($payment->getParentTransactionId()) - ->getAdditionalInformation(self::TRANSPORT_PAYFLOW_TXN_ID); - } - return $payment->getParentTransactionId(); - } - - /** - * Import capture results to payment - * - * @param Mage_Paypal_Model_Api_Nvp $api - * @param Mage_Sales_Model_Order_Payment $payment - */ - protected function _importCaptureResultToPayment($api, $payment) - { - $payment->setTransactionId($api->getPaypalTransactionId()) - ->setIsTransactionClosed(false) - ->setTransactionAdditionalInfo( - self::TRANSPORT_PAYFLOW_TXN_ID, - $api->getTransactionId(), - ); - $payment->setPreparedMessage( - Mage::helper('paypaluk')->__('Payflow PNREF: #%s.', $api->getTransactionId()), - ); - Mage::getModel('paypal/info')->importToPayment($api, $payment); - } - - /** - * Fetch transaction details info method does not exists in PaypalUK - * - * @param string $transactionId - * @throws Mage_Core_Exception - * @return void - */ - public function fetchTransactionInfo(Mage_Payment_Model_Info $payment, $transactionId) - { - Mage::throwException( - Mage::helper('paypaluk')->__('Fetch transaction details method does not exists in PaypalUK'), - ); - } - - /** - * Import refund results to payment - * - * @param Mage_Paypal_Model_Api_Nvp $api - * @param Mage_Sales_Model_Order_Payment $payment - * @param bool $canRefundMore - */ - protected function _importRefundResultToPayment($api, $payment, $canRefundMore) - { - $payment->setTransactionId($api->getPaypalTransactionId()) - ->setIsTransactionClosed(1) // refund initiated by merchant - ->setShouldCloseParentTransaction(!$canRefundMore) - ->setTransactionAdditionalInfo( - self::TRANSPORT_PAYFLOW_TXN_ID, - $api->getTransactionId(), - ); - $payment->setPreparedMessage( - Mage::helper('paypaluk')->__('Payflow PNREF: #%s.', $api->getTransactionId()), - ); - Mage::getModel('paypal/info')->importToPayment($api, $payment); - } -} diff --git a/app/code/core/Mage/PaypalUk/Model/Session.php b/app/code/core/Mage/PaypalUk/Model/Session.php deleted file mode 100644 index 78f50a2ddd4..00000000000 --- a/app/code/core/Mage/PaypalUk/Model/Session.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php - -/** - * @copyright For copyright and license information, read the COPYING.txt file. - * @link /COPYING.txt - * @license Open Software License (OSL 3.0) - * @package Mage_PaypalUk - */ - -/** - * - * PaypalUk transaction session namespace - * - * @package Mage_PaypalUk - */ -class Mage_PaypalUk_Model_Session extends Mage_Core_Model_Session_Abstract -{ - public function __construct() - { - $this->init('paypaluk'); - } -} diff --git a/app/code/core/Mage/PaypalUk/controllers/BmlController.php b/app/code/core/Mage/PaypalUk/controllers/BmlController.php deleted file mode 100644 index 96ac09228fe..00000000000 --- a/app/code/core/Mage/PaypalUk/controllers/BmlController.php +++ /dev/null @@ -1,24 +0,0 @@ -<?php - -/** - * @copyright For copyright and license information, read the COPYING.txt file. - * @link /COPYING.txt - * @license Open Software License (OSL 3.0) - * @package Mage_PaypalUk - */ - -/** - * Bill Me Later Controller - * - * @package Mage_PaypalUk - */ -class Mage_PaypalUk_BmlController extends Mage_Core_Controller_Front_Action -{ - /** - * Action for Bill Me Later checkout button (product view and shopping cart pages) - */ - public function startAction() - { - $this->_forward('start', 'express', 'payflow', ['bml' => 1]); - } -} diff --git a/app/code/core/Mage/PaypalUk/controllers/ExpressController.php b/app/code/core/Mage/PaypalUk/controllers/ExpressController.php deleted file mode 100644 index cd1b840e85b..00000000000 --- a/app/code/core/Mage/PaypalUk/controllers/ExpressController.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php - -/** - * @copyright For copyright and license information, read the COPYING.txt file. - * @link /COPYING.txt - * @license Open Software License (OSL 3.0) - * @package Mage_PaypalUk - */ - -/** - * @package Mage_PaypalUk - */ -class Mage_PaypalUk_ExpressController extends Mage_Paypal_Controller_Express_Abstract -{ - /** - * Config mode type - * - * @var string - */ - protected $_configType = 'paypal/config'; - - /** - * Config method type - * - * @var string - */ - protected $_configMethod = Mage_Paypal_Model_Config::METHOD_WPP_PE_EXPRESS; - - /** - * Checkout mode type - * - * @var string - */ - protected $_checkoutType = 'paypaluk/express_checkout'; -} diff --git a/app/code/core/Mage/PaypalUk/etc/config.xml b/app/code/core/Mage/PaypalUk/etc/config.xml deleted file mode 100644 index 4273cce438c..00000000000 --- a/app/code/core/Mage/PaypalUk/etc/config.xml +++ /dev/null @@ -1,106 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * @copyright For copyright and license information, read the COPYING.txt file. - * @link /COPYING.txt - * @license Academic Free License (AFL 3.0) - * @package Mage_PaypalUk - */ ---> -<config> - <modules> - <Mage_PaypalUk> - <version>1.6.0.0</version> - </Mage_PaypalUk> - </modules> - <global> - <models> - <paypaluk> - <class>Mage_PaypalUk_Model</class> - <resourceModel>paypaluk_resource</resourceModel> - </paypaluk> - <paypaluk_resource> - <class>Mage_PaypalUk_Model_Resource</class> - <deprecatedNode>paypaluk_mysql4</deprecatedNode> - <entities> - <api_debug> - <table>paypaluk_api_debug</table> - </api_debug> - </entities> - </paypaluk_resource> - </models> - <helpers> - <paypaluk> - <class>Mage_PaypalUk_Helper</class> - </paypaluk> - </helpers> - <resources> - <paypaluk_setup> - <setup> - <module>Mage_PaypalUk</module> - </setup> - </paypaluk_setup> - </resources> - <blocks> - <paypaluk> - <class>Mage_PaypalUk_Block</class> - </paypaluk> - </blocks> - </global> - <frontend> - <secure_url> - <paypaluk_express>/paypaluk/express</paypaluk_express> - </secure_url> - <routers> - <paypaluk> - <use>standard</use> - <args> - <module>Mage_PaypalUk</module> - <frontName>payflow</frontName> - </args> - </paypaluk> - </routers> - <translate> - <modules> - <Mage_PaypalUk> - <files> - <default>Mage_PaypalUk.csv</default> - </files> - </Mage_PaypalUk> - </modules> - </translate> - <layout> - <updates> - <paypaluk> - <file>paypaluk.xml</file> - </paypaluk> - </updates> - </layout> - </frontend> - <adminhtml> - <translate> - <modules> - <Mage_PaypalUk> - <files> - <default>Mage_PaypalUk.csv</default> - </files> - </Mage_PaypalUk> - </modules> - </translate> - </adminhtml> - <default> - <payment> - <paypaluk_express> - <model>paypaluk/express</model> - </paypaluk_express> - <paypaluk_express_bml> - <model>paypaluk/bml</model> - <title>Paypal Credit - paypal - - - paypaluk/direct - -
- -
diff --git a/app/code/core/Mage/PaypalUk/sql/paypaluk_setup/install-1.6.0.0.php b/app/code/core/Mage/PaypalUk/sql/paypaluk_setup/install-1.6.0.0.php deleted file mode 100644 index 3fc5f596851..00000000000 --- a/app/code/core/Mage/PaypalUk/sql/paypaluk_setup/install-1.6.0.0.php +++ /dev/null @@ -1,11 +0,0 @@ -startSetup(); - -$installer->run(" - --- DROP TABLE IF EXISTS {$this->getTable('paypaluk_api_debug')}; - -CREATE TABLE {$this->getTable('paypaluk_api_debug')} ( - `debug_id` int(10) unsigned NOT NULL auto_increment, - `debug_at` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, - `request_body` text, - `response_body` text, - PRIMARY KEY (`debug_id`), - KEY `debug_at` (`debug_at`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - "); - -$installer->endSetup(); diff --git a/app/code/core/Mage/Persistent/Model/Observer.php b/app/code/core/Mage/Persistent/Model/Observer.php index 894081107ef..13bdcf7300b 100644 --- a/app/code/core/Mage/Persistent/Model/Observer.php +++ b/app/code/core/Mage/Persistent/Model/Observer.php @@ -338,10 +338,6 @@ public function preventExpressCheckout($observer) Mage::helper('persistent')->__('To proceed to Checkout, please log in using your email address.'), ); $controllerAction->redirectLogin(); - if ($controllerAction instanceof Mage_Paypal_Controller_Express_Abstract) { - Mage::getSingleton('customer/session') - ->setBeforeAuthUrl(Mage::getUrl('persistent/index/expressCheckout')); - } } } diff --git a/app/code/core/Mage/Persistent/etc/config.xml b/app/code/core/Mage/Persistent/etc/config.xml index 040f5da6c3a..dd3f93356cb 100644 --- a/app/code/core/Mage/Persistent/etc/config.xml +++ b/app/code/core/Mage/Persistent/etc/config.xml @@ -205,22 +205,6 @@ - - - - persistent/observer - preventExpressCheckout - - - - - - - persistent/observer - preventExpressCheckout - - - diff --git a/app/code/core/Mage/Sales/Model/Order.php b/app/code/core/Mage/Sales/Model/Order.php index 3c3f413d523..ff68b5617b2 100644 --- a/app/code/core/Mage/Sales/Model/Order.php +++ b/app/code/core/Mage/Sales/Model/Order.php @@ -231,8 +231,6 @@ * @method $this setPaymentAuthorizationAmount(float $value) * @method int getPaymentAuthorizationExpiration() * @method $this setPaymentAuthorizationExpiration(int $value) - * @method int getPaypalIpnCustomerNotified() - * @method $this setPaypalIpnCustomerNotified(int $value) * @method string getProtectCode() * @method $this setProtectCode(string $value) * diff --git a/app/code/core/Mage/Sales/etc/wsdl.xml b/app/code/core/Mage/Sales/etc/wsdl.xml index 0124534ab0e..4408ade9712 100644 --- a/app/code/core/Mage/Sales/etc/wsdl.xml +++ b/app/code/core/Mage/Sales/etc/wsdl.xml @@ -183,7 +183,6 @@ - diff --git a/app/code/core/Mage/Sales/etc/wsi.xml b/app/code/core/Mage/Sales/etc/wsi.xml index 95a063341a8..c8c54bd520c 100644 --- a/app/code/core/Mage/Sales/etc/wsi.xml +++ b/app/code/core/Mage/Sales/etc/wsi.xml @@ -186,7 +186,6 @@ - diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-install-1.4.0.0.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-install-1.4.0.0.php index 835a25ca4fa..9ec36797e89 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-install-1.4.0.0.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-install-1.4.0.0.php @@ -91,7 +91,6 @@ `forced_do_shipment_with_invoice` tinyint(1) unsigned default NULL, `gift_message_id` int(10) default NULL, `payment_authorization_expiration` int(10) default NULL, - `paypal_ipn_customer_notified` int(10) default NULL, `quote_address_id` int(10) default NULL, `quote_id` int(10) default NULL, `shipping_address_id` int(10) default NULL, diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.50-0.9.51.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.50-0.9.51.php index 50a6a0d5fc6..7b5d670cf9c 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.50-0.9.51.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.50-0.9.51.php @@ -19,11 +19,7 @@ $connection = $installer->getConnection(); $paymentMethods = [ - 'paypal_standard', - 'paypal_express', - 'paypal_direct', - 'paypaluk_direct', - 'paypaluk_express', + 'paypal', ]; $entityTypeCode = 'order_payment'; $attributesIds = [ diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.3.99-1.4.0.0.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.3.99-1.4.0.0.php index 347a34fc5a6..35c2494c513 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.3.99-1.4.0.0.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-1.3.99-1.4.0.0.php @@ -125,7 +125,6 @@ `forced_do_shipment_with_invoice` tinyint(1) unsigned default NULL, `gift_message_id` int(10) default NULL, `payment_authorization_expiration` int(10) default NULL, - `paypal_ipn_customer_notified` int(10) default NULL, `quote_address_id` int(10) default NULL, `quote_id` int(10) default NULL, `shipping_address_id` int(10) default NULL, diff --git a/app/design/adminhtml/default/default/layout/paypal.xml b/app/design/adminhtml/default/default/layout/paypal.xml new file mode 100644 index 00000000000..074a4a5750a --- /dev/null +++ b/app/design/adminhtml/default/default/layout/paypal.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/app/design/adminhtml/default/default/template/paypal/info.phtml b/app/design/adminhtml/default/default/template/paypal/info.phtml new file mode 100644 index 00000000000..3808d5d286d --- /dev/null +++ b/app/design/adminhtml/default/default/template/paypal/info.phtml @@ -0,0 +1,88 @@ + +
+
+ escapeHtml($this->getMethod()->getTitle()) ?> +
+ getTransactionId()): ?> +
+ __('Transaction ID') ?>: + getTransactionUrl()): ?> + + escapeHtml($this->getTransactionId()) ?> + + + escapeHtml($this->getTransactionId()) ?> + +
+ + + getPaymentInfo()): ?> +
+
+ getPaymentInfo() as $label => $value): ?> +
escapeHtml($label) ?>
+
escapeHtml($value) ?>
+ +
+
+ +
+ diff --git a/app/design/adminhtml/default/default/template/paypal/system/config/api_wizard.phtml b/app/design/adminhtml/default/default/template/paypal/system/config/api_wizard.phtml deleted file mode 100644 index c12299a6090..00000000000 --- a/app/design/adminhtml/default/default/template/paypal/system/config/api_wizard.phtml +++ /dev/null @@ -1,22 +0,0 @@ - - -
- - -
diff --git a/app/design/adminhtml/default/default/template/paypal/system/config/bml_api_wizard.phtml b/app/design/adminhtml/default/default/template/paypal/system/config/bml_api_wizard.phtml deleted file mode 100644 index f1aeeacc060..00000000000 --- a/app/design/adminhtml/default/default/template/paypal/system/config/bml_api_wizard.phtml +++ /dev/null @@ -1,19 +0,0 @@ - - -
- -
diff --git a/app/design/adminhtml/default/default/template/paypal/system/config/fieldset/global.phtml b/app/design/adminhtml/default/default/template/paypal/system/config/fieldset/global.phtml deleted file mode 100644 index 5d43feb2301..00000000000 --- a/app/design/adminhtml/default/default/template/paypal/system/config/fieldset/global.phtml +++ /dev/null @@ -1,583 +0,0 @@ - - - - - - - - - - - - -getElements() as $htmlId => $element): ?> - - getIsElementSimplified($element)):?> - - - - - - - - -
escapeHtml($this->getFieldsetLabel()) ?>__('Help')?>
- hasInheritElement($element)): ?> -
getInheritElementHtml($element) ?>getInheritElementLabelHtml($element) ?>
- - -
- hasInheritElement($element)): ?> -
getInheritElementHtml($element) ?>getInheritElementLabelHtml($element) ?>
- - -
- getElementOriginalData($element, 'demo_url')):?> - __('View Demo')?> | - - getElementOriginalData($element, 'more_url')):?> - __('Learn More')?> - -
- - diff --git a/app/design/adminhtml/default/default/template/paypal/system/config/fieldset/hint.phtml b/app/design/adminhtml/default/default/template/paypal/system/config/fieldset/hint.phtml deleted file mode 100644 index 3aa76f8196e..00000000000 --- a/app/design/adminhtml/default/default/template/paypal/system/config/fieldset/hint.phtml +++ /dev/null @@ -1,19 +0,0 @@ - - -getHelpLink()): ?> -
- __('Not sure what PayPal payment method to use? Click here to learn more.', $this->getHelpLink()); ?> -
- diff --git a/app/design/adminhtml/default/default/template/paypal/system/config/fieldset/store.phtml b/app/design/adminhtml/default/default/template/paypal/system/config/fieldset/store.phtml deleted file mode 100644 index ad78d36243f..00000000000 --- a/app/design/adminhtml/default/default/template/paypal/system/config/fieldset/store.phtml +++ /dev/null @@ -1,84 +0,0 @@ - - - diff --git a/app/design/adminhtml/default/default/template/paypal/system/config/payflowlink/advanced.phtml b/app/design/adminhtml/default/default/template/paypal/system/config/payflowlink/advanced.phtml deleted file mode 100644 index 847793d2a7d..00000000000 --- a/app/design/adminhtml/default/default/template/paypal/system/config/payflowlink/advanced.phtml +++ /dev/null @@ -1,22 +0,0 @@ - -
- __('Important: ') ?> - __('To use PayPal Payments Advanced, you must configure your PayPal Payments Advanced account on the PayPal website.'); ?> - __('Once you log into your PayPal Advanced account, navigate to the Service Settings - Hosted Checkout Pages - Set Up menu and set the options described below') ?> -
    -
  • AVS: No
  • -
  • CSC: No
  • -
  • Enable Secure Token: Yes
  • -
-
diff --git a/app/design/adminhtml/default/default/template/paypal/system/config/payflowlink/info.phtml b/app/design/adminhtml/default/default/template/paypal/system/config/payflowlink/info.phtml deleted file mode 100644 index 500ae88156a..00000000000 --- a/app/design/adminhtml/default/default/template/paypal/system/config/payflowlink/info.phtml +++ /dev/null @@ -1,24 +0,0 @@ - - -
- __('Important: ') ?> - __('To use PayPal Payflow Link, you must configure your PayPal Payflow Link account on the PayPal website.'); ?> - __('Once you log into your PayPal Payflow Link account, navigate to the Service Settings - Hosted Checkout Pages - Set Up menu and set the options described below') ?> -
    -
  • AVS: No
  • -
  • CSC: No
  • -
  • Enable Secure Token: Yes
  • -
-
diff --git a/app/design/frontend/base/default/layout/bml.xml b/app/design/frontend/base/default/layout/bml.xml deleted file mode 100644 index ccc24313a67..00000000000 --- a/app/design/frontend/base/default/layout/bml.xml +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - -
homepage
- 0 -
-
- - -
homepage
- 1 -
-
-
- - - - -
homepage
- 0 -
-
- - -
homepage
- 1 -
-
-
- - - - -
categorypage
- 0 -
-
- - -
categorypage
- 1 -
-
-
- - - - -
categorypage
- 0 -
-
- - -
categorypage
- 1 -
- -
-
- - - - -
productpage
- 0 -
-
- - -
productpage
- 1 -
-
-
- - - - -
checkout
- 0 -
-
- - -
checkout
- 1 -
-
-
- - - - -
checkout
- 0 -
-
-
-
diff --git a/app/design/frontend/base/default/layout/bundle.xml b/app/design/frontend/base/default/layout/bundle.xml index 9b8b08b8f55..14d78540dca 100644 --- a/app/design/frontend/base/default/layout/bundle.xml +++ b/app/design/frontend/base/default/layout/bundle.xml @@ -152,28 +152,6 @@ Onepage Checkout Review Page - - - bundlebundle/checkout_cart_item_renderer - - - - - bundlebundle/checkout_cart_item_renderer - - - - - - bundlebundle/checkout_cart_item_renderer - - - - - bundlebundle/checkout_cart_item_renderer - - - diff --git a/app/design/frontend/base/default/layout/downloadable.xml b/app/design/frontend/base/default/layout/downloadable.xml index 4b73664f2dd..326d09802f2 100644 --- a/app/design/frontend/base/default/layout/downloadable.xml +++ b/app/design/frontend/base/default/layout/downloadable.xml @@ -69,28 +69,6 @@ - - - downloadabledownloadable/checkout_cart_item_renderer - - - - - downloadabledownloadable/checkout_cart_item_renderer - - - - - - downloadabledownloadable/checkout_cart_item_renderer - - - - - downloadabledownloadable/checkout_cart_item_renderer - - - downloadabledownloadable/sales_order_item_renderer_downloadable diff --git a/app/design/frontend/base/default/layout/paypal.xml b/app/design/frontend/base/default/layout/paypal.xml index 7eb68522478..3b020dd9f06 100644 --- a/app/design/frontend/base/default/layout/paypal.xml +++ b/app/design/frontend/base/default/layout/paypal.xml @@ -1,167 +1,15 @@ - - - - - 1 - - - - - - 1 - - - - - - - - - - - - - - - - - - - defaultcheckout/cart_item_renderer - groupedcheckout/cart_item_renderer_grouped - configurablecheckout/cart_item_renderer_configurable - - - - - + - skin_jsjs/checkout/review.js - - - - - - - defaultcheckout/cart_item_renderer - groupedcheckout/cart_item_renderer_grouped - configurablecheckout/cart_item_renderer_configurable - - - - - - - - - - - 1 - - + + css/paypal.css - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - 1 - after - - + + + - + diff --git a/app/design/frontend/base/default/layout/paypaluk.xml b/app/design/frontend/base/default/layout/paypaluk.xml deleted file mode 100644 index e56c9f90c2f..00000000000 --- a/app/design/frontend/base/default/layout/paypaluk.xml +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - 1 - - - - - 1 - - - - - - - - - - - - - - - - - paypaluk - - - defaultcheckout/cart_item_renderer - groupedcheckout/cart_item_renderer_grouped - configurablecheckout/cart_item_renderer_configurable - - - - - - - skin_jsjs/checkout/review.js - - - - - - defaultcheckout/cart_item_renderer - groupedcheckout/cart_item_renderer_grouped - configurablecheckout/cart_item_renderer_configurable - - - - - - - - - p - paypal-logo - - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 - after - - - - - diff --git a/app/design/frontend/base/default/layout/review.xml b/app/design/frontend/base/default/layout/review.xml index b38380a816c..c81bbb12d94 100644 --- a/app/design/frontend/base/default/layout/review.xml +++ b/app/design/frontend/base/default/layout/review.xml @@ -63,15 +63,7 @@ Product reviews page - - - - - - 1 - - - + diff --git a/app/design/frontend/base/default/template/paypal/bml.phtml b/app/design/frontend/base/default/template/paypal/bml.phtml deleted file mode 100644 index 942408826f5..00000000000 --- a/app/design/frontend/base/default/template/paypal/bml.phtml +++ /dev/null @@ -1,23 +0,0 @@ - - - diff --git a/app/design/frontend/base/default/template/paypal/express/review.phtml b/app/design/frontend/base/default/template/paypal/express/review.phtml deleted file mode 100644 index 22b08774647..00000000000 --- a/app/design/frontend/base/default/template/paypal/express/review.phtml +++ /dev/null @@ -1,155 +0,0 @@ - -
-

__('Review Order') ?>

-
-getMessagesBlock()->toHtml() ?> -getShippingAddress()): ?> -
-

__('Shipping Information') ?>

-
-
-
-

__('Shipping Address') ?>getCanEditShippingAddress()):?> | __('Edit') ?>

-
-
-
renderAddress($this->getShippingAddress())?>
-
-
-
-
-
-
-

__('Shipping Method') ?>

-
-
-
- getCanEditShippingMethod() || !$this->getCurrentShippingRate()):?> - getShippingRateGroups()):?> - getCurrentShippingRate(); ?> -
- -
-

- -

- -

__('Sorry, no quotes are available for this order at this time.') ?>

- - -

renderShippingRateOption($this->getCurrentShippingRate())?>

- -
-
-
-
-
- - -
-

__('Billing Information') ?>

-
-
-
-

__('Payment Method') ?> | - getEditUrl()):?>__('Edit Payment Information') ?> -

-
-
- escapeHtml($this->getPaymentMethodTitle()) ?> -
-
-
-
- -
-

__('Items in Your Shopping Cart') ?> | __('Edit Shopping Cart') ?>

-
- getChildHtml('details') ?> -
-
-
- getChildHtml('agreements'); ?> -
- - - -
-
- diff --git a/app/design/frontend/base/default/template/paypal/express/review/details.phtml b/app/design/frontend/base/default/template/paypal/express/review/details.phtml deleted file mode 100644 index 5a167f9e729..00000000000 --- a/app/design/frontend/base/default/template/paypal/express/review/details.phtml +++ /dev/null @@ -1,47 +0,0 @@ - - - helper('tax')->displayCartBothPrices()): $colspan = $rowspan = 2; else: $colspan = $rowspan = 1; endif; ?> - - - - - helper('tax')->displayCartBothPrices()): ?> - - - - - - - - - - - helper('tax')->displayCartBothPrices()): ?> - - - - - - - - -getChildHtml('totals'); ?> - - getItems() as $_item): ?> - getItemHtml($_item) ?> - - -
__('Product Name') ?>__('Price') ?>__('Qty') ?>__('Subtotal') ?>
helper('tax')->getIncExcTaxLabel(false) ?>helper('tax')->getIncExcTaxLabel(true) ?>helper('tax')->getIncExcTaxLabel(false) ?>helper('tax')->getIncExcTaxLabel(true) ?>
- diff --git a/app/design/frontend/base/default/template/paypal/express/review/shipping/method.phtml b/app/design/frontend/base/default/template/paypal/express/review/shipping/method.phtml deleted file mode 100644 index 20494f7036c..00000000000 --- a/app/design/frontend/base/default/template/paypal/express/review/shipping/method.phtml +++ /dev/null @@ -1,35 +0,0 @@ - -
-getCanEditShippingMethod() || !$this->getCurrentShippingRate()):?> - getShippingRateGroups()):?> - getCurrentShippingRate(); ?> - - -

__('Sorry, no quotes are available for this order at this time.') ?>

- - -

renderShippingRateOption($this->getCurrentShippingRate())?>

- -
- diff --git a/app/design/frontend/base/default/template/paypal/express/shortcut.phtml b/app/design/frontend/base/default/template/paypal/express/shortcut.phtml deleted file mode 100644 index aa9058282e4..00000000000 --- a/app/design/frontend/base/default/template/paypal/express/shortcut.phtml +++ /dev/null @@ -1,62 +0,0 @@ - - - -
  • - -
  • - -

    - -isOrPositionAfter()): ?> -
  • - -
  • - -getConfirmationUrl() || $this->getIsInCatalogProduct()): ?> -getIsInCatalogProduct()): ?> - - - - diff --git a/app/design/frontend/base/default/template/paypal/hss/form.phtml b/app/design/frontend/base/default/template/paypal/hss/form.phtml deleted file mode 100644 index 9f9d8f12691..00000000000 --- a/app/design/frontend/base/default/template/paypal/hss/form.phtml +++ /dev/null @@ -1,28 +0,0 @@ - - - - -
    - - - -
    - - - diff --git a/app/design/frontend/base/default/template/paypal/hss/iframe.phtml b/app/design/frontend/base/default/template/paypal/hss/iframe.phtml deleted file mode 100644 index fa9cc62ca6f..00000000000 --- a/app/design/frontend/base/default/template/paypal/hss/iframe.phtml +++ /dev/null @@ -1,34 +0,0 @@ - -
    - __('Please do not refresh the page until you complete payment.') ?> -
    - - diff --git a/app/design/frontend/base/default/template/paypal/hss/info.phtml b/app/design/frontend/base/default/template/paypal/hss/info.phtml deleted file mode 100644 index ee76931be61..00000000000 --- a/app/design/frontend/base/default/template/paypal/hss/info.phtml +++ /dev/null @@ -1,18 +0,0 @@ - - diff --git a/app/design/frontend/base/default/template/paypal/hss/js.phtml b/app/design/frontend/base/default/template/paypal/hss/js.phtml deleted file mode 100644 index 7705f9ed82e..00000000000 --- a/app/design/frontend/base/default/template/paypal/hss/js.phtml +++ /dev/null @@ -1,44 +0,0 @@ - -
    - diff --git a/app/design/frontend/base/default/template/paypal/hss/redirect.phtml b/app/design/frontend/base/default/template/paypal/hss/redirect.phtml deleted file mode 100644 index 92596a21fc0..00000000000 --- a/app/design/frontend/base/default/template/paypal/hss/redirect.phtml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - diff --git a/app/design/frontend/base/default/template/paypal/hss/review/button.phtml b/app/design/frontend/base/default/template/paypal/hss/review/button.phtml deleted file mode 100644 index 0dbd301d113..00000000000 --- a/app/design/frontend/base/default/template/paypal/hss/review/button.phtml +++ /dev/null @@ -1,9 +0,0 @@ - - diff --git a/app/design/frontend/base/default/template/paypal/info.phtml b/app/design/frontend/base/default/template/paypal/info.phtml new file mode 100644 index 00000000000..f053dc3420d --- /dev/null +++ b/app/design/frontend/base/default/template/paypal/info.phtml @@ -0,0 +1,18 @@ + +

    escapeHtml($this->getMethod()->getTitle()) ?>

    +getTransactionId()): ?> +

    __('Transaction ID: %s', $this->escapeHtml($this->getTransactionId())) ?>

    + diff --git a/app/design/frontend/base/default/template/paypal/partner/logo.phtml b/app/design/frontend/base/default/template/paypal/partner/logo.phtml deleted file mode 100644 index a4879e87172..00000000000 --- a/app/design/frontend/base/default/template/paypal/partner/logo.phtml +++ /dev/null @@ -1,18 +0,0 @@ - - - diff --git a/app/design/frontend/base/default/template/paypal/partner/us_logo.phtml b/app/design/frontend/base/default/template/paypal/partner/us_logo.phtml deleted file mode 100644 index 4e34252be5a..00000000000 --- a/app/design/frontend/base/default/template/paypal/partner/us_logo.phtml +++ /dev/null @@ -1,18 +0,0 @@ - - - diff --git a/app/design/frontend/base/default/template/paypal/payflowadvanced/iframe.phtml b/app/design/frontend/base/default/template/paypal/payflowadvanced/iframe.phtml deleted file mode 100644 index 83cb2d34ca8..00000000000 --- a/app/design/frontend/base/default/template/paypal/payflowadvanced/iframe.phtml +++ /dev/null @@ -1,31 +0,0 @@ - -
    - __('Please do not refresh the page until you complete payment.') ?> -
    - - diff --git a/app/design/frontend/base/default/template/paypal/payflowadvanced/info.phtml b/app/design/frontend/base/default/template/paypal/payflowadvanced/info.phtml deleted file mode 100644 index 57ffac85ec6..00000000000 --- a/app/design/frontend/base/default/template/paypal/payflowadvanced/info.phtml +++ /dev/null @@ -1,17 +0,0 @@ - - diff --git a/app/design/frontend/base/default/template/paypal/payflowadvanced/redirect.phtml b/app/design/frontend/base/default/template/paypal/payflowadvanced/redirect.phtml deleted file mode 100644 index 2d1239f66ad..00000000000 --- a/app/design/frontend/base/default/template/paypal/payflowadvanced/redirect.phtml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - diff --git a/app/design/frontend/base/default/template/paypal/payflowlink/iframe.phtml b/app/design/frontend/base/default/template/paypal/payflowlink/iframe.phtml deleted file mode 100644 index 108b1131c7f..00000000000 --- a/app/design/frontend/base/default/template/paypal/payflowlink/iframe.phtml +++ /dev/null @@ -1,31 +0,0 @@ - -
    - __('Please do not refresh the page until you complete payment.') ?> -
    - - diff --git a/app/design/frontend/base/default/template/paypal/payflowlink/info.phtml b/app/design/frontend/base/default/template/paypal/payflowlink/info.phtml deleted file mode 100644 index 29053817150..00000000000 --- a/app/design/frontend/base/default/template/paypal/payflowlink/info.phtml +++ /dev/null @@ -1,17 +0,0 @@ - - diff --git a/app/design/frontend/base/default/template/paypal/payflowlink/redirect.phtml b/app/design/frontend/base/default/template/paypal/payflowlink/redirect.phtml deleted file mode 100644 index bae879c3552..00000000000 --- a/app/design/frontend/base/default/template/paypal/payflowlink/redirect.phtml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - diff --git a/app/design/frontend/base/default/template/paypal/payment.phtml b/app/design/frontend/base/default/template/paypal/payment.phtml new file mode 100644 index 00000000000..adc2e553ffd --- /dev/null +++ b/app/design/frontend/base/default/template/paypal/payment.phtml @@ -0,0 +1,34 @@ + + + diff --git a/app/design/frontend/base/default/template/paypal/payment/mark.phtml b/app/design/frontend/base/default/template/paypal/payment/mark.phtml deleted file mode 100644 index 72b71d6b3ef..00000000000 --- a/app/design/frontend/base/default/template/paypal/payment/mark.phtml +++ /dev/null @@ -1,21 +0,0 @@ - - - -<?php echo Mage::helper('core')->quoteEscape(Mage::helper('paypal')->__('Acceptance Mark')) ?>  - - getPaymentWhatIs()) {echo Mage::helper('paypal')->__($this->getPaymentWhatIs());} else {echo Mage::helper('paypal')->__('What is PayPal?');} ?> - - diff --git a/app/design/frontend/base/default/template/paypal/payment/redirect.phtml b/app/design/frontend/base/default/template/paypal/payment/redirect.phtml deleted file mode 100644 index 6177e2dc22a..00000000000 --- a/app/design/frontend/base/default/template/paypal/payment/redirect.phtml +++ /dev/null @@ -1,24 +0,0 @@ - - - diff --git a/app/design/frontend/rwd/default/layout/bundle.xml b/app/design/frontend/rwd/default/layout/bundle.xml index 1ecc7cdd3bf..bf9302e05c3 100644 --- a/app/design/frontend/rwd/default/layout/bundle.xml +++ b/app/design/frontend/rwd/default/layout/bundle.xml @@ -155,27 +155,6 @@ Onepage Checkout Review Page
    - - - bundlebundle/checkout_cart_item_renderer - - - - - bundlebundle/checkout_cart_item_renderer - - - - - - bundlebundle/checkout_cart_item_renderer - - - - - bundlebundle/checkout_cart_item_renderer - - - - - - - 1 - after - - - - - - 1 - after - - - - - - - - - - - - - - - - - - - defaultcheckout/cart_item_renderer - groupedcheckout/cart_item_renderer_grouped - configurablecheckout/cart_item_renderer_configurable - - - - - - - skin_jsjs/checkout/review.js - - - - - - - defaultcheckout/cart_item_renderer - groupedcheckout/cart_item_renderer_grouped - configurablecheckout/cart_item_renderer_configurable - - - - - - - - - true - - - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 - after - - - - - diff --git a/app/design/frontend/rwd/default/layout/review.xml b/app/design/frontend/rwd/default/layout/review.xml index 7823f4e9cae..41302a67676 100644 --- a/app/design/frontend/rwd/default/layout/review.xml +++ b/app/design/frontend/rwd/default/layout/review.xml @@ -75,15 +75,7 @@ Product reviews page - - - - - - 1 - - - + diff --git a/app/design/frontend/rwd/default/template/paypal/bml.phtml b/app/design/frontend/rwd/default/template/paypal/bml.phtml deleted file mode 100644 index da93af4cfe1..00000000000 --- a/app/design/frontend/rwd/default/template/paypal/bml.phtml +++ /dev/null @@ -1,32 +0,0 @@ - - -
    - -
    -
    - -
    diff --git a/app/design/frontend/rwd/default/template/paypal/express/minicart/shortcut.phtml b/app/design/frontend/rwd/default/template/paypal/express/minicart/shortcut.phtml deleted file mode 100644 index 27c1e2ed9d4..00000000000 --- a/app/design/frontend/rwd/default/template/paypal/express/minicart/shortcut.phtml +++ /dev/null @@ -1,55 +0,0 @@ - - -
  • - -
  • -getIsBmlEnabled()): ?> -
  • - -
  • - - -getConfirmationUrl() || $this->getIsInCatalogProduct()): ?> - getIsInCatalogProduct()): ?> - - - - diff --git a/app/design/frontend/rwd/default/template/paypal/express/product/shortcut.phtml b/app/design/frontend/rwd/default/template/paypal/express/product/shortcut.phtml deleted file mode 100644 index f063c914d46..00000000000 --- a/app/design/frontend/rwd/default/template/paypal/express/product/shortcut.phtml +++ /dev/null @@ -1,51 +0,0 @@ - - -

    - __('-OR-');?> - - getShortcutHtmlId() ?> - getBmlShortcutHtmlId() ?> - <?php echo $this->quoteEscape(Mage::helper('paypal')->__('Checkout with PayPal')); ?> -

    -getIsBmlEnabled()): ?> - - - -getConfirmationUrl() || $this->getIsInCatalogProduct()): ?> - getIsInCatalogProduct()): ?> - - - - diff --git a/app/design/frontend/rwd/default/template/paypal/express/review.phtml b/app/design/frontend/rwd/default/template/paypal/express/review.phtml deleted file mode 100644 index 1295803b394..00000000000 --- a/app/design/frontend/rwd/default/template/paypal/express/review.phtml +++ /dev/null @@ -1,159 +0,0 @@ - -
    -

    __('Review Order') ?>

    -
    -getMessagesBlock()->toHtml() ?> -getShippingAddress()): ?> -
    -

    __('Shipping Information') ?>

    -
    -
    -
    -

    __('Shipping Address') ?>getCanEditShippingAddress()):?> | __('Edit') ?>

    -
    -
    -
    renderAddress($this->getShippingAddress())?>
    -
    -
    -
    -
    -
    -
    -

    __('Shipping Method') ?>

    -
    -
    -
    - getCanEditShippingMethod() || !$this->getCurrentShippingRate()):?> - getShippingRateGroups()):?> - getCurrentShippingRate(); ?> -
    - -
    -

    - -

    - -

    __('Sorry, no quotes are available for this order at this time.') ?>

    - - -

    renderShippingRateOption($this->getCurrentShippingRate())?>

    - -
    -
    -
    -
    -
    - - -
    -

    __('Billing Information') ?>

    -
    -
    -
    -

    __('Payment Method') ?> | - getEditUrl()):?>__('Edit Payment Information') ?> -

    -
    -
    - escapeHtml($this->getPaymentMethodTitle()) ?> -
    -
    -
    -
    - -
    -

    __('Items in Your Shopping Cart') ?> | __('Edit Shopping Cart') ?>

    -
    - getChildHtml('details') ?> -
    -
    -
    - getChildHtml('agreements'); ?> -
    - - - -
    -
    - diff --git a/app/design/frontend/rwd/default/template/paypal/express/review/address.phtml b/app/design/frontend/rwd/default/template/paypal/express/review/address.phtml deleted file mode 100644 index 4cb25e82ad2..00000000000 --- a/app/design/frontend/rwd/default/template/paypal/express/review/address.phtml +++ /dev/null @@ -1,173 +0,0 @@ - -getFieldNamePrefix();?> -
    -
      -
    • -
      - -
        -
      • getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress()->getFirstname() ? $this->getAddress() : $this->getQuote()->getCustomer())->setForceUseCustomerRequiredAttributes(!$this->isCustomerLoggedIn())->setFieldIdFormat($prefix . ':%s')->setFieldNameFormat($prefix . '[%s]')->toHtml() ?>
      • -
      • -
        - -
        - -
        -
        - isCustomerLoggedIn() && !$this->getHideEmailAddress()): ?> -
        - -
        - -
        -
        - -
      • - helper('customer/address')->getAttributeValidationClass('street'); ?> -
      • -
        - -
        - -
        -
        -
      • - - helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?> -
      • -
        - -
        - -
        -
        -
      • - - helper('customer/address')->isVatAttributeVisible()) : ?> -
      • -
        - -
        - -
        -
        -
      • - -
      • -
        - -
        - -
        -
        -
        - -
        - - - -
        -
        -
      • -
      • -
        - -
        - -
        -
        -
        - -
        - getCountryHtmlSelect($prefix) ?> -
        -
        -
      • -
      • -
        - -
        - -
        -
        -
        - -
        - -
        -
        -
      • - getChildHtml('form.additional.info'); ?> - getShowAsShippingCheckbox()): ?> -
      • -
        -
        - getAddress()->getSameAsBilling()):?>checked="checked"/> -
        - -
        -
      • - -
      -
      -
    • -
    -
    - -getShowAsShippingCheckbox()): ?> - - diff --git a/app/design/frontend/rwd/default/template/paypal/express/review/details.phtml b/app/design/frontend/rwd/default/template/paypal/express/review/details.phtml deleted file mode 100644 index f832b3316e3..00000000000 --- a/app/design/frontend/rwd/default/template/paypal/express/review/details.phtml +++ /dev/null @@ -1,47 +0,0 @@ - - - helper('tax')->displayCartBothPrices()): $colspan = $rowspan = 2; else: $colspan = $rowspan = 1; endif; ?> - - - - - helper('tax')->displayCartBothPrices()): ?> - - - - - - - - - - - helper('tax')->displayCartBothPrices()): ?> - - - - - - - - -getChildHtml('totals'); ?> - - getItems() as $_item): ?> - getItemHtml($_item) ?> - - -
    __('Product') ?>__('Price') ?>__('Qty') ?>__('Subtotal') ?>
    helper('tax')->getIncExcTaxLabel(false) ?>helper('tax')->getIncExcTaxLabel(true) ?>helper('tax')->getIncExcTaxLabel(false) ?>helper('tax')->getIncExcTaxLabel(true) ?>
    - diff --git a/app/design/frontend/rwd/default/template/paypal/express/review/shipping/method.phtml b/app/design/frontend/rwd/default/template/paypal/express/review/shipping/method.phtml deleted file mode 100644 index c90e1ea45ae..00000000000 --- a/app/design/frontend/rwd/default/template/paypal/express/review/shipping/method.phtml +++ /dev/null @@ -1,35 +0,0 @@ - -
    -getCanEditShippingMethod() || !$this->getCurrentShippingRate()):?> - getShippingRateGroups()):?> - getCurrentShippingRate(); ?> - - -

    __('Sorry, no quotes are available for this order at this time.') ?>

    - - -

    renderShippingRateOption($this->getCurrentShippingRate())?>

    - -
    - diff --git a/app/design/frontend/rwd/default/template/paypal/partner/us_logo.phtml b/app/design/frontend/rwd/default/template/paypal/partner/us_logo.phtml deleted file mode 100644 index c1055c83f4f..00000000000 --- a/app/design/frontend/rwd/default/template/paypal/partner/us_logo.phtml +++ /dev/null @@ -1,25 +0,0 @@ - - - diff --git a/app/etc/modules/Mage_PaypalUk.xml b/app/etc/modules/Mage_PaypalUk.xml deleted file mode 100644 index 3e1294b8be2..00000000000 --- a/app/etc/modules/Mage_PaypalUk.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - true - core - - - - - - - - - diff --git a/app/locale/en_US/Mage_Paypal.csv b/app/locale/en_US/Mage_Paypal.csv index e6657d1ae56..99eadf78cc9 100644 --- a/app/locale/en_US/Mage_Paypal.csv +++ b/app/locale/en_US/Mage_Paypal.csv @@ -644,3 +644,64 @@ "no reason","no reason" "reversal of an adjustment","reversal of an adjustment" "unknown reason","unknown reason" +"All debug logs have been deleted.","All debug logs have been deleted." +"An error occurred while processing your payment. Please try again.","An error occurred while processing your payment. Please try again." +"Are you sure you want to delete all debug logs?","Are you sure you want to delete all debug logs?" +"Authorization Expires","Authorization Expires" +"Authorization ID","Authorization ID" +"Black","Black" +"Blue","Blue" +"Buy Now","Buy Now" +"Client ID","Client ID" +"Client Secret","Client Secret" +"Debug Log","Debug Log" +"Delete All Logs","Delete All Logs" +"Enable this option to log PayPal API requests and responses.","Enable this option to log PayPal API requests and responses." +"Enable this option to use the PayPal Sandbox environment for testing.","Enable this option to use the PayPal Sandbox environment for testing." +"Enter the title for the PayPal Express Checkout button.","Enter the title for the PayPal Express Checkout button." +"Enter your PayPal REST API Client ID.Learn more about PayPal API credentials","Enter your PayPal REST API Client ID.Learn more about PayPal API credentials" +"Enter your PayPal REST API Client Secret.Learn more about PayPal API credentials","Enter your PayPal REST API Client Secret.Learn more about PayPal API credentials" +"Exception","Exception" +"Failed to reauthorize payment","Failed to reauthorize payment" +"Gold","Gold" +"Horizontal","Horizontal" +"If not specified, Default Country from General Config will be + used. Learn more about PayPal Supported Countries.","If not specified, Default Country from General Config will be + used. Learn more about PayPal Supported Countries." +"If you want to use PayPal Express Checkout, you must complete the settings below.","If you want to use PayPal Express Checkout, you must complete the settings below." +"Invalid form key","Invalid form key" +"Order ID is required","Order ID is required" +"Order not found","Order not found" +"Pay with PayPal","Pay with PayPal" +"PayPal","PayPal" +"PayPal (Recommended)","PayPal (Recommended)" +"PayPal Debug Log","PayPal Debug Log" +"PayPal Installment","PayPal Installment" +"PayPal Settings","PayPal Settings" +"PayPal authorizations expire after 3 days. Reauthorize to extend the authorization period.","PayPal authorizations expire after 3 days. Reauthorize to extend the authorization period." +"PayPal payment captured successfully. Capture ID: %s","PayPal payment captured successfully. Capture ID: %s" +"PayPal payment has been reauthorized. New authorization ID: %s. Expires on: %s","PayPal payment has been reauthorized. New authorization ID: %s. Expires on: %s" +"PayPal payment voided successfully. Transaction ID: %s","PayPal payment voided successfully. Transaction ID: %s" +"PayPal will process multishipping orders as immediate capture regardless of your authorization setting.","PayPal will process multishipping orders as immediate capture regardless of your authorization setting." +"Payment has been authorized. Capture is required.","Payment has been authorized. Capture is required." +"Payment has been successfully reauthorized. New authorization ID: %s","Payment has been successfully reauthorized. New authorization ID: %s" +"Paypal payment has been authorized, capture is required before date","Paypal payment has been authorized, capture is required before date" +"Pill","Pill" +"Please select log(s) to delete.","Please select log(s) to delete." +"Quote #","Quote #" +"Reauthorize Payment","Reauthorize Payment" +"Rectangle","Rectangle" +"Refund error: %s","Refund error: %s" +"Request","Request" +"Response","Response" +"Rounding","Rounding" +"Select whether to authorize or capture the payment immediately. Note: Authorization is not supported for multishipping orders and will automatically use capture instead.When using Authorize, funds are reserved for up to 29 days, but it's best to capture within 3 days.","Select whether to authorize or capture the payment immediately. Note: Authorization is not supported for multishipping orders and will automatically use capture instead.When using Authorize, funds are reserved for up to 29 days, but it's best to capture within 3 days." +"Selected currency code (%s) is not supported by PayPal","Selected currency code (%s) is not supported by PayPal" +"Sharp","Sharp" +"Silver","Silver" +"This order does not have a PayPal authorization","This order does not have a PayPal authorization" +"This order was not placed using PayPal","This order was not placed using PayPal" +"Transaction ID: %s","Transaction ID: %s" +"Vertical","Vertical" +"Void error: %s","Void error: %s" +"White","White" diff --git a/app/locale/en_US/Mage_PaypalUk.csv b/app/locale/en_US/Mage_PaypalUk.csv deleted file mode 100644 index 94085b297f0..00000000000 --- a/app/locale/en_US/Mage_PaypalUk.csv +++ /dev/null @@ -1,2 +0,0 @@ -"PayPal Express Checkout (Payflow Edition) Shortcut Wrapper","PayPal Express Checkout (Payflow Edition) Shortcut Wrapper" -"PayPal Express Order Review Form","PayPal Express Order Review Form" diff --git a/composer.json b/composer.json index 8a75b4be6af..bbd76fde70d 100644 --- a/composer.json +++ b/composer.json @@ -37,6 +37,7 @@ "mklkj/tinymce-i18n": "^25.2", "nnnick/chartjs": "^4.4", "openmage/composer-plugin": "^3.0", + "paypal/paypal-server-sdk": "^1.1", "pelago/emogrifier": "^7.0", "phpseclib/mcrypt_compat": "^2.0.3", "phpseclib/phpseclib": "^3.0.14", diff --git a/composer.lock b/composer.lock index 01fb60457cf..def622809a6 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,224 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9b28e4ca972506fbf0f405c2b014d7b5", + "content-hash": "037033d886a52bad856ff19653b42c53", "packages": [ + { + "name": "apimatic/core", + "version": "0.3.14", + "source": { + "type": "git", + "url": "https://github.com/apimatic/core-lib-php.git", + "reference": "c3eaad6cf0c00b793ce6d9bee8b87176247da582" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/apimatic/core-lib-php/zipball/c3eaad6cf0c00b793ce6d9bee8b87176247da582", + "reference": "c3eaad6cf0c00b793ce6d9bee8b87176247da582", + "shasum": "" + }, + "require": { + "apimatic/core-interfaces": "~0.1.5", + "apimatic/jsonmapper": "^3.1.1", + "ext-curl": "*", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "php": "^7.2 || ^8.0", + "php-jsonpointer/php-jsonpointer": "^3.0.2", + "psr/log": "^1.1.4 || ^2.0.0 || ^3.0.0" + }, + "require-dev": { + "phan/phan": "5.4.5", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "squizlabs/php_codesniffer": "^3.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Core\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Core logic and the utilities for the Apimatic's PHP SDK", + "homepage": "https://github.com/apimatic/core-lib-php", + "keywords": [ + "apimatic", + "core", + "corelib", + "php" + ], + "support": { + "issues": "https://github.com/apimatic/core-lib-php/issues", + "source": "https://github.com/apimatic/core-lib-php/tree/0.3.14" + }, + "time": "2025-02-27T06:03:30+00:00" + }, + { + "name": "apimatic/core-interfaces", + "version": "0.1.5", + "source": { + "type": "git", + "url": "https://github.com/apimatic/core-interfaces-php.git", + "reference": "b4f1bffc8be79584836f70af33c65e097eec155c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/apimatic/core-interfaces-php/zipball/b4f1bffc8be79584836f70af33c65e097eec155c", + "reference": "b4f1bffc8be79584836f70af33c65e097eec155c", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "CoreInterfaces\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Definition of the behavior of apimatic/core, apimatic/unirest-php and Apimatic's PHP SDK", + "homepage": "https://github.com/apimatic/core-interfaces-php", + "keywords": [ + "apimatic", + "core", + "corelib", + "interface", + "php", + "unirest" + ], + "support": { + "issues": "https://github.com/apimatic/core-interfaces-php/issues", + "source": "https://github.com/apimatic/core-interfaces-php/tree/0.1.5" + }, + "time": "2024-05-09T06:32:07+00:00" + }, + { + "name": "apimatic/jsonmapper", + "version": "3.1.6", + "source": { + "type": "git", + "url": "https://github.com/apimatic/jsonmapper.git", + "reference": "c6cc21bd56bfe5d5822bbd08f514be465c0b24e7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/apimatic/jsonmapper/zipball/c6cc21bd56bfe5d5822bbd08f514be465c0b24e7", + "reference": "c6cc21bd56bfe5d5822bbd08f514be465c0b24e7", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": "^5.6 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0", + "squizlabs/php_codesniffer": "^3.0.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "apimatic\\jsonmapper\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "OSL-3.0" + ], + "authors": [ + { + "name": "Christian Weiske", + "email": "christian.weiske@netresearch.de", + "homepage": "http://www.netresearch.de/", + "role": "Developer" + }, + { + "name": "Mehdi Jaffery", + "email": "mehdi.jaffery@apimatic.io", + "homepage": "http://apimatic.io/", + "role": "Developer" + } + ], + "description": "Map nested JSON structures onto PHP classes", + "support": { + "email": "mehdi.jaffery@apimatic.io", + "issues": "https://github.com/apimatic/jsonmapper/issues", + "source": "https://github.com/apimatic/jsonmapper/tree/3.1.6" + }, + "time": "2024-11-28T09:15:32+00:00" + }, + { + "name": "apimatic/unirest-php", + "version": "4.0.6", + "source": { + "type": "git", + "url": "https://github.com/apimatic/unirest-php.git", + "reference": "df38c93ffa71e8a1b7a075c2322c28cdfe8fe1f5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/apimatic/unirest-php/zipball/df38c93ffa71e8a1b7a075c2322c28cdfe8fe1f5", + "reference": "df38c93ffa71e8a1b7a075c2322c28cdfe8fe1f5", + "shasum": "" + }, + "require": { + "apimatic/core-interfaces": "^0.1.0", + "ext-curl": "*", + "ext-json": "*", + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "phan/phan": "5.4.2", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "squizlabs/php_codesniffer": "^3.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Unirest\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mashape", + "email": "opensource@mashape.com", + "homepage": "https://www.mashape.com", + "role": "Developer" + }, + { + "name": "APIMATIC", + "email": "opensource@apimatic.io", + "homepage": "https://www.apimatic.io", + "role": "Developer" + } + ], + "description": "Unirest PHP", + "homepage": "https://github.com/apimatic/unirest-php", + "keywords": [ + "client", + "curl", + "http", + "https", + "rest" + ], + "support": { + "email": "opensource@apimatic.io", + "issues": "https://github.com/apimatic/unirest-php/issues", + "source": "https://github.com/apimatic/unirest-php/tree/4.0.6" + }, + "time": "2025-04-22T09:12:12+00:00" + }, { "name": "carbonphp/carbon-doctrine-types", "version": "3.2.0", @@ -1536,6 +1752,50 @@ }, "time": "2020-10-15T08:29:30+00:00" }, + { + "name": "paypal/paypal-server-sdk", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/paypal/PayPal-PHP-Server-SDK.git", + "reference": "3964c1732b1815fa8cf8aee37069ccc4e95d9572" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paypal/PayPal-PHP-Server-SDK/zipball/3964c1732b1815fa8cf8aee37069ccc4e95d9572", + "reference": "3964c1732b1815fa8cf8aee37069ccc4e95d9572", + "shasum": "" + }, + "require": { + "apimatic/core": "~0.3.13", + "apimatic/core-interfaces": "~0.1.5", + "apimatic/unirest-php": "^4.0.6", + "ext-curl": "*", + "ext-json": "*", + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "phan/phan": "5.4.5", + "squizlabs/php_codesniffer": "^3.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "PaypalServerSdkLib\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PayPal's SDK for interacting with the REST APIs", + "homepage": "https://github.com/paypal/PayPal-PHP-Server-SDK", + "support": { + "issues": "https://github.com/paypal/PayPal-PHP-Server-SDK/issues", + "source": "https://github.com/paypal/PayPal-PHP-Server-SDK/tree/1.1.0" + }, + "time": "2025-05-27T17:46:31+00:00" + }, { "name": "pelago/emogrifier", "version": "v7.3.0", @@ -1618,6 +1878,62 @@ }, "time": "2024-10-28T16:12:26+00:00" }, + { + "name": "php-jsonpointer/php-jsonpointer", + "version": "v3.0.2", + "source": { + "type": "git", + "url": "https://github.com/raphaelstolt/php-jsonpointer.git", + "reference": "4428f86c6f23846e9faa5a420c4ef14e485b3afb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/raphaelstolt/php-jsonpointer/zipball/4428f86c6f23846e9faa5a420c4ef14e485b3afb", + "reference": "4428f86c6f23846e9faa5a420c4ef14e485b3afb", + "shasum": "" + }, + "require": { + "php": ">=5.4" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^1.11", + "phpunit/phpunit": "4.6.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Rs\\Json": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Raphael Stolt", + "email": "raphael.stolt@gmail.com", + "homepage": "http://raphaelstolt.blogspot.com/" + } + ], + "description": "Implementation of JSON Pointer (http://tools.ietf.org/html/rfc6901)", + "homepage": "https://github.com/raphaelstolt/php-jsonpointer", + "keywords": [ + "json", + "json pointer", + "json traversal" + ], + "support": { + "issues": "https://github.com/raphaelstolt/php-jsonpointer/issues", + "source": "https://github.com/raphaelstolt/php-jsonpointer/tree/master" + }, + "time": "2016-08-29T08:51:01+00:00" + }, { "name": "phpseclib/mcrypt_compat", "version": "2.0.6", @@ -1897,6 +2213,56 @@ }, "time": "2021-11-05T16:47:00+00:00" }, + { + "name": "psr/log", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/ef29f6d262798707a9edd554e2b82517ef3a9376", + "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/2.0.0" + }, + "time": "2021-07-14T16:41:46+00:00" + }, { "name": "psr/simple-cache", "version": "3.0.0", @@ -6785,56 +7151,6 @@ }, "time": "2019-01-08T18:20:26+00:00" }, - { - "name": "psr/log", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/ef29f6d262798707a9edd554e2b82517ef3a9376", - "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376", - "shasum": "" - }, - "require": { - "php": ">=8.0.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "support": { - "source": "https://github.com/php-fig/log/tree/2.0.0" - }, - "time": "2021-07-14T16:41:46+00:00" - }, { "name": "react/cache", "version": "v1.2.0", @@ -9286,5 +9602,5 @@ "platform-overrides": { "php": "8.1" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/js/paypal/payment.js b/js/paypal/payment.js new file mode 100644 index 00000000000..1ac8b341963 --- /dev/null +++ b/js/paypal/payment.js @@ -0,0 +1,483 @@ +/** + * OpenMage + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available at https://opensource.org/license/afl-3-0-php + * + * @category Varien + * @package js + * @copyright Copyright (c) 2022-2025 The OpenMage Contributors (https://www.openmage.org) + * @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ + +class PayPalPayment { + constructor(config = {}) { + this.config = config; + this.buttonInitialized = false; + this.sdkLoaded = false; + this.renderPromise = null; + this.reviewContainerInterval = null; + this.abortController = new AbortController(); + + this.init(); + } + + async init() { + if (document.readyState === 'loading') { + await new Promise(resolve => { + document.addEventListener('DOMContentLoaded', resolve, { once: true }); + }); + } + + this.setupEventListeners(); + this.checkAndInitialize(); + } + + setupEventListeners() { + this.setupPaymentMethodHandling(); + this.setupPaymentButtonHandling(); + } + + setupPaymentButtonHandling() { + const paymentButton = document.querySelector('button[onclick="payment.save()"]'); + if (!paymentButton) return; + + paymentButton.addEventListener('click', async () => { + if (this.getCurrentPaymentMethod() === this.config.methodCode) { + this.handlePaymentMethodChange(this.config.methodCode); + const container = await this.waitForReviewContainer(); + if (container) { + await this.initializePayPalButton(); + } + } + }, { signal: this.abortController.signal }); + } + + async waitForReviewContainer() { + if (this.reviewContainerInterval) { + clearInterval(this.reviewContainerInterval); + this.reviewContainerInterval = null; + } + + const maxAttempts = 100; + let attempts = 0; + + return new Promise(resolve => { + const checkForContainer = () => { + attempts++; + const reviewContainer = document.getElementById(this.config.reviewButtonContainerId); + + if (reviewContainer || attempts >= maxAttempts) { + if (this.reviewContainerInterval) { + clearInterval(this.reviewContainerInterval); + this.reviewContainerInterval = null; + } + resolve(reviewContainer); + } + }; + + checkForContainer(); + + if (!document.getElementById(this.config.reviewButtonContainerId)) { + this.reviewContainerInterval = setInterval(checkForContainer, 100); + } + }); + } + + checkAndInitialize() { + if (this.getCurrentPaymentMethod() === this.config.methodCode) { + this.initializePayPalButton(); + } + } + + getCurrentPaymentMethod() { + const checkedInput = document.querySelector('input[name="payment[method]"]:checked'); + return checkedInput?.value ?? null; + } + + async initializePayPalButton() { + if (this.buttonInitialized) return; + + try { + await this.loadPayPalSDK(); + await this.renderButton(); + } catch (error) { + this.showError('Failed to load PayPal. Please try another payment method.'); + } + } + + async loadPayPalSDK() { + if (typeof paypal !== 'undefined') { + this.sdkLoaded = true; + return; + } + + return new Promise((resolve, reject) => { + const script = document.createElement('script'); + script.src = this.config.sdkUrl; + script.async = true; + script.onload = () => { + this.sdkLoaded = true; + resolve(); + }; + script.onerror = () => reject(new Error('Failed to load PayPal SDK')); + document.head.appendChild(script); + }); + } + + async renderButton() { + if (!this.sdkLoaded) { + throw new Error('PayPal SDK not loaded'); + } + + const reviewContainer = document.getElementById(this.config.reviewButtonContainerId); + if (!reviewContainer) { + throw new Error('Review container not found'); + } + + this.removePayPalButton(); + + const checkoutButton = reviewContainer.querySelector('button.btn-checkout'); + const paypalContainer = this.createPayPalContainer(); + + if (!checkoutButton) { + reviewContainer.prepend(paypalContainer); + } else { + checkoutButton.remove(); + const pleaseWaitSpan = reviewContainer.querySelector('span.please-wait'); + + if (pleaseWaitSpan) { + pleaseWaitSpan.before(paypalContainer); + } else { + reviewContainer.prepend(paypalContainer); + } + } + + try { + await this.createPayPalButton(paypalContainer, reviewContainer); + } catch (error) { + this.handleRenderError(error, reviewContainer, paypalContainer); + throw error; + } + } + + createPayPalContainer() { + const container = document.createElement('div'); + container.id = this.config.containerId; + container.className = 'paypal-button-container'; + container.style.cssText = 'margin: 0; min-height: 35px;'; + return container; + } + + async createPayPalButton(paypalContainer, reviewContainer) { + const buttonWrapper = document.createElement('div'); + buttonWrapper.className = 'paypal-button-wrapper'; + paypalContainer.appendChild(buttonWrapper); + + await paypal.Buttons({ + style: { + layout: this.config.buttonLayout || 'vertical', + color: this.config.buttonColor || 'gold', + shape: this.config.buttonShape || 'rect', + label: this.config.buttonLabel || 'paypal', + height: parseInt(this.config.buttonHeight, 10) || 40 + }, + createOrder: (data) => this.createOrder(data), + onApprove: (data) => this.onApprove(data), + onError: (error) => this.onButtonError(error), + onCancel: () => this.onCancel() + }).render(buttonWrapper); + + this.buttonInitialized = true; + } + + handleRenderError(error, reviewContainer, paypalContainer) { + paypalContainer?.remove(); + this.recreateCheckoutButton(reviewContainer); + this.buttonInitialized = false; + } + + recreateCheckoutButton(reviewContainer) { + if (reviewContainer.querySelector('button.btn-checkout')) return; + + const checkoutButton = document.createElement('button'); + checkoutButton.type = 'submit'; + checkoutButton.title = 'Place Order'; + checkoutButton.className = 'button btn-checkout'; + checkoutButton.onclick = () => review.save(); + + const span1 = document.createElement('span'); + const span2 = document.createElement('span'); + span2.textContent = 'Place Order'; + span1.appendChild(span2); + checkoutButton.appendChild(span1); + + const pleaseWaitSpan = reviewContainer.querySelector('span.please-wait'); + if (pleaseWaitSpan) { + pleaseWaitSpan.before(checkoutButton); + } else { + reviewContainer.prepend(checkoutButton); + } + } + + async createOrder(data) { + this.showLoadingMask(); + + try { + if (!this.validateForm()) { + throw new Error('Form validation failed'); + } + + const requestBody = new URLSearchParams({ + form_key: this.config.formKey + }); + + if (data?.paymentSource) { + requestBody.append('funding_source', data.paymentSource); + } + const response = await fetch(this.config.createOrderUrl, { + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + }, + body: requestBody, + signal: this.abortController.signal + }); + + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + + const result = await response.json(); + + if (!result?.success || !result?.id) { + throw new Error(result?.message || 'Failed to create PayPal order'); + } + + return result.id; + } catch (error) { + console.error('Create order error:', error); + this.showError(error.message); + this.hideLoadingMask(); + throw error; + } finally { + this.hideLoadingMask(); + } + } + + async onApprove(data) { + this.showLoadingMask(); + + try { + const response = await fetch(this.config.captureUrl, { + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + }, + body: new URLSearchParams({ + order_id: data.orderID, + form_key: this.config.formKey + }), + signal: this.abortController.signal + }); + + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + + const result = await response.json(); + + if (!result?.success) { + throw new Error(result?.message || 'Payment capture failed'); + } + + this.submitPlaceOrderForm(data.orderID); + return result; + } catch (error) { + console.error('Payment approval error:', error); + this.showError(error.message); + this.hideLoadingMask(); + throw error; + } + } + + submitPlaceOrderForm(orderId) { + const form = document.createElement('form'); + form.method = 'POST'; + form.action = this.config.placeOrderUrl; + form.style.display = 'none'; + + const orderIdInput = document.createElement('input'); + orderIdInput.type = 'hidden'; + orderIdInput.name = 'id'; + orderIdInput.value = orderId; + + const formKeyInput = document.createElement('input'); + formKeyInput.type = 'hidden'; + formKeyInput.name = 'form_key'; + formKeyInput.value = this.config.formKey; + + form.append(orderIdInput, formKeyInput); + document.body.appendChild(form); + form.submit(); + } + + onButtonError(error) { + console.error('PayPal button error:', error); + this.onCancel(); + this.showError(error); + } + + onCancel() { + this.hideLoadingMask(); + fetch(this.config.cancelUrl, { + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + }, + body: new URLSearchParams({ + form_key: this.config.formKey + }), + signal: this.abortController.signal + }).catch(err => console.error('Cancel order error:', err)); + this.showError('PayPal payment cancelled by user.'); + } + + validateForm() { + const form = document.getElementById('firecheckout-form') || + document.getElementById('co-payment-form'); + + if (!form) return false; + + const isValid = form.checkValidity(); + if (!isValid) { + form.reportValidity(); + } + + if (typeof Validation !== 'undefined') { + const validator = new Validation(form); + return validator.validate() && isValid; + } + + return isValid; + } + + setupPaymentMethodHandling() { + const paymentInputs = document.querySelectorAll('input[name="payment[method]"]'); + + paymentInputs.forEach(input => { + input.addEventListener('change', () => { + this.handlePaymentMethodChange(input.value); + }, { signal: this.abortController.signal }); + }); + + document.addEventListener('payment-method:switched', (event) => { + const methodCode = event.detail?.method_code; + if (methodCode) { + this.handlePaymentMethodChange(methodCode); + } + }, { signal: this.abortController.signal }); + + const currentMethod = this.getCurrentPaymentMethod(); + if (currentMethod) { + this.handlePaymentMethodChange(currentMethod); + } + } + + handlePaymentMethodChange(selectedMethod) { + const reviewContainer = document.getElementById(this.config.reviewButtonContainerId); + if (!reviewContainer) return; + + this.buttonInitialized = false; + reviewContainer.remove(); + } + + removePayPalButton() { + const container = document.getElementById(this.config.containerId); + if (container) { + container.remove(); + this.buttonInitialized = false; + } + } + + showLoadingMask() { + let mask = document.getElementById('loading-mask'); + + if (!mask) { + mask = document.createElement('div'); + mask.id = 'loading-mask'; + mask.className = 'loading-mask'; + mask.style.cssText = ` + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: rgba(0,0,0,0.5); + z-index: 9999; + display: flex; + align-items: center; + justify-content: center; + `; + + const loader = document.createElement('div'); + loader.className = 'loading-mask-loader'; + loader.style.cssText = 'color: white; font-size: 18px;'; + loader.textContent = 'Processing...'; + + mask.appendChild(loader); + document.body.appendChild(mask); + } + + mask.style.display = 'flex'; + } + + hideLoadingMask() { + const mask = document.getElementById('loading-mask'); + if (mask) { + mask.style.display = 'none'; + } + } + + showError(message) { + const errorId = `${this.config.containerId}-error`; + const existingError = document.getElementById(errorId); + existingError?.remove(); + + const container = document.getElementById(this.config.containerId); + if (!container) return; + + const errorDiv = document.createElement('div'); + errorDiv.id = errorId; + errorDiv.className = 'paypal-error'; + errorDiv.style.cssText = ` + color: red; + margin: 10px 0; + padding: 10px; + border: 1px solid red; + background: #ffe6e6; + border-radius: 4px; + `; + errorDiv.textContent = message || this.config.errorMessage || 'An error occurred. Please try again later.'; + container.after(errorDiv); + } + + destroy() { + this.abortController.abort(); + + if (this.reviewContainerInterval) { + clearInterval(this.reviewContainerInterval); + this.reviewContainerInterval = null; + } + + this.removePayPalButton(); + + const mask = document.getElementById('loading-mask'); + mask?.remove(); + } +} + +if (typeof window !== 'undefined') { + window.PayPalPayment = PayPalPayment; +} \ No newline at end of file diff --git a/js/varien/payment.js b/js/varien/payment.js index bc1f4ebef48..fdcd88e84dd 100644 --- a/js/varien/payment.js +++ b/js/varien/payment.js @@ -54,4 +54,4 @@ paymentForm.prototype = { this.currentMethod = method; } } -}; +}; \ No newline at end of file diff --git a/skin/adminhtml/default/default/boxes.css b/skin/adminhtml/default/default/boxes.css index 82a53b450fb..994500bb9f7 100644 --- a/skin/adminhtml/default/default/boxes.css +++ b/skin/adminhtml/default/default/boxes.css @@ -1009,21 +1009,6 @@ ul.item-options li { padding-left:.7em; } .giftmessage-whole-order-container .entry-edit textarea { width:99% !important; padding:2px 3px; } .giftmessage-whole-order-container .entry-edit label { width:121px; } -/* PayPal */ - -.pp-general-uk > .config-heading .heading strong, -.pp-method-payflow > .config-heading .heading strong, -.pp-method-express > .config-heading .heading strong, -.pp-method-general > .config-heading .heading strong { padding-left:56px; background:url(images/paypal/logo-paypal.png) no-repeat 0 2px; } -.pp-method-general > .config-heading .button-container { padding:8px 0 0 180px; background:url(images/paypal/pp-allinone.png) no-repeat 0 0; height:26px; } -.pp-method-express > .config-heading .button-container { padding:0 0 0 174px; background:url(images/paypal/pp-alt.png) no-repeat 0 0; height:29px; } -.pp-method-payflow > .config-heading .button-container { padding:0px 0 0 99px; background:url(images/paypal/pp-gateways.png) no-repeat 1px 0; height:36px; } -.pp-general-uk > .config-heading .button-container { padding:9px 0 0 201px; background:url(images/paypal/pp-uk.png) no-repeat 0 0; height:27px; } -.payflow-settings-notice {padding-bottom: 1em;max-width: 660px;} -.payflow-settings-notice .important-label {color:red;} -.payflow-settings-notice ul.options-list {list-style:disc;padding:0 2em;} - - /* Packaging for Shipping Popup */ #popup-window-mask, .popup-window-mask { background:url(images/bg_window_mask.png) repeat 0 0; background:rgba(239, 239, 239, 0.5); position:absolute; top:0; right:0; bottom:0; left:0; width:100%; height:100%; z-index:399; } @@ -1319,8 +1304,6 @@ ul.config-tabs a.last span { background-image:none; } .comment { padding:5px; } .comment a { color:#888; margin-left:3px; } -.paypal-payment-notice { font-weight: bold; margin: -10px 0 10px 0; } - .payment-group-title { border:0; padding:10px 5px 10px; } .payment-group-title strong { display:inline; font-size:14px; border:0; } diff --git a/skin/frontend/base/default/css/paypal.css b/skin/frontend/base/default/css/paypal.css new file mode 100644 index 00000000000..6e7f21ad1be --- /dev/null +++ b/skin/frontend/base/default/css/paypal.css @@ -0,0 +1,25 @@ +.paypal-payment-method { + margin: 10px 0; +} + +.paypal-button-container { + min-height: 35px; + margin: 10px 0; +} + +.paypal-button-container[data-loading="true"] { + opacity: 0.5; + pointer-events: none; +} + +.paypal-error { + color: #df280a; + margin: 5px 0; + font-size: 13px; +} + +.paypal-message { + margin: 10px 0; + font-size: 13px; + color: #666; +} \ No newline at end of file diff --git a/skin/frontend/base/default/js/msrp.js b/skin/frontend/base/default/js/msrp.js index eece5853461..5d8d49fc9af 100644 --- a/skin/frontend/base/default/js/msrp.js +++ b/skin/frontend/base/default/js/msrp.js @@ -108,9 +108,6 @@ Catalog.Map = { if (helpBox.parentNode != bodyNode) { helpBox.remove(); bodyNode.insert(helpBox); - // Fix for FF4-FF5 bug with missing alt text after DOM manipulations - var paypalImg = helpBox.select('.paypal-logo > a > img')[0]; - if (paypalImg) paypalImg.src = paypalImg.src; } if (this != Catalog.Map && Catalog.Map.active != this.link) { diff --git a/skin/frontend/rwd/default/css/styles.css b/skin/frontend/rwd/default/css/styles.css index 4070de61841..a63c2154718 100644 --- a/skin/frontend/rwd/default/css/styles.css +++ b/skin/frontend/rwd/default/css/styles.css @@ -1015,50 +1015,6 @@ a.button:hover { display: none; } } -/* -------------------------------------------- * - * Paypal Button - */ -.paypal-logo.paypal-after { - float: left; -} - -.paypal-after .paypal-or { - float: left; -} - -.paypal-or { - line-height: 34px; - margin: 0px 10px 5px; -} - -.paypal-after .paypal-button { - float: left; -} - -.paypal-button { - line-height: 0px; -} - -.paypal-button img { - display: inline; -} - -@media only screen and (max-width: 740px) { - .paypal-or { - line-height: 20px; - } - - .paypal-logo, - .paypal-or, - .paypal-button { - text-align: center; - width: 100%; - display: block; - margin-right: 0; - margin-left: 0; - float: none; - } -} /* -------------------------------------------- * * Button Sets */ @@ -5170,9 +5126,6 @@ p.product-name a:hover { .product-view .product-options-bottom .price-box, .product-view .add-to-cart .qty-wrapper, .product-view .add-to-cart-buttons .button, -.product-view .add-to-cart-buttons .paypal-logo { - margin-bottom: 10px; -} .product-view .add-to-cart .qty-wrapper, .product-view .add-to-cart .qty-wrapper label { margin-right: 7px; @@ -5190,31 +5143,6 @@ p.product-name a:hover { margin-right: 10px; max-width: 100%; } -.product-view .add-to-cart-buttons .paypal-logo { - clear: left; - text-align: center; -} -.product-view .add-to-cart-buttons .paypal-logo .paypal-button { - margin: 0 auto; - display: block; - width: 170px; -} -.product-view .add-to-cart-buttons .paypal-logo .bml_button { - display: block; - width: 174px; - margin: 0 auto; -} -.product-view .add-to-cart-buttons .paypal-logo .bml_button a { - text-align: center; -} -.product-view .add-to-cart-buttons .paypal-logo .paypal-or { - display: block; - margin-bottom: 10px; - margin-left: 0; - margin-right: 0; - line-height: 1; - text-align: center; -} .product-view .add-to-cart-buttons .button { min-height: 40px; line-height: 40px; @@ -5229,23 +5157,6 @@ p.product-name a:hover { .product-view .alert-stock { clear: both; } - -@media only screen and (max-width: 479px) { - .product-view .add-to-cart-buttons .paypal-or { - line-height: 20px; - } - .product-view .add-to-cart-buttons .paypal-logo, - .product-view .add-to-cart-buttons .paypal-or, - .product-view .add-to-cart-buttons .paypal-button, - .product-view .add-to-cart-buttons .button { - text-align: center; - width: 100%; - display: block; - margin-right: 0; - margin-left: 0; - float: none; - } -} /* This is the "or" that separates the "Add to Cart" and "Add to X" links */ .add-to-box .or { display: none; @@ -5967,46 +5878,6 @@ p.product-name a:hover { .map-popup .map-popup-checkout .additional-addtocart-box li { list-style-type: none; } -.map-popup .map-popup-checkout .paypal-logo { - width: auto; -} -.map-popup .map-popup-checkout .paypal-logo a { - display: inline-block; - float: left; - clear: left; -} -.map-popup .map-popup-checkout .paypal-logo .paypal-or { - float: left; - text-align: center; - padding: 5px 15px; - clear: left; -} -.map-popup .map-popup-checkout .paypal-logo:after { - content: ''; - display: table; - clear: both; -} -.map-popup .map-popup-checkout .paypal-logo .bml_button a { - clear: left; -} -@media only screen and (max-width: 479px) { - .map-popup .map-popup-checkout { - text-align: center; - } - .map-popup .map-popup-checkout .button, - .map-popup .map-popup-checkout .additional-addtocart-box, - .map-popup .map-popup-checkout .paypal-logo a, - .map-popup .map-popup-checkout .paypal-logo .paypal-or { - float: none; - } - .map-popup .map-popup-checkout .additional-addtocart-box { - min-width: 0px; - } - .map-popup .map-popup-checkout .paypal-logo .paypal-or { - margin: 0px; - margin-bottom: 10px; - } -} .map-popup .map-popup-checkout:after { content: ''; display: table; @@ -6235,24 +6106,6 @@ p.product-name a:hover { .checkout-types.top .bml_button img { display: block; } -.checkout-types.top .paypal-logo .paypal-or { - margin-top: 5px; -} -.checkout-types.bottom .paypal-logo a, .checkout-types.minicart .paypal-logo a { - display: block; -} -.checkout-types.bottom .paypal-or, .checkout-types.minicart .paypal-or { - margin: 0px; - display: block; - text-align: center; -} - -@media only screen and (min-width: 741px) { - .checkout-types.bottom .paypal-or { - text-align: right; - padding-right: 70px; - } -} .cart-totals .checkout-types .btn-checkout { margin-bottom: 7px; } @@ -6262,10 +6115,6 @@ p.product-name a:hover { float: none; text-align: center; } - .checkout-types.bottom .paypal-or, .checkout-types.minicart .paypal-or { - width: auto; - float: none; - } .checkout-types li { float: none; @@ -7006,12 +6855,6 @@ p.product-name a:hover { padding: 5px 5px 5px 0; } -@media only screen and (max-width: 479px) { - .opc .buttons-set .button + .buttons-set .button, - .paypal-express-review .buttons-set .button + .buttons-set .button { - margin-left: 0; - } -} .opc #opc-login .step { padding: 0px; } @@ -8340,135 +8183,6 @@ body.newsletter-manage-index .my-account .form-list { } } -/* ============================================ * - * PayPal - * ============================================ */ -@media only screen and (max-width: 870px) and (min-width: 771px) { - .paypal-review-order .col2-set .col-1, - .paypal-review-order .col2-set .col-2 { - padding: 0px; - } -} -.paypal-review-order .info-set { - margin-bottom: 10px; - padding-bottom: 10px; - border-bottom: 1px solid #ededed; -} -.paypal-review-order .buttons-set { - margin-top: 0px; - padding-top: 0px; - border: 0; -} -.paypal-review-order .buttons-set button { - margin-bottom: 10px; -} -@media only screen and (max-width: 770px) { - .paypal-review-order .col-1 { - padding-bottom: 0; - } - .paypal-review-order .field.inactive { - display: none; - } -} - -.top-container .bml-ad { - margin-top: 7px; - margin-bottom: 7px; - text-align: center; -} -.top-container .bml-ad span { - display: inline-block; -} -.top-container .bml-ad span a { - display: block; -} - -.bml-ad { - display: none; - text-align: center; - margin-bottom: 5px; -} -.bml-ad span { - display: block; - line-height: 0; -} -.bml-ad a { - display: inline-block; - max-width: 100%; -} -.bml-ad a:hover { - opacity: 0.7; -} -.bml-ad img { - height: auto !important; - max-width: 100%; -} - -.cart-totals-wrapper .bml-ad.large img { - display: block; - margin: 0; -} - -@media only screen and (max-width: 770px) { - .bml-ad.small { - display: block; - } -} -@media only screen and (min-width: 771px) { - .bml-ad.large { - display: block; - } -} -div.paypal-logo { - text-align: center; - margin: 15px 0; - max-width: 100%; -} -div.paypal-logo span { - display: block; - width: 100%; -} -div.paypal-logo span a { - display: inline-block; - max-width: 100%; -} -div.paypal-logo span a img { - max-width: 100%; -} -div.paypal-logo span > img { - display: none; -} - -.checkout-types div.paypal-logo { - text-align: right; -} - -.bml-checkout-type { - list-style-type: none; -} - -.sidebar .paypal-logo { - text-align: center; - line-height: 0; -} -.sidebar .paypal-logo > a { - display: inline-block; - max-width: 100%; -} -.sidebar .paypal-logo > a:hover { - opacity: 0.8; -} -.sidebar .paypal-logo > a img { - display: block; -} -.sidebar .paypal-logo .label { - margin-top: 4px; -} -.sidebar .paypal-logo .label a { - font-size: 12px; - line-height: 1.5; -} - /* ============================================ * * Review - Customer * ============================================ */ @@ -9391,9 +9105,6 @@ div.paypal-logo span > img { text-transform: uppercase; font-size: 13px; } -.header-minicart .minicart-actions .paypal-logo .paypal-or { - line-height: 1.6; -} .header-minicart #minicart-error-message { text-align: center; color: red; @@ -9452,21 +9163,6 @@ div.paypal-logo span > img { .header-minicart .minicart-actions .checkout-types.minicart li { display: inline-block; } - .header-minicart .minicart-actions .checkout-types.minicart li .paypal-logo > a { - display: inline; - } - .header-minicart .minicart-actions .checkout-types.minicart li .paypal-logo .bml_button { - display: inline-block; - vertical-align: top; - } - .header-minicart .minicart-actions .checkout-types.minicart li .paypal-logo .paypal-or { - width: auto; - float: none; - display: inline; - margin: 0 10px 5px 10px; - line-height: 40px; - } -} @media only screen and (max-width: 740px) { .header-minicart .minicart-actions .cart-link { right: auto; @@ -9474,15 +9170,6 @@ div.paypal-logo span > img { text-align: center; width: 100%; } - .header-minicart .minicart-actions .checkout-types.minicart li .paypal-logo .paypal-or, - .header-minicart .minicart-actions .checkout-types.minicart li .paypal-logo .paypal-button { - width: 100%; - display: block; - margin-left: 0; - } - .header-minicart .minicart-actions .checkout-types.minicart li .paypal-logo .paypal-or { - line-height: 1.6; - } } @media only screen and (max-width: 599px) { .header-minicart .minicart-actions .checkout-button { diff --git a/skin/frontend/rwd/default/scss/_core.scss b/skin/frontend/rwd/default/scss/_core.scss index d964f42c94c..cd86a4a5372 100644 --- a/skin/frontend/rwd/default/scss/_core.scss +++ b/skin/frontend/rwd/default/scss/_core.scss @@ -63,7 +63,6 @@ @import "module/configurableswatches"; @import "module/customer"; @import "module/contacts"; -@import "module/paypal"; @import "module/review"; @import "module/slideshow"; @import "module/wishlist"; diff --git a/skin/frontend/rwd/default/scss/core/_common.scss b/skin/frontend/rwd/default/scss/core/_common.scss index 3dc1b5f1b3a..a5104a04eaa 100644 --- a/skin/frontend/rwd/default/scss/core/_common.scss +++ b/skin/frontend/rwd/default/scss/core/_common.scss @@ -455,52 +455,6 @@ a.button:hover { } } -/* -------------------------------------------- * - * Paypal Button - */ - -.paypal-logo.paypal-after { - float: left; -} - -.paypal-after .paypal-or { - float: left; -} - -.paypal-or { - line-height: 34px; - margin: 0px 10px 5px; -} - -.paypal-after .paypal-button { - float: left; -} - -.paypal-button { - line-height: 0px; -} - -.paypal-button img { - display: inline; -} - -@include bp(max-width, 740px) { - .paypal-or { - line-height: 20px; - } - - .paypal-logo, - .paypal-or, - .paypal-button { - text-align: center; - width: 100%; - display: block; - margin-right: 0; - margin-left: 0; - float: none; - } -} - /* -------------------------------------------- * * Button Sets */ diff --git a/skin/frontend/rwd/default/scss/module/_catalog-msrp.scss b/skin/frontend/rwd/default/scss/module/_catalog-msrp.scss index 9113f2ed80d..09f727c0645 100644 --- a/skin/frontend/rwd/default/scss/module/_catalog-msrp.scss +++ b/skin/frontend/rwd/default/scss/module/_catalog-msrp.scss @@ -130,51 +130,12 @@ } } - .paypal-logo { - width: auto; - - a { - display: inline-block; - float: left; - clear: left; - } - - .paypal-or { - float: left; - text-align: center; - padding: 5px 15px; - clear: left; - } - - &:after { - @include clearfix; - } - - .bml_button { - a { - clear: left; - } - } - } - @include bp(max-width, $bp-xsmall) { text-align: center; - .button, - .additional-addtocart-box, - .paypal-logo a, - .paypal-logo .paypal-or { - float: none; - } - .additional-addtocart-box { min-width: 0px; } - - .paypal-logo .paypal-or { - margin: 0px; - margin-bottom: 10px; - } } &:after { diff --git a/skin/frontend/rwd/default/scss/module/_catalog-product.scss b/skin/frontend/rwd/default/scss/module/_catalog-product.scss index 0bcde976579..c1387fa3d19 100644 --- a/skin/frontend/rwd/default/scss/module/_catalog-product.scss +++ b/skin/frontend/rwd/default/scss/module/_catalog-product.scss @@ -334,13 +334,6 @@ min-height: 40px; } - .product-options-bottom .price-box, - .add-to-cart .qty-wrapper, - .add-to-cart-buttons .button, - .add-to-cart-buttons .paypal-logo { - margin-bottom: 10px; - } - .add-to-cart .qty-wrapper, .add-to-cart .qty-wrapper label { margin-right: 7px; @@ -360,36 +353,6 @@ float: left; margin-right: 10px; max-width: 100%; // Constrain width in Firefox - - .paypal-logo { - clear: left; - text-align: center; - - .paypal-button { - margin: 0 auto; - display: block; - width: 170px; - } - - .bml_button { - display: block; - width: 174px; - margin: 0 auto; - - a { - text-align: center; - } - } - - .paypal-or { - display: block; - margin-bottom: 10px; - margin-left: 0; - margin-right: 0; - line-height: 1; - text-align: center; - } - } } .add-to-cart-buttons .button { @@ -409,25 +372,6 @@ } } -@include bp(max-width, $bp-xsmall) { - .product-view .add-to-cart-buttons { - .paypal-or { - line-height: 20px; - } - - .paypal-logo, - .paypal-or, - .paypal-button, - .button { - text-align: center; - width: 100%; - display: block; - margin-right: 0; - margin-left: 0; - float: none; - } - } -} /* This is the "or" that separates the "Add to Cart" and "Add to X" links */ .add-to-box .or { diff --git a/skin/frontend/rwd/default/scss/module/_checkout-cart-minicart.scss b/skin/frontend/rwd/default/scss/module/_checkout-cart-minicart.scss index 52723a8743d..2b513ce8a25 100644 --- a/skin/frontend/rwd/default/scss/module/_checkout-cart-minicart.scss +++ b/skin/frontend/rwd/default/scss/module/_checkout-cart-minicart.scss @@ -171,12 +171,6 @@ text-transform: uppercase; font-size: $f-size-s; } - - .paypal-logo { - .paypal-or { - line-height: 1.6; - } - } } #minicart-error-message { @@ -253,25 +247,6 @@ .checkout-types.minicart { li { display: inline-block; - - .paypal-logo { - > a { - display: inline; - } - - .bml_button { - display: inline-block; - vertical-align: top; - } - - .paypal-or { - width: auto; - float: none; - display: inline; - margin: 0 10px 5px 10px; - line-height: 40px; - } - } } } } @@ -287,23 +262,6 @@ text-align: center; width: 100%; } - - .checkout-types.minicart { - li { - .paypal-logo { - .paypal-or, - .paypal-button { - width: 100%; - display: block; - margin-left: 0; - } - - .paypal-or { - line-height: 1.6; - } - } - } - } } } } diff --git a/skin/frontend/rwd/default/scss/module/_checkout-cart.scss b/skin/frontend/rwd/default/scss/module/_checkout-cart.scss index b3f2565dcc4..beec358b589 100644 --- a/skin/frontend/rwd/default/scss/module/_checkout-cart.scss +++ b/skin/frontend/rwd/default/scss/module/_checkout-cart.scss @@ -167,42 +167,6 @@ li { display: inline-block; } - - .bml_button { - display: inline-block; - vertical-align: top; - - img { - display: block; - } - } - - .paypal-logo .paypal-or { - margin-top: 5px; - } - } - - &.bottom, - &.minicart { - .paypal-logo { - a { - display: block; - } - } - .paypal-or { - margin: 0px; - display: block; - text-align: center; - } - } -} - -@include bp(min-width, 741px) { - .checkout-types.bottom { - .paypal-or { - text-align: right; - padding-right: 70px; - } } } @@ -214,14 +178,6 @@ .checkout-types { float: none; text-align: center; - - &.bottom, - &.minicart { - .paypal-or { - width: auto; - float: none; - } - } } .checkout-types li { diff --git a/skin/frontend/rwd/default/scss/module/_checkout-onepage.scss b/skin/frontend/rwd/default/scss/module/_checkout-onepage.scss index 0fe85096b4f..7a21caeaf8b 100644 --- a/skin/frontend/rwd/default/scss/module/_checkout-onepage.scss +++ b/skin/frontend/rwd/default/scss/module/_checkout-onepage.scss @@ -180,15 +180,6 @@ } } -@include bp(max-width, $bp-xsmall) { - .opc, - .paypal-express-review { - .buttons-set .button + .buttons-set .button { - margin-left: 0; - } - } -} - .opc #opc-login { .step { padding: 0px; @@ -266,14 +257,6 @@ body:not(.opc-has-progressed-from-login) .opc.opc-firststep-login .section#opc-l dd li { margin: 5px 0; } - label img { // This applies to the Paypal Express label - float: left; - } - label a { // This applies to the Paypal Express label - margin-top: 6px; - float: right; - margin-left: 10px; - } .price { font-weight: bold; } diff --git a/skin/frontend/rwd/default/scss/module/_paypal.scss b/skin/frontend/rwd/default/scss/module/_paypal.scss deleted file mode 100644 index 8afb5922583..00000000000 --- a/skin/frontend/rwd/default/scss/module/_paypal.scss +++ /dev/null @@ -1,171 +0,0 @@ -// -// OpenMage -// -// This source file is subject to the Academic Free License (AFL 3.0) -// that is bundled with this package in the file LICENSE_AFL.txt. -// It is also available at https://opensource.org/license/afl-3-0-php -// -// @category design -// @package rwd_default -// @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com) -// @copyright Copyright (c) 2022 The OpenMage Contributors (https://www.openmage.org) -// @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -// - -/* ============================================ * - * PayPal - * ============================================ */ - -.paypal-review-order { - @include bp(max-width, $bp-medium + 100) { - @include bp(min-width, $bp-medium + 1) { - .col2-set { - .col-1, - .col-2 { - padding: 0px; - } - } - } - } - - .info-set { - margin-bottom: $gap; - padding-bottom: $gap; - border-bottom: 1px solid $c-fieldset-border-light; - } - - .buttons-set { - margin-top: 0px; - padding-top: 0px; - border: 0; - - button { - margin-bottom: $gap; - } - } - - @include bp(max-width, $bp-medium) { - .col-1 { - padding-bottom: 0; - } - - .field.inactive { - display: none; - } - } -} - - -.top-container .bml-ad { - margin-top: $element-spacing; - margin-bottom: $element-spacing; - text-align: center; - - span { - display: inline-block; - - a { - display: block; - } - } -} - -.bml-ad { - display: none; - text-align: center; - margin-bottom: 5px; - - span { - display: block; - line-height: 0; - } - a { - display: inline-block; - max-width: 100%; - } - a:hover { - opacity: 0.7; - } - img { - height: auto !important; // Override inline style - max-width: 100%; - } -} - -// Prevent small 2px space on right side of image -.cart-totals-wrapper .bml-ad.large img { - display: block; - margin: 0; -} - -@include bp(max-width, $bp-medium) { - .bml-ad.small { - display: block; - } -} - -@include bp(min-width, $bp-medium + 1) { - .bml-ad.large { - display: block; - } -} - -div.paypal-logo { - text-align: center; - margin: $trim-small 0; - max-width: 100%; - - span { - display: block; - width: 100%; - - a { - display: inline-block; - max-width: 100%; - - img { - max-width: 100%; - } - } - } - - span > img { - display: none; - } -} - -.checkout-types { - div.paypal-logo { - text-align: right; - } -} - -.bml-checkout-type { - list-style-type: none; -} - -.sidebar { - .paypal-logo { - text-align: center; - line-height: 0; - - > a { - display: inline-block; - max-width: 100%; - - &:hover { - opacity: 0.8; - } - img { - display: block; - } - } - .label { - margin-top: 4px; - a { - font-size: $f-size-xs; - line-height: 1.5; - } - } - } -} diff --git a/tests/unit/Traits/DataProvider/Base/ModulesTrait.php b/tests/unit/Traits/DataProvider/Base/ModulesTrait.php index 8f9f5661217..89130c15d9b 100644 --- a/tests/unit/Traits/DataProvider/Base/ModulesTrait.php +++ b/tests/unit/Traits/DataProvider/Base/ModulesTrait.php @@ -60,7 +60,6 @@ final public function provideAllModules(): array 'Mage_Paygate', 'Mage_Payment', 'Mage_Paypal', - 'Mage_PaypalUk', 'Mage_Persistent', 'Mage_ProductAlert', 'Mage_Rating', diff --git a/tests/unit/Traits/PhpStormMetaData/BlocksTrait.php b/tests/unit/Traits/PhpStormMetaData/BlocksTrait.php index 9ebe3228956..42428b80f17 100644 --- a/tests/unit/Traits/PhpStormMetaData/BlocksTrait.php +++ b/tests/unit/Traits/PhpStormMetaData/BlocksTrait.php @@ -1122,53 +1122,6 @@ public function getAllBlockClasses(): array 'payment/info_checkmo' => \Mage_Payment_Block_Info_Checkmo::class, 'payment/info_container' => \Mage_Payment_Block_Info_Container::class, 'payment/info_purchaseorder' => \Mage_Payment_Block_Info_Purchaseorder::class, - 'paypaluk/bml_form' => \Mage_PaypalUk_Block_Bml_Form::class, - 'paypaluk/express_form' => \Mage_PaypalUk_Block_Express_Form::class, - 'paypaluk/express_shortcut' => \Mage_PaypalUk_Block_Express_Shortcut::class, - 'paypal/adminhtml_settlement_details' => \Mage_Paypal_Block_Adminhtml_Settlement_Details::class, - 'paypal/adminhtml_settlement_details_form' => \Mage_Paypal_Block_Adminhtml_Settlement_Details_Form::class, - 'paypal/adminhtml_settlement_report' => \Mage_Paypal_Block_Adminhtml_Settlement_Report::class, - 'paypal/adminhtml_settlement_report_grid' => \Mage_Paypal_Block_Adminhtml_Settlement_Report_Grid::class, - 'paypal/adminhtml_system_config_apiWizard' => \Mage_Paypal_Block_Adminhtml_System_Config_ApiWizard::class, - 'paypal/adminhtml_system_config_bmlApiWizard' => \Mage_Paypal_Block_Adminhtml_System_Config_BmlApiWizard::class, - 'paypal/adminhtml_system_config_field_country' => \Mage_Paypal_Block_Adminhtml_System_Config_Field_Country::class, - 'paypal/adminhtml_system_config_field_hidden' => \Mage_Paypal_Block_Adminhtml_System_Config_Field_Hidden::class, - 'paypal/adminhtml_system_config_field_solutionType' => \Mage_Paypal_Block_Adminhtml_System_Config_Field_SolutionType::class, - 'paypal/adminhtml_system_config_fieldset_deprecated' => \Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Deprecated::class, - 'paypal/adminhtml_system_config_fieldset_expanded' => \Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Expanded::class, - 'paypal/adminhtml_system_config_fieldset_global' => \Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Global::class, - 'paypal/adminhtml_system_config_fieldset_group' => \Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Group::class, - 'paypal/adminhtml_system_config_fieldset_hint' => \Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Hint::class, - 'paypal/adminhtml_system_config_fieldset_location' => \Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Location::class, - 'paypal/adminhtml_system_config_fieldset_pathDependent' => \Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_PathDependent::class, - 'paypal/adminhtml_system_config_fieldset_payment' => \Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Payment::class, - 'paypal/adminhtml_system_config_fieldset_store' => \Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Store::class, - 'paypal/adminhtml_system_config_payflowlink_advanced' => \Mage_Paypal_Block_Adminhtml_System_Config_Payflowlink_Advanced::class, - 'paypal/adminhtml_system_config_payflowlink_info' => \Mage_Paypal_Block_Adminhtml_System_Config_Payflowlink_Info::class, - 'paypal/bml_banners' => \Mage_Paypal_Block_Bml_Banners::class, - 'paypal/bml_form' => \Mage_Paypal_Block_Bml_Form::class, - 'paypal/express_form' => \Mage_Paypal_Block_Express_Form::class, - 'paypal/express_review' => \Mage_Paypal_Block_Express_Review::class, - 'paypal/express_review_billing' => \Mage_Paypal_Block_Express_Review_Billing::class, - 'paypal/express_review_details' => \Mage_Paypal_Block_Express_Review_Details::class, - 'paypal/express_review_shipping' => \Mage_Paypal_Block_Express_Review_Shipping::class, - 'paypal/express_shortcut' => \Mage_Paypal_Block_Express_Shortcut::class, - 'paypal/hosted_pro_form' => \Mage_Paypal_Block_Hosted_Pro_Form::class, - 'paypal/hosted_pro_iframe' => \Mage_Paypal_Block_Hosted_Pro_Iframe::class, - 'paypal/hosted_pro_info' => \Mage_Paypal_Block_Hosted_Pro_Info::class, - 'paypal/iframe' => \Mage_Paypal_Block_Iframe::class, - 'paypal/logo' => \Mage_Paypal_Block_Logo::class, - 'paypal/payflow_advanced_form' => \Mage_Paypal_Block_Payflow_Advanced_Form::class, - 'paypal/payflow_advanced_iframe' => \Mage_Paypal_Block_Payflow_Advanced_Iframe::class, - 'paypal/payflow_advanced_info' => \Mage_Paypal_Block_Payflow_Advanced_Info::class, - 'paypal/payflow_advanced_review' => \Mage_Paypal_Block_Payflow_Advanced_Review::class, - 'paypal/payflow_link_form' => \Mage_Paypal_Block_Payflow_Link_Form::class, - 'paypal/payflow_link_iframe' => \Mage_Paypal_Block_Payflow_Link_Iframe::class, - 'paypal/payflow_link_info' => \Mage_Paypal_Block_Payflow_Link_Info::class, - 'paypal/payflow_link_review' => \Mage_Paypal_Block_Payflow_Link_Review::class, - 'paypal/payment_info' => \Mage_Paypal_Block_Payment_Info::class, - 'paypal/standard_form' => \Mage_Paypal_Block_Standard_Form::class, - 'paypal/standard_redirect' => \Mage_Paypal_Block_Standard_Redirect::class, 'persistent/form_remember' => \Mage_Persistent_Block_Form_Remember::class, 'persistent/header_additional' => \Mage_Persistent_Block_Header_Additional::class, 'productalert/email_abstract' => \Mage_ProductAlert_Block_Email_Abstract::class, @@ -1680,14 +1633,6 @@ public function getBlockClassesWithSessions(): array \Mage_Oauth_Block_Adminhtml_Oauth_Consumer_Edit::class, \Mage_Oauth_Block_Adminhtml_Oauth_Consumer_Grid::class, \Mage_Oauth_Block_Customer_Token_List::class, - \Mage_Paypal_Block_Adminhtml_Settlement_Details::class, - \Mage_Paypal_Block_Adminhtml_Settlement_Report::class, - \Mage_Paypal_Block_Express_Review_Billing::class, - \Mage_Paypal_Block_Express_Review_Shipping::class, - \Mage_Paypal_Block_Hosted_Pro_Iframe::class, - \Mage_Paypal_Block_Iframe::class, - \Mage_Paypal_Block_Payflow_Advanced_Iframe::class, - \Mage_Paypal_Block_Payflow_Link_Iframe::class, \Mage_Review_Block_Customer_List::class, \Mage_Review_Block_Customer_Recent::class, \Mage_Review_Block_Form::class,