/** * Create a new mailing address destination from a magento order address. * * @param Mage_Customer_Model_Address_Abstract * @param IOrderDestinationIterable Used to create the new email address destination payload * @return IEmailAddressDestination */ protected function _buildVirtualDestination(Mage_Customer_Model_Address_Abstract $address, IOrderDestinationIterable $destinations) { $destination = $destinations->getEmptyEmailAddress(); return $this->_transferPersonNameData($address, $destination)->setEmailAddress($address->getEmail()); }
/** * Create an email address destination for the virtual gift card, using the * gift card recipient information for the destination data. * * @param EbayEnterprise_Order_Model_Create_Itemreferencepair * @param IShipGroupIterable * @param IOrderDestinationIterable * @return IShipGroup */ protected function createShipGroupForVirtualGiftCard(EbayEnterprise_Order_Model_Create_Itemreferencepair $itemRefPair, IShipGroupIterable $shipGroups, IOrderDestinationIterable $destinations) { $orderItem = $itemRefPair->getItem(); $itemRefPayload = $itemRefPair->getPayload(); $shipGroupPayload = $shipGroups->getEmptyShipGroup(); $destination = $destinations->getEmptyEmailAddress(); $destination->setEmailAddress($orderItem->getBuyRequest()->getGiftcardRecipientEmail()); $shipGroupPayload->getItemReferences()->offsetSet($itemRefPayload); $shipGroupPayload->setDestination($destination)->setChargeType(EbayEnterprise_Order_Model_Create::SHIPPING_CHARGE_TYPE_FLATRATE); // As each virtual gift card will be in its own ship group, it likely needs // its own shipping price group for the OMS, even though the "shipping" cost is 0. // Add a new price groups for shipping with amount of 0.00 so the item & // ship group will have one. $itemPayload = $itemRefPayload->getReferencedItem(); $itemPayload->setShippingPricing($itemPayload->getEmptyPriceGroup()->setAmount(0.0)); $this->logger->debug('Created ship group for virtual gift card', $this->logContext->getMetaData(__CLASS__, ['email' => $destination->getEmailAddress(), 'sku' => $orderItem->getSku(), 'line_number' => $orderItem->getLineNumber()])); return $shipGroupPayload; }