From 674f9ee17c3efbc6b91a97b841e6d4f94e8e513b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Franc=C3=A9=20Wilke?= <francewilke@gmail.com>
Date: Wed, 14 Aug 2024 17:51:53 +0200
Subject: [PATCH] Some cleanup

---
 Model/Carrier/AdditionalInfo.php              |  1 -
 Model/Carrier/BobGo.php                       | 16 ++++-----
 Observer/ConfigChangeObserver.php             |  4 +--
 .../DataProviders/Tracking/ChangeTitle.php    |  2 +-
 composer.json                                 |  2 +-
 etc/adminhtml/system.xml                      | 33 ++-----------------
 etc/config.xml                                |  8 +----
 7 files changed, 14 insertions(+), 52 deletions(-)

diff --git a/Model/Carrier/AdditionalInfo.php b/Model/Carrier/AdditionalInfo.php
index 0b002a0..bf32069 100644
--- a/Model/Carrier/AdditionalInfo.php
+++ b/Model/Carrier/AdditionalInfo.php
@@ -30,7 +30,6 @@ class AdditionalInfo
 
         if (isset($data['address']['custom_attributes'][0]['value'])) {
             $destSub = $data['address']['custom_attributes'][0]['value'];
-            //print_r($destSub);
         } else {
             $destSub = '';
         }
diff --git a/Model/Carrier/BobGo.php b/Model/Carrier/BobGo.php
index 97f5576..faf7d2b 100644
--- a/Model/Carrier/BobGo.php
+++ b/Model/Carrier/BobGo.php
@@ -889,7 +889,6 @@ class BobGo extends AbstractCarrierOnline implements \Magento\Shipping\Model\Car
                 'activity' => $checkpoint['status'],
                 'deliverydate' => $this->formatDate($checkpoint['time']),
                 'deliverytime' => $this->formatTime($checkpoint['time']),
-                //  'deliverylocation' => 'Unavailable',//TODO: remove this line
             ];
         }
         return $result;
