diff --git a/controllers/admin/AdminSaferPayOfficialSettingsController.php b/controllers/admin/AdminSaferPayOfficialSettingsController.php index 34864441..0cf1b1b7 100755 --- a/controllers/admin/AdminSaferPayOfficialSettingsController.php +++ b/controllers/admin/AdminSaferPayOfficialSettingsController.php @@ -80,6 +80,18 @@ public function initOptions() { $this->context->smarty->assign(SaferPayConfig::PASSWORD, SaferPayConfig::WEB_SERVICE_PASSWORD_PLACEHOLDER); + $savedCardSetting = SaferPayConfig::isVersion17() ? [ + 'type' => 'radio', + 'title' => $this->l('Credit card saving for customers'), + 'validation' => 'isInt', + 'choices' => [ + 1 => $this->l('Enable'), + 0 => $this->l('Disable'), + ], + 'desc' => $this->l('Allow customers to save credit card for faster purchase'), + 'form_group_class' => 'thumbs_chose', + ] : null; + $this->fields_options = [ 'login_configurations' => [ 'title' => $this->l('TEST MODE'), @@ -261,17 +273,7 @@ public function initOptions() 'desc' => $this->l('Default payment behavior for payment without 3-D Secure'), 'form_group_class' => 'thumbs_chose', ], - SaferPayConfig::CREDIT_CARD_SAVE => [ - 'type' => 'radio', - 'title' => $this->l('Credit card saving for customers'), - 'validation' => 'isInt', - 'choices' => [ - 1 => $this->l('Enable'), - 0 => $this->l('Disable'), - ], - 'desc' => $this->l('Allow customers to save credit card for faster purchase'), - 'form_group_class' => 'thumbs_chose', - ], + SaferPayConfig::CREDIT_CARD_SAVE => $savedCardSetting, SaferPayConfig::RESTRICT_REFUND_AMOUNT_TO_CAPTURED_AMOUNT => [ 'type' => 'radio', 'title' => $this->l('Restrict RefundAmount To Captured Amount'), diff --git a/controllers/front/successIFrame.php b/controllers/front/successIFrame.php index f1dc96f9..22d8e591 100755 --- a/controllers/front/successIFrame.php +++ b/controllers/front/successIFrame.php @@ -126,9 +126,16 @@ public function initContent() $this->setTemplate(SaferPayConfig::SAFERPAY_TEMPLATE_LOCATION . '/front/loading.tpl'); return; } + + $jsUrl = "{$this->module->getPathUri()}views/js/front/saferpay_iframe_16.js"; + + if (SaferPayConfig::isVersion17()) { + $jsUrl = "{$this->module->getPathUri()}views/js/front/saferpay_iframe.js"; + } + $this->context->smarty->assign([ 'cssUrl' => "{$this->module->getPathUri()}views/css/front/loading.css", - 'jsUrl' => "{$this->module->getPathUri()}views/js/front/saferpay_iframe.js", + 'jsUrl' => $jsUrl, 'redirectUrl' => $orderLink, ]); $this->setTemplate('loading_16.tpl'); diff --git a/saferpayofficial.php b/saferpayofficial.php index 6ecaa5e9..c467a61a 100755 --- a/saferpayofficial.php +++ b/saferpayofficial.php @@ -179,7 +179,7 @@ public function hookActionObjectOrderPaymentAddAfter($params) public function hookPaymentOptions($params) { - /** @var Invertus\SaferPay\Service\SaferPayCartService $assertService */ + /** @var Invertus\SaferPay\Service\SaferPayCartService $cartService */ $cartService = $this->getService(\Invertus\SaferPay\Service\SaferPayCartService::class); if (!$cartService->isCurrencyAvailable($params['cart'])) { return []; diff --git a/src/Validation/CustomerCreditCardValidation.php b/src/Validation/CustomerCreditCardValidation.php index b0f3037e..d487c6f1 100644 --- a/src/Validation/CustomerCreditCardValidation.php +++ b/src/Validation/CustomerCreditCardValidation.php @@ -60,9 +60,11 @@ public function __construct(SaferPayCardAliasRepository $saferPayCardAliasReposi */ public function validate($idSavedCard, $idCustomer) { - if ( - !is_numeric($idCustomer) || !is_numeric($idSavedCard) - || !isset($idCustomer) || !isset($idSavedCard)) + if ($idSavedCard <= 0 || empty($idSavedCard)) { + return true; + } + + if (!is_numeric($idCustomer) || !is_numeric($idSavedCard)) { $this->logger->error(sprintf('%s - Invalid data or bad types', self::FILE_NAME), [ 'context' => [], @@ -73,10 +75,6 @@ public function validate($idSavedCard, $idCustomer) throw SaferPayException::unknownError(); } - if ($idSavedCard <= 0) { - return true; - } - $cardOwnerId = $this->saferPayCardAliasRepository->getCustomerIdByReferenceId(pSQL($idSavedCard), pSQL($idCustomer)); if (empty($cardOwnerId)) { diff --git a/views/js/front/saferpay_iframe_16.js b/views/js/front/saferpay_iframe_16.js new file mode 100644 index 00000000..a555a0d1 --- /dev/null +++ b/views/js/front/saferpay_iframe_16.js @@ -0,0 +1,29 @@ +/** + *NOTICE OF LICENSE + * + *This source file is subject to the Open Software License (OSL 3.0) + *that is bundled with this package in the file LICENSE.txt. + *It is also available through the world-wide-web at this URL: + *http://opensource.org/licenses/osl-3.0.php + *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 license@prestashop.com so we can send you a copy immediately. + * + *DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + *versions in the future. If you wish to customize PrestaShop for your + *needs please refer to http://www.prestashop.com for more information. + * + *@author INVERTUS UAB www.invertus.eu + *@copyright SIX Payment Services + *@license SIX Payment Services + */ + +(function () { + // NOTE: Replacing because javascript gives "&" instead of "&" in the URL + redirectUrl = redirectUrl.replace(/&/g, "&"); + if (top.location !== window.location) { + top.location.href = redirectUrl; + } +})(); \ No newline at end of file