/** * verify if the address has a shipping method, return the address' shipping method * */ public function testGetUsableMethodFromAddress() { $this->assertSame('carrier2_methodB', $this->shippingHelper->getUsableMethod(Mage::getModel('sales/quote_address', ['shipping_method' => 'carrier2_methodB']))); }
public function fillOutShippingItem(IOrderItem $itemPayload, Mage_Sales_Model_Quote_Item_Abstract $item, Mage_Customer_Model_Address_Abstract $address) { $shippingMethod = $this->shippingHelper->getUsableMethod($address); $itemPayload->setItemId($item->getSku())->setLineId($item->getAddressItemId() ?: $item->getId())->setQuantity($this->quantityHelper->getRequestedItemQuantity($item))->setGiftWrapRequested($this->isItemGiftWrapped($item))->setAddressLines($address->getStreet(static::ADDRESS_ALL_STREET_LINES))->setAddressCity($address->getCity())->setAddressCountryCode($address->getCountryId())->setShippingMethod($this->shippingHelper->getMethodSdkId($shippingMethod))->setAddressMainDivision($address->getRegionCode())->setAddressPostalCode($address->getPostcode())->setShippingMethodDisplayText($this->shippingHelper->getMethodTitle($shippingMethod)); }