/**
  * add the sku for the chosen gift wrapping
  * @param  IGifting
  * @param  Varien_Object
  * @return self
  */
 protected function _addGiftWrapItem(IGifting $giftingPayload, Varien_Object $giftingItem)
 {
     $giftWrapId = $giftingItem->getGwId();
     if ($giftWrapId) {
         $giftwrap = Mage::getModel('enterprise_giftwrapping/wrapping')->load($giftWrapId);
         $giftingPayload->setGiftItemId($giftwrap->getEb2cSku())->setIncludeGiftWrapping(true);
         $this->_getPriceGroup($giftingPayload)->setTaxClass($giftwrap->getEb2cTaxClass());
     }
     return $this;
 }
 /**
  * Trasfer data from an "item" with gifting options to a Gifting payload.
  * The "item" may be a quote item or quote address, as either may have
  * gift options data, retrievable in the same way.
  *
  * @param Varien_Object
  * @param IGfiting
  * @return IGifting
  */
 public function giftingItemToGiftingPayload(Varien_Object $giftItem, IGifting $giftingPayload)
 {
     $giftPricing = $giftingPayload->getEmptyGiftPriceGroup();
     $giftWrap = Mage::getModel('enterprise_giftwrapping/wrapping')->load($giftItem->getGwId());
     if ($giftWrap->getId()) {
         // For quote items (which will have a quantity), gift wrapping price
         // on the item will be the price for a single item to be wrapped,
         // total will be for cost for all items to be wrapped (qty * amount).
         // For addresses (which will have no quantity), gift wrapping price
         // on the address will be the price for wrapping all items for that
         // address, so total is just amount (1 * amount).
         $giftQty = $giftItem->getQty() ?: 1;
         // Add pricing data for gift wrapping - does not include discounts
         // as Magento does not support applying discounts to gift wrapping
         // out-of-the-box.
         $giftPricing->setUnitPrice($giftWrap->getBasePrice())->setAmount($giftItem->getGwPrice() * $giftQty)->setTaxClass($giftWrap->getEb2cTaxClass());
         $giftingPayload->setGiftItemId($giftWrap->getEb2cSku())->setGiftDescription($giftWrap->getDesign())->setGiftPricing($giftPricing);
     }
     return $giftingPayload;
 }