Skip to content

Commit

Permalink
Merge pull request #47 from PrestaShop/dev
Browse files Browse the repository at this point in the history
Release 2.0.1
  • Loading branch information
jolelievre authored Jul 15, 2022
2 parents 7b5be55 + 1695f17 commit 1f80133
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 15 deletions.
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<module>
<name>ps_cashondelivery</name>
<displayName><![CDATA[Cash on delivery (COD)]]></displayName>
<version><![CDATA[2.0.0]]></version>
<version><![CDATA[2.0.1]]></version>
<description><![CDATA[Accept cash payments on delivery to make it easy for customers to purchase on your store.]]></description>
<author><![CDATA[PrestaShop]]></author>
<is_configurable>0</is_configurable>
Expand Down
2 changes: 1 addition & 1 deletion controllers/front/validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function postProcess()
(int) $this->context->cart->id,
(int) Configuration::getGlobalValue(Ps_Cashondelivery::CONFIG_OS_CASH_ON_DELIVERY),
(float) $this->context->cart->getOrderTotal(true, Cart::BOTH),
$this->trans('Cash on delivery', [], 'Modules.Cashondelivery.Shop'),
$this->module->displayName,
null,
[],
(int) $this->context->currency->id,
Expand Down
20 changes: 11 additions & 9 deletions ps_cashondelivery.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
require_once __DIR__ . '/vendor/autoload.php';

use PrestaShop\PrestaShop\Core\Payment\PaymentOption;

if (!defined('_PS_VERSION_')) {
exit;
}

if (file_exists(__DIR__ . '/vendor/autoload.php')) {
require_once __DIR__ . '/vendor/autoload.php';
}

use PrestaShop\PrestaShop\Core\Payment\PaymentOption;

class Ps_Cashondelivery extends PaymentModule
{
const HOOKS = [
Expand All @@ -42,7 +44,7 @@ public function __construct()
$this->name = 'ps_cashondelivery';
$this->tab = 'payments_gateways';
$this->author = 'PrestaShop';
$this->version = '2.0.0';
$this->version = '2.0.1';
$this->need_instance = 1;
$this->ps_versions_compliancy = ['min' => '1.7.6.0', 'max' => _PS_VERSION_];
$this->controllers = ['validation'];
Expand Down Expand Up @@ -98,13 +100,13 @@ public function hookPaymentOptions(array $params)
*/
public function hookDisplayOrderConfirmation(array $params)
{
if (empty($params['order'])) {
return '';
}

/** @var Order $order */
$order = (isset($params['objOrder'])) ? $params['objOrder'] : $params['order'];

if (!Validate::isLoadedObject($order) || $order->module !== $this->name) {
return '';
}

$this->context->smarty->assign([
'shop_name' => $this->context->shop->name,
'total' => $this->context->getCurrentLocale()->formatPrice($params['order']->getOrdersTotalPaid(), (new Currency($params['order']->id_currency))->iso_code),
Expand Down
18 changes: 14 additions & 4 deletions upgrade/upgrade-1.0.7.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,36 @@
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* @author PrestaShop SA and Contributors <[email protected]>
* @author PrestaShop SA <[email protected]>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/

use PrestaShop\PrestaShop\Core\Module\WidgetInterface;

if (!defined('_PS_VERSION_')) {
exit;
}

/**
* @param Ps_Cashondelivery $module
*
* @return bool
*/
function upgrade_module_1_0_7($module)
{
$module->unregisterHook('paymentReturn');
$module->registerHook('displayPaymentReturn');
if (method_exists($module, 'hookDisplayPaymentReturn') || $module instanceof WidgetInterface) {
$module->registerHook('displayPaymentReturn');
}

return true;
}

0 comments on commit 1f80133

Please sign in to comment.