MAJ Module Paypal vers 5.1.1 (comme en prod)
This commit is contained in:
@@ -18,10 +18,11 @@
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2019 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
* @author 2007-2019 PayPal
|
||||
* @author 202 ecommerce <tech@202-ecommerce.com>
|
||||
* @copyright PayPal
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PaypalPPBTlib;
|
||||
@@ -70,10 +71,10 @@ abstract class AbstractMethod
|
||||
|
||||
/**
|
||||
* Refund settled transaction
|
||||
* @param $orderPayPal PaypalOrder object
|
||||
* @param $orderPaypal PaypalOrder object
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function refund($orderPayPal);
|
||||
abstract public function refund($orderPaypal);
|
||||
|
||||
/**
|
||||
* Update configuration (postProcess)
|
||||
@@ -91,10 +92,10 @@ abstract class AbstractMethod
|
||||
|
||||
/**
|
||||
* Void authorized transaction (cancel payment)
|
||||
* @param $orderPayPal PaypalOrder object
|
||||
* @param $orderPaypal PaypalOrder object
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function void($orderPayPal);
|
||||
abstract public function void($orderPaypal);
|
||||
|
||||
/**
|
||||
* @param $params array hookActionOrderSlipAdd parameters
|
||||
@@ -133,9 +134,8 @@ abstract class AbstractMethod
|
||||
|
||||
/**
|
||||
* Get link to transaction
|
||||
* @param string $id_transaction
|
||||
* @param bool $sandbox mode (sandbox/live)
|
||||
* @param \PaypalLog $log
|
||||
* @return string
|
||||
*/
|
||||
abstract public function getLinkToTransaction($id_transaction, $sandbox);
|
||||
abstract public function getLinkToTransaction($log);
|
||||
}
|
||||
|
||||
@@ -18,10 +18,11 @@
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2019 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
* @author 2007-2019 PayPal
|
||||
* @author 202 ecommerce <tech@202-ecommerce.com>
|
||||
* @copyright PayPal
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PaypalPPBTlib;
|
||||
@@ -56,21 +57,30 @@ abstract class CommonAbstarctModuleFrontController extends ModuleFrontController
|
||||
{
|
||||
$this->init();
|
||||
if ($this->checkAccess()) {
|
||||
// postProcess handles ajaxProcess
|
||||
$this->postProcess();
|
||||
if ($this->ajax) {
|
||||
$this->ajaxProcess();
|
||||
} else {
|
||||
$this->postProcess();
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($this->errors) == false) {
|
||||
$message = '';
|
||||
if (isset($this->errors['error_code'])) {
|
||||
$message .= 'Error code: ' . $this->errors['error_code'] . '.';
|
||||
$message .= 'Error code: ' . $this->errors['error_code'] . ';';
|
||||
}
|
||||
if (isset($this->errors['error_msg']) && $this->errors['error_msg']) {
|
||||
$message .= 'Short message: ' . $this->errors['error_msg'] . '.';
|
||||
}
|
||||
if (isset($this->errors['msg_long']) && $this->errors['msg_long']) {
|
||||
$message .= 'Long message: ' . $this->errors['msg_long'] . '.';
|
||||
|
||||
if (isset($this->errors['logger_msg'])) {
|
||||
$message .= 'Short message: ' . $this->errors['logger_msg'] . ';';
|
||||
} else {
|
||||
if (isset($this->errors['error_msg']) && $this->errors['error_msg']) {
|
||||
$message .= 'Short message: ' . $this->errors['error_msg'] . ';';
|
||||
}
|
||||
if (isset($this->errors['msg_long']) && $this->errors['msg_long']) {
|
||||
$message .= 'Long message: ' . $this->errors['msg_long'] . ';';
|
||||
}
|
||||
}
|
||||
|
||||
ProcessLoggerHandler::openLogger();
|
||||
ProcessLoggerHandler::logError(
|
||||
$message,
|
||||
@@ -86,11 +96,35 @@ abstract class CommonAbstarctModuleFrontController extends ModuleFrontController
|
||||
}
|
||||
|
||||
if (!empty($this->redirectUrl)) {
|
||||
\Tools::redirect($this->redirectUrl);
|
||||
$this->redirectWithNotifications($this->redirectUrl);
|
||||
}
|
||||
if (!empty($this->jsonValues)) {
|
||||
$response = new JsonResponse($this->jsonValues);
|
||||
return $response->send();
|
||||
}
|
||||
}
|
||||
|
||||
public function init()
|
||||
{
|
||||
parent::init();
|
||||
|
||||
if (\Tools::getValue('ajax')) {
|
||||
$this->ajax = true;
|
||||
} else {
|
||||
$this->ajax = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function ajaxProcess()
|
||||
{
|
||||
if (\Tools::isSubmit('action') == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$method = 'displayAjax' . \Tools::getValue('action');
|
||||
|
||||
if (method_exists($this, $method)) {
|
||||
return call_user_func(array($this, $method));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
* ...........................................................................
|
||||
*
|
||||
* @author 202-ecommerce <tech@202-ecommerce.com>
|
||||
* @copyright Copyright (c) 202-ecommerce
|
||||
* @license Commercial license
|
||||
* @copyright PayPal
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* @version develop
|
||||
*/
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
* ...........................................................................
|
||||
*
|
||||
* @author 202-ecommerce <tech@202-ecommerce.com>
|
||||
* @copyright Copyright (c) 202-ecommerce
|
||||
* @license Commercial license
|
||||
* @copyright PayPal
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* @version develop
|
||||
*/
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
* ...........................................................................
|
||||
*
|
||||
* @author 202-ecommerce <tech@202-ecommerce.com>
|
||||
* @copyright Copyright (c) 202-ecommerce
|
||||
* @license Commercial license
|
||||
* @copyright PayPal
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* @version develop
|
||||
*/
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
* ...........................................................................
|
||||
*
|
||||
* @author 202-ecommerce <tech@202-ecommerce.com>
|
||||
* @copyright Copyright (c) 202-ecommerce
|
||||
* @license Commercial license
|
||||
* @copyright PayPal
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* @version develop
|
||||
*/
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
* ...........................................................................
|
||||
*
|
||||
* @author 202-ecommerce <tech@202-ecommerce.com>
|
||||
* @copyright Copyright (c) 202-ecommerce
|
||||
* @license Commercial license
|
||||
* @copyright PayPal
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* @version develop
|
||||
*/
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
* ...........................................................................
|
||||
*
|
||||
* @author 202-ecommerce <tech@202-ecommerce.com>
|
||||
* @copyright Copyright (c) 202-ecommerce
|
||||
* @license Commercial license
|
||||
* @copyright PayPal
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* @version develop
|
||||
*/
|
||||
|
||||
|
||||
@@ -18,10 +18,11 @@
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2019 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
* @author 2007-2019 PayPal
|
||||
* @author 202 ecommerce <tech@202-ecommerce.com>
|
||||
* @copyright PayPal
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
*
|
||||
*/
|
||||
namespace PaypalPPBTlib\Extensions;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
*
|
||||
* @author 202-ecommerce <tech@202-ecommerce.com>
|
||||
* @copyright Copyright (c) 202-ecommerce
|
||||
* @license Commercial license
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* @version develop
|
||||
*/
|
||||
|
||||
@@ -123,7 +123,7 @@ class ProcessLoggerObjectModel extends ObjectModel
|
||||
|
||||
public function getDateTransaction()
|
||||
{
|
||||
if ($this->date_transaction == '0000-00-00 00:00:00') {
|
||||
if ($this->date_transaction == '0000-00-00 00:00:00' || $this->date_transaction == false) {
|
||||
return '';
|
||||
}
|
||||
$datetime1 = new \DateTime($this->date_transaction);
|
||||
@@ -137,10 +137,16 @@ class ProcessLoggerObjectModel extends ObjectModel
|
||||
}
|
||||
if ($diff == 0) {
|
||||
$diff = 'GMT';
|
||||
} elseif ($diff > 0) {
|
||||
$diff = "+" . $diff;
|
||||
}
|
||||
$dateTimeZone = new \DateTimeZone($diff);
|
||||
|
||||
$date = new \DateTime($this->date_transaction, $dateTimeZone);
|
||||
return $date->format('Y-m-d H:i:s T');
|
||||
try {
|
||||
$dateTimeZone = new \DateTimeZone($diff);
|
||||
$date = new \DateTime($this->date_transaction, $dateTimeZone);
|
||||
return $date->format('Y-m-d H:i:s T');
|
||||
} catch (\Exception $e) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
*
|
||||
* @author 202-ecommerce <tech@202-ecommerce.com>
|
||||
* @copyright Copyright (c) 202-ecommerce
|
||||
* @license Commercial license
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* @version develop
|
||||
*/
|
||||
|
||||
@@ -71,10 +71,7 @@ class AdminProcessLoggerController extends \ModuleAdminController
|
||||
$this->bulk_actions = array(
|
||||
'delete' => array(
|
||||
'text' => $this->module->l('Delete selected', 'AdminProcessLoggerController'),
|
||||
'confirm' => $this->module->l(
|
||||
'Would you like to delete the selected items?',
|
||||
'AdminProcessLoggerController'
|
||||
),
|
||||
'confirm' => $this->module->l('Would you like to delete the selected items?', 'AdminProcessLoggerController'),
|
||||
)
|
||||
);
|
||||
|
||||
@@ -131,34 +128,21 @@ class AdminProcessLoggerController extends \ModuleAdminController
|
||||
'processLogger' => array(
|
||||
'image' => '../img/admin/cog.gif',
|
||||
'title' => $this->module->l('Process Logger Settings', 'AdminProcessLoggerController'),
|
||||
'description' => $this->module->l(
|
||||
'Here you can change the default configuration for this Process Logger',
|
||||
'AdminProcessLoggerController'
|
||||
'description' => $this->module->l('Here you can change the default configuration for this Process Logger', 'AdminProcessLoggerController'),
|
||||
'info' => $this->module->displayWarning(
|
||||
$this->module->l('Logs with order ID will not be erased.', 'AdminProcessLoggerController')
|
||||
),
|
||||
'info' => \Context::getContext()->smarty->fetch(_PS_MODULE_DIR_ . 'paypal/views/templates/admin/_partials/helperOptionInfo.tpl'),
|
||||
'fields' => array(
|
||||
'PAYPAL_EXTLOGS_ERASING_DISABLED' => array(
|
||||
'title' => $this->module->l(
|
||||
'Disable auto erasing',
|
||||
'AdminProcessLoggerController'
|
||||
),
|
||||
'hint' => $this->module->l(
|
||||
'If disabled, logs will be automatically erased after the delay',
|
||||
'AdminProcessLoggerController'
|
||||
),
|
||||
'title' => $this->module->l('Disable auto erasing', 'AdminProcessLoggerController'),
|
||||
'hint' => $this->module->l('If disabled, logs will be automatically erased after the delay', 'AdminProcessLoggerController'),
|
||||
'validation' => 'isBool',
|
||||
'cast' => 'intval',
|
||||
'type' => 'bool',
|
||||
),
|
||||
'PAYPAL_EXTLOGS_ERASING_DAYSMAX' => array(
|
||||
'title' => $this->module->l(
|
||||
'Auto erasing delay (in days)',
|
||||
'AdminProcessLoggerController'
|
||||
),
|
||||
'hint' => $this->module->l(
|
||||
'Choose the number of days you want to keep logs in database',
|
||||
'AdminProcessLoggerController'
|
||||
),
|
||||
'title' => $this->module->l('Auto erasing delay (in days)', 'AdminProcessLoggerController'),
|
||||
'hint' => $this->module->l('Choose the number of days you want to keep logs in database', 'AdminProcessLoggerController'),
|
||||
'validation' => 'isInt',
|
||||
'cast' => 'intval',
|
||||
'type' => 'text',
|
||||
@@ -302,7 +286,7 @@ class AdminProcessLoggerController extends \ModuleAdminController
|
||||
$result = Db::getInstance()->delete($this->table);
|
||||
|
||||
if ($result) {
|
||||
$this->confirmations[] = $this->module->l('All logs has been erased', 'AdminProcessLoggerController');
|
||||
$this->confirmations[] = $this->module->l('All logs have been erased', 'AdminProcessLoggerController');
|
||||
}
|
||||
|
||||
return $result;
|
||||
@@ -334,9 +318,7 @@ class AdminProcessLoggerController extends \ModuleAdminController
|
||||
|
||||
if (!is_numeric($extlogs_erasing_daysmax)) {
|
||||
$this->errors[] = $this->module->l(
|
||||
'You must specify a valid \"Auto erasing delay (in days)\" number.',
|
||||
'AdminProcessLoggerController'
|
||||
);
|
||||
'You must specify a valid \"Auto erasing delay (in days)\" number.', 'AdminProcessLoggerController');
|
||||
} else {
|
||||
\Configuration::updateValue(
|
||||
'PAYPAL_EXTLOGS_ERASING_DAYSMAX',
|
||||
@@ -345,10 +327,7 @@ class AdminProcessLoggerController extends \ModuleAdminController
|
||||
null,
|
||||
$shop['id_shop']
|
||||
);
|
||||
$this->confirmations[] = $this->module->l(
|
||||
'Log parameters are successfully updated!',
|
||||
'AdminProcessLoggerController'
|
||||
);
|
||||
$this->confirmations[] = $this->module->l('Successful update.', 'AdminProcessLoggerController');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
*
|
||||
* @author 202-ecommerce <tech@202-ecommerce.com>
|
||||
* @copyright Copyright (c) 202-ecommerce
|
||||
* @license Commercial license
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* @version develop
|
||||
*/
|
||||
namespace PaypalPPBTlib\Extensions\ProcessLogger;
|
||||
@@ -64,7 +64,7 @@ class ProcessLoggerExtension extends AbstractModuleExtension
|
||||
$class_logger = ProcessLoggerObjectModel::class;
|
||||
}
|
||||
$collectionLogs = new \PrestaShopCollection($class_logger);
|
||||
$collectionLogs->where('id_order', '=', $params['order']->id);
|
||||
$collectionLogs->where('id_cart', '=', $params['order']->id_cart);
|
||||
\Context::getContext()->smarty->assign('logs', $collectionLogs->getResults());
|
||||
return \Context::getContext()->smarty->fetch(_PS_MODULE_DIR_ . 'paypal/views/templates/hook/displayAdminOrderContentOrder.tpl');
|
||||
}
|
||||
@@ -85,7 +85,7 @@ class ProcessLoggerExtension extends AbstractModuleExtension
|
||||
/** @var $cart Cart */
|
||||
$cart = $params['cart'];
|
||||
$order = new \Order((int)\Order::getIdByCartId($cart->id));
|
||||
if ($order->module != 'paypal') {
|
||||
if (\Validate::isLoadedObject($order) && $order->module != 'paypal') {
|
||||
return;
|
||||
}
|
||||
if (isset($params['class_logger']) && is_subclass_of($params['class_logger'], ProcessLoggerObjectModel::class)) {
|
||||
@@ -95,6 +95,11 @@ class ProcessLoggerExtension extends AbstractModuleExtension
|
||||
}
|
||||
$collectionLogs = new \PrestaShopCollection($class_logger);
|
||||
$collectionLogs->where('id_cart', '=', $params['cart']->id);
|
||||
|
||||
if ($collectionLogs->count() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
\Context::getContext()->smarty->assign('logs', $collectionLogs->getResults());
|
||||
return \Context::getContext()->smarty->fetch(_PS_MODULE_DIR_ . 'paypal/views/templates/hook/displayAdminCartsView.tpl');
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
* ...........................................................................
|
||||
*
|
||||
* @author 202-ecommerce <tech@202-ecommerce.com>
|
||||
* @copyright Copyright (c) 202-ecommerce
|
||||
* @license Commercial license
|
||||
* @copyright PayPal
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* @version develop
|
||||
*/
|
||||
|
||||
|
||||
@@ -18,10 +18,11 @@
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2019 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
* @author 2007-2019 PayPal
|
||||
* @author 202 ecommerce <tech@202-ecommerce.com>
|
||||
* @copyright PayPal
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PaypalPPBTlib\Install;
|
||||
|
||||
@@ -18,10 +18,11 @@
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2019 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
* @author 2007-2019 PayPal
|
||||
* @author 202 ecommerce <tech@202-ecommerce.com>
|
||||
* @copyright PayPal
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PaypalPPBTlib\Install;
|
||||
|
||||
@@ -18,10 +18,11 @@
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2019 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
* @author 2007-2019 PayPal
|
||||
* @author 202 ecommerce <tech@202-ecommerce.com>
|
||||
* @copyright PayPal
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PaypalPPBTlib\Install;
|
||||
|
||||
Reference in New Issue
Block a user