Skip to content

Commit

Permalink
Merge pull request #89 from Paazl/release/1.11.1
Browse files Browse the repository at this point in the history
Release/1.11.1
  • Loading branch information
Marvin-Magmodules authored Mar 15, 2022
2 parents 0052a40 + aff0269 commit f1019d7
Show file tree
Hide file tree
Showing 35 changed files with 259 additions and 192 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codesniffer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ jobs:
docker run
--volume $(pwd)/:/app/workdir
michielgerritsen/magento-coding-standard:latest
--severity=10
--severity=6
48 changes: 25 additions & 23 deletions .github/workflows/setup-di-compile.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
name: setup:di:compile

on: pull_request
on: [pull_request]

jobs:
build:
strategy:
matrix:
PHP_VERSION: [php7-fpm, php71-fpm, php72-fpm]
MAGENTO_VERSION: [2.2.11, 2.3.5-p1]
exclude:
- PHP_VERSION: php7-fpm
MAGENTO_VERSION: 2.3.5-p1
- PHP_VERSION: php72-fpm
MAGENTO_VERSION: 2.2.11
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
build:
strategy:
matrix:
include:
- PHP_VERSION: php72-fpm
MAGENTO_VERSION: 2.3.3
- PHP_VERSION: php73-fpm
MAGENTO_VERSION: 2.3.6-p1
- PHP_VERSION: php74-fpm
MAGENTO_VERSION: 2.4.2
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1

- name: Start Docker
run: docker run --detach --name magento-project-community-edition michielgerritsen/magento-project-community-edition:${{ matrix.PHP_VERSION }}-magento${{ matrix.MAGENTO_VERSION }}

- name: Start Docker
run: docker run --detach --name magento-project-community-edition michielgerritsen/magento-project-community-edition:${{ matrix.PHP_VERSION }}-magento${{ matrix.MAGENTO_VERSION }}
- name: Create branch for Composer and remove version from composer.json
run: git checkout -b continuous-integration-test-branch && sed -i '/version/d' ./composer.json

- name: Upload our code into the docker container
run: docker cp $(pwd) magento-project-community-edition:/data/extensions/
- name: Upload our code into the docker container
run: docker cp $(pwd) magento-project-community-edition:/data/extensions/

- name: Install the extension in Magento
run: docker exec magento-project-community-edition composer require paazl/magento2-checkout-widget:@dev
- name: Install the extension in Magento
run: docker exec magento-project-community-edition composer require paazl/magento2-checkout-widget:dev-continuous-integration-test-branch

- name: Run setup:di:compile
run: docker exec magento-project-community-edition php bin/magento setup:di:compile
- name: Run setup:di:compile
run: docker exec magento-project-community-edition php bin/magento setup:di:compile
8 changes: 4 additions & 4 deletions Api/Data/CheckQuoteResultInterface.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright © 2019 Paazl. All rights reserved.
* Copyright © Paazl. All rights reserved.
* See COPYING.txt for license details.
*/

