From f2b6e0cfc31ca73727776019895016076c06d89d Mon Sep 17 00:00:00 2001 From: Nabil Berhouche Date: Tue, 15 Dec 2020 10:26:58 +0100 Subject: [PATCH] [BOT] Migrate hotfix 2.5.1 to GitHub. --- .../Form/Field/Standard/CardInfoMode.php | 59 +++ CHANGELOG.md | 5 + Helper/Data.php | 20 -- Helper/Rest.php | 5 +- Model/Api/PayzenApi.php | 23 -- Model/Api/PayzenResponse.php | 2 +- Model/Method/Payzen.php | 337 ++++++++++-------- Model/{WsException.php => RestException.php} | 14 +- composer.json | 2 +- etc/adminhtml/system/standard.xml | 1 + etc/config.xml | 3 +- i18n/de_DE.csv | 7 +- i18n/en_US.csv | 7 +- i18n/es_ES.csv | 9 +- i18n/fr_FR.csv | 7 +- 15 files changed, 277 insertions(+), 224 deletions(-) create mode 100644 Block/Adminhtml/System/Config/Form/Field/Standard/CardInfoMode.php rename Model/{WsException.php => RestException.php} (55%) diff --git a/Block/Adminhtml/System/Config/Form/Field/Standard/CardInfoMode.php b/Block/Adminhtml/System/Config/Form/Field/Standard/CardInfoMode.php new file mode 100644 index 00000000..7bd0986d --- /dev/null +++ b/Block/Adminhtml/System/Config/Form/Field/Standard/CardInfoMode.php @@ -0,0 +1,59 @@ +renderScript($element); + } + + /** + * Render element JavaScript code. + * + * @return string + */ + protected function renderScript(\Magento\Framework\Data\Form\Element\AbstractElement $element) + { + $warningMessage = __('Warning, some payment means are not compatible with an integration by iframe. Please consult the documentation for more details.'); + + $script = ' + '; + + return $script; + } +} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d90073c..b11b8899 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +2.5.1, 2020-12-15: +- Display warning message on payment in iframe mode enabling. +- Bug fix: Manage PSP_100 errors when calling REST web services. +- Bug fix: Error 500 due to obsolete function (get_magic_quotes_gpc) in PHP 7.4. + 2.5.0, 2020-11-25: - [embedded] Bug fix: Empty cart to avoid double payments with REST API. - [franfinance] Added new FranFinance submodule. diff --git a/Helper/Data.php b/Helper/Data.php index 39c5634e..e8a117c1 100644 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -402,26 +402,6 @@ public function getOtherPaymentModelConfig() return $connection->fetchAll($select); } - /** - * Check if server has requirements to do WS operations. - * - * @throws \Lyranetwork\Payzen\Model\WsException - */ - public function checkWsRequirements() - { - if (! extension_loaded('soap')) { - throw new \Lyranetwork\Payzen\Model\WsException( - 'SOAP extension for PHP must be enabled on the server in order to use PayZen web services.' - ); - } - - if (! extension_loaded('openssl')) { - throw new \Lyranetwork\Payzen\Model\WsException( - 'OPENSSL extension for PHP must be enabled on the server in order to use PayZen web services.' - ); - } - } - /** * Unserialize data using JSON or PHP unserialize function if error. * diff --git a/Helper/Rest.php b/Helper/Rest.php index e2391d41..888a6c10 100644 --- a/Helper/Rest.php +++ b/Helper/Rest.php @@ -164,10 +164,11 @@ public function checkResult($response, $expectedStatuses = array()) if ($response['status'] !== 'SUCCESS') { $msg = $answer['errorMessage'] . ' (' . $answer['errorCode'] . ').'; if (isset($answer['detailedErrorMessage']) && ! empty($answer['detailedErrorMessage'])) { - $msg .= ' Detailed message: ' . $answer['detailedErrorMessage'] .' (' . $answer['detailedErrorCode'] . ').'; + $msg .= ' Detailed message: ' . $answer['detailedErrorMessage'] . ($answer['detailedErrorCode'] ? + ' (' . $answer['detailedErrorCode'] . ').' : ''); } - throw new \Exception($msg); + throw new \Lyranetwork\Payzen\Model\RestException($msg, $answer['errorCode']); } elseif (! empty($expectedStatuses) && ! in_array($answer['detailedStatus'], $expectedStatuses)) { throw new \UnexpectedValueException( "Unexpected transaction status returned ({$answer['detailedStatus']})." diff --git a/Model/Api/PayzenApi.php b/Model/Api/PayzenApi.php index 9bd47b09..b20feacc 100644 --- a/Model/Api/PayzenApi.php +++ b/Model/Api/PayzenApi.php @@ -326,28 +326,5 @@ public static function sign($parameters, $key, $algo, $hashed = true) throw new \InvalidArgumentException("Unsupported algorithm passed : {$algo}."); } } - - /** - * PHP is not yet a sufficiently advanced technology to be indistinguishable from magic... - * so don't use magic_quotes, they mess up with the gateway response analysis. - * - * @param array $potentially_quoted_data - * @return mixed - */ - public static function uncharm($potentially_quoted_data) - { - if (get_magic_quotes_gpc()) { - $sane = array(); - foreach ($potentially_quoted_data as $k => $v) { - $sane_key = stripslashes($k); - $sane_value = is_array($v) ? self::uncharm($v) : stripslashes($v); - $sane[$sane_key] = $sane_value; - } - } else { - $sane = $potentially_quoted_data; - } - - return $sane; - } } } diff --git a/Model/Api/PayzenResponse.php b/Model/Api/PayzenResponse.php index 6de4668c..d9b6d279 100644 --- a/Model/Api/PayzenResponse.php +++ b/Model/Api/PayzenResponse.php @@ -92,7 +92,7 @@ class PayzenResponse */ public function __construct($params, $ctx_mode, $key_test, $key_prod, $algo = PayzenApi::ALGO_SHA1) { - $this->rawResponse = PayzenApi::uncharm($params); + $this->rawResponse = $params; $this->certificate = trim(($ctx_mode == 'PRODUCTION') ? $key_prod : $key_test); if (in_array($algo, PayzenApi::$SUPPORTED_ALGOS)) { diff --git a/Model/Method/Payzen.php b/Model/Method/Payzen.php index 6a2ef745..639cd08a 100644 --- a/Model/Method/Payzen.php +++ b/Model/Method/Payzen.php @@ -476,7 +476,7 @@ public function acceptPayment(\Magento\Payment\Model\InfoInterface $payment) // Client has not configured private key in module backend, let Magento accept order offline. if (! $this->restHelper->getPrivateKey($storeId)) { - $this->dataHelper->log("Cannot get online payment information for order #{$order->getIncrementId()}: private key is not configured, let Magento accepts the payment."); + $this->dataHelper->log("Cannot get online payment information for order #{$order->getIncrementId()}: private key is not configured, let Magento accept the payment."); return true; } @@ -511,7 +511,7 @@ public function acceptPayment(\Magento\Payment\Model\InfoInterface $payment) // Check operation type. $transType = $getPaymentDetails['answer']['operationType']; if ($transType !== 'DEBIT') { - throw new \Exception("Unexpected transaction type returned ($transType)."); + throw new \UnexpectedValueException("Unexpected transaction type returned ($transType)."); } $this->dataHelper->log("Updating payment information for accepted order #{$order->getIncrementId()}."); @@ -556,26 +556,35 @@ public function acceptPayment(\Magento\Payment\Model\InfoInterface $payment) exit; } catch(\UnexpectedValueException $e) { $this->dataHelper->log( - "getPaymentDetails error with code {$e->getCode()}: {$e->getMessage()}.", + "Get payment details error: {$e->getMessage()}.", \Psr\Log\LogLevel::ERROR ); throw new \Exception($e->getMessage()); } catch (\Exception $e) { $this->dataHelper->log( - "Exception with code {$e->getCode()}: {$e->getMessage()}", + "Get payment details exception with code {$e->getCode()}: {$e->getMessage()}", \Psr\Log\LogLevel::ERROR ); - if ($e->getCode() <= -1) { // Manage cUrl errors. - $message = __("Please consult the PayZen logs for more details."); + if ($e->getCode() === 'PSP_100') { + // Merchant does not subscribe to REST WS option, accept payment offline. + $this->dataHelper->log("Cannot get online payment information for order #{$order->getIncrementId()}: REST API not available for merchant, let Magento accept the payment."); + + return true; } else { - $message = $e->getMessage(); - } + $message = __('Payment review error') . ': '; - $this->messageManager->addError($message); + if ($e->getCode() <= -1) { + // Manage cUrl errors. + $message .= __('Please consult the PayZen logs for more details.'); + } else { + $message .= $e->getMessage(); + } - throw $e; + $this->messageManager->addError($message); + throw $e; + } } } @@ -595,7 +604,7 @@ public function denyPayment(\Magento\Payment\Model\InfoInterface $payment) $order = $payment->getOrder(); $storeId = $order->getStore()->getId(); - // Client has not configured private key in module backend, let Magento accept order offline. + // Client has not configured private key in module backend, let Magento cancel order offline. if (! $this->restHelper->getPrivateKey($storeId)) { $this->dataHelper->log("Cannot cancel payment online for order #{$order->getIncrementId()}: private key is not configured, let Magento cancel the payment."); @@ -655,26 +664,36 @@ public function denyPayment(\Magento\Payment\Model\InfoInterface $payment) return true; // Let Magento cancel order. } catch(\UnexpectedValueException $e) { $this->dataHelper->log( - "cancelPayment error with code {$e->getCode()}: {$e->getMessage()}.", + "Cancel payment error: {$e->getMessage()}.", \Psr\Log\LogLevel::ERROR ); throw new \Exception($e->getMessage()); } catch (\Exception $e) { $this->dataHelper->log( - "Exception with code {$e->getCode()}: {$e->getMessage()}", + "Cancel payment exception with code {$e->getCode()}: {$e->getMessage()}", \Psr\Log\LogLevel::ERROR ); - if ($e->getCode() <= -1) { // Manage cUrl errors. - $message = __("Please consult the PayZen logs for more details."); + if ($e->getCode() === 'PSP_100') { + // Merchant does not subscribe to REST WS option, deny payment offline. + $this->dataHelper->log("Cannot cancel payment online for order #{$order->getIncrementId()}: REST API not available for merchant, let Magento cancel the payment."); + + $this->messageManager->addWarning(__('Payment is cancelled only in Magento. Please, consider cancelling the payment in PayZen Back Office.')); + return true; } else { - $message = $e->getMessage(); - } + $message = __('Cancellation error') . ': '; - $this->messageManager->addError($message); + if ($e->getCode() <= -1) { + // Manage cUrl errors. + $message .= __('Please consult the PayZen logs for more details.'); + } else { + $message .= $e->getMessage(); + } - throw $e; + $this->messageManager->addError($message); + throw $e; + } } } @@ -693,110 +712,52 @@ public function validatePayment(\Magento\Payment\Model\InfoInterface $payment) $storeId = $order->getStore()->getId(); $uuidArray = []; - $onlineValidatePayment = true; if (! $this->restHelper->getPrivateKey($storeId)) { - // Client has not configured private key in module backend, let Magento validate payment offline. - $this->dataHelper->log("Cannot validate online payment for order #{$order->getIncrementId()}: private key is not configured, let Magento validate payment."); - $this->messageManager->addWarning(__('Payment is validated only in Magento. Please, consider validating the payment in PayZen Back Office.')); - $onlineValidatePayment = false; - } else { - $this->dataHelper->log("Validate payment online for order #{$order->getIncrementId()}."); + // Client has not configured private key in module backend, let's update order offline. + $this->dataHelper->log("Cannot validate online payment for order #{$order->getIncrementId()}: private key is not configured, let's validate order offline."); + $this->validatePaymentOffline($order); + + return; } + $this->dataHelper->log("Validate payment online for order #{$order->getIncrementId()}."); + try { // Get choosen payment option if any. $option = @unserialize($payment->getAdditionalInformation(\Lyranetwork\Payzen\Helper\Payment::MULTI_OPTION)); $multi = (stripos($payment->getMethod(), 'payzen_multi') === 0) && is_array($option) && ! empty($option); $count = $multi ? (int) $option['count'] : 1; - if ($onlineValidatePayment) { - // Retrieve saved transaction UUID. - $savedUuid = $payment->getAdditionalInformation(\Lyranetwork\Payzen\Helper\Payment::TRANS_UUID); - - if (! $savedUuid || ($count > 1)) { - $uuidArray = $this->getPaymentDetails($order); - } else { - $uuidArray[] = $savedUuid; - } - - $first = true; - foreach ($uuidArray as $uuid) { - $requestData = [ - 'uuid' => $uuid, - 'comment' => $this->getUserInfo() - ]; - - // Perform our request. - $client = new PayzenRest( - $this->dataHelper->getCommonConfigData('rest_url', $storeId), - $this->dataHelper->getCommonConfigData('site_id', $storeId), - $this->restHelper->getPrivateKey($storeId) - ); - - $validatePaymentResponse = $client->post('V4/Transaction/Validate', json_encode($requestData)); - - $this->restHelper->checkResult($validatePaymentResponse, ['WAITING_AUTHORISATION', 'AUTHORISED']); + // Retrieve saved transaction UUID. + $savedUuid = $payment->getAdditionalInformation(\Lyranetwork\Payzen\Helper\Payment::TRANS_UUID); - // Wrap payment result to use traditional order creation tunnel. - $data = $this->restHelper->convertRestResult($validatePaymentResponse['answer'], true); - - // Load API response. - $response = $this->payzenResponseFactory->create( - [ - 'params' => $data, - 'ctx_mode' => null, - 'key_test' => null, - 'key_prod' => null, - 'algo' => null - ] - ); - - $transId = $order->getPayment()->getCcTransId() . '-' . $response->get('sequence_number'); - - if ($first) { // Single payment or first transaction for payment in installments. - $stateObject = $this->paymentHelper->nextOrderState($order, $response, true); - - $this->dataHelper->log("Order #{$order->getIncrementId()}, new state : {$stateObject->getState()}, new status : {$stateObject->getStatus()}."); - $order->setState($stateObject->getState()) - ->setStatus($stateObject->getStatus()); - } + if (! $savedUuid || ($count > 1)) { + $uuidArray = $this->getPaymentDetails($order); + } else { + $uuidArray[] = $savedUuid; + } - $order->addStatusHistoryComment(__('Transaction %1 has been validated.', $transId)); + $first = true; + foreach ($uuidArray as $uuid) { + $requestData = [ + 'uuid' => $uuid, + 'comment' => $this->getUserInfo() + ]; - // Update transaction status. - $txn = $this->transactionResource->loadObjectByTxnId( - $this->transaction, - $order->getId(), - $order->getPayment()->getId(), - $transId - ); + // Perform our request. + $client = new PayzenRest( + $this->dataHelper->getCommonConfigData('rest_url', $storeId), + $this->dataHelper->getCommonConfigData('site_id', $storeId), + $this->restHelper->getPrivateKey($storeId) + ); - if ($txn && $txn->getId()) { - $data = $txn->getAdditionalInformation(\Magento\Sales\Model\Order\Payment\Transaction::RAW_DETAILS); - $data['Transaction Status'] = $response->getTransStatus(); + $validatePaymentResponse = $client->post('V4/Transaction/Validate', json_encode($requestData)); - $txn->setAdditionalInformation(\Magento\Sales\Model\Order\Payment\Transaction::RAW_DETAILS, $data); - $txn->save(); - } + $this->restHelper->checkResult($validatePaymentResponse, ['WAITING_AUTHORISATION', 'AUTHORISED']); - $first = false; - } - } else { // Wrap payment result to use traditional order creation tunnel. - $data = ['vads_trans_status' => 'AUTHORISED']; - - $txn = $this->transactionResource->loadObjectByTxnId( - $this->transaction, - $order->getId(), - $order->getPayment()->getId(), - $order->getPayment()->getLastTransId() - ); - - if ($txn && $txn->getId()) { - $txnData = $txn->getAdditionalInformation(\Magento\Sales\Model\Order\Payment\Transaction::RAW_DETAILS); - $data['vads_card_brand'] = $txnData['Means of payment']; - } + $data = $this->restHelper->convertRestResult($validatePaymentResponse['answer'], true); // Load API response. $response = $this->payzenResponseFactory->create( @@ -809,42 +770,120 @@ public function validatePayment(\Magento\Payment\Model\InfoInterface $payment) ] ); - $stateObject = $this->paymentHelper->nextOrderState($order, $response, true); + $transId = $order->getPayment()->getCcTransId() . '-' . $response->get('sequence_number'); - $this->dataHelper->log("Order #{$order->getIncrementId()}, new state : {$stateObject->getState()}, new status : {$stateObject->getStatus()}."); - $order->setState($stateObject->getState()) - ->setStatus($stateObject->getStatus()); + if ($first) { // Single payment or first transaction for payment in installments. + $stateObject = $this->paymentHelper->nextOrderState($order, $response, true); - $order->addStatusHistoryComment(__('Order %1 has been validated.', $order->getIncrementId())); - } + $this->dataHelper->log("Order #{$order->getIncrementId()}, new state : {$stateObject->getState()}, new status : {$stateObject->getStatus()}."); + $order->setState($stateObject->getState()) + ->setStatus($stateObject->getStatus()); + } + + $order->addStatusHistoryComment(__('Transaction %1 has been validated.', $transId)); + + // Update transaction status. + $txn = $this->transactionResource->loadObjectByTxnId( + $this->transaction, + $order->getId(), + $order->getPayment()->getId(), + $transId + ); + + if ($txn && $txn->getId()) { + $data = $txn->getAdditionalInformation(\Magento\Sales\Model\Order\Payment\Transaction::RAW_DETAILS); + $data['Transaction Status'] = $response->getTransStatus(); - $this->dataHelper->log("Updating payment information for validated order #{$order->getIncrementId()}."); + $txn->setAdditionalInformation(\Magento\Sales\Model\Order\Payment\Transaction::RAW_DETAILS, $data); + $txn->save(); + } + + $first = false; + } // Try to create invoice. $this->paymentHelper->createInvoice($order); - $order->save(); + + $this->dataHelper->log("Payment information updated for validated order #{$order->getIncrementId()}."); $this->messageManager->addSuccess(__('Payment validated successfully.')); } catch(\UnexpectedValueException $e) { $this->dataHelper->log( - "validatePayment error with code {$e->getCode()}: {$e->getMessage()}.", + "Validate payment error: {$e->getMessage()}.", \Psr\Log\LogLevel::ERROR ); + + throw new \Exception($e->getMessage()); } catch (\Exception $e) { $this->dataHelper->log( - "Exception with code {$e->getCode()}: {$e->getMessage()}", + "Validate payment exception with code {$e->getCode()}: {$e->getMessage()}", \Psr\Log\LogLevel::ERROR ); - $message = __("We cannot update the payment right now."); - if ($e->getCode() <= -1) { // Manage cUrl errors. - $message .= ' ' . __("Please consult the PayZen logs for more details."); + if ($e->getCode() === 'PSP_100') { + // Merchant does not subscribe to REST WS option, validate payment offline. + $this->dataHelper->log("Cannot validate online payment for order #{$order->getIncrementId()}: REST API not available for merchant, let's validate order offline."); + $this->validatePaymentOffline($order, true); + + return; } else { - $message .= ' ' . $e->getMessage(); + $message = __('Validation error') . ': '; + + if ($e->getCode() <= -1) { + // Manage cUrl errors. + $message .= __('Please consult the PayZen logs for more details.'); + } else { + $message .= $e->getMessage(); + } + + $this->messageManager->addError($message); } + } + } - $this->messageManager->addError($message); + protected function validatePaymentOffline($order) + { + $this->messageManager->addWarning(__('Payment is validated only in Magento. Please, consider validating the payment in PayZen Back Office.')); + + // Wrap payment result to use traditional order creation tunnel. + $data = ['vads_trans_status' => 'AUTHORISED']; + + $txn = $this->transactionResource->loadObjectByTxnId( + $this->transaction, + $order->getId(), + $order->getPayment()->getId(), + $order->getPayment()->getLastTransId() + ); + + if ($txn && $txn->getId()) { + $txnData = $txn->getAdditionalInformation(\Magento\Sales\Model\Order\Payment\Transaction::RAW_DETAILS); + $data['vads_card_brand'] = $txnData['Means of payment']; } + + // Load API response. + $response = $this->payzenResponseFactory->create( + [ + 'params' => $data, + 'ctx_mode' => null, + 'key_test' => null, + 'key_prod' => null, + 'algo' => null + ] + ); + + $stateObject = $this->paymentHelper->nextOrderState($order, $response, true); + + $this->dataHelper->log("Order #{$order->getIncrementId()}, new state : {$stateObject->getState()}, new status : {$stateObject->getStatus()}."); + $order->setState($stateObject->getState()) + ->setStatus($stateObject->getStatus()); + + $order->addStatusHistoryComment(__('Order %1 has been validated.', $order->getIncrementId())); + + // Try to create invoice. + $this->paymentHelper->createInvoice($order); + $order->save(); + + $this->dataHelper->log("Payment information updated for validated order #{$order->getIncrementId()}."); } /** @@ -1040,7 +1079,7 @@ public function refund(\Magento\Payment\Model\InfoInterface $payment, $amount) $transType = $refundPaymentResponse['answer']['operationType']; if ($transType !== 'CREDIT') { - throw new \Exception("Unexpected transaction type returned ($transType)."); + throw new \UnexpectedValueException("Unexpected transaction type returned ($transType)."); } // Create refund transaction in Magento. @@ -1065,33 +1104,11 @@ public function refund(\Magento\Payment\Model\InfoInterface $payment, $amount) $this->dataHelper->log("Online payment cancel for order #{$order->getIncrementId()} is successful."); } else { // Partial transaction cancel, call update WS. - $timestamp = time(); - - $captureDelay = $this->getConfigData('capture_delay', $storeId); // Get submodule specific param. - if (! is_numeric($captureDelay)) { - // Get general param. - $captureDelay = $this->dataHelper->getCommonConfigData('capture_delay', $storeId); - } - - $expectedCaptureDate = (is_numeric($captureDelay)) ? new \DateTime('@' . strtotime("+$captureDelay days", $timestamp)) : null; - - $validationMode = $this->getConfigData('validation_mode', $storeId); // Get submodule specific param. - if ($validationMode === '-1') { - // Get general param. - $validationMode = $this->dataHelper->getCommonConfigData('validation_mode', $storeId); - } - - if ($validationMode !== '') { - $validationMode = ($validationMode == '1') ? 'YES' : 'NO'; - } - $requestData = [ 'uuid' => $uuid, 'cardUpdate' => [ 'amount' => $transAmount - $amountInCents, - 'currency' => $currency->getAlpha3(), - 'expectedCaptureDate' => $expectedCaptureDate, - 'manualValidation' => $validationMode + 'currency' => $currency->getAlpha3() ], 'comment' => $commentText ]; @@ -1110,21 +1127,35 @@ public function refund(\Magento\Payment\Model\InfoInterface $payment, $amount) } } } catch(\UnexpectedValueException $e) { - $this->dataHelper->log("refund error with code {$e->getCode()}: {$e->getMessage()}.", \Psr\Log\LogLevel::ERROR); + $this->dataHelper->log( + "Refund payment error: {$e->getMessage()}.", + \Psr\Log\LogLevel::ERROR + ); + + throw new \Exception($e->getMessage()); } catch (\Exception $e) { $this->dataHelper->log( - "Exception with code {$e->getCode()}: {$e->getMessage()}", + "Refund payment exception with code {$e->getCode()}: {$e->getMessage()}", \Psr\Log\LogLevel::ERROR ); - $message = __('Refund error') . ':'; - if ($e->getCode() <= -1) { // Manage cUrl errors. - $message .= ' ' . __('Please consult the PayZen logs for more details.'); + if ($e->getCode() === 'PSP_083') { + throw new \Exception(__('Chargebacks cannot be refunded.')); + } elseif ($e->getCode() === 'PSP_100') { + // Merchant does not subscribe to REST WS option, refund payment offline. + $notice = __('You are not authorized to do this action online. Please, do not forget to update payment in PayZen Back Office.'); + $this->messageManager->addWarning($notice); + // Magento will do an offline refund. } else { - $message .= ' ' . $e->getMessage(); - } + $message = __('Refund error') . ': '; + if ($e->getCode() <= -1) { // Manage cUrl errors. + $message .= __('Please consult the PayZen logs for more details.'); + } else { + $message .= $e->getMessage(); + } - throw new \Exception($message); + throw new \Exception($message); + } } $order->save(); diff --git a/Model/WsException.php b/Model/RestException.php similarity index 55% rename from Model/WsException.php rename to Model/RestException.php index 9556b8ec..89f7f8d7 100644 --- a/Model/WsException.php +++ b/Model/RestException.php @@ -9,6 +9,18 @@ */ namespace Lyranetwork\Payzen\Model; -class WsException extends \Exception +class RestException extends \Exception { + protected $code; + + /** + * @param message[optional] + * @param code[optional] + */ + public function __construct($message, $code = null) + { + parent::__construct($message, null); + + $this->code = $code; + } } diff --git a/composer.json b/composer.json index 9e24f288..31102787 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "php" : "~5.5.0|~5.6.0|~7" }, "type" : "magento2-module", - "version" : "2.5.0", + "version" : "2.5.1", "license" : "OSL-3.0", "autoload" : { "files" : [ diff --git a/etc/adminhtml/system/standard.xml b/etc/adminhtml/system/standard.xml index cf6b6659..ef372eed 100644 --- a/etc/adminhtml/system/standard.xml +++ b/etc/adminhtml/system/standard.xml @@ -114,6 +114,7 @@ + Lyranetwork\Payzen\Block\Adminhtml\System\Config\Form\Field\Standard\CardInfoMode Lyranetwork\Payzen\Model\System\Config\Source\CardInfoMode payment/payzen_standard/card_info_mode diff --git a/etc/config.xml b/etc/config.xml index 76448181..04ed98f5 100644 --- a/etc/config.xml +++ b/etc/config.xml @@ -15,7 +15,7 @@ support@payzen.eu - 2.5.0 + 2.5.1 V2 Magento_2.x 1 @@ -26,7 +26,6 @@ TEST SHA-256 https://secure.payzen.eu/vads-payment/ - https://secure.payzen.eu/vads-ws/v5?wsdl payzen/payment/check diff --git a/i18n/de_DE.csv b/i18n/de_DE.csv index 748842f3..6fab253d 100644 --- a/i18n/de_DE.csv +++ b/i18n/de_DE.csv @@ -182,6 +182,7 @@ "Embedded payment fields in a pop-in (REST API)","Eingebettete Zahlungsfelder in einem Pop-In (REST-API)" "Payment by token","Zahlung per Alias" "The payment by token allows to pay orders without re-entering bank data at each payment. The Payment by token option should be enabled on your PayZen store to use this feature.","The payment by token allows to pay orders without re-entering bank data at each payment. The Payment by token option should be enabled on your PayZen store to use this feature." +"Warning, some payment means are not compatible with an integration by iframe. Please consult the documentation for more details.", "Warning, some payment means are not compatible with an integration by iframe. Please consult the documentation for more details." "REST API SETTINGS","REST API EINSTELLUNGEN" "CUSTOMIZATION","PERSONALISIERUNG" "Theme","Thema" @@ -262,7 +263,6 @@ "The next order ID « %1 » does not match PayZen specifications.","Der nächste Auftrag ID « %1 » nicht PayZen Spezifikationen entsprechen." "This field must agree to the regular expression %1.","Dieses Feld muss mit dem regulären Ausdruck %1 zustimmen." "Oney means of payment cannot be used.","Das Zahlungsmittel Oney kann nicht benutzt werden." -"PayPal means of payment cannot be used.","Das Zahlungsmittel PayPal kann nicht benutzt werden." "Payment Method","Zahlungsmethode" "Sequence Number","Sequenznummer" "Transaction Type","Art der Transaktion" @@ -281,14 +281,12 @@ "Authentication Type","Authentifizierungsart" "Fraud Control Result:","Fraud Control-Ergebnis:" "Advanced Risk Assessment Result:","Erweiterte Risikoeinschätzung Ergebnis:" -"Authentication error !","Fehler bei der Authentifizierung !" "You are not authorized to do this action online. Please, do not forget to update payment in PayZen Back Office.","Sie sind nicht online zu dieser Aktion autorisiert. Bitte vergessen Sie nicht, die Zahlung in PayZen Back Office zu aktualisieren." "Chargebacks cannot be refunded.","Chargebacks cannot be refunded." -"SOAP extension for PHP must be enabled on the server in order to use PayZen web services.","SOAP extension for PHP must be enabled on the server in order to use PayZen web services." -"OPENSSL extension for PHP must be enabled on the server in order to use PayZen web services.","OPENSSL extension for PHP must be enabled on the server in order to use PayZen web services." "Refund error","Fehler bei der Rückzahlung" "Please fix error to refund payments through PayZen. If you want to refund order in Magento, use the « Refund Offline » button.","Please fix error to refund payments through PayZen. If you want to refund order in Magento, use the « Refund Offline » button." "Cancellation error","Stornierung Fehler" +"Payment review error","Zahlungsüberprüfung Fehler" "An error has occurred during the cancellation process.","Ein Fehler ist während der Löschung Prozess aufgetreten." "An error has occurred during the payment review process.","Ein Fehler ist während des Zahlungsüberprüfung Prozess aufgetreten." "Are you sure you want to validate this order in PayZen gateway?","Bist du sicher, dass Sie diesen Auftrag in PayZen Plattform zu validieren wollen?" @@ -303,7 +301,6 @@ "Payment validated successfully.","Zahlung erfolgreich validiert." "Please consult the PayZen logs for more details.","Please consult the PayZen logs for more details." "An error has occurred during the validation process.","Ein Fehler ist während des Validierungsprozesses aufgetreten." -"Please fix this error to use PayZen web services.","Please fix this error to use PayZen web services." "You will enter payment data after order confirmation.","Sie werden die Zahlungsdaten nach Auftragsbestätigung ein." "Choose your payment option","Wählen Sie Ihre Zahlungsoption" "Your payment option","Ihre Zahlungsoption" diff --git a/i18n/en_US.csv b/i18n/en_US.csv index 8e03cf61..832d3e80 100644 --- a/i18n/en_US.csv +++ b/i18n/en_US.csv @@ -181,6 +181,7 @@ "Embedded payment fields in a pop-in (REST API)","Embedded payment fields in a pop-in (REST API)" "Payment by token","Payment by token" "The payment by token allows to pay orders without re-entering bank data at each payment. The Payment by token option should be enabled on your PayZen store to use this feature.","The payment by token allows to pay orders without re-entering bank data at each payment. The Payment by token option should be enabled on your PayZen store to use this feature." +"Warning, some payment means are not compatible with an integration by iframe. Please consult the documentation for more details.", "Warning, some payment means are not compatible with an integration by iframe. Please consult the documentation for more details." "REST API SETTINGS","REST API SETTINGS" "CUSTOMIZATION","CUSTOMIZATION" "Theme","Theme" @@ -261,7 +262,6 @@ "The next order ID « %1 » does not match PayZen specifications.","The next order ID « %1 » does not match PayZen specifications." "This field must agree to the regular expression %1.","This field must agree to the regular expression %1." "Payment in 3 or 4 times Oney cannot be used.","Le paiement 3 ou 4 fois Oney ne peut pas être utilisé." -"PayPal means of payment cannot be used.","PayPal means of payment cannot be used." "Payment Method","Payment Method" "Sequence Number","Sequence Number" "Transaction Type","Transaction Type" @@ -280,14 +280,12 @@ "3DS Certificate","3DS Certificate" "Fraud Control Result:","Fraud Control Result:" "Advanced Risk Assessment Result:","Advanced Risk Assessment Result:" -"Authentication error !","Authentication error !" "You are not authorized to do this action online. Please, do not forget to update payment in PayZen Back Office.","You are not authorized to do this action online. Please, do not forget to update payment in PayZen Back Office." "Chargebacks cannot be refunded.","Chargebacks cannot be refunded." -"SOAP extension for PHP must be enabled on the server in order to use PayZen web services.","SOAP extension for PHP must be enabled on the server in order to use PayZen web services." -"OPENSSL extension for PHP must be enabled on the server in order to use PayZen web services.","OPENSSL extension for PHP must be enabled on the server in order to use PayZen web services." "Refund error","Refund error" "Please fix error to refund payments through PayZen. If you want to refund order in Magento, use the « Refund Offline » button.","Please fix error to refund payments through PayZen. If you want to refund order in Magento, use the « Refund Offline » button." "Cancellation error","Cancellation error" +"Payment review error","Payment review error" "An error has occurred during the cancellation process.","An error has occurred during the cancellation process." "An error has occurred during the payment review process.","An error has occurred during the payment review process." "Are you sure you want to validate this order in PayZen gateway?","Are you sure you want to validate this order in PayZen gateway?" @@ -301,7 +299,6 @@ "Order %1 has been validated.","Order %1 has been validated." "Payment validated successfully.","Payment validated successfully." "Please consult the PayZen logs for more details.","Please consult the PayZen logs for more details." -"Please fix this error to use PayZen web services.","Please fix this error to use PayZen web services." "An error has occurred during the validation process.","An error has occurred during the validation process." "You will enter payment data after order confirmation.","You will enter payment data after order confirmation." "Choose your payment option","Choose your payment option" diff --git a/i18n/es_ES.csv b/i18n/es_ES.csv index c07302d9..b604c28a 100644 --- a/i18n/es_ES.csv +++ b/i18n/es_ES.csv @@ -182,6 +182,7 @@ "Embedded payment fields in a pop-in (REST API)","Campos de pago incrustados en una ventana pop-in (API REST)" "Payment by token","Pago por token" "The payment by token allows to pay orders without re-entering bank data at each payment. The Payment by token option should be enabled on your PayZen store to use this feature.","El pago por token permite pagar pedidos sin reingresar datos bancarios en cada pago. La opción Pago por token; debe estar habilitada en su tienda PayZen para usar esta función." +"Warning, some payment means are not compatible with an integration by iframe. Please consult the documentation for more details.", "Advertencia, algunos medios de pago no son compatibles con una integración por iframe. Consulte la documentación para obtener más detalles." "REST API SETTINGS","CONFIGURACIÓN DE API REST" "CUSTOMIZATION","PERSONALIZACIÓN" "Theme","Tema" @@ -260,7 +261,6 @@ "The next order ID « %1 » does not match PayZen specifications.","El ID del siguiente pedido « %1 » no cumple con las especificaciones de PayZen." "This field must agree to the regular expression %1.","Este campo debe aceptar la expresión regular %1." "Payment in 3 or 4 times Oney cannot be used.","No se puede usar el pago 3 o 4 veces Oney." -"PayPal means of payment cannot be used.","No se puede usar el medio de pago PayPal." "Payment Method","Método de pago" "Sequence Number","Número de secuencia" "Transaction Type","Tipo de transacción" @@ -279,14 +279,12 @@ "3DS Certificate","Certificado 3DS" "Fraud Control Result:","Resultado del control de fraude:" "Advanced Risk Assessment Result:","Resultado de la evaluación de riesgos avanzada:" -"Authentication error !","Error de autenticación" "You are not authorized to do this action online. Please, do not forget to update payment in PayZen Back Office.","No está autorizado para realizar esta acción en línea. No olvide actualizar el pago en el Back Office PayZen." -"Chargebacks cannot be refunded.","Chargebacks cannot be refunded." -"SOAP extension for PHP must be enabled on the server in order to use PayZen web services.","La extensión SOAP para PHP debe estar habilitada en el servidor para usar los servicios web de PayZen." -"OPENSSL extension for PHP must be enabled on the server in order to use PayZen web services.","La extensión OPENSSL para PHP debe estar habilitada en el servidor para usar los servicios web de PayZen." +"Chargebacks cannot be refunded.","No se puede reembolsar una transacción no pagada." "Refund error","Error de reembolso" "Please fix error to refund payments through PayZen. If you want to refund order in Magento, use the « Refund Offline » button.","Corrija el error para reembolsar pagos a través de PayZen. Si desea reembolsar el pedido en Magento, use el botón « Reembolso fuera de línea »." "Cancellation error","Error de cancelación" +"Payment review error","Error de revisión del pago" "An error has occurred during the cancellation process.","Ocurrió un error durante el proceso de cancelación." "An error has occurred during the payment review process.","Ocurrió un error durante el proceso de revisión del pago." "Are you sure you want to validate this order in PayZen gateway?","¿Está seguro de que desea validar este pedido en el portal de PayZen?" @@ -301,7 +299,6 @@ "Payment validated successfully.","Pago validado correctamente." "Please consult the PayZen logs for more details.","Consulte los registros de PayZen para obtener más detalles." "An error has occurred during the validation process.","Ocurrió un error durante el proceso de validación." -"Please fix this error to use PayZen web services.","Corrija este error para usar los servicios web de PayZen." "You will enter payment data after order confirmation.","Usted ingresará los datos de pago después de la confirmación del pedido." "Choose your payment option","Elija su opción de pago" "Your payment option","Su opción de pago" diff --git a/i18n/fr_FR.csv b/i18n/fr_FR.csv index be6464b0..c9e70325 100644 --- a/i18n/fr_FR.csv +++ b/i18n/fr_FR.csv @@ -182,6 +182,7 @@ "Embedded payment fields in a pop-in (REST API)","Champs de paiement embarqués dans une pop-in (API REST)" "Payment by token","Paiement par alias" "The payment by token allows to pay orders without re-entering bank data at each payment. The Payment by token option should be enabled on your PayZen store to use this feature.","Le paiement par alias permet de régler une commande sans resaisir les données bancaires à chaque paiement. L'option Paiement par alias doit être activée sur votre boutique PayZen pour utiliser cette fonctionnalité." +"Warning, some payment means are not compatible with an integration by iframe. Please consult the documentation for more details.","Attention, certains moyens de paiement ne sont pas compatibles avec une intégration par iframe. Consulter la documentation pour plus de détails." "REST API SETTINGS","PARAMÈTRES DE L'API REST" "CUSTOMIZATION","PERSONNALISATION" "Theme","Thème" @@ -262,7 +263,6 @@ "The next order ID « %1 » does not match PayZen specifications.","L'ID pour la prochaine commande « %1 » ne correspond pas aux spécifications PayZen." "This field must agree to the regular expression %1.","Ce champ doit respecter l'expression régulière %1." "Payment in 3 or 4 times Oney cannot be used.","Le paiement 3 ou 4 fois Oney ne peut pas être utilisé." -"PayPal means of payment cannot be used.","Le moyen de paiement PayPal ne peut pas être utilisé." "Payment Method","Méthode de paiement" "Sequence Number","Numéro de séquence" "Transaction Type","Type de transaction" @@ -281,14 +281,12 @@ "3DS Certificate","Certificat 3DS" "Fraud Control Result:","Résultat des contrôles de fraude :" "Advanced Risk Assessment Result:","Résultat de la gestion des risques avancée :" -"Authentication error !","Erreur d'authentification !" "You are not authorized to do this action online. Please, do not forget to update payment in PayZen Back Office.","Vous n'êtes pas authorisé à faire cette action en ligne. Pensez à modifier le paiement dans le Back Office PayZen." "Chargebacks cannot be refunded.","Il est impossible de rembourser une transaction impayée." -"SOAP extension for PHP must be enabled on the server in order to use PayZen web services.","L'extension SOAP pour PHP doit être activée sur le serveur pour pouvoir utiliser les services web PayZen." -"OPENSSL extension for PHP must be enabled on the server in order to use PayZen web services.","L'extension OPENSSL pour PHP doit être activée sur le serveur pour pouvoir utiliser les services web PayZen." "Refund error","Erreur de remboursement" "Please fix error to refund payments through PayZen. If you want to refund order in Magento, use the « Refund Offline » button.","Veuillez corriger l'erreur pour rembourser les paiements à travers PayZen. Si vous souhaitez rembourser la commande dans Magento, utilisez le bouton « Remboursement hors ligne »." "Cancellation error","Erreur d'annulation" +"Payment review error","Erreur de mise à jour" "An error has occurred during the cancellation process.","Une erreur est survenue durant le processus d'annulation." "An error has occurred during the payment review process.","Une erreur est survenue durant le processus de mise à jour du paiement." "Are you sure you want to validate this order in PayZen gateway?","Êtes-vous sûr de vouloir valider cette commande sur la plateforme PayZen?" @@ -303,7 +301,6 @@ "Payment validated successfully.","Paiement validé avec succès." "Please consult the PayZen logs for more details.","Veuillez consulter les logs de PayZen pour plus de détails." "An error has occurred during the validation process.","Une erreur est survenue durant le processus de validation." -"Please fix this error to use PayZen web services.";"Veuillez corriger cette erreur pour utiliser les services web PayZen." "You will enter payment data after order confirmation.","Vous allez saisir les informations de paiement après confirmation de la commande." "Choose your payment option","Choisissez votre option de paiement" "Your payment option","Votre option de paiement"