diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7c10ef62f..4c9c31314 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -29,7 +29,7 @@ jobs: uses: docker/setup-buildx-action@v3 - name: Build docker images - uses: docker/bake-action@v4 + uses: docker/bake-action@v5 with: files: compose.yml pull: true @@ -48,3 +48,9 @@ jobs: run: task test env: XDEBUG_MODE: coverage + + - name: Install semgrep + run: pip install semgrep + + - name: Run semgrep + run: semgrep scan --config semgrep/rules diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d83d0bc25..f76ad9cee 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/commitizen-tools/commitizen - rev: v3.27.0 + rev: v3.28.0 hooks: - id: commitizen name: Check commit message format @@ -39,7 +39,7 @@ repos: stages: [commit] - repo: https://github.com/returntocorp/semgrep - rev: v1.78.0 + rev: v1.81.0 hooks: - id: semgrep args: diff --git a/CHANGELOG.md b/CHANGELOG.md index dc60c549a..b4527097e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,29 @@ # Changelog +## v4.2.0 - 2024-08-06 + +### Changes + +### 🚀 New Features + +- feat: Insurance compatability with PS 1.7 (#522) +- feat: Insurance product page cannot be added to cart (#530) + +### 🐛 Bug Fixes + +- fix: create payment with object category in product (#551) +- fix: load alma script on dashboard for ps17 (#549) +- fix: eligible limit of feePlans (#550) +- fix: display multiple notification dashboard on ps17 (#548) +- fix: install module with ps_account from ps17 to ps8 (#547) +- fix: openmodal insurance in the first load product page (#543) +- fix: change order status error (#542) +- fix: install module without ConfigCache about PS Account (#541) + +#### Contributors + +@Benjamin-Freoua-Alma, @alma-renovate-bot, @alma-renovate-bot[bot], @carine-bonnafous and @github-actions + ## v4.1.4 - 2024-07-29 ### Changes diff --git a/alma/alma.php b/alma/alma.php index 7b6f72c47..912e56c04 100644 --- a/alma/alma.php +++ b/alma/alma.php @@ -30,7 +30,7 @@ class Alma extends PaymentModule { - const VERSION = '4.1.4'; + const VERSION = '4.2.0'; public $_path; public $local_path; @@ -80,7 +80,7 @@ public function __construct() { $this->name = 'alma'; $this->tab = 'payments_gateways'; - $this->version = '4.1.4'; + $this->version = '4.2.0'; $this->author = 'Alma'; $this->need_instance = false; $this->bootstrap = true; @@ -150,6 +150,7 @@ public function checkCompatibilityPSModule() { if ( $this->toolsHelper->psVersionCompare('1.6', '<') + || !class_exists(\Symfony\Component\Config\ConfigCache::class) || !class_exists(\PrestaShop\ModuleLibServiceContainer\DependencyInjection\ServiceContainer::class) || _PS_MODE_DEV_ === true ) { @@ -419,7 +420,19 @@ public function hookTermsAndConditions($params) } /** - * Hook to modify the order table + * Hook to modify the order table before Ps 1.7.5 + * + * @param $params + * + * @return mixed|null + */ + public function hookActionAdminOrdersListingFieldsModifier($params) + { + return $this->runHookController('actionAdminOrdersListingFieldsModifier', $params); + } + + /** + * Hook to modify the order table after Ps 1.7.5 * * @param $params * @@ -431,7 +444,7 @@ public function hookActionOrderGridQueryBuilderModifier($params) } /** - * Hook to modify the order table + * Hook to modify the order table after Ps 1.7.5 * * @param $params * @@ -649,11 +662,21 @@ public function hookDisplayPayment($params) return $this->runHookController('displayPayment', $params); } - public function hookDeleteProductInCartAfter($params) + /** + * @param $params + * + * @return mixed|null + */ + public function hookActionAfterDeleteProductInCart($params) { return $this->hookActionObjectProductInCartDeleteAfter($params); } + /** + * @param $params + * + * @return mixed|null + */ public function hookActionObjectProductInCartDeleteAfter($params) { return $this->runHookController('actionObjectProductInCartDeleteAfter', $params); @@ -711,4 +734,24 @@ public function hookDisplayAdminAfterHeader($params) { return $this->runHookController('displayAdminAfterHeader', $params); } + + /** + * @param $params + * + * @return mixed|null + */ + public function hookActionFrontControllerSetVariables($params) + { + return $this->runHookController('actionFrontControllerSetVariables', $params); + } + + /** + * @param $params + * + * @return mixed|null + */ + public function hookActionGetProductPropertiesBefore($params) + { + return $this->runHookController('actionGetProductPropertiesBefore', $params); + } } diff --git a/alma/config/admin/services.yml b/alma/config/admin/services.yml index 934cf7b48..5dcbbadca 100644 --- a/alma/config/admin/services.yml +++ b/alma/config/admin/services.yml @@ -1,15 +1,14 @@ services: - _defaults: - public: true - ##################### # PS Account alma.ps_accounts_installer: + public: true class: 'PrestaShop\PsAccountsInstaller\Installer\Installer' arguments: - '5.0' alma.ps_accounts_facade: + public: true class: 'PrestaShop\PsAccountsInstaller\Installer\Facade\PsAccounts' arguments: - '@alma.ps_accounts_installer' diff --git a/alma/controllers/front/payment.php b/alma/controllers/front/payment.php index 2d223c009..7f91dca20 100644 --- a/alma/controllers/front/payment.php +++ b/alma/controllers/front/payment.php @@ -22,7 +22,6 @@ * @license https://opensource.org/licenses/MIT The MIT License */ -use Alma\API\ParamsError; use Alma\PrestaShop\Builders\Helpers\SettingsHelperBuilder; use Alma\PrestaShop\Builders\Models\PaymentDataBuilder; use Alma\PrestaShop\Helpers\ClientHelper; @@ -106,9 +105,7 @@ private function ajaxErrorAndDie() /** * @return void * - * @throws PrestaShopDatabaseException * @throws PrestaShopException - * @throws ParamsError */ public function postProcess() { diff --git a/alma/controllers/hook/ActionAdminOrdersListingFieldsModifierHookController.php b/alma/controllers/hook/ActionAdminOrdersListingFieldsModifierHookController.php new file mode 100644 index 000000000..85e917cf7 --- /dev/null +++ b/alma/controllers/hook/ActionAdminOrdersListingFieldsModifierHookController.php @@ -0,0 +1,82 @@ + + * @copyright 2018-2024 Alma SAS + * @license https://opensource.org/licenses/MIT The MIT License + */ + +namespace Alma\PrestaShop\Controllers\Hook; + +use Alma\PrestaShop\Builders\Helpers\InsuranceHelperBuilder; +use Alma\PrestaShop\Helpers\InsuranceHelper; +use Alma\PrestaShop\Helpers\SettingsHelper; +use Alma\PrestaShop\Hooks\AdminHookController; + +class ActionAdminOrdersListingFieldsModifierHookController extends AdminHookController +{ + /** + * @var InsuranceHelper + */ + protected $insuranceHelper; + + public function canRun() + { + // Front controllers can run if the module is properly configured ... + return SettingsHelper::isFullyConfigured() + // ... and the plugin is in LIVE mode, or the visitor is an admin + && $this->insuranceHelper->isInsuranceActivated(); + } + + /** + * @param $module + */ + public function __construct($module) + { + parent::__construct($module); + + $insuranceHelperBuilder = new InsuranceHelperBuilder(); + $this->insuranceHelper = $insuranceHelperBuilder->getInstance(); + } + + /** + * Run Controller + * + * @param array $params + * + * @return void + */ + public function run($params) + { + if (array_key_exists('select', $params)) { + $params['select'] .= ' ,IF(aip.`id_order` IS NOT NULL,1,0) as has_alma_insurance '; + } + if (array_key_exists('join', $params)) { + $params['join'] .= 'LEFT JOIN ' . _DB_PREFIX_ . 'alma_insurance_product aip ON (a.id_order = aip.id_order)'; + } + if (array_key_exists('group_by', $params)) { + $params['group_by'] .= 'GROUP BY a.id_order'; + } + $params['fields']['has_alma_insurance'] = [ + 'title' => 'Has Insurance', + 'type' => 'bool', + 'tmpTableFilter' => true, + ]; + } +} diff --git a/alma/controllers/hook/ActionFrontControllerSetVariablesHookController.php b/alma/controllers/hook/ActionFrontControllerSetVariablesHookController.php new file mode 100644 index 000000000..61f0dd140 --- /dev/null +++ b/alma/controllers/hook/ActionFrontControllerSetVariablesHookController.php @@ -0,0 +1,85 @@ + + * @copyright 2018-2024 Alma SAS + * @license https://opensource.org/licenses/MIT The MIT License + */ + +namespace Alma\PrestaShop\Controllers\Hook; + +use Alma\PrestaShop\Helpers\ConstantsHelper; +use Alma\PrestaShop\Hooks\FrontendHookController; +use Alma\PrestaShop\Repositories\ProductRepository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class ActionFrontControllerSetVariablesHookController extends FrontendHookController +{ + protected $productRepository; + + public function __construct($module, $productRepository = null) + { + parent::__construct($module); + + if (is_null($productRepository)) { + $productRepository = new ProductRepository(); + } + + $this->productRepository = $productRepository; + } + + /** + * @param $params + * + * @return bool + */ + public function run($params) + { + if ($this->checkIsInsuranceProduct($params)) { + return $params['templateVars']['configuration']['is_catalog'] = true; + } + + return false; + } + + /** + * @param $params + * + * @return bool + */ + private function checkIsInsuranceProduct($params) + { + $templateVars = $params['templateVars']; + $idInsuranceProduct = $this->productRepository->getProductIdByReference(ConstantsHelper::ALMA_INSURANCE_PRODUCT_REFERENCE); + + if ( + is_null($idInsuranceProduct) || + !array_key_exists('page', $templateVars) || + $templateVars['page']['page_name'] !== 'product' || + !array_key_exists('product-id-' . $idInsuranceProduct, $templateVars['page']['body_classes']) + ) { + return false; + } + + return true; + } +} diff --git a/alma/controllers/hook/ActionGetProductPropertiesBeforeHookController.php b/alma/controllers/hook/ActionGetProductPropertiesBeforeHookController.php new file mode 100644 index 000000000..2a72f7829 --- /dev/null +++ b/alma/controllers/hook/ActionGetProductPropertiesBeforeHookController.php @@ -0,0 +1,68 @@ + + * @copyright 2018-2024 Alma SAS + * @license https://opensource.org/licenses/MIT The MIT License + */ + +namespace Alma\PrestaShop\Controllers\Hook; + +use Alma\PrestaShop\Helpers\ConstantsHelper; +use Alma\PrestaShop\Hooks\FrontendHookController; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class ActionGetProductPropertiesBeforeHookController extends FrontendHookController +{ + /** + * @param $params + */ + public function run($params) + { + if ($this->checkIsInsuranceProduct($params)) { + $params['context']->smarty->assign([ + 'configuration' => [ + 'is_catalog' => true, + 'display_taxes_label' => null, + ], + ]); + } + } + + /** + * @param $params + * + * @return bool + */ + private function checkIsInsuranceProduct($params) + { + if ( + !array_key_exists('product', $params) || + !array_key_exists('context', $params) || + $params['product']['reference'] !== ConstantsHelper::ALMA_INSURANCE_PRODUCT_REFERENCE + ) { + return false; + } + + return true; + } +} diff --git a/alma/controllers/hook/DisplayCartExtraProductActionsHookController.php b/alma/controllers/hook/DisplayCartExtraProductActionsHookController.php index 41734643f..926022fba 100644 --- a/alma/controllers/hook/DisplayCartExtraProductActionsHookController.php +++ b/alma/controllers/hook/DisplayCartExtraProductActionsHookController.php @@ -30,7 +30,9 @@ use Alma\PrestaShop\Builders\Helpers\PriceHelperBuilder; use Alma\PrestaShop\Builders\Helpers\SettingsHelperBuilder; use Alma\PrestaShop\Builders\Services\InsuranceProductServiceBuilder; +use Alma\PrestaShop\Exceptions\AlmaCartItemFactoryException; use Alma\PrestaShop\Exceptions\InsuranceNotFoundException; +use Alma\PrestaShop\Factories\AlmaCartItemFactory; use Alma\PrestaShop\Helpers\Admin\AdminInsuranceHelper; use Alma\PrestaShop\Helpers\CartHelper; use Alma\PrestaShop\Helpers\ConstantsHelper; @@ -40,9 +42,11 @@ use Alma\PrestaShop\Helpers\ProductHelper; use Alma\PrestaShop\Helpers\SettingsHelper; use Alma\PrestaShop\Hooks\FrontendHookController; +use Alma\PrestaShop\Logger; use Alma\PrestaShop\Repositories\AlmaInsuranceProductRepository; use Alma\PrestaShop\Repositories\ProductRepository; use Alma\PrestaShop\Services\InsuranceProductService; +use PrestaShop\PrestaShop\Core\Localization\Exception\LocalizationException; if (!defined('_PS_VERSION_')) { exit; @@ -99,6 +103,14 @@ class DisplayCartExtraProductActionsHookController extends FrontendHookControlle * @var InsuranceProductService */ protected $insuranceProductService; + /** + * @var AlmaCartItemFactory + */ + protected $almaCartItemFactory; + /** + * @var Logger + */ + protected $logger; /** * @param $module @@ -130,6 +142,10 @@ public function __construct($module) $insuranceProductServiceBuilder = new InsuranceProductServiceBuilder(); $this->insuranceProductService = $insuranceProductServiceBuilder->getInstance(); + $this->almaCartItemFactory = new AlmaCartItemFactory(); + + $this->logger = Logger::instance(); + parent::__construct($module); } @@ -150,18 +166,22 @@ public function canRun() * @throws InsuranceNotFoundException * @throws \PrestaShopDatabaseException * @throws \PrestaShopException + * @throws LocalizationException */ public function run($params) { - /** - * @var \ProductCore $product - */ - $product = $params['product']; + try { + $product = $this->almaCartItemFactory->create($params['product']); + } catch (AlmaCartItemFactoryException $e) { + $msg = 'Cannot display insurance cart item'; + $this->logger->error('[Alma] ' . $msg); + + $this->context->smarty->assign([ + 'message' => $msg, + ]); - /** - * @var \CartCore $cart - */ - $cart = $params['cart']; + return $this->module->display($this->module->file, 'notificationError.tpl'); + } $insuranceProductId = $this->productRepository->getProductIdByReference( ConstantsHelper::ALMA_INSURANCE_PRODUCT_REFERENCE, @@ -169,19 +189,24 @@ public function run($params) ); if (!$insuranceProductId) { - throw new InsuranceNotFoundException(); + $msg = 'Insurance product not found'; + $this->logger->error('[Alma] ' . $msg); + + $this->context->smarty->assign([ + 'message' => $msg, + ]); + + return $this->module->display($this->module->file, 'notificationError.tpl'); } $resultInsurance = []; - - $idProduct = $product->id; - $productAttributeId = $product->id_product_attribute; - $productQuantity = $product->quantity; - $template = 'displayCartExtraProductActions.tpl'; - $cmsReference = $this->insuranceHelper->createCmsReference($idProduct, $productAttributeId); + $idProduct = $product->getId(); + $productAttributeId = $product->getIdProductAttribute(); $staticPrice = $this->productHelper->getPriceStatic($idProduct, $productAttributeId); - $staticPriceInCents = $this->priceHelper->convertPriceToCents($staticPrice); - $merchantId = $this->settingHelper->getIdMerchant(); + /** + * @var \CartCore $cart + */ + $cart = $params['cart']; if ($idProduct !== $insuranceProductId) { $resultInsurance = $this->insuranceProductService->getItemsCartInsuranceProductAttributes($product, $cart->id, $insuranceProductId); @@ -192,43 +217,36 @@ public function run($params) $nbProductWithInsurance += $insurance['quantity']; } - $ajaxLinkRemoveProduct = $this->link->getModuleLink('alma', 'insurance', ['action' => 'removeProductFromCart']); - $ajaxLinkRemoveAssociation = $this->link->getModuleLink('alma', 'insurance', ['action' => 'removeAssociation']); - $ajaxLinkRemoveAssociations = $this->link->getModuleLink('alma', 'insurance', ['action' => 'removeAssociations']); - $ajaxLinkRemoveInsuranceProduct = $this->link->getModuleLink('alma', 'insurance', ['action' => 'removeInsuranceProduct']); - $ajaxLinkRemoveInsuranceProducts = $this->link->getModuleLink('alma', 'insurance', ['action' => 'removeInsuranceProducts']); - $ajaxLinkAddInsuranceProduct = $this->link->getModuleLink('alma', 'insurance', ['action' => 'addInsuranceProduct']); - $this->context->smarty->assign([ 'idCart' => $cart->id, 'idLanguage' => $this->context->language->id, - 'nbProductWithoutInsurance' => $productQuantity - $nbProductWithInsurance, + 'nbProductWithoutInsurance' => $product->getQuantity() - $nbProductWithInsurance, 'nbProductWithInsurance' => $nbProductWithInsurance, 'product' => $product, 'associatedInsurances' => $resultInsurance, 'isAlmaInsurance' => $idProduct === $insuranceProductId ? 1 : 0, - 'ajaxLinkAlmaRemoveProduct' => $ajaxLinkRemoveProduct, - 'ajaxLinkAlmaRemoveAssociation' => $ajaxLinkRemoveAssociation, - 'ajaxLinkAlmaRemoveAssociations' => $ajaxLinkRemoveAssociations, - 'ajaxLinkRemoveInsuranceProduct' => $ajaxLinkRemoveInsuranceProduct, - 'ajaxLinkRemoveInsuranceProducts' => $ajaxLinkRemoveInsuranceProducts, - 'ajaxLinkAddInsuranceProduct' => $ajaxLinkAddInsuranceProduct, + 'ajaxLinkAlmaRemoveProduct' => $this->link->getModuleLink('alma', 'insurance', ['action' => 'removeProductFromCart']), + 'ajaxLinkAlmaRemoveAssociation' => $this->link->getModuleLink('alma', 'insurance', ['action' => 'removeAssociation']), + 'ajaxLinkAlmaRemoveAssociations' => $this->link->getModuleLink('alma', 'insurance', ['action' => 'removeAssociations']), + 'ajaxLinkRemoveInsuranceProduct' => $this->link->getModuleLink('alma', 'insurance', ['action' => 'removeInsuranceProduct']), + 'ajaxLinkRemoveInsuranceProducts' => $this->link->getModuleLink('alma', 'insurance', ['action' => 'removeInsuranceProducts']), + 'ajaxLinkAddInsuranceProduct' => $this->link->getModuleLink('alma', 'insurance', ['action' => 'addInsuranceProduct']), 'token' => \Tools::getToken(false), 'idProduct' => $idProduct, 'iframeUrl' => sprintf( '%s%s?cms_reference=%s&product_price=%s&product_quantity=%s&merchant_id=%s&customer_session_id=%s&cart_id=%s&is_in_cart=true', $this->adminInsuranceHelper->envUrl(), ConstantsHelper::FO_IFRAME_WIDGET_INSURANCE_PATH, - $cmsReference, - $staticPriceInCents, - $product['quantity_wanted'], - $merchantId, - $this->context->session->getId(), + $this->insuranceHelper->createCmsReference($idProduct, $productAttributeId), + $this->priceHelper->convertPriceToCents($staticPrice), + $product->getQuantity(), + $this->settingHelper->getIdMerchant(), + $this->context->cookie->checksum, $this->cartHelper->getCartIdFromContext() ), 'insuranceSettings' => $this->adminInsuranceHelper->mapDbFieldsWithIframeParams(), ]); - return $this->module->display($this->module->file, $template); + return $this->module->display($this->module->file, 'displayCartExtraProductActions.tpl'); } } diff --git a/alma/controllers/hook/DisplayProductActionsHookController.php b/alma/controllers/hook/DisplayProductActionsHookController.php index 23338da34..611dc4f22 100644 --- a/alma/controllers/hook/DisplayProductActionsHookController.php +++ b/alma/controllers/hook/DisplayProductActionsHookController.php @@ -139,7 +139,7 @@ public function run($params) $staticPriceInCents, $productName, $merchantId, - $this->context->session->getId(), + $this->context->cookie->checksum, $this->cartHelper->getCartIdFromContext() ), ]); @@ -157,7 +157,7 @@ protected function handleSettings($merchantId) $settings = $this->adminInsuranceHelper->mapDbFieldsWithIframeParams(); $settings['merchant_id'] = $merchantId; $settings['cart_id'] = $this->cartHelper->getCartIdFromContext(); - $settings['session_id'] = $this->context->session->getId(); + $settings['session_id'] = $this->context->cookie->checksum; return json_encode($settings); } diff --git a/alma/controllers/hook/FrontHeaderHookController.php b/alma/controllers/hook/FrontHeaderHookController.php index 4bfb857f1..2caed1a65 100644 --- a/alma/controllers/hook/FrontHeaderHookController.php +++ b/alma/controllers/hook/FrontHeaderHookController.php @@ -382,7 +382,9 @@ protected function almaInsuranceIdInHeader() $this->context->language->id ); - return "
"; + $message = $this->module->l('Alma insurance can only be added to your cart if it is associated with a product eligible for insurance. It will be offered on the product page concerned.'); + + return ""; } /** diff --git a/alma/exceptions/AlmaCartItemFactoryException.php b/alma/exceptions/AlmaCartItemFactoryException.php new file mode 100644 index 000000000..dd58216b2 --- /dev/null +++ b/alma/exceptions/AlmaCartItemFactoryException.php @@ -0,0 +1,11 @@ + - * @copyright 2018-2023 Alma SAS + * @copyright 2018-2024 Alma SAS * @license https://opensource.org/licenses/MIT The MIT License */ diff --git a/alma/lib/Builders/Repositories/InsuranceProductRepositoryBuilder.php b/alma/lib/Builders/Repositories/InsuranceProductRepositoryBuilder.php index 1003dba04..6287b54e2 100644 --- a/alma/lib/Builders/Repositories/InsuranceProductRepositoryBuilder.php +++ b/alma/lib/Builders/Repositories/InsuranceProductRepositoryBuilder.php @@ -1,6 +1,6 @@ - * @copyright 2018-2023 Alma SAS + * @copyright 2018-2024 Alma SAS * @license https://opensource.org/licenses/MIT The MIT License */ diff --git a/alma/lib/Builders/Services/InsuranceProductServiceBuilder.php b/alma/lib/Builders/Services/InsuranceProductServiceBuilder.php index 6d7ec301a..5e37592d8 100644 --- a/alma/lib/Builders/Services/InsuranceProductServiceBuilder.php +++ b/alma/lib/Builders/Services/InsuranceProductServiceBuilder.php @@ -45,7 +45,6 @@ public function getInstance() { return new InsuranceProductService( $this->getProductFactory(), - $this->getCombinationFactory(), $this->getLinkFactory(), $this->getAlmaInsuranceProductRepository(), $this->getContextFactory(), diff --git a/alma/lib/Factories/AlmaCartItemFactory.php b/alma/lib/Factories/AlmaCartItemFactory.php new file mode 100644 index 000000000..7fa43aace --- /dev/null +++ b/alma/lib/Factories/AlmaCartItemFactory.php @@ -0,0 +1,73 @@ + + * @copyright 2018-2024 Alma SAS + * @license https://opensource.org/licenses/MIT The MIT License + */ + +namespace Alma\PrestaShop\Factories; + +use Alma\PrestaShop\Exceptions\AlmaCartItemFactoryException; +use Alma\PrestaShop\Model\AlmaCartItemModel; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class AlmaCartItemFactory +{ + /** + * @throws AlmaCartItemFactoryException + */ + public function create($product) + { + if (!is_object($product) && !is_array($product)) { + throw new AlmaCartItemFactoryException('Product must be an object or an array'); + } + $cartItemData = []; + if (is_object($product)) { + $cartItemData['id'] = isset($product->id) ? $product->id : null; + $cartItemData['id_product_attribute'] = isset($product->id_product_attribute) ? $product->id_product_attribute : null; + $cartItemData['id_customization'] = isset($product->id_customization) ? $product->id_customization : null; + $cartItemData['quantity'] = isset($product->quantity) ? $product->quantity : null; + $cartItemData['price_with_reduction'] = isset($product->price_with_reduction) ? $product->price_with_reduction : null; + $cartItemData['reference'] = isset($product->reference) ? $product->reference : null; + $cartItemData['name'] = isset($product->name) ? $product->name : null; + } + if (is_array($product)) { + $cartItemData = $product; + } + if ( + empty($cartItemData) || + ( + !isset($cartItemData['id']) || + !isset($cartItemData['id_product_attribute']) || + !isset($cartItemData['quantity']) || + !isset($cartItemData['price_with_reduction']) || + !isset($cartItemData['reference']) || + !isset($cartItemData['name']) + ) + ) { + throw new AlmaCartItemFactoryException('Product array must contain Id, id_product_attribute and quantity'); + } + + return new AlmaCartItemModel($cartItemData); + } +} diff --git a/alma/lib/Factories/CombinationFactory.php b/alma/lib/Factories/CombinationFactory.php index a3050f117..ce61bedac 100644 --- a/alma/lib/Factories/CombinationFactory.php +++ b/alma/lib/Factories/CombinationFactory.php @@ -1,6 +1,6 @@ - * @copyright 2018-2023 Alma SAS + * @copyright 2018-2024 Alma SAS * @license https://opensource.org/licenses/MIT The MIT License */ diff --git a/alma/lib/Factories/LinkFactory.php b/alma/lib/Factories/LinkFactory.php index e04d3c2eb..eda1e31ec 100644 --- a/alma/lib/Factories/LinkFactory.php +++ b/alma/lib/Factories/LinkFactory.php @@ -1,6 +1,6 @@ - * @copyright 2018-2023 Alma SAS + * @copyright 2018-2024 Alma SAS * @license https://opensource.org/licenses/MIT The MIT License */ diff --git a/alma/lib/Factories/ProductFactory.php b/alma/lib/Factories/ProductFactory.php index c5cd4062e..4d18da785 100644 --- a/alma/lib/Factories/ProductFactory.php +++ b/alma/lib/Factories/ProductFactory.php @@ -1,6 +1,6 @@ - * @copyright 2018-2023 Alma SAS + * @copyright 2018-2024 Alma SAS * @license https://opensource.org/licenses/MIT The MIT License */ diff --git a/alma/lib/Helpers/FeePlanHelper.php b/alma/lib/Helpers/FeePlanHelper.php index b40eef42e..421fbf611 100644 --- a/alma/lib/Helpers/FeePlanHelper.php +++ b/alma/lib/Helpers/FeePlanHelper.php @@ -99,8 +99,8 @@ public function getEligibleFeePlans($feePlans, $purchaseAmount) $getDataFromKey = $this->settingsHelper->getDataFromKey($key); if ( - $purchaseAmount > $feePlan->min - && $purchaseAmount < $feePlan->max + $purchaseAmount >= $feePlan->min + && $purchaseAmount <= $feePlan->max ) { $activePlans[] = $getDataFromKey; } diff --git a/alma/lib/Helpers/HookHelper.php b/alma/lib/Helpers/HookHelper.php index 83636821b..5ce85a14a 100644 --- a/alma/lib/Helpers/HookHelper.php +++ b/alma/lib/Helpers/HookHelper.php @@ -95,26 +95,46 @@ public function __construct() 'version' => '1.7.6', 'operand' => '>=', ], - 'actionObjectProductInCartDeleteAfter' => [ - 'version' => '1.7.1', + 'actionAfterDeleteProductInCart' => [ + 'version' => '1.7', 'operand' => '>=', ], + 'actionObjectProductInCartDeleteAfter' => [ + 'version' => '8.1.4', + 'operand' => '>', + ], 'actionCartSave' => 'all', 'actionValidateOrder' => 'all', 'displayCartExtraProductActions' => 'all', 'termsAndConditions' => 'all', + 'actionAdminOrdersListingFieldsModifier' => [ + 'version' => '1.7.5', + 'operand' => '<', + ], 'actionOrderGridQueryBuilderModifier' => [ - 'version' => '1.7.7', + 'version' => '1.7.5', 'operand' => '>=', ], 'actionOrderGridDefinitionModifier' => [ - 'version' => '1.7.7', + 'version' => '1.7.5', 'operand' => '>=', ], + 'displayInvoice' => [ + 'version' => '1.7.7', + 'operand' => '<', + ], 'displayAdminOrderTop' => [ 'version' => '1.7.7', 'operand' => '>=', ], + 'actionFrontControllerSetVariables' => [ + 'version' => '1.7.5', + 'operand' => '>=', + ], + 'actionGetProductPropertiesBefore' => [ + 'version' => '1.7.5', + 'operand' => '<', + ], ]; /** diff --git a/alma/lib/Helpers/PriceHelper.php b/alma/lib/Helpers/PriceHelper.php index 606e9c765..06435fe11 100644 --- a/alma/lib/Helpers/PriceHelper.php +++ b/alma/lib/Helpers/PriceHelper.php @@ -114,8 +114,6 @@ public function convertPriceFromCents($price) */ public function formatPriceToCentsByCurrencyId($cents, $idCurrency = null) { - $legacy = $this->toolsHelper->psVersionCompare('1.7.6.0', '<'); - $currency = $this->contextFactory->getCurrencyFromContext(); $price = $this->convertPriceFromCents($cents); @@ -128,7 +126,7 @@ public function formatPriceToCentsByCurrencyId($cents, $idCurrency = null) $formattedPrice = sprintf('%.2f€', $price); try { - $formattedPrice = $this->toolsHelper->displayPrice($legacy, $price, $currency); + $formattedPrice = $this->toolsHelper->displayPrice($price, $currency); } catch (\Exception $e) { Logger::instance()->warning(sprintf('Price localization error: %s', $e->getMessage())); } diff --git a/alma/lib/Helpers/ProductHelper.php b/alma/lib/Helpers/ProductHelper.php index f9914eb76..8a7d876ad 100644 --- a/alma/lib/Helpers/ProductHelper.php +++ b/alma/lib/Helpers/ProductHelper.php @@ -250,4 +250,30 @@ public function getProductName($product, $languageId, $idProductAttribute = null return htmlspecialchars($productName, ENT_NOQUOTES); } + + /** + * @param $product + * + * @return array + */ + public function getCategoriesName($product) + { + $category = []; + + if ($product instanceof \Product) { + $category = [$product->category]; + } + + if (is_array($product) && isset($product['category'])) { + if ($product['category'] instanceof \Category) { + $category = array_values($product['category']->name); + } + + if (is_string($product['category'])) { + $category = [$product['category']]; + } + } + + return $category; + } } diff --git a/alma/lib/Helpers/ToolsHelper.php b/alma/lib/Helpers/ToolsHelper.php index 5ae195755..26c20a88e 100644 --- a/alma/lib/Helpers/ToolsHelper.php +++ b/alma/lib/Helpers/ToolsHelper.php @@ -24,6 +24,8 @@ namespace Alma\PrestaShop\Helpers; +use PrestaShop\PrestaShop\Core\Localization\Exception\LocalizationException; + if (!defined('_PS_VERSION_')) { exit; } @@ -51,20 +53,19 @@ public function psRound($value, $precision = 0, $roundMode = null) /** * Return price with currency sign for a given product. * - * @see \PrestaShop\PrestaShop\Core\Localization\Locale - * - * @param bool $legacy * @param float $price Product price * @param int|\Currency|array|null $currency Current currency (object, id_currency, NULL => context currency) * * @return string Price correctly formatted (sign, decimal separator...) * if you modify this function, don't forget to modify the Javascript function formatCurrency (in tools.js) * - * @throws \LocalizationException + * @throws LocalizationException + * + * @see \PrestaShop\PrestaShop\Core\Localization\Locale */ - public function displayPrice($legacy, $price, $currency = null) + public function displayPrice($price, $currency = null) { - if ($legacy) { + if ($this->psVersionCompare('1.7.6.0', '<')) { return \Tools::displayPrice($price, $currency); } diff --git a/alma/lib/Model/AlmaCartItemModel.php b/alma/lib/Model/AlmaCartItemModel.php new file mode 100644 index 000000000..d868c4da0 --- /dev/null +++ b/alma/lib/Model/AlmaCartItemModel.php @@ -0,0 +1,128 @@ + + * @copyright 2018-2024 Alma SAS + * @license https://opensource.org/licenses/MIT The MIT License + */ + +namespace Alma\PrestaShop\Model; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class AlmaCartItemModel +{ + /** + * @var string + */ + private $id; + /** + * @var string + */ + private $id_product_attribute; + /** + * @var int + */ + private $id_customization; + /** + * @var int + */ + private $quantity; + /** + * @var float + */ + private $price_with_reduction; + /** + * @var string + */ + private $reference; + /** + * @var string + */ + private $name; + + public function __construct($productArray) + { + $this->id = $productArray['id']; + $this->id_product_attribute = $productArray['id_product_attribute']; + $this->id_customization = $productArray['id_customization'] ?: 0; + $this->quantity = $productArray['quantity']; + $this->price_with_reduction = $productArray['price_with_reduction']; + $this->reference = $productArray['reference']; + $this->name = $productArray['name']; + } + + /** + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * @return string + */ + public function getIdProductAttribute() + { + return $this->id_product_attribute; + } + + /** + * @return int + */ + public function getIdCustomization() + { + return $this->id_customization; + } + + /** + * @return int + */ + public function getQuantity() + { + return $this->quantity; + } + + /** + * @return float + */ + public function getPriceWithReduction() + { + return $this->price_with_reduction; + } + + /** + * @return string + */ + public function getReference() + { + return $this->reference; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } +} diff --git a/alma/lib/Model/CartData.php b/alma/lib/Model/CartData.php index 9a099a495..f1264605c 100644 --- a/alma/lib/Model/CartData.php +++ b/alma/lib/Model/CartData.php @@ -166,7 +166,7 @@ public function getCartItems($cart) 'unit_price' => $this->priceHelper->convertPriceToCents($unitPrice), 'line_price' => $this->priceHelper->convertPriceToCents($linePrice), 'is_gift' => $isGift, - 'categories' => [$productRow['category']], + 'categories' => $this->productHelper->getCategoriesName($productRow), 'url' => $this->productHelper->getProductLink($product, $productRow, $cart), 'picture_url' => $pictureUrl, 'requires_shipping' => $requiresShipping, diff --git a/alma/lib/Model/InsuranceProduct.php b/alma/lib/Model/InsuranceProduct.php index bb186d6c2..f5f5ddaff 100644 --- a/alma/lib/Model/InsuranceProduct.php +++ b/alma/lib/Model/InsuranceProduct.php @@ -106,6 +106,12 @@ class InsuranceProduct extends \ObjectModel /** @var string Live ou test */ public $mode; + /** @var string */ + public $insurance_contract_id; + + /** @var string */ + public $insurance_contract_name; + /** * @see ObjectModel::$definition */ @@ -123,7 +129,8 @@ class InsuranceProduct extends \ObjectModel 'id_address_delivery' => ['type' => self::TYPE_INT, 'validate' => 'isUnsignedId'], 'id_order' => ['type' => self::TYPE_INT, 'validate' => 'isUnsignedId'], 'price' => ['type' => self::TYPE_FLOAT, 'validate' => 'isPrice'], - 'insurance_contract_id' => ['type' => self::TYPE_STRING], + 'insurance_contract_id' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName'], + 'insurance_contract_name' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName'], 'cms_reference' => ['type' => self::TYPE_STRING], 'product_price' => ['type' => self::TYPE_FLOAT, 'validate' => 'isPrice'], 'date_add' => ['type' => self::TYPE_DATE, 'validate' => 'isDate'], @@ -132,12 +139,164 @@ class InsuranceProduct extends \ObjectModel 'subscription_broker_id' => ['type' => self::TYPE_STRING], 'subscription_broker_reference' => ['type' => self::TYPE_STRING], 'subscription_state' => ['type' => self::TYPE_STRING], - 'date_of_cancelation' => ['type' => self::TYPE_DATE, 'validate'], - 'date_of_cancelation_request' => ['type' => self::TYPE_DATE], + 'date_of_cancelation' => ['type' => self::TYPE_DATE, 'validate' => 'isDate'], + 'date_of_cancelation_request' => ['type' => self::TYPE_DATE, 'validate' => 'isDate'], 'reason_of_cancelation' => ['type' => self::TYPE_STRING], 'is_refunded' => ['type' => self::TYPE_BOOL], - 'date_of_refund' => ['type' => self::TYPE_DATE], + 'date_of_refund' => ['type' => self::TYPE_DATE, 'validate' => 'isDate'], 'mode' => ['type' => self::TYPE_STRING], ], ]; + + /** + * @param $null_values + * @param $auto_date + * + * @return bool|int|string + * + * @throws \PrestaShopException + */ + public function save($null_values = false, $auto_date = true) + { + if (version_compare(_PS_VERSION_, '1.7.1.0', '<')) { + return $this->updateWithFullyQualifiedNamespace($null_values); + } else { + return parent::save($null_values, $auto_date); + } + } + + /** + * Updates the current object in the database + * + * @param bool $null_values + * + * @return bool + * + * @throws \PrestaShopException + */ + private function updateWithFullyQualifiedNamespace($null_values = false) + { + // @hook actionObject*UpdateBefore + \Hook::exec('actionObjectUpdateBefore', ['object' => $this]); + \Hook::exec('actionObject' . $this->getFullyQualifiedName() . 'UpdateBefore', ['object' => $this]); + + $this->clearCache(); + + // Automatically fill dates + if (array_key_exists('date_upd', $this)) { + $this->date_upd = date('Y-m-d H:i:s'); + if (isset($this->update_fields) && is_array($this->update_fields) && count($this->update_fields)) { + $this->update_fields['date_upd'] = true; + } + } + + // Automatically fill dates + if (array_key_exists('date_add', $this) && $this->date_add == null) { + $this->date_add = date('Y-m-d H:i:s'); + if (isset($this->update_fields) && is_array($this->update_fields) && count($this->update_fields)) { + $this->update_fields['date_add'] = true; + } + } + + $id_shop_list = \Shop::getContextListShopID(); + if (count($this->id_shop_list) > 0) { + $id_shop_list = $this->id_shop_list; + } + + if (\Shop::checkIdShopDefault($this->def['table']) && !$this->id_shop_default) { + $this->id_shop_default = (in_array(\Configuration::get('PS_SHOP_DEFAULT'), $id_shop_list) == true) ? \Configuration::get('PS_SHOP_DEFAULT') : min($id_shop_list); + } + // Database update + if (!$result = \Db::getInstance()->update($this->def['table'], $this->getFields(), '`' . pSQL($this->def['primary']) . '` = ' . (int) $this->id, 0, $null_values)) { + return false; + } + + // Database insertion for multishop fields related to the object + if (\Shop::isTableAssociated($this->def['table'])) { + $fields = $this->getFieldsShop(); + $fields[$this->def['primary']] = (int) $this->id; + if (is_array($this->update_fields)) { + $update_fields = $this->update_fields; + $this->update_fields = null; + $all_fields = $this->getFieldsShop(); + $all_fields[$this->def['primary']] = (int) $this->id; + $this->update_fields = $update_fields; + } else { + $all_fields = $fields; + } + + foreach ($id_shop_list as $id_shop) { + $fields['id_shop'] = (int) $id_shop; + $all_fields['id_shop'] = (int) $id_shop; + $where = $this->def['primary'] . ' = ' . (int) $this->id . ' AND id_shop = ' . (int) $id_shop; + + // A little explanation of what we do here : we want to create multishop entry when update is called, but + // only if we are in a shop context (if we are in all context, we just want to update entries that alread exists) + $shop_exists = \Db::getInstance()->getValue('SELECT ' . $this->def['primary'] . ' FROM ' . _DB_PREFIX_ . $this->def['table'] . '_shop WHERE ' . $where); + if ($shop_exists) { + $result &= \Db::getInstance()->update($this->def['table'] . '_shop', $fields, $where, 0, $null_values); + } elseif (\Shop::getContext() == \Shop::CONTEXT_SHOP) { + $result &= \Db::getInstance()->insert($this->def['table'] . '_shop', $all_fields, $null_values); + } + } + } + + // Database update for multilingual fields related to the object + if (isset($this->def['multilang']) && $this->def['multilang']) { + $fields = $this->getFieldsLang(); + if (is_array($fields)) { + foreach ($fields as $field) { + foreach (array_keys($field) as $key) { + if (!\Validate::isTableOrIdentifier($key)) { + throw new \PrestaShopException('key ' . $key . ' is not a valid table or identifier'); + } + } + + // If this table is linked to multishop system, update / insert for all shops from context + if ($this->isLangMultishop()) { + $id_shop_list = \Shop::getContextListShopID(); + if (count($this->id_shop_list) > 0) { + $id_shop_list = $this->id_shop_list; + } + foreach ($id_shop_list as $id_shop) { + $field['id_shop'] = (int) $id_shop; + $where = pSQL($this->def['primary']) . ' = ' . (int) $this->id + . ' AND id_lang = ' . (int) $field['id_lang'] + . ' AND id_shop = ' . (int) $id_shop; + + if (\Db::getInstance()->getValue('SELECT COUNT(*) FROM ' . pSQL(_DB_PREFIX_ . $this->def['table']) . '_lang WHERE ' . $where)) { + $result &= \Db::getInstance()->update($this->def['table'] . '_lang', $field, $where); + } else { + $result &= \Db::getInstance()->insert($this->def['table'] . '_lang', $field); + } + } + } + // If this table is not linked to multishop system ... + else { + $where = pSQL($this->def['primary']) . ' = ' . (int) $this->id + . ' AND id_lang = ' . (int) $field['id_lang']; + if (\Db::getInstance()->getValue('SELECT COUNT(*) FROM ' . pSQL(_DB_PREFIX_ . $this->def['table']) . '_lang WHERE ' . $where)) { + $result &= \Db::getInstance()->update($this->def['table'] . '_lang', $field, $where); + } else { + $result &= \Db::getInstance()->insert($this->def['table'] . '_lang', $field, $null_values); + } + } + } + } + } + + // @hook actionObject*UpdateAfter + \Hook::exec('actionObjectUpdateAfter', ['object' => $this]); + \Hook::exec('actionObject' . $this->getFullyQualifiedName() . 'UpdateAfter', ['object' => $this]); + + return $result; + } + + /** + * @return array|string|string[] + */ + private function getFullyQualifiedName() + { + return str_replace('\\', '', get_class($this)); + } } diff --git a/alma/lib/Repositories/AlmaInsuranceProductRepository.php b/alma/lib/Repositories/AlmaInsuranceProductRepository.php index 81172903d..e9b019df7 100644 --- a/alma/lib/Repositories/AlmaInsuranceProductRepository.php +++ b/alma/lib/Repositories/AlmaInsuranceProductRepository.php @@ -26,6 +26,7 @@ use Alma\API\Entities\Insurance\Subscription; use Alma\PrestaShop\Helpers\SettingsHelper; +use Alma\PrestaShop\Model\AlmaCartItemModel; if (!defined('_PS_VERSION_')) { exit; @@ -79,6 +80,7 @@ public function add( 'insurance_contract_id' => $insuranceContractInfos['insurance_contract_id'], 'cms_reference' => $insuranceContractInfos['cms_reference'], 'product_price' => $insuranceContractInfos['product_price'], + 'insurance_contract_name' => $insuranceContractInfos['insurance_contract_name'], 'mode' => SettingsHelper::getActiveMode(), ])) { return false; @@ -284,6 +286,7 @@ public function createTable() `id_order` int(10) unsigned NULL, `price` int(10) unsigned NULL, `insurance_contract_id` varchar(255) NULL, + `insurance_contract_name` varchar(255) NULL, `cms_reference` varchar(255) NULL, `product_price` int(10) unsigned NULL, `date_add` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, @@ -485,9 +488,9 @@ public function getIdByOrderId($orderId, $shopId) } /** - * @param \ProductCore $product - * @param $cartId - * @param $shopId + * @param AlmaCartItemModel $product + * @param int $cartId + * @param int $shopId * * @return mixed * @@ -502,25 +505,36 @@ public function getCountInsuranceProductAttributeByProductAndCartIdAndShopId($pr `price` FROM `' . _DB_PREFIX_ . 'alma_insurance_product` aip WHERE aip.`id_cart` = ' . (int) $cartId . ' - AND aip.`id_product` = ' . (int) $product->id . ' - AND aip.`id_product_attribute` = ' . (int) $product->id_product_attribute . ' - AND aip.`id_customization` = ' . (int) $product->id_customization . ' + AND aip.`id_product` = ' . (int) $product->getId() . ' + AND aip.`id_product_attribute` = ' . (int) $product->getIdProductAttribute() . ' + AND aip.`id_customization` = ' . (int) $product->getIdCustomization() . ' AND aip.`id_shop` = ' . (int) $shopId . ' GROUP BY aip.`id_product_attribute_insurance`'; return \Db::getInstance()->executeS($sql); } + /** + * @param AlmaCartItemModel $product + * @param int $cartId + * @param int $shopId + * @param string $insuranceProductAttribute + * + * @return mixed + * + * @throws \PrestaShopDatabaseException + */ public function getContractByProductAndCartIdAndShopAndInsuranceProductAttribute($product, $cartId, $shopId, $insuranceProductAttribute) { $sql = ' SELECT `id_alma_insurance_product`, - `insurance_contract_id` + `insurance_contract_id`, + `insurance_contract_name` FROM `' . _DB_PREFIX_ . 'alma_insurance_product` aip WHERE aip.`id_cart` = ' . (int) $cartId . ' - AND aip.`id_product` = ' . (int) $product->id . ' - AND aip.`id_product_attribute` = ' . (int) $product->id_product_attribute . ' - AND aip.`id_customization` = ' . (int) $product->id_customization . ' + AND aip.`id_product` = ' . (int) $product->getId() . ' + AND aip.`id_product_attribute` = ' . (int) $product->getIdProductAttribute() . ' + AND aip.`id_customization` = ' . (int) $product->getIdCustomization() . ' AND aip.`id_shop` = ' . (int) $shopId . ' AND aip.`id_product_attribute_insurance` = ' . (int) $insuranceProductAttribute; diff --git a/alma/lib/Services/AttributeProductService.php b/alma/lib/Services/AttributeProductService.php index 2e8defcf1..4ec2ea09a 100644 --- a/alma/lib/Services/AttributeProductService.php +++ b/alma/lib/Services/AttributeProductService.php @@ -26,6 +26,7 @@ use Alma\PrestaShop\Builders\Models\LocaleHelperBuilder; use Alma\PrestaShop\Helpers\LocaleHelper; +use Alma\PrestaShop\Helpers\ToolsHelper; use Alma\PrestaShop\Repositories\AttributeRepository; if (!defined('_PS_VERSION_')) { @@ -48,6 +49,10 @@ class AttributeProductService * @var LocaleHelper */ protected $localeHelper; + /** + * @var ToolsHelper + */ + protected $toolsHelper; public function __construct() { @@ -56,18 +61,22 @@ public function __construct() $this->localeHelper = $localeHelperBuilder->getInstance(); $this->attributeRepository = new AttributeRepository(); + $this->toolsHelper = new ToolsHelper(); } /** - * @param string $name + * @param string $insuranceContractId * @param int $attributeGroupId * * @return int + * + * @throws \PrestaShopDatabaseException + * @throws \PrestaShopException */ - public function getAttributeId($name, $attributeGroupId) + public function getOrCreateAttributeId($insuranceContractId, $attributeGroupId) { $insuranceAttributeId = $this->attributeRepository->getAttributeIdByNameAndGroup( - $name, + $insuranceContractId, $attributeGroupId, $this->context->language->id ); @@ -75,7 +84,7 @@ public function getAttributeId($name, $attributeGroupId) if (!$insuranceAttributeId) { $insuranceAttribute = $this->getProductAttributeObject(); - $insuranceAttribute->name = $this->localeHelper->createMultiLangField($name); + $insuranceAttribute->name = $this->localeHelper->createMultiLangField($insuranceContractId); $insuranceAttribute->id_attribute_group = $attributeGroupId; $insuranceAttribute->add(); @@ -115,10 +124,17 @@ public function getIdProductAttributeFromPost($idProduct) $idProductAttribute = (int) \Tools::getValue('product_attribute_id'); if (\Tools::getIsset('group')) { - $idProductAttribute = (int) \Product::getIdProductAttributeByIdAttributes( - $idProduct, - \Tools::getValue('group') - ); + if ($this->toolsHelper->psVersionCompare('1.7.4.0', '<')) { + $idProductAttribute = (int) \Product::getIdProductAttributesByIdAttributes( + $idProduct, + \Tools::getValue('group') + ); + } else { + $idProductAttribute = (int) \Product::getIdProductAttributeByIdAttributes( + $idProduct, + \Tools::getValue('group') + ); + } } return $idProductAttribute; diff --git a/alma/lib/Services/CombinationProductAttributeService.php b/alma/lib/Services/CombinationProductAttributeService.php index cf1d0a5d0..1bcd37999 100644 --- a/alma/lib/Services/CombinationProductAttributeService.php +++ b/alma/lib/Services/CombinationProductAttributeService.php @@ -59,7 +59,7 @@ public function __construct() * * @return int */ - public function manageCombination($product, $attributeId, $reference, $price, $quantity, $shopId = 1, $outOfStock = 1) + public function getOrCreateCombination($product, $attributeId, $reference, $price, $quantity, $shopId = 1, $outOfStock = 1) { /** * @var \CombinationCore $combinaison diff --git a/alma/lib/Services/InsuranceApiService.php b/alma/lib/Services/InsuranceApiService.php index 32d8d4348..04772deae 100644 --- a/alma/lib/Services/InsuranceApiService.php +++ b/alma/lib/Services/InsuranceApiService.php @@ -104,7 +104,7 @@ public function getInsuranceContractFiles($insuranceContractId, $cmsReference, $ $insuranceContractId, $cmsReference, $productPrice, - $this->context->session->getId(), + $this->context->cookie->checksum, $this->cartHelper->getCartIdFromContext() )->getFiles(); @@ -140,7 +140,7 @@ public function getInsuranceContract($insuranceContractId, $cmsReference, $produ $insuranceContractId, $cmsReference, $productPrice, - $this->context->session->getId(), + $this->context->cookie->checksum, $this->cartHelper->getCartIdFromContext() ); } catch (\Exception $e) { @@ -174,7 +174,7 @@ public function subscribeInsurance($subscriptionData, $order, $orderPayment = fa $subscriptionData, $order->id, $idTransaction, - $this->context->session->getId(), + $this->context->cookie->checksum, $order->id_cart ); diff --git a/alma/lib/Services/InsuranceProductService.php b/alma/lib/Services/InsuranceProductService.php index a8c2aa9ab..9c3268ae2 100644 --- a/alma/lib/Services/InsuranceProductService.php +++ b/alma/lib/Services/InsuranceProductService.php @@ -26,7 +26,6 @@ use Alma\PrestaShop\Exceptions\AlmaException; use Alma\PrestaShop\Exceptions\InsuranceContractException; -use Alma\PrestaShop\Factories\CombinationFactory; use Alma\PrestaShop\Factories\ContextFactory; use Alma\PrestaShop\Factories\LinkFactory; use Alma\PrestaShop\Factories\ProductFactory; @@ -38,8 +37,10 @@ use Alma\PrestaShop\Helpers\ProductHelper; use Alma\PrestaShop\Helpers\ToolsHelper; use Alma\PrestaShop\Logger; +use Alma\PrestaShop\Model\AlmaCartItemModel; use Alma\PrestaShop\Repositories\AlmaInsuranceProductRepository; use Alma\PrestaShop\Repositories\ProductRepository; +use PrestaShop\PrestaShop\Core\Localization\Exception\LocalizationException; if (!defined('_PS_VERSION_')) { exit; @@ -116,10 +117,6 @@ class InsuranceProductService * @var ProductFactory */ protected $productFactory; - /** - * @var CombinationFactory - */ - protected $combinationFactory; /** * @var \Link */ @@ -152,7 +149,6 @@ class InsuranceProductService */ public function __construct( $productFactory, - $combinationFactory, $linkFactory, $almaInsuranceProductRepository, $contextFactory, @@ -171,7 +167,6 @@ public function __construct( $toolsHelper ) { $this->productFactory = $productFactory; - $this->combinationFactory = $combinationFactory; $this->link = $linkFactory->create(); $this->almaInsuranceProductRepository = $almaInsuranceProductRepository; $this->context = $contextFactory->getContext(); @@ -236,7 +231,7 @@ public function addAssociations( * @param int $idProduct * @param \ProductCore $insuranceProduct * @param float $insurancePrice - * @param string $insuranceName + * @param string $insuranceContractId * @param int $quantity * @param int $idCustomization * @param array $insuranceContractInfos @@ -252,27 +247,28 @@ public function addInsuranceProduct( $idProduct, $insuranceProduct, $insurancePrice, - $insuranceName, + $insuranceContractId, $quantity, $idCustomization, $insuranceContractInfos, $cart = null ) { + $insuranceContractId = str_replace('insurance_contract_', '', $insuranceContractId); $idProductAttribute = $this->attributeProductService->getIdProductAttributeFromPost($idProduct); $insuranceAttributeGroupId = $this->attributeGroupProductService->getIdAttributeGroupByName( ConstantsHelper::ALMA_INSURANCE_ATTRIBUTE_NAME ); - $insuranceAttributeId = $this->attributeProductService->getAttributeId( - $insuranceName, + $insuranceAttributeId = $this->attributeProductService->getOrCreateAttributeId( + $insuranceContractId, $insuranceAttributeGroupId ); // Check if the combination already exists - $idProductAttributeInsurance = $this->combinationProductAttributeService->manageCombination( + $idProductAttributeInsurance = $this->combinationProductAttributeService->getOrCreateCombination( $insuranceProduct, $insuranceAttributeId, - $insuranceName, + $insuranceContractId, $insurancePrice, $quantity, $this->context->shop->id @@ -331,13 +327,14 @@ public function addInsuranceProductInPsCart($idProduct, $insuranceContractId, $q $idProduct, $insuranceProduct, $this->priceHelper->convertPriceFromCents($insuranceContract->getPrice()), - $insuranceContract->getName(), + $insuranceContract->getId(), $quantity, $idCustomization, [ 'insurance_contract_id' => $insuranceContractId, 'cms_reference' => $cmsReference, 'product_price' => $staticPriceInCents, + 'insurance_contract_name' => $insuranceContract->getName(), ], $cart ); @@ -375,13 +372,14 @@ public function canHandleAddingProductInsuranceOnce() } /** - * @param $product - * @param $cartId - * @param $insuranceProductId + * @param AlmaCartItemModel $product + * @param int $cartId + * @param string $insuranceProductId * * @return array * * @throws \PrestaShopDatabaseException + * @throws LocalizationException */ public function getItemsCartInsuranceProductAttributes($product, $cartId, $insuranceProductId) { @@ -398,7 +396,6 @@ public function getItemsCartInsuranceProductAttributes($product, $cartId, $insur $linkRewrite = $almaInsuranceProduct->link_rewrite[$this->context->language->id]; foreach ($almaInsurancesByAttribute as $almaInsurance) { - $almaProductAttribute = $this->combinationFactory->create((int) $almaInsurance['id_product_attribute_insurance']); $contractAlmaInsuranceProduct = $this->almaInsuranceProductRepository->getContractByProductAndCartIdAndShopAndInsuranceProductAttribute( $product, $cartId, @@ -414,8 +411,9 @@ public function getItemsCartInsuranceProductAttributes($product, $cartId, $insur $idImage, $this->imageHelper->getFormattedImageTypeName('cart') ), - 'reference' => $almaProductAttribute->reference, - 'price' => $this->priceHelper->convertPriceFromCents($almaInsurance['price']), + 'reference' => $contractAlmaInsuranceProduct[0]['insurance_contract_name'], + 'unitPrice' => $this->toolsHelper->displayPrice($this->priceHelper->convertPriceFromCents($almaInsurance['price']), $this->context->currency), + 'price' => $this->toolsHelper->displayPrice($this->priceHelper->convertPriceFromCents($almaInsurance['price'] * $almaInsurance['nbInsurance']), $this->context->currency), 'quantity' => $almaInsurance['nbInsurance'], 'insuranceContractId' => $contractAlmaInsuranceProduct[0]['insurance_contract_id'], 'idsAlmaInsuranceProduct' => $this->toolsHelper->getJsonValues($contractAlmaInsuranceProduct, 'id_alma_insurance_product'), diff --git a/alma/lib/Services/InsuranceSubscriptionService.php b/alma/lib/Services/InsuranceSubscriptionService.php index 7bfd9e8e6..4fd3040e9 100644 --- a/alma/lib/Services/InsuranceSubscriptionService.php +++ b/alma/lib/Services/InsuranceSubscriptionService.php @@ -148,7 +148,7 @@ protected function confirmSubscription($orderId, $shopId, $subscription) $insuranceProduct = new InsuranceProduct($almaInsuranceProduct['id_alma_insurance_product']); $insuranceProduct->subscription_id = $subscription['id']; - + $insuranceProduct->insurance_contract_id = $subscription['contract_id']; $insuranceProduct->subscription_amount = $subscription['amount']; $insuranceProduct->subscription_state = $subscription['state']; $insuranceProduct->save(); diff --git a/alma/lib/Services/OrderService.php b/alma/lib/Services/OrderService.php index ded1fdbb8..582a6d9de 100644 --- a/alma/lib/Services/OrderService.php +++ b/alma/lib/Services/OrderService.php @@ -69,6 +69,10 @@ public function manageStatusUpdate($order, $orderState = null) $orderState = $order->getCurrentOrderState(); } + if (!$orderState) { + return; + } + $paymentTransactionId = $this->getPaymentTransactionId($order); $almaPayment = $this->getAlmaPayment($paymentTransactionId, $order->reference); diff --git a/alma/tests/Unit/Builders/InsuranceHelperBuilderTest.php b/alma/tests/Unit/Builders/InsuranceHelperBuilderTest.php index bb1cc2019..6ecd556c3 100644 --- a/alma/tests/Unit/Builders/InsuranceHelperBuilderTest.php +++ b/alma/tests/Unit/Builders/InsuranceHelperBuilderTest.php @@ -1,6 +1,6 @@ - * @copyright 2018-2023 Alma SAS + * @copyright 2018-2024 Alma SAS * @license https://opensource.org/licenses/MIT The MIT License */ diff --git a/alma/tests/Unit/Builders/Repositories/InsuranceProductRepositoryBuilderTest.php b/alma/tests/Unit/Builders/Repositories/InsuranceProductRepositoryBuilderTest.php index 4b66b841d..1e199983a 100644 --- a/alma/tests/Unit/Builders/Repositories/InsuranceProductRepositoryBuilderTest.php +++ b/alma/tests/Unit/Builders/Repositories/InsuranceProductRepositoryBuilderTest.php @@ -1,6 +1,6 @@ - * @copyright 2018-2023 Alma SAS + * @copyright 2018-2024 Alma SAS * @license https://opensource.org/licenses/MIT The MIT License */ diff --git a/alma/tests/Unit/Controllers/Hook/ActionFrontControllerSetVariablesHookControllerTest.php b/alma/tests/Unit/Controllers/Hook/ActionFrontControllerSetVariablesHookControllerTest.php new file mode 100644 index 000000000..fa313c9c9 --- /dev/null +++ b/alma/tests/Unit/Controllers/Hook/ActionFrontControllerSetVariablesHookControllerTest.php @@ -0,0 +1,143 @@ + + * @copyright 2018-2024 Alma SAS + * @license https://opensource.org/licenses/MIT The MIT License + */ + +namespace Alma\PrestaShop\Tests\Unit\Controllers\Hook; + +use Alma\PrestaShop\Controllers\Hook\ActionFrontControllerSetVariablesHookController; +use Alma\PrestaShop\Helpers\ConstantsHelper; +use Alma\PrestaShop\Repositories\ProductRepository; +use PHPUnit\Framework\TestCase; + +class ActionFrontControllerSetVariablesHookControllerTest extends TestCase +{ + /** + * @var ProductRepository + */ + protected $productRepository; + /** + * @var \Module + */ + protected $module; + + public function setUp() + { + $this->productRepository = $this->createMock(ProductRepository::class); + $this->module = $this->createMock(\Module::class); + $this->insuranceProductId = '22'; + } + + /** + * @return void + */ + public function tearDown() + { + $this->productRepository = null; + $this->module = null; + $this->insuranceProductId = null; + } + + /** + * @dataProvider paramsDataProvider + * + * @return void + */ + public function testRunWithWrongParams($params) + { + $controller = new ActionFrontControllerSetVariablesHookController($this->module); + $this->assertFalse($controller->run($params)); + } + + /** + * @return void + */ + public function testRunWithCorrectParamsAndNoInsuranceProduct() + { + $idProduct = '12'; + $this->productRepository->expects($this->once()) + ->method('getProductIdByReference') + ->with(ConstantsHelper::ALMA_INSURANCE_PRODUCT_REFERENCE) + ->willReturn($this->insuranceProductId); + $params = [ + 'templateVars' => [ + 'page' => [ + 'page_name' => 'product', + 'body_classes' => [ + "product-id-${idProduct}", + ], + ], + ], + ]; + $controller = new ActionFrontControllerSetVariablesHookController($this->module, $this->productRepository); + $this->assertFalse($controller->run($params)); + } + + /** + * @return void + */ + public function testRunWithCorrectParamsAndInsuranceProduct() + { + $idProduct = '22'; + $this->productRepository->expects($this->once()) + ->method('getProductIdByReference') + ->with(ConstantsHelper::ALMA_INSURANCE_PRODUCT_REFERENCE) + ->willReturn($this->insuranceProductId); + $params = [ + 'templateVars' => [ + 'page' => [ + 'page_name' => 'product', + 'body_classes' => [ + "product-id-${idProduct}" => true, + ], + ], + ], + ]; + $controller = new ActionFrontControllerSetVariablesHookController($this->module, $this->productRepository); + $this->assertTrue($controller->run($params)); + } + + /** + * @return array + */ + public function paramsDataProvider() + { + return [ + 'params without page key' => [ + [ + 'templateVars' => [ + ], + ], + ], + 'params without configuration key' => [ + [ + 'templateVars' => [ + 'page' => [ + 'page_name' => 'toto', + ], + ], + ], + ], + ]; + } +} diff --git a/alma/tests/Unit/Controllers/Hook/ActionGetProductPropertiesBeforeHookControllerTest.php b/alma/tests/Unit/Controllers/Hook/ActionGetProductPropertiesBeforeHookControllerTest.php new file mode 100644 index 000000000..75944c21c --- /dev/null +++ b/alma/tests/Unit/Controllers/Hook/ActionGetProductPropertiesBeforeHookControllerTest.php @@ -0,0 +1,135 @@ + + * @copyright 2018-2024 Alma SAS + * @license https://opensource.org/licenses/MIT The MIT License + */ + +namespace Alma\PrestaShop\Tests\Unit\Controllers\Hook; + +use Alma\PrestaShop\Controllers\Hook\ActionGetProductPropertiesBeforeHookController; +use Alma\PrestaShop\Helpers\ConstantsHelper; +use PHPUnit\Framework\TestCase; + +class ActionGetProductPropertiesBeforeHookControllerTest extends TestCase +{ + /** + * @var \Context + */ + protected $context; + /** + * @var \Module + */ + protected $module; + + /** + * @return void + */ + public function setUp() + { + $this->context = $this->createMock(\Context::class); + $this->context->smarty = $this->createMock(\Smarty::class); + $this->module = $this->createMock(\Module::class); + } + + /** + * @return void + */ + public function tearDown() + { + $this->context->smarty = null; + $this->module = null; + } + + /** + * @dataProvider paramsDataProvider + * + * @return void + */ + public function testRunWithWrongParams($params) + { + $this->context->smarty->expects($this->never()) + ->method('assign'); + $controller = new ActionGetProductPropertiesBeforeHookController($this->module); + $controller->run($params); + } + + /** + * @return void + */ + public function testRunWithNotInsuranceProduct() + { + $this->context->smarty->expects($this->never()) + ->method('assign'); + $params = [ + 'product' => [ + 'reference' => 'reference-product', + ], + 'context' => $this->context, + ]; + + $controller = new ActionGetProductPropertiesBeforeHookController($this->module); + $controller->run($params); + } + + /** + * @return void + */ + public function testRunWithCorrectParams() + { + $this->context->smarty->expects($this->once()) + ->method('assign') + ->with([ + 'configuration' => [ + 'is_catalog' => true, + 'display_taxes_label' => null, + ], + ]); + + $params = [ + 'product' => [ + 'reference' => ConstantsHelper::ALMA_INSURANCE_PRODUCT_REFERENCE, + ], + 'context' => $this->context, + ]; + + $controller = new ActionGetProductPropertiesBeforeHookController($this->module); + $controller->run($params); + } + + /** + * @return array + */ + public function paramsDataProvider() + { + return [ + 'params without product' => [ + [ + 'context' => $this->context, + ], + ], + 'params with product and no context' => [ + [ + 'product' => ['title' => 'product', 'reference' => '123456'], + ], + ], + ]; + } +} diff --git a/alma/tests/Unit/Controllers/Hook/index.php b/alma/tests/Unit/Controllers/Hook/index.php new file mode 100644 index 000000000..eebdd7186 --- /dev/null +++ b/alma/tests/Unit/Controllers/Hook/index.php @@ -0,0 +1,32 @@ + + * @copyright 2018-2024 Alma SAS + * @license https://opensource.org/licenses/MIT The MIT License + */ +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/alma/tests/Unit/Controllers/index.php b/alma/tests/Unit/Controllers/index.php new file mode 100644 index 000000000..eebdd7186 --- /dev/null +++ b/alma/tests/Unit/Controllers/index.php @@ -0,0 +1,32 @@ + + * @copyright 2018-2024 Alma SAS + * @license https://opensource.org/licenses/MIT The MIT License + */ +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/alma/tests/Unit/Factories/AlmaCartItemFactoryTest.php b/alma/tests/Unit/Factories/AlmaCartItemFactoryTest.php new file mode 100644 index 000000000..0257f0092 --- /dev/null +++ b/alma/tests/Unit/Factories/AlmaCartItemFactoryTest.php @@ -0,0 +1,139 @@ + + * @copyright 2018-2024 Alma SAS + * @license https://opensource.org/licenses/MIT The MIT License + */ + +namespace Alma\PrestaShop\Tests\Unit\Factories; + +use Alma\PrestaShop\Exceptions\AlmaCartItemFactoryException; +use Alma\PrestaShop\Factories\AlmaCartItemFactory; +use Alma\PrestaShop\Model\AlmaCartItemModel; +use Alma\PrestaShop\Tests\Unit\Model\AlmaCartItemModelTest; +use PHPUnit\Framework\TestCase; + +class AlmaCartItemFactoryTest extends TestCase +{ + public function setUp() + { + $this->almaCartItemModelArrayData = AlmaCartItemModelTest::almaCartItemArrayData(); + $this->almaCartItemFactory = new AlmaCartItemFactory(); + $this->almaCartItemModel = new AlmaCartItemModel($this->almaCartItemModelArrayData); + } + + public function tearDown() + { + $this->almaCartItemModelArrayData = null; + $this->almaCartItemFactory = null; + $this->almaCartItemModel = null; + } + + /** + * @dataProvider wrongProductDataProvider + * + * @throws AlmaCartItemFactoryException + */ + public function testCreateAlmaCartItemFactoryWithWrongData($product) + { + $this->expectException(AlmaCartItemFactoryException::class); + $this->almaCartItemFactory->create($product); + } + + /** + * @throws AlmaCartItemFactoryException + */ + public function testCreateAlmaCartItemFactoryWithWrongDataInArray() + { + $product = [ + 'wrongkeyid' => '1', + 'id_product_attribute' => 2, + 'id_customization' => 0, + 'quantity' => 3, + ]; + + $this->expectException(AlmaCartItemFactoryException::class); + $this->almaCartItemFactory->create($product); + } + + /** + * @throws AlmaCartItemFactoryException + */ + public function testCreateAlmaCartItemFactoryWithWrongDataInObject() + { + $product = new \stdClass(); + $product->wrongkeyid = '1'; + $product->id_product_attribute = '2'; + $product->id_customization = 0; + $product->quantity = 3; + + $this->expectException(AlmaCartItemFactoryException::class); + $this->almaCartItemFactory->create($product); + } + + /** + * @return void + * + * @throws AlmaCartItemFactoryException + */ + public function testCreateAlmaCartItemWithProductListingLazyArray() + { + $product = new \stdClass(); + $product->id = '1'; + $product->id_product_attribute = '2'; + $product->id_customization = 0; + $product->quantity = 3; + $product->price_with_reduction = 100.00; + $product->reference = 'ABC123'; + $product->name = 'Name of product'; + + $this->assertEquals($this->almaCartItemModel, $this->almaCartItemFactory->create($product)); + } + + /** + * @throws AlmaCartItemFactoryException + */ + public function testCreateAlmaCartItemFactoryWithArray() + { + $this->assertEquals($this->almaCartItemModel, $this->almaCartItemFactory->create($this->almaCartItemModelArrayData)); + } + + /** + * @return array + */ + public function wrongProductDataProvider() + { + return [ + 'String' => [ + 'toto', + ], + 'Int' => [ + 1, + ], + 'Empty' => [ + [], + ], + 'Boolean' => [ + true, + ], + ]; + } +} diff --git a/alma/tests/Unit/Helper/FeePlanHelperTest.php b/alma/tests/Unit/Helper/FeePlanHelperTest.php index dbbcc2426..2874e6e41 100644 --- a/alma/tests/Unit/Helper/FeePlanHelperTest.php +++ b/alma/tests/Unit/Helper/FeePlanHelperTest.php @@ -28,6 +28,7 @@ use Alma\API\Entities\FeePlan; use Alma\PrestaShop\Builders\Helpers\FeePlanHelperBuilder; use Alma\PrestaShop\Factories\EligibilityFactory; +use Alma\PrestaShop\Helpers\FeePlanHelper; use Alma\PrestaShop\Helpers\SettingsHelper; use PHPUnit\Framework\TestCase; @@ -151,4 +152,40 @@ public function testGetEligibleFeePlans() $this->assertEquals([$installementData], $feePlanHelper->getEligibleFeePlans($feePlans, 300)); } + + public function testGetEligibleFeePlansOnLimitMinMax() + { + $installementCountOne = [ + 'installmentsCount' => 1, + 'deferredDays' => 0, + 'deferredMonths' => 0, + ]; + $installementCountThree = [ + 'installmentsCount' => 3, + 'deferredDays' => 0, + 'deferredMonths' => 0, + ]; + + $installementDataArray = [ + $installementCountOne, + $installementCountThree, + ]; + + $settingsHelper = $this->createMock(SettingsHelper::class); + $settingsHelper->expects($this->exactly(2))->method('getDataFromKey')->willReturnOnConsecutiveCalls($installementCountOne, $installementCountThree); + + $eligibilityFactory = $this->createMock(EligibilityFactory::class); + + $feePlanHelper = new FeePlanHelper( + $settingsHelper, + $eligibilityFactory + ); + + $feePlans = [ + 'general_1_0_0' => new FeePlan(['min' => 100, 'max' => 1000]), + 'general_3_0_0' => new FeePlan(['min' => 50, 'max' => 100]), + ]; + + $this->assertEquals($installementDataArray, $feePlanHelper->getEligibleFeePlans($feePlans, 100)); + } } diff --git a/alma/tests/Unit/Helper/ProductHelperTest.php b/alma/tests/Unit/Helper/ProductHelperTest.php new file mode 100644 index 000000000..d9772ad52 --- /dev/null +++ b/alma/tests/Unit/Helper/ProductHelperTest.php @@ -0,0 +1,145 @@ + + * @copyright 2018-2024 Alma SAS + * @license https://opensource.org/licenses/MIT The MIT License + */ + +namespace Alma\PrestaShop\Tests\Unit\Helper; + +use Alma\PrestaShop\Helpers\ProductHelper; +use PHPUnit\Framework\TestCase; + +class ProductHelperTest extends TestCase +{ + /** + * @var ProductHelper + */ + protected $productHelper; + /** + * @var \Category + */ + protected $categoryMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Product|(\Product&\PHPUnit_Framework_MockObject_MockObject) + */ + protected $productMock; + + /** + * @return void + */ + public function setUp() + { + $this->productHelper = new ProductHelper(); + $this->categoryMock = $this->createMock(\Category::class); + $this->productMock = $this->createMock(\Product::class); + } + + public function tearDown() + { + $this->productHelper = null; + $this->categoryMock = null; + $this->productMock = null; + } + + /** + * @return void + */ + public function testGetCategoryNameWithArray() + { + $productArray = [ + 'id_product' => 1, + 'category' => 'category-name', + ]; + $expected = ['category-name']; + + $this->assertEquals($expected, $this->productHelper->getCategoriesName($productArray)); + } + + /** + * @return void + */ + public function testGetCategoryNameWithCategoryObject() + { + $this->categoryMock->id = 23; + $this->categoryMock->id_category = '23'; + $this->categoryMock->name = [ + 'Category Name', + 'Category Name 2', + ]; + $product = [ + 'category' => $this->categoryMock, + ]; + + $expected = [ + 'Category Name', + 'Category Name 2', + ]; + + $this->assertEquals($expected, $this->productHelper->getCategoriesName($product)); + } + + /** + * @return void + */ + public function testGetCategoryNameWithObjectProduct() + { + $this->productMock->id = 25; + $this->productMock->category = 'category-name-object'; + + $this->assertEquals(['category-name-object'], $this->productHelper->getCategoriesName($this->productMock)); + } + + /** + * @dataProvider wrongDataProvider + * + * @return void + */ + public function testGetCategoryNameWithWrongData($product) + { + $this->assertEquals([], $this->productHelper->getCategoriesName($product)); + } + + /** + * @return array + */ + public function wrongDataProvider() + { + $object = new \stdClass(); + $object->id = 24; + $object->name = 'category-name'; + $product = [ + 'category' => $object, + ]; + + return [ + 'object not Category' => [ + $product, + ], + 'product is string' => [ + 'product', + ], + 'product is int' => [1], + 'product is null' => [null], + 'product is false' => [false], + 'product is true' => [true], + ]; + } +} diff --git a/alma/tests/Unit/Model/AlmaCartItemModelTest.php b/alma/tests/Unit/Model/AlmaCartItemModelTest.php new file mode 100644 index 000000000..74c533b5a --- /dev/null +++ b/alma/tests/Unit/Model/AlmaCartItemModelTest.php @@ -0,0 +1,89 @@ + + * @copyright 2018-2024 Alma SAS + * @license https://opensource.org/licenses/MIT The MIT License + */ + +namespace Alma\PrestaShop\Tests\Unit\Model; + +use Alma\PrestaShop\Model\AlmaCartItemModel; +use PHPUnit\Framework\TestCase; + +class AlmaCartItemModelTest extends TestCase +{ + /** + * @var AlmaCartItemModel + */ + protected $almaCartItemModel; + /** + * @var array + */ + protected $almaCartItemArrayData; + + public function setUp() + { + $this->almaCartItemArrayData = static::almaCartItemArrayData(); + $this->almaCartItemModel = new AlmaCartItemModel($this->almaCartItemArrayData); + } + + public function tearDown() + { + $this->almaCartItemModel = null; + } + + /** + * @return void + */ + public function testGetterAlmaCartItemModel() + { + $this->assertInstanceOf(AlmaCartItemModel::class, $this->almaCartItemModel); + $this->assertEquals($this->almaCartItemArrayData['id'], $this->almaCartItemModel->getId()); + $this->assertEquals($this->almaCartItemArrayData['id_product_attribute'], $this->almaCartItemModel->getIdProductAttribute()); + $this->assertEquals($this->almaCartItemArrayData['id_customization'], $this->almaCartItemModel->getIdCustomization()); + $this->assertEquals($this->almaCartItemArrayData['quantity'], $this->almaCartItemModel->getQuantity()); + $this->assertEquals($this->almaCartItemArrayData['price_with_reduction'], $this->almaCartItemModel->getPriceWithReduction()); + $this->assertEquals($this->almaCartItemArrayData['reference'], $this->almaCartItemModel->getReference()); + $this->assertEquals($this->almaCartItemArrayData['name'], $this->almaCartItemModel->getName()); + } + + public function testIdCustomizationNullSaveZero() + { + $this->almaCartItemArrayData['id_customization'] = null; + $almaCartItem = new AlmaCartItemModel($this->almaCartItemArrayData); + $this->assertEquals(0, $almaCartItem->getIdCustomization()); + } + + /** + * @return array + */ + public static function almaCartItemArrayData() + { + return [ + 'id' => '1', + 'id_product_attribute' => '2', + 'id_customization' => 0, + 'quantity' => 3, + 'price_with_reduction' => 100.00, + 'reference' => 'ABC123', + 'name' => 'Name of product', + ]; + } +} diff --git a/alma/tests/Unit/Model/CartDataTest.php b/alma/tests/Unit/Model/CartDataTest.php index 3c75e185c..092fc04b4 100644 --- a/alma/tests/Unit/Model/CartDataTest.php +++ b/alma/tests/Unit/Model/CartDataTest.php @@ -60,6 +60,7 @@ public function testGetCartItems($items, $expected) $productHelper = $this->createMock(ProductHelper::class); $productHelper->method('getImageLink')->willReturn('https://prestashop-a-1-7-8-7.local.test/1-large_default/product_test.jpg'); $productHelper->method('getProductLink')->willReturn('https://prestashop-a-1-7-8-7.local.test/1-1-product_test.html#/1-size-s/8-color-white'); + $productHelper->method('getCategoriesName')->willReturn(['category_test']); $productHelper->method('createProduct')->with()->willReturn(new \Product(null, false, 1)); $summaryDetailsMock = ['products' => $items, 'gift_products' => []]; @@ -226,6 +227,9 @@ public function getCombinations() ]; } + /** + * @return void + */ public function testGetCartExclusion() { $cart = \Mockery::mock(\Cart::class); @@ -252,16 +256,4 @@ public function testGetCartExclusion() $this->assertEquals(['2' => 'cateexclue'], $result); } - - public function testIncludeTaxes() - { - } - - public function testCartInfo() - { - } - - public function testGetCartDiscounts() - { - } } diff --git a/alma/tests/Unit/Services/InsuranceProductServiceTest.php b/alma/tests/Unit/Services/InsuranceProductServiceTest.php index d2b0591c4..eb1bf04cb 100644 --- a/alma/tests/Unit/Services/InsuranceProductServiceTest.php +++ b/alma/tests/Unit/Services/InsuranceProductServiceTest.php @@ -24,7 +24,6 @@ namespace Alma\PrestaShop\Tests\Unit\Services; -use Alma\PrestaShop\Factories\CombinationFactory; use Alma\PrestaShop\Factories\ContextFactory; use Alma\PrestaShop\Factories\LinkFactory; use Alma\PrestaShop\Factories\ProductFactory; @@ -44,6 +43,7 @@ use Alma\PrestaShop\Services\InsuranceProductService; use Alma\PrestaShop\Services\InsuranceService; use PHPUnit\Framework\TestCase; +use PrestaShop\PrestaShop\Core\Localization\Exception\LocalizationException; class InsuranceProductServiceTest extends TestCase { @@ -67,14 +67,6 @@ class InsuranceProductServiceTest extends TestCase * @var ProductFactory */ protected $productFactoryMock; - /** - * @var CombinationFactory - */ - protected $combinationFactoryMock; - /** - * @var \Combination - */ - protected $combinationMock; /** * @var \Product */ @@ -119,7 +111,6 @@ public function setUp() $this->contextFactoryMock = \Mockery::mock(ContextFactory::class)->makePartial(); $this->almaInsuranceProductRepository = $this->createMock(AlmaInsuranceProductRepository::class); $this->productFactoryMock = $this->createMock(ProductFactory::class); - $this->combinationFactoryMock = $this->createMock(CombinationFactory::class); $this->linkFactoryMock = $this->createMock(LinkFactory::class); $this->linkFactoryMock->method('create')->willReturn($this->linkMock); $this->cart = $this->createMock(\Cart::class); @@ -131,8 +122,6 @@ public function setUp() $this->shop->id = 1; $this->productMock = $this->createMock(\Product::class); $this->productInsuranceMock = $this->createMock(\Product::class); - $this->combinationMock = $this->createMock(\Combination::class); - $this->combinationMock2 = $this->createMock(\Combination::class); $this->context->shop = $this->shop; $this->context->language = $this->languageMock; $this->imageHelperMock = $this->createMock(ImageHelper::class); @@ -141,7 +130,6 @@ public function setUp() $this->insuranceProductServiceMock = \Mockery::mock(InsuranceProductService::class, [ $this->productFactoryMock, - $this->combinationFactoryMock, $this->linkFactoryMock, $this->almaInsuranceProductRepository, $this->contextFactoryMock, @@ -173,6 +161,7 @@ public function tearDown() /** * @throws \PrestaShopDatabaseException + * @throws LocalizationException */ public function testGetItemCartInsuranceProductAttributes() { @@ -182,7 +171,8 @@ public function testGetItemCartInsuranceProductAttributes() 'nameInsuranceProduct' => 'Name insurance Alma', 'urlImageInsuranceProduct' => '//url_image', 'reference' => 'Reference Vol + Casse Alma', - 'price' => 47.899999999999999, + 'unitPrice' => '47.90 €', + 'price' => '95.80 €', 'quantity' => '2', 'insuranceContractId' => 'insurance_contract_ABCD123', 'idsAlmaInsuranceProduct' => '["22","23"]', @@ -192,7 +182,8 @@ public function testGetItemCartInsuranceProductAttributes() 'nameInsuranceProduct' => 'Name insurance Alma', 'urlImageInsuranceProduct' => '//url_image', 'reference' => 'Reference Vol Alma', - 'price' => 22.899999999999999, + 'unitPrice' => '22.90 €', + 'price' => '22.90 €', 'quantity' => '1', 'insuranceContractId' => 'insurance_contract_EFGH456', 'idsAlmaInsuranceProduct' => '["24"]', @@ -203,12 +194,14 @@ public function testGetItemCartInsuranceProductAttributes() 'nbInsurance' => '2', 'id_product_insurance' => '21', 'id_product_attribute_insurance' => '33', - 'price' => '4790', + 'unitPrice' => '4790', + 'price' => '9580', ], [ 'nbInsurance' => '1', 'id_product_insurance' => '21', 'id_product_attribute_insurance' => '34', + 'unitPrice' => '2290', 'price' => '2290', ], ]; @@ -216,16 +209,19 @@ public function testGetItemCartInsuranceProductAttributes() [ 'id_alma_insurance_product' => '22', 'insurance_contract_id' => 'insurance_contract_ABCD123', + 'insurance_contract_name' => 'Reference Vol + Casse Alma', ], [ 'id_alma_insurance_product' => '23', 'insurance_contract_id' => 'insurance_contract_ABCD123', + 'insurance_contract_name' => 'Reference Vol + Casse Alma', ], ]; $returnContractByProduct2 = [ [ 'id_alma_insurance_product' => '24', 'insurance_contract_id' => 'insurance_contract_EFGH456', + 'insurance_contract_name' => 'Reference Vol Alma', ], ]; $this->productMock->id = 27; @@ -235,25 +231,22 @@ public function testGetItemCartInsuranceProductAttributes() $this->productInsuranceMock->name = [ '1' => 'Name insurance Alma', ]; - $this->combinationMock->reference = 'Reference Vol + Casse Alma'; - $this->combinationMock2->reference = 'Reference Vol Alma'; $this->productInsuranceMock->link_rewrite = [1 => '']; $this->toolsHelperMock->expects($this->exactly(2)) ->method('getJsonValues') ->willReturnOnConsecutiveCalls('["22","23"]', '["24"]'); - $this->priceHelperMock->expects($this->exactly(2)) - ->method('convertPriceFromCents') - ->willReturnOnConsecutiveCalls(47.899999999999999, 22.899999999999999); + $this->priceHelperMock->expects($this->exactly(4)) + ->method('convertPriceFromCents'); + $this->toolsHelperMock->expects($this->exactly(4)) + ->method('displayPrice') + ->willReturnOnConsecutiveCalls('47.90 €', '95.80 €', '22.90 €', '22.90 €'); $this->linkMock->expects($this->exactly(2)) ->method('getImageLink') ->willReturn('url_image'); $this->almaInsuranceProductRepository->expects($this->exactly(2)) ->method('getContractByProductAndCartIdAndShopAndInsuranceProductAttribute') ->willReturnOnConsecutiveCalls($returnContractByProduct1, $returnContractByProduct2); - $this->combinationFactoryMock->expects($this->exactly(2)) - ->method('create') - ->willReturnOnConsecutiveCalls($this->combinationMock, $this->combinationMock2); $this->productInsuranceMock->expects($this->once()) ->method('getImages') ->willReturn([ diff --git a/alma/translations/de.php b/alma/translations/de.php index 2737e545a..063c136d1 100644 --- a/alma/translations/de.php +++ b/alma/translations/de.php @@ -31,7 +31,7 @@ $_MODULE['<{alma}prestashop>alma_7bab99339291e7eea710b4a998e663de'] = 'Alma erfordert die PHP-cURL-Erweiterung'; $_MODULE['<{alma}prestashop>alma_fbb47375d2272bef79f5722a183bf1ec'] = 'Alma erfordert die PHP-JSON-Erweiterung'; $_MODULE['<{alma}prestashop>alma_7fb83ba9cf3cc38857a2ddae98534d22'] = 'Alma erfordert OpenSSL 1.0.1 oder höher'; -$_MODULE['<{alma}prestashop>modulefactorytest_2c53dea2326232a2d867ddd1d2206aa0'] = 'Jetzt per Kreditkarte bezahlen'; +$_MODULE['<{alma}prestashop>modulefactorytest_5914ca153abaf8a2af61e13e7fe7e829'] = 'Mein Wortlaut zum Übersetzen'; $_MODULE['<{alma}prestashop>wrongcredentialsexception_cc76de47de858ac2fa2964f534ecfdfb'] = 'Could not connect to Alma using your API keys.'; $_MODULE['<{alma}prestashop>wrongcredentialsexception_733b6ddadc31fd97174b0cfe69b584c9'] = 'Please double check your keys on your %1$sAlma dashboard%2$s.'; $_MODULE['<{alma}prestashop>wrongparamsexception_8ec75b5f68c49d1d6541b1e318a8120d'] = 'Error(s) key(s): %1$s.'; @@ -143,15 +143,9 @@ $_MODULE['<{alma}prestashop>customfieldshelper_7a854e750fe5f3e7120020c7c20987d4'] = 'Ihr Warenkorb ist nicht für Zahlungen mit Alma geeignet.'; $_MODULE['<{alma}prestashop>customfieldshelper_6ed45ebd72fcca0fc0c271128e9d7b7b'] = 'Beim Versand'; $_MODULE['<{alma}prestashop>apihelper_fc610b81ff31f9d969ddb659cd8248c1'] = 'Alma ist beim Abrufen des Händlerstatus auf einen Fehler gestoßen. Bitte überprüfen Sie Ihre Api-Schlüssel oder versuchen Sie es später erneut.'; -$_MODULE['<{alma}prestashop>insurancehelper_eaff1bdf24fcffe0e14e29a1bff51a12'] = 'Insurance'; -$_MODULE['<{alma}prestashop>insurancehelper_f1206f9fadc5ce41694f69129aecac26'] = 'Configure'; -$_MODULE['<{alma}prestashop>insurancehelper_7442e29d7d53e549b78d93c46b8cdcfc'] = 'Orders'; $_MODULE['<{alma}prestashop>admininsurancehelper_eaff1bdf24fcffe0e14e29a1bff51a12'] = 'Insurance'; $_MODULE['<{alma}prestashop>admininsurancehelper_f1206f9fadc5ce41694f69129aecac26'] = 'Configure'; $_MODULE['<{alma}prestashop>admininsurancehelper_7442e29d7d53e549b78d93c46b8cdcfc'] = 'Orders'; -$_MODULE['<{alma}prestashop>insurancehelper_eaff1bdf24fcffe0e14e29a1bff51a12'] = 'Insurance'; -$_MODULE['<{alma}prestashop>insurancehelper_f1206f9fadc5ce41694f69129aecac26'] = 'Configure'; -$_MODULE['<{alma}prestashop>insurancehelper_7442e29d7d53e549b78d93c46b8cdcfc'] = 'Orders'; $_MODULE['<{alma}prestashop>insuranceservice_d87aee5118a62a7ff6c21e4ac31006c5'] = 'I hereby acknowledge my acceptance to subscribe to the insurance offered by Alma. In doing so, I confirm that I have previously reviewed the [information notice, which constitutes the general conditions], the [insurance product information document], and the [pre-contractual information and advice sheet]. I ahead to it without reservation and agree to electronically sign the various documents forming my contract, if applicable. I expressly consent to the collection and use of my personal data for the purpose of subscribing to and managing my insurance contract(s).'; $_MODULE['<{alma}prestashop>adminalmainsuranceconfiguration_b824200e9b8aca1fbb762d6566ff0cd7'] = 'Your configuration has been saved'; $_MODULE['<{alma}prestashop>adminalmainsuranceconfiguration_4a39c6a33c3441762924914168d2a387'] = 'Error creating configuration Alma insurance: %1$s'; @@ -197,6 +191,7 @@ $_MODULE['<{alma}prestashop>getcontenthookcontroller_5f265dfcb9ab68a1258ec25393ffb886'] = 'Module Manager'; $_MODULE['<{alma}prestashop>getcontenthookcontroller_c6e24f81cb99e08c3d56b191c00aea28'] = 'Modul-Manager - Liste'; $_MODULE['<{alma}prestashop>frontheaderhookcontroller_0bbf1fb0708055cf522541b4151894c4'] = 'To manage your purchases with Assurance, please go to the checkout page.'; +$_MODULE['<{alma}prestashop>frontheaderhookcontroller_8f1e80580ceb2bb7a54a7288ea169b30'] = 'Die Alma-Versicherung kann nur in den Warenkorb gelegt werden, wenn sie mit einem versicherungsfähigen Produkt verbunden ist. Sie wird auf der betreffenden Produktseite angeboten.'; $_MODULE['<{alma}prestashop>displaypaymenthookcontroller_afd8ac1c65e1519d6a890e5f98558a52'] = '%1$s dann %2$d x %3$s'; $_MODULE['<{alma}prestashop>displaypaymenthookcontroller_bc69b42c4bd339154f9025f3299ad146'] = '%1$s heute dann %2$d x %3$s'; $_MODULE['<{alma}prestashop>displaypaymenthookcontroller_9088921432b295dfe6f02863b2dc0ff8'] = '0 € heute dann %1$s am %2$s'; @@ -302,19 +297,6 @@ $_MODULE['<{alma}prestashop>getcontent_8c10d3b0970a247fc554062dc9055fd1'] = 'Für Zahlungen in %1$d Raten muss der Höchstbetrag zwischen %2$d und %3$d liegen.'; $_MODULE['<{alma}prestashop>getcontent_84b96a3ca61f4425b3fd56534a89a653'] = 'Es ist nicht möglich, die Einstellungen des Check-out zu speichern, bitte versuchen Sie es später noch einmal'; $_MODULE['<{alma}prestashop>getcontent_7f40d377cc4942c4f0d6e75a736f8445'] = 'Konfiguration gespeichert'; -$_MODULE['<{alma}prestashop>getcontent_9f246d669c560d2ac604f5e01c8dd981'] = 'Um Alma zu verwenden, gehen Sie bitte folgendermaßen vor'; -$_MODULE['<{alma}prestashop>getcontent_7379f16a6f4551a47731893ecfce52ab'] = '1. PrestaShop-Konto zuordnen (gleich unten)'; -$_MODULE['<{alma}prestashop>getcontent_54f458d63e438020e62552dc28f23925'] = '2. Erstellen Sie ein Alma-Konto'; -$_MODULE['<{alma}prestashop>getcontent_e243bbd390b43c9ee6047fab4ab3cdc0'] = 'Lesen Sie unseren Leitfaden für den Einstieg'; -$_MODULE['<{alma}prestashop>getcontent_45d67e5114ba6e1f894f12c0c8ac6538'] = '3. Geben Sie Ihren API-Schlüssel ein'; -$_MODULE['<{alma}prestashop>getcontent_055f421849c2a1c32b885c95540f827c'] = 'Finden Sie Ihren API-Live-Schlüssel auf Ihrem %1$s Alma Dashboard%2$s'; -$_MODULE['<{alma}prestashop>getcontent_83b4d24aae962bb5581ba5720be20666'] = 'Um den Testmodus zu verwenden, rufen Sie Ihren Test-API-Schlüssel von Ihrem %1$s sandbox dashboard%2$sab.'; -$_MODULE['<{alma}prestashop>getcontent_41d0063d3bb7d3067f46734fac8b27c4'] = 'Wir bieten das PrestaShop Account Modul zum Download an'; -$_MODULE['<{alma}prestashop>getcontent_6997dde298b14fbf6a7c95bd39fe8dc4'] = 'Das Modul %1$sfinden Sie hier%2$s'; -$_MODULE['<{alma}prestashop>cartproducts_39f9a4a4bf8387aa7c0478f98b713f91'] = 'Remove insurance'; -$_MODULE['<{alma}prestashop>cartproducts_7da9ba421c3f84f283070d68bb7adca1'] = 'Alma Versicherung'; -$_MODULE['<{alma}prestashop>cartproducts_adcd954ece839e7da469e9b37801fa69'] = 'Schützen Sie Ihr Produkt mit'; -$_MODULE['<{alma}prestashop>cartproducts_4cc10fb1d9332d404cc8016b47a1afd1'] = 'Siehe verfügbare Versicherungspolicen'; $_MODULE['<{alma}prestashop>widgetaddinsuranceproducts_f1aab89a3a1e86807c8dffa61d41ded6'] = 'Schützen Sie den Rest Ihrer Produkte mit'; $_MODULE['<{alma}prestashop>widgetaddinsuranceproducts_f28220d70798406523119d998573b489'] = 'Ich möchte alle verbleibenden [1]%1$s[/1] in meinem Warenkorb versichern'; $_MODULE['<{alma}prestashop>fees_3acc62b245d8bc10f04d81f69d85b685'] = '(ohne Gebühren)'; diff --git a/alma/translations/en.php b/alma/translations/en.php index 937aa93ad..98e702b2d 100644 --- a/alma/translations/en.php +++ b/alma/translations/en.php @@ -31,7 +31,7 @@ $_MODULE['<{alma}prestashop>alma_7bab99339291e7eea710b4a998e663de'] = 'Alma requires the CURL PHP extension.'; $_MODULE['<{alma}prestashop>alma_fbb47375d2272bef79f5722a183bf1ec'] = 'Alma requires the JSON PHP extension.'; $_MODULE['<{alma}prestashop>alma_7fb83ba9cf3cc38857a2ddae98534d22'] = 'Alma requires OpenSSL >= 1.0.1'; -$_MODULE['<{alma}prestashop>modulefactorytest_2c53dea2326232a2d867ddd1d2206aa0'] = 'Pay now by credit card'; +$_MODULE['<{alma}prestashop>modulefactorytest_5914ca153abaf8a2af61e13e7fe7e829'] = 'My wording to translate'; $_MODULE['<{alma}prestashop>wrongcredentialsexception_cc76de47de858ac2fa2964f534ecfdfb'] = 'Could not connect to Alma using your API keys.'; $_MODULE['<{alma}prestashop>wrongcredentialsexception_733b6ddadc31fd97174b0cfe69b584c9'] = 'Please double check your keys on your %1$sAlma dashboard%2$s.'; $_MODULE['<{alma}prestashop>wrongparamsexception_8ec75b5f68c49d1d6541b1e318a8120d'] = 'Error(s) key(s): %1$s.'; @@ -143,15 +143,9 @@ $_MODULE['<{alma}prestashop>customfieldshelper_7a854e750fe5f3e7120020c7c20987d4'] = 'Your cart is not eligible for payments with Alma.'; $_MODULE['<{alma}prestashop>customfieldshelper_6ed45ebd72fcca0fc0c271128e9d7b7b'] = 'At shipping'; $_MODULE['<{alma}prestashop>apihelper_fc610b81ff31f9d969ddb659cd8248c1'] = 'Alma encountered an error when fetching merchant status, please check your api keys or retry later.'; -$_MODULE['<{alma}prestashop>insurancehelper_eaff1bdf24fcffe0e14e29a1bff51a12'] = 'Insurance'; -$_MODULE['<{alma}prestashop>insurancehelper_f1206f9fadc5ce41694f69129aecac26'] = 'Configure'; -$_MODULE['<{alma}prestashop>insurancehelper_7442e29d7d53e549b78d93c46b8cdcfc'] = 'Orders'; $_MODULE['<{alma}prestashop>admininsurancehelper_eaff1bdf24fcffe0e14e29a1bff51a12'] = 'Insurance'; $_MODULE['<{alma}prestashop>admininsurancehelper_f1206f9fadc5ce41694f69129aecac26'] = 'Configure'; $_MODULE['<{alma}prestashop>admininsurancehelper_7442e29d7d53e549b78d93c46b8cdcfc'] = 'Orders'; -$_MODULE['<{alma}prestashop>insurancehelper_eaff1bdf24fcffe0e14e29a1bff51a12'] = 'Insurance'; -$_MODULE['<{alma}prestashop>insurancehelper_f1206f9fadc5ce41694f69129aecac26'] = 'Configure'; -$_MODULE['<{alma}prestashop>insurancehelper_7442e29d7d53e549b78d93c46b8cdcfc'] = 'Orders'; $_MODULE['<{alma}prestashop>insuranceservice_d87aee5118a62a7ff6c21e4ac31006c5'] = 'I hereby acknowledge my acceptance to subscribe to the insurance offered by Alma. In doing so, I confirm that I have previously reviewed the [information notice, which constitutes the general conditions], the [insurance product information document], and the [pre-contractual information and advice sheet]. I ahead to it without reservation and agree to electronically sign the various documents forming my contract, if applicable. I expressly consent to the collection and use of my personal data for the purpose of subscribing to and managing my insurance contract(s).'; $_MODULE['<{alma}prestashop>adminalmainsuranceconfiguration_b824200e9b8aca1fbb762d6566ff0cd7'] = 'Your configuration has been saved'; $_MODULE['<{alma}prestashop>adminalmainsuranceconfiguration_4a39c6a33c3441762924914168d2a387'] = 'Error creating configuration Alma insurance: %1$s'; @@ -197,6 +191,7 @@ $_MODULE['<{alma}prestashop>getcontenthookcontroller_5f265dfcb9ab68a1258ec25393ffb886'] = 'Module Manager'; $_MODULE['<{alma}prestashop>getcontenthookcontroller_c6e24f81cb99e08c3d56b191c00aea28'] = 'Module Manager - List'; $_MODULE['<{alma}prestashop>frontheaderhookcontroller_0bbf1fb0708055cf522541b4151894c4'] = 'To manage your purchases with Assurance, please go to the checkout page.'; +$_MODULE['<{alma}prestashop>frontheaderhookcontroller_8f1e80580ceb2bb7a54a7288ea169b30'] = 'Alma insurance can only be added to your cart if it is associated with a product eligible for insurance. It will be offered on the product page concerned.'; $_MODULE['<{alma}prestashop>displaypaymenthookcontroller_afd8ac1c65e1519d6a890e5f98558a52'] = '%1$s then %2$d x %3$s'; $_MODULE['<{alma}prestashop>displaypaymenthookcontroller_bc69b42c4bd339154f9025f3299ad146'] = '%1$s today then %2$d x %3$s'; $_MODULE['<{alma}prestashop>displaypaymenthookcontroller_9088921432b295dfe6f02863b2dc0ff8'] = '0 € today then %1$s on %2$s'; @@ -302,19 +297,6 @@ $_MODULE['<{alma}prestashop>getcontent_8c10d3b0970a247fc554062dc9055fd1'] = 'Maximum amount for %1$d-installment plan must be within %2$d and %3$d.'; $_MODULE['<{alma}prestashop>getcontent_84b96a3ca61f4425b3fd56534a89a653'] = 'Impossible to save the Share of Checkout settings, please try again later'; $_MODULE['<{alma}prestashop>getcontent_7f40d377cc4942c4f0d6e75a736f8445'] = 'Settings successfully updated'; -$_MODULE['<{alma}prestashop>getcontent_9f246d669c560d2ac604f5e01c8dd981'] = 'To use Alma, please follow these steps'; -$_MODULE['<{alma}prestashop>getcontent_7379f16a6f4551a47731893ecfce52ab'] = '1. Associate PrestaShop account (just below)'; -$_MODULE['<{alma}prestashop>getcontent_54f458d63e438020e62552dc28f23925'] = '2. Create an Alma account'; -$_MODULE['<{alma}prestashop>getcontent_e243bbd390b43c9ee6047fab4ab3cdc0'] = 'Consult our getting started guide'; -$_MODULE['<{alma}prestashop>getcontent_45d67e5114ba6e1f894f12c0c8ac6538'] = '3. Enter your API key'; -$_MODULE['<{alma}prestashop>getcontent_055f421849c2a1c32b885c95540f827c'] = 'Find your API live key on your %1$s Alma dashboard%2$s'; -$_MODULE['<{alma}prestashop>getcontent_83b4d24aae962bb5581ba5720be20666'] = 'To use Test mode, retrieve your Test API key from your %1$s sandbox dashboard%2$s'; -$_MODULE['<{alma}prestashop>getcontent_41d0063d3bb7d3067f46734fac8b27c4'] = 'We offer to download the PrestaShop Account module'; -$_MODULE['<{alma}prestashop>getcontent_6997dde298b14fbf6a7c95bd39fe8dc4'] = 'You can find the module %1$shere%2$s'; -$_MODULE['<{alma}prestashop>cartproducts_39f9a4a4bf8387aa7c0478f98b713f91'] = 'Remove insurance'; -$_MODULE['<{alma}prestashop>cartproducts_7da9ba421c3f84f283070d68bb7adca1'] = 'Alma insurance'; -$_MODULE['<{alma}prestashop>cartproducts_adcd954ece839e7da469e9b37801fa69'] = 'Protect your product with'; -$_MODULE['<{alma}prestashop>cartproducts_4cc10fb1d9332d404cc8016b47a1afd1'] = 'See available insurance policies'; $_MODULE['<{alma}prestashop>widgetaddinsuranceproducts_f1aab89a3a1e86807c8dffa61d41ded6'] = 'Protect the rest of your products with'; $_MODULE['<{alma}prestashop>widgetaddinsuranceproducts_f28220d70798406523119d998573b489'] = 'I want to insure all the remaining [1]%1$s[/1] in my cart'; $_MODULE['<{alma}prestashop>fees_3acc62b245d8bc10f04d81f69d85b685'] = '(No additional fees)'; diff --git a/alma/translations/es.php b/alma/translations/es.php index 4820207be..81e68fb3a 100644 --- a/alma/translations/es.php +++ b/alma/translations/es.php @@ -31,7 +31,7 @@ $_MODULE['<{alma}prestashop>alma_7bab99339291e7eea710b4a998e663de'] = 'Alma requiere la extensión PHP CURL.'; $_MODULE['<{alma}prestashop>alma_fbb47375d2272bef79f5722a183bf1ec'] = 'Alma requiere la extensión PHP JSON'; $_MODULE['<{alma}prestashop>alma_7fb83ba9cf3cc38857a2ddae98534d22'] = 'Alma requiere OpenSSL >= 1.0.1'; -$_MODULE['<{alma}prestashop>modulefactorytest_2c53dea2326232a2d867ddd1d2206aa0'] = 'Paga ahora con tarjeta de crédito'; +$_MODULE['<{alma}prestashop>modulefactorytest_5914ca153abaf8a2af61e13e7fe7e829'] = 'Mi redacción para traducir'; $_MODULE['<{alma}prestashop>wrongcredentialsexception_cc76de47de858ac2fa2964f534ecfdfb'] = 'No se pudo conectar a Alma utilizando tus claves de API.'; $_MODULE['<{alma}prestashop>wrongcredentialsexception_733b6ddadc31fd97174b0cfe69b584c9'] = 'Por favor, vuelve a comprobar tus claves en tu %1$sPanel de control Alma%2$s.'; $_MODULE['<{alma}prestashop>wrongparamsexception_8ec75b5f68c49d1d6541b1e318a8120d'] = 'Clave(s) de error(es): %1$s.'; @@ -143,15 +143,9 @@ $_MODULE['<{alma}prestashop>customfieldshelper_7a854e750fe5f3e7120020c7c20987d4'] = 'Su cesta no es elegible para los pagos con Alma.'; $_MODULE['<{alma}prestashop>customfieldshelper_6ed45ebd72fcca0fc0c271128e9d7b7b'] = 'En el envío'; $_MODULE['<{alma}prestashop>apihelper_fc610b81ff31f9d969ddb659cd8248c1'] = 'Alma ha encontrado un error al obtener el estado del comerciante, por favor, comprueba tus claves api o vuelve a intentar más tarde.'; -$_MODULE['<{alma}prestashop>insurancehelper_eaff1bdf24fcffe0e14e29a1bff51a12'] = 'Seguros'; -$_MODULE['<{alma}prestashop>insurancehelper_f1206f9fadc5ce41694f69129aecac26'] = 'Configure'; -$_MODULE['<{alma}prestashop>insurancehelper_7442e29d7d53e549b78d93c46b8cdcfc'] = 'Pedidos'; $_MODULE['<{alma}prestashop>admininsurancehelper_eaff1bdf24fcffe0e14e29a1bff51a12'] = 'Seguros'; $_MODULE['<{alma}prestashop>admininsurancehelper_f1206f9fadc5ce41694f69129aecac26'] = 'Configura'; $_MODULE['<{alma}prestashop>admininsurancehelper_7442e29d7d53e549b78d93c46b8cdcfc'] = 'Pedidos'; -$_MODULE['<{alma}prestashop>insurancehelper_eaff1bdf24fcffe0e14e29a1bff51a12'] = 'Seguros'; -$_MODULE['<{alma}prestashop>insurancehelper_f1206f9fadc5ce41694f69129aecac26'] = 'Configura'; -$_MODULE['<{alma}prestashop>insurancehelper_7442e29d7d53e549b78d93c46b8cdcfc'] = 'Pedidos'; $_MODULE['<{alma}prestashop>insuranceservice_d87aee5118a62a7ff6c21e4ac31006c5'] = 'Por la presente acepto suscribir el seguro ofrecido por Alma. Al hacerlo, confirmo que he revisado previamente el [aviso informativo, que constituye las condiciones generales], el [documento de información sobre el producto de seguro] y la [hoja de información y asesoramiento precontractual]. Y sin reservas, acepto firmar electrónicamente los distintos documentos que forman mi contrato, si procede. Consiento expresamente la recolección y utilización de mis datos personales a efectos de la suscripción y gestión de mi(s) contrato(s) de seguro.'; $_MODULE['<{alma}prestashop>adminalmainsuranceconfiguration_b824200e9b8aca1fbb762d6566ff0cd7'] = 'Tu configuración se ha guardado'; $_MODULE['<{alma}prestashop>adminalmainsuranceconfiguration_4a39c6a33c3441762924914168d2a387'] = 'Error al crear la configuración Alma insurance: %1$s'; @@ -197,6 +191,7 @@ $_MODULE['<{alma}prestashop>getcontenthookcontroller_5f265dfcb9ab68a1258ec25393ffb886'] = 'Gestor de módulos'; $_MODULE['<{alma}prestashop>getcontenthookcontroller_c6e24f81cb99e08c3d56b191c00aea28'] = 'Gestor de módulos - Lista'; $_MODULE['<{alma}prestashop>frontheaderhookcontroller_0bbf1fb0708055cf522541b4151894c4'] = 'Para gestionar tus compras con Assurance, ve a la página de pago.'; +$_MODULE['<{alma}prestashop>frontheaderhookcontroller_8f1e80580ceb2bb7a54a7288ea169b30'] = 'El seguro Alma sólo puede añadirse a su cesta si está asociado a un producto susceptible de seguro. Se ofrecerá en la página del producto en cuestión.'; $_MODULE['<{alma}prestashop>displaypaymenthookcontroller_afd8ac1c65e1519d6a890e5f98558a52'] = '%1$s entonces %2$d x %3$s'; $_MODULE['<{alma}prestashop>displaypaymenthookcontroller_bc69b42c4bd339154f9025f3299ad146'] = '%1$s hoy después %2$d x %3$s'; $_MODULE['<{alma}prestashop>displaypaymenthookcontroller_9088921432b295dfe6f02863b2dc0ff8'] = '0 € hoy después %1$s en %2$s'; @@ -302,19 +297,6 @@ $_MODULE['<{alma}prestashop>getcontent_8c10d3b0970a247fc554062dc9055fd1'] = 'El importe máximo de los pagos en %1$d plazos debe ser de entre %2$d y %3$d.'; $_MODULE['<{alma}prestashop>getcontent_84b96a3ca61f4425b3fd56534a89a653'] = 'Imposible guardar la configuración de Share of Checkout, por favor inténtalo de nuevo más tarde.'; $_MODULE['<{alma}prestashop>getcontent_7f40d377cc4942c4f0d6e75a736f8445'] = 'Configuración guardada correctamente'; -$_MODULE['<{alma}prestashop>getcontent_9f246d669c560d2ac604f5e01c8dd981'] = 'Para utilizar Alma, sigue estos pasos'; -$_MODULE['<{alma}prestashop>getcontent_7379f16a6f4551a47731893ecfce52ab'] = '1. Asociar cuenta PrestaShop (justo debajo)'; -$_MODULE['<{alma}prestashop>getcontent_54f458d63e438020e62552dc28f23925'] = '2. Crear una cuenta Alma'; -$_MODULE['<{alma}prestashop>getcontent_e243bbd390b43c9ee6047fab4ab3cdc0'] = 'Consulta nuestra guía de iniciación'; -$_MODULE['<{alma}prestashop>getcontent_45d67e5114ba6e1f894f12c0c8ac6538'] = '3. Introduce tu clave API'; -$_MODULE['<{alma}prestashop>getcontent_055f421849c2a1c32b885c95540f827c'] = 'Encuentre tu API live key en tu %1$s Alma dashboard%2$s'; -$_MODULE['<{alma}prestashop>getcontent_83b4d24aae962bb5581ba5720be20666'] = 'Para utilizar el modo de prueba, obten tu clave de API de prueba en el panel de control de tu sandbox %1$s%2$s'; -$_MODULE['<{alma}prestashop>getcontent_41d0063d3bb7d3067f46734fac8b27c4'] = 'Te proponemos descargar el módulo Cuenta PrestaShop'; -$_MODULE['<{alma}prestashop>getcontent_6997dde298b14fbf6a7c95bd39fe8dc4'] = 'Encontrarás el módulo %1$saquí%2$s'; -$_MODULE['<{alma}prestashop>cartproducts_39f9a4a4bf8387aa7c0478f98b713f91'] = 'Quitar el seguro'; -$_MODULE['<{alma}prestashop>cartproducts_7da9ba421c3f84f283070d68bb7adca1'] = 'Seguro Alma'; -$_MODULE['<{alma}prestashop>cartproducts_adcd954ece839e7da469e9b37801fa69'] = 'Proteje tu producto con'; -$_MODULE['<{alma}prestashop>cartproducts_4cc10fb1d9332d404cc8016b47a1afd1'] = 'Ver los seguros disponibles'; $_MODULE['<{alma}prestashop>widgetaddinsuranceproducts_f1aab89a3a1e86807c8dffa61d41ded6'] = 'Proteje el resto de tus productos con'; $_MODULE['<{alma}prestashop>widgetaddinsuranceproducts_f28220d70798406523119d998573b489'] = 'Quiero asegurar todos los [1]%1$s[/1] que quedan en mi cesta'; $_MODULE['<{alma}prestashop>fees_3acc62b245d8bc10f04d81f69d85b685'] = '(Sin gastos)'; diff --git a/alma/translations/fr.php b/alma/translations/fr.php index 63498c112..91a161af6 100644 --- a/alma/translations/fr.php +++ b/alma/translations/fr.php @@ -31,7 +31,7 @@ $_MODULE['<{alma}prestashop>alma_7bab99339291e7eea710b4a998e663de'] = 'Alma nécessite l\'extension PHP cURL'; $_MODULE['<{alma}prestashop>alma_fbb47375d2272bef79f5722a183bf1ec'] = 'Alma nécessite l\'extension PHP JSON'; $_MODULE['<{alma}prestashop>alma_7fb83ba9cf3cc38857a2ddae98534d22'] = 'Alma nécessite OpenSSL >= 1.0.1'; -$_MODULE['<{alma}prestashop>modulefactorytest_2c53dea2326232a2d867ddd1d2206aa0'] = 'Payer maintenant par carte bancaire'; +$_MODULE['<{alma}prestashop>modulefactorytest_5914ca153abaf8a2af61e13e7fe7e829'] = 'Ma formulation à traduire'; $_MODULE['<{alma}prestashop>wrongcredentialsexception_cc76de47de858ac2fa2964f534ecfdfb'] = 'Impossible de se connecter à Alma en utilisant vos clés API.'; $_MODULE['<{alma}prestashop>wrongcredentialsexception_733b6ddadc31fd97174b0cfe69b584c9'] = 'Veuillez vérifier vos clés sur votre tableau de bord %1$sAlma%2$s.'; $_MODULE['<{alma}prestashop>wrongparamsexception_8ec75b5f68c49d1d6541b1e318a8120d'] = 'Clé(s) d\'erreur : %1$s.'; @@ -143,15 +143,9 @@ $_MODULE['<{alma}prestashop>customfieldshelper_7a854e750fe5f3e7120020c7c20987d4'] = 'Paiements avec Alma indisponibles'; $_MODULE['<{alma}prestashop>customfieldshelper_6ed45ebd72fcca0fc0c271128e9d7b7b'] = 'À l\'expédition'; $_MODULE['<{alma}prestashop>apihelper_fc610b81ff31f9d969ddb659cd8248c1'] = 'Alma a rencontré une erreur lors de la récupération du statut du marchand, veuillez vérifier vos clés d\'api ou réessayer plus tard.'; -$_MODULE['<{alma}prestashop>insurancehelper_eaff1bdf24fcffe0e14e29a1bff51a12'] = 'Assurance'; -$_MODULE['<{alma}prestashop>insurancehelper_f1206f9fadc5ce41694f69129aecac26'] = 'Configurer'; -$_MODULE['<{alma}prestashop>insurancehelper_7442e29d7d53e549b78d93c46b8cdcfc'] = 'Commandes'; $_MODULE['<{alma}prestashop>admininsurancehelper_eaff1bdf24fcffe0e14e29a1bff51a12'] = 'Assurance'; $_MODULE['<{alma}prestashop>admininsurancehelper_f1206f9fadc5ce41694f69129aecac26'] = 'Configurer'; $_MODULE['<{alma}prestashop>admininsurancehelper_7442e29d7d53e549b78d93c46b8cdcfc'] = 'Commandes'; -$_MODULE['<{alma}prestashop>insurancehelper_eaff1bdf24fcffe0e14e29a1bff51a12'] = 'Assurance'; -$_MODULE['<{alma}prestashop>insurancehelper_f1206f9fadc5ce41694f69129aecac26'] = 'Configurer'; -$_MODULE['<{alma}prestashop>insurancehelper_7442e29d7d53e549b78d93c46b8cdcfc'] = 'Commandes'; $_MODULE['<{alma}prestashop>insuranceservice_d87aee5118a62a7ff6c21e4ac31006c5'] = 'Par la présente, je reconnais accepter de souscrire à l\'assurance proposée par Alma. Ce faisant, je confirme avoir préalablement pris connaissance de la [notice d\'information valant conditions générales], du [document d\'information sur le produit d\'assurance], et de la [fiche d\'information et de conseil précontractuelle]. J\'y adhère sans réserve et accepte de signer électroniquement les différents documents formant mon contrat, le cas échéant. Je consens expressément à la collecte et à l\'utilisation de mes données personnelles aux fins de la souscription et de la gestion de mon (mes) contrat(s) d\'assurance.'; $_MODULE['<{alma}prestashop>adminalmainsuranceconfiguration_b824200e9b8aca1fbb762d6566ff0cd7'] = 'Votre configuration a été sauvegardée'; $_MODULE['<{alma}prestashop>adminalmainsuranceconfiguration_4a39c6a33c3441762924914168d2a387'] = 'Erreur lors de la création de la configuration Assurance Alma : %1$s'; @@ -197,6 +191,7 @@ $_MODULE['<{alma}prestashop>getcontenthookcontroller_5f265dfcb9ab68a1258ec25393ffb886'] = 'Gestionnaire de module'; $_MODULE['<{alma}prestashop>getcontenthookcontroller_c6e24f81cb99e08c3d56b191c00aea28'] = 'Gestionnaire de module - Liste'; $_MODULE['<{alma}prestashop>frontheaderhookcontroller_0bbf1fb0708055cf522541b4151894c4'] = 'Pour gérer vos achats avec Assurance, veuillez vous rendre à la page de paiement.'; +$_MODULE['<{alma}prestashop>frontheaderhookcontroller_8f1e80580ceb2bb7a54a7288ea169b30'] = 'L\'assurance Alma ne peut être ajoutée à votre panier que si elle est associée à un produit éligible à l\'assurance. Elle sera proposée sur la page du produit concerné.'; $_MODULE['<{alma}prestashop>displaypaymenthookcontroller_afd8ac1c65e1519d6a890e5f98558a52'] = '%1$s puis %2$d x %3$s'; $_MODULE['<{alma}prestashop>displaypaymenthookcontroller_bc69b42c4bd339154f9025f3299ad146'] = '%1$s aujourd\'hui puis %2$d x %3$s'; $_MODULE['<{alma}prestashop>displaypaymenthookcontroller_9088921432b295dfe6f02863b2dc0ff8'] = '0 € aujourd\'hui puis %1$s le %2$s'; @@ -302,19 +297,6 @@ $_MODULE['<{alma}prestashop>getcontent_8c10d3b0970a247fc554062dc9055fd1'] = 'Le montant maximum pour les paiements en %1$d fois doit être entre %2$d et %3$d.'; $_MODULE['<{alma}prestashop>getcontent_84b96a3ca61f4425b3fd56534a89a653'] = 'Impossible d\'enregistrer le partage des paramètres de paiement, veuillez réessayer plus tard.'; $_MODULE['<{alma}prestashop>getcontent_7f40d377cc4942c4f0d6e75a736f8445'] = 'Configuration enregistrée avec succès'; -$_MODULE['<{alma}prestashop>getcontent_9f246d669c560d2ac604f5e01c8dd981'] = 'Pour utiliser Alma, veuillez suivre les étapes suivantes'; -$_MODULE['<{alma}prestashop>getcontent_7379f16a6f4551a47731893ecfce52ab'] = '1. Associer le compte PrestaShop (juste en dessous)'; -$_MODULE['<{alma}prestashop>getcontent_54f458d63e438020e62552dc28f23925'] = '2. Créer un compte Alma'; -$_MODULE['<{alma}prestashop>getcontent_e243bbd390b43c9ee6047fab4ab3cdc0'] = 'Consultez notre guide de démarrage'; -$_MODULE['<{alma}prestashop>getcontent_45d67e5114ba6e1f894f12c0c8ac6538'] = '3. Saisissez votre clé API'; -$_MODULE['<{alma}prestashop>getcontent_055f421849c2a1c32b885c95540f827c'] = 'Trouvez votre clé API sur votre tableau de bord %1$s Alma%2$s'; -$_MODULE['<{alma}prestashop>getcontent_83b4d24aae962bb5581ba5720be20666'] = 'Pour utiliser le mode test, récupérez votre clé API de test dans le tableau de bord de votre sandbox %1$s%2$s'; -$_MODULE['<{alma}prestashop>getcontent_41d0063d3bb7d3067f46734fac8b27c4'] = 'Nous vous proposons de télécharger le module PrestaShop Account'; -$_MODULE['<{alma}prestashop>getcontent_6997dde298b14fbf6a7c95bd39fe8dc4'] = 'Vous pouvez trouver le module %1$sici%2$s'; -$_MODULE['<{alma}prestashop>cartproducts_39f9a4a4bf8387aa7c0478f98b713f91'] = 'Supprimer l\'assurance'; -$_MODULE['<{alma}prestashop>cartproducts_7da9ba421c3f84f283070d68bb7adca1'] = 'Assurance Alma'; -$_MODULE['<{alma}prestashop>cartproducts_adcd954ece839e7da469e9b37801fa69'] = 'Protégez votre produit avec'; -$_MODULE['<{alma}prestashop>cartproducts_4cc10fb1d9332d404cc8016b47a1afd1'] = 'Voir les polices d\'assurance disponibles'; $_MODULE['<{alma}prestashop>widgetaddinsuranceproducts_f1aab89a3a1e86807c8dffa61d41ded6'] = 'Protégez le reste de vos produits avec'; $_MODULE['<{alma}prestashop>widgetaddinsuranceproducts_f28220d70798406523119d998573b489'] = 'Je veux assurer tous les autres produits [1]%1$s[/1] de mon panier.'; $_MODULE['<{alma}prestashop>fees_3acc62b245d8bc10f04d81f69d85b685'] = '(Sans frais)'; diff --git a/alma/translations/it.php b/alma/translations/it.php index ea720eb98..51a8b5047 100644 --- a/alma/translations/it.php +++ b/alma/translations/it.php @@ -31,7 +31,7 @@ $_MODULE['<{alma}prestashop>alma_7bab99339291e7eea710b4a998e663de'] = 'Alma richiede l\'estensione PHP cURL'; $_MODULE['<{alma}prestashop>alma_fbb47375d2272bef79f5722a183bf1ec'] = 'Alma richiede l\'estensione PHP JSON.'; $_MODULE['<{alma}prestashop>alma_7fb83ba9cf3cc38857a2ddae98534d22'] = 'Alma richiede OpenSSL >= 1.0.1'; -$_MODULE['<{alma}prestashop>modulefactorytest_2c53dea2326232a2d867ddd1d2206aa0'] = 'Paga ora con la carta bancaria'; +$_MODULE['<{alma}prestashop>modulefactorytest_5914ca153abaf8a2af61e13e7fe7e829'] = 'La mia formulazione da tradurre'; $_MODULE['<{alma}prestashop>wrongcredentialsexception_cc76de47de858ac2fa2964f534ecfdfb'] = 'Impossibile connettersi ad Alma utilizzando le chiavi API.'; $_MODULE['<{alma}prestashop>wrongcredentialsexception_733b6ddadc31fd97174b0cfe69b584c9'] = 'Controlla che le chiavi API inserite corrispondano a quelle sul %1$sportale Alma%2$s.'; $_MODULE['<{alma}prestashop>wrongparamsexception_8ec75b5f68c49d1d6541b1e318a8120d'] = 'Errore/i chiave: %1$s.'; @@ -143,15 +143,9 @@ $_MODULE['<{alma}prestashop>customfieldshelper_7a854e750fe5f3e7120020c7c20987d4'] = 'Il tuo carrello non è idoneo per i pagamenti con Alma.'; $_MODULE['<{alma}prestashop>customfieldshelper_6ed45ebd72fcca0fc0c271128e9d7b7b'] = 'Alla spedizione'; $_MODULE['<{alma}prestashop>apihelper_fc610b81ff31f9d969ddb659cd8248c1'] = 'Alma ha riscontrato un errore durante il recupero dello stato del commerciante, si prega di controllare le chiavi api o di riprovare più tardi.'; -$_MODULE['<{alma}prestashop>insurancehelper_eaff1bdf24fcffe0e14e29a1bff51a12'] = 'Assicurazione'; -$_MODULE['<{alma}prestashop>insurancehelper_f1206f9fadc5ce41694f69129aecac26'] = 'Configurare'; -$_MODULE['<{alma}prestashop>insurancehelper_7442e29d7d53e549b78d93c46b8cdcfc'] = 'Ordini'; $_MODULE['<{alma}prestashop>admininsurancehelper_eaff1bdf24fcffe0e14e29a1bff51a12'] = 'Assicurazione'; $_MODULE['<{alma}prestashop>admininsurancehelper_f1206f9fadc5ce41694f69129aecac26'] = 'Configurare'; $_MODULE['<{alma}prestashop>admininsurancehelper_7442e29d7d53e549b78d93c46b8cdcfc'] = 'Ordini'; -$_MODULE['<{alma}prestashop>insurancehelper_eaff1bdf24fcffe0e14e29a1bff51a12'] = 'Assicurazione'; -$_MODULE['<{alma}prestashop>insurancehelper_f1206f9fadc5ce41694f69129aecac26'] = 'Configurare'; -$_MODULE['<{alma}prestashop>insurancehelper_7442e29d7d53e549b78d93c46b8cdcfc'] = 'Ordini'; $_MODULE['<{alma}prestashop>insuranceservice_d87aee5118a62a7ff6c21e4ac31006c5'] = 'Con la presente dichiaro di accettare di sottoscrivere l\'assicurazione offerta da Alma. In tal modo, confermo di aver preso visione della [nota informativa, che costituisce le condizioni generali], del [documento informativo sul prodotto assicurativo] e del [foglio informativo e di consulenza precontrattuale]. Accetto senza riserve e acconsento a firmare elettronicamente i vari documenti che formano il mio contratto, se del caso. Acconsento espressamente alla raccolta e all\'utilizzo dei miei dati personali ai fini della sottoscrizione e della gestione del/i mio/i contratto/i di assicurazione.'; $_MODULE['<{alma}prestashop>adminalmainsuranceconfiguration_b824200e9b8aca1fbb762d6566ff0cd7'] = 'La configurazione è stata salvata'; $_MODULE['<{alma}prestashop>adminalmainsuranceconfiguration_4a39c6a33c3441762924914168d2a387'] = 'Errore nella creazione della configurazione dell\'assicurazione Alma: %1$s'; @@ -197,6 +191,7 @@ $_MODULE['<{alma}prestashop>getcontenthookcontroller_5f265dfcb9ab68a1258ec25393ffb886'] = 'Responsabile del modulo'; $_MODULE['<{alma}prestashop>getcontenthookcontroller_c6e24f81cb99e08c3d56b191c00aea28'] = 'Gestione dei moduli - Elenco'; $_MODULE['<{alma}prestashop>frontheaderhookcontroller_0bbf1fb0708055cf522541b4151894c4'] = 'Per gestire i vostri acquisti con Assurance, accedete alla pagina di checkout.'; +$_MODULE['<{alma}prestashop>frontheaderhookcontroller_8f1e80580ceb2bb7a54a7288ea169b30'] = 'L\'assicurazione Alma può essere aggiunta al carrello solo se è associata a un prodotto assicurabile. Verrà proposta nella pagina del prodotto in questione.'; $_MODULE['<{alma}prestashop>displaypaymenthookcontroller_afd8ac1c65e1519d6a890e5f98558a52'] = '%1$s allora %2$d x %3$s'; $_MODULE['<{alma}prestashop>displaypaymenthookcontroller_bc69b42c4bd339154f9025f3299ad146'] = 'Oggi paghi %1$s poi %2$d x %3$s'; $_MODULE['<{alma}prestashop>displaypaymenthookcontroller_9088921432b295dfe6f02863b2dc0ff8'] = 'Oggi paghi 0 € poi %1$s il %2$s'; @@ -302,19 +297,6 @@ $_MODULE['<{alma}prestashop>getcontent_8c10d3b0970a247fc554062dc9055fd1'] = 'L’ammontare massimo per i pagamenti in %1$d rate deve essere compreso tra %2$d e %3$d.'; $_MODULE['<{alma}prestashop>getcontent_84b96a3ca61f4425b3fd56534a89a653'] = 'Impossibile salvare le impostazioni di Share of Checkout, riprova più tardi'; $_MODULE['<{alma}prestashop>getcontent_7f40d377cc4942c4f0d6e75a736f8445'] = 'Configurazione memorizzata con successo'; -$_MODULE['<{alma}prestashop>getcontent_9f246d669c560d2ac604f5e01c8dd981'] = 'Per utilizzare Alma, seguire i seguenti passaggi'; -$_MODULE['<{alma}prestashop>getcontent_7379f16a6f4551a47731893ecfce52ab'] = '1. Associare l\'account PrestaShop (appena sotto)'; -$_MODULE['<{alma}prestashop>getcontent_54f458d63e438020e62552dc28f23925'] = '2. Creare un account Alma'; -$_MODULE['<{alma}prestashop>getcontent_e243bbd390b43c9ee6047fab4ab3cdc0'] = 'Consultate la nostra guida introduttiva'; -$_MODULE['<{alma}prestashop>getcontent_45d67e5114ba6e1f894f12c0c8ac6538'] = '3. Inserire la chiave API'; -$_MODULE['<{alma}prestashop>getcontent_055f421849c2a1c32b885c95540f827c'] = 'Trovate la vostra chiave API live sul vostro cruscotto %1$s Alma%2$s'; -$_MODULE['<{alma}prestashop>getcontent_83b4d24aae962bb5581ba5720be20666'] = 'Per utilizzare la modalità Test, recuperare la chiave API Test dalla dashboard di %1$s sandbox%2$s.'; -$_MODULE['<{alma}prestashop>getcontent_41d0063d3bb7d3067f46734fac8b27c4'] = 'Vi proponiamo di scaricare il modulo Account di PrestaShop'; -$_MODULE['<{alma}prestashop>getcontent_6997dde298b14fbf6a7c95bd39fe8dc4'] = 'Il modulo %1$sè disponibile qui%2$s.'; -$_MODULE['<{alma}prestashop>cartproducts_39f9a4a4bf8387aa7c0478f98b713f91'] = 'Rimuovere l\'assicurazione'; -$_MODULE['<{alma}prestashop>cartproducts_7da9ba421c3f84f283070d68bb7adca1'] = 'Assicurazione Alma'; -$_MODULE['<{alma}prestashop>cartproducts_adcd954ece839e7da469e9b37801fa69'] = 'Proteggete il vostro prodotto con'; -$_MODULE['<{alma}prestashop>cartproducts_4cc10fb1d9332d404cc8016b47a1afd1'] = 'Vedi le polizze assicurative disponibili'; $_MODULE['<{alma}prestashop>widgetaddinsuranceproducts_f1aab89a3a1e86807c8dffa61d41ded6'] = 'Proteggete il resto dei vostri prodotti con'; $_MODULE['<{alma}prestashop>widgetaddinsuranceproducts_f28220d70798406523119d998573b489'] = 'Voglio assicurare tutti i [1]%1$s[/1] rimanenti nel mio carrello'; $_MODULE['<{alma}prestashop>fees_3acc62b245d8bc10f04d81f69d85b685'] = '(Nessun costo aggiuntivo)'; diff --git a/alma/translations/nl.php b/alma/translations/nl.php index 992d387b3..4af67c5be 100644 --- a/alma/translations/nl.php +++ b/alma/translations/nl.php @@ -31,7 +31,7 @@ $_MODULE['<{alma}prestashop>alma_7bab99339291e7eea710b4a998e663de'] = 'Voor Alma is een PHP cURL extensie nodig.'; $_MODULE['<{alma}prestashop>alma_fbb47375d2272bef79f5722a183bf1ec'] = 'Voor Alma is een PHP JSON extensie nodig.'; $_MODULE['<{alma}prestashop>alma_7fb83ba9cf3cc38857a2ddae98534d22'] = 'Voor Alma is OpenSSL >= 1.0.1 nodig'; -$_MODULE['<{alma}prestashop>modulefactorytest_2c53dea2326232a2d867ddd1d2206aa0'] = 'Betaal nu met creditcard'; +$_MODULE['<{alma}prestashop>modulefactorytest_5914ca153abaf8a2af61e13e7fe7e829'] = 'Mijn formulering om te vertalen'; $_MODULE['<{alma}prestashop>wrongcredentialsexception_cc76de47de858ac2fa2964f534ecfdfb'] = 'Kan geen verbinding maken met Alma met behulp van jouw API-keys.'; $_MODULE['<{alma}prestashop>wrongcredentialsexception_733b6ddadc31fd97174b0cfe69b584c9'] = 'Controleer de API-keys op jouw %1$sAlma dashboard%2$s.'; $_MODULE['<{alma}prestashop>wrongparamsexception_8ec75b5f68c49d1d6541b1e318a8120d'] = 'Fout(en) sleutel(s): %1$s.'; @@ -143,15 +143,9 @@ $_MODULE['<{alma}prestashop>customfieldshelper_7a854e750fe5f3e7120020c7c20987d4'] = 'Jouw winkelwagentje komt niet in aanmerking voor betalingen met Alma.'; $_MODULE['<{alma}prestashop>customfieldshelper_6ed45ebd72fcca0fc0c271128e9d7b7b'] = 'Bij verzending'; $_MODULE['<{alma}prestashop>apihelper_fc610b81ff31f9d969ddb659cd8248c1'] = 'Er is een fout opgetreden bij het ophalen van de verkopersstatus. Controleer de api-sleutels of probeer het later opnieuw.'; -$_MODULE['<{alma}prestashop>insurancehelper_eaff1bdf24fcffe0e14e29a1bff51a12'] = 'Verzekering'; -$_MODULE['<{alma}prestashop>insurancehelper_f1206f9fadc5ce41694f69129aecac26'] = 'Configureer'; -$_MODULE['<{alma}prestashop>insurancehelper_7442e29d7d53e549b78d93c46b8cdcfc'] = 'Bestellingen'; $_MODULE['<{alma}prestashop>admininsurancehelper_eaff1bdf24fcffe0e14e29a1bff51a12'] = 'Verzekering'; $_MODULE['<{alma}prestashop>admininsurancehelper_f1206f9fadc5ce41694f69129aecac26'] = 'Configureer'; $_MODULE['<{alma}prestashop>admininsurancehelper_7442e29d7d53e549b78d93c46b8cdcfc'] = 'Bestellingen'; -$_MODULE['<{alma}prestashop>insurancehelper_eaff1bdf24fcffe0e14e29a1bff51a12'] = 'Verzekering'; -$_MODULE['<{alma}prestashop>insurancehelper_f1206f9fadc5ce41694f69129aecac26'] = 'Configureer'; -$_MODULE['<{alma}prestashop>insurancehelper_7442e29d7d53e549b78d93c46b8cdcfc'] = 'Bestellingen'; $_MODULE['<{alma}prestashop>insuranceservice_d87aee5118a62a7ff6c21e4ac31006c5'] = 'Hierbij verklaar ik akkoord te gaan met de verzekering aangeboden door Alma. Hierbij bevestig ik dat ik vooraf kennis heb genomen van de [informatiebrochure, die de algemene voorwaarden vormt], het [informatiedocument over het verzekeringsproduct] en het [precontractuele informatie- en adviesblad]. Ik ga er zonder voorbehoud mee akkoord en stem ermee in de verschillende documenten die mijn contract vormen, indien van toepassing, elektronisch te ondertekenen. Ik geef uitdrukkelijk toestemming voor het verzamelen en gebruiken van mijn persoonsgegevens met het oog op het afsluiten en beheren van mijn verzekeringscontract(en).'; $_MODULE['<{alma}prestashop>adminalmainsuranceconfiguration_b824200e9b8aca1fbb762d6566ff0cd7'] = 'Je configuratie is opgeslagen'; $_MODULE['<{alma}prestashop>adminalmainsuranceconfiguration_4a39c6a33c3441762924914168d2a387'] = 'Fout bij het aanmaken van configuratie Alma verzekering: %1$s'; @@ -197,6 +191,7 @@ $_MODULE['<{alma}prestashop>getcontenthookcontroller_5f265dfcb9ab68a1258ec25393ffb886'] = 'Module Manager'; $_MODULE['<{alma}prestashop>getcontenthookcontroller_c6e24f81cb99e08c3d56b191c00aea28'] = 'Module Manager - Lijst'; $_MODULE['<{alma}prestashop>frontheaderhookcontroller_0bbf1fb0708055cf522541b4151894c4'] = 'Ga naar de afrekenpagina om je aankopen met Assurance te beheren.'; +$_MODULE['<{alma}prestashop>frontheaderhookcontroller_8f1e80580ceb2bb7a54a7288ea169b30'] = 'Een Alma-verzekering kan alleen aan uw winkelwagen worden toegevoegd als deze gekoppeld is aan een product dat in aanmerking komt voor een verzekering. De verzekering wordt aangeboden op de betreffende productpagina.'; $_MODULE['<{alma}prestashop>displaypaymenthookcontroller_afd8ac1c65e1519d6a890e5f98558a52'] = '%1$s dan %2$d x %3$s'; $_MODULE['<{alma}prestashop>displaypaymenthookcontroller_bc69b42c4bd339154f9025f3299ad146'] = '%1$s vandaag dan %2$d x %3$s'; $_MODULE['<{alma}prestashop>displaypaymenthookcontroller_9088921432b295dfe6f02863b2dc0ff8'] = '€0 vandaag dan %1$s op %2$s'; @@ -302,19 +297,6 @@ $_MODULE['<{alma}prestashop>getcontent_8c10d3b0970a247fc554062dc9055fd1'] = 'Het maximum bedrag voor betalingen in %1$d keer moet tussen %2$d en %3$d liggen.'; $_MODULE['<{alma}prestashop>getcontent_84b96a3ca61f4425b3fd56534a89a653'] = 'Niet mogelijk om de instellingen van Share of Checkout op te slaan, probeer het later nog eens'; $_MODULE['<{alma}prestashop>getcontent_7f40d377cc4942c4f0d6e75a736f8445'] = 'Configuratie opgeslagen'; -$_MODULE['<{alma}prestashop>getcontent_9f246d669c560d2ac604f5e01c8dd981'] = 'Volg deze stappen om Alma te gebruiken'; -$_MODULE['<{alma}prestashop>getcontent_7379f16a6f4551a47731893ecfce52ab'] = '1. Koppel je PrestaShop-account (net hieronder)'; -$_MODULE['<{alma}prestashop>getcontent_54f458d63e438020e62552dc28f23925'] = '2. Maak een Alma-account aan'; -$_MODULE['<{alma}prestashop>getcontent_e243bbd390b43c9ee6047fab4ab3cdc0'] = 'Raadpleeg onze handleiding om aan de slag te gaan'; -$_MODULE['<{alma}prestashop>getcontent_45d67e5114ba6e1f894f12c0c8ac6538'] = '3. Voer je API-sleutel in'; -$_MODULE['<{alma}prestashop>getcontent_055f421849c2a1c32b885c95540f827c'] = 'Vind je API live key op je %1$s Alma dashboard%2$s'; -$_MODULE['<{alma}prestashop>getcontent_83b4d24aae962bb5581ba5720be20666'] = 'Om de Testmodus te gebruiken, haal je je Test API-sleutel op van jouw %1$s sandbox dashboard%2$s'; -$_MODULE['<{alma}prestashop>getcontent_41d0063d3bb7d3067f46734fac8b27c4'] = 'Wij bieden aan om de PrestaShop Account module te downloaden'; -$_MODULE['<{alma}prestashop>getcontent_6997dde298b14fbf6a7c95bd39fe8dc4'] = 'Je kunt de module %1$shier vinden%2$s'; -$_MODULE['<{alma}prestashop>cartproducts_39f9a4a4bf8387aa7c0478f98b713f91'] = 'Verzekering verwijderen'; -$_MODULE['<{alma}prestashop>cartproducts_7da9ba421c3f84f283070d68bb7adca1'] = 'Alma verzekering'; -$_MODULE['<{alma}prestashop>cartproducts_adcd954ece839e7da469e9b37801fa69'] = 'Bescherm je product met'; -$_MODULE['<{alma}prestashop>cartproducts_4cc10fb1d9332d404cc8016b47a1afd1'] = 'Bekijk de beschikbare verzekeringspolissen'; $_MODULE['<{alma}prestashop>widgetaddinsuranceproducts_f1aab89a3a1e86807c8dffa61d41ded6'] = 'Bescherm de rest van je producten met'; $_MODULE['<{alma}prestashop>widgetaddinsuranceproducts_f28220d70798406523119d998573b489'] = 'Ik wil alle resterende [1]%1$s[/1] in mijn winkelwagen verzekeren.'; $_MODULE['<{alma}prestashop>fees_3acc62b245d8bc10f04d81f69d85b685'] = '(Geen extra kosten)'; diff --git a/alma/translations/pt.php b/alma/translations/pt.php index 23a7d3cc1..dbc3eb6c1 100644 --- a/alma/translations/pt.php +++ b/alma/translations/pt.php @@ -31,7 +31,7 @@ $_MODULE['<{alma}prestashop>alma_7bab99339291e7eea710b4a998e663de'] = 'A Alma requer a extensão CURL PHP'; $_MODULE['<{alma}prestashop>alma_fbb47375d2272bef79f5722a183bf1ec'] = 'A Alma requer a extensão JSON PHP'; $_MODULE['<{alma}prestashop>alma_7fb83ba9cf3cc38857a2ddae98534d22'] = 'A Alma requer OpenSSL >= 1.0.1'; -$_MODULE['<{alma}prestashop>modulefactorytest_2c53dea2326232a2d867ddd1d2206aa0'] = 'Pagar agora com cartão de crédito'; +$_MODULE['<{alma}prestashop>modulefactorytest_5914ca153abaf8a2af61e13e7fe7e829'] = 'A minha redação para traduzir'; $_MODULE['<{alma}prestashop>wrongcredentialsexception_cc76de47de858ac2fa2964f534ecfdfb'] = 'Não foi possível conectar-se à Alma usando suas chaves de API.'; $_MODULE['<{alma}prestashop>wrongcredentialsexception_733b6ddadc31fd97174b0cfe69b584c9'] = 'Por favor, verifique novamente as suas chaves no seu painel de instrumentos %1$sAlma%2$s.'; $_MODULE['<{alma}prestashop>wrongparamsexception_8ec75b5f68c49d1d6541b1e318a8120d'] = 'Chave(s) de erro(s): %1$s.'; @@ -143,15 +143,9 @@ $_MODULE['<{alma}prestashop>customfieldshelper_7a854e750fe5f3e7120020c7c20987d4'] = 'O seu cesto não é elegível para pagamentos através da Alma.'; $_MODULE['<{alma}prestashop>customfieldshelper_6ed45ebd72fcca0fc0c271128e9d7b7b'] = 'Na expedição'; $_MODULE['<{alma}prestashop>apihelper_fc610b81ff31f9d969ddb659cd8248c1'] = 'A Alma encontrou um erro ao obter o estado do comerciante, verifique as suas chaves de API ou tente novamente mais tarde.'; -$_MODULE['<{alma}prestashop>insurancehelper_eaff1bdf24fcffe0e14e29a1bff51a12'] = 'Seguros'; -$_MODULE['<{alma}prestashop>insurancehelper_f1206f9fadc5ce41694f69129aecac26'] = 'Configurar'; -$_MODULE['<{alma}prestashop>insurancehelper_7442e29d7d53e549b78d93c46b8cdcfc'] = 'Encomendas'; $_MODULE['<{alma}prestashop>admininsurancehelper_eaff1bdf24fcffe0e14e29a1bff51a12'] = 'Seguros'; $_MODULE['<{alma}prestashop>admininsurancehelper_f1206f9fadc5ce41694f69129aecac26'] = 'Configurar'; $_MODULE['<{alma}prestashop>admininsurancehelper_7442e29d7d53e549b78d93c46b8cdcfc'] = 'Encomendas'; -$_MODULE['<{alma}prestashop>insurancehelper_eaff1bdf24fcffe0e14e29a1bff51a12'] = 'Seguros'; -$_MODULE['<{alma}prestashop>insurancehelper_f1206f9fadc5ce41694f69129aecac26'] = 'Configurar'; -$_MODULE['<{alma}prestashop>insurancehelper_7442e29d7d53e549b78d93c46b8cdcfc'] = 'Encomendas'; $_MODULE['<{alma}prestashop>insuranceservice_d87aee5118a62a7ff6c21e4ac31006c5'] = 'Confirmo a minha aceitação em subscrever o seguro proposto pela Alma. Ao fazê-lo, confirmo que tomei conhecimento prévio da [nota informativa, que constitui as condições gerais], do [documento de informação sobre o produto de seguro] e da [ficha de informação e aconselhamento pré-contratual]. Aceito sem reservas e concordo em assinar eletronicamente os vários documentos que constituem o meu contrato, se aplicável. Autorizo expressamente a recolha e utilização dos meus dados pessoais para efeitos de subscrição e gestão do(s) meu(s) contrato(s) de seguro.'; $_MODULE['<{alma}prestashop>adminalmainsuranceconfiguration_b824200e9b8aca1fbb762d6566ff0cd7'] = 'A sua configuração foi guardada'; $_MODULE['<{alma}prestashop>adminalmainsuranceconfiguration_4a39c6a33c3441762924914168d2a387'] = 'Erro ao criar a configuração do seguro Alma: %1$s'; @@ -197,6 +191,7 @@ $_MODULE['<{alma}prestashop>getcontenthookcontroller_5f265dfcb9ab68a1258ec25393ffb886'] = 'Gestor do módulo'; $_MODULE['<{alma}prestashop>getcontenthookcontroller_c6e24f81cb99e08c3d56b191c00aea28'] = 'Gestor do módulo - Lista'; $_MODULE['<{alma}prestashop>frontheaderhookcontroller_0bbf1fb0708055cf522541b4151894c4'] = 'Para gerir as suas compras com a Assurance, aceda à página de finalização da compra.'; +$_MODULE['<{alma}prestashop>frontheaderhookcontroller_8f1e80580ceb2bb7a54a7288ea169b30'] = 'O seguro Alma só pode ser adicionado ao seu carrinho se estiver associado a um produto elegível para seguro. Este será proposto na página do produto em causa.'; $_MODULE['<{alma}prestashop>displaypaymenthookcontroller_afd8ac1c65e1519d6a890e5f98558a52'] = '%1$s e depois %2$d x %3$s'; $_MODULE['<{alma}prestashop>displaypaymenthookcontroller_bc69b42c4bd339154f9025f3299ad146'] = '%1$s hoje, e depois %2$d x %3$s'; $_MODULE['<{alma}prestashop>displaypaymenthookcontroller_9088921432b295dfe6f02863b2dc0ff8'] = '0€ hoje, e depois %1$s em %2$s'; @@ -302,19 +297,6 @@ $_MODULE['<{alma}prestashop>getcontent_8c10d3b0970a247fc554062dc9055fd1'] = 'O montante máximo para o plano %1$d meses em diferido deve estar entre %2$d e %3$d.'; $_MODULE['<{alma}prestashop>getcontent_84b96a3ca61f4425b3fd56534a89a653'] = 'Impossível guardar a Partilha de definições de Checkout, por favor tente novamente mais tarde'; $_MODULE['<{alma}prestashop>getcontent_7f40d377cc4942c4f0d6e75a736f8445'] = 'Configurações atualizadas com sucesso'; -$_MODULE['<{alma}prestashop>getcontent_9f246d669c560d2ac604f5e01c8dd981'] = 'Para utilizar o Alma, siga estes passos'; -$_MODULE['<{alma}prestashop>getcontent_7379f16a6f4551a47731893ecfce52ab'] = '1. Associar a conta PrestaShop (logo abaixo)'; -$_MODULE['<{alma}prestashop>getcontent_54f458d63e438020e62552dc28f23925'] = '2. Criar uma conta Alma'; -$_MODULE['<{alma}prestashop>getcontent_e243bbd390b43c9ee6047fab4ab3cdc0'] = 'Consultar o nosso guia de iniciação'; -$_MODULE['<{alma}prestashop>getcontent_45d67e5114ba6e1f894f12c0c8ac6538'] = '3. Introduza a sua chave API'; -$_MODULE['<{alma}prestashop>getcontent_055f421849c2a1c32b885c95540f827c'] = 'Encontre a sua chave de acesso à API no seu painel de controlo %1$s Alma%2$s'; -$_MODULE['<{alma}prestashop>getcontent_83b4d24aae962bb5581ba5720be20666'] = 'Para utilizar o modo de teste, recupere a sua chave de API de teste a partir do seu painel de controlo da caixa de areia %1$s%2$s'; -$_MODULE['<{alma}prestashop>getcontent_41d0063d3bb7d3067f46734fac8b27c4'] = 'Oferecemos a possibilidade de descarregar o módulo Conta PrestaShop'; -$_MODULE['<{alma}prestashop>getcontent_6997dde298b14fbf6a7c95bd39fe8dc4'] = 'Pode encontrar o módulo %1$saqui%2$s'; -$_MODULE['<{alma}prestashop>cartproducts_39f9a4a4bf8387aa7c0478f98b713f91'] = 'Remover o seguro'; -$_MODULE['<{alma}prestashop>cartproducts_7da9ba421c3f84f283070d68bb7adca1'] = 'Alma seguros'; -$_MODULE['<{alma}prestashop>cartproducts_adcd954ece839e7da469e9b37801fa69'] = 'Proteja o seu produto com'; -$_MODULE['<{alma}prestashop>cartproducts_4cc10fb1d9332d404cc8016b47a1afd1'] = 'Ver apólices de seguro disponíveis'; $_MODULE['<{alma}prestashop>widgetaddinsuranceproducts_f1aab89a3a1e86807c8dffa61d41ded6'] = 'Proteja o resto dos seus produtos com'; $_MODULE['<{alma}prestashop>widgetaddinsuranceproducts_f28220d70798406523119d998573b489'] = 'Quero segurar todos os restantes [1]%1$s[/1] no meu carrinho'; $_MODULE['<{alma}prestashop>fees_3acc62b245d8bc10f04d81f69d85b685'] = '(Sem encargos adicionais)'; diff --git a/alma/upgrade/upgrade-4.2.0.php b/alma/upgrade/upgrade-4.2.0.php new file mode 100644 index 000000000..f0d1b548b --- /dev/null +++ b/alma/upgrade/upgrade-4.2.0.php @@ -0,0 +1,64 @@ + + * @copyright 2018-2024 Alma SAS + * @license https://opensource.org/licenses/MIT The MIT License + */ + +use Alma\PrestaShop\Builders\Helpers\InsuranceHelperBuilder; +use Alma\PrestaShop\Helpers\ConstantsHelper; + +if (!defined('_PS_VERSION_')) { + exit; +} + +/** + * @param $module + * + * @return bool + * + * @throws PrestaShopException + */ +function upgrade_module_4_2_0($module) +{ + // TODO : Need to test this request + $insuranceHelperBuilder = new InsuranceHelperBuilder(); + $insuranceHelper = $insuranceHelperBuilder->getInstance(); + if ($insuranceHelper->isInsuranceActivated()) { + $sql = 'ALTER TABLE `' . _DB_PREFIX_ . 'alma_insurance_product` + ADD `insurance_contract_name` varchar(255) NULL AFTER `insurance_contract_id`'; + + \Db::getInstance()->execute($sql); + } + + if (version_compare(_PS_VERSION_, '1.7', '>=')) { + $module->registerHook('actionAfterDeleteProductInCart'); + $module->registerHook('actionObjectProductInCartDeleteAfter'); + $module->registerHook('actionAdminOrdersListingFieldsModifier'); + $module->registerHook('displayInvoice'); + } + + if (version_compare(_PS_VERSION_, ConstantsHelper::PRESTASHOP_VERSION_1_7_0_2, '>')) { + Tools::clearAllCache(); + Tools::clearXMLCache(); + } + + return true; +} diff --git a/alma/views/css/alma-insurance.css b/alma/views/css/alma-insurance.css index 0b4a6800c..68049c3d2 100644 --- a/alma/views/css/alma-insurance.css +++ b/alma/views/css/alma-insurance.css @@ -24,6 +24,7 @@ padding: 12px 0; border-radius: 12px; color: #1A1A1A; + margin : .5rem 0; } .item-alma-insurance *{ @@ -85,6 +86,10 @@ border: 1px solid rgba(0, 0, 0, 0.25); } +.product-line-grid-right .bootstrap-touchspin { + box-shadow: none; +} + /** -- Loader dot */ diff --git a/alma/views/js/admin/alma-insurance-orders.js b/alma/views/js/admin/alma-insurance-orders.js index 785c8e4be..ee7cca623 100644 --- a/alma/views/js/admin/alma-insurance-orders.js +++ b/alma/views/js/admin/alma-insurance-orders.js @@ -21,97 +21,95 @@ * @license https://opensource.org/licenses/MIT The MIT License */ -(function ($) { - $(function () { - $('.js-choice-options .js-dropdown-item').each(function(i, e){ - $(e).attr("data-confirm_modal", "module-modal-confirm-refund-order-with-insurance"); - var rowOrder = $(e).parents('tr'); - var checkboxOrder = rowOrder.find('.bulk_action-type .js-bulk-action-checkbox'); - var buttonStatus = this; - var statusId = $(buttonStatus).data('value'); +window.addEventListener("load", function() { + $('.js-choice-options .js-dropdown-item').each(function(i, e){ + $(e).attr("data-confirm_modal", "module-modal-confirm-refund-order-with-insurance"); + var rowOrder = $(e).parents('tr'); + var checkboxOrder = rowOrder.find('.bulk_action-type .js-bulk-action-checkbox'); + var buttonStatus = this; + var statusId = $(buttonStatus).data('value'); - $(e).off('click'); - $(e).on('click', function(e) { - e.stopImmediatePropagation(); - e.preventDefault(); - - ajaxOrderAndConfirmModal(checkboxOrder, buttonStatus, statusId); - }); + $(e).off('click'); + $(e).on('click', function(e) { + e.stopImmediatePropagation(); + e.preventDefault(); + ajaxOrderAndConfirmModal(checkboxOrder, buttonStatus, statusId); }); - function ajaxOrderAndConfirmModal(checkboxOrder, buttonStatus, statusId) { - const updateConfirmModal = new window.ConfirmModal( - { - id: 'confirm-refund-order-insurance-modal', - confirmTitle: window.InsuranceModalConfirm.confirmTitleText, - closeButtonLabel: window.InsuranceModalConfirm.closeButtonLabelText, - confirmButtonLabel: window.InsuranceModalConfirm.confirmButtonLabelText, - confirmButtonClass: 'btn-primary', - confirmMessage: window.InsuranceModalConfirm.confirmMessageLine1Text + '