siip-whatsapp-notifications.../vendor/aws/aws-crt-php
DANYDHSV 84a25a829c Feat(Plugin): Implementación Microservicio PDF, Integración MinIO, Fix Recorte y Overlay de Pagos
Descripción:

Se ha realizado una refactorización mayor del sistema de notificaciones y generación de comprobantes para eliminar dependencias legacy (Imagick/FTP) y modernizar la arquitectura.

🚀 Nuevas Características (Features)
Microservicio PDF (pdf-cropper):

Nuevo servicio en Python (FastAPI + Poppler) desplegado en Docker (Puerto 8050) para la conversión de PDF a Imagen.
Reemplaza la librería Imagick de PHP, aislando el procesamiento pesado fuera del plugin.
Modo Full: Garantiza la conversión del PDF completo respetando su relación de aspecto original (sin recortes ni "square crop").
Overlay de Texto: Capacidad nativa en el backend para sobreescribir texto dinámicamente (ej. cambiar "Tarjeta de crédito Stripe" por "OXXO Pay") basado en parámetros.
Integración S3 / MinIO:

Implementación de
MinioStorageService
.
Los comprobantes (JPG) y Vouchers OXXO se suben automáticamente a MinIO en lugar de usar FTP.
Generación de URLs públicas seguras.
🧹 Mantenimiento y Limpieza (Chores/Refactor)
Limpieza Automática (Cleanup):

Se implementó lógica para eliminar archivos temporales locales (PDFs descargados, JPGs generados) inmediatamente después de una subida exitosa a MinIO.
Aplica tanto para comprobantes de pago como para Vouchers OXXO.
Refactor
ClientCallBellAPI
:

Eliminación de código muerto relacionado con FTP de WordPress.
Implementación de cliente HTTP Guzzle para comunicación con pdf-cropper.
Cache Busting: Se añade Timestamp al nombre de archivo (_time()) para evitar caché agresivo en WhatsApp/Navegadores.
Detección de Método: Lógica preliminar para detectar "OXXO" o "Transferencia" en notas de pago y aplicar Overlay.
Docker Infraestructura:

Actualización de
docker-compose.yml
 para incluir pdf-cropper.
Instalación de fuentes (fonts-dejavu-core) para renderizado correcto de texto.
🐛 Correcciones (Bug Fixes)
Fix Recorte de Imagen: Se eliminó la restricción de relación de aspecto 1:1 (cuadrado) que cortaba headers y footers en documentos rectangulares.
Standardización de Notas: Actualización de
AbstractStripeOperationsFacade
 para incluir explícitamente "OXXO" o "Transferencia" en las notas de pago de UCRM (preparación para lógica de plantillas).
2026-01-14 22:56:17 -06:00
..
src/AWS/CRT Feat(Plugin): Implementación Microservicio PDF, Integración MinIO, Fix Recorte y Overlay de Pagos 2026-01-14 22:56:17 -06:00
CODE_OF_CONDUCT.md Feat(Plugin): Implementación Microservicio PDF, Integración MinIO, Fix Recorte y Overlay de Pagos 2026-01-14 22:56:17 -06:00
composer.json Feat(Plugin): Implementación Microservicio PDF, Integración MinIO, Fix Recorte y Overlay de Pagos 2026-01-14 22:56:17 -06:00
format-check.py Feat(Plugin): Implementación Microservicio PDF, Integración MinIO, Fix Recorte y Overlay de Pagos 2026-01-14 22:56:17 -06:00
LICENSE Feat(Plugin): Implementación Microservicio PDF, Integración MinIO, Fix Recorte y Overlay de Pagos 2026-01-14 22:56:17 -06:00
NOTICE Feat(Plugin): Implementación Microservicio PDF, Integración MinIO, Fix Recorte y Overlay de Pagos 2026-01-14 22:56:17 -06:00
README.md Feat(Plugin): Implementación Microservicio PDF, Integración MinIO, Fix Recorte y Overlay de Pagos 2026-01-14 22:56:17 -06:00

AWS Common Runtime PHP bindings

Requirements

  • PHP 5.5+ on UNIX platforms, 7.2+ on Windows
  • CMake 3.x
  • GCC 4.4+, clang 3.8+ on UNIX, Visual Studio build tools on Windows
  • Tests require Composer

Installing with Composer and PECL

The package has two different package published to composer and PECL.

On UNIX, you can get the package from package manager or build from source:

pecl install awscrt
composer require aws/aws-crt-php

On Windows, you need to build from source as instruction written below for the native extension php_awscrt.dll . And, follow https://www.php.net/manual/en/install.pecl.windows.php#install.pecl.windows.loading to load extension. After that:

composer require aws/aws-crt-php

Building from Github source

$ git clone --recursive https://github.com/awslabs/aws-crt-php.git
$ cd aws-crt-php
$ phpize
$ ./configure
$ make
$ ./dev-scripts/run_tests.sh

Building on Windows

Requirements for Windows

  • Ensure you have the windows PHP SDK (this example assumes installation of the SDK to C:\php-sdk and that you've checked out the PHP source to php-src within the build directory) and it works well on your machine.

  • Ensure you have "Development package (SDK to develop PHP extensions)" and PHP available from your system path. You can download them from https://windows.php.net/download/. You can check if they are available by running phpize -v and php -v

Instructions

From Command Prompt (not powershell). The instruction is based on Visual Studio 2019 on 64bit Windows.

> git clone --recursive https://github.com/awslabs/aws-crt-php.git
> git clone https://github.com/microsoft/php-sdk-binary-tools.git C:\php-sdk
> C:\php-sdk\phpsdk-vs16-x64.bat

C:\php-sdk\
$ cd <your-path-to-aws-crt-php>

<your-path-to-aws-crt-php>\
$ phpize

# --with-prefix only required when your php runtime in system path is different than the runtime you wish to use.
<your-path-to-aws-crt-php>\
$ configure --enable-awscrt=shared --with-prefix=<your-path-to-php-prefix>

<your-path-to-aws-crt-php>\
$ nmake

<your-path-to-aws-crt-php>\
$ nmake generate-php-ini

# check .\php-win.ini, it now has the full path to php_awscrt.dll that you can manually load to your php runtime, or you can run the following command to run tests and load the required native extension for awscrt.
<your-path-to-aws-crt-php>\
$ .\dev-scripts\run_tests.bat <your-path-to-php-binary>

Note: for VS2017, Cmake will default to build for Win32, refer to here. If you are building for x64 php, you can set environment variable as follow to let cmake pick x64 compiler.

set CMAKE_GENERATOR=Visual Studio 15 2017
set CMAKE_GENERATOR_PLATFORM=x64

Debugging

Using PHPBrew to build/manage multiple versions of PHP is helpful.

Note: You must use a debug build of PHP to debug native extensions. See the PHP Internals Book for more info

# PHP 8 example
$ phpbrew install --stdout -j 8 8.0 +default -- CFLAGS=-Wno-error --disable-cgi --enable-debug
# PHP 5.5 example
$ phpbrew install --stdout -j 8 5.5 +default -openssl -mbstring -- CFLAGS="-w -Wno-error" --enable-debug --with-zlib=/usr/local/opt/zlib
$ phpbrew switch php-8.0.6 # or whatever version is current, it'll be at the end of the build output
$ phpize
$ ./configure
$ make CMAKE_BUILD_TYPE=Debug

Ensure that the php you launch from your debugger is the result of which php , not just the system default php.

Security

See CONTRIBUTING for more information.

  • When your php loads a different version of openssl than your system openssl version, awscrt may fail to load or weirdly crash. You can find the openssl version php linked via: php -i | grep 'OpenSSL', and awscrt linked from the build log, which will be Found OpenSSL: * (found version *)

The easiest workaround to those issue is to build from source and get aws-lc for awscrt to depend on instead. TO do that, same instructions as here, but use USE_OPENSSL=OFF make instead of make

License

This project is licensed under the Apache-2.0 License.