Select Git revision
ConfigChangeObserver.php 5.30 KiB
<?php
//
//namespace BobGroup\BobGo\Observer;
//
//use Magento\Framework\Event\Observer;
//use Magento\Framework\Event\ObserverInterface;
//use Magento\Framework\App\Config\ScopeConfigInterface;
//use Magento\Framework\HTTP\Client\Curl;
//use Psr\Log\LoggerInterface;
//
//class ConfigChangeObserver implements ObserverInterface
//{
// protected $scopeConfig;
// protected $curl;
// protected $logger;
//
// public function __construct(
// ScopeConfigInterface $scopeConfig,
// Curl $curl,
// LoggerInterface $logger
// ) {
// $this->scopeConfig = $scopeConfig;
// $this->curl = $curl;
// $this->logger = $logger;
// }
//
// public function execute(Observer $observer)
// {
// $sectionId = $observer->getEvent()->getSection();
//
// // Ensure we're working with the 'carriers' section
// if ($sectionId === 'carriers') {
// $isEnabled = $this->scopeConfig->getValue('carriers/bobgo/active', \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
//
// // Check if the extension is enabled
// if ($isEnabled) {
// $url = 'https://api.dev.bobgo.co.za/rates-at-checkout/magento';
//
// // Prepare the payload
// $payload = json_encode([
// "identifier" => "woodemo3.bobgo.co.za",
// "rate" => [
// "origin" => [
// "country" => "ZA",
// "postal_code" => "0181",
// "province" => "GP",
// "city" => "Pretoria",
// "name" => null,
// "address1" => "125 Dallas Avenue",
// "address2" => "Newlands",
// "address3" => null,
// "phone" => "",
// "fax" => "",
// "email" => null,
// "address_type" => null,
// "company_name" => ""
// ],
// "destination" => [
// "country" => "ZA",
// "postal_code" => "0181",
// "province" => "GP",
// "city" => "Pretoria",
// "name" => null,
// "address1" => null,
// "address2" => "",
// "address3" => null,
// "phone" => "",
// "fax" => "",
// "email" => null,
// "address_type" => null,