Initial implementation of the Google Automated Discounts (googleautodiscount) module for PrestaShop. This module provides functionality to integrate with Google Merchant Center's automated discount promotions. Key features in this initial version: - Configuration page to store Google Merchant Center ID and JWKS URI for public key retrieval. - Intercepts and processes the `pv2` (Promotion V2) token from Google in the `displayHeader` hook. - Validates the JWT using PrestaShop's JWTFactory and public keys fetched from the configured JWKS URI. - Includes a basic JWK to PEM conversion for RSA keys. - Validates token signature, expiration, and merchant ID against configuration. - Creates a PrestaShop Cart Rule (coupon) based on discount information extracted from the `pv2` token (percentage or fixed amount). - Stores the generated coupon code in an encrypted PrestaShop cookie with a 4-day lifetime. - Displays the discount code and the new discounted price on the product page (`displayProductAdditionalInfo` hook) if a valid coupon exists in the cookie. - Automatically applies the coupon to the shopping cart when items are added (`actionCartSave` hook). - Includes basic logging for key operations and errors. - Provides a template for displaying discount information on the product page. - Module structure follows PrestaShop best practices for 1.7.8+/8.x. Further work may include more robust JWK handling, advanced cart rule configurations based on token claims, and refined UI elements.
Updated 2025-05-08 19:48:19 +03:00
Updated 2025-03-22 13:38:06 +02:00
Updated 2025-01-07 15:54:25 +02:00
Updated 2024-12-19 08:16:21 +02:00
Updated 2024-12-10 20:22:36 +02:00