diff --git a/README.md b/README.md index 9f1ca74..09dcd24 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ This repository contains the PrestaShop wallee payment module that enables the s ## Documentation -* [English](https://plugin-documentation.wallee.com/wallee-payment/prestashop-1.6/1.2.35/docs/en/documentation.html) +* [English](https://plugin-documentation.wallee.com/wallee-payment/prestashop-1.6/1.2.38/docs/en/documentation.html) ## Support @@ -23,7 +23,7 @@ Support queries can be issued on the [wallee support site](https://app-wallee.co ## License -Please see the [license file](https://github.com/wallee-payment/prestashop-1.6/blob/1.2.35/LICENSE) for more information. +Please see the [license file](https://github.com/wallee-payment/prestashop-1.6/blob/1.2.38/LICENSE) for more information. ## Other PrestaShop Versions diff --git a/docs/en/documentation.html b/docs/en/documentation.html index a6fa8f6..2ef654e 100644 --- a/docs/en/documentation.html +++ b/docs/en/documentation.html @@ -22,7 +22,7 @@

Documentation

  • - + Source
  • @@ -54,7 +54,7 @@

    1. -

      Download the module.

      +

      Download the module.

    2. Login to the backend of your PrestsShop store.

      diff --git a/inc/Backend/Defaultstrategy.php b/inc/Backend/Defaultstrategy.php index c648ff4..06934b7 100644 --- a/inc/Backend/Defaultstrategy.php +++ b/inc/Backend/Defaultstrategy.php @@ -1019,7 +1019,10 @@ public function getRefundTotal(array $parsedData) public function isVoucherOnlyWallee(Order $order, array $postData) { - return WalleeVersionadapter::isVoucherOnlyWallee($postData); + if (method_exists('WalleeVersionadapter', 'isVoucherOnlyWallee')) { + return WalleeVersionadapter::isVoucherOnlyWallee($postData); + } + return FALSE; } public function isCancelRequest(Order $order, array $postData) diff --git a/inc/Basemodule.php b/inc/Basemodule.php index 9875c05..dd4e1de 100644 --- a/inc/Basemodule.php +++ b/inc/Basemodule.php @@ -150,7 +150,7 @@ public static function installHooks(Wallee $module) $module->registerHook('displayAdminOrderMain') && $module->registerHook('displayAdminOrderTabLink') && $module->registerHook('displayBackOfficeHeader') && $module->registerHook('displayOrderDetail') && $module->registerHook('actionProductCancel') && $module->registerHook('walleeSettingsChanged') && - $module->registerHook('actionAfterUpdateCancelProductFormHandler'); + $module->registerHook('actionOrderSlipAdd'); } public static function installConfigurationValues() @@ -1843,7 +1843,7 @@ public static function hookDisplayBackOfficeHeader(Wallee $module, $params) } self::handleVoucherAddRequest($module); self::handleVoucherDeleteRequest($module); - // self::handleRefundRequest($module); + self::handleRefundRequest($module); self::handleCancelProductRequest($module); } diff --git a/inc/Exception/Incompleteconfig.php b/inc/Exception/Incompleteconfig.php index ac8058d..a4df093 100644 --- a/inc/Exception/Incompleteconfig.php +++ b/inc/Exception/Incompleteconfig.php @@ -24,7 +24,7 @@ class WalleeExceptionIncompleteconfig extends Exception * @param Throwable|null $previous * The previously thrown exception. */ - public function __construct($message = "The configuration is not complete", int $code = 0, ?Throwable $previous = null) { + public function __construct($message = "The configuration is not complete", $code = 0, Throwable $previous = null) { parent::__construct($message, $code, $previous); } } diff --git a/inc/Helper.php b/inc/Helper.php index 4cc9d7f..9d76a36 100644 --- a/inc/Helper.php +++ b/inc/Helper.php @@ -11,9 +11,9 @@ class WalleeHelper { - public const SHOP_SYSTEM = 'x-meta-shop-system'; - public const SHOP_SYSTEM_VERSION = 'x-meta-shop-system-version'; - public const SHOP_SYSTEM_AND_VERSION = 'x-meta-shop-system-and-version'; + protected static $shop_system = 'x-meta-shop-system'; + protected static $shop_system_version = 'x-meta-shop-system-version'; + protected static $shop_system_and_version = 'x-meta-shop-system-and-version'; private static $apiClient; @@ -675,11 +675,18 @@ public static function getMaxExecutionTime() protected static function getDefaultHeaderData() { $shop_version = _PS_VERSION_; - [$major_version, $minor_version, $_] = explode('.', $shop_version, 3); + $version_array = explode('.', $shop_version, 3); + if (count($version_array) < 2) { + // The format in _PS_VERSION_ has changed and it's unknown to us. + return []; + + } + $major_version = current($version_array); + $minor_version = next($version_array); return [ - self::SHOP_SYSTEM => 'prestashop', - self::SHOP_SYSTEM_VERSION => $shop_version, - self::SHOP_SYSTEM_AND_VERSION => 'prestashop-' . $major_version . '.' . $minor_version, + self::$shop_system => 'prestashop', + self::$shop_system_version => $shop_version, + self::$shop_system_and_version => 'prestashop-' . $major_version . '.' . $minor_version, ]; } } diff --git a/inc/Service/Refund.php b/inc/Service/Refund.php index 8a91dbe..217115d 100644 --- a/inc/Service/Refund.php +++ b/inc/Service/Refund.php @@ -47,16 +47,6 @@ public function getRefundByExternalId($spaceId, $externalId) } } - /** - * Executes the refund, saving it in the database (via database transaction) - * and then sending the refund information to the portal. - * - * @param Order $order - * @param array $parsedParameters - * @return void - * - * @see hookActionProductCancel - */ public function executeRefund(Order $order, array $parsedParameters) { $currentRefundJob = null; @@ -187,15 +177,6 @@ protected function sendRefund($refundJobId) } } - /** - * This functionality is called from a webhook, triggered by the portal. - * Updates the status of the order in the shop. - * - * @param [type] $refundJobId - * @return void - * - * @see WalleeWebhookRefund::process - */ public function applyRefundToShop($refundJobId) { $refundJob = new WalleeModelRefundjob($refundJobId); diff --git a/inc/Service/Token.php b/inc/Service/Token.php index e5e9514..4ea47e4 100644 --- a/inc/Service/Token.php +++ b/inc/Service/Token.php @@ -79,7 +79,11 @@ protected function updateInfo($spaceId, \Wallee\Sdk\Model\TokenVersion $tokenVer ->getCustomerId()); $info->setName($tokenVersion->getName()); - $info->setPaymentMethodId( + if ($tokenVersion->getPaymentConnectorConfiguration() === null) { + return; + } + + $info->setPaymentMethodId( $tokenVersion->getPaymentConnectorConfiguration() ->getPaymentMethodConfiguration() ->getId() diff --git a/inc/Versionadapter.php b/inc/Versionadapter.php index 2d08f58..0930a09 100644 --- a/inc/Versionadapter.php +++ b/inc/Versionadapter.php @@ -29,4 +29,15 @@ public static function getAdminOrderTemplate() { return 'views/templates/admin/hook/admin_order.tpl'; } + + /** + * Returns true if the refund is only voucher, not required to be sent to Wallee. + * + * @param [] $postData + * @return boolean + */ + public static function isVoucherOnlyWallee($postData) + { + return isset($postData['generateDiscountRefund']) && ! isset($postData['wallee_offline']); + } } diff --git a/views/templates/admin/admin_help_buttons.tpl b/views/templates/admin/admin_help_buttons.tpl index ba88c87..6cdcd3d 100644 --- a/views/templates/admin/admin_help_buttons.tpl +++ b/views/templates/admin/admin_help_buttons.tpl @@ -10,5 +10,5 @@ \ No newline at end of file diff --git a/wallee.php b/wallee.php index 79b15a6..8d8b911 100644 --- a/wallee.php +++ b/wallee.php @@ -34,7 +34,7 @@ public function __construct() $this->author = 'Customweb GmbH'; $this->bootstrap = true; $this->need_instance = 0; - $this->version = '1.2.35'; + $this->version = '1.2.38'; $this->displayName = 'wallee'; $this->description = $this->l('This PrestaShop module enables to process payments with %s.'); $this->description = sprintf($this->description, 'wallee');