Skip to content

Commit

Permalink
Merge pull request #4 from webshopapps/SHQ16-1859
Browse files Browse the repository at this point in the history
SHQ16-1859 allow extension of shipper mapper functions
  • Loading branch information
wsagen authored Jan 24, 2017
2 parents e15bd88 + 9c308ba commit 45fc8bf
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions src/Model/Carrier/Processor/ShipperMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ public function getShipperTranslation($magentoRequest)

// $this->setSessionStuffOnRequest($magentoRequest);
if($delDate = $this->getDeliveryDateUTC($magentoRequest)) {
$shipperHQRequest->setDeliveryDate(self::getDeliveryDate($magentoRequest));
$shipperHQRequest->setDeliveryDate($this->getDeliveryDate($magentoRequest));
$shipperHQRequest->setDeliveryDateUTC($delDate);
}

Expand Down Expand Up @@ -439,7 +439,7 @@ public function getCarrierId($request)
* @param bool $childItems
* @return array
*/
private function getFormattedItems($request, $magentoItems, $childItems = false)
public function getFormattedItems($request, $magentoItems, $childItems = false)
{
$formattedItems = [];
if (empty($magentoItems)) {
Expand Down Expand Up @@ -469,7 +469,7 @@ private function getFormattedItems($request, $magentoItems, $childItems = false)
$id = $magentoItem->getItemId() ? $magentoItem->getItemId() : $magentoItem->getQuoteItemId();
$productType = $magentoItem->getProductType() ? $magentoItem->getProductType() : $magentoItem->getProduct()->getTypeId();
$stdAttributes = array_merge($this->getDimensionalAttributes($magentoItem), self::$stdAttributeNames);
$options = self::populateCustomOptions($magentoItem);
$options = $this->populateCustomOptions($magentoItem);
$weight = $magentoItem->getWeight();
if(is_null($weight)) { //SHIPPERHQ-1855
if ($productType!= \Magento\Catalog\Model\Product\Type::TYPE_VIRTUAL &&
Expand Down Expand Up @@ -508,8 +508,8 @@ private function getFormattedItems($request, $magentoItems, $childItems = false)
'taxPercentage' => $taxPercentage,
'type' => $productType,
'items' => [], // child items
'attributes' => $options ? array_merge(self::populateAttributes($stdAttributes, $magentoItem), $options) : self::populateAttributes($stdAttributes, $magentoItem),
'additionalAttributes' => self::getCustomAttributes($magentoItem),
'attributes' => $options ? array_merge($this->populateAttributes($stdAttributes, $magentoItem), $options) : $this->populateAttributes($stdAttributes, $magentoItem),
'additionalAttributes' => $this->getCustomAttributes($magentoItem),
'warehouseDetails' => $warehouseDetails,
'pickupLocationDetails' => $pickupLocationDetails
]);
Expand All @@ -528,7 +528,7 @@ private function getFormattedItems($request, $magentoItems, $childItems = false)
return $formattedItems;
}

protected function getCustomerGroupId($items)
public function getCustomerGroupId($items)
{
if (count($items) > 0) {
return $items[0]->getQuote()->getCustomerGroupId();
Expand All @@ -542,11 +542,11 @@ protected function getCustomerGroupId($items)
* @param $request
* @return array
*/
private function getDestination($request)
public function getDestination($request)
{
$selectedOptions = $this->getSelectedOptions($request);

if (self::getCartType($request) == "CART") {
if ($this->getCartType($request) == "CART") {
// Don't pass in street for this scenario
$destination = $this->addressFactory->create([
'city' => $request->getDestCity(),
Expand All @@ -570,7 +570,7 @@ private function getDestination($request)
}


protected function getWarehouseDetails($item)
public function getWarehouseDetails($item)
{
$details = [];
$itemOriginsString = $item->getProduct()->getData(self::$origin);
Expand Down Expand Up @@ -604,7 +604,7 @@ protected function getWarehouseDetails($item)
return $details;
}

protected function getPickupLocationDetails($item)
public function getPickupLocationDetails($item)
{
$details = [];
$itemLocationsString = $item->getProduct()->getData(self::$location);
Expand Down Expand Up @@ -635,7 +635,7 @@ protected function getPickupLocationDetails($item)
return $details;
}

protected function getDefaultWarehouseStockDetail($item)
public function getDefaultWarehouseStockDetail($item)
{
$product = $item->getProduct();
$details = $this->stockDetailFactory->create([
Expand All @@ -650,7 +650,7 @@ protected function getDefaultWarehouseStockDetail($item)

}

protected function getDimensionalAttributes($item)
public function getDimensionalAttributes($item)
{
$attributes = [];
$product = $item->getProduct();
Expand All @@ -669,7 +669,7 @@ protected function getDimensionalAttributes($item)
* @param $item
* @return array
*/
protected function populateAttributes($reqdAttributeNames, $item)
public function populateAttributes($reqdAttributeNames, $item)
{
$attributes = [];
$product = $item->getProduct();
Expand Down Expand Up @@ -724,7 +724,7 @@ protected function populateAttributes($reqdAttributeNames, $item)
* @param $item
* @return array
*/
protected function populateCustomOptions($item)
public function populateCustomOptions($item)
{
$option_values = [];
$options = $this->productConfiguration->getCustomOptions($item);
Expand Down Expand Up @@ -753,7 +753,7 @@ protected function populateCustomOptions($item)
* @param $item
* @return array
*/
protected function getCustomAttributes($item)
public function getCustomAttributes($item)
{
$rawCustomAttributes = explode(',', $this->shipperDataHelper->getConfigValue('carriers/shipper/item_attributes'));
$customAttributes = [];
Expand All @@ -764,11 +764,11 @@ protected function getCustomAttributes($item)
}
}

return self::populateAttributes($customAttributes, $item);
return $this->populateAttributes($customAttributes, $item);

}

protected function getSelectedOptions($request)
public function getSelectedOptions($request)
{
$shippingOptions = $request->getSelectedOptions();
return $this->selectedOptionsFactory->create(['options' => $shippingOptions]);
Expand All @@ -779,7 +779,7 @@ protected function getSelectedOptions($request)
* @param $order
* @return mixed
*/
protected function getMagentoOrderNumber($order)
public function getMagentoOrderNumber($order)
{
return $order->getRealOrderId();

Expand Down

0 comments on commit 45fc8bf

Please sign in to comment.