Skip to content

Commit

Permalink
Merge pull request #497 from mollie/release/2.7.0
Browse files Browse the repository at this point in the history
Release/2.7.0
  • Loading branch information
Marvin-Magmodules committed Mar 4, 2022
2 parents bc94f54 + 93026e7 commit 1f66e7c
Show file tree
Hide file tree
Showing 54 changed files with 2,936 additions and 543 deletions.
18 changes: 17 additions & 1 deletion Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
namespace Mollie\Payment;

use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\App\ProductMetadataInterface;
use Magento\Framework\Encryption\EncryptorInterface;
use Magento\Framework\Module\Manager;
use Magento\Store\Model\ScopeInterface;
Expand Down Expand Up @@ -81,16 +82,23 @@ class Config
*/
private $encryptor;

/**
* @var ProductMetadataInterface
*/
private $productMetadata;

public function __construct(
ScopeConfigInterface $config,
MollieLogger $logger,
Manager $moduleManager,
EncryptorInterface $encryptor
EncryptorInterface $encryptor,
ProductMetadataInterface $productMetadata
) {
$this->config = $config;
$this->logger = $logger;
$this->moduleManager = $moduleManager;
$this->encryptor = $encryptor;
$this->productMetadata = $productMetadata;
}

/**
Expand Down Expand Up @@ -141,6 +149,14 @@ public function getVersion()
return $this->getPath(static::GENERAL_VERSION, null);
}

/**
* Returns current version of Magento
*/
public function getMagentoVersion(): string
{
return $this->productMetadata->getVersion();
}

/**
* Returns API key
*
Expand Down
14 changes: 0 additions & 14 deletions GraphQL/Resolver/Cart/AvailableIssuersForCart.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,14 @@

class AvailableIssuersForCart implements ResolverInterface
{
/**
* @var Mollie
*/
private $mollieModel;

/**
* @var General
*/
private $mollieHelper;

/**
* @var GetIssuers
*/
private $getIssuers;

public function __construct(
Mollie $mollieModel,
General $mollieHelper,
GetIssuers $getIssuers
) {
$this->mollieModel = $mollieModel;
$this->mollieHelper = $mollieHelper;
$this->getIssuers = $getIssuers;
}

Expand Down
18 changes: 9 additions & 9 deletions Helper/General.php
Original file line number Diff line number Diff line change
Expand Up @@ -555,11 +555,11 @@ public function getPaymentLinkMessage($checkoutUrl, $storeId = null)
/**
* Order Currency and Value array for payment request
*
* @param \Magento\Sales\Model\Order $order
* @param OrderInterface $order
*
* @return array
* @return array{currency: string, value: string}
*/
public function getOrderAmountByOrder($order)
public function getOrderAmountByOrder(OrderInterface $order): array
{
if ($this->useBaseCurrency($order->getStoreId())) {
return $this->getAmountArray($order->getBaseCurrencyCode(), $order->getBaseGrandTotal());
Expand All @@ -579,16 +579,16 @@ public function useBaseCurrency($storeId = 0)
}

/**
* @param $currency
* @param $value
* @param string|null $currency
* @param float|null $value
*
* @return array
* @return array{currency: string, value: string}
*/
public function getAmountArray($currency, $value)
public function getAmountArray(?string $currency, ?float $value): array
{
return [
"currency" => $currency,
"value" => $this->formatCurrencyValue($value, $currency)
'currency' => $currency,
'value' => $this->formatCurrencyValue($value, $currency)
];
}

Expand Down
12 changes: 6 additions & 6 deletions Logger/MollieLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ class MollieLogger extends Logger
public function addInfoLog($type, $data)
{
if (is_array($data)) {
$this->addInfo($type . ': ' . json_encode($data));
$this->addRecord(static::INFO, $type . ': ' . json_encode($data));
} elseif (is_object($data)) {
$this->addInfo($type . ': ' . json_encode($data));
$this->addRecord(static::INFO, $type . ': ' . json_encode($data));
} else {
$this->addInfo($type . ': ' . $data);
$this->addRecord(static::INFO, $type . ': ' . $data);
}
}

Expand All @@ -42,11 +42,11 @@ public function addInfoLog($type, $data)
public function addErrorLog($type, $data)
{
if (is_array($data)) {
$this->addError($type . ': ' . json_encode($data));
$this->addRecord(static::ERROR, $type . ': ' . json_encode($data));
} elseif (is_object($data)) {
$this->addError($type . ': ' . json_encode($data));
$this->addRecord(static::ERROR, $type . ': ' . json_encode($data));
} else {
$this->addError($type . ': ' . $data);
$this->addRecord(static::ERROR, $type . ': ' . $data);
}
}
}
20 changes: 20 additions & 0 deletions Model/Client/OrderProcessorInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
/*
* Copyright Magmodules.eu. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Mollie\Payment\Model\Client;

use Magento\Sales\Api\Data\OrderInterface;
use Mollie\Api\Resources\Order;

interface OrderProcessorInterface
{
public function process(
OrderInterface $magentoOrder,
Order $mollieOrder,
string $type,
ProcessTransactionResponse $response
): ?ProcessTransactionResponse;
}
Loading

0 comments on commit 1f66e7c

Please sign in to comment.