Skip to content
Snippets Groups Projects
Commit 332a2309 authored by Christel Loftus's avatar Christel Loftus
Browse files

issue with dependency injection

parent 42311650
No related branches found
No related tags found
1 merge request!6Rates at checkout
Pipeline #65220 passed
......@@ -19,6 +19,7 @@ class BobGo extends AbstractCarrier implements CarrierInterface
protected $rateResultFactory;
protected $rateMethodFactory;
protected $logger;
public function __construct(
ScopeConfigInterface $scopeConfig,
......@@ -30,15 +31,21 @@ class BobGo extends AbstractCarrier implements CarrierInterface
) {
$this->rateResultFactory = $rateResultFactory;
$this->rateMethodFactory = $rateMethodFactory;
$this->logger = $logger;
parent::__construct($scopeConfig, $rateErrorFactory, $logger, $data);
}
public function collectRates(RateRequest $request)
{
$this->logger->debug('BobGo collectRates method called');
if (!$this->getConfigFlag('active')) {
$this->logger->debug('BobGo is not active');
return false;
}
$this->logger->debug('BobGo is active');
$result = $this->rateResultFactory->create();
$method = $this->rateMethodFactory->create();
......@@ -49,6 +56,7 @@ class BobGo extends AbstractCarrier implements CarrierInterface
$method->setMethodTitle($this->getConfigData('name'));
$shippingCost = (float)$this->getConfigData('shipping_cost');
$this->logger->debug('Shipping Cost: ' . $shippingCost);
$method->setPrice($shippingCost);
$method->setCost($shippingCost);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment