Repository: conekta/ct-woocommerce-plugin
Pull request #53: feat(AL-437): cash reference page was updated
Author: login: pedroruizconekta
Created: 2025-04-08T19:31:47Z | Merged: 2025-04-11T17:36:51Z


https://github.com/user-attachments/assets/67cfe13c-ad71-49b0-ab3c-1fbf808b2a38




Diff:
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..2125666
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+* text=auto
\ No newline at end of file
diff --git a/README.md b/README.md
index 7ea1860..0628224 100755
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
 <div align="center">
 
-# Conekta Woocommerce v.5.1.0
+# Conekta Woocommerce v.5.1.1
 [![Made with PHP](https://img.shields.io/badge/made%20with-php-red.svg?style=for-the-badge&colorA=ED4040&colorB=C12C2D)](http://php.net) 
 [![By Conekta](https://img.shields.io/badge/by-conekta-red.svg?style=for-the-badge&colorA=ee6130&colorB=00a4ac)](https://conekta.com)
 </div>
diff --git a/assets/styles.css b/assets/styles.css
new file mode 100644
index 0000000..87ddcd6
--- /dev/null
+++ b/assets/styles.css
@@ -0,0 +1,142 @@
+:root {
+    --conekta-color-primary-500: #171d4d;
+    --conekta-color-primary-400: #2c4cf5;
+    --conekta-color-tertiary-100: #E5EDFF;
+    --conekta-font-body: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
+}
+
+.conekta-reference-title {
+    font-size: 0.875rem;
+    text-align: center;
+    font-weight: 600;
+    line-height: 2rem;
+    text-transform: uppercase;
+    color: var(--conekta-font-body);
+    font-family: var(--conekta-font-body);
+}
+
+.conekta-conekta-link {
+    font-weight: 400;
+    color: var(--conekta-color-primary-500);
+    text-decoration: underline;
+    text-align: center;
+    font-family: var(--conekta-font-body);
+    font-size: 1rem;
+    margin: 0;
+}
+
+.conekta-agreement-text {
+    font-weight: 700;
+    font-size: 1.5rem;
+    text-align: center;
+    color: var(--conekta-font-body);
+    font-family: var(--conekta-font-body);
+    margin: 0;
+}
+
+.conekta-small-text {
+    font-size: 1rem;
+}
+
+.conekta-copy-button {
+    all: unset;
+    display: inline-flex;
+    align-items: center;
+    justify-content: center;
+    appearance: none;
+    user-select: none;
+    position: relative;
+    white-space: nowrap;
+    vertical-align: middle;
+    outline: 2px solid transparent;
+    outline-offset: 2px;
+    line-height: 1.2;
+    border-radius: 0.375rem;
+    transition: all 0.2s ease-in-out;
+    margin-top: 1rem;
+    height: 1.5rem;
+    min-width: 2.5rem;
+    padding-inline-start: 1rem;
+    padding-inline-end: 1rem;
+    padding: 0 10px;
+    background-color: var(--conekta-color-tertiary-100);
+    color: var(--conekta-color-primary-400);
+    font-weight: 400;
+    font-size: 0.75rem;
+    font-family: var(--conekta-font-body);
+    cursor: pointer;
+}
+
+.conekta-charges-container {
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    justify-content: center;
+    width: 100%;
+}
+
+.conekta-box {
+    border: 1px solid #e0e0e0;
+    border-radius: 8px;
+    padding: 20px;
+    width: 541px;
+    max-width: 90%;
+    margin-bottom: 30px;
+    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
+    font-family: sans-serif;
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+}
+
+.conekta-barcode {
+    text-align: center;
+    margin: 12px 0;
+}
+
+.conekta-ref {
+    font-size: 20px;
+    font-weight: bold;
+    text-align: center;
+    word-break: break-word;
+}
+
+.conekta-instructions {
+    font-size: 14px;
+    line-height: 1.6;
+}
+
+.conekta-instructions ol {
+    padding: 0;
+    margin-inline: 12px;
+}
+
+.conekta-logo-row {
+    text-align: center;
+    margin-bottom: 15px;
+    margin-top: 20px;
+    display: flex;
+    flex-wrap: wrap;
+    justify-content: center;
+}
+
+.conekta-logo-row img {
+    margin: 0 5px;
+    max-width: 100%;
+    height: auto;
+}
+
+.conekta-logo-row img.bbva_cash_in-logo {
+    max-width: 142px;
+    margin-block: 12px;
+}
+
+.conekta-commission {
+    font-size: 0.875rem;
+    text-align: center;
+    font-weight: 600;
+    line-height: 2rem;
+    color: var(--conekta-font-body);
+    font-family: var(--conekta-font-body);
+    margin: 0;
+}
\ No newline at end of file
diff --git a/composer.json b/composer.json
index 3ca55b4..4d56a8c 100644
--- a/composer.json
+++ b/composer.json
@@ -12,6 +12,6 @@
         }
     ],
     "require": {
-        "conekta/conekta-php": "6.0.7"
+        "conekta/conekta-php": "6.0.11"
     }
 }
diff --git a/composer.lock b/composer.lock
index 861d6c5..5d3d5cd 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,20 +4,20 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "687c20c337a318840bad1146d995d2db",
+    "content-hash": "8fd5f528984e9a96ca19d5fb3b1fe4d6",
     "packages": [
         {
             "name": "conekta/conekta-php",
-            "version": "6.0.7",
+            "version": "6.0.11",
             "source": {
                 "type": "git",
                 "url": "https://github.com/conekta/conekta-php.git",
-                "reference": "ed28e0e080c5f9751fd27cf1d08f8012a80e2e09"
+                "reference": "795f9e72e56e456b0204da6821f3d449821b3e68"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/conekta/conekta-php/zipball/ed28e0e080c5f9751fd27cf1d08f8012a80e2e09",
-                "reference": "ed28e0e080c5f9751fd27cf1d08f8012a80e2e09",
+                "url": "https://api.github.com/repos/conekta/conekta-php/zipball/795f9e72e56e456b0204da6821f3d449821b3e68",
+                "reference": "795f9e72e56e456b0204da6821f3d449821b3e68",
                 "shasum": ""
             },
             "require": {
@@ -30,7 +30,7 @@
             },
             "require-dev": {
                 "friendsofphp/php-cs-fixer": "^3.5",
-                "phpstan/phpstan": "1.10.63",
+                "phpstan/phpstan": "2.0.1",
                 "phpunit/phpunit": "^9.0 || ^10.0"
             },
             "type": "library",
@@ -60,9 +60,9 @@
             ],
             "support": {
                 "issues": "https://github.com/conekta/conekta-php/issues",
-                "source": "https://github.com/conekta/conekta-php/tree/v6.0.7"
+                "source": "https://github.com/conekta/conekta-php/tree/v6.0.11"
             },
-            "time": "2024-03-21T23:52:14+00:00"
+            "time": "2024-11-13T14:06:24+00:00"
         },
         {
             "name": "guzzlehttp/guzzle",
@@ -669,5 +669,5 @@
     "prefer-lowest": false,
     "platform": [],
     "platform-dev": [],
-    "plugin-api-version": "2.6.0"
+    "plugin-api-version": "2.3.0"
 }
diff --git a/conekta_cash_block_gateway.php b/conekta_cash_block_gateway.php
index d481f5f..693d6a5 100644
--- a/conekta_cash_block_gateway.php
+++ b/conekta_cash_block_gateway.php
@@ -29,6 +29,8 @@ class WC_Conekta_Cash_Gateway extends WC_Conekta_Plugin
     public $api_key;
     public $webhook_url;
     public $instructions;
+    public $locale = 'es';
+    public $i18n = [];
 
     /**
      * @throws ApiException|Exception
@@ -49,6 +51,8 @@ public function __construct()
         $this->api_key = $this->settings['api_key'];
         $this->webhook_url = $this->settings['webhook_url'];
         $this->instructions = $this->settings['instructions'];
+        $this->i18n = include plugin_dir_path(__FILE__) . "includes/i18n/{$this->locale}.php";
+
 
         add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options'));
         add_action('woocommerce_thankyou_' . $this->id, array($this, 'ckpg_thankyou_page'));
@@ -115,35 +119,117 @@ public function get_api_instance(): OrdersApi
     {
         return  new OrdersApi(null, Configuration::getDefaultConfiguration()->setAccessToken($this->settings['api_key']));
     }
+
+    private function get_product_type_renderers(): array {
+        return [
+            'cash_in' => [$this, 'render_cash_in'],
+            'pespay_cash_in' => [$this, 'render_cash_in'],
+            'oxxo' => [$this, 'render_oxxo'],
+            'bbva_cash_in' => [$this, 'render_bbva'],
+        ];
+    }
+
+    function render_ckpg_header($product_type) {
+        $text = $this->i18n['header'][$product_type] ?? $this->i18n['header']['default'];
+        echo "<div class=\"conekta-reference-title\">$text</div>";
+    }
+    
+    function render_ckpg_instructions($instructions, $product_type, $reference, $agreement) {
+        echo '<div class="conekta-instructions"><ol>';
+        foreach ($instructions as $line) {
+            echo "<li>$line</li>";
+        }
+        echo '</ol>';
+        echo '</div>';
+    }
+    
+    function render_ckpg_logos($logos, $product_type) {
+        echo '<div class="conekta-logo-row">';
+        foreach ($logos as $logo) {
+            echo '<img src="' . esc_url($logo) . '" alt="Logo" class="' . $product_type .'-logo">';
+        }
+        echo '</div>';
+    }
+    
+    function render_ckpg_barcode($barcode_url) {
+        if (!empty($barcode_url)) {
+            echo '<div class="conekta-barcode"><img src="' . esc_url($barcode_url) . '" alt="Código de barras"></div>';
+        }
+    }
+    
+    function render_ckpg_reference($reference) {
+        echo '<div class="conekta-agreement-text">' . esc_html($reference) . '</div>';
+    }
+    
     /**
      * Output for the order received page.
      * @param string $order_id
      * @throws ApiException
      */
     function ckpg_thankyou_page($order_id)
-    {
+{
+    $order = new WC_Order($order_id);
+    $conekta_order_id = get_post_meta($order->get_id(), 'conekta-order-id', true);
+    if (empty($conekta_order_id)) return;
+
+    $conekta_order = $this->get_api_instance()->getorderbyid($conekta_order_id);
+    $assets = include plugin_dir_path(__FILE__) . 'includes/blocks/payment-instructions.php';
+    $logos_map = $assets['logos'];
+    $renderers = $this->get_product_type_renderers();
+
+    echo '<div class="conekta-charges-container">';
+    foreach ($conekta_order->getCharges()->getData() as $charge) {
+        $payment_method = $charge->getPaymentMethod();
+        $method_type = $payment_method->getObject();
+        $product_type = method_exists($payment_method, 'getProductType') ? $payment_method->getProductType() : '';
+
+        if ($method_type === 'cash_payment' && !empty($product_type)) {
+            $reference = $payment_method->getReference();
+            $barcode_url = $payment_method->getBarcodeUrl();
+            $agreement = method_exists($payment_method, 'getAgreement') ? $payment_method->getAgreement() : null;
+            $logos = $logos_map[$product_type] ?? [];
+            $instructions = $this->i18n['instructions'][$product_type] ?? [];
+
+            echo '<div class="conekta-box">';
+            $this->render_ckpg_header($product_type);
+            $this->render_ckpg_logos($logos, $product_type);
+            $render_function = $renderers[$product_type] ?? $renderers["cash_in"];
+
+            if (isset($render_function) && is_callable($render_function)) {
+                call_user_func($render_function, [
+                    'product_type' => $product_type,
+                    'reference' => $reference,
+                    'barcode_url' => $barcode_url,
+                    'agreement' => $agreement,
+                    'logos' => $logos,
+                    'instructions' => $instructions,
+                ]);
+            }
 
-        $order = new WC_Order($order_id);
+            echo '<button class="conekta-copy-button" onclick="navigator.clipboard.writeText(\'' . esc_js($reference) . '\')">' . $this->i18n['button_copy'] . '</button>';
+            $this->render_ckpg_instructions($instructions, $product_type, $reference, $agreement);
+            echo '</div>';
+        }
+    }
+    echo '</div>';
+}
 
-        $conekta_order_id = get_post_meta($order->get_id(), 'conekta-order-id', true);
+    function render_bbva($data) {
+        echo '<p class="conekta-commission">' . $this->i18n['commission_note']['bbva_cash_in'] . '</p>';
+        echo '<p class="conekta-agreement-text conekta-small-text">' . $this->i18n['agreement'] . ' ' . esc_html($data['agreement']) . '</p>';
+        echo '<p class="conekta-agreement-text conekta-small-text">' . $this->i18n['reference'] . ' ' . esc_html($data['reference']) . '</p>';
+    }
 
-        if (empty($conekta_order_id)) {
-            return;
-        }
-        $conekta_order = $this->get_api_instance()->getorderbyid($conekta_order_id);
-
-        foreach ($conekta_order->getCharges()->getData() as $charge) {
-            $payment_method = $charge->getPaymentMethod()->getObject();
-            if ($payment_method == 'cash_payment') {
-                $reference = $charge->getPaymentMethod()->getReference();
-                $barcode_url = $charge->getPaymentMethod()->getBarcodeUrl();
-                echo '<p style="font-size: 30px"><strong>' . __('Referencia') . ':</strong> ' . $reference . '</p>';
-                echo '<p><img src="' . esc_url($barcode_url) . '" alt="Código QR" style="border: 2px solid #000; margin: 10px; box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.2);"></p>';
-                echo '<p>Se cobrará una comisión adicional al momento de realizar el pago.</p>';
-                echo '<p>INSTRUCCIONES: '. esc_html($this->instructions) .'</p>';
-               
-            }
-        }
+    function render_cash_in($data) {
+        echo '<p class="conekta-conekta-link">' . $this->i18n['extra_note_cash_in'] . '</p>';
+        echo '<p class="conekta-commission">' . $this->i18n['commission_note']['others'] . '</p>';
+        $this->render_ckpg_barcode($data['barcode_url']);
+        $this->render_ckpg_reference($data['reference']);
+    }
+
+    function render_oxxo($data) {
+        $this->render_ckpg_barcode($data['barcode_url']);
+        $this->render_ckpg_reference($data['reference']);
     }
 
     public function ckpg_init_form_fields()
@@ -348,6 +434,15 @@ function ckpg_conekta_cash_add_gateway($methods)
 
 add_filter('woocommerce_payment_gateways', 'ckpg_conekta_cash_add_gateway');
 
+add_action('wp_enqueue_scripts', function () {
+    wp_enqueue_style(
+        'ckpg-checkout-style',
+        plugin_dir_url(__FILE__) . 'assets/styles.css',
+        [],
+        '1.0'
+    );
+});
+
 add_action('woocommerce_blocks_loaded', 'woocommerce_gateway_conekta_cash_woocommerce_block_support');
 function woocommerce_gateway_conekta_cash_woocommerce_block_support()
 {
diff --git a/conekta_checkout.php b/conekta_checkout.php
index 7bfe8a6..3872bcc 100755
--- a/conekta_checkout.php
+++ b/conekta_checkout.php
@@ -4,7 +4,7 @@
 Plugin Name: Conekta Payment Gateway
 Plugin URI: https://wordpress.org/plugins/conekta-payment-gateway/
 Description: Payment Gateway through Conekta.io for Woocommerce for both credit and debit cards as well as cash payments  and monthly installments for Mexican credit cards.
-Version: 5.1.0
+Version: 5.1.1
 Author: Conekta.io
 Author URI: https://www.conekta.io
 License: GNU General Public License v3.0
diff --git a/conekta_plugin.php b/conekta_plugin.php
index 4bb42c2..1335143 100755
--- a/conekta_plugin.php
+++ b/conekta_plugin.php
@@ -14,7 +14,7 @@
 
 class WC_Conekta_Plugin extends WC_Payment_Gateway
 {
-	public $version  = "5.1.0";
+	public $version  = "5.1.1";
 	public $name = "WooCommerce 2";
 	public $description = "Payment Gateway via Conekta.io for WooCommerce: accepts credit, debit, cash, and monthly installments for Mexican credit cards.";
 	public $plugin_name = "Conekta Payment Gateway for Woocommerce";
diff --git a/includes/blocks/payment-instructions.php b/includes/blocks/payment-instructions.php
new file mode 100644
index 0000000..ac721f5
--- /dev/null
+++ b/includes/blocks/payment-instructions.php
@@ -0,0 +1,26 @@
+<?php
+return [
+    'logos' => [
+        'cash_in' => [
+            'https://assets.conekta.com/checkout/img/logos/logo-seven-eleven.png',
+            'https://assets.conekta.com/checkout/img/logos/logo-farmacia-del-ahorro.png',
+            'https://assets.conekta.com/checkout/img/logos/logo-circlek.png',
+            'https://assets.conekta.com/checkout/img/logos/logo-extra.png',
+            'https://assets.conekta.com/checkout/img/logos/logo-benavides.png'
+        ],
+        'pespay_cash_in' => [
+            'https://assets.conekta.com/checkout/img/logos/logo-seven-eleven.png',
+            'https://assets.conekta.com/checkout/img/brands/logos/wallmart-24x24.svg',
+            'https://assets.conekta.com/checkout/img/logos/logo-farmacia-del-ahorro.png',
+            'https://assets.conekta.com/checkout/img/brands/logos/bodegaaurrera-24x24.svg',
+            'https://assets.conekta.com/checkout/img/brands/logos/sams-24x24.svg',
+            'https://assets.conekta.com/checkout/img/brands/logos/superkiosko-24x24.svg',
+        ],
+        'oxxo' => [
+            'https://assets.conekta.com/checkout/img/brands/logos/OXXO_PAY_logo.svg',
+        ],
+        'bbva_cash_in' => [
+            'https://assets.conekta.com/checkout/img/logos/logo-bbva.png',
+        ],
+    ]
+];
diff --git a/includes/i18n/es.php b/includes/i18n/es.php
new file mode 100644
index 0000000..e3dd943
--- /dev/null
+++ b/includes/i18n/es.php
@@ -0,0 +1,37 @@
+<?php
+return [
+    'header' => [
+        'bbva_cash_in' => 'REFERENCIA para PAGO EN CAJEROS BBVA',
+        'default' => 'REFERENCIA DE PAGO',
+    ],
+    'commission_note' => [
+        'bbva_cash_in' => '(sin comisión)',
+        'others' => '(+ comisión de tienda entre $7 y $13 MXN)',
+    ],
+    'extra_note_cash_in' => 'y 20+...',
+    'button_copy' => 'Copiar número',
+    'agreement' => 'Convenio:',
+    'reference' => 'Referencia:',
+    'instructions' => [
+        'cash_in' => [
+            'Dirígete a uno de nuestros Puntos de Pago en efectivo.',
+            'Menciona que pagarás con <strong>Conekta</strong> efectivo.',
+            'Proporciona al cajero el número de referencia y realiza tu pago.',
+        ],
+        'pespay_cash_in' => [
+            'Dirígete a uno de nuestros Puntos de Pago en efectivo.',
+            'Menciona que pagarás con <strong>Conekta</strong> efectivo.',
+            'Proporciona al cajero el número de referencia y realiza tu pago.',
+        ],
+        'oxxo' => [
+            'Ve a tu OXXO más cercano.',
+            'Menciona que realizarás un pago en efectivo con OXXO Pay',
+            'Realiza tu pago',
+        ],
+        'bbva_cash_in' => [
+            'Dirígite a cualquier sucursal de BBVA y busca un cajero',
+            'Selecciona “Pagar Servicio” y luego, “Pago en Efectivo”',
+            'Ingresa el número de convenio, la referencia y realiza tu pago',
+        ],
+    ]
+];
diff --git a/readme.txt b/readme.txt
index 201fa5b..1a71b6b 100755
--- a/readme.txt
+++ b/readme.txt
@@ -4,7 +4,7 @@ Tags: free, cash, conekta, mexico, payment gateway
 Requires at least: 6.1
 Tested up to: 6.7.1
 Requires PHP: 7.4
-Stable tag: 5.1.0
+Stable tag: 5.1.1
 License: GPLv2 or later
 License URI: http://www.gnu.org/licenses/gpl-2.0.html
 


Reviews:
user: login: gemini-code-assist[bot]
body: Hello @pedroruizconekta, I'm Gemini Code Assist[^1]! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

## Summary of Changes
This pull request focuses on updating the cash reference page for the Conekta WooCommerce plugin. The primary changes include updating the plugin version, modifying the Dockerfile to include Node.js installation, adding CSS styles for the cash reference page, updating the Conekta PHP library version, and enhancing the cash payment gateway with new features like i18n support, dynamic logo rendering, and improved instructions display on the thank you page.

### Highlights
* **Feature Enhancement**: The cash payment gateway is enhanced with i18n support, dynamic logo rendering based on payment method, and improved instructions display on the thank you page.
* **Dependency Update**: The Conekta PHP library is updated from version 6.0.7 to 6.0.11, and phpstan/phpstan is updated from 1.10.63 to 2.0.1.
* **Dockerfile Modification**: The Dockerfile is modified to include Node.js installation, which suggests the plugin might be using Node.js for some functionalities.
* **UI Enhancement**: New CSS styles are added to improve the look and feel of the cash reference page, including styles for titles, links, buttons, and payment instructions.

### Changelog
<details>
<summary>Click here to see the changelog</summary>

* **.gitattributes**
  * Added a .gitattributes file to manage how Git handles line endings.
* **Dockerfile**
  * Added installation steps for Node.js and npm.
  * Updated the phpunit alias to point to the composer vendor directory.
  * Added several dependencies such as curl, python3, make, g++, zip, ca-certificates, tar, xz, and openssl.
* **README.md**
  * Updated the plugin version from 5.1.0 to 5.1.1.
* **assets/styles.css**
  * Added new CSS rules for styling the cash reference page, including styles for titles, links, buttons, and payment instructions.
* **composer.json**
  * Updated the conekta/conekta-php dependency from version 6.0.7 to 6.0.11.
* **composer.lock**
  * Updated the conekta/conekta-php package version and reference.
  * Updated the phpstan/phpstan package version.
  * Updated the plugin-api-version.
* **conekta_cash_block_gateway.php**
  * Added i18n support for the cash payment gateway.
  * Implemented dynamic logo rendering based on the payment method.
  * Improved instructions display on the thank you page.
  * Added functions to render the header, instructions, logos, barcode, and reference for cash payments.
  * Added a new action to enqueue the styles.css file.
* **conekta_checkout.php**
  * Updated the plugin version from 5.1.0 to 5.1.1.
* **conekta_plugin.php**
  * Updated the plugin version from 5.1.0 to 5.1.1.
* **includes/blocks/payment-instructions.php**
  * Added an array containing the logos for different cash payment methods.
* **includes/i18n/es.php**
  * Added a new file containing the Spanish translations for the cash payment gateway, including headers, commission notes, button labels, and instructions.
* **readme.txt**
  * Updated the stable tag from 5.1.0 to 5.1.1.

</details>


<details>

<summary><b>Using Gemini Code Assist</b></summary>
<br>

The full guide for Gemini Code Assist can be found on our [documentation page](https://developers.google.com/gemini-code-assist/docs/review-github-code), here are some quick tips.

<b>Invoking Gemini</b>

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either `/gemini <command>` or `@gemini-code-assist <command>`. Below is a summary of the supported commands.

Feature | Command | Description
--- | --- | ---
Code Review | `/gemini review` | Performs a code review for the current pull request in its current state.
Pull Request Summary | `/gemini summary` | Provides a summary of the current pull request in its current state.
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments.
Help | `/gemini help` | Displays a list of available commands.

<b>Customization</b>

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a `.gemini/` folder in the base of the repository. Detailed instructions can be found [here](https://developers.google.com/gemini-code-assist/docs/customize-gemini-behavior-github).

<b>Limitations & Feedback</b>

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with :thumbsup: and :thumbsdown: on @gemini-code-assist comments to provide feedback.

</details>

<b>You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the [Gemini Code Assist IDE Extension](https://cloud.google.com/products/gemini/code-assist).</b>


[^1]: Review the [Privacy Notices](https://policies.google.com/privacy), [Generative AI Prohibited Use Policy](https://policies.google.com/terms/generative-ai/use-policy), [Terms of Service](https://policies.google.com/terms), and learn how to configure Gemini Code Assist in GitHub [here](https://developers.google.com/gemini-code-assist/docs/review-github-code). Gemini can make mistakes, so double check it and [use code with caution](https://support.google.com/legal/answer/13505487).

---

> A payment's made with cash,
> Reference shown in a flash,
> Logos bright and bold,
> Instructions to be told,
> A modern money dash.


state: COMMENTED
author_association: NONE
submitted_at: 2025-04-08T19:31:58Z
user: login: gemini-code-assist[bot]
body: ## Code Review
The pull request updates the Conekta Woocommerce plugin, focusing on cash payment methods. It includes version updates, dependency upgrades, and enhancements to the cash payment reference display on the order received page. The addition of CSS styles and i18n support improves the user experience and maintainability.

### Summary of Findings
* **Node.js Installation in Dockerfile**: The Dockerfile installs Node.js from an unofficial build. While this may work, it's generally recommended to use official sources or package managers to ensure security and stability. Consider using `nvm` or the official Node.js APT/YUM repositories.
* **Hardcoded Locale**: The locale is hardcoded to 'es'. It would be better to allow the locale to be configurable, either through a setting or by detecting the user's locale.
* **Missing Input Sanitization**: The code lacks input sanitization for the 'instructions' field in the admin settings. This could lead to XSS vulnerabilities. Sanitize the input before saving it to the database.

### Merge Readiness
The pull request introduces several improvements and bug fixes. However, the potential security concerns with the Node.js installation in the Dockerfile and the missing input sanitization should be addressed before merging. I am unable to approve this pull request, and recommend that others review and approve this code before merging. At a minimum, the high severity issues should be addressed before merging.
state: CHANGES_REQUESTED
author_association: NONE
submitted_at: 2025-04-08T19:32:11Z
user: login: pedroruizconekta
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T15:01:54Z
user: login: pedroruizconekta
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-10T17:30:55Z
user: login: xonorosas
state: DISMISSED
author_association: NONE
submitted_at: 2025-04-11T15:09:05Z
user: login: nicocedron
state: CHANGES_REQUESTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-11T16:04:49Z
user: login: nicocedron
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-04-11T17:17:43Z

Review comments:
diff_hunk: @@ -1,12 +1,36 @@
 FROM php:7.4-cli-alpine
 
-RUN apk add --no-cache $PHPIZE_DEPS \
-	libxml2-dev \
-	php-soap linux-headers bash \
-	git 
+# Variables de versión
+ENV NODE_VERSION=20.11.1
 
+# Instala dependencias necesarias
+RUN apk add --no-cache \
+    $PHPIZE_DEPS \
+    libxml2-dev \
+    linux-headers \
+    bash \
+    git \
+    curl \
+    python3 \
+    make \
+    g++ \
+    zip \
+    ca-certificates \
+    tar \
+    xz \
+    openssl
+
+# Instala Node.js desde los binarios oficiales
+RUN curl -fsSL https://unofficial-builds.nodejs.org/download/release/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64-musl.tar.xz | tar -xJ -C /usr/local --strip-components=1 --no-same-owner \
+    && ln -s /usr/local/bin/node /usr/bin/node \
+    && ln -s /usr/local/bin/npm /usr/bin/npm \
+    && ln -s /usr/local/bin/npx /usr/bin/npx
path: Dockerfile
user: login: gemini-code-assist[bot]
body: ![high](https://img.shields.io/badge/priority-high-orange)

Installing Node.js from an unofficial build is risky. Consider using the official NodeSource repository or `nvm` for better security and maintainability. This approach ensures you're getting official builds and can easily manage Node.js versions.

For example, you could use `nvm`:

```bash
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash \
    && . ~/.nvm/nvm.sh \
    && nvm install $NODE_VERSION \
    && nvm alias default $NODE_VERSION
```
created_at: 2025-04-08T19:32:11Z
author_association: NONE
diff_hunk: @@ -29,6 +29,8 @@ class WC_Conekta_Cash_Gateway extends WC_Conekta_Plugin
     public $api_key;
     public $webhook_url;
     public $instructions;
+    public $locale = 'es';
+    public $i18n = [];
path: conekta_cash_block_gateway.php
user: login: gemini-code-assist[bot]
body: ![medium](https://img.shields.io/badge/priority-medium-yellow)

The locale is hardcoded to 'es'. It would be better to allow the locale to be configurable, either through a setting or by detecting the user's locale. This would make the plugin more flexible and user-friendly.
created_at: 2025-04-08T19:32:11Z
author_association: NONE
diff_hunk: @@ -29,6 +29,8 @@ class WC_Conekta_Cash_Gateway extends WC_Conekta_Plugin
     public $api_key;
     public $webhook_url;
     public $instructions;
+    public $locale = 'es';
+    public $i18n = [];
path: conekta_cash_block_gateway.php
user: login: pedroruizconekta
body: at the moment we are going to use only spanish.
created_at: 2025-04-09T15:01:54Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1 @@
+* text=auto
path: .gitattributes
user: login: pedroruizconekta
body: this is to avoid loading automatic changes from the "END OF LINE" (CRLF or LF) when working in windows
created_at: 2025-04-10T17:30:54Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,146 @@
+:root {
+    --color-primary-500: #171d4d;
+    --color-primary-400: #2c4cf5;
+    --color-tertiary-100: #E5EDFF;
+    --color-tertiary-500: #2c4cf5;
+    --color-text: #212247;
+    --font-body: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
+}
+
path: assets/styles.css
user: login: nicocedron
body: A las variables le pondría el prefijo conekta, por si el theme de woo tiene las mismas variables
created_at: 2025-04-11T16:03:25Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,146 @@
+:root {
+    --color-primary-500: #171d4d;
+    --color-primary-400: #2c4cf5;
+    --color-tertiary-100: #E5EDFF;
+    --color-tertiary-500: #2c4cf5;
+    --color-text: #212247;
+    --font-body: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
+}
+
+/* Texto en mayúsculas, centrado, semibold */
path: assets/styles.css
user: login: nicocedron
body: Quitar comentarios en español
created_at: 2025-04-11T16:03:38Z
author_association: CONTRIBUTOR

PR comments:
user: login: gemini-code-assist[bot]
created_at: 2025-04-09T15:01:11Z
body: > [!WARNING]
> You have reached your daily quota limit. As a reminder, free tier users are limited to 5 requests per day. Please wait up to 24 hours and I will start processing your requests again!
author_association: NONE
user: login: gemini-code-assist[bot]
created_at: 2025-04-09T16:54:20Z
body: > [!WARNING]
> You have reached your daily quota limit. As a reminder, free tier users are limited to 5 requests per day. Please wait up to 24 hours and I will start processing your requests again!
author_association: NONE