@@ -906,7 +905,6 @@ class BobGo extends AbstractCarrierOnline implements \Magento\Shipping\Model\Car
         $begin = strtotime($startDate);
         $end = strtotime($endDate);
         if ($begin > $end) {
-//            echo "Start Date Cannot Be In The Future! <br />";
             return 0;
         } else {
             $no_days = 0;
@@ -1082,14 +1080,14 @@ class BobGo extends AbstractCarrierOnline implements \Magento\Shipping\Model\Car
                 'identifier' => $this->getBaseUrl(),
                 'rate' => [
                     'origin' => [
-                        'company' => 'Test Store',
-                        'address1' => '123 Test St',
-                        'address2' => '',
-                        'city' => 'Test City',
-                        'suburb' => 'Test Suburb',
-                        'province' => 'Test Province',
+                        'company' => 'Jamie Ds Emporium',
+                        'address1' => '36 Marelu Street',
+                        'address2' => 'Six Fountains Estate',
+                        'city' => 'Pretoria',
+                        'suburb' => 'Pretoria',
+                        'province' => 'GT',
                         'country_code' => 'ZA',
-                        'postal_code' => '2000',
+                        'postal_code' => '0081',
                     ],
                     'destination' => [
                         'company' => 'Test Company',
diff --git a/Observer/ConfigChangeObserver.php b/Observer/ConfigChangeObserver.php
index e3dad60..b72cb26 100644
--- a/Observer/ConfigChangeObserver.php
+++ b/Observer/ConfigChangeObserver.php
@@ -34,9 +34,9 @@ class ConfigChangeObserver implements ObserverInterface
                 $result = $this->bobGo->triggerRatesTest();
 
                 if ($result !== false) {
-                    $this->messageManager->addSuccessMessage(__('Bob Go rates at checkout test is successful.'));
+                    $this->messageManager->addSuccessMessage(__('Bob Go rates at checkout connected.'));
                 } else {
-                    $this->messageManager->addErrorMessage(__('Bob Go rates at checkout test failed. Please visit https://www.bobgo.co.za/ and enable this channel for rates at checkout.'));
+                    $this->messageManager->addErrorMessage(__('Failed to connect to rates at checkout. Please check your internet connection and make sure Rates at checkout is enabled for your channel on Bob Go. Please visit <a href="https://my.bobgo.co.za/rates-at-checkout?tab=settings" target="_new">Bob Go</a> and make sure your WooCommerce channel is enabled to receive rates.'));
                 }
             }
         }
diff --git a/Plugin/Block/DataProviders/Tracking/ChangeTitle.php b/Plugin/Block/DataProviders/Tracking/ChangeTitle.php
index 03d6b4c..36eebbc 100644
--- a/Plugin/Block/DataProviders/Tracking/ChangeTitle.php
+++ b/Plugin/Block/DataProviders/Tracking/ChangeTitle.php
@@ -25,7 +25,7 @@ class ChangeTitle
     public function afterGetTitle(Subject $subject, $result, Status $trackingStatus)
     {
         if ($trackingStatus->getCarrier() === Carrier::CODE) {
-            $result = __('Expected Delivery:');
+            $result = __('Expected delivery:');
         }
         return $result;
     }
diff --git a/composer.json b/composer.json
index b7c15e0..c78f4cf 100644
--- a/composer.json
+++ b/composer.json
@@ -1,6 +1,6 @@
 {
   "name": "bobgo/bobgo",
-  "description": "Streamline your shipments fulfillment's with Bob Go",
+  "description": "Smart shipping and order management solution in South Africa",
   "type": "magento2-module",
   "version": "1.0.0",
   "authors": [
diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml
index 29ad3d7..7180e38 100644
--- a/etc/adminhtml/system.xml
+++ b/etc/adminhtml/system.xml
@@ -19,43 +19,14 @@
                     <frontend_model>BobGroup\BobGo\Block\System\Config\Form\Field\Version</frontend_model>
                 </field>
                 <field id="active" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0">
-                    <label>Show rates for checkout</label>
+                    <label>Enable Bob Go rates at checkout</label>
                     <comment>When this setting is enabled, your customers will be presented with shipping rates at checkout, as configured on the Bob Go platform under Rates at checkout.</comment>
                     <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                 </field>
                 <field id="additional_info" translate="label" type="select" sortOrder="7" showInDefault="1" showInWebsite="1">
                     <label>Show additional rate information</label>
                     <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
-                    <comment>Displays the delivery timeframe and additional service level description as configured on Bob Go.</comment>
-                </field>
-
-                <!--                Hiding these fields (specificerrmsg, sallowspecific, specificcountry, showmethod, unit_of_measure, max_package_weight) from the admin protal-->
-                <field id="specificerrmsg" translate="label" type="textarea" sortOrder="80" showInDefault="0" showInWebsite="0" showInStore="0">
-                    <label>Displayed Error Message</label>
-                    <comment>We could not find any shipping rates for your delivery address. Please make sure your address is correct. If you are experiencing problems, please contact BobGo (support@bobgo.co.za).</comment>
-                </field>
-                <field id="sallowspecific" translate="label" type="select" sortOrder="90" showInDefault="0" showInWebsite="0" showInStore="0">
-                    <label>Ship to Applicable Countries</label>
-                    <frontend_class>shipping-applicable-country</frontend_class>
-                    <source_model>Magento\Shipping\Model\Config\Source\Allspecificcountries</source_model>
-                </field>
-                <field id="specificcountry" translate="label" type="multiselect" sortOrder="91" showInDefault="0" showInWebsite="0" showInStore="0">
-                    <label>Ship to Specific Countries</label>
-                    <source_model>Magento\Directory\Model\Config\Source\Country</source_model>
-                    <can_be_empty>1</can_be_empty>
-                </field>
-                <field id="showmethod" translate="label" type="select" sortOrder="92" showInDefault="0" showInWebsite="0" showInStore="0">
-                    <label>Show Method if Not Applicable</label>
-                    <frontend_class>shipping-skip-hide</frontend_class>
-                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
-                </field>
-                <field id="unit_of_measure" translate="label" type="select" sortOrder="73" showInDefault="0" showInWebsite="0">
-                    <label>Weight Unit</label>
-                    <source_model>BobGroup\BobGo\Model\Source\Unitofmeasure</source_model>
-                </field>
-                <field id="max_package_weight" translate="label" type="text" sortOrder="90" showInDefault="0" showInWebsite="0">
-                    <label>Maximum Package Weight (Please consult your shipping carrier for maximum supported shipping weight)</label>
-                    <validate>validate-number validate-zero-or-greater</validate>
+                    <comment>Displays the delivery timeframe and additional service level description, as configured on Bob Go.</comment>
                 </field>
             </group>
         </section>
diff --git a/etc/config.xml b/etc/config.xml
index 9e4c986..8630ff6 100644
--- a/etc/config.xml
+++ b/etc/config.xml
@@ -1,18 +1,12 @@
 <?xml version="1.0"?>
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
     <default>
-        <BobGroup_BobGo>
-            <general>
-                <debug>0</debug>
-            </general>
-        </BobGroup_BobGo>
-
         <carriers>
             <bobgo>
                 <active>1</active>
                 <price>0.00</price>
                 <model>BobGroup\BobGo\Model\Carrier\BobGo</model>
-                <name>Fixed</name>
+                <name>Bob Go</name>
                 <title>Bob Go</title>
             </bobgo>
         </carriers>
-- 
GitLab