*/
-class MercurialProcessor
+class MercurialProcessor implements ProcessorInterface
{
private $level;
private static $cache;
diff --git a/lib/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php b/lib/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php
index 9d3f559..66b80fb 100644
--- a/lib/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php
+++ b/lib/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php
@@ -16,7 +16,7 @@
*
* @author Andreas Hörnicke
*/
-class ProcessIdProcessor
+class ProcessIdProcessor implements ProcessorInterface
{
/**
* @param array $record
diff --git a/lib/monolog/monolog/src/Monolog/Processor/ProcessorInterface.php b/lib/monolog/monolog/src/Monolog/Processor/ProcessorInterface.php
new file mode 100644
index 0000000..7e64d4d
--- /dev/null
+++ b/lib/monolog/monolog/src/Monolog/Processor/ProcessorInterface.php
@@ -0,0 +1,25 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Processor;
+
+/**
+ * An optional interface to allow labelling Monolog processors.
+ *
+ * @author Nicolas Grekas
+ */
+interface ProcessorInterface
+{
+ /**
+ * @return array The processed records
+ */
+ public function __invoke(array $records);
+}
diff --git a/lib/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php b/lib/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php
index c2686ce..0088505 100644
--- a/lib/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php
+++ b/lib/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php
@@ -11,6 +11,8 @@
namespace Monolog\Processor;
+use Monolog\Utils;
+
/**
* Processes a record's message according to PSR-3 rules
*
@@ -18,7 +20,7 @@
*
* @author Jordi Boggiano
*/
-class PsrLogMessageProcessor
+class PsrLogMessageProcessor implements ProcessorInterface
{
/**
* @param array $record
@@ -35,7 +37,7 @@ public function __invoke(array $record)
if (is_null($val) || is_scalar($val) || (is_object($val) && method_exists($val, "__toString"))) {
$replacements['{'.$key.'}'] = $val;
} elseif (is_object($val)) {
- $replacements['{'.$key.'}'] = '[object '.get_class($val).']';
+ $replacements['{'.$key.'}'] = '[object '.Utils::getClass($val).']';
} else {
$replacements['{'.$key.'}'] = '['.gettype($val).']';
}
diff --git a/lib/monolog/monolog/src/Monolog/Processor/TagProcessor.php b/lib/monolog/monolog/src/Monolog/Processor/TagProcessor.php
index 7e2df2a..615a4d9 100644
--- a/lib/monolog/monolog/src/Monolog/Processor/TagProcessor.php
+++ b/lib/monolog/monolog/src/Monolog/Processor/TagProcessor.php
@@ -16,7 +16,7 @@
*
* @author Martijn Riemers
*/
-class TagProcessor
+class TagProcessor implements ProcessorInterface
{
private $tags;
diff --git a/lib/monolog/monolog/src/Monolog/Processor/UidProcessor.php b/lib/monolog/monolog/src/Monolog/Processor/UidProcessor.php
index 812707c..d1f708c 100644
--- a/lib/monolog/monolog/src/Monolog/Processor/UidProcessor.php
+++ b/lib/monolog/monolog/src/Monolog/Processor/UidProcessor.php
@@ -11,12 +11,14 @@
namespace Monolog\Processor;
+use Monolog\ResettableInterface;
+
/**
* Adds a unique identifier into records
*
* @author Simon Mönch
*/
-class UidProcessor
+class UidProcessor implements ProcessorInterface, ResettableInterface
{
private $uid;
@@ -26,7 +28,8 @@ public function __construct($length = 7)
throw new \InvalidArgumentException('The uid length must be an integer between 1 and 32');
}
- $this->uid = substr(hash('md5', uniqid('', true)), 0, $length);
+
+ $this->uid = $this->generateUid($length);
}
public function __invoke(array $record)
@@ -43,4 +46,14 @@ public function getUid()
{
return $this->uid;
}
+
+ public function reset()
+ {
+ $this->uid = $this->generateUid(strlen($this->uid));
+ }
+
+ private function generateUid($length)
+ {
+ return substr(hash('md5', uniqid('', true)), 0, $length);
+ }
}
diff --git a/lib/monolog/monolog/src/Monolog/Processor/WebProcessor.php b/lib/monolog/monolog/src/Monolog/Processor/WebProcessor.php
index ea1d897..684188f 100644
--- a/lib/monolog/monolog/src/Monolog/Processor/WebProcessor.php
+++ b/lib/monolog/monolog/src/Monolog/Processor/WebProcessor.php
@@ -16,7 +16,7 @@
*
* @author Jordi Boggiano
*/
-class WebProcessor
+class WebProcessor implements ProcessorInterface
{
/**
* @var array|\ArrayAccess
diff --git a/lib/monolog/monolog/src/Monolog/ResettableInterface.php b/lib/monolog/monolog/src/Monolog/ResettableInterface.php
new file mode 100644
index 0000000..635bc77
--- /dev/null
+++ b/lib/monolog/monolog/src/Monolog/ResettableInterface.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog;
+
+/**
+ * Handler or Processor implementing this interface will be reset when Logger::reset() is called.
+ *
+ * Resetting ends a log cycle gets them back to their initial state.
+ *
+ * Resetting a Handler or a Processor means flushing/cleaning all buffers, resetting internal
+ * state, and getting it back to a state in which it can receive log records again.
+ *
+ * This is useful in case you want to avoid logs leaking between two requests or jobs when you
+ * have a long running process like a worker or an application server serving multiple requests
+ * in one process.
+ *
+ * @author Grégoire Pineau
+ */
+interface ResettableInterface
+{
+ public function reset();
+}
diff --git a/lib/monolog/monolog/src/Monolog/SignalHandler.php b/lib/monolog/monolog/src/Monolog/SignalHandler.php
new file mode 100644
index 0000000..d87018f
--- /dev/null
+++ b/lib/monolog/monolog/src/Monolog/SignalHandler.php
@@ -0,0 +1,115 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog;
+
+use Psr\Log\LoggerInterface;
+use Psr\Log\LogLevel;
+use ReflectionExtension;
+
+/**
+ * Monolog POSIX signal handler
+ *
+ * @author Robert Gust-Bardon
+ */
+class SignalHandler
+{
+ private $logger;
+
+ private $previousSignalHandler = array();
+ private $signalLevelMap = array();
+ private $signalRestartSyscalls = array();
+
+ public function __construct(LoggerInterface $logger)
+ {
+ $this->logger = $logger;
+ }
+
+ public function registerSignalHandler($signo, $level = LogLevel::CRITICAL, $callPrevious = true, $restartSyscalls = true, $async = true)
+ {
+ if (!extension_loaded('pcntl') || !function_exists('pcntl_signal')) {
+ return $this;
+ }
+
+ if ($callPrevious) {
+ if (function_exists('pcntl_signal_get_handler')) {
+ $handler = pcntl_signal_get_handler($signo);
+ if ($handler === false) {
+ return $this;
+ }
+ $this->previousSignalHandler[$signo] = $handler;
+ } else {
+ $this->previousSignalHandler[$signo] = true;
+ }
+ } else {
+ unset($this->previousSignalHandler[$signo]);
+ }
+ $this->signalLevelMap[$signo] = $level;
+ $this->signalRestartSyscalls[$signo] = $restartSyscalls;
+
+ if (function_exists('pcntl_async_signals') && $async !== null) {
+ pcntl_async_signals($async);
+ }
+
+ pcntl_signal($signo, array($this, 'handleSignal'), $restartSyscalls);
+
+ return $this;
+ }
+
+ public function handleSignal($signo, array $siginfo = null)
+ {
+ static $signals = array();
+
+ if (!$signals && extension_loaded('pcntl')) {
+ $pcntl = new ReflectionExtension('pcntl');
+ $constants = $pcntl->getConstants();
+ if (!$constants) {
+ // HHVM 3.24.2 returns an empty array.
+ $constants = get_defined_constants(true);
+ $constants = $constants['Core'];
+ }
+ foreach ($constants as $name => $value) {
+ if (substr($name, 0, 3) === 'SIG' && $name[3] !== '_' && is_int($value)) {
+ $signals[$value] = $name;
+ }
+ }
+ unset($constants);
+ }
+
+ $level = isset($this->signalLevelMap[$signo]) ? $this->signalLevelMap[$signo] : LogLevel::CRITICAL;
+ $signal = isset($signals[$signo]) ? $signals[$signo] : $signo;
+ $context = isset($siginfo) ? $siginfo : array();
+ $this->logger->log($level, sprintf('Program received signal %s', $signal), $context);
+
+ if (!isset($this->previousSignalHandler[$signo])) {
+ return;
+ }
+
+ if ($this->previousSignalHandler[$signo] === true || $this->previousSignalHandler[$signo] === SIG_DFL) {
+ if (extension_loaded('pcntl') && function_exists('pcntl_signal') && function_exists('pcntl_sigprocmask') && function_exists('pcntl_signal_dispatch')
+ && extension_loaded('posix') && function_exists('posix_getpid') && function_exists('posix_kill')) {
+ $restartSyscalls = isset($this->signalRestartSyscalls[$signo]) ? $this->signalRestartSyscalls[$signo] : true;
+ pcntl_signal($signo, SIG_DFL, $restartSyscalls);
+ pcntl_sigprocmask(SIG_UNBLOCK, array($signo), $oldset);
+ posix_kill(posix_getpid(), $signo);
+ pcntl_signal_dispatch();
+ pcntl_sigprocmask(SIG_SETMASK, $oldset);
+ pcntl_signal($signo, array($this, 'handleSignal'), $restartSyscalls);
+ }
+ } elseif (is_callable($this->previousSignalHandler[$signo])) {
+ if (PHP_VERSION_ID >= 70100) {
+ $this->previousSignalHandler[$signo]($signo, $siginfo);
+ } else {
+ $this->previousSignalHandler[$signo]($signo);
+ }
+ }
+ }
+}
diff --git a/lib/monolog/monolog/src/Monolog/Utils.php b/lib/monolog/monolog/src/Monolog/Utils.php
new file mode 100644
index 0000000..180a159
--- /dev/null
+++ b/lib/monolog/monolog/src/Monolog/Utils.php
@@ -0,0 +1,159 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog;
+
+class Utils
+{
+ /**
+ * @internal
+ */
+ public static function getClass($object)
+ {
+ $class = \get_class($object);
+
+ return 'c' === $class[0] && 0 === strpos($class, "class@anonymous\0") ? get_parent_class($class).'@anonymous' : $class;
+ }
+
+ /**
+ * Return the JSON representation of a value
+ *
+ * @param mixed $data
+ * @param int $encodeFlags flags to pass to json encode, defaults to JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE
+ * @param bool $ignoreErrors whether to ignore encoding errors or to throw on error, when ignored and the encoding fails, "null" is returned which is valid json for null
+ * @throws \RuntimeException if encoding fails and errors are not ignored
+ * @return string
+ */
+ public static function jsonEncode($data, $encodeFlags = null, $ignoreErrors = false)
+ {
+ if (null === $encodeFlags && version_compare(PHP_VERSION, '5.4.0', '>=')) {
+ $encodeFlags = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
+ }
+
+ if ($ignoreErrors) {
+ $json = @json_encode($data, $encodeFlags);
+ if (false === $json) {
+ return 'null';
+ }
+
+ return $json;
+ }
+
+ $json = json_encode($data, $encodeFlags);
+ if (false === $json) {
+ $json = self::handleJsonError(json_last_error(), $data);
+ }
+
+ return $json;
+ }
+
+ /**
+ * Handle a json_encode failure.
+ *
+ * If the failure is due to invalid string encoding, try to clean the
+ * input and encode again. If the second encoding attempt fails, the
+ * inital error is not encoding related or the input can't be cleaned then
+ * raise a descriptive exception.
+ *
+ * @param int $code return code of json_last_error function
+ * @param mixed $data data that was meant to be encoded
+ * @param int $encodeFlags flags to pass to json encode, defaults to JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE
+ * @throws \RuntimeException if failure can't be corrected
+ * @return string JSON encoded data after error correction
+ */
+ public static function handleJsonError($code, $data, $encodeFlags = null)
+ {
+ if ($code !== JSON_ERROR_UTF8) {
+ self::throwEncodeError($code, $data);
+ }
+
+ if (is_string($data)) {
+ self::detectAndCleanUtf8($data);
+ } elseif (is_array($data)) {
+ array_walk_recursive($data, array('Monolog\Utils', 'detectAndCleanUtf8'));
+ } else {
+ self::throwEncodeError($code, $data);
+ }
+
+ if (null === $encodeFlags && version_compare(PHP_VERSION, '5.4.0', '>=')) {
+ $encodeFlags = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
+ }
+
+ $json = json_encode($data, $encodeFlags);
+
+ if ($json === false) {
+ self::throwEncodeError(json_last_error(), $data);
+ }
+
+ return $json;
+ }
+
+ /**
+ * Throws an exception according to a given code with a customized message
+ *
+ * @param int $code return code of json_last_error function
+ * @param mixed $data data that was meant to be encoded
+ * @throws \RuntimeException
+ */
+ private static function throwEncodeError($code, $data)
+ {
+ switch ($code) {
+ case JSON_ERROR_DEPTH:
+ $msg = 'Maximum stack depth exceeded';
+ break;
+ case JSON_ERROR_STATE_MISMATCH:
+ $msg = 'Underflow or the modes mismatch';
+ break;
+ case JSON_ERROR_CTRL_CHAR:
+ $msg = 'Unexpected control character found';
+ break;
+ case JSON_ERROR_UTF8:
+ $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
+ break;
+ default:
+ $msg = 'Unknown error';
+ }
+
+ throw new \RuntimeException('JSON encoding failed: '.$msg.'. Encoding: '.var_export($data, true));
+ }
+
+ /**
+ * Detect invalid UTF-8 string characters and convert to valid UTF-8.
+ *
+ * Valid UTF-8 input will be left unmodified, but strings containing
+ * invalid UTF-8 codepoints will be reencoded as UTF-8 with an assumed
+ * original encoding of ISO-8859-15. This conversion may result in
+ * incorrect output if the actual encoding was not ISO-8859-15, but it
+ * will be clean UTF-8 output and will not rely on expensive and fragile
+ * detection algorithms.
+ *
+ * Function converts the input in place in the passed variable so that it
+ * can be used as a callback for array_walk_recursive.
+ *
+ * @param mixed &$data Input to check and convert if needed
+ * @private
+ */
+ public static function detectAndCleanUtf8(&$data)
+ {
+ if (is_string($data) && !preg_match('//u', $data)) {
+ $data = preg_replace_callback(
+ '/[\x80-\xFF]+/',
+ function ($m) { return utf8_encode($m[0]); },
+ $data
+ );
+ $data = str_replace(
+ array('¤', '¦', '¨', '´', '¸', '¼', '½', '¾'),
+ array('€', 'Š', 'š', 'Ž', 'ž', 'Œ', 'œ', 'Ÿ'),
+ $data
+ );
+ }
+ }
+}
diff --git a/lib/psr/log/Psr/Log/LoggerInterface.php b/lib/psr/log/Psr/Log/LoggerInterface.php
index 5ea7243..e695046 100644
--- a/lib/psr/log/Psr/Log/LoggerInterface.php
+++ b/lib/psr/log/Psr/Log/LoggerInterface.php
@@ -118,6 +118,8 @@ public function debug($message, array $context = array());
* @param array $context
*
* @return void
+ *
+ * @throws \Psr\Log\InvalidArgumentException
*/
public function log($level, $message, array $context = array());
}
diff --git a/lib/psr/log/Psr/Log/LoggerTrait.php b/lib/psr/log/Psr/Log/LoggerTrait.php
index 867225d..e392fef 100644
--- a/lib/psr/log/Psr/Log/LoggerTrait.php
+++ b/lib/psr/log/Psr/Log/LoggerTrait.php
@@ -135,6 +135,8 @@ public function debug($message, array $context = array())
* @param array $context
*
* @return void
+ *
+ * @throws \Psr\Log\InvalidArgumentException
*/
abstract public function log($level, $message, array $context = array());
}
diff --git a/lib/psr/log/Psr/Log/NullLogger.php b/lib/psr/log/Psr/Log/NullLogger.php
index d8cd682..c8f7293 100644
--- a/lib/psr/log/Psr/Log/NullLogger.php
+++ b/lib/psr/log/Psr/Log/NullLogger.php
@@ -20,6 +20,8 @@ class NullLogger extends AbstractLogger
* @param array $context
*
* @return void
+ *
+ * @throws \Psr\Log\InvalidArgumentException
*/
public function log($level, $message, array $context = array())
{
diff --git a/lib/psr/log/Psr/Log/Test/LoggerInterfaceTest.php b/lib/psr/log/Psr/Log/Test/LoggerInterfaceTest.php
index a0391a5..9ecb6c4 100644
--- a/lib/psr/log/Psr/Log/Test/LoggerInterfaceTest.php
+++ b/lib/psr/log/Psr/Log/Test/LoggerInterfaceTest.php
@@ -4,6 +4,7 @@
use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;
+use PHPUnit\Framework\TestCase;
/**
* Provides a base test class for ensuring compliance with the LoggerInterface.
@@ -11,7 +12,7 @@
* Implementors can extend the class and implement abstract methods to run this
* as part of their test suite.
*/
-abstract class LoggerInterfaceTest extends \PHPUnit_Framework_TestCase
+abstract class LoggerInterfaceTest extends TestCase
{
/**
* @return LoggerInterface
@@ -101,6 +102,9 @@ public function testObjectCastToString()
public function testContextCanContainAnything()
{
+ $closed = fopen('php://memory', 'r');
+ fclose($closed);
+
$context = array(
'bool' => true,
'null' => null,
@@ -110,6 +114,7 @@ public function testContextCanContainAnything()
'nested' => array('with object' => new DummyTest),
'object' => new \DateTime,
'resource' => fopen('php://memory', 'r'),
+ 'closed' => $closed,
);
$this->getLogger()->warning('Crazy context data', $context);
@@ -136,5 +141,6 @@ class DummyTest
{
public function __toString()
{
+ return 'DummyTest';
}
}
diff --git a/lib/psr/log/Psr/Log/Test/TestLogger.php b/lib/psr/log/Psr/Log/Test/TestLogger.php
new file mode 100644
index 0000000..1be3230
--- /dev/null
+++ b/lib/psr/log/Psr/Log/Test/TestLogger.php
@@ -0,0 +1,147 @@
+ $level,
+ 'message' => $message,
+ 'context' => $context,
+ ];
+
+ $this->recordsByLevel[$record['level']][] = $record;
+ $this->records[] = $record;
+ }
+
+ public function hasRecords($level)
+ {
+ return isset($this->recordsByLevel[$level]);
+ }
+
+ public function hasRecord($record, $level)
+ {
+ if (is_string($record)) {
+ $record = ['message' => $record];
+ }
+ return $this->hasRecordThatPasses(function ($rec) use ($record) {
+ if ($rec['message'] !== $record['message']) {
+ return false;
+ }
+ if (isset($record['context']) && $rec['context'] !== $record['context']) {
+ return false;
+ }
+ return true;
+ }, $level);
+ }
+
+ public function hasRecordThatContains($message, $level)
+ {
+ return $this->hasRecordThatPasses(function ($rec) use ($message) {
+ return strpos($rec['message'], $message) !== false;
+ }, $level);
+ }
+
+ public function hasRecordThatMatches($regex, $level)
+ {
+ return $this->hasRecordThatPasses(function ($rec) use ($regex) {
+ return preg_match($regex, $rec['message']) > 0;
+ }, $level);
+ }
+
+ public function hasRecordThatPasses(callable $predicate, $level)
+ {
+ if (!isset($this->recordsByLevel[$level])) {
+ return false;
+ }
+ foreach ($this->recordsByLevel[$level] as $i => $rec) {
+ if (call_user_func($predicate, $rec, $i)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public function __call($method, $args)
+ {
+ if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) {
+ $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3];
+ $level = strtolower($matches[2]);
+ if (method_exists($this, $genericMethod)) {
+ $args[] = $level;
+ return call_user_func_array([$this, $genericMethod], $args);
+ }
+ }
+ throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()');
+ }
+
+ public function reset()
+ {
+ $this->records = [];
+ $this->recordsByLevel = [];
+ }
+}
diff --git a/lib/psr/log/README.md b/lib/psr/log/README.md
index 574bc1c..a9f20c4 100644
--- a/lib/psr/log/README.md
+++ b/lib/psr/log/README.md
@@ -7,6 +7,13 @@ This repository holds all interfaces/classes/traits related to
Note that this is not a logger of its own. It is merely an interface that
describes a logger. See the specification for more details.
+Installation
+------------
+
+```bash
+composer require psr/log
+```
+
Usage
-----
@@ -31,6 +38,12 @@ class Foo
if ($this->logger) {
$this->logger->info('Doing work');
}
+
+ try {
+ $this->doSomethingElse();
+ } catch (Exception $exception) {
+ $this->logger->error('Oh no!', array('exception' => $exception));
+ }
// do something useful
}
diff --git a/lib/psr/log/composer.json b/lib/psr/log/composer.json
index 87934d7..3f6d4ee 100644
--- a/lib/psr/log/composer.json
+++ b/lib/psr/log/composer.json
@@ -20,7 +20,7 @@
},
"extra": {
"branch-alias": {
- "dev-master": "1.0.x-dev"
+ "dev-master": "1.1.x-dev"
}
}
}
diff --git a/payline.php b/payline.php
index b4652d3..fd7df24 100644
--- a/payline.php
+++ b/payline.php
@@ -4,7 +4,7 @@
*
* @author Monext
* @copyright Monext - http://www.payline.com
- * @version 2.1.0
+ * @version 2.2.7
*/
if (!defined('_PS_VERSION_')) {
@@ -90,7 +90,7 @@ public function __construct()
$this->name = 'payline';
$this->tab = 'payments_gateways';
$this->module_key = '';
- $this->version = '2.2.4';
+ $this->version = '2.2.7';
$this->author = 'Monext';
$this->need_instance = true;
@@ -360,19 +360,7 @@ protected function processFullOrderRefund(Order $order)
$orderSlipDetailsList = array();
// Amount for refund
- $amountToRefund = 0.00;
- foreach ($order->getProducts() as $idOrderDetail => $product) {
- if (($product['product_quantity'] - $product['product_quantity_refunded']) > 0) {
- $orderSlipDetailsList[(int)$idOrderDetail] = array(
- 'id_order_detail' => $idOrderDetail,
- 'quantity' => ($product['product_quantity'] - $product['product_quantity_refunded']),
- 'unit_price' => (float)$product['unit_price_tax_excl'],
- 'amount' => $product['unit_price_tax_incl'] * ($product['product_quantity'] - $product['product_quantity_refunded']),
- );
- }
- $amountToRefund += round(($product['product_price_wt'] * $product['product_quantity']), 2);
- }
- $amountToRefund += (float)($order->total_shipping);
+ $amountToRefund = $transaction['payment']['amount'] / 100;
// Create order slip (available since PS 1.6.0.11)
if (method_exists('OrderSlip', 'create')) {
@@ -413,16 +401,15 @@ protected function processTransactionCapture(Order $order, $idTransaction, $doRe
$capture = PaylinePaymentGateway::captureTransaction($idTransaction, 'CPT', $this->l('Manual capture from PrestaShop BackOffice'));
if (PaylinePaymentGateway::isValidResponse($capture)) {
// Capture OK
- // Change order state
- $history = new OrderHistory();
- $history->id_order = (int)$order->id;
- $history->changeIdOrderState(_PS_OS_PAYMENT_, (int)$order->id);
- $history->addWithemail();
+ if (Configuration::get('PAYLINE_WEB_CASH_VALIDATION') != _PS_OS_PAYMENT_) {
+ // Change order state
+ $history = new OrderHistory();
+ $history->id_order = (int)$order->id;
+ $history->changeIdOrderState(_PS_OS_PAYMENT_, (int)$order->id);
+ $history->addWithemail();
+ }
if ($doRedirect) {
- // Wait 1s because Payline API may take some time to be updated after a capture
- sleep(1);
-
Tools::redirectAdmin($this->context->link->getAdminLink('AdminOrders') . '&id_order=' . $order->id . '&vieworder&paylineCaptureOK=1');
}
} else {
@@ -3029,7 +3016,7 @@ public function processRecNotification($idTransaction, $paymentRecordId)
}
/**
- * Clone of Order::addOrderPayment() - We force total_paid_real to be = 0 instead of a negative value, so we can update without warning
+ * Clone of Order::addOrderPayment()
* @since 2.0.0
* @return bool
*/
@@ -3046,8 +3033,7 @@ protected function addOrderPaymentAfterRefund(Order $order, $amount_paid, $payme
$order_payment->amount = $amount_paid;
$order_payment->date_add = ($date ? $date : null);
- // Force total_paid_real to 0
- $order->total_paid_real = 0;
+ $order->total_paid_real = max(0, $order->total_paid_real - abs($amount_paid));
// We put autodate parameter of add method to true if date_add field is null
$res = $order_payment->add(is_null($order_payment->date_add)) && $order->update();
diff --git a/translations/fr.php b/translations/fr.php
index 1f108ef..4a04f19 100644
--- a/translations/fr.php
+++ b/translations/fr.php
@@ -102,7 +102,7 @@
$_MODULE['<{payline}prestashop>payline_2715d06f9a029a951c5c8b66903badd5'] = 'Configuration des contrats';
$_MODULE['<{payline}prestashop>payline_1c6ddba6ebafc01b08f21aefd7993899'] = 'Sélectionnez et triez les contrats que vous souhaitez rendre disponibles à vos clients';
$_MODULE['<{payline}prestashop>payline_cc0ca8cd23cacc40345b234594a3df42'] = 'Vous pouvez trier les contrats en utilisant la méthode glisser & déposer';
-$_MODULE['<{payline}prestashop>payline_7dbab2bc66cba2aeb56aec68973b3c53'] = 'Sélectionnez et triez les contrats alternatfis que vous souhaitez rendre disponibles à vos clients';
+$_MODULE['<{payline}prestashop>payline_7dbab2bc66cba2aeb56aec68973b3c53'] = 'Sélectionnez et triez les contrats alternatifs que vous souhaitez rendre disponibles à vos clients';
$_MODULE['<{payline}prestashop>payline_558b49eb972c3c62a1a4e5b6d91420ae'] = 'Configuration enregistrée.';
$_MODULE['<{payline}prestashop>payline_3cd289dd8822372e7348bb7fda88de1b'] = 'La commande ne peut pas être créée car le montant payé est différent du total de votre panier.';
$_MODULE['<{payline}prestashop>payline_a8823d45d4a0c43caa6f5eb36e200381'] = 'La commande ne peut pas être créée car le panier n\'existe pas.';
diff --git a/views/templates/admin/landing.tpl b/views/templates/admin/landing.tpl
index e7524a4..f8d9dbe 100644
--- a/views/templates/admin/landing.tpl
+++ b/views/templates/admin/landing.tpl
@@ -20,11 +20,5 @@
{l s='More information on www.payline.com.' mod='payline'}
-
-
-
{l s='Need help ?' mod='payline'}
-
{l s='Find our documentation or contact our team through support.payline.com.' mod='payline'}
-
-
\ No newline at end of file