From 6c0616b771a2ff031960686714f0ad7beb9a4887 Mon Sep 17 00:00:00 2001 From: "@ChristelLoftus" <christel@bob.co.za> Date: Tue, 13 Aug 2024 14:56:47 +0200 Subject: [PATCH] Remove company.php --- Model/Carrier/BobGo.php | 8 ++++---- Model/Carrier/Company.php | 39 --------------------------------------- 2 files changed, 4 insertions(+), 43 deletions(-) delete mode 100644 Model/Carrier/Company.php diff --git a/Model/Carrier/BobGo.php b/Model/Carrier/BobGo.php index 0af2cd8..97b6903 100644 --- a/Model/Carrier/BobGo.php +++ b/Model/Carrier/BobGo.php @@ -112,7 +112,7 @@ class BobGo extends AbstractCarrierOnline implements \Magento\Shipping\Model\Car */ protected JsonFactory $jsonFactory; private $cartRepository; - public Company $company; + public AdditionalInfo $additionalInfo; /** @@ -187,7 +187,7 @@ class BobGo extends AbstractCarrierOnline implements \Magento\Shipping\Model\Car ); $this->jsonFactory = $jsonFactory; $this->curl = $curlFactory->create(); - $this->company = new Company(); + $this->additionalInfo = new AdditionalInfo($countryFactory); } /* @@ -1004,14 +1004,14 @@ class BobGo extends AbstractCarrierOnline implements \Magento\Shipping\Model\Car */ public function getDestComp(): mixed { - return $this->company->getDestComp(); + return $this->additionalInfo->getDestComp(); } /** * @return mixed|string */ public function getDestSuburb(): mixed { - return $this->company->getSuburb(); + return $this->additionalInfo->getSuburb(); } /** diff --git a/Model/Carrier/Company.php b/Model/Carrier/Company.php deleted file mode 100644 index b554759..0000000 --- a/Model/Carrier/Company.php +++ /dev/null @@ -1,39 +0,0 @@ -<?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; - } -} -- GitLab