diff --git a/Block/System/Config/Form/Field/Version.php b/Block/System/Config/Form/Field/Version.php index 50339f7674680e692c6dc7abce4406438a2c5328..964f53cfe5cfdc52a4de73baf68d88fe3cb38f1c 100644 --- a/Block/System/Config/Form/Field/Version.php +++ b/Block/System/Config/Form/Field/Version.php @@ -1,11 +1,12 @@ <?php -namespace bobgo\Customshipping\Block\System\Config\Form\Field; +namespace bobgo\CustomShipping\Block\System\Config\Form\Field; use Magento\Framework\Data\Form\Element\AbstractElement; /** + * Displays Version number in System Configuration * @category BobGroup - * @package bobgo_Customshipping + * @package bobgo_CustomShipping * @author info@bob.co.za * @website https://www.bob.co.za */ @@ -14,17 +15,17 @@ class Version extends \Magento\Config\Block\System\Config\Form\Field const EXTENSION_URL = 'https://www.bob.co.za'; /** - * @var \bobgo\Customshipping\Helper\Data $helper + * @var \bobgo\CustomShipping\Helper\Data $helper */ protected $_helper; /** * @param \Magento\Backend\Block\Template\Context $context - * @param \bobgo\Customshipping\Helper\Data $helper + * @param \bobgo\CustomShipping\Helper\Data $helper */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \bobgo\Customshipping\Helper\Data $helper + \bobgo\CustomShipping\Helper\Data $helper ) { $this->_helper = $helper; parent::__construct($context); diff --git a/Helper/Data.php b/Helper/Data.php index f1f28ca67887520fd7fcc80c5eb20d677ef1b52a..f1da9bdf1359370d934f38be1c520e0ac1786a00 100644 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -1,5 +1,5 @@ <?php -namespace bobgo\Customshipping\Helper; +namespace bobgo\CustomShipping\Helper; use Magento\Framework\App\Helper\AbstractHelper; use Magento\Framework\App\Helper\Context; @@ -8,15 +8,15 @@ use Magento\Store\Model\ScopeInterface; /** * @category bobgo - * @package bobgo_Customshipping + * @package bobgo_CustomShipping * @author bobgo * @website https://www.bob.co.za */ class Data extends AbstractHelper { - const XML_PATH_ENABLED = 'bobgo_Customshipping/general/enabled'; - const XML_PATH_DEBUG = 'bobgo_Customshipping/general/debug'; + const XML_PATH_ENABLED = 'bobgo_CustomShipping/general/enabled'; + const XML_PATH_DEBUG = 'bobgo_CustomShipping/general/debug'; /** * @var \Psr\Log\LoggerInterface @@ -65,7 +65,7 @@ class Data extends AbstractHelper public function getExtensionVersion() { - $moduleCode = 'bobgo_Customshipping'; + $moduleCode = 'bobgo_CustomShipping'; $moduleInfo = $this->_moduleList->getOne($moduleCode); return $moduleInfo['setup_version']; } diff --git a/Model/Carrier/Company.php b/Model/Carrier/Company.php index 40c2f5b669d6dc3d4bd03a84250a966c4c8a4d95..c0d6a932df2aa37fdcaef03a53b0cceea8adb38d 100644 --- a/Model/Carrier/Company.php +++ b/Model/Carrier/Company.php @@ -1,7 +1,10 @@ <?php -namespace bobgo\Customshipping\Model\Carrier; +namespace bobgo\CustomShipping\Model\Carrier; +/** + * Get the Company information from the request body and return it + */ class Company { diff --git a/Model/Carrier/Customshipping.php b/Model/Carrier/CustomShipping.php similarity index 98% rename from Model/Carrier/Customshipping.php rename to Model/Carrier/CustomShipping.php index 0e2566673b14cc00ca795955d75fa4a5f55d2c16..679a0a4a89be41f6828d2f137ec70dc56eb8fa93 100644 --- a/Model/Carrier/Customshipping.php +++ b/Model/Carrier/CustomShipping.php @@ -1,7 +1,7 @@ <?php declare(strict_types=1); -namespace bobgo\Customshipping\Model\Carrier; +namespace bobgo\CustomShipping\Model\Carrier; use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory; use Magento\CatalogInventory\Api\StockRegistryInterface; @@ -33,14 +33,14 @@ use Psr\Log\LoggerInterface; /** * bobgo shipping implementation * @category bob - * @package bobgo_Customshipping + * @package bobgo_CustomShipping * @author info@bob.co.za * @website https://www.bob.co.za * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.TooManyFields) */ -class Customshipping extends AbstractCarrierOnline implements \Magento\Shipping\Model\Carrier\CarrierInterface +class CustomShipping extends AbstractCarrierOnline implements \Magento\Shipping\Model\Carrier\CarrierInterface { /** * Code of the carrier @@ -73,12 +73,6 @@ class Customshipping extends AbstractCarrierOnline implements \Magento\Shipping\ */ protected $_result = null; - /** - * Container types that could be customized for bobgo carrier - * - * @var string[] - */ - protected $_customizableContainerTypes = ['YOUR_PACKAGING']; /** * @var \Magento\Store\Model\StoreManagerInterface @@ -701,7 +695,7 @@ class Customshipping extends AbstractCarrierOnline implements \Magento\Shipping\ } /** - * Perfom API Request to bobgo API and return response + * Perform API Request to bobgo API and return response * @param array $payload * @param Result $result * @return void diff --git a/Model/Carrier/uData.php b/Model/Carrier/uData.php index 51b4feadc451a969f9e1499e97468ad1b2c5722c..476e9a1f4c22960f2de0a9fada874143a2c49863 100644 --- a/Model/Carrier/uData.php +++ b/Model/Carrier/uData.php @@ -1,11 +1,11 @@ <?php -namespace bobgo\Customshipping\Model\Carrier; +namespace bobgo\CustomShipping\Model\Carrier; /** * Class uData - * bobGo API Resources - * @package bobgo\Customshipping\Model\Carrier + * bobGo API Resources for Custom Shipping + * @package bobgo\CustomShipping\Model\Carrier */ class uData { diff --git a/Model/Carrier/uSub.php b/Model/Carrier/uSub.php index fd3e3cef4fe4f202f969689bf843e16635ddd7ba..96ae4747c1b928eefd2843b4d711fdc468c4e9bc 100644 --- a/Model/Carrier/uSub.php +++ b/Model/Carrier/uSub.php @@ -1,6 +1,6 @@ <?php -namespace bobgo\Customshipping\Model\Carrier; +namespace bobgo\CustomShipping\Model\Carrier; use Magento\Checkout\Api\Data\ShippingInformationInterface; use Magento\Framework\App\ObjectManager; use Magento\Framework\Exception\NoSuchEntityException; @@ -11,6 +11,8 @@ class uSub { /** + * This is supposed to get the suburb from the shipping address extension attributes. + * Does not work for now, was supposed to access the suburb attribute from the shipping address extension attributes. * @throws NoSuchEntityException */ public function getDestSuburb() diff --git a/Model/Source/Dropoff.php b/Model/Source/Dropoff.php index ebfed2edd7da9034b96127d2b9dac9ccddacce96..e2705573bef8e747fc4a8759cbeb78165e5f743a 100644 --- a/Model/Source/Dropoff.php +++ b/Model/Source/Dropoff.php @@ -1,6 +1,6 @@ <?php -namespace bobgo\Customshipping\Model\Source; +namespace bobgo\CustomShipping\Model\Source; class Dropoff extends Generic { diff --git a/Model/Source/Freemethod.php b/Model/Source/Freemethod.php index 1687ac64d09dac94fe312899a498b5cd1a8d8fb6..2ea09d3a96a72e394c04c4e72190481cdd8fd4b6 100644 --- a/Model/Source/Freemethod.php +++ b/Model/Source/Freemethod.php @@ -1,6 +1,6 @@ <?php -namespace bobgo\Customshipping\Model\Source; +namespace bobgo\CustomShipping\Model\Source; /** * bobgo Free Method source implementation diff --git a/Model/Source/Generic.php b/Model/Source/Generic.php index f22455290855c7372fdfbc06b4814c2ed9c69e89..214e8eb4d02e8d6f437d37244172ffd589362ee9 100644 --- a/Model/Source/Generic.php +++ b/Model/Source/Generic.php @@ -1,10 +1,10 @@ <?php -namespace bobgo\Customshipping\Model\Source; +namespace bobgo\CustomShipping\Model\Source; use Magento\Framework\Data\OptionSourceInterface; -use bobgo\Customshipping\Model\Carrier\Customshipping; +use bobgo\CustomShipping\Model\Carrier\CustomShipping; /** * bobgo generic source implementation @@ -12,9 +12,9 @@ use bobgo\Customshipping\Model\Carrier\Customshipping; class Generic implements OptionSourceInterface { /** - * @var Customshipping + * @var CustomShipping */ - protected Customshipping $_shippingCustomshipping; + protected CustomShipping $_shippingCustomShipping; /** * Carrier code @@ -23,11 +23,11 @@ class Generic implements OptionSourceInterface protected string $_code = ''; /** - * @param Customshipping $shippingCustomshipping + * @param CustomShipping $shippingCustomShipping */ - public function __construct(Customshipping $shippingCustomshipping) + public function __construct(CustomShipping $shippingCustomShipping) { - $this->_shippingCustomshipping = $shippingCustomshipping; + $this->_shippingCustomShipping = $shippingCustomShipping; } /** @@ -36,7 +36,7 @@ class Generic implements OptionSourceInterface */ public function toOptionArray() { - $configData = $this->_shippingCustomshipping->getCode($this->_code); + $configData = $this->_shippingCustomShipping->getCode($this->_code); $arr = []; if ($configData) { $arr = array_map( diff --git a/Model/Source/Method.php b/Model/Source/Method.php index c7ca37c8a3bd12db5b489f32cd151281a9ceb19e..6ff23503c0c8b273df38b0abfbc5dcee3b1e4f79 100644 --- a/Model/Source/Method.php +++ b/Model/Source/Method.php @@ -1,6 +1,6 @@ <?php -namespace bobgo\Customshipping\Model\Source; +namespace bobgo\CustomShipping\Model\Source; class Method extends Generic { diff --git a/Model/Source/Packaging.php b/Model/Source/Packaging.php index 43f90a96069a4da3ec368601efd80ae39bad618b..5c93ad376f2c01564da7593149e89cc783dcc06f 100644 --- a/Model/Source/Packaging.php +++ b/Model/Source/Packaging.php @@ -1,6 +1,6 @@ <?php -namespace bobgo\Customshipping\Model\Source; +namespace bobgo\CustomShipping\Model\Source; class Packaging extends Generic { diff --git a/Model/Source/Unitofmeasure.php b/Model/Source/Unitofmeasure.php index 2d5fad6cf81cc46eaabb18e47b458f96d566b80f..8ef12cdb8b4a84d1ae7a59b5c8a366a1e6d54e69 100644 --- a/Model/Source/Unitofmeasure.php +++ b/Model/Source/Unitofmeasure.php @@ -1,6 +1,6 @@ <?php -namespace bobgo\Customshipping\Model\Source; +namespace bobgo\CustomShipping\Model\Source; class Unitofmeasure extends Generic { diff --git a/Observer/SaveOrderBeforeSalesModelQuote.php b/Observer/SaveOrderBeforeSalesModelQuote.php index f3cdd8e942077e94408187016749d981e0e7076c..25cc18a5477f0a750453cda6716d5ff348e898a8 100644 --- a/Observer/SaveOrderBeforeSalesModelQuote.php +++ b/Observer/SaveOrderBeforeSalesModelQuote.php @@ -1,6 +1,6 @@ <?php -namespace bobgo\Customshipping\Observer; +namespace bobgo\CustomShipping\Observer; use Magento\Framework\DataObject\Copy; use Magento\Framework\Event\Observer; @@ -8,6 +8,11 @@ use Magento\Framework\Event\ObserverInterface; use Magento\Quote\Model\Quote; use Magento\Sales\Model\Order; +/** + * Class SaveOrderBeforeSalesModelQuote + * @package bobgo\CustomShipping\Observer + * This class is supposed to copy the suburb attribute from the quote to the order object. + */ class SaveOrderBeforeSalesModelQuote implements ObserverInterface { public Copy $objectCopyService; diff --git a/Plugin/Block/DataProviders/Tracking/ChangeTitle.php b/Plugin/Block/DataProviders/Tracking/ChangeTitle.php index 21e7fd5b5b309f0e781178c4ab17d5a8255e003e..05d108bb12603f8182fcb9a0d72bc40b749fc1b9 100644 --- a/Plugin/Block/DataProviders/Tracking/ChangeTitle.php +++ b/Plugin/Block/DataProviders/Tracking/ChangeTitle.php @@ -1,8 +1,8 @@ <?php -namespace bobgo\Customshipping\Plugin\Block\DataProviders\Tracking; +namespace bobgo\CustomShipping\Plugin\Block\DataProviders\Tracking; -use bobgo\Customshipping\Model\Carrier; +use bobgo\CustomShipping\Model\Carrier; use Magento\Shipping\Model\Tracking\Result\Status; use Magento\Shipping\Block\DataProviders\Tracking\DeliveryDateTitle as Subject; diff --git a/Plugin/Block/Tracking/PopUpDeliveryDate.php b/Plugin/Block/Tracking/PopUpDeliveryDate.php index 3d813732a47c68901da1caba4d2def8b1d6f9b45..87b61372a07c89c61ca22fad16d3a5db86032bcd 100644 --- a/Plugin/Block/Tracking/PopUpDeliveryDate.php +++ b/Plugin/Block/Tracking/PopUpDeliveryDate.php @@ -1,6 +1,6 @@ <?php -namespace bobgo\Customshipping\Plugin\Block\Tracking; +namespace bobgo\CustomShipping\Plugin\Block\Tracking; use Magento\Shipping\Block\Tracking\Popup; use Magento\Shipping\Model\Tracking\Result\Status; diff --git a/Plugin/Checkout/Block/LayoutProcessorPlugin.php b/Plugin/Checkout/Block/LayoutProcessorPlugin.php index 2fdf43f9251fc2908abb0e6c7987577b3d55bf23..6eb562667b50c5df05d1d4a05ef5337f4b29387c 100644 --- a/Plugin/Checkout/Block/LayoutProcessorPlugin.php +++ b/Plugin/Checkout/Block/LayoutProcessorPlugin.php @@ -1,20 +1,17 @@ <?php -namespace bobgo\Customshipping\Plugin\Checkout\Block; +namespace bobgo\CustomShipping\Plugin\Checkout\Block; use Magento\Checkout\Block\Checkout\LayoutProcessor; +/** + * Class LayoutProcessorPlugin + * @package bobgo\CustomShipping\Plugin\Checkout\Block + * This class is supposed to add a new field to the checkout page for the suburb. It is supposed to be used in conjunction with the SaveOrderBeforeSalesModelQuote observer. + * At the moment, it overrides the 2 Address fields and adds a new 3 Address field to accommodate the suburb on the checkout page( including placeholders). + * This is not the best way to do it, but it is the only way I could get it to work. + */ class LayoutProcessorPlugin { -// /** -// * This is the Class That Allows The Field To Appear As Required On Checkout, -// * But It Does Not Save The Data To The Quote Table In The Database For The Order -// * To Be Processed Correctly In The Backend And Frontend It Works With Shipping -// * Information Management Class -// * @param LayoutProcessor $subject -// * @param array $jsLayout -// * @return array -// */ - /** * @param \Magento\Checkout\Block\Checkout\LayoutProcessor $subject * @param array $jsLayout diff --git a/Plugin/ShippingInformationManagement.php b/Plugin/ShippingInformationManagement.php index f19b720feb8dab3ef2827eeff498a36c55ea7531..107f90be40122e915d33ec36a4773c26887e1824 100644 --- a/Plugin/ShippingInformationManagement.php +++ b/Plugin/ShippingInformationManagement.php @@ -1,11 +1,16 @@ <?php -namespace bobgo\Customshipping\Plugin; +namespace bobgo\CustomShipping\Plugin; use Magento\Quote\Api\CartRepositoryInterface; use Magento\Checkout\Api\Data\ShippingInformationInterface; +/** + * Class ShippingInformationManagement + * @package bobgo\CustomShipping\Plugin + * This class is supposed to copy the suburb attribute from the quote to the order object. + */ class ShippingInformationManagement { public CartRepositoryInterface $cartRepository; @@ -17,7 +22,7 @@ class ShippingInformationManagement $this->cartRepository = $cartRepository; } - public function beforeSaveAddressInformation($subject, $cartId, ShippingInformationInterface $addressInformation) + public function beforeSaveAddressInformation($subject, $cartId, ShippingInformationInterface $addressInformation): array { $quote = $this->cartRepository->getActive($cartId); $deliveryNote = $addressInformation->getShippingAddress()->getExtensionAttributes()->getSuburb(); diff --git a/Readme.md b/Readme.md index e5100a761c642369b324ac3830dcf37748480c7e..c157860761a1071e29e6ce76907d3e857a5ae810 100644 --- a/Readme.md +++ b/Readme.md @@ -23,12 +23,12 @@ Run the following command in Magento 2 root folder:</br> #### 1. Execute the following command to install the module: ``` -composer require bobgo/customshipping +composer require bobgo/CustomShipping ``` #### 2. Enter following commands to enable the module: ``` -bin/magento module:enable bobgo_Customshipping +bin/magento module:enable bobgo_CustomShipping bin/magento cache:clean bin/magento cache:flush bin/magento setup:upgrade @@ -45,16 +45,16 @@ bin/magento setup:static-content:deploy 2. Unzip the file and copy contents -3. Create `bobgo/Customshipping` <em>Directory</em> +3. Create `bobgo/CustomShipping` <em>Directory</em> **It should look like this:** </br> ->{Magento root}/app/code/bobgo/Customshipping/ +>{Magento root}/app/code/bobgo/CustomShipping/ ->**{Magento root}**`/app/code/bobgo/Customshipping/`**{Paste here}** +>**{Magento root}**`/app/code/bobgo/CustomShipping/`**{Paste here}** -3. Go to Magento root folder and run all commands below to install `bobgo_Customshipping`: </br> +3. Go to Magento root folder and run all commands below to install `bobgo_CustomShipping`: </br> ``` bin/magento cache:clean Bin/magento cache:flush diff --git a/composer.json b/composer.json index bd2a1d95264e21da9c6cf29dfdf1b7daee09fffd..d817decda90ccb35b62a7d9d1a542d42ea8fe6f4 100644 --- a/composer.json +++ b/composer.json @@ -1,12 +1,12 @@ { "name": "bobgo/bobgo", - "description": "Streamline your shipments fulfillments with bobgo", + "description": "Streamline your shipments fulfillment's with bobgo", "type": "magento2-module", "version": "1.0.0", "authors": [ { - "name": "Gundo", - "email": "gundo@bob.co.za", + "name": "Bob Go", + "email": "info@bob.co.za", "homepage": "https://www.bob.co.za" } ], @@ -19,7 +19,7 @@ "registration.php" ], "psr-4": { - "bobgo\\Customshipping\\": "" + "bobgo\\CustomShipping\\": "" } } } diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index dd2c48d4d059a8b62648c3210292782dbc7e86bb..84025e6eeeb55c581cb08ccf469b8461e5612bc8 100644 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -2,7 +2,7 @@ <!-- /** * @category bobgo - * @package bobgo_Customshipping + * @package bobgo_CustomShipping * @author bobgo */ --> @@ -10,17 +10,17 @@ <system> <tab id="bobgo" translate="label" sortOrder="200"> - <label>bobgo</label> + <label>Bob Go</label> </tab> - <section id="bobgo_Customshipping" showInDefault="1"> - <tab>bobgo</tab> - <label>bobGo</label> + <section id="bobgo_CustomShipping" showInDefault="1"> + <tab>BobGo</tab> + <label>Bob Go</label> <resource>Magento_Config::config</resource> <group id="general" showInDefault="1"> <label>General Settings</label> <field id="version" translate="label" type="label" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0"> <label>Version</label> - <frontend_model>bobgo\Customshipping\Block\System\Config\Form\Field\Version</frontend_model> + <frontend_model>bobgo\CustomShipping\Block\System\Config\Form\Field\Version</frontend_model> </field> <field id="enabled" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Enabled for Checkout</label> @@ -46,7 +46,7 @@ <field id="version" translate="label" type="label" sortOrder="0" showInDefault="1" showInWebsite="0" showInStore="0"> <label>Version</label> - <frontend_model>bobgo\Customshipping\Block\System\Config\Form\Field\Version</frontend_model> + <frontend_model>bobgo\CustomShipping\Block\System\Config\Form\Field\Version</frontend_model> </field> <field id="active" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0"> @@ -86,7 +86,7 @@ </field> <field id="unit_of_measure" translate="label" type="select" sortOrder="73" showInDefault="1" showInWebsite="1" canRestore="1"> <label>Weight Unit</label> - <source_model>bobgo\Customshipping\Model\Source\Unitofmeasure</source_model> + <source_model>bobgo\CustomShipping\Model\Source\Unitofmeasure</source_model> </field> <field id="additional_info" translate="label" type="select" sortOrder="7" showInDefault="1" showInWebsite="1"> <label>Display Additional Information</label> diff --git a/etc/config.xml b/etc/config.xml index 9cf20c6dfe2a5977a39683d2b25fdca49b8a3068..aa8f79dfde17814e8deff10dd15e1a395b4a4f7a 100644 --- a/etc/config.xml +++ b/etc/config.xml @@ -2,26 +2,26 @@ <!-- /** * @category bobgo - * @package bobgo_customshipping + * @package bobgo_CustomShipping * @author bobgo */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd"> <default> - <bobgo_customshipping> + <bobgo_CustomShipping> <general> <debug>0</debug> </general> - </bobgo_customshipping> + </bobgo_CustomShipping> <carriers> <bobgo> <active>0</active> <sallowspecific>0</sallowspecific> <price>0.00</price> - <model>bobgo\Customshipping\Model\Carrier\Customshipping</model> + <model>bobgo\CustomShipping\Model\Carrier\CustomShipping</model> <name>Fixed</name> - <title>bobgo</title> + <title>Bob Go</title> <specificerrmsg>This shipping method is not available. To use this shipping method, please contact us.</specificerrmsg> </bobgo> </carriers> diff --git a/etc/di.xml b/etc/di.xml index d501898738c3d0f7ca44668d75b476cfa319b620..4f4ee2d8bbfd191d93355cbc58931211a3be53b2 100644 --- a/etc/di.xml +++ b/etc/di.xml @@ -3,6 +3,6 @@ xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\Checkout\Model\ShippingInformationManagement"> <plugin name="get_suburb" - type="bobgo\Customshipping\Plugin\ShippingInformationManagement" sortOrder="1"/> + type="bobgo\CustomShipping\Plugin\ShippingInformationManagement" sortOrder="1"/> </type> </config> diff --git a/etc/events.xml b/etc/events.xml index 2a246a7dd4ac640f74034c951c461b4018ab29db..caf07f224582cd023691b1d43ed3d5d5052c75b5 100644 --- a/etc/events.xml +++ b/etc/events.xml @@ -1,7 +1,7 @@ <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Event/etc/events.xsd"> <event name="sales_model_service_quote_submit_before"> - <observer name="bobgo_Customshipping_sales_model_service_quote_submit_before" - instance="bobgo\Customshipping\Observer\SaveOrderBeforeSalesModelQuote" /> + <observer name="bobgo_CustomShipping_sales_model_service_quote_submit_before" + instance="bobgo\CustomShipping\Observer\SaveOrderBeforeSalesModelQuote" /> </event> </config> diff --git a/etc/frontend/di.xml b/etc/frontend/di.xml index fd464886f98c6e4839a15029a4e81438b27023e9..61b1ccdd5598615f49d8e63f90f0bbff6a2ccf20 100644 --- a/etc/frontend/di.xml +++ b/etc/frontend/di.xml @@ -1,9 +1,9 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\Checkout\Block\Checkout\LayoutProcessor"> - <plugin name="add_custom_field_checkout_shipping_form" type="bobgo\Customshipping\Plugin\Checkout\Block\LayoutProcessorPlugin" sortOrder="10"/> + <plugin name="add_custom_field_checkout_shipping_form" type="bobgo\CustomShipping\Plugin\Checkout\Block\LayoutProcessorPlugin" sortOrder="10"/> <arguments> <argument name="layoutProcessors" xsi:type="array"> - <item name="orderattribute" xsi:type="object">bobgo\Customshipping\Plugin\Checkout\Block\LayoutProcessorPlugin</item> + <item name="orderattribute" xsi:type="object">bobgo\CustomShipping\Plugin\Checkout\Block\LayoutProcessorPlugin</item> </argument> </arguments> </type> diff --git a/etc/module.xml b/etc/module.xml index 702d466c8e47cafc80e350a173beaa093b451277..c1a03f842063b0354d514b7003300f63e321ca36 100644 --- a/etc/module.xml +++ b/etc/module.xml @@ -2,12 +2,12 @@ <!-- /** * @category bobgo - * @package bobgo_Customshipping + * @package bobgo_CustomShipping * @author bobgo */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> - <module name="bobgo_Customshipping" setup_version="1.0.0"> + <module name="bobgo_CustomShipping" setup_version="1.0.0"> <sequence> <module name="Magento_Webapi"/> <module name="Magento_Catalog"/> diff --git a/registration.php b/registration.php index 425ec6f971baf00372ebfd12f04a91f659befe2e..4c358c2e4db661b29186feaf09f205555534fa69 100644 --- a/registration.php +++ b/registration.php @@ -1,6 +1,7 @@ <?php +// Convention requires Vendor_Extension \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'bobgo_Customshipping', + 'bobgo_CustomShipping', __DIR__ ); diff --git a/vendor/autoload.php b/vendor/autoload.php deleted file mode 100644 index d52a5a24374833000273ce7b261db635c70dc97f..0000000000000000000000000000000000000000 --- a/vendor/autoload.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php - -// autoload.php @generated by Composer - -if (PHP_VERSION_ID < 50600) { - if (!headers_sent()) { - header('HTTP/1.1 500 Internal Server Error'); - } - $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL; - if (!ini_get('display_errors')) { - if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { - fwrite(STDERR, $err); - } elseif (!headers_sent()) { - echo $err; - } - } - trigger_error( - $err, - E_USER_ERROR - ); -} - -require_once __DIR__ . '/composer/autoload_real.php'; - -return ComposerAutoloaderInit9ef748c64c226893f336031e47dd147d::getLoader(); diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php deleted file mode 100644 index 1abd427cf1afa3a841c0acfeace634b3009815db..0000000000000000000000000000000000000000 --- a/vendor/composer/ClassLoader.php +++ /dev/null @@ -1,571 +0,0 @@ -<?php - -/* - * This file is part of Composer. - * - * (c) Nils Adermann <naderman@naderman.de> - * Jordi Boggiano <j.boggiano@seld.be> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Composer\Autoload; - -/** - * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. - * - * $loader = new \Composer\Autoload\ClassLoader(); - * - * // register classes with namespaces - * $loader->add('Symfony\Component', __DIR__.'/component'); - * $loader->add('Symfony', __DIR__.'/framework'); - * - * // activate the autoloader - * $loader->register(); - * - * // to enable searching the include path (eg. for PEAR packages) - * $loader->setUseIncludePath(true); - * - * In this example, if you try to use a class in the Symfony\Component - * namespace or one of its children (Symfony\Component\Console for instance), - * the autoloader will first look for the class under the component/ - * directory, and it will then fallback to the framework/ directory if not - * found before giving up. - * - * This class is loosely based on the Symfony UniversalClassLoader. - * - * @author Fabien Potencier <fabien@symfony.com> - * @author Jordi Boggiano <j.boggiano@seld.be> - * @see https://www.php-fig.org/psr/psr-0/ - * @see https://www.php-fig.org/psr/psr-4/ - */ -class ClassLoader -{ - /** @var ?string */ - private $vendorDir; - - // PSR-4 - /** - * @var array[] - * @psalm-var array<string, array<string, int>> - */ - private $prefixLengthsPsr4 = array(); - /** - * @var array[] - * @psalm-var array<string, array<int, string>> - */ - private $prefixDirsPsr4 = array(); - /** - * @var array[] - * @psalm-var array<string, string> - */ - private $fallbackDirsPsr4 = array(); - - // PSR-0 - /** - * @var array[] - * @psalm-var array<string, array<string, string[]>> - */ - private $prefixesPsr0 = array(); - /** - * @var array[] - * @psalm-var array<string, string> - */ - private $fallbackDirsPsr0 = array(); - - /** @var bool */ - private $useIncludePath = false; - - /** - * @var string[] - * @psalm-var array<string, string> - */ - private $classMap = array(); - - /** @var bool */ - private $classMapAuthoritative = false; - - /** - * @var bool[] - * @psalm-var array<string, bool> - */ - private $missingClasses = array(); - - /** @var ?string */ - private $apcuPrefix; - - /** - * @var self[] - */ - private static $registeredLoaders = array(); - - /** - * @param ?string $vendorDir - */ - public function __construct($vendorDir = null) - { - $this->vendorDir = $vendorDir; - } - - /** - * @return string[] - */ - public function getPrefixes() - { - if (!empty($this->prefixesPsr0)) { - return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); - } - - return array(); - } - - /** - * @return array[] - * @psalm-return array<string, array<int, string>> - */ - public function getPrefixesPsr4() - { - return $this->prefixDirsPsr4; - } - - /** - * @return array[] - * @psalm-return array<string, string> - */ - public function getFallbackDirs() - { - return $this->fallbackDirsPsr0; - } - - /** - * @return array[] - * @psalm-return array<string, string> - */ - public function getFallbackDirsPsr4() - { - return $this->fallbackDirsPsr4; - } - - /** - * @return string[] Array of classname => path - * @psalm-return array<string, string> - */ - public function getClassMap() - { - return $this->classMap; - } - - /** - * @param string[] $classMap Class to filename map - * @psalm-param array<string, string> $classMap - * - * @return void - */ - public function addClassMap(array $classMap) - { - if ($this->classMap) { - $this->classMap = array_merge($this->classMap, $classMap); - } else { - $this->classMap = $classMap; - } - } - - /** - * Registers a set of PSR-0 directories for a given prefix, either - * appending or prepending to the ones previously set for this prefix. - * - * @param string $prefix The prefix - * @param string[]|string $paths The PSR-0 root directories - * @param bool $prepend Whether to prepend the directories - * - * @return void - */ - public function add($prefix, $paths, $prepend = false) - { - if (!$prefix) { - if ($prepend) { - $this->fallbackDirsPsr0 = array_merge( - (array) $paths, - $this->fallbackDirsPsr0 - ); - } else { - $this->fallbackDirsPsr0 = array_merge( - $this->fallbackDirsPsr0, - (array) $paths - ); - } - - return; - } - - $first = $prefix[0]; - if (!isset($this->prefixesPsr0[$first][$prefix])) { - $this->prefixesPsr0[$first][$prefix] = (array) $paths; - - return; - } - if ($prepend) { - $this->prefixesPsr0[$first][$prefix] = array_merge( - (array) $paths, - $this->prefixesPsr0[$first][$prefix] - ); - } else { - $this->prefixesPsr0[$first][$prefix] = array_merge( - $this->prefixesPsr0[$first][$prefix], - (array) $paths - ); - } - } - - /** - * Registers a set of PSR-4 directories for a given namespace, either - * appending or prepending to the ones previously set for this namespace. - * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param string[]|string $paths The PSR-4 base directories - * @param bool $prepend Whether to prepend the directories - * - * @throws \InvalidArgumentException - * - * @return void - */ - public function addPsr4($prefix, $paths, $prepend = false) - { - if (!$prefix) { - // Register directories for the root namespace. - if ($prepend) { - $this->fallbackDirsPsr4 = array_merge( - (array) $paths, - $this->fallbackDirsPsr4 - ); - } else { - $this->fallbackDirsPsr4 = array_merge( - $this->fallbackDirsPsr4, - (array) $paths - ); - } - } elseif (!isset($this->prefixDirsPsr4[$prefix])) { - // Register directories for a new namespace. - $length = strlen($prefix); - if ('\\' !== $prefix[$length - 1]) { - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); - } - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = (array) $paths; - } elseif ($prepend) { - // Prepend directories for an already registered namespace. - $this->prefixDirsPsr4[$prefix] = array_merge( - (array) $paths, - $this->prefixDirsPsr4[$prefix] - ); - } else { - // Append directories for an already registered namespace. - $this->prefixDirsPsr4[$prefix] = array_merge( - $this->prefixDirsPsr4[$prefix], - (array) $paths - ); - } - } - - /** - * Registers a set of PSR-0 directories for a given prefix, - * replacing any others previously set for this prefix. - * - * @param string $prefix The prefix - * @param string[]|string $paths The PSR-0 base directories - * - * @return void - */ - public function set($prefix, $paths) - { - if (!$prefix) { - $this->fallbackDirsPsr0 = (array) $paths; - } else { - $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; - } - } - - /** - * Registers a set of PSR-4 directories for a given namespace, - * replacing any others previously set for this namespace. - * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param string[]|string $paths The PSR-4 base directories - * - * @throws \InvalidArgumentException - * - * @return void - */ - public function setPsr4($prefix, $paths) - { - if (!$prefix) { - $this->fallbackDirsPsr4 = (array) $paths; - } else { - $length = strlen($prefix); - if ('\\' !== $prefix[$length - 1]) { - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); - } - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = (array) $paths; - } - } - - /** - * Turns on searching the include path for class files. - * - * @param bool $useIncludePath - * - * @return void - */ - public function setUseIncludePath($useIncludePath) - { - $this->useIncludePath = $useIncludePath; - } - - /** - * Can be used to check if the autoloader uses the include path to check - * for classes. - * - * @return bool - */ - public function getUseIncludePath() - { - return $this->useIncludePath; - } - - /** - * Turns off searching the prefix and fallback directories for classes - * that have not been registered with the class map. - * - * @param bool $classMapAuthoritative - * - * @return void - */ - public function setClassMapAuthoritative($classMapAuthoritative) - { - $this->classMapAuthoritative = $classMapAuthoritative; - } - - /** - * Should class lookup fail if not found in the current class map? - * - * @return bool - */ - public function isClassMapAuthoritative() - { - return $this->classMapAuthoritative; - } - - /** - * APCu prefix to use to cache found/not-found classes, if the extension is enabled. - * - * @param string|null $apcuPrefix - * - * @return void - */ - public function setApcuPrefix($apcuPrefix) - { - $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; - } - - /** - * The APCu prefix in use, or null if APCu caching is not enabled. - * - * @return string|null - */ - public function getApcuPrefix() - { - return $this->apcuPrefix; - } - - /** - * Registers this instance as an autoloader. - * - * @param bool $prepend Whether to prepend the autoloader or not - * - * @return void - */ - public function register($prepend = false) - { - spl_autoload_register(array($this, 'loadClass'), true, $prepend); - - if (null === $this->vendorDir) { - return; - } - - if ($prepend) { - self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; - } else { - unset(self::$registeredLoaders[$this->vendorDir]); - self::$registeredLoaders[$this->vendorDir] = $this; - } - } - - /** - * Unregisters this instance as an autoloader. - * - * @return void - */ - public function unregister() - { - spl_autoload_unregister(array($this, 'loadClass')); - - if (null !== $this->vendorDir) { - unset(self::$registeredLoaders[$this->vendorDir]); - } - } - - /** - * Loads the given class or interface. - * - * @param string $class The name of the class - * @return true|null True if loaded, null otherwise - */ - public function loadClass($class) - { - if ($file = $this->findFile($class)) { - includeFile($file); - - return true; - } - - return null; - } - - /** - * Finds the path to the file where the class is defined. - * - * @param string $class The name of the class - * - * @return string|false The path if found, false otherwise - */ - public function findFile($class) - { - // class map lookup - if (isset($this->classMap[$class])) { - return $this->classMap[$class]; - } - if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { - return false; - } - if (null !== $this->apcuPrefix) { - $file = apcu_fetch($this->apcuPrefix.$class, $hit); - if ($hit) { - return $file; - } - } - - $file = $this->findFileWithExtension($class, '.php'); - - // Search for Hack files if we are running on HHVM - if (false === $file && defined('HHVM_VERSION')) { - $file = $this->findFileWithExtension($class, '.hh'); - } - - if (null !== $this->apcuPrefix) { - apcu_add($this->apcuPrefix.$class, $file); - } - - if (false === $file) { - // Remember that this class does not exist. - $this->missingClasses[$class] = true; - } - - return $file; - } - - /** - * Returns the currently registered loaders indexed by their corresponding vendor directories. - * - * @return self[] - */ - public static function getRegisteredLoaders() - { - return self::$registeredLoaders; - } - - /** - * @param string $class - * @param string $ext - * @return string|false - */ - private function findFileWithExtension($class, $ext) - { - // PSR-4 lookup - $logicalPathPsr4 = ClassLoader . phpstrtr($class, '\\', DIRECTORY_SEPARATOR); - - $first = $class[0]; - if (isset($this->prefixLengthsPsr4[$first])) { - $subPath = $class; - while (false !== $lastPos = strrpos($subPath, '\\')) { - $subPath = substr($subPath, 0, $lastPos); - $search = $subPath . '\\'; - if (isset($this->prefixDirsPsr4[$search])) { - $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); - foreach ($this->prefixDirsPsr4[$search] as $dir) { - if (file_exists($file = $dir . $pathEnd)) { - return $file; - } - } - } - } - } - - // PSR-4 fallback dirs - foreach ($this->fallbackDirsPsr4 as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { - return $file; - } - } - - // PSR-0 lookup - if (false !== $pos = strrpos($class, '\\')) { - // namespaced class name - $logicalPathPsr0 = ClassLoader . phpsubstr($logicalPathPsr4, 0, $pos + 1); - } else { - // PEAR-like class name - $logicalPathPsr0 = ClassLoader . phpstrtr($class, '_', DIRECTORY_SEPARATOR); - } - - if (isset($this->prefixesPsr0[$first])) { - foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { - if (0 === strpos($class, $prefix)) { - foreach ($dirs as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { - return $file; - } - } - } - } - } - - // PSR-0 fallback dirs - foreach ($this->fallbackDirsPsr0 as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { - return $file; - } - } - - // PSR-0 include paths. - if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { - return $file; - } - - return false; - } -} - -/** - * Scope isolated include. - * - * Prevents access to $this/self from included files. - * - * @param string $file - * @return void - * @private - */ -function includeFile($file) -{ - include $file; -} diff --git a/vendor/composer/InstalledVersions.php b/vendor/composer/InstalledVersions.php deleted file mode 100644 index c6b54af7ba2e1e3e960134233321efe47aa4528c..0000000000000000000000000000000000000000 --- a/vendor/composer/InstalledVersions.php +++ /dev/null @@ -1,352 +0,0 @@ -<?php - -/* - * This file is part of Composer. - * - * (c) Nils Adermann <naderman@naderman.de> - * Jordi Boggiano <j.boggiano@seld.be> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Composer; - -use Composer\Autoload\ClassLoader; -use Composer\Semver\VersionParser; - -/** - * This class is copied in every Composer installed project and available to all - * - * See also https://getcomposer.org/doc/07-runtime.md#installed-versions - * - * To require its presence, you can require `composer-runtime-api ^2.0` - * - * @final - */ -class InstalledVersions -{ - /** - * @var mixed[]|null - * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null - */ - private static $installed; - - /** - * @var bool|null - */ - private static $canGetVendors; - - /** - * @var array[] - * @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}> - */ - private static $installedByVendor = array(); - - /** - * Returns a list of all package names which are present, either by being installed, replaced or provided - * - * @return string[] - * @psalm-return list<string> - */ - public static function getInstalledPackages() - { - $packages = array(); - foreach (self::getInstalled() as $installed) { - $packages[] = array_keys($installed['versions']); - } - - if (1 === \count($packages)) { - return $packages[0]; - } - - return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); - } - - /** - * Returns a list of all package names with a specific type e.g. 'library' - * - * @param string $type - * @return string[] - * @psalm-return list<string> - */ - public static function getInstalledPackagesByType($type) - { - $packagesByType = array(); - - foreach (self::getInstalled() as $installed) { - foreach ($installed['versions'] as $name => $package) { - if (isset($package['type']) && $package['type'] === $type) { - $packagesByType[] = $name; - } - } - } - - return $packagesByType; - } - - /** - * Checks whether the given package is installed - * - * This also returns true if the package name is provided or replaced by another package - * - * @param string $packageName - * @param bool $includeDevRequirements - * @return bool - */ - public static function isInstalled($packageName, $includeDevRequirements = true) - { - foreach (self::getInstalled() as $installed) { - if (isset($installed['versions'][$packageName])) { - return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']); - } - } - - return false; - } - - /** - * Checks whether the given package satisfies a version constraint - * - * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call: - * - * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3') - * - * @param VersionParser $parser Install composer/semver to have access to this class and functionality - * @param string $packageName - * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package - * @return bool - */ - public static function satisfies(VersionParser $parser, $packageName, $constraint) - { - $constraint = $parser->parseConstraints($constraint); - $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); - - return $provided->matches($constraint); - } - - /** - * Returns a version constraint representing all the range(s) which are installed for a given package - * - * It is easier to use this via isInstalled() with the $constraint argument if you need to check - * whether a given version of a package is installed, and not just whether it exists - * - * @param string $packageName - * @return string Version constraint usable with composer/semver - */ - public static function getVersionRanges($packageName) - { - foreach (self::getInstalled() as $installed) { - if (!isset($installed['versions'][$packageName])) { - continue; - } - - $ranges = array(); - if (isset($installed['versions'][$packageName]['pretty_version'])) { - $ranges[] = $installed['versions'][$packageName]['pretty_version']; - } - if (array_key_exists('aliases', $installed['versions'][$packageName])) { - $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); - } - if (array_key_exists('replaced', $installed['versions'][$packageName])) { - $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); - } - if (array_key_exists('provided', $installed['versions'][$packageName])) { - $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); - } - - return implode(' || ', $ranges); - } - - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); - } - - /** - * @param string $packageName - * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present - */ - public static function getVersion($packageName) - { - foreach (self::getInstalled() as $installed) { - if (!isset($installed['versions'][$packageName])) { - continue; - } - - if (!isset($installed['versions'][$packageName]['version'])) { - return null; - } - - return $installed['versions'][$packageName]['version']; - } - - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); - } - - /** - * @param string $packageName - * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present - */ - public static function getPrettyVersion($packageName) - { - foreach (self::getInstalled() as $installed) { - if (!isset($installed['versions'][$packageName])) { - continue; - } - - if (!isset($installed['versions'][$packageName]['pretty_version'])) { - return null; - } - - return $installed['versions'][$packageName]['pretty_version']; - } - - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); - } - - /** - * @param string $packageName - * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference - */ - public static function getReference($packageName) - { - foreach (self::getInstalled() as $installed) { - if (!isset($installed['versions'][$packageName])) { - continue; - } - - if (!isset($installed['versions'][$packageName]['reference'])) { - return null; - } - - return $installed['versions'][$packageName]['reference']; - } - - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); - } - - /** - * @param string $packageName - * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path. - */ - public static function getInstallPath($packageName) - { - foreach (self::getInstalled() as $installed) { - if (!isset($installed['versions'][$packageName])) { - continue; - } - - return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null; - } - - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); - } - - /** - * @return array - * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool} - */ - public static function getRootPackage() - { - $installed = self::getInstalled(); - - return $installed[0]['root']; - } - - /** - * Returns the raw installed.php data for custom implementations - * - * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect. - * @return array[] - * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} - */ - public static function getRawData() - { - @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED); - - if (null === self::$installed) { - // only require the installed.php file if this file is loaded from its dumped location, - // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 - if (substr(__DIR__, -8, 1) !== 'C') { - self::$installed = include __DIR__ . '/installed.php'; - } else { - self::$installed = array(); - } - } - - return self::$installed; - } - - /** - * Returns the raw data of all installed.php which are currently loaded for custom implementations - * - * @return array[] - * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}> - */ - public static function getAllRawData() - { - return self::getInstalled(); - } - - /** - * Lets you reload the static array from another file - * - * This is only useful for complex integrations in which a project needs to use - * this class but then also needs to execute another project's autoloader in process, - * and wants to ensure both projects have access to their version of installed.php. - * - * A typical case would be PHPUnit, where it would need to make sure it reads all - * the data it needs from this class, then call reload() with - * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure - * the project in which it runs can then also use this class safely, without - * interference between PHPUnit's dependencies and the project's dependencies. - * - * @param array[] $data A vendor/composer/installed.php data set - * @return void - * - * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data - */ - public static function reload($data) - { - self::$installed = $data; - self::$installedByVendor = array(); - } - - /** - * @return array[] - * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}> - */ - private static function getInstalled() - { - if (null === self::$canGetVendors) { - self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); - } - - $installed = array(); - - if (self::$canGetVendors) { - foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { - if (isset(self::$installedByVendor[$vendorDir])) { - $installed[] = self::$installedByVendor[$vendorDir]; - } elseif (is_file($vendorDir.'/composer/installed.php')) { - $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; - if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { - self::$installed = $installed[count($installed) - 1]; - } - } - } - } - - if (null === self::$installed) { - // only require the installed.php file if this file is loaded from its dumped location, - // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 - if (substr(__DIR__, -8, 1) !== 'C') { - self::$installed = require __DIR__ . '/installed.php'; - } else { - self::$installed = array(); - } - } - $installed[] = self::$installed; - - return $installed; - } -} diff --git a/vendor/composer/LICENSE b/vendor/composer/LICENSE deleted file mode 100644 index f27399a042d95c4708af3a8c74d35d338763cf8f..0000000000000000000000000000000000000000 --- a/vendor/composer/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - -Copyright (c) Nils Adermann, Jordi Boggiano - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php deleted file mode 100644 index 0fb0a2c194b8590999a5ed79e357d4a9c1e9d8b8..0000000000000000000000000000000000000000 --- a/vendor/composer/autoload_classmap.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -// autoload_classmap.php @generated by Composer - -$vendorDir = dirname(__DIR__); -$baseDir = dirname($vendorDir); - -return array( - 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', -); diff --git a/vendor/composer/autoload_namespaces.php b/vendor/composer/autoload_namespaces.php deleted file mode 100644 index 15a2ff3ad6d8d6ea2b6b1f9552c62d745ffc9bf4..0000000000000000000000000000000000000000 --- a/vendor/composer/autoload_namespaces.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -// autoload_namespaces.php @generated by Composer - -$vendorDir = dirname(__DIR__); -$baseDir = dirname($vendorDir); - -return array( -); diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php deleted file mode 100644 index 3890ddc2409b78e2720b8ec2db64d76b18811b3d..0000000000000000000000000000000000000000 --- a/vendor/composer/autoload_psr4.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -// autoload_psr4.php @generated by Composer - -$vendorDir = dirname(__DIR__); -$baseDir = dirname($vendorDir); - -return array( -); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php deleted file mode 100644 index b1dde79b7be6fde981dc5e958df98950d975ba53..0000000000000000000000000000000000000000 --- a/vendor/composer/autoload_real.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php - -// autoload_real.php @generated by Composer - -class ComposerAutoloaderInit9ef748c64c226893f336031e47dd147d -{ - private static $loader; - - public static function loadClassLoader($class) - { - if ('Composer\Autoload\ClassLoader' === $class) { - require __DIR__ . '/ClassLoader.php'; - } - } - - /** - * @return \Composer\Autoload\ClassLoader - */ - public static function getLoader() - { - if (null !== self::$loader) { - return self::$loader; - } - - spl_autoload_register(array('ComposerAutoloaderInit9ef748c64c226893f336031e47dd147d', 'loadClassLoader'), true, true); - self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); - spl_autoload_unregister(array('ComposerAutoloaderInit9ef748c64c226893f336031e47dd147d', 'loadClassLoader')); - - require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit9ef748c64c226893f336031e47dd147d::getInitializer($loader)); - - $loader->register(true); - - return $loader; - } -} diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php deleted file mode 100644 index 5703da56a26aa4d38ddbfe3c1d3afc98b691aa4c..0000000000000000000000000000000000000000 --- a/vendor/composer/autoload_static.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php - -// autoload_static.php @generated by Composer - -namespace Composer\Autoload; - -class ComposerStaticInit9ef748c64c226893f336031e47dd147d -{ - public static $classMap = array ( - 'Composer\\InstalledVersions' => __DIR__ . '/..', - ); - - public static function getInitializer(ClassLoader $loader) - { - return \Closure::bind(function () use ($loader) { - $loader->classMap = ComposerStaticInit9ef748c64c226893f336031e47dd147d::$classMap; - - }, null, ClassLoader::class); - } -} diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json deleted file mode 100644 index 87fda747e6ce957c1bf1b4d373bb5c60dbf96e7d..0000000000000000000000000000000000000000 --- a/vendor/composer/installed.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "packages": [], - "dev": true, - "dev-package-names": [] -} diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php deleted file mode 100644 index 133ab49c92cf1b4f94eca24b0e2662e55a91bbd4..0000000000000000000000000000000000000000 --- a/vendor/composer/installed.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php return array( - 'root' => array( - 'name' => '__root__', - 'pretty_version' => 'dev-main', - 'version' => 'dev-main', - 'reference' => '5d71c85cc020f9db5753213fce46620f15cb94d1', - 'type' => 'library', - 'install_path' => __DIR__ . '/../magento-bobgo-shipping-extension/', - 'aliases' => array(), - 'dev' => true, - ), - 'versions' => array( - '__root__' => array( - 'pretty_version' => 'dev-main', - 'version' => 'dev-main', - 'reference' => '5d71c85cc020f9db5753213fce46620f15cb94d1', - 'type' => 'library', - 'install_path' => __DIR__ . '/../magento-bobgo-shipping-extension/', - 'aliases' => array(), - 'dev_requirement' => false, - ), - ), -); diff --git a/view/frontend/layout/checkout_cart_index.xml b/view/frontend/layout/checkout_cart_index.xml index 5fc57d490edfd59068b1aefa9eafb66ce7de08e2..884a7712c0b183d822204c85f434ee9c250ec4ab 100644 --- a/view/frontend/layout/checkout_cart_index.xml +++ b/view/frontend/layout/checkout_cart_index.xml @@ -10,7 +10,7 @@ <item name="shipping-rates-validation" xsi:type="array"> <item name="children" xsi:type="array"> <item name="bobgo-rates-validation" xsi:type="array"> - <item name="component" xsi:type="string">bobgo_Customshipping/js/view/shipping-rates-validation</item> + <item name="component" xsi:type="string">bobgo_CustomShipping/js/view/shipping-rates-validation</item> </item> </item> </item> diff --git a/view/frontend/layout/checkout_index_index.xml b/view/frontend/layout/checkout_index_index.xml index 5ff2aad3d5ab9e5c438099624d4223f7b87a067e..95457b70f16c695dc1869519860fbdb73f1f94a1 100644 --- a/view/frontend/layout/checkout_index_index.xml +++ b/view/frontend/layout/checkout_index_index.xml @@ -16,7 +16,7 @@ <item name="shipping-rates-validation" xsi:type="array"> <item name="children" xsi:type="array"> <item name="bobgo-rates-validation" xsi:type="array"> - <item name="component" xsi:type="string">bobgo_Customshipping/js/view/shipping-rates-validation</item> + <item name="component" xsi:type="string">bobgo_CustomShipping/js/view/shipping-rates-validation</item> </item> </item> </item> diff --git a/view/frontend/requirejs-config.js b/view/frontend/requirejs-config.js index f95fdac27f622687e1590a9a1b999b3ec86697ab..471dc742f1a6068b0d02ccbfeba883f771eab8ff 100644 --- a/view/frontend/requirejs-config.js +++ b/view/frontend/requirejs-config.js @@ -1,8 +1,10 @@ +/*required for adding the mixing that is supposed to add the suburb to the shipping address +set-shipping-information-mixin.js*/ var config = { config: { mixins: { 'Magento_Checkout/js/action/set-shipping-information': { - 'bobgo_Customshipping/js/action/set-shipping-information-mixin': true + 'bobgo_CustomShipping/js/action/set-shipping-information-mixin': true } } } diff --git a/view/frontend/web/js/action/set-shipping-information-mixin.js b/view/frontend/web/js/action/set-shipping-information-mixin.js index 1c8327be8ca8e09070cdddcbb8b065c709988745..b899f21c19c365149aeac59026048b30e3d322fa 100644 --- a/view/frontend/web/js/action/set-shipping-information-mixin.js +++ b/view/frontend/web/js/action/set-shipping-information-mixin.js @@ -14,18 +14,19 @@ define([ if (shippingAddress['extension_attributes'] === undefined) { shippingAddress['extension_attributes'] = {}; } + //This is supposed to be the mixin that adds the suburb to the shipping address, but it doesn't work +/* var attribute = shippingAddress.customAttributes.find( + function (element) { + return element.attribute_code === 'suburb'; + } + ); - // var attribute = shippingAddress.customAttributes.find( - // function (element) { - // return element.attribute_code === 'suburb'; - // } - // ); - // - // shippingAddress['extension_attributes']['suburb'] = attribute.value; + shippingAddress['extension_attributes']['suburb'] = attribute.value; - // shippingAddress['extension_attributes']['suburb'] = shippingAddress.value; + shippingAddress['extension_attributes']['suburb'] = shippingAddress.value; - // pass execution to original action ('Magento_Checkout/js/action/set-shipping-information') + pass execution to original action ('Magento_Checkout/js/action/set-shipping-information')*/ + //after all the of the above the suburb is still not added to the request payload that goes to CustomShipping.php return originalAction(); }); };