Skip to content

Commit

Permalink
Merge pull request #87 from Paazl/release/1.11.0
Browse files Browse the repository at this point in the history
Release/1.11.0
  • Loading branch information
Marvin-Magmodules authored Mar 7, 2022
2 parents bbe79ca + 4a9e4be commit 0052a40
Show file tree
Hide file tree
Showing 8 changed files with 151 additions and 216 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/codesniffer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Codesniffer with the Magento Coding standard
on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Run codesniffer
run:
docker run
--volume $(pwd)/:/app/workdir
michielgerritsen/magento-coding-standard:latest
--severity=10
45 changes: 45 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Lint PHP files
on: [push, pull_request]

jobs:
php-71:
runs-on: ubuntu-latest
steps:
- uses: StephaneBour/[email protected]
with:
dir: './'

php-72:
runs-on: ubuntu-latest
steps:
- uses: StephaneBour/[email protected]
with:
dir: './'

php-73:
runs-on: ubuntu-latest
steps:
- uses: StephaneBour/[email protected]
with:
dir: './'

php-74:
runs-on: ubuntu-latest
steps:
- uses: StephaneBour/[email protected]
with:
dir: './'

php-80:
runs-on: ubuntu-latest
steps:
- uses: StephaneBour/[email protected]
with:
dir: './'

php-81:
runs-on: ubuntu-latest
steps:
- uses: StephaneBour/[email protected]
with:
dir: './'
39 changes: 30 additions & 9 deletions Logger/PaazlLogger.php
Original file line number Diff line number Diff line change
@@ -1,33 +1,54 @@
<?php
/**
* Copyright © 2019 Paazl. All rights reserved.
* Copyright © Paazl. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Paazl\CheckoutWidget\Logger;

use Magento\Framework\Serialize\Serializer\Json;
use Monolog\Logger;

/**
* Class PaazlLogger
*
* @package Paazl\CheckoutWidget\Logger
* DebugLogger logger class
*/
class PaazlLogger extends Logger
{

/**
* @var Json
*/
private $json;

/**
* DebugLogger constructor.
*
* @param Json $json
* @param string $name
* @param array $handlers
* @param array $processors
*/
public function __construct(
Json $json,
string $name,
array $handlers = [],
array $processors = []
) {
$this->json = $json;
parent::__construct($name, $handlers, $processors);
}

/**
* @param string $type
* @param mixed $data
*/
public function add($type, $data)
{
if (is_array($data)) {
$this->addInfo($type . ': ' . json_encode($data));
} elseif (is_object($data)) {
$this->addInfo($type . ': ' . json_encode($data));
if (is_array($data) || is_object($data)) {
$this->addRecord(static::INFO, $type . ': ' . $this->json->serialize($data));
} else {
$this->addInfo($type . ': ' . $data);
$this->addRecord(static::INFO, $type . ': ' . $data);
}
}
}
21 changes: 19 additions & 2 deletions Plugin/Tax/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

namespace Paazl\CheckoutWidget\Plugin\Tax;

use Magento\Store\Model\StoreManagerInterface;
use Magento\Tax\Model\Config as TaxConfigModel;
use Paazl\CheckoutWidget\Helper\Order as OrderHelper;
use Paazl\CheckoutWidget\Model\Config as PaazlConfig;
Expand Down Expand Up @@ -36,24 +37,32 @@ class Config
*/
private $quoteAddressResource;

/**
* @var StoreManagerInterface
*/
private $storeManager;

/**
* Config constructor.
*
* @param OrderHelper $orderHelper
* @param PaazlConfig $paazlConfig
* @param Session $session
* @param QuoteAddressResource $quoteAddressResource
* @param StoreManagerInterface $storeManager
*/
public function __construct(
OrderHelper $orderHelper,
PaazlConfig $paazlConfig,
Session $session,
QuoteAddressResource $quoteAddressResource
QuoteAddressResource $quoteAddressResource,
StoreManagerInterface $storeManager
) {
$this->orderHelper = $orderHelper;
$this->paazlConfig = $paazlConfig;
$this->session = $session;
$this->quoteAddressResource = $quoteAddressResource;
$this->storeManager = $storeManager;
}

/**
Expand All @@ -68,7 +77,7 @@ public function afterShippingPriceIncludesTax(
bool $result,
$store = null
) {
$cartId = $this->session->getQuoteId();
$cartId = $this->session->getData($this->getQuoteIdKey());
$shippingMethod = $this->quoteAddressResource->getShippingMethodByQuoteId((int)$cartId);
if ($shippingMethod
&& $this->orderHelper->isPaazlShippingMethod($shippingMethod)
Expand All @@ -79,4 +88,12 @@ public function afterShippingPriceIncludesTax(

return $result;
}

/**
* @return string
*/
private function getQuoteIdKey()
{
return 'quote_id_' . $this->storeManager->getStore()->getWebsiteId();
}
}
203 changes: 0 additions & 203 deletions Setup/UpgradeSchema.php

This file was deleted.

Loading

0 comments on commit 0052a40

Please sign in to comment.