diff --git a/app/code/local/Voronoy/ExtraFee/Model/Observer.php b/app/code/local/Voronoy/ExtraFee/Model/Observer.php index 2c42e4b..27c3724 100644 --- a/app/code/local/Voronoy/ExtraFee/Model/Observer.php +++ b/app/code/local/Voronoy/ExtraFee/Model/Observer.php @@ -25,6 +25,7 @@ class Voronoy_ExtraFee_Model_Observer * Process Sales Rule Model Before Save * * @param $observer + * @return $this */ public function beforeSaveSalesRuleModel($observer) { @@ -45,6 +46,7 @@ public function beforeSaveSalesRuleModel($observer) * Prepare Form for Sales Rule * * @param $observer + * @return $this */ public function prepareFormSalesRuleEdit($observer) { @@ -76,4 +78,20 @@ public function prepareFormSalesRuleEdit($observer) Mage_SalesRule_Model_Rule::CART_FIXED_ACTION)) ); } + + /** + * PayPal prepare request + * + * @param $observer + */ + public function paypalPrepareLineItems($observer) + { + + /* @var $cart Mage_Paypal_Model_Cart */ + $cart = $observer->getEvent()->getPaypalCart(); + $address = $cart->getSalesEntity()->getIsVirtual() ? + $cart->getSalesEntity()->getBillingAddress() : $cart->getSalesEntity()->getShippingAddress(); + $feeAmount = $address->getExtraFeeRuleAmount(); + $cart->updateTotal(Mage_Paypal_Model_Cart::TOTAL_TAX, $feeAmount); + } } \ No newline at end of file diff --git a/app/code/local/Voronoy/ExtraFee/etc/config.xml b/app/code/local/Voronoy/ExtraFee/etc/config.xml index 46c890a..e65a8f5 100644 --- a/app/code/local/Voronoy/ExtraFee/etc/config.xml +++ b/app/code/local/Voronoy/ExtraFee/etc/config.xml @@ -119,12 +119,20 @@ - + voronoy_extrafee/observer prepareFormSalesRuleEdit - + + + + + voronoy_extrafee/observer + paypalPrepareLineItems + + +