Skip to content

Commit

Permalink
Merge pull request #229 from mollie/9.4.0
Browse files Browse the repository at this point in the history
9.4.0 -Check failed due to test environment changes. Will update the test files on the next update.
  • Loading branch information
QualityWorks committed Aug 6, 2020
2 parents 09af733 + 22dea8b commit b14c223
Show file tree
Hide file tree
Showing 395 changed files with 38,156 additions and 3,094 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,13 @@

# Changelog #

#### Changes in release 9.4.0
+ Updated mollie API to 2.21.0

#### Changes in release 9.3.2
+ Fixed bug regarding "Custom CSS illegal offset"
+ Fixed fetching incorrect order_id by callback in case of multiple payment attempt

#### Changes in release 9.3.1
+ Updated API to the latest
+ Fixed payment title related bug for pdf invoice pro
Expand Down
15 changes: 11 additions & 4 deletions admin/controller/payment/mollie/base.php
Expand Up @@ -586,8 +586,8 @@ public function index () {
$data['entry_version'] = $this->language->get("entry_version") . " " . MollieHelper::PLUGIN_VERSION;
$data['code'] = $code;
$data['token'] = $this->getTokenUriPart();
$data['update_url'] = $this->getUpdateUrl()['updateUrl'];
$data['text_update'] = sprintf($this->language->get('text_update_message'), $this->getUpdateUrl()['updateVersion'], $data['update_url']);
$data['update_url'] = ($this->getUpdateUrl()) ? $this->getUpdateUrl()['updateUrl'] : '';
$data['text_update'] = ($this->getUpdateUrl()) ? sprintf($this->language->get('text_update_message'), $this->getUpdateUrl()['updateVersion'], $data['update_url']) : '';
$data['geo_zones'] = $modelGeoZone->getGeoZones();
$data['order_statuses'] = $modelOrderStatus->getOrderStatuses();
$data['languages'] = $modelLanguage->getLanguages();
Expand Down Expand Up @@ -677,7 +677,14 @@ public function index () {
$data['stores'][$store['store_id']][$setting_name] = Util::request()->post()->get($store['store_id'] . '_' . $setting_name);
} else { // Otherwise, attempt to get the setting from the database
// same as $this->config->get()
$stored_setting = isset($this->data[$setting_name]) ? $this->data[$setting_name] : null;
$stored_setting = null;
if(isset($this->data[$setting_name])) {
if(!empty($this->data[$setting_name])) {
$stored_setting = $this->data[$setting_name];
} elseif($default_value !== NULL) {
$stored_setting = $default_value;
}
}

if($stored_setting === NULL && $default_value !== NULL) {
$data['stores'][$store['store_id']][$setting_name] = $default_value;
Expand Down Expand Up @@ -967,7 +974,7 @@ public function saveAppData() {
private function getUpdateUrl() {
$client = new mollieHttpClient();
$info = $client->get(MOLLIE_VERSION_URL);
if ($info["tag_name"] && $info["tag_name"] != MOLLIE_VERSION && version_compare(MOLLIE_VERSION, $info["tag_name"], "<")) {
if (isset($info["tag_name"]) && ($info["tag_name"] != MOLLIE_VERSION) && version_compare(MOLLIE_VERSION, $info["tag_name"], "<")) {
$updateUrl = array(
"updateUrl" => Util::url()->link("payment/mollie_" . static::MODULE_NAME . "/update"),
"updateVersion" => $info["tag_name"]
Expand Down
Expand Up @@ -3,45 +3,57 @@
namespace Mollie\Api;

use Mollie\Api\Exceptions\IncompatiblePlatform;

class CompatibilityChecker
{
/**
* @var string
*/
const MIN_PHP_VERSION = "5.6.0";

/**
* @throws IncompatiblePlatform
* @return void
*/
public function checkCompatibility()
{
if (!$this->satisfiesPhpVersion()) {
throw new \Mollie\Api\Exceptions\IncompatiblePlatform("The client requires PHP version >= " . self::MIN_PHP_VERSION . ", you have " . \PHP_VERSION . ".", \Mollie\Api\Exceptions\IncompatiblePlatform::INCOMPATIBLE_PHP_VERSION);
throw new IncompatiblePlatform(
"The client requires PHP version >= " . self::MIN_PHP_VERSION . ", you have " . PHP_VERSION . ".",
IncompatiblePlatform::INCOMPATIBLE_PHP_VERSION
);
}

if (!$this->satisfiesJsonExtension()) {
throw new \Mollie\Api\Exceptions\IncompatiblePlatform("PHP extension json is not enabled. Please make sure to enable 'json' in your PHP configuration.", \Mollie\Api\Exceptions\IncompatiblePlatform::INCOMPATIBLE_JSON_EXTENSION);
throw new IncompatiblePlatform(
"PHP extension json is not enabled. Please make sure to enable 'json' in your PHP configuration.",
IncompatiblePlatform::INCOMPATIBLE_JSON_EXTENSION
);
}
}

/**
* @return bool
* @codeCoverageIgnore
*/
public function satisfiesPhpVersion()
{
return (bool) \version_compare(\PHP_VERSION, self::MIN_PHP_VERSION, ">=");
return (bool)version_compare(PHP_VERSION, self::MIN_PHP_VERSION, ">=");
}

/**
* @return bool
* @codeCoverageIgnore
*/
public function satisfiesJsonExtension()
{
// Check by extension_loaded
if (\function_exists('extension_loaded') && \extension_loaded('json')) {
return \true;
} elseif (\function_exists('json_encode')) {
return \true;
if (function_exists('extension_loaded') && extension_loaded('json')) {
return true;
} elseif (function_exists('json_encode')) {
return true;
}
return \false;

return false;
}
}
Expand Up @@ -5,18 +5,21 @@
use Mollie\Api\Exceptions\ApiException;
use Mollie\Api\Resources\Chargeback;
use Mollie\Api\Resources\ChargebackCollection;
class ChargebackEndpoint extends \Mollie\Api\Endpoints\CollectionEndpointAbstract

class ChargebackEndpoint extends CollectionEndpointAbstract
{
protected $resourcePath = "chargebacks";

/**
* Get the object that is used by this API endpoint. Every API endpoint uses one type of object.
*
* @return Chargeback
*/
protected function getResourceObject()
{
return new \Mollie\Api\Resources\Chargeback($this->client);
return new Chargeback($this->client);
}

/**
* Get the collection object that is used by this API endpoint. Every API endpoint uses one type of collection object.
*
Expand All @@ -27,8 +30,9 @@ protected function getResourceObject()
*/
protected function getResourceCollectionObject($count, $_links)
{
return new \Mollie\Api\Resources\ChargebackCollection($this->client, $count, $_links);
return new ChargebackCollection($this->client, $count, $_links);
}

/**
* Retrieves a collection of Chargebacks from Mollie.
*
Expand Down
Expand Up @@ -3,7 +3,8 @@
namespace Mollie\Api\Endpoints;

use Mollie\Api\Resources\BaseCollection;
abstract class CollectionEndpointAbstract extends \Mollie\Api\Endpoints\EndpointAbstract

abstract class CollectionEndpointAbstract extends EndpointAbstract
{
/**
* Get the collection object that is used by this API endpoint. Every API endpoint uses one type of collection object.
Expand All @@ -13,5 +14,5 @@ abstract class CollectionEndpointAbstract extends \Mollie\Api\Endpoints\Endpoint
*
* @return BaseCollection
*/
protected abstract function getResourceCollectionObject($count, $_links);
abstract protected function getResourceCollectionObject($count, $_links);
}
Expand Up @@ -5,18 +5,21 @@
use Mollie\Api\Exceptions\ApiException;
use Mollie\Api\Resources\Customer;
use Mollie\Api\Resources\CustomerCollection;
class CustomerEndpoint extends \Mollie\Api\Endpoints\CollectionEndpointAbstract

class CustomerEndpoint extends CollectionEndpointAbstract
{
protected $resourcePath = "customers";

/**
* Get the object that is used by this API endpoint. Every API endpoint uses one type of object.
*
* @return Customer
*/
protected function getResourceObject()
{
return new \Mollie\Api\Resources\Customer($this->client);
return new Customer($this->client);
}

/**
* Get the collection object that is used by this API endpoint. Every API endpoint uses one type of collection object.
*
Expand All @@ -27,8 +30,9 @@ protected function getResourceObject()
*/
protected function getResourceCollectionObject($count, $_links)
{
return new \Mollie\Api\Resources\CustomerCollection($this->client, $count, $_links);
return new CustomerCollection($this->client, $count, $_links);
}

/**
* Creates a customer in Mollie.
*
Expand All @@ -42,6 +46,7 @@ public function create(array $data = [], array $filters = [])
{
return $this->rest_create($data, $filters);
}

/**
* Retrieve a single customer from Mollie.
*
Expand All @@ -56,6 +61,7 @@ public function get($customerId, array $parameters = [])
{
return $this->rest_read($customerId, $parameters);
}

/**
* Deletes the given Customer.
*
Expand All @@ -72,6 +78,7 @@ public function delete($customerId, array $data = [])
{
return $this->rest_delete($customerId, $data);
}

/**
* Retrieves a collection of Customers from Mollie.
*
Expand Down
Expand Up @@ -5,18 +5,21 @@
use Mollie\Api\Resources\Customer;
use Mollie\Api\Resources\Payment;
use Mollie\Api\Resources\PaymentCollection;
class CustomerPaymentsEndpoint extends \Mollie\Api\Endpoints\CollectionEndpointAbstract

class CustomerPaymentsEndpoint extends CollectionEndpointAbstract
{
protected $resourcePath = "customers_payments";

/**
* Get the object that is used by this API endpoint. Every API endpoint uses one type of object.
*
* @return Payment
*/
protected function getResourceObject()
{
return new \Mollie\Api\Resources\Payment($this->client);
return new Payment($this->client);
}

/**
* Get the collection object that is used by this API endpoint. Every API endpoint uses one type of collection object.
*
Expand All @@ -27,8 +30,9 @@ protected function getResourceObject()
*/
protected function getResourceCollectionObject($count, $_links)
{
return new \Mollie\Api\Resources\PaymentCollection($this->client, $count, $_links);
return new PaymentCollection($this->client, $count, $_links);
}

/**
* Create a subscription for a Customer
*
Expand All @@ -39,10 +43,11 @@ protected function getResourceCollectionObject($count, $_links)
* @return Payment
* @throws \Mollie\Api\Exceptions\ApiException
*/
public function createFor(\Mollie\Api\Resources\Customer $customer, array $options = [], array $filters = [])
public function createFor(Customer $customer, array $options = [], array $filters = [])
{
return $this->createForId($customer->id, $options, $filters);
}

/**
* Create a subscription for a Customer ID
*
Expand All @@ -56,8 +61,10 @@ public function createFor(\Mollie\Api\Resources\Customer $customer, array $optio
public function createForId($customerId, array $options = [], array $filters = [])
{
$this->parentId = $customerId;

return parent::rest_create($options, $filters);
}

/**
* @param Customer $customer
* @param string $from The first resource ID you want to include in your list.
Expand All @@ -67,10 +74,11 @@ public function createForId($customerId, array $options = [], array $filters = [
* @return PaymentCollection
* @throws \Mollie\Api\Exceptions\ApiException
*/
public function listFor(\Mollie\Api\Resources\Customer $customer, $from = null, $limit = null, array $parameters = [])
public function listFor(Customer $customer, $from = null, $limit = null, array $parameters = [])
{
return $this->listForId($customer->id, $from, $limit, $parameters);
}

/**
* @param string $customerId
* @param string $from The first resource ID you want to include in your list.
Expand All @@ -83,6 +91,7 @@ public function listFor(\Mollie\Api\Resources\Customer $customer, $from = null,
public function listForId($customerId, $from = null, $limit = null, array $parameters = [])
{
$this->parentId = $customerId;

return parent::rest_list($from, $limit, $parameters);
}
}

0 comments on commit b14c223

Please sign in to comment.