diff --git a/Model/Carrier/AdditionalInfo.php b/Model/Carrier/AdditionalInfo.php index fff3c92920d53e977feaccbe27b64432d1f295a0..0b002a0ff7b8fdf82842f1adceef888dd8aaf052 100644 --- a/Model/Carrier/AdditionalInfo.php +++ b/Model/Carrier/AdditionalInfo.php @@ -77,47 +77,4 @@ class AdditionalInfo } return $countryName; } - -// // Method to get the per-package price -// protected function _getPerpackagePrice($cost, $handlingType, $handlingFee) -// { -// if ($handlingType == AbstractCarrier::HANDLING_TYPE_PERCENT) { -// return $cost + $cost * $this->_numBoxes * $handlingFee / self::UNITS; -// } -// return $cost + $this->_numBoxes * $handlingFee; -// } -// -// // Method to get the per-order price -// protected function _getPerorderPrice($cost, $handlingType, $handlingFee) -// { -// if ($handlingType == self::HANDLING_TYPE_PERCENT) { -// return $cost + $cost * $handlingFee / self::UNITS; -// } -// return $cost + $handlingFee; -// } -// -// // Method to get configuration data of the carrier -// public function getCode($type, $code = '') -// { -// $codes = [ -// 'method' => [ -// 'bobGo' => __('BobGo'), -// ], -// 'unit_of_measure' => [ -// 'KGS' => __('Kilograms'), -// 'LBS' => __('Pounds'), -// ], -// ]; -// if (!isset($codes[$type])) { -// return false; -// } elseif ('' === $code) { -// return $codes[$type]; -// } -// if (!isset($codes[$type][$code])) { -// return false; -// } else { -// return $codes[$type][$code]; -// } -// } - } diff --git a/Model/Carrier/Company.php b/Model/Carrier/Company.php new file mode 100644 index 0000000000000000000000000000000000000000..b5547595722df67b2535db561a06aad3c28b1918 --- /dev/null +++ b/Model/Carrier/Company.php @@ -0,0 +1,39 @@ +<?php + +namespace BobGroup\BobGo\Model\Carrier; + +/** + * Get the Company information from the request body and return it + */ +class Company +{ + + /** + * @return mixed|string + */ + public function getDestComp(): mixed + { + $data = json_decode(file_get_contents('php://input'), true); + + if (isset($data['address']['company'])) { + $destComp = $data['address']['company']; + } else { + $destComp = ''; + } + return $destComp; + } + + public function getSuburb(): mixed + { + + $data = json_decode(file_get_contents('php://input'), true); + + if (isset($data['address']['custom_attributes'][0]['value'])) { + $destSub = $data['address']['custom_attributes'][0]['value']; + //print_r($destSub); + } else { + $destSub = ''; + } + return $destSub; + } +}