Skip to content

Commit

Permalink
Merge branch 'develop' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksandarBoljanovic committed Mar 4, 2024
2 parents 1e717b4 + 0803527 commit 59b5d96
Show file tree
Hide file tree
Showing 7 changed files with 218 additions and 152 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ Read our [**contribution guidelines**](CONTRIBUTING.md) to find out how.
## Requirements
This plugin supports PrestaShop versions 1.7.5.0 to 8.1.3.

### Current Checkout API version
##### v69
### Current Checkout Component version:
##### 5.31.1

## Documentation
Please find the relevant documentation for
- [How to start with Adyen](https://www.adyen.com/get-started)
Expand Down
47 changes: 31 additions & 16 deletions src/adyenofficial.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function __construct()
{
$this->name = 'adyenofficial';
$this->tab = 'payments_gateways';
$this->version = '5.1.9';
$this->version = '5.1.10';

$this->author = $this->l('Adyen');
$this->need_instance = 0;
Expand Down Expand Up @@ -78,13 +78,15 @@ public function getContext()
public function install(): bool
{
try {
return (
parent::install() &&
$this->getInstaller()->install()
);
} catch (Exception $e) {
\Adyen\Core\Infrastructure\Logger\Logger::logError(
'error ' . $e->getMessage() . ' trace ' . $e->getTraceAsString()
$success = parent::install();
$success && $this->getInstaller()->install();

return $success;
} catch (Throwable $e) {
$this->_errors[] = $e->getMessage();
\PrestaShopLogger::addLog(
'Adyen plugin installation failed. Error: ' . $e->getMessage() . ' . Trace: ' . $e->getTraceAsString(),
\PrestaShopLogger::LOG_SEVERITY_LEVEL_ERROR
);

return false;
Expand All @@ -95,15 +97,24 @@ public function install(): bool
* Handle plugin uninstallation.
*
* @return bool
*
* @throws \Adyen\Core\Infrastructure\ORM\Exceptions\RepositoryClassException
*/
public function uninstall(): bool
{
return (
parent::uninstall() &&
$this->getInstaller()->uninstall()
);
try {
$success = parent::uninstall();
$success && $this->getInstaller()->uninstall();

return $success;
} catch (Throwable $e) {
$this->_errors[] = $e->getMessage();
\PrestaShopLogger::addLog(
'Adyen plugin uninstallation failed. Error: ' . $e->getMessage() . ' . Trace: ' . $e->getTraceAsString(
),
\PrestaShopLogger::LOG_SEVERITY_LEVEL_ERROR
);

return false;
}
}

/**
Expand All @@ -117,8 +128,10 @@ public function uninstall(): bool
public function enable($force_all = false): bool
{
$this->installOverrides();
$success = parent::enable($force_all);
$success && $this->getInstaller()->activateCustomOrderStates();

return parent::enable($force_all) && $this->getInstaller()->activateCustomOrderStates();
return $success;
}

/**
Expand All @@ -132,8 +145,10 @@ public function enable($force_all = false): bool
public function disable($force_all = false): bool
{
$this->uninstallOverrides();
$success = parent::disable($force_all);
$success && $this->getInstaller()->deactivateCustomOrderStates();

return parent::disable($force_all) && $this->getInstaller()->deactivateCustomOrderStates();
return $success;
}

/**
Expand Down
Loading

0 comments on commit 59b5d96

Please sign in to comment.