Expand All @@ -13,9 +13,9 @@
*/
interface CheckQuoteResultInterface
{
const RELOAD_WIDGET = 'reload_widget';
const RELOAD_WIDGET_CONFIG_JSON = 'reload_widget_config';
const TOTALS = 'totals';
public const RELOAD_WIDGET = 'reload_widget';
public const RELOAD_WIDGET_CONFIG_JSON = 'reload_widget_config';
public const TOTALS = 'totals';

/**
* @return boolean
Expand Down
14 changes: 7 additions & 7 deletions Api/Data/Delivery/OrderPickupLocationInterface.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright © 2019 Paazl. All rights reserved.
* Copyright © Paazl. All rights reserved.
* See COPYING.txt for license details.
*/

Expand All @@ -13,12 +13,12 @@
*/
interface OrderPickupLocationInterface
{
const PICKUP_CODE = 'pickup_code';
const NAME = 'name';
const COUNTRY = 'country';
const POSTCODE = 'postcode';
const CITY = 'city';
const STREET = 'street';
public const PICKUP_CODE = 'pickup_code';
public const NAME = 'name';
public const COUNTRY = 'country';
public const POSTCODE = 'postcode';
public const CITY = 'city';
public const STREET = 'street';

/**
* @return string
Expand Down
12 changes: 6 additions & 6 deletions Api/Data/Order/OrderReferenceInterface.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright © 2019 Paazl. All rights reserved.
* Copyright © Paazl. All rights reserved.
* See COPYING.txt for license details.
*/

Expand All @@ -19,11 +19,11 @@ interface OrderReferenceInterface
*
* @var string
*/
const ENTITY_ID = 'entity_id';
const ORDER_ID = 'order_id';
const EXT_SHIPPING_INFO = 'ext_shipping_info';
const EXT_SENT_AT = 'ext_sent_at';
const EXT_INVALID = 'invalid';
public const ENTITY_ID = 'entity_id';
public const ORDER_ID = 'order_id';
public const EXT_SHIPPING_INFO = 'ext_shipping_info';
public const EXT_SENT_AT = 'ext_sent_at';
public const EXT_INVALID = 'invalid';
/**#@-*/

/**
Expand Down
12 changes: 6 additions & 6 deletions Api/Data/Quote/QuoteReferenceInterface.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright © 2019 Paazl. All rights reserved.
* Copyright © Paazl. All rights reserved.
* See COPYING.txt for license details.
*/

Expand All @@ -19,11 +19,11 @@ interface QuoteReferenceInterface
*
* @var string
*/
const ENTITY_ID = 'entity_id';
const QUOTE_ID = 'quote_id';
const EXT_SHIPPING_INFO = 'ext_shipping_info';
const TOKEN = 'token';
const TOKEN_EXPIRES_AT = 'token_expires_at';
public const ENTITY_ID = 'entity_id';
public const QUOTE_ID = 'quote_id';
public const EXT_SHIPPING_INFO = 'ext_shipping_info';
public const TOKEN = 'token';
public const TOKEN_EXPIRES_AT = 'token_expires_at';
/**#@-*/

/**
Expand Down
7 changes: 4 additions & 3 deletions Console/Command/OrderSendCommand.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright © 2019 Paazl. All rights reserved.
* Copyright © Paazl. All rights reserved.
* See COPYING.txt for license details.
*/

Expand Down Expand Up @@ -28,7 +28,7 @@ class OrderSendCommand extends Command
/**
* @var string
*/
const ARG_ORDER = 'order';
public const ARG_ORDER = 'order';

/**
* @var OrderRepositoryInterface
Expand Down Expand Up @@ -98,8 +98,9 @@ public function getInputList()
protected function execute(InputInterface $input, OutputInterface $output)
{
try {
$this->state->setAreaCode(Area::AREA_ADMINHTML);
$this->state->getAreaCode();
} catch (LocalizedException $e) {
$this->state->setAreaCode(Area::AREA_ADMINHTML);
}

$orderIds = $input->getArgument(OrderSendCommand::ARG_ORDER);
Expand Down
4 changes: 2 additions & 2 deletions Controller/Adminhtml/Order/Data/Save.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright © 2019 Paazl. All rights reserved.
* Copyright © Paazl. All rights reserved.
* See COPYING.txt for license details.
*/

Expand Down Expand Up @@ -36,7 +36,7 @@
*/
class Save extends Order
{
const DEFAULT_MESSAGE_KEY = 'message';
public const DEFAULT_MESSAGE_KEY = 'message';

/**
* @var SerializerInterface
Expand Down
4 changes: 2 additions & 2 deletions Controller/Adminhtml/Order/Data/Validate.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright © 2019 Paazl. All rights reserved.
* Copyright © Paazl. All rights reserved.
* See COPYING.txt for license details.
*/

Expand All @@ -22,7 +22,7 @@
*/
class Validate extends Order
{
const DEFAULT_MESSAGE_KEY = 'message';
public const DEFAULT_MESSAGE_KEY = 'message';

/**
* @var SerializerInterface
Expand Down
2 changes: 1 addition & 1 deletion Cron/SendOrders.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class SendOrders
/**
* Retry time in seconds
*/
const RETRY_TIME_SECONDS = 50400;
public const RETRY_TIME_SECONDS = 50400;

/**
* @var SendToService
Expand Down
2 changes: 1 addition & 1 deletion Helper/General.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class General extends AbstractHelper
/**
* @var string
*/
const MODULE_CODE = 'Paazl_CheckoutWidget';
public const MODULE_CODE = 'Paazl_CheckoutWidget';

/**
* @var ModuleListInterface
Expand Down
2 changes: 1 addition & 1 deletion Model/Admin/Order/Create/WidgetConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class WidgetConfigProvider implements ConfigProviderInterface
/**#@+
* Constants
*/
const DEFAULT_NUMBER_OF_PROCESSING_DAYS = 0;
public const DEFAULT_NUMBER_OF_PROCESSING_DAYS = 0;
/**#@-*/

/**
Expand Down
47 changes: 20 additions & 27 deletions Model/Api/ApiException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,35 @@

namespace Paazl\CheckoutWidget\Model\Api;

use Throwable;
use Magento\Framework\Exception\NoSuchEntityException;

/**
* Class ApiException
*
* @package Paazl\CheckoutWidget\Model\Api
*/
class ApiException extends \Exception
{
/**
* @param \Exception|null $previous
* @return ApiException
*/
public static function error(\Exception $previous = null)
{
return new static('API error', 0, $previous);
}

/**
* @param string $message
* @param int|string $code
* @param \Exception|null $previous
* @return ApiException
*/
public static function fromErrorResponse($message, $code, \Exception $previous = null)
{
// Parsing errors
$code = (int)$code;
$errors = json_decode($message, true);
$message = 'API error';
if ($errors !== null && !empty($errors['errors']) && is_array($errors['errors'])) {
$messages = array_map(function ($error) {
return isset($error['message']) ? $error['message'] : null;
}, $errors['errors']);
public function __construct(
$message = "",
$code = 0,
Throwable $previous = null,
$response = false
) {
if ($response) {
$code = (int)$code;
$errors = json_decode($message, true);
$message = 'API error';
if ($errors !== null && !empty($errors['errors']) && is_array($errors['errors'])) {
$messages = array_map(function ($error) {
return isset($error['message']) ? $error['message'] : null;
}, $errors['errors']);

$message = implode(', ', $messages);
$message = implode(', ', $messages);
}
}

return new static($message, $code, $previous);
parent::__construct($message, $code, $previous);
}
}
2 changes: 1 addition & 1 deletion Model/Api/CurlExtra.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright © 2019 Paazl. All rights reserved.
* Copyright © Paazl. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
Expand Down
4 changes: 2 additions & 2 deletions Model/Api/Field/DeliveryType.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
class DeliveryType
{

const PICKUP = 'PICKUP_LOCATION';
const DELIVERY = 'HOME';
public const PICKUP = 'PICKUP_LOCATION';
public const DELIVERY = 'HOME';
}
7 changes: 2 additions & 5 deletions Model/Api/Http/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,13 @@ protected function parseHeaders($ch, $data)
if (count($line) < 2) {
$this->doError("Invalid response line returned from server: " . $data);
}
$code = intval($line[1]);
if (!HttpCode::execute($code)) {
$this->doError("Invalid response line returned from server: " . $data);
}
$code = (int)$line[1];
if ($code === 100) {
// Handle status 100 Continue
$this->skipNextHeader = true;
return strlen($data);
}
$this->_responseStatus = intval($line[1]);
$this->_responseStatus = (int)$line[1];
} else {
$name = $value = '';
$out = explode(": ", trim($data), 2);
Expand Down
Loading

0 comments on commit f1019d7

Please sign in to comment.