Compare commits

...

21 Commits

Author SHA1 Message Date
96d7fe6b27 Version 2.7.0 con la opción de generar clabes interbancarias por medio de una etiqueta con nombre 'CREARCLABESTRIPE' y además permite crear las clabes de manera automática cuando el cliente pasa de potencial a cliente regular 2025-03-24 22:47:43 -06:00
9db9febc39 Versión 2.6.9.1 con modificaciones para devolver mas campos en la respuesta a una creación de referencia de OXXO, como tal son los campos de oxxo_reference, error, failDescription, clientID, clientFullName, amount como número entero 2025-03-08 08:13:48 +00:00
59aac17968 Versión 2.6.9 con modificaciones para devolver mas campos en la respuesta a una creación de referencia de OXXO, como tal son los campos de oxxo_reference, error, failDescription, clientID, clientFullName, amount 2025-03-08 00:09:06 +00:00
2819804ad8 HotFix para manejo de excepciones de timeout para referencias de oxxo, ahora se envian las claves 'error' y 'url' en el mismo cuerpo de la respuesta, también se mejoró el código del método para crear la referencia de oxxo y el de edición del cliente para agregar los campos personalizados de Site y Antena/Sectorial 2025-03-05 05:33:07 +00:00
4276097212 HotFix para manejo de excepciones de timeout para referencias de oxxo y otros errores versión 2 con ajuste de codigos 2025-03-04 10:04:00 +00:00
cd74cafeda HotFix para manejo de excepciones de timeout para referencias de oxxo y otros errores 2025-03-04 09:32:03 +00:00
398dcc462f Adición de los eventos: [invoice.draft_approved, invoice.add_draft] para sincronizar el saldo del cliente a CallBell así como del evento service.edit 2025-02-18 23:27:27 +00:00
c3824ba827 Hot fix para poder enviar notoficaciones a mas de un contacto de tipo whatsapp en un mismo cliente, verificacion para la sincroniazacion de clientes hacia callbell cuando se agrega una factura o se edita ademas s ajustó para que solo se pueda editar el email en stripe cuando se haga una edición en el CRM 2025-02-18 10:42:18 +00:00
e1e3f409c9 Hot fix para arreglar el error que no permitía generar pagos por referencia 2025-02-06 23:48:51 +00:00
eafc867742 Versión 2.6.3 HOT FIX que arregla el bug que impedía hacer referencias de oxxo porque se duplicaba la multiplicación del factor 100 para la conversión de centavos 2025-02-02 22:42:29 +00:00
12d19c46de Versión 2.6.2 correción de la rutina de envio de pdf 2025-01-27 09:29:45 +00:00
9fc3bcb8d9 Versión 2.6.1 ajuste de la hora, negritas en el folio y el envio correcto de desasignacion de servicio 2025-01-25 16:42:25 +00:00
8e5b144796 Versión 2.6.1 ajuste de la hora, negritas en el folio y el envio correcto de desasignacion de servicio 2025-01-25 16:36:47 +00:00
869331b02c Versión 2.6.0 completa 2025-01-24 16:07:10 +00:00
11b7d7cacc corrección de referencias oxxo con linea return y rutina para ir evaluando los jobs 2025-01-18 03:52:06 +00:00
efd6f36c37 Rework para clientes pontenciales nuevos, eliminacion del tiempo de espera para intentos de creacion de referencias de oxxo 2025-01-14 09:10:39 +00:00
93a0f30eec Hot fix para nuevos clientes potenciales, se evitara hacer un Stripe customer ID, se ajuto el email del cliente por defecto para crear paymenIntent para pagos de Oxxo 2025-01-07 23:14:34 +00:00
3b3cd70ece Cambios para validar cantidad, mas logs para errores y poner email por defecto al cliente, manifest 2025-01-05 19:43:42 +00:00
f7119a4512 Cambios para validar cantidad, mas logs para errores y poner email por defecto al cliente 2025-01-05 19:39:57 +00:00
9e78efdf2f Cambios para procesar referencias oxxo con hasta 5 intentos 2025-01-04 08:36:11 +00:00
1731eb1813 Cambios en el comprobante de pago, imagen sin recorte 2025-01-03 21:36:27 +00:00
4775 changed files with 318507 additions and 11818 deletions

5
.gitignore vendored Executable file
View File

@ -0,0 +1,5 @@
*.pdf
*.log
*.png
.vscode/
*.zip

5
.vscode/extensions.json vendored Executable file
View File

@ -0,0 +1,5 @@
{
"recommendations": [
"github.copilot-chat"
]
}

69
.vscode/launch.json vendored Executable file
View File

@ -0,0 +1,69 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 0,
"runtimeArgs": [
"-dxdebug.start_with_request=yes"
],
"env": {
"XDEBUG_MODE": "debug,develop",
"XDEBUG_CONFIG": "client_port=${port}"
}
},
{
"name": "Launch Built-in web server",
"type": "php",
"request": "launch",
"runtimeArgs": [
"-dxdebug.mode=debug",
"-dxdebug.start_with_request=yes",
"-S",
"localhost:0"
],
"program": "",
"cwd": "${workspaceRoot}",
"port": 9003,
"serverReadyAction": {
"pattern": "Development Server \\(http://localhost:([0-9]+)\\) started",
"uriFormat": "http://localhost:%s",
"action": "openExternally"
}
},
{
"name": "Launch built-in server and Debug",
"type": "php",
"request": "launch",
"noDebug": false,
"runtimeArgs": [
"-S",
"localhost:8000",
"-t",
"."
],
"cwd": "${workspaceRoot}/.",
"serverReadyAction": {
"action": "openExternally"
}
},
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch"
}
]
}

View File

@ -1,9 +1,7 @@
# SMS notifier - Twilio
# SIIP - Procesador de Pagos en línea con Stripe, Oxxo y Transferencia, Sincronizador de CallBell y Envío de Notificaciones y comprobantes vía WhatsApp
Este plugin sincroniza los clientes del sitema UISP CRM con los contactos de WhatsApp en CallBell, además procesa pagos de Stripe como las trasferencias bancarias y genera referencias de pago vía OXXO, además envía comprobantes de pago en formato imagen PNG o texto vía Whatsapp a los clientes
* This plugin sends SMS notifications to clients.
* SMS is triggered by an event which happened in UCRM, e.g. new invoice has been issued, or client's sevice became suspended.
* It only sends SMS to clients having a phone number set in their contacts details.
* [Twilio](https://www.twilio.com/) account is required to access its API.
## Configuration
@ -29,7 +27,7 @@ Note: there are two sets of credentials available, the default ("LIVE credential
## Usage
* In UCRM admin, go to System / Webhooks / Endpoints
* Click Test Endpoint
* Go to System / Plugins / SMS notifications via Twilio
* Go to System / Plugins / SIIP - Procesador de Pagos en línea con Stripe, Oxxo y Transferencia, Sincronizador de CallBell y Envío de Notificaciones y comprobantes vía WhatsApp
* In the log output, you'll see `Webhook test successful.`
## Variables replaced
@ -206,7 +204,7 @@ Client variables are replaced always; payment invoice and service only with the
* Replace the TwilioNotifierFacade and any references to it with a different class which extends AbstractMessageNotifierFacade
* Update libraries in composer.json as needed
* Communicate with the remote system in the sendMessage() function
* Preferably also change the SmsNotifier namespace to some other (not strictly necessary).
Read more about creating your own plugin in the [Developer documentation](https://github.com/Ubiquiti-App/UCRM-plugins/blob/master/docs/index.md).

270
composer.lock generated
View File

@ -8,16 +8,16 @@
"packages": [
{
"name": "firebase/php-jwt",
"version": "v6.10.1",
"version": "v6.10.2",
"source": {
"type": "git",
"url": "https://github.com/firebase/php-jwt.git",
"reference": "500501c2ce893c824c801da135d02661199f60c5"
"reference": "30c19ed0f3264cb660ea496895cfb6ef7ee3653b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/firebase/php-jwt/zipball/500501c2ce893c824c801da135d02661199f60c5",
"reference": "500501c2ce893c824c801da135d02661199f60c5",
"url": "https://api.github.com/repos/firebase/php-jwt/zipball/30c19ed0f3264cb660ea496895cfb6ef7ee3653b",
"reference": "30c19ed0f3264cb660ea496895cfb6ef7ee3653b",
"shasum": ""
},
"require": {
@ -65,40 +65,40 @@
],
"support": {
"issues": "https://github.com/firebase/php-jwt/issues",
"source": "https://github.com/firebase/php-jwt/tree/v6.10.1"
"source": "https://github.com/firebase/php-jwt/tree/v6.10.2"
},
"time": "2024-05-18T18:05:11+00:00"
"time": "2024-11-24T11:22:49+00:00"
},
{
"name": "google/apiclient",
"version": "v2.16.0",
"version": "v2.18.2",
"source": {
"type": "git",
"url": "https://github.com/googleapis/google-api-php-client.git",
"reference": "017400f609c1fb71ab5ad824c50eabd4c3eaf779"
"reference": "d8d201ba8a189a3cd7fb34e4da569f2ed440eee7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/googleapis/google-api-php-client/zipball/017400f609c1fb71ab5ad824c50eabd4c3eaf779",
"reference": "017400f609c1fb71ab5ad824c50eabd4c3eaf779",
"url": "https://api.github.com/repos/googleapis/google-api-php-client/zipball/d8d201ba8a189a3cd7fb34e4da569f2ed440eee7",
"reference": "d8d201ba8a189a3cd7fb34e4da569f2ed440eee7",
"shasum": ""
},
"require": {
"firebase/php-jwt": "~6.0",
"firebase/php-jwt": "^6.0",
"google/apiclient-services": "~0.350",
"google/auth": "^1.37",
"guzzlehttp/guzzle": "^6.5.8||^7.4.5",
"guzzlehttp/psr7": "^1.9.1||^2.2.1",
"guzzlehttp/guzzle": "^7.4.5",
"guzzlehttp/psr7": "^2.6",
"monolog/monolog": "^2.9||^3.0",
"php": "^7.4|^8.0",
"php": "^8.0",
"phpseclib/phpseclib": "^3.0.36"
},
"require-dev": {
"cache/filesystem-adapter": "^1.1",
"composer/composer": "^1.10.23",
"phpcompatibility/php-compatibility": "^9.2",
"phpspec/prophecy-phpunit": "^2.0",
"phpunit/phpunit": "^9.5",
"phpspec/prophecy-phpunit": "^2.1",
"phpunit/phpunit": "^9.6",
"squizlabs/php_codesniffer": "^3.8",
"symfony/css-selector": "~2.1",
"symfony/dom-crawler": "~2.1"
@ -134,22 +134,22 @@
],
"support": {
"issues": "https://github.com/googleapis/google-api-php-client/issues",
"source": "https://github.com/googleapis/google-api-php-client/tree/v2.16.0"
"source": "https://github.com/googleapis/google-api-php-client/tree/v2.18.2"
},
"time": "2024-04-24T00:59:47+00:00"
"time": "2024-12-16T22:52:40+00:00"
},
{
"name": "google/apiclient-services",
"version": "v0.359.0",
"version": "v0.389.0",
"source": {
"type": "git",
"url": "https://github.com/googleapis/google-api-php-client-services.git",
"reference": "e975e6d0efa47f7e49280c4ea7fd6a93b6d7e338"
"reference": "6274e67ee52b1a416ccee0a4eaf337d1139cdaf8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/e975e6d0efa47f7e49280c4ea7fd6a93b6d7e338",
"reference": "e975e6d0efa47f7e49280c4ea7fd6a93b6d7e338",
"url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/6274e67ee52b1a416ccee0a4eaf337d1139cdaf8",
"reference": "6274e67ee52b1a416ccee0a4eaf337d1139cdaf8",
"shasum": ""
},
"require": {
@ -178,29 +178,29 @@
],
"support": {
"issues": "https://github.com/googleapis/google-api-php-client-services/issues",
"source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.359.0"
"source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.389.0"
},
"time": "2024-06-10T01:02:17+00:00"
"time": "2025-01-05T01:04:21+00:00"
},
{
"name": "google/auth",
"version": "v1.40.0",
"version": "v1.44.0",
"source": {
"type": "git",
"url": "https://github.com/googleapis/google-auth-library-php.git",
"reference": "bff9f2d01677e71a98394b5ac981b99523df5178"
"reference": "5670e56307d7a2eac931f677c0e59a4f8abb2e43"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/bff9f2d01677e71a98394b5ac981b99523df5178",
"reference": "bff9f2d01677e71a98394b5ac981b99523df5178",
"url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/5670e56307d7a2eac931f677c0e59a4f8abb2e43",
"reference": "5670e56307d7a2eac931f677c0e59a4f8abb2e43",
"shasum": ""
},
"require": {
"firebase/php-jwt": "^6.0",
"guzzlehttp/guzzle": "^7.4.5",
"guzzlehttp/psr7": "^2.4.5",
"php": "^8.0",
"php": "^8.1",
"psr/cache": "^2.0||^3.0",
"psr/http-message": "^1.1||^2.0"
},
@ -238,28 +238,28 @@
"support": {
"docs": "https://googleapis.github.io/google-auth-library-php/main/",
"issues": "https://github.com/googleapis/google-auth-library-php/issues",
"source": "https://github.com/googleapis/google-auth-library-php/tree/v1.40.0"
"source": "https://github.com/googleapis/google-auth-library-php/tree/v1.44.0"
},
"time": "2024-05-31T19:16:15+00:00"
"time": "2024-12-04T15:34:58+00:00"
},
{
"name": "guzzlehttp/guzzle",
"version": "7.8.1",
"version": "7.9.2",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "41042bc7ab002487b876a0683fc8dce04ddce104"
"reference": "d281ed313b989f213357e3be1a179f02196ac99b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/41042bc7ab002487b876a0683fc8dce04ddce104",
"reference": "41042bc7ab002487b876a0683fc8dce04ddce104",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/d281ed313b989f213357e3be1a179f02196ac99b",
"reference": "d281ed313b989f213357e3be1a179f02196ac99b",
"shasum": ""
},
"require": {
"ext-json": "*",
"guzzlehttp/promises": "^1.5.3 || ^2.0.1",
"guzzlehttp/psr7": "^1.9.1 || ^2.5.1",
"guzzlehttp/promises": "^1.5.3 || ^2.0.3",
"guzzlehttp/psr7": "^2.7.0",
"php": "^7.2.5 || ^8.0",
"psr/http-client": "^1.0",
"symfony/deprecation-contracts": "^2.2 || ^3.0"
@ -270,9 +270,9 @@
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8.2",
"ext-curl": "*",
"php-http/client-integration-tests": "dev-master#2c025848417c1135031fdf9c728ee53d0a7ceaee as 3.0.999",
"guzzle/client-integration-tests": "3.0.2",
"php-http/message-factory": "^1.1",
"phpunit/phpunit": "^8.5.36 || ^9.6.15",
"phpunit/phpunit": "^8.5.39 || ^9.6.20",
"psr/log": "^1.1 || ^2.0 || ^3.0"
},
"suggest": {
@ -350,7 +350,7 @@
],
"support": {
"issues": "https://github.com/guzzle/guzzle/issues",
"source": "https://github.com/guzzle/guzzle/tree/7.8.1"
"source": "https://github.com/guzzle/guzzle/tree/7.9.2"
},
"funding": [
{
@ -366,20 +366,20 @@
"type": "tidelift"
}
],
"time": "2023-12-03T20:35:24+00:00"
"time": "2024-07-24T11:22:20+00:00"
},
{
"name": "guzzlehttp/promises",
"version": "2.0.2",
"version": "2.0.4",
"source": {
"type": "git",
"url": "https://github.com/guzzle/promises.git",
"reference": "bbff78d96034045e58e13dedd6ad91b5d1253223"
"reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/promises/zipball/bbff78d96034045e58e13dedd6ad91b5d1253223",
"reference": "bbff78d96034045e58e13dedd6ad91b5d1253223",
"url": "https://api.github.com/repos/guzzle/promises/zipball/f9c436286ab2892c7db7be8c8da4ef61ccf7b455",
"reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455",
"shasum": ""
},
"require": {
@ -387,7 +387,7 @@
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8.2",
"phpunit/phpunit": "^8.5.36 || ^9.6.15"
"phpunit/phpunit": "^8.5.39 || ^9.6.20"
},
"type": "library",
"extra": {
@ -433,7 +433,7 @@
],
"support": {
"issues": "https://github.com/guzzle/promises/issues",
"source": "https://github.com/guzzle/promises/tree/2.0.2"
"source": "https://github.com/guzzle/promises/tree/2.0.4"
},
"funding": [
{
@ -449,20 +449,20 @@
"type": "tidelift"
}
],
"time": "2023-12-03T20:19:20+00:00"
"time": "2024-10-17T10:06:22+00:00"
},
{
"name": "guzzlehttp/psr7",
"version": "2.6.2",
"version": "2.7.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/psr7.git",
"reference": "45b30f99ac27b5ca93cb4831afe16285f57b8221"
"reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/45b30f99ac27b5ca93cb4831afe16285f57b8221",
"reference": "45b30f99ac27b5ca93cb4831afe16285f57b8221",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/a70f5c95fb43bc83f07c9c948baa0dc1829bf201",
"reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201",
"shasum": ""
},
"require": {
@ -477,8 +477,8 @@
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8.2",
"http-interop/http-factory-tests": "^0.9",
"phpunit/phpunit": "^8.5.36 || ^9.6.15"
"http-interop/http-factory-tests": "0.9.0",
"phpunit/phpunit": "^8.5.39 || ^9.6.20"
},
"suggest": {
"laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
@ -549,7 +549,7 @@
],
"support": {
"issues": "https://github.com/guzzle/psr7/issues",
"source": "https://github.com/guzzle/psr7/tree/2.6.2"
"source": "https://github.com/guzzle/psr7/tree/2.7.0"
},
"funding": [
{
@ -565,7 +565,7 @@
"type": "tidelift"
}
],
"time": "2023-12-03T20:05:35+00:00"
"time": "2024-07-18T11:15:46+00:00"
},
{
"name": "katzgrau/klogger",
@ -623,26 +623,27 @@
},
{
"name": "laravel/serializable-closure",
"version": "v1.3.3",
"version": "v1.3.7",
"source": {
"type": "git",
"url": "https://github.com/laravel/serializable-closure.git",
"reference": "3dbf8a8e914634c48d389c1234552666b3d43754"
"reference": "4f48ade902b94323ca3be7646db16209ec76be3d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/serializable-closure/zipball/3dbf8a8e914634c48d389c1234552666b3d43754",
"reference": "3dbf8a8e914634c48d389c1234552666b3d43754",
"url": "https://api.github.com/repos/laravel/serializable-closure/zipball/4f48ade902b94323ca3be7646db16209ec76be3d",
"reference": "4f48ade902b94323ca3be7646db16209ec76be3d",
"shasum": ""
},
"require": {
"php": "^7.3|^8.0"
},
"require-dev": {
"nesbot/carbon": "^2.61",
"illuminate/support": "^8.0|^9.0|^10.0|^11.0",
"nesbot/carbon": "^2.61|^3.0",
"pestphp/pest": "^1.21.3",
"phpstan/phpstan": "^1.8.2",
"symfony/var-dumper": "^5.4.11"
"symfony/var-dumper": "^5.4.11|^6.2.0|^7.0.0"
},
"type": "library",
"extra": {
@ -679,20 +680,20 @@
"issues": "https://github.com/laravel/serializable-closure/issues",
"source": "https://github.com/laravel/serializable-closure"
},
"time": "2023-11-08T14:08:06+00:00"
"time": "2024-11-14T18:34:49+00:00"
},
{
"name": "monolog/monolog",
"version": "2.9.3",
"version": "2.10.0",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/monolog.git",
"reference": "a30bfe2e142720dfa990d0a7e573997f5d884215"
"reference": "5cf826f2991858b54d5c3809bee745560a1042a7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/a30bfe2e142720dfa990d0a7e573997f5d884215",
"reference": "a30bfe2e142720dfa990d0a7e573997f5d884215",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/5cf826f2991858b54d5c3809bee745560a1042a7",
"reference": "5cf826f2991858b54d5c3809bee745560a1042a7",
"shasum": ""
},
"require": {
@ -769,7 +770,7 @@
],
"support": {
"issues": "https://github.com/Seldaek/monolog/issues",
"source": "https://github.com/Seldaek/monolog/tree/2.9.3"
"source": "https://github.com/Seldaek/monolog/tree/2.10.0"
},
"funding": [
{
@ -781,28 +782,28 @@
"type": "tidelift"
}
],
"time": "2024-04-12T20:52:51+00:00"
"time": "2024-11-12T12:43:37+00:00"
},
{
"name": "paragonie/constant_time_encoding",
"version": "v2.7.0",
"version": "v3.0.0",
"source": {
"type": "git",
"url": "https://github.com/paragonie/constant_time_encoding.git",
"reference": "52a0d99e69f56b9ec27ace92ba56897fe6993105"
"reference": "df1e7fde177501eee2037dd159cf04f5f301a512"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/52a0d99e69f56b9ec27ace92ba56897fe6993105",
"reference": "52a0d99e69f56b9ec27ace92ba56897fe6993105",
"url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/df1e7fde177501eee2037dd159cf04f5f301a512",
"reference": "df1e7fde177501eee2037dd159cf04f5f301a512",
"shasum": ""
},
"require": {
"php": "^7|^8"
"php": "^8"
},
"require-dev": {
"phpunit/phpunit": "^6|^7|^8|^9",
"vimeo/psalm": "^1|^2|^3|^4"
"phpunit/phpunit": "^9",
"vimeo/psalm": "^4|^5"
},
"type": "library",
"autoload": {
@ -848,7 +849,7 @@
"issues": "https://github.com/paragonie/constant_time_encoding/issues",
"source": "https://github.com/paragonie/constant_time_encoding"
},
"time": "2024-05-08T12:18:48+00:00"
"time": "2024-05-08T12:36:18+00:00"
},
{
"name": "paragonie/random_compat",
@ -957,16 +958,16 @@
},
{
"name": "php-di/php-di",
"version": "7.0.6",
"version": "7.0.7",
"source": {
"type": "git",
"url": "https://github.com/PHP-DI/PHP-DI.git",
"reference": "8097948a89f6ec782839b3e958432f427cac37fd"
"reference": "e87435e3c0e8f22977adc5af0d5cdcc467e15cf1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHP-DI/PHP-DI/zipball/8097948a89f6ec782839b3e958432f427cac37fd",
"reference": "8097948a89f6ec782839b3e958432f427cac37fd",
"url": "https://api.github.com/repos/PHP-DI/PHP-DI/zipball/e87435e3c0e8f22977adc5af0d5cdcc467e15cf1",
"reference": "e87435e3c0e8f22977adc5af0d5cdcc467e15cf1",
"shasum": ""
},
"require": {
@ -1014,7 +1015,7 @@
],
"support": {
"issues": "https://github.com/PHP-DI/PHP-DI/issues",
"source": "https://github.com/PHP-DI/PHP-DI/tree/7.0.6"
"source": "https://github.com/PHP-DI/PHP-DI/tree/7.0.7"
},
"funding": [
{
@ -1026,24 +1027,24 @@
"type": "tidelift"
}
],
"time": "2023-11-02T10:04:50+00:00"
"time": "2024-07-21T15:55:45+00:00"
},
{
"name": "phpseclib/phpseclib",
"version": "3.0.37",
"version": "3.0.43",
"source": {
"type": "git",
"url": "https://github.com/phpseclib/phpseclib.git",
"reference": "cfa2013d0f68c062055180dd4328cc8b9d1f30b8"
"reference": "709ec107af3cb2f385b9617be72af8cf62441d02"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/cfa2013d0f68c062055180dd4328cc8b9d1f30b8",
"reference": "cfa2013d0f68c062055180dd4328cc8b9d1f30b8",
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/709ec107af3cb2f385b9617be72af8cf62441d02",
"reference": "709ec107af3cb2f385b9617be72af8cf62441d02",
"shasum": ""
},
"require": {
"paragonie/constant_time_encoding": "^1|^2",
"paragonie/constant_time_encoding": "^1|^2|^3",
"paragonie/random_compat": "^1.4|^2.0|^9.99.99",
"php": ">=5.6.1"
},
@ -1120,7 +1121,7 @@
],
"support": {
"issues": "https://github.com/phpseclib/phpseclib/issues",
"source": "https://github.com/phpseclib/phpseclib/tree/3.0.37"
"source": "https://github.com/phpseclib/phpseclib/tree/3.0.43"
},
"funding": [
{
@ -1136,7 +1137,7 @@
"type": "tidelift"
}
],
"time": "2024-03-03T02:14:58+00:00"
"time": "2024-12-14T21:12:59+00:00"
},
{
"name": "psr/cache",
@ -1294,20 +1295,20 @@
},
{
"name": "psr/http-factory",
"version": "1.0.2",
"version": "1.1.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-factory.git",
"reference": "e616d01114759c4c489f93b099585439f795fe35"
"reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35",
"reference": "e616d01114759c4c489f93b099585439f795fe35",
"url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a",
"reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a",
"shasum": ""
},
"require": {
"php": ">=7.0.0",
"php": ">=7.1",
"psr/http-message": "^1.0 || ^2.0"
},
"type": "library",
@ -1331,7 +1332,7 @@
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interfaces for PSR-7 HTTP message factories",
"description": "PSR-17: Common interfaces for PSR-7 HTTP message factories",
"keywords": [
"factory",
"http",
@ -1343,9 +1344,9 @@
"response"
],
"support": {
"source": "https://github.com/php-fig/http-factory/tree/1.0.2"
"source": "https://github.com/php-fig/http-factory"
},
"time": "2023-04-10T20:10:41+00:00"
"time": "2024-04-15T12:06:14+00:00"
},
{
"name": "psr/http-message",
@ -1555,16 +1556,16 @@
},
{
"name": "symfony/deprecation-contracts",
"version": "v3.4.0",
"version": "v3.5.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/deprecation-contracts.git",
"reference": "7c3aff79d10325257a001fcf92d991f24fc967cf"
"reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf",
"reference": "7c3aff79d10325257a001fcf92d991f24fc967cf",
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6",
"reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6",
"shasum": ""
},
"require": {
@ -1572,12 +1573,12 @@
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "3.4-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"
"url": "https://github.com/symfony/contracts",
"name": "symfony/contracts"
},
"branch-alias": {
"dev-main": "3.5-dev"
}
},
"autoload": {
@ -1602,7 +1603,7 @@
"description": "A generic function and convention to trigger deprecation notices",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.4.0"
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.1"
},
"funding": [
{
@ -1618,20 +1619,20 @@
"type": "tidelift"
}
],
"time": "2023-05-23T14:45:45+00:00"
"time": "2024-09-25T14:20:29+00:00"
},
{
"name": "symfony/filesystem",
"version": "v6.4.6",
"version": "v6.4.13",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
"reference": "9919b5509ada52cc7f66f9a35c86a4a29955c9d3"
"reference": "4856c9cf585d5a0313d8d35afd681a526f038dd3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/9919b5509ada52cc7f66f9a35c86a4a29955c9d3",
"reference": "9919b5509ada52cc7f66f9a35c86a4a29955c9d3",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/4856c9cf585d5a0313d8d35afd681a526f038dd3",
"reference": "4856c9cf585d5a0313d8d35afd681a526f038dd3",
"shasum": ""
},
"require": {
@ -1639,6 +1640,9 @@
"symfony/polyfill-ctype": "~1.8",
"symfony/polyfill-mbstring": "~1.8"
},
"require-dev": {
"symfony/process": "^5.4|^6.4|^7.0"
},
"type": "library",
"autoload": {
"psr-4": {
@ -1665,7 +1669,7 @@
"description": "Provides basic utilities for the filesystem",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/filesystem/tree/v6.4.6"
"source": "https://github.com/symfony/filesystem/tree/v6.4.13"
},
"funding": [
{
@ -1681,24 +1685,24 @@
"type": "tidelift"
}
],
"time": "2024-03-21T19:36:20+00:00"
"time": "2024-10-25T15:07:50+00:00"
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.29.0",
"version": "v1.31.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4"
"reference": "a3cc8b044a6ea513310cbd48ef7333b384945638"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4",
"reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638",
"reference": "a3cc8b044a6ea513310cbd48ef7333b384945638",
"shasum": ""
},
"require": {
"php": ">=7.1"
"php": ">=7.2"
},
"provide": {
"ext-ctype": "*"
@ -1709,8 +1713,8 @@
"type": "library",
"extra": {
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
"url": "https://github.com/symfony/polyfill",
"name": "symfony/polyfill"
}
},
"autoload": {
@ -1744,7 +1748,7 @@
"portable"
],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.29.0"
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0"
},
"funding": [
{
@ -1760,24 +1764,24 @@
"type": "tidelift"
}
],
"time": "2024-01-29T20:11:03+00:00"
"time": "2024-09-09T11:45:10+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.29.0",
"version": "v1.31.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec"
"reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec",
"reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341",
"reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341",
"shasum": ""
},
"require": {
"php": ">=7.1"
"php": ">=7.2"
},
"provide": {
"ext-mbstring": "*"
@ -1788,8 +1792,8 @@
"type": "library",
"extra": {
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
"url": "https://github.com/symfony/polyfill",
"name": "symfony/polyfill"
}
},
"autoload": {
@ -1824,7 +1828,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.29.0"
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0"
},
"funding": [
{
@ -1840,7 +1844,7 @@
"type": "tidelift"
}
],
"time": "2024-01-29T20:11:03+00:00"
"time": "2024-09-09T11:45:10+00:00"
},
{
"name": "twilio/sdk",

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 383 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 411 KiB

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

View File

@ -1 +1 @@
{"ipserver":"172.16.5.134","apitoken":"6abef18c-783d-4dd0-b530-be6e6a7bbd1d","tokencallbell":"g8thcZkXGd3xBj2g3TtYNYFMH1fuesbJ.b6a940ea7d78cf6c9e42f067b21c8ddf96e9fa2a9e307bfd0c7c7c4d7fa38f79","tokenstripe":"sk_test_51OkG0REFY1WEUtgRH6UxBK5pu80Aq5Iy8EcdPnf0cOWzuVLQTpyLCd7CbPzqMsWMafZOHElCxhEHF7g8boURjWlJ00tBwE0W1M","unmsApiToken":null,"hostServerFTP":"siip.mx","usernameServerFTP":"siip0001","passServerFTP":"$spGiT,[wa)n","cashPaymentMethodId":false,"courtesyPaymentMethodId":false,"bankTransferPaymentMethodId":true,"paypalPaymentMethodId":true,"creditCardPaypalPaymentMethodId":true,"creditCardStripePaymentMethodId":true,"stripeSubscriptionCreditCardPaymentMethodId":true,"paypalSubscriptionPaymentMethodId":true,"mercadopagoPaymentMethodId":true,"checkPaymentMethodId":true,"customPaymentMethodId":true,"notificationTypeText":false,"debugMode":true,"logging_level":true,"dataInstallersWhatsApp":"{ \"instaladores\": [{\"ID\": 1015, \"nombre\": \"Daniel Peña, \"whatsapp\": 4181878106}, {\"ID\": 1020, \"nombre\": \"Angel Arvizu\", \"whatsapp\": 4123456789}, {\"ID\": 1035,\"nombre\": \"Juan Rostro, \"whatsapp\": 4198765432}] }"}
{"ipserver":"172.16.5.134","apitoken":"6abef18c-783d-4dd0-b530-be6e6a7bbd1d","tokencallbell":"g8thcZkXGd3xBj2g3TtYNYFMH1fuesbJ.b6a940ea7d78cf6c9e42f067b21c8ddf96e9fa2a9e307bfd0c7c7c4d7fa38f79","tokenstripe":"sk_test_51OkG0REFY1WEUtgRH6UxBK5pu80Aq5Iy8EcdPnf0cOWzuVLQTpyLCd7CbPzqMsWMafZOHElCxhEHF7g8boURjWlJ00tBwE0W1M","unmsApiToken":null,"hostServerFTP":"siip.mx","usernameServerFTP":"siip0001","passServerFTP":"$spGiT,[wa)n","cashPaymentMethodId":false,"courtesyPaymentMethodId":false,"bankTransferPaymentMethodId":true,"paypalPaymentMethodId":true,"creditCardPaypalPaymentMethodId":true,"creditCardStripePaymentMethodId":true,"stripeSubscriptionCreditCardPaymentMethodId":true,"paypalSubscriptionPaymentMethodId":true,"mercadopagoPaymentMethodId":true,"checkPaymentMethodId":true,"customPaymentMethodId":true,"notificationTypeText":false,"installersDataWhatsApp":"{\r\n \"instaladores\": [\r\n {\r\n \"id\": 1019,\r\n \"nombre\": \"Mucio Robledo\",\r\n \"whatsapp\": \"4181878106\"\r\n },\r\n {\r\n \"id\": 1173,\r\n \"nombre\": \"Angel Arvizu\",\r\n \"whatsapp\": \"4181878106\"\r\n },\r\n {\r\n \"id\": 1172,\r\n \"nombre\": \"Juan Rostro\",\r\n \"whatsapp\": \"4181878106\"\r\n },\r\n {\r\n \"id\": 1015,\r\n \"nombre\": \"Daniel Humberto\",\r\n \"whatsapp\": \"4181878106\"\r\n }\r\n ]\r\n}","debugMode":true,"logging_level":true}

18597
data/plugin.log Normal file → Executable file

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@ require 'vendor/autoload.php';
$plugin->run();
// cleanup plugin log
$container->get(\SmsNotifier\Service\LogCleaner::class)->clean();
//$container->get(\SmsNotifier\Service\LogCleaner::class)->clean();
} catch (Exception $e) {
$logger = new \SmsNotifier\Service\Logger();
$logger->error($e->getMessage());

View File

@ -2,10 +2,10 @@
"version": "1",
"information": {
"name": "siip-whatsapp-notifications",
"displayName": "SIIP - Procesador de Pagos en línea con Stripe, Sincronizador de CallBell y Envío de Notificaciones y comprobantes vía WhatsApp",
"description": "Este plugin sincroniza los clientes del sitema UISP CRM con los contactos de WhatsApp en CallBell, además procesa pagos de Stripe como las trasferencias bancarias y genera referencias de pago vía OXXO, además envía comprobantes de pago en formato imagen PNG vía Whatsapp a los clientes",
"displayName": "SIIP - Procesador de Pagos en línea con Stripe, Oxxo y Transferencia, Sincronizador de CallBell y Envío de Notificaciones y comprobantes vía WhatsApp",
"description": "Este plugin sincroniza los clientes del sistema UISP CRM con los contactos de WhatsApp en CallBell, además procesa pagos de Stripe como las trasferencias bancarias y genera referencias de pago vía OXXO, además envía comprobantes de pago en formato imagen PNG o texto vía Whatsapp a los clientes",
"url": "https://siip.mx/",
"version": "2.4.7",
"version": "2.7.0",
"unmsVersionCompliancy": {
"min": "2.1.0",
"max": null
@ -154,10 +154,11 @@
"type": "checkbox"
},
{
"key": "dataInstallersWhatsApp",
"key": "installersDataWhatsApp",
"label": "Datos de los instaladores en formato JSON",
"description": "El número identificador (id) del instalador se obtiene desde la API del CRM en su ednpoint \"/api/v1.0/user\" y se debe de obtener el campo 'id' de cada instalador para agregarlo en este campo en formato JSON",
"required": 1,
"type": "text"
"type": "textarea"
},
{
"key": "debugMode",

Binary file not shown.

View File

@ -10,6 +10,9 @@ use SmsNotifier\Service\Logger;
use SmsNotifier\Service\SmsNumberProvider;
use Twilio\Exceptions\HttpException;
use SmsNotifier\Facade\ClientCallBellAPI;
use GuzzleHttp\Client;
use Ubnt\UcrmPluginSdk\Service\UcrmApi;
use \DateTime;
/*
@ -33,12 +36,24 @@ abstract class AbstractMessageNotifierFacade
*/
protected $clientPhoneNumber;
/**
* @var PluginNotifierFacade
*/
private $pluginNotifierFacade;
/**
* @var UcrmApi
*/
protected $ucrmApi;
const SUBJECT_OF_INSTALLER_CHANGE = ["se ha cancelado una tarea que tenías asignada con el folio ", "se te ha desasignado la tarea con el folio "];
const ADDITIONAL_CHANGE_DATA = ["Ya no es necesario realizar la visita técnica.", "En tu lugar asistirá el técnico"];
public function __construct(
Logger $logger,
MessageTextFactory $messageTextFactory,
SmsNumberProvider $clientPhoneNumber
SmsNumberProvider $clientPhoneNumber,
) {
$this->logger = $logger;
$this->messageTextFactory = $messageTextFactory;
@ -54,28 +69,56 @@ abstract class AbstractMessageNotifierFacade
//$this->logger->debug(print_r(json_encode($notificationData),true).PHP_EOL);
$arrayPhones = $this->clientPhoneNumber->getUcrmClientNumbers($notificationData);
// Obtener los números de teléfono de los contactos
$arrayPhones = $this->clientPhoneNumber->getUcrmClientNumbers($notificationData, null);
// Imprimir el array de teléfonos
$this->logger->info(json_encode($arrayPhones));
// Procesar el array de teléfonos y ejecutar la función correspondiente
foreach ($arrayPhones as $type => $phones) {
foreach ($arrayPhones as $type => $phone) {
// Registrar el tipo de contacto antes de la normalización para verificar qué valor se recibe
$this->logger->info("Procesando tipo de contacto original: '$type'");
switch ($type) {
case 'WhatsApp':
$this->notifyAndUpdate($notificationData, $phone); // Ejecuta función de Notificar y Actualizar
break;
case 'WhatsNotifica':
$this->notify($notificationData, $phone); // Ejecuta función de Notificar
break;
case 'WhatsActualiza':
$this->onlyUpdate($notificationData, $phone); // Ejecuta función de Actualizar
break;
default:
$this->logger->info("Tipo de contacto no reconocido: $type" . PHP_EOL);
break;
// Normalizar el tipo para manejar posibles diferencias en las mayúsculas o espacios en blanco
$type = trim(strtolower($type));
// Registrar el tipo de contacto después de la normalización
$this->logger->info("Tipo de contacto normalizado: '$type'");
// Asegurarse de que $phones es un array y recorrerlo
if (is_array($phones)) {
foreach ($phones as $phone) {
switch ($type) {
case 'whatsapp':
// Ejecutar función de notificación y actualización
$this->notifyAndUpdate($notificationData, $phone);
break;
case 'whatsnotifica':
// Ejecutar función de notificación
$this->notify($notificationData, $phone);
break;
case 'whatsactualiza':
// Ejecutar función de actualización
$this->onlyUpdate($notificationData, $phone, false);
break;
default:
// Registrar cuando el tipo no es reconocido
$this->logger->info("Tipo de contacto no reconocido: '$type'" . PHP_EOL);
break;
}
}
} else {
$this->logger->info("Formato no esperado para los números de teléfono en el tipo: $type" . PHP_EOL);
}
}
}
/*
@ -83,24 +126,47 @@ abstract class AbstractMessageNotifierFacade
*/
public function verifyClientActionToDo(NotificationData $notificationData): void
{
//$this->logger->debug("Verificar contactos" . PHP_EOL);
$this->logger->debug(print_r(json_encode($notificationData), true) . PHP_EOL);
$arrayPhones = $this->clientPhoneNumber->getUcrmClientNumbers($notificationData, null);
//$this->logger->debug(print_r(json_encode($notificationData),true).PHP_EOL);
$arrayPhones = $this->clientPhoneNumber->getUcrmClientNumbers($notificationData);
// Procesar el array de teléfonos y ejecutar la función correspondiente
foreach ($arrayPhones as $type => $phones) {
foreach ($arrayPhones as $type => $phone) {
// Registrar el tipo de contacto antes de la normalización para verificar qué valor se recibe
$this->logger->info("Procesando tipo de contacto original: '$type'");
switch ($type) {
case 'WhatsApp':
$this->onlyUpdate($notificationData, $phone); // Ejecuta función de Notificar y Actualizar
break;
case 'WhatsActualiza':
$this->onlyUpdate($notificationData, $phone); // Ejecuta función de Actualizar
break;
default:
$this->logger->info("Tipo de contacto no reconocido: $type" . PHP_EOL);
break;
// Normalizar el tipo para manejar posibles diferencias en las mayúsculas o espacios en blanco
$type = trim(strtolower($type));
// Registrar el tipo de contacto después de la normalización
$this->logger->info("Tipo de contacto normalizado: '$type'");
// Asegurarse de que $phones es un array y recorrerlo
if (is_array($phones)) {
foreach ($phones as $phone) {
switch ($type) {
case 'whatsapp':
// Ejecutar función de notificación y actualización
$this->onlyUpdate($notificationData, $phone);
break;
case 'whatsactualiza':
// Ejecutar función de actualización
$this->onlyUpdate($notificationData, $phone);
break;
default:
// Registrar cuando el tipo no es reconocido
$this->logger->info("Tipo de contacto no reconocido: '$type'" . PHP_EOL);
break;
}
}
} else {
$this->logger->info("Formato no esperado para los números de teléfono en el tipo: $type" . PHP_EOL);
}
}
@ -114,18 +180,281 @@ abstract class AbstractMessageNotifierFacade
//$this->logger->debug(print_r(json_encode($notificationData),true).PHP_EOL);
$arrayPhones = $this->clientPhoneNumber->getUcrmClientNumbers($notificationData);
// Procesar el array de teléfonos y ejecutar la función correspondiente
$arrayPhones = $this->clientPhoneNumber->getUcrmClientNumbers($notificationData, null);
foreach ($arrayPhones as $type => $phone) {
// Procesar el array de teléfonos y ejecutar la función correspondiente
foreach ($arrayPhones as $type => $phones) {
// Registrar el tipo de contacto antes de la normalización para verificar qué valor se recibe
$this->logger->info("Procesando tipo de contacto original: '$type'");
// Normalizar el tipo para manejar posibles diferencias en las mayúsculas o espacios en blanco
$type = trim(strtolower($type));
// Registrar el tipo de contacto después de la normalización
$this->logger->info("Tipo de contacto normalizado: '$type'");
// Asegurarse de que $phones es un array y recorrerlo
if (is_array($phones)) {
foreach ($phones as $phone) {
switch ($type) {
case 'whatsapp':
// Ejecutar función de notificación y actualización
$this->onlyUpdateService($notificationData, $phone);
break;
case 'whatsactualiza':
// Ejecutar función de actualización
$this->onlyUpdateService($notificationData, $phone);
break;
default:
// Registrar cuando el tipo no es reconocido
$this->logger->info("Tipo de contacto no reconocido: '$type'" . PHP_EOL);
break;
}
}
} else {
$this->logger->info("Formato no esperado para los números de teléfono en el tipo: $type" . PHP_EOL);
}
}
}
/*
* Verify contact type numbers to do client's
*/
public function verifyJobActionToDo($jsonNotificationData, $reprogramming = false, $changeInstaller = false): void
{
$this->logger->debug('Valor de $jsonNotificationData en verifyJobActionToDo: ' . json_encode($jsonNotificationData) . PHP_EOL);
$clientId = $jsonNotificationData['extraData']['entity']['clientId'];
$installerId = $jsonNotificationData['extraData']['entity']['assignedUserId'];
$jobId = $jsonNotificationData['entityId'];
$jobDescription = $jsonNotificationData['extraData']['entity']['description'] ?? null;
$this->logger->debug('Valor de $clientId en verifyJobActionToDo: ' . $clientId . PHP_EOL);
$this->logger->debug('Valor de $installerId en verifyJobActionToDo: ' . $installerId . PHP_EOL);
$this->logger->debug('Valor de $jobId en verifyJobActionToDo: ' . $jobId . PHP_EOL);
// Obtener la fecha del nodo "entity"
$dateString = $jsonNotificationData['extraData']['entity']['date'] ?? null;
if ($dateString) {
// Crear un objeto DateTime a partir de la fecha
$date = new DateTime($dateString);
// Formatear la fecha al formato deseado: día/mes/año a las hora:minuto am/pm aproximadamente
$formattedDate = $date->format('d/m/Y') . " a las " . $date->format('h:i A') . " aproximadamente";
echo $formattedDate;
} else {
echo "La fecha no está disponible en el JSON.\n";
}
$configManager = \Ubnt\UcrmPluginSdk\Service\PluginConfigManager::create();
$config = $configManager->loadConfig();
$IPServer = $config['ipserver'];
$UCRMAPIToken = $config['apitoken'];
$CallBellAPIToken = $config['tokencallbell'];
$IPServer = $config['ipserver'];
$installersData = $config['installersDataWhatsApp'];
$this->logger->debug('Valor de $installersData en verifyJobActionToDo: ' . $installersData . PHP_EOL);
$this->ucrmApi = UcrmApi::create();
$usersInstallers = $this->ucrmApi->get('users/admins/' . $installerId, []);
$this->logger->debug('Valor de $usersInstallers en verifyJobActionToDo: ' . json_encode($usersInstallers) . PHP_EOL);
// Inicializar la variable para el nombre completo
$installerFullName = '';
$jsonInstallersData = json_decode($installersData, true);
if (json_last_error() !== JSON_ERROR_NONE) {
$this->logger->error('Error al decodificar el JSON de instaladores: ' . json_last_error_msg());
return;
}
// Verificar si el nodo "instaladores" existe
if (!isset($jsonInstallersData['instaladores'])) {
$this->logger->error('El nodo "instaladores" no existe en el JSON');
return;
}
// Buscar el número de WhatsApp en el JSON
$installerWhatsApp = '';
foreach ($jsonInstallersData['instaladores'] as $installer) {
if ($installer['id'] === $installerId) {
$installerWhatsApp = $installer['whatsapp'];
break;
}
}
//$this->logger->debug('tipo de dato de installerWhatsApp: ' . gettype($installerWhatsApp) . PHP_EOL);
// Validar si se encontró el WhatsApp
if (empty($installerWhatsApp)) {
$this->logger->warning('No se encontró un número de WhatsApp para el instalador con ID 1019');
} else {
$this->logger->debug('Número de WhatsApp del Instalador: ' . $installerWhatsApp . PHP_EOL);
}
$this->ucrmApi = UcrmApi::create();
$usersInstallers = $this->ucrmApi->get('users/admins/' . $installerId, []);
//$this->logger->debug('Valor de $usersInstallers ' . json_encode($usersInstallers) . PHP_EOL);
$firstName = $usersInstallers['firstName'] ?? '';
$lastName = $usersInstallers['lastName'] ?? '';
$installerFullName = trim("$firstName $lastName");
$this->logger->debug('Valor de $installerFullName: ' . $installerFullName . PHP_EOL);
$baseUri = 'https://' . $IPServer . '/crm/api/v1.0/';
$clientGuzzleHttp = new Client([
'base_uri' => $baseUri,
'headers' => [
'X-Auth-App-Key' => $UCRMAPIToken,
'Accept' => 'application/json',
],
'verify' => false,
]);
$response = $clientGuzzleHttp->request('GET', "clients/" . $clientId);
$arrayClientCRM = json_decode($response->getBody()->getContents(), true);
$this->logger->debug('Valor de $arrayClientCRM en verifyJobActionToDo: ' . json_encode($arrayClientCRM) . PHP_EOL);
$clientFullName = sprintf("%s %s", $arrayClientCRM['firstName'], $arrayClientCRM['lastName']);
// Extraer la dirección completa
$fullAddress = $arrayClientCRM['fullAddress'] ?? null;
// Validar si la dirección completa está disponible
if ($fullAddress) {
// Convertir la dirección a HTML seguro
$safeAddress = htmlspecialchars($fullAddress, ENT_QUOTES, 'UTF-8');
$this->logger->debug('Dirección completa: ' . $safeAddress . PHP_EOL);
} else {
$this->logger->error('La dirección completa no está disponible en el JSON' . PHP_EOL);
}
// Extraer las coordenadas del nodo "entity"
$gpsLat = $arrayClientCRM['addressGpsLat'] ?? null;
$gpsLon = $arrayClientCRM['addressGpsLon'] ?? null;
// Validar si las coordenadas están disponibles
if ($gpsLat && $gpsLon) {
// Construir la URL de Google Maps
$googleMapsUrl = sprintf('https://www.google.com/maps?q=%s,%s', $gpsLat, $gpsLon);
$this->logger->debug('URL de Google Maps: ' . $googleMapsUrl . PHP_EOL);
} else {
$this->logger->error('Las coordenadas no están disponibles en el JSON' . PHP_EOL);
}
$arrayPhones = $this->clientPhoneNumber->getUcrmClientNumbers(null, $arrayClientCRM);
$this->logger->debug('Valor de $arrayPhones en verifyJobActionToDo: ' . json_encode($arrayPhones) . PHP_EOL);
$arrayAllPhones = $this->clientPhoneNumber->getAllUcrmClientNumbers($arrayClientCRM);
// Convertir el array de teléfonos en una cadena separada por comas
$clientAllPhonesString = implode(',', $arrayAllPhones);
$this->logger->debug('Valor de $clientAllPhonesString en verifyJobActionToDo: ' . $clientAllPhonesString . PHP_EOL);
// Dividir los números en un array
$arrayNumeros = explode(',', $clientAllPhonesString);
$this->logger->debug('Valor de $arrayNumeros en verifyJobActionToDo: ' . json_encode($arrayNumeros) . PHP_EOL);
// Procesar cada número
$resultados = [];
foreach ($arrayNumeros as $numero) {
// Limpiar espacios alrededor de cada número
$numero = trim($numero);
// Validar el número
$numeroValidado = $this->validarNumeroTelefono($numero);
// Remover el prefijo 521 si está presente y tiene 12 dígitos
if (substr($numeroValidado, 0, 3) === "521" && strlen($numeroValidado) === 12) {
$resultados[] = substr($numeroValidado, 3); // Remover "521"
} else {
$resultados[] = $numeroValidado; // Mantener el número sin cambios
}
}
$this->logger->debug('Valor de $resultados en verifyJobActionToDo: ' . json_encode($resultados) . PHP_EOL);
// Convertir el array de resultados en una cadena separada por comas
$resultadoFinalNumerosCliente = implode(', ', $resultados);
$this->logger->debug('Valor de $resultadoFinalNumerosCliente en verifyJobActionToDo: ' . $resultadoFinalNumerosCliente . PHP_EOL);
$client_callbell_api = new ClientCallBellAPI($UCRMAPIToken, $IPServer, $CallBellAPIToken);
// Construir el array asociativo con los datos de la notificación para el cliente
$jsonClientJobNotificationData = [
"clientFullName" => $clientFullName,
"jobId" => $jobId,
"date" => $formattedDate,
"installerName" => $installerFullName
];
$clientWhatsApp = '';
// Procesar el array de teléfonos y ejecutar la función correspondiente
foreach ($arrayPhones as $type => $phones) {
// Normalizar el tipo para manejar posibles diferencias en las mayúsculas o espacios en blanco
$type = trim(strtolower($type));
switch ($type) {
case 'WhatsApp':
$this->onlyUpdateService($notificationData, $phone); // Ejecuta función de Notificar y Actualizar
break;
case 'WhatsActualiza':
$this->onlyUpdateService($notificationData, $phone); // Ejecuta función de Actualizar
case 'whatsapp':
case 'whatsnotifica':
$this->logger->debug("Se encontró un tipo de contacto $type" . PHP_EOL);
// Verificar si el valor es un array de teléfonos
if (is_array($phones)) {
foreach ($phones as $phone) {
$attempts = 0;
$maxAttempts = 3;
$result = false;
// Reintentar hasta 3 veces si la función retorna false
while ($attempts < $maxAttempts && $result === false) {
$attempts++;
$result = $client_callbell_api->sendJobNotificationWhatsAppToClient(
$this->validarNumeroTelefono($phone), // Validar número de teléfono
$jsonClientJobNotificationData, // Datos de notificación
$reprogramming, // Reprogramación
$changeInstaller // Cambio de instalador
);
if ($result === false) {
sleep(1); // Esperar 1 segundo antes de reintentar
$this->logger->warning("Intento $attempts fallido para enviar notificación a $phone. Reintentando..." . PHP_EOL);
}
}
// Verificar el resultado final
if ($result === true) {
$this->logger->info("Notificación enviada correctamente al contacto $phone después de $attempts intento(s)." . PHP_EOL);
} else {
$this->logger->error("No se pudo enviar la notificación al contacto $phone después de $maxAttempts intentos." . PHP_EOL);
}
}
} else {
$this->logger->warning("No se encontraron números de teléfono para el tipo de contacto $type." . PHP_EOL);
}
break;
default:
$this->logger->info("Tipo de contacto no reconocido: $type" . PHP_EOL);
break;
@ -133,36 +462,201 @@ abstract class AbstractMessageNotifierFacade
}
}
//$installerWhatsApp = $this->validarNumeroTelefono((string)$installerWhatsApp); //Obtiene el número de celular del cliente que sea del tipo de contacto "WhatsApp"
$this->logger->debug('Valor de $installerWhatsApp en verifyJobActionToDo: ' . $installerWhatsApp . PHP_EOL);
if ($changeInstaller) { //Si se cambió el instalador
$this->logger->debug('Se cambió el instalador, por lo tanto se procede a enviarle mensaje al que se le desasignó' . PHP_EOL);
// Construir el array asociativo con los datos de la notificación
//Enviar notificación al instalador anterior
$previousinstallerInstallerId = $installerId = $jsonNotificationData['extraData']['entityBeforeEdit']['assignedUserId'];
$usersInstallers = $this->ucrmApi->get('users/admins/' . $previousinstallerInstallerId, []);
$firstNamePreviousInstaller = $usersInstallers['firstName'] ?? ''; //Obtener el nombre del instalador anterior
$lastNamePreviousInstaller = $usersInstallers['lastName'] ?? ''; //Obtener el apellido del instalador anterior
$previousInstallerFullName = trim("$firstNamePreviousInstaller $lastNamePreviousInstaller");
$attempts = 0;
$maxAttempts = 3;
$result = false;
$jsonPreviousInstallerJobNotificationData = [
"installerName" => $previousInstallerFullName,
"subjectOfChange" => self::SUBJECT_OF_INSTALLER_CHANGE[1],
"jobId" => $jobId,
"clientFullName" => sprintf("[%s] %s", $arrayClientCRM['id'], $clientFullName),
"additionalChangeData" => self::ADDITIONAL_CHANGE_DATA[1] . ' *' . $installerFullName . '*'
];
// Buscar el número de WhatsApp en el JSON del instalador anterior
$previousInstallerWhatsApp = '';
foreach ($jsonInstallersData['instaladores'] as $installer) {
if ($installer['id'] === $previousinstallerInstallerId) {
$previousInstallerWhatsApp = $installer['whatsapp'];
$this->logger->debug('Se encontró el Whatsapp del instalador anterior en el JSON y es: ' . $previousInstallerWhatsApp . PHP_EOL);
break;
}
}
// Reintentar hasta 3 veces si la función retorna false
while ($attempts < $maxAttempts && $result === false) {
$attempts++;
$result = $client_callbell_api->sendJobNotificationWhatsAppToInstaller(
$this->validarNumeroTelefono((string) $previousInstallerWhatsApp),
$jsonPreviousInstallerJobNotificationData,
false,
true
);
if ($result === false) {
sleep(1);
$this->logger->warning("Intento $attempts fallido para enviar notificación a $phone. Reintentando..." . PHP_EOL);
}
}
sleep(4);
// Construir el array asociativo con los datos de la notificación para el instalador nuevo
$jsonInstallerJobNotificationData = [
"installerName" => $installerFullName,
"clientFullName" => sprintf("[%s] %s", $arrayClientCRM['id'], $clientFullName),
"jobId" => $jobId,
"clientAddress" => $safeAddress,
"clientWhatsApp" => $resultadoFinalNumerosCliente,
"date" => $formattedDate,
"jobDescription" => $jobDescription,
"gmapsLocation" => $googleMapsUrl
];
//Enviar notificación al instalador nuevo
$attempts = 0;
$maxAttempts = 3;
$result = false;
// Reintentar hasta 3 veces si la función retorna false
while ($attempts < $maxAttempts && $result === false) {
$attempts++;
$result = $client_callbell_api->sendJobNotificationWhatsAppToInstaller(
$this->validarNumeroTelefono((string) $installerWhatsApp),
$jsonInstallerJobNotificationData,
$reprogramming,
false
);
if ($result === false) {
sleep(1);
$this->logger->warning("Intento $attempts fallido para enviar notificación a $phone. Reintentando..." . PHP_EOL);
}
}
} else {
// Construir el array asociativo con los datos de la notificación
$jsonInstallerJobNotificationData = [
"installerName" => $installerFullName,
"clientFullName" => sprintf("[%s] %s", $arrayClientCRM['id'], $clientFullName),
"jobId" => $jobId,
"clientAddress" => $safeAddress,
"clientWhatsApp" => $resultadoFinalNumerosCliente,
"date" => $formattedDate,
"jobDescription" => $jobDescription,
"gmapsLocation" => $googleMapsUrl
];
$attempts = 0;
$maxAttempts = 3;
$result = false;
// Reintentar hasta 3 veces si la función retorna false
while ($attempts < $maxAttempts && $result === false) {
$attempts++;
$result = $client_callbell_api->sendJobNotificationWhatsAppToInstaller(
$this->validarNumeroTelefono((string) $installerWhatsApp),
$jsonInstallerJobNotificationData,
$reprogramming,
$changeInstaller
);
if ($result === false) {
sleep(1);
$this->logger->warning("Intento $attempts fallido para enviar notificación a $phone. Reintentando..." . PHP_EOL);
}
}
}
}
/*
* Verify contact type numbers to do client's data update at CallBell by invoice add or edit
*/
public function verifyInvoiceActionToDo(NotificationData $notificationData): void
{
$accountBalance = $notificationData->clientData['accountBalance'];
$this->logger->debug(print_r(json_encode($notificationData), true) . PHP_EOL);
$arrayPhones = $this->clientPhoneNumber->getUcrmClientNumbers($notificationData);
$arrayPhones = $this->clientPhoneNumber->getUcrmClientNumbers($notificationData, null);
// Procesar el array de teléfonos y ejecutar la función correspondiente
foreach ($arrayPhones as $type => $phones) {
foreach ($arrayPhones as $type => $phone) {
// Registrar el tipo de contacto antes de la normalización para verificar qué valor se recibe
$this->logger->info("Procesando tipo de contacto original: '$type'");
switch ($type) {
case 'WhatsApp':
$this->onlyUpdate($notificationData, $phone); // Ejecuta función de Notificar y Actualizar
break;
case 'WhatsActualiza':
$this->onlyUpdate($notificationData, $phone); // Ejecuta función de Actualizar
break;
default:
$this->logger->info("Tipo de contacto no reconocido: $type" . PHP_EOL);
break;
// Normalizar el tipo para manejar posibles diferencias en las mayúsculas o espacios en blanco
$type = trim(strtolower($type));
// Registrar el tipo de contacto después de la normalización
$this->logger->info("Tipo de contacto normalizado: '$type'");
// Asegurarse de que $phones es un array y recorrerlo
if (is_array($phones)) {
foreach ($phones as $phone) {
switch ($type) {
case 'whatsapp':
// Ejec vb bbnbbnbvnutar función de notificación y actualización
$this->onlyUpdate($notificationData, $phone, false);
break;
case 'whatsactualiza':
// Ejecutar función de actualización
$this->onlyUpdate($notificationData, $phone, false);
break;
default:
// Registrar cuando el tipo no es reconocido
$this->logger->info("Tipo de contacto no reconocido: '$type'" . PHP_EOL);
break;
}
}
} else {
$this->logger->info("Formato no esperado para los números de teléfono en el tipo: $type" . PHP_EOL);
}
}
}
/*
@ -200,29 +694,49 @@ abstract class AbstractMessageNotifierFacade
if ($notificationTypeText) {
try {
//$this->logger->debug(sprintf('llego al llamado de sendPaymentNotificationWhatsApp con client_id: %s y número de celular: %s', $notificationData->clientId, $clientPhoneNumber));
//$this->sendMessage($notificationData, $clientSmsNumber, $messageBody);
//$this->sendWhatsApp($notificationData, $clientSmsNumber);
if (!$client_callbell_api->sendTextPaymentNotificationWhatsApp($clientPhoneNumber, $notificationData)) {
$this->logger->warning("No se pudo enviar el comprobante para este cliente" . PHP_EOL);
$attempts = 0;
$maxAttempts = 3;
$result = false;
while ($attempts < $maxAttempts && !$result) {
$attempts++;
$result = $client_callbell_api->sendTextPaymentNotificationWhatsApp($clientPhoneNumber, $notificationData);
if (!$result) {
$this->logger->warning("Intento $attempts fallido para enviar notificación de texto al cliente con número $clientPhoneNumber." . PHP_EOL);
}
}
if ($result) {
$this->logger->info("Notificación de texto enviada correctamente al cliente con número $clientPhoneNumber después de $attempts intento(s)." . PHP_EOL);
} else {
$this->logger->error("No se pudo enviar la notificación de texto al cliente con número $clientPhoneNumber después de $maxAttempts intentos." . PHP_EOL);
}
} catch (HttpException $httpException) {
//$this->logger->debug('Ocurrio un error en el try catch');
$this->logger->error($httpException->getCode() . ' ' . $httpException->getMessage());
}
} else {
try {
//$this->logger->debug(sprintf('llego al llamado de sendPaymentNotificationWhatsApp con client_id: %s y número de celular: %s', $notificationData->clientId, $clientPhoneNumber));
//$this->sendMessage($notificationData, $clientSmsNumber, $messageBody);
//$this->sendWhatsApp($notificationData, $clientSmsNumber);
if (!$client_callbell_api->sendPaymentNotificationWhatsApp($clientPhoneNumber, $notificationData)) {
$this->logger->warning("No se pudo enviar el comprobante para este cliente" . PHP_EOL);
$attempts = 0;
$maxAttempts = 3;
$result = false;
while ($attempts < $maxAttempts && !$result) {
$attempts++;
$result = $client_callbell_api->sendPaymentNotificationWhatsApp($clientPhoneNumber, $notificationData);
if (!$result) {
$this->logger->warning("Intento $attempts fallido para enviar notificación al cliente con número $clientPhoneNumber." . PHP_EOL);
}
}
if ($result) {
$this->logger->info("Notificación enviada correctamente al cliente con número $clientPhoneNumber después de $attempts intento(s)." . PHP_EOL);
} else {
$this->logger->error("No se pudo enviar la notificación al cliente con número $clientPhoneNumber después de $maxAttempts intentos." . PHP_EOL);
}
} catch (HttpException $httpException) {
//$this->logger->debug('Ocurrio un error en el try catch');
$this->logger->error($httpException->getCode() . ' ' . $httpException->getMessage());
}
@ -281,7 +795,7 @@ abstract class AbstractMessageNotifierFacade
//$this->logger->debug(sprintf('llego al llamado de sendPaymentNotificationWhatsApp con client_id: %s y número de celular: %s', $notificationData->clientId, $clientPhoneNumber));
if ($notificationTypeText) {
$this->logger->debug("Activado el check de mensajes de texto: ".$notificationTypeText.PHP_EOL);
$this->logger->debug("Activado el check de mensajes de texto: " . $notificationTypeText . PHP_EOL);
}
if ($notificationTypeText) {
@ -382,7 +896,7 @@ abstract class AbstractMessageNotifierFacade
/*
* Update the client's data at CallBell
*/
public function onlyUpdate(NotificationData $notificationData, $phoneToUpdate = null): void
public function onlyUpdate(NotificationData $notificationData, $phoneToUpdate = null, $updateEmail=false): void
{
//$this->logger->info("Se enviará una actualización a Callbell " . PHP_EOL);
@ -418,30 +932,35 @@ abstract class AbstractMessageNotifierFacade
}
$contacts = $notificationData->clientData['contacts'] ?? []; //Obtener los contactos que tiene el cliente
if ($updateEmail) {
$contacts = $notificationData->clientData['contacts'] ?? []; //Obtener los contactos que tiene el cliente para buscar el email
foreach ($contacts as $contact) {
foreach ($contacts as $contact) {
$types = $contact['types'] ?? []; //Obtener los tipos de contactos del cliente
foreach ($types as $type) {
$types = $contact['types'] ?? []; //Obtener los tipos de contactos del cliente
foreach ($types as $type) {
if ($type['name'] == 'WhatsApp') { //Si el tipo de contacto es Whatsapp
if ($type['name'] == 'WhatsApp') { //Si el tipo de contacto es Whatsapp
$client_email = $contact['email']; //Asignar el correo del cliente a la variable
break;
$client_email = $contact['email']; //Asignar el correo del cliente a la variable
break;
}
}
}
$this->logger->info("Se procesaron los contactos para revisar el o los email" . PHP_EOL);
}
$this->logger->info("Se proceso los contactos " . PHP_EOL);
$stripe = new \Stripe\StripeClient($StripeToken); //Instancia de la clase manejadora de clientes para la API de Stripe
$stripe = new \Stripe\StripeClient($StripeToken); //Instancia de la clase manejadora de clientes para la API de Stripe
if (!empty($client_email)) {
$stripe->customers->update($customerStripeID, ['email' => $client_email]); //Actualiza el correo electrónico del cliente en la plataforma de Stripe en su correspondiente "customer Stripe ID"
if ($client_email !== null && $customerStripeID !== null) {
$this->logger->info("Se actualizara el correo del cliente en Stripe: " . $client_email . PHP_EOL);
$stripe->customers->update($customerStripeID, ['email' => $client_email]); //Actualiza el correo electrónico del cliente en la plataforma de Stripe en su correspondiente "customer Stripe ID"
}
}
$clientPhoneNumber = $this->validarNumeroTelefono($phoneToUpdate); //Obtiene el número de celular del cliente que sea del tipo de contacto "WhatsApp"

View File

@ -37,7 +37,7 @@ abstract class AbstractOxxoOperationsFacade
* @var UcrmApi
*/
protected $ucrmApi;
protected $stripeCustomAttributeID;
protected $clabeInterbancariaBanamexID;
@ -52,162 +52,303 @@ abstract class AbstractOxxoOperationsFacade
}
/*
* Creates a PaymentIntent for OXXO in Stripe for a Customer
*/
public function createOxxoPaymentIntent($event_json):string
* Creates a PaymentIntent for OXXO in Stripe for a Customer
* @param array $event_json
* @param int|null $amount
* @return array
* @throws \GuzzleHttp\Exception\GuzzleException
* @throws \Stripe\Exception\ApiErrorException
* @throws Exception
*/
public function createOxxoPaymentIntent($event_json, $amount = null): array
{
$this->logger->info("Creando referencia del cliente para oxxo: ".PHP_EOL);
//declarar un array asociativo de strings pero no asignarle nada aun
$arrayOxxoPayment = array();
$integerAmount = $amount;
$this->logger->info("Creando referencia del cliente para OXXO: " . PHP_EOL);
$configManager = \Ubnt\UcrmPluginSdk\Service\PluginConfigManager::create();
$config = $configManager->loadConfig();
$StripeToken = $config['tokenstripe'];
$IPServer = $config['ipserver'];
$tokenCRM = $config['apitoken'];
// $this->logger->info("Datos de configuración: ".PHP_EOL);
// $this->logger->info("Stripe token: ".$StripeToken.PHP_EOL);
// $this->logger->info("IP server: ".$IPServer.PHP_EOL);
// $this->logger->info("Token CRM: ".$tokenCRM.PHP_EOL);
$baseUri = 'https://'.$IPServer.'/crm/api/v1.0/'; //endpoint de la API REST del CRM
$stripe = new \Stripe\StripeClient($StripeToken); //Token de clave privada para la API de Stripe
//$stripe = new \Stripe\StripeClient('sk_test_51OkG0REFY1WEUtgRH6UxBK5pu80Aq5Iy8EcdPnf0cOWzuVLQTpyLCd7CbPzqMsWMafZOHElCxhEHF7g8boURjWlJ00tBwE0W1M'); //Token de clave privada para la API de Stripe modo pruebas
$baseUri = 'https://' . $IPServer . '/crm/api/v1.0/';
$this->ucrmApi = UcrmApi::create();
$currentUserAdmin = $this->ucrmApi->get('users/admins',[]);
$clientID = $event_json->client_id;
$currentUserAdmin = $this->ucrmApi->get('users/admins', []);
$clientID = $event_json['client_id'];
$stripeCustomerId = null;
$clientEmail = '';
$clientGuzzleHttp = new Client([
'base_uri' => $baseUri,
'headers' => [
'X-Auth-App-Key' => $tokenCRM,
'Accept' => 'application/json',
],
'verify' => false,
'timeout' => 5, // Timeout de 5 segundos
]);
try {
$clientGuzzleHttp = new Client([
'base_uri' => $baseUri,
'headers' => [
'X-Auth-App-Key' => $tokenCRM, // Cambia el nombre de la cabecera de autorización para el UISP CRM
'Accept' => 'application/json', // Indica que esperamos una respuesta en formato JSON
],
'verify' => false,
]);
// Hacer la solicitud GET para obtener los datos del cliente
$response = $clientGuzzleHttp->request('GET', "clients/".$clientID);
// Obtener el cuerpo de la respuesta como JSON
$response = $clientGuzzleHttp->request('GET', "clients/" . $clientID);
$arrayClientCRM = json_decode($response->getBody()->getContents(), true);
// Inicializamos una variable para guardar el valor del 'stripeCustomerId'
$stripeCustomerId = null;
$clientEmail = '';
// Recorrer los atributos para encontrar el 'stripeCustomerId'
//$this->logger->info("Valor de arrayClientCRM: " . print_r($arrayClientCRM, true) . PHP_EOL);
$clientFullName = $arrayClientCRM['firstName'] . ' ' . $arrayClientCRM['lastName'];
} catch (RequestException $e) {
if ($e->getCode() === 404) {
$this->logger->error("Cliente no encontrado en CRM: " . $clientID . PHP_EOL);
//devolver un array con los campos del codigo error, descripción de la falla, clientID, clientFullName y amount
$arrayOxxoPayment['oxxo_reference'] = '';
$arrayOxxoPayment['url'] = '';
$arrayOxxoPayment['error'] = 'errorGetClientNotFound';
$arrayOxxoPayment['failDescription'] = 'Cliente no encontrado en CRM: ' . $clientID;
$arrayOxxoPayment['clientID'] = $clientID;
$arrayOxxoPayment['clientFullName'] = $clientFullName;
$arrayOxxoPayment['amount'] = $integerAmount;
return $arrayOxxoPayment;
}
//timeout
if ($e->getCode() === 408) {
$this->logger->error("Timeout al obtener el cliente en CRM: " . $clientID . PHP_EOL);
//devolver un array con los campos del codigo error, descripción de la falla, clientID y amount
$arrayOxxoPayment['oxxo_reference'] = '';
$arrayOxxoPayment['error'] = 'errorTimeoutGetClient';
$arrayOxxoPayment['failDescription'] = 'Timeout al obtener el cliente en CRM: ' . $clientID;
$arrayOxxoPayment['clientID'] = $clientID;
$arrayOxxoPayment['clientFullName'] = $clientFullName;
$arrayOxxoPayment['amount'] = $integerAmount;
return $arrayOxxoPayment;
}
$this->logger->error("Error al obtener el cliente en CRM (Error {$e->getCode()}): " . $e->getMessage() . PHP_EOL);
//devolver un array con los campos del codigo error, descripción de la falla, clientID y amount
$arrayOxxoPayment['oxxo_reference'] = '';
$arrayOxxoPayment['error'] = 'errorGetClient';
$arrayOxxoPayment['failDescription'] = 'Error al obtener el cliente en CRM: ' . $clientID;
$arrayOxxoPayment['clientID'] = $clientID;
$arrayOxxoPayment['clientFullName'] = $clientFullName;
$arrayOxxoPayment['amount'] = $integerAmount;
return $arrayOxxoPayment;
}
// Obtener email del cliente
foreach ($arrayClientCRM['contacts'] as $contact) {
if (!empty($contact['email'])) {
$clientEmail = $contact['email'];
break;
} else {
$clientEmail = 'siip8873@gmail.com'; // Default
}
}
try {
// Obtener stripeCustomerId
foreach ($arrayClientCRM['attributes'] as $attribute) {
if ($attribute['key'] === 'stripeCustomerId') {
$stripeCustomerId = $attribute['value'];
break;
}
}
// Recorrer los contactos
foreach ($arrayClientCRM['contacts'] as $contact) {
if ($contact['email'] != '') {
$clientEmail = $contact['email'];
break;
}else{
$clientEmail = 'siip8873@gmail.com';
break;
}
}
$this->logger->info("Se obtuvieron los datos del cliente y Stripe Customer ID: ".$stripeCustomerId.PHP_EOL);
} catch (RequestException $e) {
// Manejo de errores en la petición
$this->logger->error("Error al obtener atributos personalizados del cliente: " . $e->getMessage().PHP_EOL);
$this->logger->info("Stripe Customer ID obtenido: " . $stripeCustomerId . PHP_EOL);
} catch (Exception $e) {
$this->logger->error("Error al obtener el Customer ID de Stripe (Error {$e->getCode()}): " . $e->getMessage() . PHP_EOL);
//devolver un array con los campos del codigo error, descripción de la falla, clientID y amount
$arrayOxxoPayment['oxxo_reference'] = '';
$arrayOxxoPayment['error'] = 'errorGetCustomerStripe';
$arrayOxxoPayment['failDescription'] = 'Error al obtener el Customer ID de Stripe: ' . $clientID;
$arrayOxxoPayment['clientID'] = $clientID;
$arrayOxxoPayment['clientFullName'] = $clientFullName;
$arrayOxxoPayment['amount'] = $integerAmount;
return $arrayOxxoPayment;
}
$amount = abs($arrayClientCRM['accountOutstanding']) * 100;
//$this->logger->info("User Admin ID: " . json_encode($currentUserAdmin) . PHP_EOL);
if($amount>0){
if ($amount === null) {
$amount = abs($arrayClientCRM['accountOutstanding']);
} else {
$this->logger->info("Monto proporcionado directamente: $amount " . PHP_EOL);
}
if ($amount > 10) {
$amount = intval($amount * 100);
try {
// Crear el PaymentIntent vinculado al cliente
$paymentIntent = $stripe->paymentIntents->create([
'amount' => $amount, // Monto en centavos (300 MXN)
'currency' => 'mxn',
'payment_method_types' => ['customer_balance', 'card' ,'oxxo'],
'description' => 'Pago de servicio de SIIP Internet',
'customer' => $stripeCustomerId, // Vincular al cliente existente
'metadata' => [
'clientId' => $clientID, // ID del cliente en UISP
'createdBy' => 'UCRM',
'paymentType' => 'card.one_time',
'signedInAdminId' => $currentUserAdmin[0]['id']
],
'payment_method_options' => [
'oxxo' => [
'expires_after_days' => 3, // El voucher expira en 3 días
$this->logger->info("Creando referencia en Stripe por $amount para el cliente $stripeCustomerId" . PHP_EOL);
$guzzleClient = new Client([
'timeout' => 5,
]);
$response = $guzzleClient->post('https://api.stripe.com/v1/payment_intents', [
'auth' => [$StripeToken, ''],
'form_params' => [
'amount' => $amount,
'currency' => 'mxn',
'payment_method_types' => ['customer_balance', 'card', 'oxxo'],
'description' => 'Pago de servicio de SIIP Internet',
'customer' => $stripeCustomerId,
'metadata' => [
'clientId' => $clientID,
'createdBy' => 'UCRM',
'paymentType' => 'card.one_time',
'signedInAdminId' => $currentUserAdmin[1]['id'],
'tipoPago' => 'OXXO',
],
],
'payment_method_options' => [
'oxxo' => [
'expires_after_days' => 3,
],
],
]
]);
// Crear un método de pago OXXO con detalles de facturación
$paymentMethod = $stripe->paymentMethods->create([
'type' => 'oxxo',
'billing_details' => [
'name' => $arrayClientCRM['firstName'].' '.$arrayClientCRM['lastName'], // Proporciona el nombre del cliente
'email' => $clientEmail, // Proporciona el correo del cliente
],
]);
// Confirmar el PaymentIntent con el método de pago OXXO
$paymentIntent = $stripe->paymentIntents->confirm(
$paymentIntent->id,
['payment_method' => $paymentMethod->id]
);
// Verificar si hay acciones pendientes (next_action)
if (!empty($paymentIntent->next_action) && isset($paymentIntent->next_action->oxxo_display_details)) {
$oxxoPayment = $paymentIntent->next_action->oxxo_display_details;
//print_r($oxxoPayment);
// Obtener la referencia OXXO y la URL del recibo
$oxxo_reference = $oxxoPayment->number;
$oxxo_receipt_url = $oxxoPayment->hosted_voucher_url;
// Mostrar la referencia y la URL del recibo al cliente
$this->logger->info("Referencia OXXO: " . $oxxo_reference.PHP_EOL);
$this->logger->info("URL del recibo: " . $oxxo_receipt_url.PHP_EOL);
return $oxxo_receipt_url;
// echo "Referencia OXXO: " . $oxxo_reference . "\n";
// echo "URL del recibo: " . $oxxo_receipt_url . "\n";
} else {
// Manejo de error si no hay detalles de OXXO
// echo "El PaymentIntent no tiene detalles de OXXO disponibles aún.\n";
// echo "Estado actual del PaymentIntent: " . $paymentIntent->status . "\n";
$this->logger->info("El PaymentIntent no tiene detalles de OXXO disponibles aún. " .PHP_EOL);
$this->logger->info("Estado actual del PaymentIntent: " . $paymentIntent->status.PHP_EOL);
return 'error';
}
$paymentIntent = json_decode($response->getBody()->getContents(), true);
} catch (\Stripe\Exception\ApiConnectionException $e) {
$this->logger->error("Error de conexión con Stripe (Error {$e->getCode()}): " . $e->getMessage() . PHP_EOL);
//devolver un array con los campos del codigo error, descripción de la falla, clientID y amount
$arrayOxxoPayment['oxxo_reference'] = '';
$arrayOxxoPayment['url'] = '';
$arrayOxxoPayment['error'] = 'errorConnectionStripe';
$arrayOxxoPayment['failDescription'] = 'Error de conexión con Stripe: ' . $clientID;
$arrayOxxoPayment['clientID'] = $clientID;
$arrayOxxoPayment['clientFullName'] = $clientFullName;
$arrayOxxoPayment['amount'] = $integerAmount;
return $arrayOxxoPayment;
} catch (\Stripe\Exception\ApiErrorException $e) {
$this->logger->error("Error de la API de Stripe: " . $e->getMessage() . PHP_EOL);
//devolver un array con los campos del codigo error, descripción de la falla, clientID y amount
$arrayOxxoPayment['oxxo_reference'] = '';
$arrayOxxoPayment['url'] = '';
$arrayOxxoPayment['error'] = 'errorApiStripe';
$arrayOxxoPayment['failDescription'] = 'Error de la API de Stripe: ' . $clientID;
$arrayOxxoPayment['clientID'] = $clientID;
$arrayOxxoPayment['clientFullName'] = $clientFullName;
$arrayOxxoPayment['amount'] = $integerAmount;
return $arrayOxxoPayment;
} catch (Exception $e) {
// Manejar cualquier error
//echo 'Error: ' . $e->getMessage();
$this->logger->error('Error al crear el payment intent: ' . $e->getMessage().PHP_EOL);
return 'error';
$this->logger->error("Error inesperado al crear PaymentIntent (Error {$e->getCode()}): " . $e->getMessage() . PHP_EOL);
//devolver un array con los campos del codigo error, descripción de la falla, clientID y amount
$arrayOxxoPayment['oxxo_reference'] = '';
$arrayOxxoPayment['url'] = '';
$arrayOxxoPayment['error'] = 'errorCreatePaymentIntent';
$arrayOxxoPayment['failDescription'] = 'Error inesperado al crear PaymentIntent: ' . $clientID;
$arrayOxxoPayment['clientID'] = $clientID;
$arrayOxxoPayment['amount'] = $integerAmount;
$arrayOxxoPayment['clientFullName'] = $clientFullName;
return $arrayOxxoPayment;
}
}else{
$this->logger->info("Este cliente no tiene adeudos por lo tanto no se puede genear su referencia de oxxo. " .PHP_EOL);
return 'errorsinadeudo';
try {
$firstName = isset($arrayClientCRM['firstName']) ? trim($arrayClientCRM['firstName']) : '';
$lastName = isset($arrayClientCRM['lastName']) ? trim($arrayClientCRM['lastName']) : '';
if (strlen($firstName) < 2 || strlen($lastName) < 2) {
$this->logger->error("Nombre/apellido inválido: ' . $firstName . ' ' . $lastName" . PHP_EOL);
//devolver un array con los campos del codigo error, descripción de la falla, clientID y amount
$arrayOxxoPayment['oxxo_reference'] = '';
$arrayOxxoPayment['url'] = '';
$arrayOxxoPayment['error'] = 'errorNombreApellidoInvalido';
$arrayOxxoPayment['failDescription'] = "Nombre/apellido inválido: ' . $firstName . ' ' . $lastName";
$arrayOxxoPayment['clientID'] = $clientID;
$arrayOxxoPayment['clientFullName'] = $clientFullName;
$arrayOxxoPayment['amount'] = $integerAmount;
return $arrayOxxoPayment;
}
$responsePaymentMethod = $guzzleClient->post('https://api.stripe.com/v1/payment_methods', [
'auth' => [$StripeToken, ''],
'form_params' => [
'type' => 'oxxo',
'billing_details' => [
'name' => "$firstName $lastName",
'email' => $clientEmail,
],
]
]);
$paymentMethod = json_decode($responsePaymentMethod->getBody()->getContents(), true);
$responseConfirmPaymentIntent = $guzzleClient->post('https://api.stripe.com/v1/payment_intents/' . $paymentIntent['id'] . '/confirm', [
'auth' => [$StripeToken, ''],
'form_params' => [
'payment_method' => $paymentMethod['id'],
]
]);
$paymentIntentConfirm = json_decode($responseConfirmPaymentIntent->getBody()->getContents(), true);
} catch (Exception $e) {
$this->logger->error("Error al confirmar PaymentIntent: " . $e->getMessage() . PHP_EOL);
//devolver un array con los campos del codigo error, descripción de la falla, clientID y amount
$arrayOxxoPayment['oxxo_reference'] = '';
$arrayOxxoPayment['url'] = '';
$arrayOxxoPayment['error'] = 'errorConfirmPaymentIntent';
$arrayOxxoPayment['failDescription'] = 'Error al confirmar PaymentIntent: ' . $e->getMessage();
$arrayOxxoPayment['clientID'] = $clientID;
$arrayOxxoPayment['clientFullName'] = $clientFullName;
$arrayOxxoPayment['amount'] = $integerAmount;
return $arrayOxxoPayment;
}
if (!empty($paymentIntentConfirm['next_action']) && isset($paymentIntentConfirm['next_action']['oxxo_display_details'])) {
$oxxoPayment = $paymentIntentConfirm['next_action']['oxxo_display_details'];
$oxxo_reference = $oxxoPayment['number'];
$oxxo_receipt_url = $oxxoPayment['hosted_voucher_url'];
$this->logger->info("Referencia OXXO: " . $oxxo_reference . PHP_EOL);
$this->logger->info("URL del recibo: " . $oxxo_receipt_url . PHP_EOL);
$this->captureScreenshot($oxxo_receipt_url);
//devolver un array con los campos de url de oxxo, descripción de la falla, clientID y amount
$arrayOxxoPayment['oxxo_reference'] = $oxxo_reference;
$arrayOxxoPayment['url'] = $oxxo_receipt_url;
$arrayOxxoPayment['clientID'] = $clientID;
$arrayOxxoPayment['clientFullName'] = $clientFullName;
$arrayOxxoPayment['amount'] = $integerAmount;
$arrayOxxoPayment['failDescription'] = '';
$arrayOxxoPayment['error'] = '';
$this->logger->info("Referencia OXXO creada correctamente." . PHP_EOL);
return $arrayOxxoPayment;
} else {
$this->logger->info("El PaymentIntent no tiene detalles de OXXO disponibles. Estado: " . $paymentIntentConfirm['status'] . PHP_EOL);
//devolver un array con los campos del codigo error, descripción de la falla, clientID y amount
$arrayOxxoPayment['oxxo_reference'] = '';
$arrayOxxoPayment['url'] = '';
$arrayOxxoPayment['error'] = 'errorPaymentIntentWithoutOxxoDetails';
$arrayOxxoPayment['failDescription'] = 'El PaymentIntent no tiene detalles de OXXO disponibles. Estado: ' . $paymentIntentConfirm['status'];
$arrayOxxoPayment['clientID'] = $clientID;
$arrayOxxoPayment['clientFullName'] = $clientFullName;
$arrayOxxoPayment['amount'] = $integerAmount;
return $arrayOxxoPayment;
}
} else {
$this->logger->info("Este cliente no tiene adeudos." . PHP_EOL);
//devolver un array con los campos del codigo error, descripción de la falla, clientID y amount
$arrayOxxoPayment['oxxo_reference'] = '';
$arrayOxxoPayment['url'] = '';
$arrayOxxoPayment['error'] = 'errorsinadeudo';
$arrayOxxoPayment['failDescription'] = 'Este cliente no tiene adeudos.';
$arrayOxxoPayment['clientID'] = $clientID;
$arrayOxxoPayment['clientFullName'] = $clientFullName;
$arrayOxxoPayment['amount'] = $integerAmount;
return $arrayOxxoPayment;
}
}
// /**
// * implement in subclass with the specific messaging provider
// * @see TwilioNotifierFacade::sendWhatsApp()
@ -221,7 +362,7 @@ abstract class AbstractOxxoOperationsFacade
function validarEmail($email)
{
$this->logger->info('SE VALIDA EL EMAIL!!! '.PHP_EOL);
$this->logger->info('SE VALIDA EL EMAIL!!! ' . PHP_EOL);
// Utilizar la función filter_var con el filtro FILTER_VALIDATE_EMAIL para validar el email
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
// Si el email es válido, devolver el email
@ -339,4 +480,38 @@ abstract class AbstractOxxoOperationsFacade
}
/**
* Función para capturar una pantalla de una URL usando el servicio Puppeteer.
*
* @param string $url La URL de la página web que se desea capturar.
* @return string La ruta del archivo de la captura de pantalla.
*/
function captureScreenshot($url) {
// URL del servicio Puppeteer
$puppeteerUrl = 'http://172.16.5.134:4000';
// Datos a enviar
$data = http_build_query(['url' => $url]);
// Configurar la solicitud POST
$options = [
'http' => [
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => $data,
],
];
// Ejecutar la solicitud
$context = stream_context_create($options);
$response = file_get_contents($puppeteerUrl, false, $context);
if ($response === false) {
throw new Exception("Error al comunicarse con el servicio Puppeteer.");
}
return trim($response);
}
}

View File

@ -57,24 +57,43 @@ abstract class AbstractStripeOperationsFacade
*/
public function createPaymentIntent($event_json)
{
$this->logger->info("Evento recibido: " . json_encode($event_json) . PHP_EOL);
$configManager = \Ubnt\UcrmPluginSdk\Service\PluginConfigManager::create();
$config = $configManager->loadConfig();
$StripeToken = $config['tokenstripe'];
$stripe = new \Stripe\StripeClient($StripeToken); //Token de clave privada para la API de Stripe
$customerId = $event_json->data->object->customer;
$amount = $event_json->data->object->net_amount;
$stripeQuery = $stripe->customers->retrieve($customerId, []);
$UCRM_clientID = $stripeQuery['metadata']['ucrm_client_id'];
$this->ucrmApi = UcrmApi::create();
$currentUserAdmin = $this->ucrmApi->get('users/admins', []);
//$this->logger->info("User Admin ID: " . json_encode($currentUserAdmin) . PHP_EOL);
// Asegurarse de que 'customer' esté presente en la estructura del evento
if (!isset($event_json['data']['object']['customer'])) {
$this->logger->info("Error: Invalid event structure. Customer ID not found." . PHP_EOL);
return;
}
$customerId = $event_json['data']['object']['customer'];
if (is_null($customerId)) {
$this->logger->info("Error: Customer ID is null." . PHP_EOL);
return;
}
// Validar que net_amount está presente
if (!isset($event_json['data']['object']['net_amount'])) {
$this->logger->info("Error: net_amount not found in event data." . PHP_EOL);
return;
}
$amount = $event_json['data']['object']['net_amount'];
try {
// Obtener información del cliente desde Stripe
$stripeQuery = $stripe->customers->retrieve($customerId, []);
$UCRM_clientID = $stripeQuery['metadata']['ucrm_client_id'];
// Obtener información del administrador actual
$this->ucrmApi = UcrmApi::create();
$currentUserAdmin = $this->ucrmApi->get('users/admins', []);
// Crear PaymentIntent
$paymentIntent = $stripe->paymentIntents->create([
'amount' => $amount,
'currency' => 'mxn',
@ -93,21 +112,22 @@ abstract class AbstractStripeOperationsFacade
'createdBy' => 'UCRM',
'paymentType' => 'card.one_time',
'signedInAdminId' => $currentUserAdmin[0]['id'],
'tipoPago' => 'Transferencia Bancaria'
],
]);
$this->logger->info("PaymentIntent creado: " . $paymentIntent->id . PHP_EOL);
} catch (\Stripe\Exception\ApiErrorException $e) {
$this->logger->info("Error creando PaymentIntent: " . $e->getMessage() . PHP_EOL);
}
}
/*
* Creates the Stripe Customer
*/
public function createStripeClient(NotificationData $notificationData): void
public function createStripeClient(NotificationData $notificationData, $tagStripe = false): void
{
$configManager = \Ubnt\UcrmPluginSdk\Service\PluginConfigManager::create();
$config = $configManager->loadConfig();
@ -115,11 +135,20 @@ abstract class AbstractStripeOperationsFacade
$IPServer = $config['ipserver'];
$UCRMAPIToken = $config['apitoken'];
$StripeToken = $config['tokenstripe'];
$baseUri = 'https://' . $IPServer . '/crm/api/v1.0/'; //endpoint de la API REST del CRM
$stripe = new \Stripe\StripeClient($StripeToken); //Token de clave privada en modo prueba para la API de Stripe
//$stripe = new \Stripe\StripeClient('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'); //Token de clave privada en modo prodcucción para la API de Stripe
//$this->logger->info("Ya dentro del metodo Create Stripe Client " . PHP_EOL);
//$this->sendWhatsApp('Hola Dany');
$this->ucrmApi = UcrmApi::create();
if ($tagStripe) {
$tagsIds = $this->ucrmApi->get('client-tags', ['name' => 'STRIPE']);
$this->createCustomerStripe($notificationData, $stripe, $baseUri, $UCRMAPIToken);
}
$customAttributes = $this->ucrmApi->get('custom-attributes/', ['attributeType' => 'client']);//Obtener los atributos del sistema que estén vinculados a la entidad "cliente"
//$this->logger->info("result del custom Attributes: " . json_encode($customAttributes) . PHP_EOL);
@ -144,10 +173,6 @@ abstract class AbstractStripeOperationsFacade
$baseUri = 'https://' . $IPServer . '/crm/api/v1.0/'; //endpoint de la API REST del CRM
$stripe = new \Stripe\StripeClient($StripeToken); //Token de clave privada en modo prueba para la API de Stripe
//$stripe = new \Stripe\StripeClient('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'); //Token de clave privada en modo prodcucción para la API de Stripe
// Verificar si la solicitud fue exitosa (código de estado 200)
@ -155,9 +180,28 @@ abstract class AbstractStripeOperationsFacade
$notification_client_data = $notificationData->clientData; //array con los datos del cliente
$notification_client_data_export = json_encode($notification_client_data);
$this->logger->info("Valor de notification client data export: " . $notification_client_data_export . PHP_EOL);
// Asegúrate de trabajar con un objeto PHP
$dataObject = json_decode(json_encode($notification_client_data)); // Convertir a JSON y luego decodificar como objeto
if (!is_object($dataObject)) {
$this->logger->info("Error: Los datos del cliente no pudieron ser procesados." . PHP_EOL);
return;
}
$this->createCustomerStripe($notificationData, $stripe, $baseUri, $UCRMAPIToken);
// Acceder a "isLead" de forma segura
// $isLead = $dataObject->isLead ?? null;
// $this->logger->info("El valor de 'isLead' es: " . ($isLead ? "true" : "false") . PHP_EOL);
// if ($isLead === true) {
// $this->logger->info("El cliente es un lead, no se procesará" . PHP_EOL);
// return;
// } else {
// $this->logger->info("El cliente NO es un lead, se procesará" . PHP_EOL);
// $this->createCustomerStripe($notificationData, $stripe, $baseUri, $UCRMAPIToken);
// }
}
@ -174,7 +218,7 @@ abstract class AbstractStripeOperationsFacade
): void;
function createCustomerStripe($notificationData, $stripe, $baseUri, $token)
function createCustomerStripe($notificationData, $stripe, $baseUri, $token): bool
{
$this->logger->info("Creando el Customer Stripe" . PHP_EOL);
@ -213,19 +257,41 @@ abstract class AbstractStripeOperationsFacade
$this->logger->info('ahora se procede a validar el teléfono!!! ' . PHP_EOL);
$phone = $this->validarNumeroTelefono($phone); //validamos y procesamos el número de celular del cliente para que se vaya a 10 dígitos ya que Stripe por si mismo les agrega el +52
//******************************************** */
//si la variable $phone no esta vacia o null se valida con la funcion validarNumeroTelefono
if ($phone == '') {
$this->logger->info('El número de teléfono está vacío o no es válido.' . PHP_EOL);
//se manda a crear pero sin numero de teléfono
$this->logger->info('AHORA SE MANDA A CREAR EL CLIENTE A STRIPE!!! ' . PHP_EOL);
$result = $stripe->customers->create([
"description" => "Cliente SIIP CRM con client_id: " . $ucrm_client_id,
"name" => $firstName . ' ' . $lastName,
"email" => $email,
'preferred_locales' => ['es-419']
]); //aquí se contruye la petición de creación de un customer en Stripe y se consume la API
$this->logger->info('AHORA SE MANDA A CREAR EL CLIENTE A STRIPE!!! ' . PHP_EOL);
$result = $stripe->customers->create([
"description" => "Cliente SIIP CRM con client_id: " . $ucrm_client_id,
"name" => $firstName . ' ' . $lastName,
"phone" => $phone,
"email" => $email,
'preferred_locales' => ['es-419']
]); //aquí se contruye la petición de creación de un customer en Stripe y se consume la API
} else {
$phone = $this->validarNumeroTelefono($phone); //validamos y procesamos el número de celular del cliente para que se vaya a 10 dígitos ya que Stripe por si mismo les agrega el +52
$this->logger->info('AHORA SE MANDA A CREAR EL CLIENTE A STRIPE!!! ' . PHP_EOL);
$result = $stripe->customers->create([
"description" => "Cliente SIIP CRM con client_id: " . $ucrm_client_id,
"name" => $firstName . ' ' . $lastName,
"phone" => $phone,
"email" => $email,
'preferred_locales' => ['es-419']
]); //aquí se contruye la petición de creación de un customer en Stripe y se consume la API
}
$this->logger->info(json_encode($result) . PHP_EOL); //imprimir respuesta de creación del cliente
//ejemplo de respuesta de stripe cuando se crea el cliente: {"id":"cus_Rkh9CoRTpjlZUu","object":"customer","address":null,"balance":0,"created":1739250682,"currency":null,"default_source":null,"delinquent":false,"description":"Cliente SIIP CRM con client_id: 167","discount":null,"email":null,"invoice_prefix":"5017E9D3","invoice_settings":{"custom_fields":null,"default_payment_method":null,"footer":null,"rendering_options":null},"livemode":false,"metadata":[],"name":"Javier Alatorre","next_invoice_sequence":1,"phone":"4181878106","preferred_locales":["es-419"],"shipping":null,"tax_exempt":"none","test_clock":null}
//validar si se creo el cliente con la API de Stripe $stripe->customers->create
if (!isset($result['id'])) { //si no existe el ID del cliente en la respuesta de Stripe entonces se manda un mensaje de error
$this->logger->info('Error al crear el cliente en Stripe: ' . json_encode($result) . PHP_EOL);
}
$stripe_customer_id = $result['id']; //obtenemos el customer id de Stripe recibido por medio del consumo del API y lo asignamos a una variable $stripe_customer_id
sleep(2);
@ -260,7 +326,7 @@ abstract class AbstractStripeOperationsFacade
],
]
);
$this->logger->info("CLABE guardada en metadata: " . $customer->metadata->clabe . PHP_EOL);
@ -305,12 +371,11 @@ abstract class AbstractStripeOperationsFacade
} catch (GuzzleException $error) {
$this->logger->info("Error al hacer el patch al CRM: " . $error->getMessage() . PHP_EOL);
//exit();
return false; // Return false if patch fails
}
$this->logger->info(json_encode($responseCRM) . PHP_EOL); //imprimir respuesta del patch de CRM con la clabe y Customer ID Stripe
return true; // Return true if all operations succeed
}
function validarNumeroTelefono($telefono)

View File

@ -8,6 +8,7 @@ use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
use Imagick;
use Ubnt\UcrmPluginSdk\Service\PluginLogManager;
use ImagickException;
use Ubnt\UcrmPluginSdk\Service\UcrmApi;
use Ubnt\UcrmPluginSdk\Service\PluginConfigManager;
use Ubnt\UcrmPluginSdk\Service\UcrmOptionsManager;
@ -117,11 +118,168 @@ class ClientCallBellAPI
curl_close($ch);
}
public function sendPaymentNotificationWhatsApp($clientWhatsAppNumber, $notificationData): bool
public function sendJobNotificationWhatsAppToClient($clientWhatsAppNumber, $jobNotificationData, $reprogramming = false, $changeInstaller = false): bool
{
$log = PluginLogManager::create(); //Initialize Logger
$log->appendLog("Enviando mensaje de trabajo para el cliente" . PHP_EOL);
$jsonJobNotificationData = json_encode($jobNotificationData, true);
$log->appendLog("Datos de la notificación de trabajo: " . $jsonJobNotificationData . PHP_EOL);
$log->appendLog("Debugging: reprogramming = " . var_export($reprogramming, true) . ", changeInstaller = " . var_export($changeInstaller, true) . PHP_EOL);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.callbell.eu/v1/messages/send');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $this->CallBellAPIToken,
'Content-Type: application/json',
]);
$campo1 = sprintf('*%s*', $jobNotificationData['clientFullName']);
$campo2 = sprintf('*#%s*', $jobNotificationData['jobId']);
$campo3 = sprintf('*%s*', $jobNotificationData['date']);
$campo4 = sprintf('*%s*', $jobNotificationData['installerName']);
if ($reprogramming && $changeInstaller === false) {
//Enviar notificación de reprogramación al cliente
$log->appendLog("Enviando notificación de reprogramación al cliente, valor de reprogramming $reprogramming y valor de changeInstaller $changeInstaller " . PHP_EOL);
$curl_string = "{\n \"to\": \"$clientWhatsAppNumber\",\n \"from\": \"whatsapp\",\n \"type\": \"text\",\n \"content\": {\n \"text\": \"S/M\"\n },\n \"template_values\": [\"$campo1\", \"$campo2\", \"$campo3\", \"$campo4\"],\n \"template_uuid\": \"70579353773f4de1836d4f9b6bf6074d\",\n \"optin_contact\": true\n }";
}
if ($changeInstaller) {
//Enviar notificación de cambio de instalador
$log->appendLog("Enviando notificación de cambio de instalador al cliente, valor de reprogramming $reprogramming y valor de changeInstaller $changeInstaller " . PHP_EOL);
$curl_string = "{\n \"to\": \"$clientWhatsAppNumber\",\n \"from\": \"whatsapp\",\n \"type\": \"text\",\n \"content\": {\n \"text\": \"S/M\"\n },\n \"template_values\": [\"$campo1\", \"$campo2\", \"$campo3\", \"$campo4\"],\n \"template_uuid\": \"0d57fd210595422caf2f5999642882a3\",\n \"optin_contact\": true\n }";
} else {
//Enviar notificación normal de visita técnica al cliente
$log->appendLog("Enviando notificación normal de visita técnica al cliente, valor de reprogramming $reprogramming y valor de changeInstaller $changeInstaller " . PHP_EOL);
$curl_string = "{\n \"to\": \"$clientWhatsAppNumber\",\n \"from\": \"whatsapp\",\n \"type\": \"text\",\n \"content\": {\n \"text\": \"S/M\"\n },\n \"template_values\": [\"$campo1\", \"$campo2\", \"$campo3\", \"$campo4\"],\n \"template_uuid\": \"c0ef8228b50a4d9690a2e87bc11e9ab3\",\n \"optin_contact\": true\n }";
}
$log->appendLog("La cadena CURL que se envia es: " . $curl_string);
curl_setopt($ch, CURLOPT_POSTFIELDS, $curl_string);
$response = curl_exec($ch);
$log->appendLog("Response del CallBell: " . $response);
curl_close($ch);
// Validar la respuesta de Callbell
$jsonResponse = json_decode($response, true);
if (json_last_error() === JSON_ERROR_NONE) {
// Evaluar si contiene "message" con "status": "enqueued"
if (isset($jsonResponse['message']) && $jsonResponse['message']['status'] === 'enqueued') {
$log->appendLog("La notificación fue enviada correctamente con estado: enqueued" . PHP_EOL);
return true;
}
// Evaluar si contiene "error"
if (isset($jsonResponse['error'])) {
$log->appendLog("Error al enviar la notificación: " . json_encode($jsonResponse['error']) . PHP_EOL);
return false;
}
} else {
// Manejo de error en caso de que la respuesta no sea un JSON válido
$log->appendLog("La respuesta no es un JSON válido." . PHP_EOL);
return false;
}
// Valor de retorno predeterminado en caso de que ninguna condición se cumpla
$log->appendLog("Ruta no prevista en la función." . PHP_EOL);
return false;
}
public function sendJobNotificationWhatsAppToInstaller($installerWhatsAppNumber, $jobInstallerNotificationData, $reprogramming = false, $changeInstaller = false): bool
{
$log = PluginLogManager::create(); //Initialize Logger
$log->appendLog("Enviando mensaje de tarea al instalador" . PHP_EOL);
$jsonJobNotificationData = json_encode($jobInstallerNotificationData, true);
$log->appendLog("Datos de la notificación de tarea: " . $jsonJobNotificationData . PHP_EOL);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.callbell.eu/v1/messages/send');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $this->CallBellAPIToken,
'Content-Type: application/json',
]);
$campo1 = $jobInstallerNotificationData['installerName'];
if ($changeInstaller) {
$campo2 = $jobInstallerNotificationData['subjectOfChange'];
$campo3 = sprintf("#%s", $jobInstallerNotificationData['jobId']);
$campo4 = $jobInstallerNotificationData['clientFullName'];
$campo5 = $jobInstallerNotificationData['additionalChangeData'];
} else {
$campo2 = sprintf("*#%s*", $jobInstallerNotificationData['jobId']);
$campo3 = $jobInstallerNotificationData['clientFullName'];
$campo4 = $jobInstallerNotificationData['clientAddress'];
$campo5 = $jobInstallerNotificationData['clientWhatsApp'];
$campo6 = $jobInstallerNotificationData['date'];
$campo7 = $jobInstallerNotificationData['jobDescription'];
$campo8 = $jobInstallerNotificationData['gmapsLocation'];
}
if ($reprogramming && $changeInstaller === false) {
//Enviar notificación de reprogramación
$log->appendLog("Enviando notificación de reprogramación al instalador, valor de reprogramming $reprogramming y valor de changeInstaller $changeInstaller " . PHP_EOL);
$curl_string = "{\n \"to\": \"$installerWhatsAppNumber\",\n \"from\": \"whatsapp\",\n \"type\": \"text\",\n \"content\": {\n \"text\": \"S/M\"\n },\n \"template_values\": [\"$campo1\", \"$campo2\", \"$campo3\", \"$campo4\", \"$campo5\", \"$campo6\", \"$campo7\", \"$campo8\"],\n \"template_uuid\": \"42152c07c67b468ba68e581c0283e22e\",\n \"optin_contact\": true\n }";
} else if ($changeInstaller) {
//Enviar notificación de cambio de instalador
$log->appendLog("Enviando notificación de cambio de instalador al instalador, valor de reprogramming $reprogramming y valor de changeInstaller $changeInstaller " . PHP_EOL);
$curl_string = "{\n \"to\": \"$installerWhatsAppNumber\",\n \"from\": \"whatsapp\",\n \"type\": \"text\",\n \"content\": {\n \"text\": \"S/M\"\n },\n \"template_values\": [\"$campo1\", \"$campo2\", \"$campo3\", \"$campo4\", \"$campo5\"],\n \"template_uuid\": \"e1aa2b0fd3884595918f4ac2676acd29\",\n \"optin_contact\": true\n }";
} else {
//Enviar notificación normal de asignación de tarea
$log->appendLog("Enviando notificación normal de asignación de tarea al instalador, valor de reprogramming $reprogramming y valor de changeInstaller $changeInstaller " . PHP_EOL);
$curl_string = "{\n \"to\": \"$installerWhatsAppNumber\",\n \"from\": \"whatsapp\",\n \"type\": \"text\",\n \"content\": {\n \"text\": \"S/M\"\n },\n \"template_values\": [\"$campo1\", \"$campo2\", \"$campo3\", \"$campo4\", \"$campo5\", \"$campo6\", \"$campo7\", \"$campo8\"],\n \"template_uuid\": \"b6663394265e4bcdb215369aa9ba0f21\",\n \"optin_contact\": true\n }";
}
$log->appendLog("La cadena CURL que se envia es: " . $curl_string);
curl_setopt($ch, CURLOPT_POSTFIELDS, $curl_string);
$response = curl_exec($ch);
$log->appendLog("Response del CallBell: " . $response);
curl_close($ch);
// Validar la respuesta de Callbell
$jsonResponse = json_decode($response, true);
if (json_last_error() === JSON_ERROR_NONE) {
// Evaluar si contiene "message" con "status": "enqueued"
if (isset($jsonResponse['message']) && $jsonResponse['message']['status'] === 'enqueued') {
$log->appendLog("La notificación fue enviada correctamente con estado: enqueued" . PHP_EOL);
return true;
}
// Evaluar si contiene "error"
if (isset($jsonResponse['error'])) {
$log->appendLog("Error al enviar la notificación: " . json_encode($jsonResponse['error']) . PHP_EOL);
return false;
}
} else {
// Manejo de error en caso de que la respuesta no sea un JSON válido
$log->appendLog("La respuesta no es un JSON válido." . PHP_EOL);
return false;
}
// Valor de retorno predeterminado en caso de que ninguna condición se cumpla
$log->appendLog("Ruta no prevista en la función." . PHP_EOL);
return false;
}
public function sendPaymentNotificationWhatsApp($clientWhatsAppNumber, $notificationData): bool
{
$log = PluginLogManager::create(); //Initialize Logger
@ -146,12 +304,7 @@ class ClientCallBellAPI
]
);
//$datos_payment_array = json_decode($payments,true);
$datos_payment = json_encode($payments);
//$log->appendLog("Datos traidos con payment api: " . $datos_payment . PHP_EOL);
//$log->appendLog("Esto es lo que trae la fecha mas reciente de los pagos: " . $notificationData->paymentData[0]['createdDate']. PHP_EOL);
// $log->appendLog("Esto es lo que trae la fecha mas reciente de los pagos opcion 2: " . $payments[0]['createdDate'] . PHP_EOL);
$payment_id = $payments[0]['id'];
$payment_amount = '$' . $payments[0]['amount'];
@ -185,73 +338,43 @@ class ClientCallBellAPI
try {
// Hacer la solicitud GET
// Hacer la solicitud GET para obtener el PDF
$response = $clientGuzzleHttp->request('GET', "payments/$payment_id/pdf");
// Realizar la solicitud a la API y guardar el contenido en un archivo local
// Leer el contenido del PDF de la respuesta
$contenidoArchivo = $response->getBody()->getContents();
// Reemplazar nombre del cliente espacios por guiones bajos y concatenar la extensión ".pdf" para construir el nombre del archivo
//$fileNameComprobante = 'Comprobante_' . str_replace(' ', '_', $nombre_cliente) . '.pdf';
$fileNameComprobante = 'Comprobante_' . str_replace(' ', '_', $nombre_cliente) . '.png';
// Construir el nombre del archivo PDF basado en el cliente
$fileNameComprobante = 'Comprobante_' . str_replace(' ', '_', $nombre_cliente) . '.pdf';
$rutaArchivo = __DIR__ . '/../../comprobantes/' . $fileNameComprobante;
// Guardar el contenido en un archivo local
$resultado = file_put_contents(__DIR__ . '/../../comprobantes/' . $fileNameComprobante, $contenidoArchivo);
if ($resultado !== false) {
$log->appendLog("El archivo se ha descargado correctamente y se ha guardado en: " . __DIR__ . '/../../comprobantes/' . $fileNameComprobante . PHP_EOL);
// Guardar el contenido del PDF en un archivo local
if (file_put_contents($rutaArchivo, $contenidoArchivo) !== false) {
$log->appendLog("El archivo PDF se ha descargado y guardado correctamente en: $rutaArchivo" . PHP_EOL);
} else {
$log->appendLog("Se produjo un error al descargar y guardar el archivo." . PHP_EOL);
$log->appendLog("Error al guardar el archivo PDF en la ruta: $rutaArchivo" . PHP_EOL);
return false;
}
// Obtener el cuerpo de la respuesta (contenido binario)
$binaryData = $response->getBody()->getContents();
// Abrir un recurso de flujo de datos en memoria
$fileHandle = fopen('php://temp', 'r+');
// Escribir los datos binarios en el recurso de flujo de datos en memoria
fwrite($fileHandle, $binaryData);
// Rebobinar el puntero del flujo de datos para leer desde el principio
rewind($fileHandle);
if (!isset($fileHandle)) {
$log->appendLog("viene vacia la variable filehandle" . PHP_EOL);
if (!file_exists($rutaArchivo)) {
$log->appendLog("El archivo PDF no existe: $rutaArchivo" . PHP_EOL);
return false;
}
if (filesize($rutaArchivo) === 0) {
$log->appendLog("El archivo PDF está vacío: $rutaArchivo" . PHP_EOL);
return false;
}
$log->appendLog("El archivo PDF es válido y tiene contenido: $rutaArchivo" . PHP_EOL);
$rutaImagen = __DIR__ . '/../../comprobantes/' . str_replace('.pdf', '.png', $fileNameComprobante);
} catch (\Exception $e) {
$log->appendLog("Error con un problema al generar y comprobante de pago: " . $e->getMessage() . PHP_EOL);
return false;
}
try {
// Obtener el nombre del archivo del encabezado Content-Disposition si está presente
$serverFilename = null;
$content_disposition = $response->getHeaderLine('Content-Disposition');
if (!empty($content_disposition)) {
preg_match('/filename=([^;]+)/', $content_disposition, $matches);
if (isset($matches[1])) {
$serverFilename = trim($matches[1], '"');
$pdf_payment_path = '/home/unms/data/ucrm/ucrm/data/payment_receipts/' . $serverFilename;
}
}
// Si no se encontró un nombre de archivo, usar un nombre predeterminado
if (empty((($serverFilename)))) {
$pdf_payment_path = '/home/unms/data/ucrm/ucrm/data/payment_receipts/comprobante.pdf';
}
//imprimir el nombre del archivo
$log->appendLog("El nombre del archivo PDF es: $pdf_payment_path" . PHP_EOL);
} catch (\Exception $exception) {
$log->appendLog("Error con un problema al generar y comprobante de pago: " . $exception->getMessage() . PHP_EOL);
$log->appendLog("Error al manejar el comprobante de pago: " . $e->getMessage() . PHP_EOL);
return false;
}
@ -260,71 +383,28 @@ class ClientCallBellAPI
try {
//******************
// Ruta del archivo PDF
//$pdfFilePath = dirname(dirname(dirname(dirname(__DIR__)))) . '//payment_receipts/' . $serverFilename;
// Instanciar Imagick con la ruta del archivo PDF
$image = new Imagick();
$log->appendLog("se creó la instancia de Imagick" . PHP_EOL);
$image->setResolution(1024, 1024); // Establecer la resolución (opcional)
// Leer el archivo PDF
$image->readImage(__DIR__ . '/../../comprobantes/' . $fileNameComprobante);
$image->resizeImage(1024, 1024, Imagick::FILTER_LANCZOS, 1, true);
// Obtener las dimensiones originales de la imagen
$ancho_original = $image->getImageWidth();
$altura_original = $image->getImageHeight();
$log->appendLog("Ancho original de la imagen:" . $ancho_original . " Altura original de la imagen: " . $altura_original . PHP_EOL);
// Calcular las coordenadas de inicio del área a recortar
// $inicio_x = $ancho_original * 0.14; // 14% del ancho
// $inicio_y = $altura_original * 0.05; // 5% de la altura
// $log->appendLog("Inicio x:" . $inicio_x . " Inicio y: " . $inicio_y . PHP_EOL);
// Calcular el ancho y la altura del área a recortar
// $nuevo_ancho = $ancho_original * 0.7; // 70% del ancho del comprbante final
// $nueva_altura = $altura_original * 0.90; // 55% de la altura del comprobante final
// $log->appendLog("Nuevo ancho:".$nuevo_ancho ." Nuevo alto: ".$nueva_altura. PHP_EOL);
// Recortar la imagen
// $image->cropImage($nuevo_ancho, $nueva_altura, $inicio_x, $inicio_y);
// Convertir la primera página del PDF a imagen
$image->setResolution(300, 300);
$image->readImage($rutaArchivo); // Aquí podría ocurrir un error
$image->setImageFormat('png');
$image->writeImage(__DIR__ . '/../../comprobantes/' . $fileNameComprobante);
// Liberar recursos
$rutaImagen = str_replace('.pdf', '.png', $rutaArchivo);
$image->writeImage($rutaImagen);
$image->destroy();
$log->appendLog("Terminó de crear la imagen del comprobante" . PHP_EOL);
//******************
} catch (\Exception $exception) {
$log->appendLog("Error al crear la imagen: " . $exception . PHP_EOL);
$log->appendLog("El archivo PNG se ha generado correctamente en: $rutaImagen" . PHP_EOL);
} catch (ImagickException $e) {
$log->appendLog("Error al convertir el PDF a PNG con Imagick: " . $e->getMessage() . PHP_EOL);
return false;
}
$url_file = $this->UploadReceiptToWordpressByImageFileName($fileNameComprobante);//Carga del comprobante PDF a Wordpress para su posterior envío
//$url_file = $this->UploadReceiptToWordpressByServerFileName($serverFilename, $fileNameComprobante);//Carga del comprobante PDF a Wordpress para su posterior envío
//$url_file = $this->UploadReceiptToWordpressByCustomLocalFileName($fileNameComprobante);//Carga del comprobante PDF a Wordpress para su posterior envío
$fileNameComprobanteImage = str_replace('.pdf', '.png', $fileNameComprobante);
$url_file = $this->UploadReceiptToWordpressByImageFileName($fileNameComprobanteImage);//Carga del comprobante PDF a Wordpress para su posterior envío
// $url_file = $this->UploadReceiptToWordpressByImageFileName($fileNameComprobante);//Carga del comprobante PDF a Wordpress para su posterior envío
$log->appendLog("Se terminó de subir comprobante a wordpress " . PHP_EOL);
// if (empty($notificationData->clientData['contacts'][0]['email'])) {
// $log->appendLog("El cliente no tiene correo" . PHP_EOL);
// } else {
// // $log->appendLog("El cliente SI tiene correo y es: ".$notificationData->clientData['contacts'][0]['email'] . PHP_EOL);
// // Hacer la solicitud PATCH para enviar correo electronico con el comprobante de pago
// $response = $clientGuzzleHttp->request('PATCH', "payments/$payment_id/send-receipt");
// }
//$log->appendLog("Entrando al metodo sendPaymentNotificationWhatsAp" . PHP_EOL);
@ -337,23 +417,9 @@ class ClientCallBellAPI
'Content-Type: application/json',
]);
// Verificar si la ruta es válida
// if ($realPath = realpath('/data/ucrm/data/plugins/siip-whatsapp-notifications/src/Facade/Comprobante.pdf')) {
// $log->appendLog("La ruta es válida: $realPath" . PHP_EOL);
// $log->appendLog(var_export($realPath,true) . PHP_EOL);
// } else {
// $log->appendLog("La ruta no es válida o no existe" . PHP_EOL);
// }
$curl_string = "{\n \"to\": \"$clientWhatsAppNumber\",\n \"from\": \"whatsapp\",\n \"type\": \"document\",\n \"content\": {\n \"text\": \"S/M\",\n \"url\": \"$url_file\"\n },\n \"template_values\": [\"$nombre_cliente\", \"$payment_amount\", \"$saldoTexto\"],\n \"template_uuid\": \"57ead79cebd14902921477922403093b\",\n \"optin_contact\": true\n }";
//$curl_string = "{\n \"to\": \"$clientWhatsAppNumber\",\n \"from\": \"whatsapp\",\n \"type\": \"document\",\n \"content\": {\n \"text\": \"S/M\",\n \"url\": \"$url_file\"\n },\n \"template_values\": [\"$nombre_cliente\", \"$payment_amount\", \"$saldo\"],\n \"template_uuid\": \"6c0df98317b44f7b8666375a6cc8454c\",\n \"optin_contact\": true\n }";
// $curl_string = "{\n \"to\": \"$clientWhatsAppNumber\",\n \"from\": \"whatsapp\",\n \"type\": \"text\",\n \"content\": {\n \"text\": \"S/M\"\n },\n \"template_values\": [\"$campo1\", \"$campo2\"],\n \"template_uuid\": \"55705f1fe4e24bab80104dc2643fe11c\",\n \"optin_contact\": true\n }";
$log->appendLog("La cadena CURL que se envia es: " . $curl_string);
curl_setopt($ch, CURLOPT_POSTFIELDS, $curl_string);
@ -368,9 +434,33 @@ class ClientCallBellAPI
// }
curl_close($ch);
$this->deleteFilesExceptLastFifty();
$this->deleteFilesExceptLastHundred();
//return $fileNameComprobante;
return true;
// Validar la respuesta de Callbell
$jsonResponse = json_decode($response, true);
if (json_last_error() === JSON_ERROR_NONE) {
// Evaluar si contiene "message" con "status": "enqueued"
if (isset($jsonResponse['message']) && $jsonResponse['message']['status'] === 'enqueued') {
$log->appendLog("La notificación fue enviada correctamente con estado: enqueued" . PHP_EOL);
return true;
}
// Evaluar si contiene "error"
if (isset($jsonResponse['error'])) {
$log->appendLog("Error al enviar la notificación: " . json_encode($jsonResponse['error']) . PHP_EOL);
return false;
}
} else {
// Manejo de error en caso de que la respuesta no sea un JSON válido
$log->appendLog("La respuesta no es un JSON válido." . PHP_EOL);
return false;
}
// Valor de retorno predeterminado en caso de que ninguna condición se cumpla
$log->appendLog("Ruta no prevista en la función." . PHP_EOL);
return false;
}
public function sendTextPaymentNotificationWhatsApp($clientWhatsAppNumber, $notificationData): bool
{
@ -485,17 +575,17 @@ class ClientCallBellAPI
}
$log->appendLog("Datos client data credit amount: " . $notificationData->paymentData['creditAmount'] . PHP_EOL);
$cantidad_pagadaFormateada = '$' . number_format($cantidad_pagada, 2, ',', '.') . ' MXN';
$creditoPorPagoFormateado = '$' . number_format($creditoPorPago, 2, ',', '.') . ' MXN';
if ($creditoClienteBase > 0 && empty($notificationData->paymentData['paymentCovers'])) {
$texto_credito = "La cantidad que sobra de $creditoPorPagoFormateado se ha convertido a crédito";
$log->appendLog("La cantidad que sobra de $creditoPorPagoFormateado se ha convertido a crédito" . PHP_EOL);
$texto_credito = "La cantidad que sobra de $creditoPorPagoFormateado se ha convertido a crédito";
$log->appendLog("La cantidad que sobra de $creditoPorPagoFormateado se ha convertido a crédito" . PHP_EOL);
$curl_string = "{\n \"to\": \"$clientWhatsAppNumber\",\n \"from\": \"whatsapp\",\n \"type\": \"text\",\n \"content\": {\n \"text\": \"John Doe\"\n },\n \"template_values\": [\"$nombre_cliente\", \"$folio\", \"$client_id\", \"$fecha_pago\", \"$cantidad_pagadaFormateada\", \"$metodo_pago\", \"$saldoTexto\", \"$texto_credito\"],\n \"template_uuid\": \"4ac9dc060cf746b6ad7f2e8acad355e0\",\n \"optin_contact\": true\n }";
@ -505,8 +595,8 @@ class ClientCallBellAPI
if ($creditoPorPago > 0) {
$texto_credito = "La cantidad que sobra de $creditoPorPagoFormateado se ha convertido a crédito";
$log->appendLog("La cantidad que sobra de $creditoPorPagoFormateado se ha convertido a crédito" . PHP_EOL);
}else{
} else {
$texto_credito = '_________________________';
}
@ -581,7 +671,7 @@ class ClientCallBellAPI
//$cantidad_pagadaFormateada = '$' . number_format($cantidad_pagada, 2, ',', '.') . ' MXN';
$log->appendLog("Se terminó de verificar payment covers" . PHP_EOL);
$total_facturaFormateada = '$' . number_format($total_factura, 2, ',', '.') . ' MXN';
$pagoFacturaFormateado = '$' . $amounts. ' MXN';
$pagoFacturaFormateado = '$' . $amounts . ' MXN';
$curl_string = "{\n \"to\": \"$clientWhatsAppNumber\",\n \"from\": \"whatsapp\",\n \"type\": \"text\",\n \"content\": {\n \"text\": \"John Doe\"\n },\n \"template_values\": [\"$nombre_cliente\", \"$folio\", \"$client_id\", \"$fecha_pago\", \"$cantidad_pagadaFormateada\", \"$metodo_pago\", \"$invoiceIds\", \"$total_facturaFormateada\", \"$pagoFacturaFormateado\", \"$saldoTexto\", \"$texto_credito\"],\n \"template_uuid\": \"c1396a6ad3cb4192916d4ac2bfb782a5\",\n \"optin_contact\": true\n }";
@ -623,7 +713,30 @@ class ClientCallBellAPI
curl_close($ch);
//$this->deleteFilesExceptLastFifty();
//return $fileNameComprobante;
return true;
// Validar la respuesta de Callbell
$jsonResponse = json_decode($response, true);
if (json_last_error() === JSON_ERROR_NONE) {
// Evaluar si contiene "message" con "status": "enqueued"
if (isset($jsonResponse['message']) && $jsonResponse['message']['status'] === 'enqueued') {
$log->appendLog("La notificación fue enviada correctamente con estado: enqueued" . PHP_EOL);
return true;
}
// Evaluar si contiene "error"
if (isset($jsonResponse['error'])) {
$log->appendLog("Error al enviar la notificación: " . json_encode($jsonResponse['error']) . PHP_EOL);
return false;
}
} else {
// Manejo de error en caso de que la respuesta no sea un JSON válido
$log->appendLog("La respuesta no es un JSON válido." . PHP_EOL);
return false;
}
// Valor de retorno predeterminado en caso de que ninguna condición se cumpla
$log->appendLog("Ruta no prevista en la función." . PHP_EOL);
return false;
}
public function sendOverdueNotificationWhatsApp($clientWhatsAppNumber, $notificationData): void
@ -754,20 +867,27 @@ class ClientCallBellAPI
{
$log = PluginLogManager::create(); //Initialize Logger
//imprimir notificacionData
$log->appendLog("Notificacion data: " . json_encode($notificationData) . PHP_EOL);
//ejemplo de $notificationData: {"uuid":"cad4fa25-176e-4823-9f4c-1421d05d2a31","changeType":"edit","entity":"client","entityId":2,"message":null,"clientId":2,"eventName":"client.edit","clientData":{"id":2,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"31 Chiapas","street2":null,"city":"Dolores Hidalgo Cuna de la Independencia Nacional","countryId":173,"stateId":null,"zipCode":"37800","fullAddress":"Chiapas 31, Centro, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":"Cliente espacial, el m\u00e1s chido","sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2024-01-25T00:00:00-0600","leadConvertedAt":null,"companyContactFirstName":null,"companyContactLastName":null,"isActive":true,"firstName":"Daniel Humberto","lastName":"Soto Villegas Pollerias2","username":"danydhsv","contacts":[{"id":2,"clientId":2,"email":"dhsv.141089@gmail.com","phone":"5214181878106","name":"Personal","isBilling":false,"isContact":false,"types":[{"id":1000,"name":"WhatsApp"}]},{"id":170,"clientId":2,"email":null,"phone":"5214181817609","name":"Bussiness","isBilling":false,"isContact":false,"types":[]}],"attributes":[{"id":112,"clientId":2,"customAttributeId":10,"name":"Stripe Customer ID","key":"stripeCustomerId","value":"cus_PetN1dhr4rx0kX","clientZoneVisible":true},{"id":113,"clientId":2,"customAttributeId":11,"name":"Clabe Interbancaria","key":"clabeInterbancaria","value":"0021804341999569810","clientZoneVisible":true},{"id":178,"clientId":2,"customAttributeId":15,"name":"Site","key":"site","value":"0LOCS","clientZoneVisible":false},{"id":179,"clientId":2,"customAttributeId":16,"name":"Antena\/Sectorial","key":"antenaSectorial","value":"Sectorial-4b 172.16.13.16\/24","clientZoneVisible":false}],"accountBalance":1553.33,"accountCredit":1553.33,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[{"id":2,"name":"NS EXENTO","colorBackground":"#42a3df","colorText":"#fff"}],"invitationEmailSentDate":null,"avatarColor":"#f1df43","addressGpsLat":21.1564209,"addressGpsLon":-100.9384185,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":true,"hasSuspendedService":false,"hasServiceWithoutDevices":false,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false},"serviceData":null,"invoiceData":null,"paymentData":null}
// $IPSERVIDOR = $this->IPServer;
// $log->appendLog("Valor de la IP del Servidor: " . $IPSERVIDOR . PHP_EOL);
// $UCRMTOKEN= $this->UCRMAPIToken;
// $log->appendLog("Valor del Token del UCRM: " . $UCRMTOKEN . PHP_EOL);
// $CALLBELLTOKEN = $this->CallBellAPIToken;
// $log->appendLog("Valor del Token de Call Bell: " . $CALLBELLTOKEN . PHP_EOL);
//buscar el attribute con el key site y antenaSectorial
$attributes = $notificationData->clientData['attributes']; //Obtener los atributos del cliente
$site = '';
$antenaSectorial = '';
//$notification_payment = $notificationData->paymentData; //array con los datos del pago
// Iterar sobre los atributos
foreach ($attributes as $attribute) {
// Verificar si el key es "site"
if ($attribute['key'] === 'site') {
$site = $attribute['value'];
}
// Verificar si el key es "antenaSectorial"
if ($attribute['key'] === 'antenaSectorial') {
$antenaSectorial = $attribute['value'];
}
}
// $notification_payment_export = json_encode($notification_payment);
// $this->logger->info("Valor de notification payment export: " . $notification_payment_export . PHP_EOL);
//$payment_id = $notification_payment['id'];
$log->appendLog("Dentro del proceso del patch: " . PHP_EOL);
@ -801,8 +921,17 @@ class ClientCallBellAPI
'Authorization: Bearer ' . $this->CallBellAPIToken,
'Content-Type: application/json',
]);
$ch2 = curl_init();
curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch2, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($ch2, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $this->CallBellAPIToken,
'Content-Type: application/json',
]);
$UrlChatCallBell = 'https://api.callbell.eu/v1/contacts/' . $uuid;
curl_setopt($ch, CURLOPT_URL, $UrlChatCallBell);
curl_setopt($ch2, CURLOPT_URL, $UrlChatCallBell);
$nombre_cliente = sprintf("%s %s", $notificationData->clientData['firstName'], $notificationData->clientData['lastName']);
$log->appendLog("Nombre del cliente que se va a actualizar: " . $nombre_cliente . PHP_EOL);
$log->appendLog("UUID: " . $uuid . PHP_EOL);
@ -890,16 +1019,18 @@ class ClientCallBellAPI
$resumenClienteJSON = '{' .
'"Cliente": "' . $notificationData->clientData['id'] . '",' .
'"Domicilio": "' .
(($notificationData->clientData['fullAddress'] == null) ? '📍❌ Sin domicilio' : '📍 ' . $notificationData->clientData['fullAddress']) . '",' .
'"Nombre": "' . sprintf("👤 %s %s", $notificationData->clientData['firstName'], $notificationData->clientData['lastName']) . '",' .
'"URL": "🌐 https://172.16.5.120/crm/client/' . $notificationData->clientId . '",' .
//(($notificationData->clientData['fullAddress'] == null) ? 'Sin domicilio' : '' . $notificationData->clientData['fullAddress']) . '",' .
'"Nombre": "' . sprintf("%s %s", $notificationData->clientData['firstName'], $notificationData->clientData['lastName']) . '",' .
'"URL": "https://sistema.siip.mx/crm/client/' . $notificationData->clientId . '",' .
'"Saldo Actual": "' . $saldoTexto . '",' .
'"Monto Ultimo Pago": "💲 ' . $payments[0]['amount'] . '",' .
'"Monto Ultimo Pago": "$ ' . $payments[0]['amount'] . '",' .
'"Estado": "' .
(($notificationData->clientData['hasSuspendedService']) ? '🔴 Suspendido' : '🟢 Activo') . '",' .
'"Fecha Ultimo Pago": "📆💰 ' . $fecha_ultimoPago_ajustada . ' con ' . $payment_method . '",' .
'"Fecha Ultima Actualizacion": "📆🔄️ ' . $fecha_actual_ajustada . '",' .
'"Clabe Transferencia Banamex": "' . $clabeInterbancaria . '"' .
(($notificationData->clientData['hasSuspendedService']) ? 'Suspendido' : 'Activo') . '",' .
'"Fecha Ultimo Pago": " ' . $fecha_ultimoPago_ajustada . ' con ' . $payment_method . '",' .
'"Fecha Ultima Actualizacion": "' . $fecha_actual_ajustada . '",' .
'"Clabe Interbancaria": "' . $clabeInterbancaria . '",' .
'"Site": "' . $site . '",' .
'"Antena/Sectorial": "' . $antenaSectorial . '"' .
'}';
@ -914,17 +1045,30 @@ class ClientCallBellAPI
"Cliente" => $notificationData->clientData['id'],
"Domicilio" => ($notificationData->clientData['fullAddress'] == null) ? '📍❌ Sin domicilio' : '📍 ' . $notificationData->clientData['fullAddress'],
"Nombre" => sprintf("👤 %s %s", $notificationData->clientData['firstName'], $notificationData->clientData['lastName']),
"URL" => '🌐 https://172.16.5.120/crm/client/' . $notificationData->clientId,
"URL" => '🌐 https://sistema.siip.mx/crm/client/' . $notificationData->clientId,
"Saldo Actual" => $saldoTexto,
"Monto Ultimo Pago" => '💲 ' . $payments[0]['amount'],
"Estado" => ($notificationData->clientData['hasSuspendedService']) ? '🔴 Suspendido' : '🟢 Activo ',
"Resumen" => $resumenClienteJSON,
"Fecha Ultimo Pago" => '📆💸 ' . $fecha_ultimoPago_ajustada . ' con ' . $payment_method,
"Fecha Ultima Actualizacion" => '📆🔄️ ' . $fecha_actual_ajustada,
"Clabe Transferencia Banamex" => $clabeInterbancaria
"Clabe Interbancaria" => $clabeInterbancaria,
"Site" => $site,
"Antena/Sectorial" => $antenaSectorial
)
);
$log->appendLog("JSON con los datos a actualizar: " . json_encode($data_CRM) . PHP_EOL);
$data_CRM2 = array(
"custom_fields" => array(
"Resumen" => $resumenClienteJSON,
)
);
$log->appendLog("JSON con los datos a actualizar del resumen: " . $resumenClienteJSON . PHP_EOL);
if (
$response_getContactCallBell['custom_fields']['Cliente'] != $data_CRM['custom_fields']['Cliente']
|| $response_getContactCallBell['custom_fields']['Domicilio'] != $data_CRM['custom_fields']['Domicilio']
@ -935,12 +1079,17 @@ class ClientCallBellAPI
|| $response_getContactCallBell['custom_fields']['Fecha Ultimo Pago'] != $data_CRM['custom_fields']['Fecha Ultimo Pago']
|| $response_getContactCallBell['custom_fields']['Monto Ultimo Pago'] != $data_CRM['custom_fields']['Monto Ultimo Pago']
|| $response_getContactCallBell['name'] != $data_CRM['name']
) {
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data_CRM));
curl_setopt($ch2, CURLOPT_POSTFIELDS, json_encode($data_CRM2));
$response = curl_exec($ch);
$log->appendLog("Response Patch CallBell: " . $response . PHP_EOL);
$response2 = curl_exec($ch2);
$log->appendLog("Response 2 Patch CallBell: " . $response2 . PHP_EOL);
curl_close($ch);
curl_close($ch2);
// if($fileNameComprobante != null){
// sleep(3);
// $this->deleteFileWordPressAndLocal($fileNameComprobante);
@ -1015,6 +1164,7 @@ class ClientCallBellAPI
$data_CRM = array(
"name" => $nombre_cliente,
"custom_fields" => array(
"Estado" => (
isset($notificationData->serviceData['status'])
@ -1043,101 +1193,6 @@ class ClientCallBellAPI
}
}
function UploadFileWordpress($fileHandle): string
{
$log = PluginLogManager::create(); //Initialize Logger
// Configuración de conexión FTP
$ftp_server = "siip.mx";
$ftp_username = "siip0001";
$ftp_password = '$spGiT,[wa)n';
//$fileName = $fileNameComprobantePDF;
$remote_file = "/public_html/wp/wp-content/uploads/pdf/Comprobante_de_pago.pdf";
//$file_to_upload = '/home/unms/data/ucrm/ucrm/data/payment_receipts/' . $fileName;
$url = 'http://siip.mx/wp/wp-content/uploads/pdf/Comprobante_de_pago.pdf';
// Conexión FTP
$ftp_conn = ftp_connect($ftp_server) or die("No se pudo conectar al servidor FTP");
$login = ftp_login($ftp_conn, $ftp_username, $ftp_password);
ftp_pasv($ftp_conn, true);
// Verificar conexión y login
if ($ftp_conn && $login) {
$log->appendLog("Conexión FTP exitosa" . PHP_EOL);
// Cargar archivo
if (ftp_fput($ftp_conn, $remote_file, $fileHandle, FTP_BINARY)) {
$log->appendLog("El archivo ha sido cargado exitosamente." . PHP_EOL);
$log->appendLog("La URL es: " . $url . PHP_EOL);
// Cerrar conexión FTP
ftp_close($ftp_conn);
return $url;
} else {
$log->appendLog("Error al cargar el archivo " . PHP_EOL);
}
// Cerrar conexión FTP
ftp_close($ftp_conn);
return '';
} else {
$log->appendLog("No se pudo conectar o iniciar sesión en el servidor FTP." . PHP_EOL);
return '';
}
}
function UploadReceiptToWordpressByServerFileName($fileNamePaymentReceiptServer, $newCustomFileName): string
{
$log = PluginLogManager::create(); //Initialize Logger
// Configuración de conexión FTP
$ftp_server = "siip.mx";
$ftp_username = "siip0001";
$ftp_password = '$spGiT,[wa)n';
$remote_file = "/public_html/wp/wp-content/uploads/pdf/" . $newCustomFileName;
$file_to_upload = __DIR__ . '/../../../../payment_receipts/' . $fileNamePaymentReceiptServer;
$url = 'https://siip.mx/wp/wp-content/uploads/pdf/' . $newCustomFileName;
// Conexión FTP
$ftp_conn = ftp_connect($ftp_server) or die("No se pudo conectar al servidor FTP");
$login = ftp_login($ftp_conn, $ftp_username, $ftp_password);
ftp_pasv($ftp_conn, true);
// Verificar conexión y login
if ($ftp_conn && $login) {
$log->appendLog("Conexión FTP exitosa" . PHP_EOL);
// Cargar archivo
if (ftp_put($ftp_conn, $remote_file, $file_to_upload, FTP_BINARY)) {
$log->appendLog("El archivo ha sido cargado exitosamente." . PHP_EOL);
$log->appendLog("La URL es: " . $url . PHP_EOL);
// Cerrar conexión FTP
ftp_close($ftp_conn);
return $url;
} else {
$log->appendLog("Error al cargar el archivo " . PHP_EOL);
}
// Cerrar conexión FTP
ftp_close($ftp_conn);
return '';
} else {
$log->appendLog("No se pudo conectar o iniciar sesión en el servidor FTP." . PHP_EOL);
return '';
}
}
function UploadReceiptToWordpressByImageFileName($imageFileName): string
{
@ -1160,6 +1215,7 @@ class ClientCallBellAPI
$file_to_upload = __DIR__ . '/../../comprobantes/' . $imageFileName;
$url = 'https://siip.mx/wp/wp-content/uploads/img/' . $imageFileName;
$log->appendLog("file_to_upload: " . $file_to_upload . PHP_EOL);
// Conexión FTP
@ -1174,9 +1230,11 @@ class ClientCallBellAPI
if (ftp_put($ftp_conn, $remote_file, $file_to_upload, FTP_BINARY)) {
$log->appendLog("El archivo ha sido cargado exitosamente." . PHP_EOL);
$log->appendLog("La URL es: " . $url . PHP_EOL);
$this->deleteFilesWordpressExceptLastHundred($log,$ftp_conn,$remote_file);
// Cerrar conexión FTP
//ftp_close($ftp_conn);
//return $url;
ftp_close($ftp_conn);//COMENTAR AQUÍ SI SE BORRAN LOS ARCHIVOS DE WORDPRESS DESCOMENTANDO EL CÓDIGO DE MÁS ABAJO
return $url;//COMENTAR AQUÍ SI SE BORRAN LOS ARCHIVOS DE WORDPRESS DESCOMENTANDO EL CÓDIGO DE MÁS ABAJO
} else {
$log->appendLog("Error al cargar el archivo " . PHP_EOL);
@ -1184,49 +1242,49 @@ class ClientCallBellAPI
return '';
}
//SI SE DECIDE VOLVER A ELIMINAR LOS COMPROBANTES ENTONCES DESCOMENTAR ESTA PARTE DE ABAJO Y COMENTAR LA SECCIÓN DE ARRIBA
// Obtener lista de archivos en la carpeta
$files = ftp_nlist($ftp_conn, $remote_folder);
if (is_array($files)) {
// Eliminar la ruta del directorio de los archivos
$files = array_map(function ($file) use ($remote_folder) {
return str_replace($remote_folder, '', $file);
}, $files);
// $files = ftp_nlist($ftp_conn, $remote_folder);
// if (is_array($files)) {
// // Eliminar la ruta del directorio de los archivos
// $files = array_map(function ($file) use ($remote_folder) {
// return str_replace($remote_folder, '', $file);
// }, $files);
// Obtener fechas de modificación
$filesWithTime = [];
foreach ($files as $file) {
$modifiedTime = ftp_mdtm($ftp_conn, $remote_folder . $file);
if ($modifiedTime != -1) {
$filesWithTime[$file] = $modifiedTime;
}
}
// // Obtener fechas de modificación
// $filesWithTime = [];
// foreach ($files as $file) {
// $modifiedTime = ftp_mdtm($ftp_conn, $remote_folder . $file);
// if ($modifiedTime != -1) {
// $filesWithTime[$file] = $modifiedTime;
// }
// }
// Ordenar archivos por fecha de modificación, más recientes primero
arsort($filesWithTime);
// // Ordenar archivos por fecha de modificación, más recientes primero
// arsort($filesWithTime);
// Obtener los archivos a eliminar (todos menos los 50 más recientes)
$filesToDelete = array_slice(array_keys($filesWithTime), 50);
// // Obtener los archivos a eliminar (todos menos los 50 más recientes)
// $filesToDelete = array_slice(array_keys($filesWithTime), 50);
// // Eliminar archivos antiguos
// foreach ($filesToDelete as $file) {
// if (ftp_delete($ftp_conn, $remote_folder . $file)) {
// $log->appendLog("Comprobante eliminado de Wordpress: " . $file . PHP_EOL);
// } else {
// $log->appendLog('Error al borrar comprobante' . $file . PHP_EOL);
// }
// }
// $log->appendLog("Archivos eliminados" . PHP_EOL);
// ftp_close($ftp_conn);
// return $url;
// } else {
// $log->appendLog("No se pudo obtener la lista de archivos de la carpeta FTP" . PHP_EOL);
// ftp_close($ftp_conn);
// return $url;
// }
// Eliminar archivos antiguos
foreach ($filesToDelete as $file) {
if (ftp_delete($ftp_conn, $remote_folder . $file)) {
$log->appendLog("Comprobante eliminado de Wordpress: " . $file . PHP_EOL);
} else {
$log->appendLog('Error al borrar comprobante' . $file . PHP_EOL);
}
}
$log->appendLog("Archivos eliminados" . PHP_EOL);
ftp_close($ftp_conn);
return $url;
} else {
$log->appendLog("No se pudo obtener la lista de archivos de la carpeta FTP" . PHP_EOL);
ftp_close($ftp_conn);
return $url;
}
// Cerrar conexión FTP
//ftp_close($ftp_conn);
//return '';
} else {
$log->appendLog("No se pudo conectar o iniciar sesión en el servidor FTP." . PHP_EOL);
return '';
@ -1235,14 +1293,57 @@ class ClientCallBellAPI
}
function deleteFilesWordpressExceptLastHundred($log, $ftp_conn, $remote_folder): bool
{
// Obtener lista de archivos en la carpeta
$files = ftp_nlist($ftp_conn, $remote_folder);
if (is_array($files)) {
// Eliminar la ruta del directorio de los archivos
$files = array_map(function ($file) use ($remote_folder) {
return str_replace($remote_folder, '', $file);
}, $files);
// Obtener fechas de modificación
$filesWithTime = [];
foreach ($files as $file) {
$modifiedTime = ftp_mdtm($ftp_conn, $remote_folder . $file);
if ($modifiedTime != -1) {
$filesWithTime[$file] = $modifiedTime;
}
}
// Ordenar archivos por fecha de modificación, más recientes primero
arsort($filesWithTime);
// Obtener los archivos a eliminar (todos menos los 50 más recientes)
$filesToDelete = array_slice(array_keys($filesWithTime), 50);
// Eliminar archivos antiguos
foreach ($filesToDelete as $file) {
if (ftp_delete($ftp_conn, $remote_folder . $file)) {
$log->appendLog("Comprobante eliminado de Wordpress: " . $file . PHP_EOL);
} else {
$log->appendLog('Error al borrar comprobante' . $file . PHP_EOL);
}
}
$log->appendLog("Archivos eliminados" . PHP_EOL);
ftp_close($ftp_conn);
return true;
} else {
$log->appendLog("No se pudo obtener la lista de archivos de la carpeta FTP" . PHP_EOL);
ftp_close($ftp_conn);
return false;
}
}
/**
* /Elimina los archivos del directorio de comprobantes de pago a excepción de los últimos 30 para evitar errores de envío
* /Elimina los archivos del directorio de comprobantes de pago a excepción de los últimos 100 para evitar errores de envío
* @return void
*/
function deleteFilesExceptLastFifty()
function deleteFilesExceptLastHundred()
{
$log = PluginLogManager::create(); //Initialize Logger
$directory = __DIR__ . '/../../comprobantes/';
@ -1261,10 +1362,10 @@ class ClientCallBellAPI
return filemtime($b) - filemtime($a);
});
// Verificar que haya más de 30 archivos
if (count($files) > 50) {
// Obtener los archivos que deben ser eliminados (todos menos los 50 más recientes)
$filesToDelete = array_slice($files, 50);
// Verificar que haya más de 100 archivos
if (count($files) > 100) {
// Obtener los archivos que deben ser eliminados (todos menos los 100 más recientes)
$filesToDelete = array_slice($files, 100);
// Eliminar los archivos
foreach ($filesToDelete as $file) {
@ -1274,7 +1375,7 @@ class ClientCallBellAPI
}
}
} else {
$log->appendLog("Hay menos de 50 archivos en el directorio. No se eliminarán archivos." . PHP_EOL);
$log->appendLog("Hay menos de 100 archivos en el directorio. No se eliminarán archivos." . PHP_EOL);
}
}

View File

@ -14,6 +14,7 @@ use SmsNotifier\Service\Logger;
use SmsNotifier\Service\OptionsManager;
use SmsNotifier\Service\PluginDataValidator;
use Twilio\Exceptions\TwilioException;
use Ubnt\UcrmPluginSdk\Service\UcrmApi;
class Plugin
{
@ -50,6 +51,12 @@ class Plugin
*/
private $notificationDataFactory;
/**
* @var UcrmApi
*/
protected $ucrmApi;
public function __construct(
Logger $logger,
OptionsManager $optionsManager,
@ -73,13 +80,13 @@ class Plugin
// $hola = PHP_SAPI;
// $this->logger->info('valor de PHP_SAPI: ' . $hola);
if (PHP_SAPI === 'fpm-fcgi') {
$this->logger->debug('Whatsapp over HTTP started');
//$this->logger->debug('Whatsapp over HTTP started');
$this->processHttpRequest();
$this->logger->debug('HTTP request processing ended.');
//$this->logger->debug('HTTP request processing ended.');
} elseif (PHP_SAPI === 'cli') {
$this->logger->debug('Whatsapp over CLI started');
//$this->logger->debug('Whatsapp over CLI started');
$this->processCli();
$this->logger->debug('CLI process ended.');
//$this->logger->debug('CLI process ended.');
} else {
throw new \UnexpectedValueException('Unknown PHP_SAPI type: ' . PHP_SAPI);
}
@ -111,83 +118,134 @@ class Plugin
return;
}
$event_json = json_decode($userInput);
$webhook_string = json_encode($event_json);
$this->logger->debug("El valor del evento recibio en json: " . $webhook_string . PHP_EOL);
// Maneja el evento del webhook
if ($event_json) {
switch ($event_json->type) {
case 'customer_cash_balance_transaction.created':
$this->logger->info('Evento de transfencia al cliente encontrado');
$this->logger->info('Valor del EventJSON: ' . json_encode($event_json) . PHP_EOL);
$this->pluginNotifierFacade->createPaymentIntent($event_json);
break;
case 'inbound_payment.payment_attempt':
$this->logger->info('Evento de Pagode OXXO recibido');
$this->logger->info('Valor del EventJSON: ' . json_encode($event_json) . PHP_EOL);
break;
case 'energy.alert':
$this->logger->info('Evento de Energía recibido: ' . $event_json->message . PHP_EOL);
break;
case 'oxxo.request':
$this->logger->info('Evento de referencia de oxxo recibido: ' . PHP_EOL);
// Construir la URL basada en el "client_id"
// $url = "https://siip.mx/wp/wp-content/uploads/img/voucher.png";
$url = $this->pluginOxxoNotifierFacade->createOxxoPaymentIntent($event_json);
// Crear una respuesta en formato JSON
// $response = [
// 'event' => 'response.siip',
// 'status' => 'success',
// 'url' => $url
// ];
$jsonData = @json_decode($userInput, true, 50);
$response = '{' .
'"url": "' . $url . '"' .
'}';
$this->logger->debug('Este ese el reponse que se envía a CallBell: ' . $response);
// $json_codificado = json_encode($response);
// if (json_last_error() !== JSON_ERROR_NONE) {
// $this->logger->error('Error en la codificación JSON: ' . json_last_error_msg() . PHP_EOL);
// }
//$this->logger->info('Se está enviando esta respuesta: ' . json_encode($json_codificado) . PHP_EOL);
// Enviar el encabezado de respuesta como JSON
header('Content-Type: application/json');
// Enviar la respuesta en formato JSON
//echo json_encode($response);
echo $response;
break;
// Otros eventos relevantes
}
}
$jsonData = @json_decode($userInput, true, 10);
if (!isset($jsonData['uuid'])) {
$this->logger->error('JSON error: ' . json_last_error_msg());
$this->logger->info('No UUID found in the webhook data');
//$this->logger->error('JSON error: ' . json_last_error_msg());
//return;
// Maneja el evento del webhook externo
if ($jsonData) {
switch ($jsonData['type']) {
case 'customer_cash_balance_transaction.created':
$this->logger->info('Evento de transfencia al cliente encontrado');
$this->logger->info('Valor del EventJSON: ' . json_encode($jsonData) . PHP_EOL);
$this->pluginNotifierFacade->createPaymentIntent($jsonData);
break;
case 'inbound_payment.payment_attempt':
$this->logger->info('Evento de Pago de OXXO recibido');
$this->logger->info('Valor del EventJSON: ' . json_encode($jsonData) . PHP_EOL);
break;
case 'energy.alert':
$this->logger->info('Evento de Energía recibido: ' . $jsonData['message'] . PHP_EOL);
break;
case 'oxxo.request':
$this->logger->info('Evento de referencia de oxxo recibido' . PHP_EOL);
// Construir la URL basada en el "client_id"
// $url = "https://siip.mx/wp/wp-content/uploads/img/voucher.png";
if (!empty($jsonData['amount'])) {
$this->logger->info('Referencia persnoalizada, Valor del monto: ' . $jsonData['amount'] . PHP_EOL);
$intentos = 0;
do {
// if ($intentos > 1) {
// sleep(2);
// }
$responseOxxo = $this->pluginOxxoNotifierFacade->createOxxoPaymentIntent($jsonData, $jsonData['amount']);
$this->logger->info('Referencia personalizada, Valor de la respuesta: ' . json_encode($responseOxxo) . PHP_EOL);
//El array asociativo $responseOxxo es un array asosiativo con los siguientes campos: oxxo_reference, error, failDescription, clientID, amount
$intentos++;
} while (strpos($responseOxxo['url'], 'https') !== 0 && $intentos < 3); //Mientras la url no contenga https y el número de intentos sea menor a 3
} else {
$intentos = 0;
do {
// if ($intentos > 1) {
// sleep(2);
// }
$responseOxxo = $this->pluginOxxoNotifierFacade->createOxxoPaymentIntent($jsonData);
//El array asociativo $responseOxxo es un array asosiativo con los siguientes campos: oxxo_reference, error, failDescription, clientID, amount
$intentos++;
} while (strpos($responseOxxo['url'], 'https') !== 0 && $intentos < 3); //Mientras la url no contenga https y el número de intentos sea menor a 3
}
//El array asociativo $responseOxxo es un array asosiativo con los siguientes campos: oxxo_reference, error, failDescription, clientID, amount
//Si la respuesta no contiene https, se genera un error
if (strpos($responseOxxo['url'], 'https') !== 0) {
//this->logger->error('Error al crear la referencia de OXXO: ' . $responseOxxo);
//crear un json con variable $response que contenga las claves y valores del array $responseOxxo los cuales son: oxxo_reference, error, failDescription, clientID, clientFullName amount
$response = '{' .
'"url":' . $responseOxxo['url'] . ',' .
'"error": "' . $responseOxxo['error'] . '",' .
'"failDescription": "' . $responseOxxo['failDescription'] . '",' .
'"clientID": "' . $responseOxxo['clientID'] . '",' .
'"clientFullName": "' . $responseOxxo['clientFullName'] . '",' .
'"amount": "' . $responseOxxo['amount'] . '",' .
'}';
header('Content-Type: application/json');
echo $response;
break;
} else {
//crear un json con variable $response que contenga las claves y valores del array $responseOxxo los cuales son: oxxo_reference, error, failDescription, clientID, clientFullName, amount
$response = '{' .
'"url": "' . $responseOxxo['url'] . '",' .
'"oxxo_reference": "' . $responseOxxo['oxxo_reference'] . '",' .
'"error": "' . $responseOxxo['error'] . '",' .
'"failDescription": "' . $responseOxxo['failDescription'] . '",' .
'"clientID": "' . $responseOxxo['clientID'] . '",' .
'"clientFullName": "' . $responseOxxo['clientFullName'] . '",' .
'"amount": "' . $responseOxxo['amount'] . '"' .
'}';
$this->logger->debug('Reponse que se envía a CallBell: ' . $response);
// Enviar el encabezado de respuesta como JSON
header('Content-Type: application/json');
// Enviar la respuesta en formato JSON
//echo json_encode($response);
echo $response;
break;
}
}
}
return;
}
// $event_json = json_decode($userInput);
// $webhook_string = json_encode($event_json);
// $this->logger->debug("El valor de webhook_string: " . $webhook_string . PHP_EOL);
$notification = $this->notificationDataFactory->getObject($jsonData);
$this->logger->debug('valor el evento recibido por webhook: ' . $notification->eventName . PHP_EOL);
$this->logger->debug('Valor de JSON: ' . json_encode($jsonData) . PHP_EOL);
if ($notification->changeType === 'test') {
$configManager = \Ubnt\UcrmPluginSdk\Service\PluginConfigManager::create();
$config = $configManager->loadConfig();
$this->logger->info('Webhook test successful.');
return;
}
if (!$notification->clientId) {
$this->logger->warning('No client specified, cannot notify them.');
// if (!$notification->clientId) {
// $this->logger->warning('No client specified, cannot notify them.');
return;
}
// return;
// }
$configManager = \Ubnt\UcrmPluginSdk\Service\PluginConfigManager::create();
$config = $configManager->loadConfig();
@ -198,14 +256,14 @@ class Plugin
if ($notification->eventName === 'payment.add') {
$result = json_encode($notification);
$this->logger->debug('datos del notification para el invoice add:' . $result . PHP_EOL);
$this->logger->debug('Notification encodificado en JSON:' . $result . PHP_EOL);
$datos_payment = $notification->paymentData;
$this->logger->debug('valor del payment data: ' . json_encode($datos_payment) . PHP_EOL);
$payment_method_id = $notification->paymentData['methodId'];
//$this->logger->debug('Metodo de pago: ' . $notification->paymentData['methodId'] . PHP_EOL);
$payment_method = '';
@ -287,11 +345,114 @@ class Plugin
} else if ($notification->eventName === 'client.edit') {
$this->logger->debug('Se actualiza a un cliente' . PHP_EOL);
$this->logger->debug('Se actualiza a un cliente');
$this->logger->debug('Valor de json_data: ' . json_encode($jsonData));
//ejemplo de json_data: {"uuid":"17e043a7-03b5-4312-ab81-a7818124a77e","changeType":"edit","entity":"client","entityId":"158","eventName":"client.edit","extraData":{"entity":{"id":158,"userIdent":null,"previousIsp":null,"isLead":false,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"23 San Luis","street2":null,"city":"Dolores Hidalgo Cuna de la Independencia Nacional","countryId":173,"stateId":null,"zipCode":"37804","fullAddress":"San Luis 23, Guadalupe, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":null,"sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2025-01-06T00:00:00-0600","leadConvertedAt":"2025-02-09T03:15:49-0600","companyContactFirstName":null,"companyContactLastName":null,"isActive":false,"firstName":"Luis","lastName":"Guti\u00e9rrez","username":null,"contacts":[{"id":162,"clientId":158,"email":null,"phone":null,"name":null,"isBilling":true,"isContact":true,"types":[{"id":1,"name":"Billing"},{"id":2,"name":"General"}]}],"attributes":[],"accountBalance":0,"accountCredit":0,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[],"invitationEmailSentDate":null,"avatarColor":"#2196f3","addressGpsLat":21.153272,"addressGpsLon":-100.9134508,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":false,"hasSuspendedService":false,"hasServiceWithoutDevices":false,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false},"entityBeforeEdit":{"id":158,"userIdent":null,"previousIsp":null,"isLead":true,"clientType":1,"companyName":null,"companyRegistrationNumber":null,"companyTaxId":null,"companyWebsite":null,"street1":"23 San Luis","street2":null,"city":"Dolores Hidalgo Cuna de la Independencia Nacional","countryId":173,"stateId":null,"zipCode":"37804","fullAddress":"San Luis 23, Guadalupe, Dolores Hidalgo Cuna de la Independencia Nacional, Gto., M\u00e9xico","invoiceStreet1":null,"invoiceStreet2":null,"invoiceCity":null,"invoiceStateId":null,"invoiceCountryId":null,"invoiceZipCode":null,"invoiceAddressSameAsContact":true,"note":null,"sendInvoiceByPost":null,"invoiceMaturityDays":null,"stopServiceDue":null,"stopServiceDueDays":null,"organizationId":1,"tax1Id":null,"tax2Id":null,"tax3Id":null,"registrationDate":"2025-01-06T00:00:00-0600","leadConvertedAt":null,"companyContactFirstName":null,"companyContactLastName":null,"isActive":false,"firstName":"Luis","lastName":"Guti\u00e9rrez","username":null,"contacts":[{"id":162,"clientId":158,"email":null,"phone":null,"name":null,"isBilling":true,"isContact":true,"types":[{"id":1,"name":"Billing"},{"id":2,"name":"General"}]}],"attributes":[],"accountBalance":0,"accountCredit":0,"accountOutstanding":0,"currencyCode":"MXN","organizationName":"SIIP Pruebas","bankAccounts":[],"tags":[],"invitationEmailSentDate":null,"avatarColor":"#2196f3","addressGpsLat":21.153272,"addressGpsLon":-100.9134508,"isArchived":false,"generateProformaInvoices":null,"usesProforma":false,"hasOverdueInvoice":false,"hasOutage":false,"hasSuspendedService":false,"hasServiceWithoutDevices":false,"referral":null,"hasPaymentSubscription":false,"hasAutopayCreditCard":false}}}
// Validar que 'extraData' existe y contiene las claves necesarias
if (
isset($jsonData['extraData']['entityBeforeEdit']) &&
isset($jsonData['extraData']['entity'])
) {
$entityBeforeEdit = $jsonData['extraData']['entityBeforeEdit'];
$entity = $jsonData['extraData']['entity'];
$this->logger->debug('Validando claves dentro de entityBeforeEdit y entity');
// Validar si 'isLead' esta en true en entityBeforeEdit y en false en entity
if (array_key_exists('isLead', $entityBeforeEdit) && array_key_exists('isLead', $entity)) {
$this->logger->debug('Los datos entityBeforeEdit y entity contienen el campo isLead');
$isLeadBefore = $entityBeforeEdit['isLead'];
$isLeadAfter = $entity['isLead'];
// Comprobar si 'isLead' cambió de true a false
if ($isLeadBefore === true && $isLeadAfter === false) {
$this->logger->debug('El cliente cambió de potencial a cliente');
$this->pluginNotifierFacade->createStripeClient($notification);
} else {
$this->logger->debug('El cliente no cambió de potencial a cliente');
}
} else {
$this->logger->warning('El campo isLead no existe en entityBeforeEdit o entity');
}
// buscar si existe la etiqueta 'STRIPE' en entity pero no en entityBeforeEdit
$tags = $jsonData['extraData']['entity']['tags'];
$tagsBefore = $jsonData['extraData']['entityBeforeEdit']['tags'];
$this->logger->debug('Validando claves dentro de entity y entityBeforeEdit');
// Validar que 'tags' existe en ambas entidades
if (array_key_exists('tags', $jsonData['extraData']['entity']) && array_key_exists('tags', $jsonData['extraData']['entityBeforeEdit'])) {
$this->logger->debug('Los datos entity y entityBeforeEdit contienen el campo tags');
$tags = $jsonData['extraData']['entity']['tags'];
$tagsBefore = $jsonData['extraData']['entityBeforeEdit']['tags'];
$this->logger->debug('Validando si la etiqueta STRIPE existe en entity pero no en entityBeforeEdit');
// Comprobar si la etiqueta 'STRIPE' existe en 'tags' pero no en 'tagsBefore'
$stripeTagExists = false;
$stripeTagExistsBefore = false;
foreach ($tags as $tag) {
if ($tag['name'] === 'CREARCLABESTRIPE') {
$stripeTagExists = true;
break;
}
}
foreach ($tagsBefore as $tag) {
if ($tag['name'] === 'CREARCLABESTRIPE') {
$stripeTagExistsBefore = true;
break;
}
}
// Comprobar si la etiqueta 'STRIPE' existe en 'tags' pero no en 'tagsBefore'
if ($stripeTagExists && !$stripeTagExistsBefore) {
$this->logger->debug('La etiqueta STRIPE se agregará al cliente');
$this->pluginNotifierFacade->createStripeClient($notification, true);
} else {
$this->logger->debug('La etiqueta STRIPE no se agregó al cliente');
}
} else {
$this->logger->warning('El campo tags no existe en entity o entityBeforeEdit');
}
} else {
$this->logger->warning('Los datos entityBeforeEdit o entity no están presentes en extraData');
}
$this->notifierFacade->verifyClientActionToDo($notification);
} else if ($notification->eventName === 'client.add') {
$this->logger->debug('Se agregó un nuevo cliente' . PHP_EOL);
$this->pluginNotifierFacade->createStripeClient($notification);
$this->logger->debug('Valor de json_data: ' . json_encode($jsonData));
// Verificar que existen tanto 'entityBeforeEdit' como 'entity'
// if (isset($jsonData['extraData']['entity']['isLead'])) {
// $this->logger->debug('El campo isLead existe en los datos del evento');
// $isLead = $jsonData['extraData']['entity']['isLead'];
// // Comprobar si 'isLead' es true
// if ($isLead === true) {
// $this->logger->debug('El cliente es potencial');
// $this->pluginNotifierFacade->createStripeClient($notification);
// } else {
// $this->logger->debug('El cliente no es potencial');
// $this->pluginNotifierFacade->createStripeClient($notification);
// }
// } else {
// $this->logger->warning('El campo isLead no existe en los datos del evento');
// }
} else if ($notification->eventName === 'service.edit') {
$this->logger->debug('Se editó el servicio a un cliente' . PHP_EOL);
$this->notifierFacade->verifyServiceActionToDo($notification);
} else if ($notification->eventName === 'service.suspend') {
$this->logger->debug('Se suspendió el servicio a un cliente' . PHP_EOL);
$this->notifierFacade->verifyServiceActionToDo($notification);
@ -301,7 +462,7 @@ class Plugin
} else if ($notification->eventName === 'service.postpone') {
$this->logger->debug('Se pospuso la suspención del servicio a un cliente' . PHP_EOL);
$this->notifierFacade->verifyServiceActionToDo($notification);
}else if ($notification->eventName === 'invoice.near_due') {
} else if ($notification->eventName === 'invoice.near_due') {
$this->logger->debug('Factura casi por vencer' . PHP_EOL);
$this->notifierFacade->notifyOverDue($notification);
} else if ($notification->eventName === 'invoice.overdue') {
@ -315,13 +476,95 @@ class Plugin
$this->logger->debug('datos del notification para el invoice add:' . $result . PHP_EOL);
$accountBalance = $notification->clientData['accountBalance'];
$invoiceAmountPaid = $notification->invoiceData['amountPaid'];
//$invoiceAmountPaid = $notification->invoiceData['amountPaid'];
$this->logger->debug("Account Balance: " . $accountBalance . PHP_EOL);
$this->logger->debug("Pago hecho con la factura: " . $invoiceAmountPaid . PHP_EOL);
// $this->logger->debug("Pago hecho con la factura: " . $invoiceAmountPaid . PHP_EOL);
$this->notifierFacade->verifyInvoiceActionToDo($notification);
}else if($notification->eventName === 'invoice.edit'){
} else if ($notification->eventName === 'invoice.edit') {
$this->logger->debug('Edición de Factura' . PHP_EOL);
$this->notifierFacade->verifyInvoiceActionToDo($notification);
} else if ($notification->eventName === 'invoice.add_draft') {
$this->logger->debug('Adición de borrador de Factura' . PHP_EOL);
$this->notifierFacade->verifyInvoiceActionToDo($notification);
} else if ($notification->eventName === 'invoice.draft_approved') {
$this->logger->debug('Aprobación de Factura' . PHP_EOL);
$this->notifierFacade->verifyInvoiceActionToDo($notification);
} else if ($notification->eventName === 'invoice.delete') {
$this->logger->debug('Eliminación de Factura' . PHP_EOL);
$this->notifierFacade->verifyInvoiceActionToDo($notification);
} else if ($notification->eventName === 'job.add') {
$this->logger->debug('Se ha agregado un nuevo trabajo' . PHP_EOL);
// Verificar que existen tanto 'assignedUserId' como 'entity'
if (isset($jsonData['extraData']['entity']['assignedUserId'])) {
$this->logger->debug('El campo assignedUserId existe en los datos del evento');
$assignedUserId = $jsonData['extraData']['entity']['assignedUserId'];
// Comprobar si 'isLead' es null
if ($assignedUserId === null) {
$this->logger->debug('El campo assignedUserId es null');
$this->pluginNotifierFacade->createStripeClient($notification);
} else {
$this->logger->debug('El campo assignedUserId no es null');
$this->notifierFacade->verifyJobActionToDo($notification);
}
} else {
$this->logger->warning('El campo assignedUserId no existe en los datos del evento');
}
} else if ($notification->eventName === 'job.edit') {
$this->logger->debug('Se actualiza un trabajo' . PHP_EOL);
$this->logger->debug('Valor de json_data: ' . json_encode($jsonData));
// Validar que 'extraData' existe y contiene las claves necesarias
if (
isset($jsonData['extraData']['entityBeforeEdit']) &&
isset($jsonData['extraData']['entity'])
) {
$entityBeforeEdit = $jsonData['extraData']['entityBeforeEdit'];
$entity = $jsonData['extraData']['entity'];
$this->logger->debug('Validando claves dentro de entityBeforeEdit y entity');
// Validar que 'assignedUserId' existe en ambas entidades
if (array_key_exists('assignedUserId', $entityBeforeEdit) && array_key_exists('assignedUserId', $entity)) {
$this->logger->debug('Los datos entityBeforeEdit y entity contienen el campo assignedUserId');
$assignedUserIdBefore = $entityBeforeEdit['assignedUserId'];
$assignedUserIdAfter = $entity['assignedUserId'];
$dateBefore = $entityBeforeEdit['date'];
$dateAfter = $entity['date'];
$statusBefore = $entityBeforeEdit['status'];
$statusAfter = $entity['status'];
// Comprobar si 'assignedUserId' cambió
if ($assignedUserIdBefore === null && $assignedUserIdAfter != null) { //Si el campo "assignedUserId" cambió de null a un valor
$this->logger->debug('El instalador cambió de null a un valor');
$this->notifierFacade->verifyJobActionToDo($jsonData); // Se envía notificación de trabajo asignado
} else if (($assignedUserIdBefore != null && $assignedUserIdAfter != $assignedUserIdBefore) && ($dateBefore === $dateAfter)) {//Si el campo "assignedUserId" cambió de un valor a otro y la fecha no cambió
$this->logger->debug('El instalador cambió y la fecha no cambió');
$this->notifierFacade->verifyJobActionToDo($jsonData, false, true); // Se envía notificación de trabajo reasignado
} else if (($assignedUserIdBefore != null && $assignedUserIdBefore === $assignedUserIdAfter) && ($dateBefore != $dateAfter)) {//Si el campo "assignedUserId" no cambió y la fecha cambió
$this->logger->debug('El instalador no cambió y la fecha sí cambió');
$this->notifierFacade->verifyJobActionToDo($jsonData, true, false); // Se envía notificación de reprogramación de trabajo
} else if (($assignedUserIdBefore != null && $assignedUserIdAfter != $assignedUserIdBefore) && ($dateBefore != $dateAfter)) {
$this->logger->debug('El instalador cambió y la fecha sí cambió');
$this->notifierFacade->verifyJobActionToDo($jsonData, true, true); // Se envía notificación de trabajo reasignado
} else if ($assignedUserIdBefore != null && $assignedUserIdAfter === null) { //Si el campo "assignedUserId" cambió de un valor a null
$this->logger->debug('El instalador cambió de un valor a null');
$this->notifierFacade->verifyJobActionToDo($jsonData, null, true); // Se envía notificación de trabajo desasignado
} else {
$this->logger->debug('No hubo cambio en el instalador ni en la fecha');
}
} else {
$this->logger->warning('El campo assignedUserId no existe en entityBeforeEdit o entity');
}
} else {
$this->logger->warning('Los datos entityBeforeEdit o entity no están presentes en extraData');
}
}

View File

@ -33,27 +33,72 @@ class SmsNumberProvider
/*
* go through client's contacts and find an applicable one, if any
*/
public function getUcrmClientNumbers(NotificationData $notificationData)
{
// Array asociativo donde almacenarás los números de teléfono con sus tipos correspondientes
$arrayPhones = [];
public function getUcrmClientNumbers(NotificationData $notificationData = null, $arrayClientCRM = null)
{
$log = PluginLogManager::create(); //Initialize Logger
$arrayPhones = [];
// Recorrer los contactos del cliente para encontrar los teléfonos con sus tipos
foreach ($notificationData->clientData['contacts'] as $contact) {
if (!empty($contact['phone'])) { // Verificar que el teléfono no esté vacío
if (isset($contact['types']) && is_array($contact['types'])) { // Verificar que 'types' exista y sea un array
if ($arrayClientCRM != null) {
foreach ($arrayClientCRM['contacts'] as $contact) {
if (!empty($contact['phone'])) {
if (isset($contact['types']) && is_array($contact['types'])) {
foreach ($contact['types'] as $type) {
if (in_array($type['name'], ['WhatsApp', 'WhatsNotifica', 'WhatsActualiza'])) {
// Si el tipo de contacto es uno de los deseados, agregamos al array asociativo
$arrayPhones[$type['name']] = $contact['phone'];
if (in_array($type['name'], ['WhatsApp', 'WhatsNotifica'])) {
// Almacena varios números bajo el mismo tipo
$arrayPhones[$type['name']][] = $contact['phone'];
}
}
}
}
}
} else {
foreach ($notificationData->clientData['contacts'] as $contact) {
if (!empty($contact['phone'])) {
if (isset($contact['types']) && is_array($contact['types'])) {
foreach ($contact['types'] as $type) {
if (in_array($type['name'], ['WhatsApp', 'WhatsNotifica', 'WhatsActualiza'])) {
// Almacena varios números bajo el mismo tipo
$arrayPhones[$type['name']][] = $contact['phone'];
}
}
}
}
}
}
return $arrayPhones; // Devolver el arreglo de teléfonos por tipo
}
/*
* go through client's contacts and find an applicable one, if any
*/
public function getAllUcrmClientNumbers($arrayClientCRM = null)
{
$log = PluginLogManager::create(); //Initialize Logger
//$log->appendLog("Ejecutando metodo getUcrmClientNumbers: " . json_encode($arrayClientCRM) . PHP_EOL);
// Array asociativo donde almacenarás los números de teléfono con sus tipos correspondientes
$arrayPhones = [];
//$log->appendLog("Entrando al if del método getUcrmClientNumbers: " . $arrayClientCRM . PHP_EOL);
//$jsonNotificationData = json_decode($jsonNotificationData, true);
// Recorrer los contactos del cliente para encontrar los teléfonos con sus tipos
foreach ($arrayClientCRM['contacts'] as $contact) {
if (!empty($contact['phone'])) { // Verificar que el teléfono no esté vacío
// agregamos al array asociativo
$arrayPhones[] = $contact['phone'];
}
}
return $arrayPhones; // Devolver el arreglo de teléfonos por tipo
}
/*
* not every contact has a phone; also check if the type of notification is applicable to contact
*/
@ -94,18 +139,17 @@ class SmsNumberProvider
}
return false;
}
case 'service':
{
case 'service': {
$types = $contact['types'] ?? [];
foreach ($types as $type) {
//$log->appendLog("Entrando al case client del switch: " . json_encode($type));
if ($type['name'] == 'WhatsApp') {
return true;
}
$types = $contact['types'] ?? [];
foreach ($types as $type) {
//$log->appendLog("Entrando al case client del switch: " . json_encode($type));
if ($type['name'] == 'WhatsApp') {
return true;
}
return false;
}
return false;
}
default:
return $contact['isContact'] ?? false;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2,17 +2,17 @@
"packages": [
{
"name": "firebase/php-jwt",
"version": "v6.10.1",
"version_normalized": "6.10.1.0",
"version": "v6.10.2",
"version_normalized": "6.10.2.0",
"source": {
"type": "git",
"url": "https://github.com/firebase/php-jwt.git",
"reference": "500501c2ce893c824c801da135d02661199f60c5"
"reference": "30c19ed0f3264cb660ea496895cfb6ef7ee3653b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/firebase/php-jwt/zipball/500501c2ce893c824c801da135d02661199f60c5",
"reference": "500501c2ce893c824c801da135d02661199f60c5",
"url": "https://api.github.com/repos/firebase/php-jwt/zipball/30c19ed0f3264cb660ea496895cfb6ef7ee3653b",
"reference": "30c19ed0f3264cb660ea496895cfb6ef7ee3653b",
"shasum": ""
},
"require": {
@ -30,7 +30,7 @@
"ext-sodium": "Support EdDSA (Ed25519) signatures",
"paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present"
},
"time": "2024-05-18T18:05:11+00:00",
"time": "2024-11-24T11:22:49+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -62,41 +62,41 @@
],
"support": {
"issues": "https://github.com/firebase/php-jwt/issues",
"source": "https://github.com/firebase/php-jwt/tree/v6.10.1"
"source": "https://github.com/firebase/php-jwt/tree/v6.10.2"
},
"install-path": "../firebase/php-jwt"
},
{
"name": "google/apiclient",
"version": "v2.16.0",
"version_normalized": "2.16.0.0",
"version": "v2.18.2",
"version_normalized": "2.18.2.0",
"source": {
"type": "git",
"url": "https://github.com/googleapis/google-api-php-client.git",
"reference": "017400f609c1fb71ab5ad824c50eabd4c3eaf779"
"reference": "d8d201ba8a189a3cd7fb34e4da569f2ed440eee7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/googleapis/google-api-php-client/zipball/017400f609c1fb71ab5ad824c50eabd4c3eaf779",
"reference": "017400f609c1fb71ab5ad824c50eabd4c3eaf779",
"url": "https://api.github.com/repos/googleapis/google-api-php-client/zipball/d8d201ba8a189a3cd7fb34e4da569f2ed440eee7",
"reference": "d8d201ba8a189a3cd7fb34e4da569f2ed440eee7",
"shasum": ""
},
"require": {
"firebase/php-jwt": "~6.0",
"firebase/php-jwt": "^6.0",
"google/apiclient-services": "~0.350",
"google/auth": "^1.37",
"guzzlehttp/guzzle": "^6.5.8||^7.4.5",
"guzzlehttp/psr7": "^1.9.1||^2.2.1",
"guzzlehttp/guzzle": "^7.4.5",
"guzzlehttp/psr7": "^2.6",
"monolog/monolog": "^2.9||^3.0",
"php": "^7.4|^8.0",
"php": "^8.0",
"phpseclib/phpseclib": "^3.0.36"
},
"require-dev": {
"cache/filesystem-adapter": "^1.1",
"composer/composer": "^1.10.23",
"phpcompatibility/php-compatibility": "^9.2",
"phpspec/prophecy-phpunit": "^2.0",
"phpunit/phpunit": "^9.5",
"phpspec/prophecy-phpunit": "^2.1",
"phpunit/phpunit": "^9.6",
"squizlabs/php_codesniffer": "^3.8",
"symfony/css-selector": "~2.1",
"symfony/dom-crawler": "~2.1"
@ -104,7 +104,7 @@
"suggest": {
"cache/filesystem-adapter": "For caching certs and tokens (using Google\\Client::setCache)"
},
"time": "2024-04-24T00:59:47+00:00",
"time": "2024-12-16T22:52:40+00:00",
"type": "library",
"extra": {
"branch-alias": {
@ -134,23 +134,23 @@
],
"support": {
"issues": "https://github.com/googleapis/google-api-php-client/issues",
"source": "https://github.com/googleapis/google-api-php-client/tree/v2.16.0"
"source": "https://github.com/googleapis/google-api-php-client/tree/v2.18.2"
},
"install-path": "../google/apiclient"
},
{
"name": "google/apiclient-services",
"version": "v0.359.0",
"version_normalized": "0.359.0.0",
"version": "v0.389.0",
"version_normalized": "0.389.0.0",
"source": {
"type": "git",
"url": "https://github.com/googleapis/google-api-php-client-services.git",
"reference": "e975e6d0efa47f7e49280c4ea7fd6a93b6d7e338"
"reference": "6274e67ee52b1a416ccee0a4eaf337d1139cdaf8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/e975e6d0efa47f7e49280c4ea7fd6a93b6d7e338",
"reference": "e975e6d0efa47f7e49280c4ea7fd6a93b6d7e338",
"url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/6274e67ee52b1a416ccee0a4eaf337d1139cdaf8",
"reference": "6274e67ee52b1a416ccee0a4eaf337d1139cdaf8",
"shasum": ""
},
"require": {
@ -159,7 +159,7 @@
"require-dev": {
"phpunit/phpunit": "^9.6"
},
"time": "2024-06-10T01:02:17+00:00",
"time": "2025-01-05T01:04:21+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -181,30 +181,30 @@
],
"support": {
"issues": "https://github.com/googleapis/google-api-php-client-services/issues",
"source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.359.0"
"source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.389.0"
},
"install-path": "../google/apiclient-services"
},
{
"name": "google/auth",
"version": "v1.40.0",
"version_normalized": "1.40.0.0",
"version": "v1.44.0",
"version_normalized": "1.44.0.0",
"source": {
"type": "git",
"url": "https://github.com/googleapis/google-auth-library-php.git",
"reference": "bff9f2d01677e71a98394b5ac981b99523df5178"
"reference": "5670e56307d7a2eac931f677c0e59a4f8abb2e43"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/bff9f2d01677e71a98394b5ac981b99523df5178",
"reference": "bff9f2d01677e71a98394b5ac981b99523df5178",
"url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/5670e56307d7a2eac931f677c0e59a4f8abb2e43",
"reference": "5670e56307d7a2eac931f677c0e59a4f8abb2e43",
"shasum": ""
},
"require": {
"firebase/php-jwt": "^6.0",
"guzzlehttp/guzzle": "^7.4.5",
"guzzlehttp/psr7": "^2.4.5",
"php": "^8.0",
"php": "^8.1",
"psr/cache": "^2.0||^3.0",
"psr/http-message": "^1.1||^2.0"
},
@ -222,7 +222,7 @@
"suggest": {
"phpseclib/phpseclib": "May be used in place of OpenSSL for signing strings or for token management. Please require version ^2."
},
"time": "2024-05-31T19:16:15+00:00",
"time": "2024-12-04T15:34:58+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -244,29 +244,29 @@
"support": {
"docs": "https://googleapis.github.io/google-auth-library-php/main/",
"issues": "https://github.com/googleapis/google-auth-library-php/issues",
"source": "https://github.com/googleapis/google-auth-library-php/tree/v1.40.0"
"source": "https://github.com/googleapis/google-auth-library-php/tree/v1.44.0"
},
"install-path": "../google/auth"
},
{
"name": "guzzlehttp/guzzle",
"version": "7.8.1",
"version_normalized": "7.8.1.0",
"version": "7.9.2",
"version_normalized": "7.9.2.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "41042bc7ab002487b876a0683fc8dce04ddce104"
"reference": "d281ed313b989f213357e3be1a179f02196ac99b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/41042bc7ab002487b876a0683fc8dce04ddce104",
"reference": "41042bc7ab002487b876a0683fc8dce04ddce104",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/d281ed313b989f213357e3be1a179f02196ac99b",
"reference": "d281ed313b989f213357e3be1a179f02196ac99b",
"shasum": ""
},
"require": {
"ext-json": "*",
"guzzlehttp/promises": "^1.5.3 || ^2.0.1",
"guzzlehttp/psr7": "^1.9.1 || ^2.5.1",
"guzzlehttp/promises": "^1.5.3 || ^2.0.3",
"guzzlehttp/psr7": "^2.7.0",
"php": "^7.2.5 || ^8.0",
"psr/http-client": "^1.0",
"symfony/deprecation-contracts": "^2.2 || ^3.0"
@ -277,9 +277,9 @@
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8.2",
"ext-curl": "*",
"php-http/client-integration-tests": "dev-master#2c025848417c1135031fdf9c728ee53d0a7ceaee as 3.0.999",
"guzzle/client-integration-tests": "3.0.2",
"php-http/message-factory": "^1.1",
"phpunit/phpunit": "^8.5.36 || ^9.6.15",
"phpunit/phpunit": "^8.5.39 || ^9.6.20",
"psr/log": "^1.1 || ^2.0 || ^3.0"
},
"suggest": {
@ -287,7 +287,7 @@
"ext-intl": "Required for Internationalized Domain Name (IDN) support",
"psr/log": "Required for using the Log middleware"
},
"time": "2023-12-03T20:35:24+00:00",
"time": "2024-07-24T11:22:20+00:00",
"type": "library",
"extra": {
"bamarni-bin": {
@ -359,7 +359,7 @@
],
"support": {
"issues": "https://github.com/guzzle/guzzle/issues",
"source": "https://github.com/guzzle/guzzle/tree/7.8.1"
"source": "https://github.com/guzzle/guzzle/tree/7.9.2"
},
"funding": [
{
@ -379,17 +379,17 @@
},
{
"name": "guzzlehttp/promises",
"version": "2.0.2",
"version_normalized": "2.0.2.0",
"version": "2.0.4",
"version_normalized": "2.0.4.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/promises.git",
"reference": "bbff78d96034045e58e13dedd6ad91b5d1253223"
"reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/promises/zipball/bbff78d96034045e58e13dedd6ad91b5d1253223",
"reference": "bbff78d96034045e58e13dedd6ad91b5d1253223",
"url": "https://api.github.com/repos/guzzle/promises/zipball/f9c436286ab2892c7db7be8c8da4ef61ccf7b455",
"reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455",
"shasum": ""
},
"require": {
@ -397,9 +397,9 @@
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8.2",
"phpunit/phpunit": "^8.5.36 || ^9.6.15"
"phpunit/phpunit": "^8.5.39 || ^9.6.20"
},
"time": "2023-12-03T20:19:20+00:00",
"time": "2024-10-17T10:06:22+00:00",
"type": "library",
"extra": {
"bamarni-bin": {
@ -445,7 +445,7 @@
],
"support": {
"issues": "https://github.com/guzzle/promises/issues",
"source": "https://github.com/guzzle/promises/tree/2.0.2"
"source": "https://github.com/guzzle/promises/tree/2.0.4"
},
"funding": [
{
@ -465,17 +465,17 @@
},
{
"name": "guzzlehttp/psr7",
"version": "2.6.2",
"version_normalized": "2.6.2.0",
"version": "2.7.0",
"version_normalized": "2.7.0.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/psr7.git",
"reference": "45b30f99ac27b5ca93cb4831afe16285f57b8221"
"reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/45b30f99ac27b5ca93cb4831afe16285f57b8221",
"reference": "45b30f99ac27b5ca93cb4831afe16285f57b8221",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/a70f5c95fb43bc83f07c9c948baa0dc1829bf201",
"reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201",
"shasum": ""
},
"require": {
@ -490,13 +490,13 @@
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8.2",
"http-interop/http-factory-tests": "^0.9",
"phpunit/phpunit": "^8.5.36 || ^9.6.15"
"http-interop/http-factory-tests": "0.9.0",
"phpunit/phpunit": "^8.5.39 || ^9.6.20"
},
"suggest": {
"laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
},
"time": "2023-12-03T20:05:35+00:00",
"time": "2024-07-18T11:15:46+00:00",
"type": "library",
"extra": {
"bamarni-bin": {
@ -564,7 +564,7 @@
],
"support": {
"issues": "https://github.com/guzzle/psr7/issues",
"source": "https://github.com/guzzle/psr7/tree/2.6.2"
"source": "https://github.com/guzzle/psr7/tree/2.7.0"
},
"funding": [
{
@ -641,29 +641,30 @@
},
{
"name": "laravel/serializable-closure",
"version": "v1.3.3",
"version_normalized": "1.3.3.0",
"version": "v1.3.7",
"version_normalized": "1.3.7.0",
"source": {
"type": "git",
"url": "https://github.com/laravel/serializable-closure.git",
"reference": "3dbf8a8e914634c48d389c1234552666b3d43754"
"reference": "4f48ade902b94323ca3be7646db16209ec76be3d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/serializable-closure/zipball/3dbf8a8e914634c48d389c1234552666b3d43754",
"reference": "3dbf8a8e914634c48d389c1234552666b3d43754",
"url": "https://api.github.com/repos/laravel/serializable-closure/zipball/4f48ade902b94323ca3be7646db16209ec76be3d",
"reference": "4f48ade902b94323ca3be7646db16209ec76be3d",
"shasum": ""
},
"require": {
"php": "^7.3|^8.0"
},
"require-dev": {
"nesbot/carbon": "^2.61",
"illuminate/support": "^8.0|^9.0|^10.0|^11.0",
"nesbot/carbon": "^2.61|^3.0",
"pestphp/pest": "^1.21.3",
"phpstan/phpstan": "^1.8.2",
"symfony/var-dumper": "^5.4.11"
"symfony/var-dumper": "^5.4.11|^6.2.0|^7.0.0"
},
"time": "2023-11-08T14:08:06+00:00",
"time": "2024-11-14T18:34:49+00:00",
"type": "library",
"extra": {
"branch-alias": {
@ -704,17 +705,17 @@
},
{
"name": "monolog/monolog",
"version": "2.9.3",
"version_normalized": "2.9.3.0",
"version": "2.10.0",
"version_normalized": "2.10.0.0",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/monolog.git",
"reference": "a30bfe2e142720dfa990d0a7e573997f5d884215"
"reference": "5cf826f2991858b54d5c3809bee745560a1042a7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/a30bfe2e142720dfa990d0a7e573997f5d884215",
"reference": "a30bfe2e142720dfa990d0a7e573997f5d884215",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/5cf826f2991858b54d5c3809bee745560a1042a7",
"reference": "5cf826f2991858b54d5c3809bee745560a1042a7",
"shasum": ""
},
"require": {
@ -760,7 +761,7 @@
"rollbar/rollbar": "Allow sending log messages to Rollbar",
"ruflin/elastica": "Allow sending log messages to an Elastic Search server"
},
"time": "2024-04-12T20:52:51+00:00",
"time": "2024-11-12T12:43:37+00:00",
"type": "library",
"extra": {
"branch-alias": {
@ -793,7 +794,7 @@
],
"support": {
"issues": "https://github.com/Seldaek/monolog/issues",
"source": "https://github.com/Seldaek/monolog/tree/2.9.3"
"source": "https://github.com/Seldaek/monolog/tree/2.10.0"
},
"funding": [
{
@ -809,27 +810,27 @@
},
{
"name": "paragonie/constant_time_encoding",
"version": "v2.7.0",
"version_normalized": "2.7.0.0",
"version": "v3.0.0",
"version_normalized": "3.0.0.0",
"source": {
"type": "git",
"url": "https://github.com/paragonie/constant_time_encoding.git",
"reference": "52a0d99e69f56b9ec27ace92ba56897fe6993105"
"reference": "df1e7fde177501eee2037dd159cf04f5f301a512"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/52a0d99e69f56b9ec27ace92ba56897fe6993105",
"reference": "52a0d99e69f56b9ec27ace92ba56897fe6993105",
"url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/df1e7fde177501eee2037dd159cf04f5f301a512",
"reference": "df1e7fde177501eee2037dd159cf04f5f301a512",
"shasum": ""
},
"require": {
"php": "^7|^8"
"php": "^8"
},
"require-dev": {
"phpunit/phpunit": "^6|^7|^8|^9",
"vimeo/psalm": "^1|^2|^3|^4"
"phpunit/phpunit": "^9",
"vimeo/psalm": "^4|^5"
},
"time": "2024-05-08T12:18:48+00:00",
"time": "2024-05-08T12:36:18+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -990,17 +991,17 @@
},
{
"name": "php-di/php-di",
"version": "7.0.6",
"version_normalized": "7.0.6.0",
"version": "7.0.7",
"version_normalized": "7.0.7.0",
"source": {
"type": "git",
"url": "https://github.com/PHP-DI/PHP-DI.git",
"reference": "8097948a89f6ec782839b3e958432f427cac37fd"
"reference": "e87435e3c0e8f22977adc5af0d5cdcc467e15cf1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHP-DI/PHP-DI/zipball/8097948a89f6ec782839b3e958432f427cac37fd",
"reference": "8097948a89f6ec782839b3e958432f427cac37fd",
"url": "https://api.github.com/repos/PHP-DI/PHP-DI/zipball/e87435e3c0e8f22977adc5af0d5cdcc467e15cf1",
"reference": "e87435e3c0e8f22977adc5af0d5cdcc467e15cf1",
"shasum": ""
},
"require": {
@ -1022,7 +1023,7 @@
"suggest": {
"friendsofphp/proxy-manager-lts": "Install it if you want to use lazy injection (version ^1)"
},
"time": "2023-11-02T10:04:50+00:00",
"time": "2024-07-21T15:55:45+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -1050,7 +1051,7 @@
],
"support": {
"issues": "https://github.com/PHP-DI/PHP-DI/issues",
"source": "https://github.com/PHP-DI/PHP-DI/tree/7.0.6"
"source": "https://github.com/PHP-DI/PHP-DI/tree/7.0.7"
},
"funding": [
{
@ -1066,21 +1067,21 @@
},
{
"name": "phpseclib/phpseclib",
"version": "3.0.37",
"version_normalized": "3.0.37.0",
"version": "3.0.43",
"version_normalized": "3.0.43.0",
"source": {
"type": "git",
"url": "https://github.com/phpseclib/phpseclib.git",
"reference": "cfa2013d0f68c062055180dd4328cc8b9d1f30b8"
"reference": "709ec107af3cb2f385b9617be72af8cf62441d02"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/cfa2013d0f68c062055180dd4328cc8b9d1f30b8",
"reference": "cfa2013d0f68c062055180dd4328cc8b9d1f30b8",
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/709ec107af3cb2f385b9617be72af8cf62441d02",
"reference": "709ec107af3cb2f385b9617be72af8cf62441d02",
"shasum": ""
},
"require": {
"paragonie/constant_time_encoding": "^1|^2",
"paragonie/constant_time_encoding": "^1|^2|^3",
"paragonie/random_compat": "^1.4|^2.0|^9.99.99",
"php": ">=5.6.1"
},
@ -1094,7 +1095,7 @@
"ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.",
"ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations."
},
"time": "2024-03-03T02:14:58+00:00",
"time": "2024-12-14T21:12:59+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -1159,7 +1160,7 @@
],
"support": {
"issues": "https://github.com/phpseclib/phpseclib/issues",
"source": "https://github.com/phpseclib/phpseclib/tree/3.0.37"
"source": "https://github.com/phpseclib/phpseclib/tree/3.0.43"
},
"funding": [
{
@ -1342,24 +1343,24 @@
},
{
"name": "psr/http-factory",
"version": "1.0.2",
"version_normalized": "1.0.2.0",
"version": "1.1.0",
"version_normalized": "1.1.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-factory.git",
"reference": "e616d01114759c4c489f93b099585439f795fe35"
"reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35",
"reference": "e616d01114759c4c489f93b099585439f795fe35",
"url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a",
"reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a",
"shasum": ""
},
"require": {
"php": ">=7.0.0",
"php": ">=7.1",
"psr/http-message": "^1.0 || ^2.0"
},
"time": "2023-04-10T20:10:41+00:00",
"time": "2024-04-15T12:06:14+00:00",
"type": "library",
"extra": {
"branch-alias": {
@ -1382,7 +1383,7 @@
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interfaces for PSR-7 HTTP message factories",
"description": "PSR-17: Common interfaces for PSR-7 HTTP message factories",
"keywords": [
"factory",
"http",
@ -1394,7 +1395,7 @@
"response"
],
"support": {
"source": "https://github.com/php-fig/http-factory/tree/1.0.2"
"source": "https://github.com/php-fig/http-factory"
},
"install-path": "../psr/http-factory"
},
@ -1618,31 +1619,31 @@
},
{
"name": "symfony/deprecation-contracts",
"version": "v3.4.0",
"version_normalized": "3.4.0.0",
"version": "v3.5.1",
"version_normalized": "3.5.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/deprecation-contracts.git",
"reference": "7c3aff79d10325257a001fcf92d991f24fc967cf"
"reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf",
"reference": "7c3aff79d10325257a001fcf92d991f24fc967cf",
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6",
"reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6",
"shasum": ""
},
"require": {
"php": ">=8.1"
},
"time": "2023-05-23T14:45:45+00:00",
"time": "2024-09-25T14:20:29+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "3.4-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"
"url": "https://github.com/symfony/contracts",
"name": "symfony/contracts"
},
"branch-alias": {
"dev-main": "3.5-dev"
}
},
"installation-source": "dist",
@ -1668,7 +1669,7 @@
"description": "A generic function and convention to trigger deprecation notices",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.4.0"
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.1"
},
"funding": [
{
@ -1688,17 +1689,17 @@
},
{
"name": "symfony/filesystem",
"version": "v6.4.6",
"version_normalized": "6.4.6.0",
"version": "v6.4.13",
"version_normalized": "6.4.13.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
"reference": "9919b5509ada52cc7f66f9a35c86a4a29955c9d3"
"reference": "4856c9cf585d5a0313d8d35afd681a526f038dd3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/9919b5509ada52cc7f66f9a35c86a4a29955c9d3",
"reference": "9919b5509ada52cc7f66f9a35c86a4a29955c9d3",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/4856c9cf585d5a0313d8d35afd681a526f038dd3",
"reference": "4856c9cf585d5a0313d8d35afd681a526f038dd3",
"shasum": ""
},
"require": {
@ -1706,7 +1707,10 @@
"symfony/polyfill-ctype": "~1.8",
"symfony/polyfill-mbstring": "~1.8"
},
"time": "2024-03-21T19:36:20+00:00",
"require-dev": {
"symfony/process": "^5.4|^6.4|^7.0"
},
"time": "2024-10-25T15:07:50+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -1734,7 +1738,7 @@
"description": "Provides basic utilities for the filesystem",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/filesystem/tree/v6.4.6"
"source": "https://github.com/symfony/filesystem/tree/v6.4.13"
},
"funding": [
{
@ -1754,21 +1758,21 @@
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.29.0",
"version_normalized": "1.29.0.0",
"version": "v1.31.0",
"version_normalized": "1.31.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4"
"reference": "a3cc8b044a6ea513310cbd48ef7333b384945638"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4",
"reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638",
"reference": "a3cc8b044a6ea513310cbd48ef7333b384945638",
"shasum": ""
},
"require": {
"php": ">=7.1"
"php": ">=7.2"
},
"provide": {
"ext-ctype": "*"
@ -1776,12 +1780,12 @@
"suggest": {
"ext-ctype": "For best performance"
},
"time": "2024-01-29T20:11:03+00:00",
"time": "2024-09-09T11:45:10+00:00",
"type": "library",
"extra": {
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
"url": "https://github.com/symfony/polyfill",
"name": "symfony/polyfill"
}
},
"installation-source": "dist",
@ -1816,7 +1820,7 @@
"portable"
],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.29.0"
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0"
},
"funding": [
{
@ -1836,21 +1840,21 @@
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.29.0",
"version_normalized": "1.29.0.0",
"version": "v1.31.0",
"version_normalized": "1.31.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec"
"reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec",
"reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341",
"reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341",
"shasum": ""
},
"require": {
"php": ">=7.1"
"php": ">=7.2"
},
"provide": {
"ext-mbstring": "*"
@ -1858,12 +1862,12 @@
"suggest": {
"ext-mbstring": "For best performance"
},
"time": "2024-01-29T20:11:03+00:00",
"time": "2024-09-09T11:45:10+00:00",
"type": "library",
"extra": {
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
"url": "https://github.com/symfony/polyfill",
"name": "symfony/polyfill"
}
},
"installation-source": "dist",
@ -1899,7 +1903,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.29.0"
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0"
},
"funding": [
{

View File

@ -1,76 +1,76 @@
<?php return array(
'root' => array(
'pretty_version' => '1.0.0+no-version-set',
'version' => '1.0.0.0',
'pretty_version' => 'dev-develop',
'version' => 'dev-develop',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => NULL,
'reference' => '9db9febc39027c302495c041d5a28e198c035b21',
'name' => 'ucrm-plugins/sms-twilio',
'dev' => false,
),
'versions' => array(
'firebase/php-jwt' => array(
'pretty_version' => 'v6.10.1',
'version' => '6.10.1.0',
'pretty_version' => 'v6.10.2',
'version' => '6.10.2.0',
'type' => 'library',
'install_path' => __DIR__ . '/../firebase/php-jwt',
'aliases' => array(),
'reference' => '500501c2ce893c824c801da135d02661199f60c5',
'reference' => '30c19ed0f3264cb660ea496895cfb6ef7ee3653b',
'dev_requirement' => false,
),
'google/apiclient' => array(
'pretty_version' => 'v2.16.0',
'version' => '2.16.0.0',
'pretty_version' => 'v2.18.2',
'version' => '2.18.2.0',
'type' => 'library',
'install_path' => __DIR__ . '/../google/apiclient',
'aliases' => array(),
'reference' => '017400f609c1fb71ab5ad824c50eabd4c3eaf779',
'reference' => 'd8d201ba8a189a3cd7fb34e4da569f2ed440eee7',
'dev_requirement' => false,
),
'google/apiclient-services' => array(
'pretty_version' => 'v0.359.0',
'version' => '0.359.0.0',
'pretty_version' => 'v0.389.0',
'version' => '0.389.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../google/apiclient-services',
'aliases' => array(),
'reference' => 'e975e6d0efa47f7e49280c4ea7fd6a93b6d7e338',
'reference' => '6274e67ee52b1a416ccee0a4eaf337d1139cdaf8',
'dev_requirement' => false,
),
'google/auth' => array(
'pretty_version' => 'v1.40.0',
'version' => '1.40.0.0',
'pretty_version' => 'v1.44.0',
'version' => '1.44.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../google/auth',
'aliases' => array(),
'reference' => 'bff9f2d01677e71a98394b5ac981b99523df5178',
'reference' => '5670e56307d7a2eac931f677c0e59a4f8abb2e43',
'dev_requirement' => false,
),
'guzzlehttp/guzzle' => array(
'pretty_version' => '7.8.1',
'version' => '7.8.1.0',
'pretty_version' => '7.9.2',
'version' => '7.9.2.0',
'type' => 'library',
'install_path' => __DIR__ . '/../guzzlehttp/guzzle',
'aliases' => array(),
'reference' => '41042bc7ab002487b876a0683fc8dce04ddce104',
'reference' => 'd281ed313b989f213357e3be1a179f02196ac99b',
'dev_requirement' => false,
),
'guzzlehttp/promises' => array(
'pretty_version' => '2.0.2',
'version' => '2.0.2.0',
'pretty_version' => '2.0.4',
'version' => '2.0.4.0',
'type' => 'library',
'install_path' => __DIR__ . '/../guzzlehttp/promises',
'aliases' => array(),
'reference' => 'bbff78d96034045e58e13dedd6ad91b5d1253223',
'reference' => 'f9c436286ab2892c7db7be8c8da4ef61ccf7b455',
'dev_requirement' => false,
),
'guzzlehttp/psr7' => array(
'pretty_version' => '2.6.2',
'version' => '2.6.2.0',
'pretty_version' => '2.7.0',
'version' => '2.7.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../guzzlehttp/psr7',
'aliases' => array(),
'reference' => '45b30f99ac27b5ca93cb4831afe16285f57b8221',
'reference' => 'a70f5c95fb43bc83f07c9c948baa0dc1829bf201',
'dev_requirement' => false,
),
'katzgrau/klogger' => array(
@ -83,30 +83,30 @@
'dev_requirement' => false,
),
'laravel/serializable-closure' => array(
'pretty_version' => 'v1.3.3',
'version' => '1.3.3.0',
'pretty_version' => 'v1.3.7',
'version' => '1.3.7.0',
'type' => 'library',
'install_path' => __DIR__ . '/../laravel/serializable-closure',
'aliases' => array(),
'reference' => '3dbf8a8e914634c48d389c1234552666b3d43754',
'reference' => '4f48ade902b94323ca3be7646db16209ec76be3d',
'dev_requirement' => false,
),
'monolog/monolog' => array(
'pretty_version' => '2.9.3',
'version' => '2.9.3.0',
'pretty_version' => '2.10.0',
'version' => '2.10.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../monolog/monolog',
'aliases' => array(),
'reference' => 'a30bfe2e142720dfa990d0a7e573997f5d884215',
'reference' => '5cf826f2991858b54d5c3809bee745560a1042a7',
'dev_requirement' => false,
),
'paragonie/constant_time_encoding' => array(
'pretty_version' => 'v2.7.0',
'version' => '2.7.0.0',
'pretty_version' => 'v3.0.0',
'version' => '3.0.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../paragonie/constant_time_encoding',
'aliases' => array(),
'reference' => '52a0d99e69f56b9ec27ace92ba56897fe6993105',
'reference' => 'df1e7fde177501eee2037dd159cf04f5f301a512',
'dev_requirement' => false,
),
'paragonie/random_compat' => array(
@ -128,21 +128,21 @@
'dev_requirement' => false,
),
'php-di/php-di' => array(
'pretty_version' => '7.0.6',
'version' => '7.0.6.0',
'pretty_version' => '7.0.7',
'version' => '7.0.7.0',
'type' => 'library',
'install_path' => __DIR__ . '/../php-di/php-di',
'aliases' => array(),
'reference' => '8097948a89f6ec782839b3e958432f427cac37fd',
'reference' => 'e87435e3c0e8f22977adc5af0d5cdcc467e15cf1',
'dev_requirement' => false,
),
'phpseclib/phpseclib' => array(
'pretty_version' => '3.0.37',
'version' => '3.0.37.0',
'pretty_version' => '3.0.43',
'version' => '3.0.43.0',
'type' => 'library',
'install_path' => __DIR__ . '/../phpseclib/phpseclib',
'aliases' => array(),
'reference' => 'cfa2013d0f68c062055180dd4328cc8b9d1f30b8',
'reference' => '709ec107af3cb2f385b9617be72af8cf62441d02',
'dev_requirement' => false,
),
'psr/cache' => array(
@ -185,12 +185,12 @@
),
),
'psr/http-factory' => array(
'pretty_version' => '1.0.2',
'version' => '1.0.2.0',
'pretty_version' => '1.1.0',
'version' => '1.1.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/http-factory',
'aliases' => array(),
'reference' => 'e616d01114759c4c489f93b099585439f795fe35',
'reference' => '2b4765fddfe3b508ac62f829e852b1501d3f6e8a',
'dev_requirement' => false,
),
'psr/http-factory-implementation' => array(
@ -248,39 +248,39 @@
'dev_requirement' => false,
),
'symfony/deprecation-contracts' => array(
'pretty_version' => 'v3.4.0',
'version' => '3.4.0.0',
'pretty_version' => 'v3.5.1',
'version' => '3.5.1.0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/deprecation-contracts',
'aliases' => array(),
'reference' => '7c3aff79d10325257a001fcf92d991f24fc967cf',
'reference' => '74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6',
'dev_requirement' => false,
),
'symfony/filesystem' => array(
'pretty_version' => 'v6.4.6',
'version' => '6.4.6.0',
'pretty_version' => 'v6.4.13',
'version' => '6.4.13.0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/filesystem',
'aliases' => array(),
'reference' => '9919b5509ada52cc7f66f9a35c86a4a29955c9d3',
'reference' => '4856c9cf585d5a0313d8d35afd681a526f038dd3',
'dev_requirement' => false,
),
'symfony/polyfill-ctype' => array(
'pretty_version' => 'v1.29.0',
'version' => '1.29.0.0',
'pretty_version' => 'v1.31.0',
'version' => '1.31.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-ctype',
'aliases' => array(),
'reference' => 'ef4d7e442ca910c4764bce785146269b30cb5fc4',
'reference' => 'a3cc8b044a6ea513310cbd48ef7333b384945638',
'dev_requirement' => false,
),
'symfony/polyfill-mbstring' => array(
'pretty_version' => 'v1.29.0',
'version' => '1.29.0.0',
'pretty_version' => 'v1.31.0',
'version' => '1.31.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-mbstring',
'aliases' => array(),
'reference' => '9773676c8a1bb1f8d4340a62efe641cf76eda7ec',
'reference' => '85181ba99b2345b0ef10ce42ecac37612d9fd341',
'dev_requirement' => false,
),
'twilio/sdk' => array(
@ -302,12 +302,12 @@
'dev_requirement' => false,
),
'ucrm-plugins/sms-twilio' => array(
'pretty_version' => '1.0.0+no-version-set',
'version' => '1.0.0.0',
'pretty_version' => 'dev-develop',
'version' => 'dev-develop',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => NULL,
'reference' => '9db9febc39027c302495c041d5a28e198c035b21',
'dev_requirement' => false,
),
),

View File

@ -1,5 +1,13 @@
# Changelog
## [6.10.2](https://github.com/firebase/php-jwt/compare/v6.10.1...v6.10.2) (2024-11-24)
### Bug Fixes
* Mitigate PHP8.4 deprecation warnings ([#570](https://github.com/firebase/php-jwt/issues/570)) ([76808fa](https://github.com/firebase/php-jwt/commit/76808fa227f3811aa5cdb3bf81233714b799a5b5))
* support php 8.4 ([#583](https://github.com/firebase/php-jwt/issues/583)) ([e3d68b0](https://github.com/firebase/php-jwt/commit/e3d68b044421339443c74199edd020e03fb1887e))
## [6.10.1](https://github.com/firebase/php-jwt/compare/v6.10.0...v6.10.1) (2024-05-18)

View File

@ -80,9 +80,9 @@ class CachedKeySet implements ArrayAccess
ClientInterface $httpClient,
RequestFactoryInterface $httpFactory,
CacheItemPoolInterface $cache,
int $expiresAfter = null,
?int $expiresAfter = null,
bool $rateLimit = false,
string $defaultAlg = null
?string $defaultAlg = null
) {
$this->jwksUri = $jwksUri;
$this->httpClient = $httpClient;
@ -180,7 +180,7 @@ class CachedKeySet implements ArrayAccess
$jwksResponse = $this->httpClient->sendRequest($request);
if ($jwksResponse->getStatusCode() !== 200) {
throw new UnexpectedValueException(
sprintf('HTTP Error: %d %s for URI "%s"',
\sprintf('HTTP Error: %d %s for URI "%s"',
$jwksResponse->getStatusCode(),
$jwksResponse->getReasonPhrase(),
$this->jwksUri,

View File

@ -52,7 +52,7 @@ class JWK
*
* @uses parseKey
*/
public static function parseKeySet(array $jwks, string $defaultAlg = null): array
public static function parseKeySet(array $jwks, ?string $defaultAlg = null): array
{
$keys = [];
@ -93,7 +93,7 @@ class JWK
*
* @uses createPemFromModulusAndExponent
*/
public static function parseKey(array $jwk, string $defaultAlg = null): ?Key
public static function parseKey(array $jwk, ?string $defaultAlg = null): ?Key
{
if (empty($jwk)) {
throw new InvalidArgumentException('JWK must not be empty');
@ -212,7 +212,7 @@ class JWK
)
);
return sprintf(
return \sprintf(
"-----BEGIN PUBLIC KEY-----\n%s\n-----END PUBLIC KEY-----\n",
wordwrap(base64_encode($pem), 64, "\n", true)
);

View File

@ -96,7 +96,7 @@ class JWT
public static function decode(
string $jwt,
$keyOrKeyArray,
stdClass &$headers = null
?stdClass &$headers = null
): stdClass {
// Validate JWT
$timestamp = \is_null(static::$timestamp) ? \time() : static::$timestamp;
@ -200,11 +200,11 @@ class JWT
array $payload,
$key,
string $alg,
string $keyId = null,
array $head = null
?string $keyId = null,
?array $head = null
): string {
$header = ['typ' => 'JWT'];
if (isset($head) && \is_array($head)) {
if (isset($head)) {
$header = \array_merge($header, $head);
}
$header['alg'] = $alg;
@ -387,12 +387,7 @@ class JWT
*/
public static function jsonEncode(array $input): string
{
if (PHP_VERSION_ID >= 50400) {
$json = \json_encode($input, \JSON_UNESCAPED_SLASHES);
} else {
// PHP 5.3 only
$json = \json_encode($input);
}
$json = \json_encode($input, \JSON_UNESCAPED_SLASHES);
if ($errno = \json_last_error()) {
self::handleJsonError($errno);
} elseif ($json === 'null') {

View File

@ -1,6 +1,8 @@
Google PHP API Client Services
==============================
[Reference Documentation](https://googleapis.github.io/google-api-php-client-services)
**NOTE**: please check to see if the package you'd like to install is available in our
list of [Google cloud packages](https://cloud.google.com/php/docs/reference) first, as
these are the recommended libraries.
@ -12,6 +14,6 @@ these are the recommended libraries.
## Usage
This library is automatically updated daily with new API changes, and tagged weekly.
It is installed as part of the
It is installed as part of the
[Google API PHP Client](https://github.com/googleapis/google-api-php-client/releases)
library via Composer, which will pull down the most recent tag.

View File

@ -268,6 +268,16 @@ class AIPlatformNotebooks extends \Google\Service
'required' => true,
],
],
],'restore' => [
'path' => 'v2/{+name}:restore',
'httpMethod' => 'POST',
'parameters' => [
'name' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
],
],'rollback' => [
'path' => 'v2/{+name}:rollback',
'httpMethod' => 'POST',

View File

@ -46,6 +46,10 @@ class GceSetup extends \Google\Collection
* @var string[]
*/
public $metadata;
/**
* @var string
*/
public $minCpuPlatform;
protected $networkInterfacesType = NetworkInterface::class;
protected $networkInterfacesDataType = 'array';
protected $serviceAccountsType = ServiceAccount::class;
@ -185,6 +189,20 @@ class GceSetup extends \Google\Collection
{
return $this->metadata;
}
/**
* @param string
*/
public function setMinCpuPlatform($minCpuPlatform)
{
$this->minCpuPlatform = $minCpuPlatform;
}
/**
* @return string
*/
public function getMinCpuPlatform()
{
return $this->minCpuPlatform;
}
/**
* @param NetworkInterface[]
*/

View File

@ -32,6 +32,10 @@ class Instance extends \Google\Collection
* @var bool
*/
public $disableProxyAccess;
/**
* @var bool
*/
public $enableThirdPartyIdentity;
protected $gceSetupType = GceSetup::class;
protected $gceSetupDataType = '';
/**
@ -127,6 +131,20 @@ class Instance extends \Google\Collection
{
return $this->disableProxyAccess;
}
/**
* @param bool
*/
public function setEnableThirdPartyIdentity($enableThirdPartyIdentity)
{
$this->enableThirdPartyIdentity = $enableThirdPartyIdentity;
}
/**
* @return bool
*/
public function getEnableThirdPartyIdentity()
{
return $this->enableThirdPartyIdentity;
}
/**
* @param GceSetup
*/

View File

@ -27,6 +27,7 @@ use Google\Service\AIPlatformNotebooks\Policy;
use Google\Service\AIPlatformNotebooks\ReportInstanceInfoSystemRequest;
use Google\Service\AIPlatformNotebooks\ResetInstanceRequest;
use Google\Service\AIPlatformNotebooks\ResizeDiskRequest;
use Google\Service\AIPlatformNotebooks\RestoreInstanceRequest;
use Google\Service\AIPlatformNotebooks\RollbackInstanceRequest;
use Google\Service\AIPlatformNotebooks\SetIamPolicyRequest;
use Google\Service\AIPlatformNotebooks\StartInstanceRequest;
@ -274,6 +275,22 @@ class ProjectsLocationsInstances extends \Google\Service\Resource
$params = array_merge($params, $optParams);
return $this->call('resizeDisk', [$params], Operation::class);
}
/**
* RestoreInstance restores an Instance from a BackupSource. (instances.restore)
*
* @param string $name Required. Format:
* `projects/{project_id}/locations/{location}/instances/{instance_id}`
* @param RestoreInstanceRequest $postBody
* @param array $optParams Optional parameters.
* @return Operation
* @throws \Google\Service\Exception
*/
public function restore($name, RestoreInstanceRequest $postBody, $optParams = [])
{
$params = ['name' => $name, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('restore', [$params], Operation::class);
}
/**
* Rollbacks a notebook instance to the previous version. (instances.rollback)
*

View File

@ -40,7 +40,7 @@ class ProjectsLocationsOperations extends \Google\Service\Resource
* other methods to check whether the cancellation succeeded or whether the
* operation completed despite cancellation. On successful cancellation, the
* operation is not deleted; instead, it becomes an operation with an
* Operation.error value with a google.rpc.Status.code of 1, corresponding to
* Operation.error value with a google.rpc.Status.code of `1`, corresponding to
* `Code.CANCELLED`. (operations.cancel)
*
* @param string $name The name of the operation resource to be cancelled.

View File

@ -0,0 +1,42 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\AIPlatformNotebooks;
class RestoreInstanceRequest extends \Google\Model
{
protected $snapshotType = Snapshot::class;
protected $snapshotDataType = '';
/**
* @param Snapshot
*/
public function setSnapshot(Snapshot $snapshot)
{
$this->snapshot = $snapshot;
}
/**
* @return Snapshot
*/
public function getSnapshot()
{
return $this->snapshot;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(RestoreInstanceRequest::class, 'Google_Service_AIPlatformNotebooks_RestoreInstanceRequest');

View File

@ -0,0 +1,62 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\AIPlatformNotebooks;
class Snapshot extends \Google\Model
{
/**
* @var string
*/
public $projectId;
/**
* @var string
*/
public $snapshotId;
/**
* @param string
*/
public function setProjectId($projectId)
{
$this->projectId = $projectId;
}
/**
* @return string
*/
public function getProjectId()
{
return $this->projectId;
}
/**
* @param string
*/
public function setSnapshotId($snapshotId)
{
$this->snapshotId = $snapshotId;
}
/**
* @return string
*/
public function getSnapshotId()
{
return $this->snapshotId;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Snapshot::class, 'Google_Service_AIPlatformNotebooks_Snapshot');

View File

@ -0,0 +1,431 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service;
use Google\Client;
/**
* Service definition for APIManagement (v1alpha).
*
* <p>
* Enables users to discover shadow APIs in existing Google Cloud
* infrastructure.</p>
*
* <p>
* For more information about this service, see the API
* <a href="https://cloud.google.com/apigee/" target="_blank">Documentation</a>
* </p>
*
* @author Google, Inc.
*/
class APIManagement extends \Google\Service
{
/** See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.. */
const CLOUD_PLATFORM =
"https://www.googleapis.com/auth/cloud-platform";
public $projects_locations;
public $projects_locations_observationJobs;
public $projects_locations_observationJobs_apiObservations;
public $projects_locations_observationJobs_apiObservations_apiOperations;
public $projects_locations_observationSources;
public $projects_locations_operations;
public $rootUrlTemplate;
/**
* Constructs the internal representation of the APIManagement service.
*
* @param Client|array $clientOrConfig The client used to deliver requests, or a
* config array to pass to a new Client instance.
* @param string $rootUrl The root URL used for requests to the service.
*/
public function __construct($clientOrConfig = [], $rootUrl = null)
{
parent::__construct($clientOrConfig);
$this->rootUrl = $rootUrl ?: 'https://apim.googleapis.com/';
$this->rootUrlTemplate = $rootUrl ?: 'https://apim.UNIVERSE_DOMAIN/';
$this->servicePath = '';
$this->batchPath = 'batch';
$this->version = 'v1alpha';
$this->serviceName = 'apim';
$this->projects_locations = new APIManagement\Resource\ProjectsLocations(
$this,
$this->serviceName,
'locations',
[
'methods' => [
'get' => [
'path' => 'v1alpha/{+name}',
'httpMethod' => 'GET',
'parameters' => [
'name' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
],
],'list' => [
'path' => 'v1alpha/{+name}/locations',
'httpMethod' => 'GET',
'parameters' => [
'name' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'filter' => [
'location' => 'query',
'type' => 'string',
],
'pageSize' => [
'location' => 'query',
'type' => 'integer',
],
'pageToken' => [
'location' => 'query',
'type' => 'string',
],
],
],'listApiObservationTags' => [
'path' => 'v1alpha/{+parent}:listApiObservationTags',
'httpMethod' => 'GET',
'parameters' => [
'parent' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'pageSize' => [
'location' => 'query',
'type' => 'integer',
],
'pageToken' => [
'location' => 'query',
'type' => 'string',
],
],
],
]
]
);
$this->projects_locations_observationJobs = new APIManagement\Resource\ProjectsLocationsObservationJobs(
$this,
$this->serviceName,
'observationJobs',
[
'methods' => [
'create' => [
'path' => 'v1alpha/{+parent}/observationJobs',
'httpMethod' => 'POST',
'parameters' => [
'parent' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'observationJobId' => [
'location' => 'query',
'type' => 'string',
],
'requestId' => [
'location' => 'query',
'type' => 'string',
],
],
],'delete' => [
'path' => 'v1alpha/{+name}',
'httpMethod' => 'DELETE',
'parameters' => [
'name' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
],
],'disable' => [
'path' => 'v1alpha/{+name}:disable',
'httpMethod' => 'POST',
'parameters' => [
'name' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
],
],'enable' => [
'path' => 'v1alpha/{+name}:enable',
'httpMethod' => 'POST',
'parameters' => [
'name' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
],
],'get' => [
'path' => 'v1alpha/{+name}',
'httpMethod' => 'GET',
'parameters' => [
'name' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
],
],'list' => [
'path' => 'v1alpha/{+parent}/observationJobs',
'httpMethod' => 'GET',
'parameters' => [
'parent' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'pageSize' => [
'location' => 'query',
'type' => 'integer',
],
'pageToken' => [
'location' => 'query',
'type' => 'string',
],
],
],
]
]
);
$this->projects_locations_observationJobs_apiObservations = new APIManagement\Resource\ProjectsLocationsObservationJobsApiObservations(
$this,
$this->serviceName,
'apiObservations',
[
'methods' => [
'batchEditTags' => [
'path' => 'v1alpha/{+parent}/apiObservations:batchEditTags',
'httpMethod' => 'POST',
'parameters' => [
'parent' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
],
],'get' => [
'path' => 'v1alpha/{+name}',
'httpMethod' => 'GET',
'parameters' => [
'name' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
],
],'list' => [
'path' => 'v1alpha/{+parent}/apiObservations',
'httpMethod' => 'GET',
'parameters' => [
'parent' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'pageSize' => [
'location' => 'query',
'type' => 'integer',
],
'pageToken' => [
'location' => 'query',
'type' => 'string',
],
],
],
]
]
);
$this->projects_locations_observationJobs_apiObservations_apiOperations = new APIManagement\Resource\ProjectsLocationsObservationJobsApiObservationsApiOperations(
$this,
$this->serviceName,
'apiOperations',
[
'methods' => [
'get' => [
'path' => 'v1alpha/{+name}',
'httpMethod' => 'GET',
'parameters' => [
'name' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
],
],'list' => [
'path' => 'v1alpha/{+parent}/apiOperations',
'httpMethod' => 'GET',
'parameters' => [
'parent' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'pageSize' => [
'location' => 'query',
'type' => 'integer',
],
'pageToken' => [
'location' => 'query',
'type' => 'string',
],
],
],
]
]
);
$this->projects_locations_observationSources = new APIManagement\Resource\ProjectsLocationsObservationSources(
$this,
$this->serviceName,
'observationSources',
[
'methods' => [
'create' => [
'path' => 'v1alpha/{+parent}/observationSources',
'httpMethod' => 'POST',
'parameters' => [
'parent' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'observationSourceId' => [
'location' => 'query',
'type' => 'string',
],
'requestId' => [
'location' => 'query',
'type' => 'string',
],
],
],'delete' => [
'path' => 'v1alpha/{+name}',
'httpMethod' => 'DELETE',
'parameters' => [
'name' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
],
],'get' => [
'path' => 'v1alpha/{+name}',
'httpMethod' => 'GET',
'parameters' => [
'name' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
],
],'list' => [
'path' => 'v1alpha/{+parent}/observationSources',
'httpMethod' => 'GET',
'parameters' => [
'parent' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'pageSize' => [
'location' => 'query',
'type' => 'integer',
],
'pageToken' => [
'location' => 'query',
'type' => 'string',
],
],
],
]
]
);
$this->projects_locations_operations = new APIManagement\Resource\ProjectsLocationsOperations(
$this,
$this->serviceName,
'operations',
[
'methods' => [
'cancel' => [
'path' => 'v1alpha/{+name}:cancel',
'httpMethod' => 'POST',
'parameters' => [
'name' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
],
],'delete' => [
'path' => 'v1alpha/{+name}',
'httpMethod' => 'DELETE',
'parameters' => [
'name' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
],
],'get' => [
'path' => 'v1alpha/{+name}',
'httpMethod' => 'GET',
'parameters' => [
'name' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
],
],'list' => [
'path' => 'v1alpha/{+name}/operations',
'httpMethod' => 'GET',
'parameters' => [
'name' => [
'location' => 'path',
'type' => 'string',
'required' => true,
],
'filter' => [
'location' => 'query',
'type' => 'string',
],
'pageSize' => [
'location' => 'query',
'type' => 'integer',
],
'pageToken' => [
'location' => 'query',
'type' => 'string',
],
],
],
]
]
);
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(APIManagement::class, 'Google_Service_APIManagement');

View File

@ -0,0 +1,207 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement;
class ApiObservation extends \Google\Collection
{
protected $collection_key = 'tags';
/**
* @var string
*/
public $apiOperationCount;
/**
* @var string
*/
public $createTime;
/**
* @var string
*/
public $hostname;
/**
* @var string
*/
public $lastEventDetectedTime;
/**
* @var string
*/
public $name;
/**
* @var string[]
*/
public $serverIps;
/**
* @var string[]
*/
public $sourceLocations;
/**
* @var string
*/
public $style;
/**
* @var string[]
*/
public $tags;
/**
* @var string
*/
public $updateTime;
/**
* @param string
*/
public function setApiOperationCount($apiOperationCount)
{
$this->apiOperationCount = $apiOperationCount;
}
/**
* @return string
*/
public function getApiOperationCount()
{
return $this->apiOperationCount;
}
/**
* @param string
*/
public function setCreateTime($createTime)
{
$this->createTime = $createTime;
}
/**
* @return string
*/
public function getCreateTime()
{
return $this->createTime;
}
/**
* @param string
*/
public function setHostname($hostname)
{
$this->hostname = $hostname;
}
/**
* @return string
*/
public function getHostname()
{
return $this->hostname;
}
/**
* @param string
*/
public function setLastEventDetectedTime($lastEventDetectedTime)
{
$this->lastEventDetectedTime = $lastEventDetectedTime;
}
/**
* @return string
*/
public function getLastEventDetectedTime()
{
return $this->lastEventDetectedTime;
}
/**
* @param string
*/
public function setName($name)
{
$this->name = $name;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @param string[]
*/
public function setServerIps($serverIps)
{
$this->serverIps = $serverIps;
}
/**
* @return string[]
*/
public function getServerIps()
{
return $this->serverIps;
}
/**
* @param string[]
*/
public function setSourceLocations($sourceLocations)
{
$this->sourceLocations = $sourceLocations;
}
/**
* @return string[]
*/
public function getSourceLocations()
{
return $this->sourceLocations;
}
/**
* @param string
*/
public function setStyle($style)
{
$this->style = $style;
}
/**
* @return string
*/
public function getStyle()
{
return $this->style;
}
/**
* @param string[]
*/
public function setTags($tags)
{
$this->tags = $tags;
}
/**
* @return string[]
*/
public function getTags()
{
return $this->tags;
}
/**
* @param string
*/
public function setUpdateTime($updateTime)
{
$this->updateTime = $updateTime;
}
/**
* @return string
*/
public function getUpdateTime()
{
return $this->updateTime;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ApiObservation::class, 'Google_Service_APIManagement_ApiObservation');

View File

@ -0,0 +1,114 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement;
class ApiOperation extends \Google\Model
{
/**
* @var string
*/
public $count;
/**
* @var string
*/
public $firstSeenTime;
protected $httpOperationType = HttpOperation::class;
protected $httpOperationDataType = '';
/**
* @var string
*/
public $lastSeenTime;
/**
* @var string
*/
public $name;
/**
* @param string
*/
public function setCount($count)
{
$this->count = $count;
}
/**
* @return string
*/
public function getCount()
{
return $this->count;
}
/**
* @param string
*/
public function setFirstSeenTime($firstSeenTime)
{
$this->firstSeenTime = $firstSeenTime;
}
/**
* @return string
*/
public function getFirstSeenTime()
{
return $this->firstSeenTime;
}
/**
* @param HttpOperation
*/
public function setHttpOperation(HttpOperation $httpOperation)
{
$this->httpOperation = $httpOperation;
}
/**
* @return HttpOperation
*/
public function getHttpOperation()
{
return $this->httpOperation;
}
/**
* @param string
*/
public function setLastSeenTime($lastSeenTime)
{
$this->lastSeenTime = $lastSeenTime;
}
/**
* @return string
*/
public function getLastSeenTime()
{
return $this->lastSeenTime;
}
/**
* @param string
*/
public function setName($name)
{
$this->name = $name;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ApiOperation::class, 'Google_Service_APIManagement_ApiOperation');

View File

@ -0,0 +1,25 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement;
class ApimEmpty extends \Google\Model
{
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ApimEmpty::class, 'Google_Service_APIManagement_ApimEmpty');

View File

@ -0,0 +1,43 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement;
class BatchEditTagsApiObservationsRequest extends \Google\Collection
{
protected $collection_key = 'requests';
protected $requestsType = EditTagsApiObservationsRequest::class;
protected $requestsDataType = 'array';
/**
* @param EditTagsApiObservationsRequest[]
*/
public function setRequests($requests)
{
$this->requests = $requests;
}
/**
* @return EditTagsApiObservationsRequest[]
*/
public function getRequests()
{
return $this->requests;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BatchEditTagsApiObservationsRequest::class, 'Google_Service_APIManagement_BatchEditTagsApiObservationsRequest');

View File

@ -0,0 +1,43 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement;
class BatchEditTagsApiObservationsResponse extends \Google\Collection
{
protected $collection_key = 'apiObservations';
protected $apiObservationsType = ApiObservation::class;
protected $apiObservationsDataType = 'array';
/**
* @param ApiObservation[]
*/
public function setApiObservations($apiObservations)
{
$this->apiObservations = $apiObservations;
}
/**
* @return ApiObservation[]
*/
public function getApiObservations()
{
return $this->apiObservations;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(BatchEditTagsApiObservationsResponse::class, 'Google_Service_APIManagement_BatchEditTagsApiObservationsResponse');

View File

@ -0,0 +1,25 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement;
class CancelOperationRequest extends \Google\Model
{
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(CancelOperationRequest::class, 'Google_Service_APIManagement_CancelOperationRequest');

View File

@ -0,0 +1,25 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement;
class DisableObservationJobRequest extends \Google\Model
{
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(DisableObservationJobRequest::class, 'Google_Service_APIManagement_DisableObservationJobRequest');

View File

@ -0,0 +1,61 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement;
class EditTagsApiObservationsRequest extends \Google\Collection
{
protected $collection_key = 'tagActions';
/**
* @var string
*/
public $apiObservationId;
protected $tagActionsType = TagAction::class;
protected $tagActionsDataType = 'array';
/**
* @param string
*/
public function setApiObservationId($apiObservationId)
{
$this->apiObservationId = $apiObservationId;
}
/**
* @return string
*/
public function getApiObservationId()
{
return $this->apiObservationId;
}
/**
* @param TagAction[]
*/
public function setTagActions($tagActions)
{
$this->tagActions = $tagActions;
}
/**
* @return TagAction[]
*/
public function getTagActions()
{
return $this->tagActions;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(EditTagsApiObservationsRequest::class, 'Google_Service_APIManagement_EditTagsApiObservationsRequest');

View File

@ -0,0 +1,25 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement;
class EnableObservationJobRequest extends \Google\Model
{
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(EnableObservationJobRequest::class, 'Google_Service_APIManagement_EnableObservationJobRequest');

View File

@ -0,0 +1,43 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement;
class GclbObservationSource extends \Google\Collection
{
protected $collection_key = 'pscNetworkConfigs';
protected $pscNetworkConfigsType = GclbObservationSourcePscNetworkConfig::class;
protected $pscNetworkConfigsDataType = 'array';
/**
* @param GclbObservationSourcePscNetworkConfig[]
*/
public function setPscNetworkConfigs($pscNetworkConfigs)
{
$this->pscNetworkConfigs = $pscNetworkConfigs;
}
/**
* @return GclbObservationSourcePscNetworkConfig[]
*/
public function getPscNetworkConfigs()
{
return $this->pscNetworkConfigs;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(GclbObservationSource::class, 'Google_Service_APIManagement_GclbObservationSource');

View File

@ -0,0 +1,62 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement;
class GclbObservationSourcePscNetworkConfig extends \Google\Model
{
/**
* @var string
*/
public $network;
/**
* @var string
*/
public $subnetwork;
/**
* @param string
*/
public function setNetwork($network)
{
$this->network = $network;
}
/**
* @return string
*/
public function getNetwork()
{
return $this->network;
}
/**
* @param string
*/
public function setSubnetwork($subnetwork)
{
$this->subnetwork = $subnetwork;
}
/**
* @return string
*/
public function getSubnetwork()
{
return $this->subnetwork;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(GclbObservationSourcePscNetworkConfig::class, 'Google_Service_APIManagement_GclbObservationSourcePscNetworkConfig');

View File

@ -0,0 +1,127 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement;
class HttpOperation extends \Google\Collection
{
protected $collection_key = 'pathParams';
/**
* @var string
*/
public $method;
/**
* @var string
*/
public $path;
protected $pathParamsType = HttpOperationPathParam::class;
protected $pathParamsDataType = 'array';
protected $queryParamsType = HttpOperationQueryParam::class;
protected $queryParamsDataType = 'map';
protected $requestType = HttpOperationHttpRequest::class;
protected $requestDataType = '';
protected $responseType = HttpOperationHttpResponse::class;
protected $responseDataType = '';
/**
* @param string
*/
public function setMethod($method)
{
$this->method = $method;
}
/**
* @return string
*/
public function getMethod()
{
return $this->method;
}
/**
* @param string
*/
public function setPath($path)
{
$this->path = $path;
}
/**
* @return string
*/
public function getPath()
{
return $this->path;
}
/**
* @param HttpOperationPathParam[]
*/
public function setPathParams($pathParams)
{
$this->pathParams = $pathParams;
}
/**
* @return HttpOperationPathParam[]
*/
public function getPathParams()
{
return $this->pathParams;
}
/**
* @param HttpOperationQueryParam[]
*/
public function setQueryParams($queryParams)
{
$this->queryParams = $queryParams;
}
/**
* @return HttpOperationQueryParam[]
*/
public function getQueryParams()
{
return $this->queryParams;
}
/**
* @param HttpOperationHttpRequest
*/
public function setRequest(HttpOperationHttpRequest $request)
{
$this->request = $request;
}
/**
* @return HttpOperationHttpRequest
*/
public function getRequest()
{
return $this->request;
}
/**
* @param HttpOperationHttpResponse
*/
public function setResponse(HttpOperationHttpResponse $response)
{
$this->response = $response;
}
/**
* @return HttpOperationHttpResponse
*/
public function getResponse()
{
return $this->response;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(HttpOperation::class, 'Google_Service_APIManagement_HttpOperation');

View File

@ -0,0 +1,80 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement;
class HttpOperationHeader extends \Google\Model
{
/**
* @var string
*/
public $count;
/**
* @var string
*/
public $dataType;
/**
* @var string
*/
public $name;
/**
* @param string
*/
public function setCount($count)
{
$this->count = $count;
}
/**
* @return string
*/
public function getCount()
{
return $this->count;
}
/**
* @param string
*/
public function setDataType($dataType)
{
$this->dataType = $dataType;
}
/**
* @return string
*/
public function getDataType()
{
return $this->dataType;
}
/**
* @param string
*/
public function setName($name)
{
$this->name = $name;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(HttpOperationHeader::class, 'Google_Service_APIManagement_HttpOperationHeader');

View File

@ -0,0 +1,42 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement;
class HttpOperationHttpRequest extends \Google\Model
{
protected $headersType = HttpOperationHeader::class;
protected $headersDataType = 'map';
/**
* @param HttpOperationHeader[]
*/
public function setHeaders($headers)
{
$this->headers = $headers;
}
/**
* @return HttpOperationHeader[]
*/
public function getHeaders()
{
return $this->headers;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(HttpOperationHttpRequest::class, 'Google_Service_APIManagement_HttpOperationHttpRequest');

View File

@ -0,0 +1,60 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement;
class HttpOperationHttpResponse extends \Google\Model
{
protected $headersType = HttpOperationHeader::class;
protected $headersDataType = 'map';
/**
* @var string[]
*/
public $responseCodes;
/**
* @param HttpOperationHeader[]
*/
public function setHeaders($headers)
{
$this->headers = $headers;
}
/**
* @return HttpOperationHeader[]
*/
public function getHeaders()
{
return $this->headers;
}
/**
* @param string[]
*/
public function setResponseCodes($responseCodes)
{
$this->responseCodes = $responseCodes;
}
/**
* @return string[]
*/
public function getResponseCodes()
{
return $this->responseCodes;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(HttpOperationHttpResponse::class, 'Google_Service_APIManagement_HttpOperationHttpResponse');

View File

@ -0,0 +1,62 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement;
class HttpOperationPathParam extends \Google\Model
{
/**
* @var string
*/
public $dataType;
/**
* @var int
*/
public $position;
/**
* @param string
*/
public function setDataType($dataType)
{
$this->dataType = $dataType;
}
/**
* @return string
*/
public function getDataType()
{
return $this->dataType;
}
/**
* @param int
*/
public function setPosition($position)
{
$this->position = $position;
}
/**
* @return int
*/
public function getPosition()
{
return $this->position;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(HttpOperationPathParam::class, 'Google_Service_APIManagement_HttpOperationPathParam');

View File

@ -0,0 +1,80 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement;
class HttpOperationQueryParam extends \Google\Model
{
/**
* @var string
*/
public $count;
/**
* @var string
*/
public $dataType;
/**
* @var string
*/
public $name;
/**
* @param string
*/
public function setCount($count)
{
$this->count = $count;
}
/**
* @return string
*/
public function getCount()
{
return $this->count;
}
/**
* @param string
*/
public function setDataType($dataType)
{
$this->dataType = $dataType;
}
/**
* @return string
*/
public function getDataType()
{
return $this->dataType;
}
/**
* @param string
*/
public function setName($name)
{
$this->name = $name;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(HttpOperationQueryParam::class, 'Google_Service_APIManagement_HttpOperationQueryParam');

View File

@ -0,0 +1,63 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement;
class ListApiObservationTagsResponse extends \Google\Collection
{
protected $collection_key = 'apiObservationTags';
/**
* @var string[]
*/
public $apiObservationTags;
/**
* @var string
*/
public $nextPageToken;
/**
* @param string[]
*/
public function setApiObservationTags($apiObservationTags)
{
$this->apiObservationTags = $apiObservationTags;
}
/**
* @return string[]
*/
public function getApiObservationTags()
{
return $this->apiObservationTags;
}
/**
* @param string
*/
public function setNextPageToken($nextPageToken)
{
$this->nextPageToken = $nextPageToken;
}
/**
* @return string
*/
public function getNextPageToken()
{
return $this->nextPageToken;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ListApiObservationTagsResponse::class, 'Google_Service_APIManagement_ListApiObservationTagsResponse');

View File

@ -0,0 +1,61 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement;
class ListApiObservationsResponse extends \Google\Collection
{
protected $collection_key = 'apiObservations';
protected $apiObservationsType = ApiObservation::class;
protected $apiObservationsDataType = 'array';
/**
* @var string
*/
public $nextPageToken;
/**
* @param ApiObservation[]
*/
public function setApiObservations($apiObservations)
{
$this->apiObservations = $apiObservations;
}
/**
* @return ApiObservation[]
*/
public function getApiObservations()
{
return $this->apiObservations;
}
/**
* @param string
*/
public function setNextPageToken($nextPageToken)
{
$this->nextPageToken = $nextPageToken;
}
/**
* @return string
*/
public function getNextPageToken()
{
return $this->nextPageToken;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ListApiObservationsResponse::class, 'Google_Service_APIManagement_ListApiObservationsResponse');

View File

@ -0,0 +1,61 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement;
class ListApiOperationsResponse extends \Google\Collection
{
protected $collection_key = 'apiOperations';
protected $apiOperationsType = ApiOperation::class;
protected $apiOperationsDataType = 'array';
/**
* @var string
*/
public $nextPageToken;
/**
* @param ApiOperation[]
*/
public function setApiOperations($apiOperations)
{
$this->apiOperations = $apiOperations;
}
/**
* @return ApiOperation[]
*/
public function getApiOperations()
{
return $this->apiOperations;
}
/**
* @param string
*/
public function setNextPageToken($nextPageToken)
{
$this->nextPageToken = $nextPageToken;
}
/**
* @return string
*/
public function getNextPageToken()
{
return $this->nextPageToken;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ListApiOperationsResponse::class, 'Google_Service_APIManagement_ListApiOperationsResponse');

View File

@ -0,0 +1,61 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement;
class ListLocationsResponse extends \Google\Collection
{
protected $collection_key = 'locations';
protected $locationsType = Location::class;
protected $locationsDataType = 'array';
/**
* @var string
*/
public $nextPageToken;
/**
* @param Location[]
*/
public function setLocations($locations)
{
$this->locations = $locations;
}
/**
* @return Location[]
*/
public function getLocations()
{
return $this->locations;
}
/**
* @param string
*/
public function setNextPageToken($nextPageToken)
{
$this->nextPageToken = $nextPageToken;
}
/**
* @return string
*/
public function getNextPageToken()
{
return $this->nextPageToken;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ListLocationsResponse::class, 'Google_Service_APIManagement_ListLocationsResponse');

View File

@ -0,0 +1,79 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement;
class ListObservationJobsResponse extends \Google\Collection
{
protected $collection_key = 'unreachable';
/**
* @var string
*/
public $nextPageToken;
protected $observationJobsType = ObservationJob::class;
protected $observationJobsDataType = 'array';
/**
* @var string[]
*/
public $unreachable;
/**
* @param string
*/
public function setNextPageToken($nextPageToken)
{
$this->nextPageToken = $nextPageToken;
}
/**
* @return string
*/
public function getNextPageToken()
{
return $this->nextPageToken;
}
/**
* @param ObservationJob[]
*/
public function setObservationJobs($observationJobs)
{
$this->observationJobs = $observationJobs;
}
/**
* @return ObservationJob[]
*/
public function getObservationJobs()
{
return $this->observationJobs;
}
/**
* @param string[]
*/
public function setUnreachable($unreachable)
{
$this->unreachable = $unreachable;
}
/**
* @return string[]
*/
public function getUnreachable()
{
return $this->unreachable;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ListObservationJobsResponse::class, 'Google_Service_APIManagement_ListObservationJobsResponse');

View File

@ -0,0 +1,79 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement;
class ListObservationSourcesResponse extends \Google\Collection
{
protected $collection_key = 'unreachable';
/**
* @var string
*/
public $nextPageToken;
protected $observationSourcesType = ObservationSource::class;
protected $observationSourcesDataType = 'array';
/**
* @var string[]
*/
public $unreachable;
/**
* @param string
*/
public function setNextPageToken($nextPageToken)
{
$this->nextPageToken = $nextPageToken;
}
/**
* @return string
*/
public function getNextPageToken()
{
return $this->nextPageToken;
}
/**
* @param ObservationSource[]
*/
public function setObservationSources($observationSources)
{
$this->observationSources = $observationSources;
}
/**
* @return ObservationSource[]
*/
public function getObservationSources()
{
return $this->observationSources;
}
/**
* @param string[]
*/
public function setUnreachable($unreachable)
{
$this->unreachable = $unreachable;
}
/**
* @return string[]
*/
public function getUnreachable()
{
return $this->unreachable;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ListObservationSourcesResponse::class, 'Google_Service_APIManagement_ListObservationSourcesResponse');

View File

@ -0,0 +1,61 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement;
class ListOperationsResponse extends \Google\Collection
{
protected $collection_key = 'operations';
/**
* @var string
*/
public $nextPageToken;
protected $operationsType = Operation::class;
protected $operationsDataType = 'array';
/**
* @param string
*/
public function setNextPageToken($nextPageToken)
{
$this->nextPageToken = $nextPageToken;
}
/**
* @return string
*/
public function getNextPageToken()
{
return $this->nextPageToken;
}
/**
* @param Operation[]
*/
public function setOperations($operations)
{
$this->operations = $operations;
}
/**
* @return Operation[]
*/
public function getOperations()
{
return $this->operations;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ListOperationsResponse::class, 'Google_Service_APIManagement_ListOperationsResponse');

View File

@ -0,0 +1,116 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement;
class Location extends \Google\Model
{
/**
* @var string
*/
public $displayName;
/**
* @var string[]
*/
public $labels;
/**
* @var string
*/
public $locationId;
/**
* @var array[]
*/
public $metadata;
/**
* @var string
*/
public $name;
/**
* @param string
*/
public function setDisplayName($displayName)
{
$this->displayName = $displayName;
}
/**
* @return string
*/
public function getDisplayName()
{
return $this->displayName;
}
/**
* @param string[]
*/
public function setLabels($labels)
{
$this->labels = $labels;
}
/**
* @return string[]
*/
public function getLabels()
{
return $this->labels;
}
/**
* @param string
*/
public function setLocationId($locationId)
{
$this->locationId = $locationId;
}
/**
* @return string
*/
public function getLocationId()
{
return $this->locationId;
}
/**
* @param array[]
*/
public function setMetadata($metadata)
{
$this->metadata = $metadata;
}
/**
* @return array[]
*/
public function getMetadata()
{
return $this->metadata;
}
/**
* @param string
*/
public function setName($name)
{
$this->name = $name;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Location::class, 'Google_Service_APIManagement_Location');

View File

@ -0,0 +1,117 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement;
class ObservationJob extends \Google\Collection
{
protected $collection_key = 'sources';
/**
* @var string
*/
public $createTime;
/**
* @var string
*/
public $name;
/**
* @var string[]
*/
public $sources;
/**
* @var string
*/
public $state;
/**
* @var string
*/
public $updateTime;
/**
* @param string
*/
public function setCreateTime($createTime)
{
$this->createTime = $createTime;
}
/**
* @return string
*/
public function getCreateTime()
{
return $this->createTime;
}
/**
* @param string
*/
public function setName($name)
{
$this->name = $name;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @param string[]
*/
public function setSources($sources)
{
$this->sources = $sources;
}
/**
* @return string[]
*/
public function getSources()
{
return $this->sources;
}
/**
* @param string
*/
public function setState($state)
{
$this->state = $state;
}
/**
* @return string
*/
public function getState()
{
return $this->state;
}
/**
* @param string
*/
public function setUpdateTime($updateTime)
{
$this->updateTime = $updateTime;
}
/**
* @return string
*/
public function getUpdateTime()
{
return $this->updateTime;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ObservationJob::class, 'Google_Service_APIManagement_ObservationJob');

View File

@ -0,0 +1,114 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement;
class ObservationSource extends \Google\Model
{
/**
* @var string
*/
public $createTime;
protected $gclbObservationSourceType = GclbObservationSource::class;
protected $gclbObservationSourceDataType = '';
/**
* @var string
*/
public $name;
/**
* @var string
*/
public $state;
/**
* @var string
*/
public $updateTime;
/**
* @param string
*/
public function setCreateTime($createTime)
{
$this->createTime = $createTime;
}
/**
* @return string
*/
public function getCreateTime()
{
return $this->createTime;
}
/**
* @param GclbObservationSource
*/
public function setGclbObservationSource(GclbObservationSource $gclbObservationSource)
{
$this->gclbObservationSource = $gclbObservationSource;
}
/**
* @return GclbObservationSource
*/
public function getGclbObservationSource()
{
return $this->gclbObservationSource;
}
/**
* @param string
*/
public function setName($name)
{
$this->name = $name;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @param string
*/
public function setState($state)
{
$this->state = $state;
}
/**
* @return string
*/
public function getState()
{
return $this->state;
}
/**
* @param string
*/
public function setUpdateTime($updateTime)
{
$this->updateTime = $updateTime;
}
/**
* @return string
*/
public function getUpdateTime()
{
return $this->updateTime;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ObservationSource::class, 'Google_Service_APIManagement_ObservationSource');

View File

@ -0,0 +1,114 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement;
class Operation extends \Google\Model
{
/**
* @var bool
*/
public $done;
protected $errorType = Status::class;
protected $errorDataType = '';
/**
* @var array[]
*/
public $metadata;
/**
* @var string
*/
public $name;
/**
* @var array[]
*/
public $response;
/**
* @param bool
*/
public function setDone($done)
{
$this->done = $done;
}
/**
* @return bool
*/
public function getDone()
{
return $this->done;
}
/**
* @param Status
*/
public function setError(Status $error)
{
$this->error = $error;
}
/**
* @return Status
*/
public function getError()
{
return $this->error;
}
/**
* @param array[]
*/
public function setMetadata($metadata)
{
$this->metadata = $metadata;
}
/**
* @return array[]
*/
public function getMetadata()
{
return $this->metadata;
}
/**
* @param string
*/
public function setName($name)
{
$this->name = $name;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @param array[]
*/
public function setResponse($response)
{
$this->response = $response;
}
/**
* @return array[]
*/
public function getResponse()
{
return $this->response;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Operation::class, 'Google_Service_APIManagement_Operation');

View File

@ -0,0 +1,152 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement;
class OperationMetadata extends \Google\Model
{
/**
* @var string
*/
public $apiVersion;
/**
* @var string
*/
public $createTime;
/**
* @var string
*/
public $endTime;
/**
* @var bool
*/
public $requestedCancellation;
/**
* @var string
*/
public $statusMessage;
/**
* @var string
*/
public $target;
/**
* @var string
*/
public $verb;
/**
* @param string
*/
public function setApiVersion($apiVersion)
{
$this->apiVersion = $apiVersion;
}
/**
* @return string
*/
public function getApiVersion()
{
return $this->apiVersion;
}
/**
* @param string
*/
public function setCreateTime($createTime)
{
$this->createTime = $createTime;
}
/**
* @return string
*/
public function getCreateTime()
{
return $this->createTime;
}
/**
* @param string
*/
public function setEndTime($endTime)
{
$this->endTime = $endTime;
}
/**
* @return string
*/
public function getEndTime()
{
return $this->endTime;
}
/**
* @param bool
*/
public function setRequestedCancellation($requestedCancellation)
{
$this->requestedCancellation = $requestedCancellation;
}
/**
* @return bool
*/
public function getRequestedCancellation()
{
return $this->requestedCancellation;
}
/**
* @param string
*/
public function setStatusMessage($statusMessage)
{
$this->statusMessage = $statusMessage;
}
/**
* @return string
*/
public function getStatusMessage()
{
return $this->statusMessage;
}
/**
* @param string
*/
public function setTarget($target)
{
$this->target = $target;
}
/**
* @return string
*/
public function getTarget()
{
return $this->target;
}
/**
* @param string
*/
public function setVerb($verb)
{
$this->verb = $verb;
}
/**
* @return string
*/
public function getVerb()
{
return $this->verb;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(OperationMetadata::class, 'Google_Service_APIManagement_OperationMetadata');

View File

@ -0,0 +1,33 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement\Resource;
/**
* The "projects" collection of methods.
* Typical usage is:
* <code>
* $apimService = new Google\Service\APIManagement(...);
* $projects = $apimService->projects;
* </code>
*/
class Projects extends \Google\Service\Resource
{
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Projects::class, 'Google_Service_APIManagement_Resource_Projects');

View File

@ -0,0 +1,100 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement\Resource;
use Google\Service\APIManagement\ListApiObservationTagsResponse;
use Google\Service\APIManagement\ListLocationsResponse;
use Google\Service\APIManagement\Location;
/**
* The "locations" collection of methods.
* Typical usage is:
* <code>
* $apimService = new Google\Service\APIManagement(...);
* $locations = $apimService->projects_locations;
* </code>
*/
class ProjectsLocations extends \Google\Service\Resource
{
/**
* Gets information about a location. (locations.get)
*
* @param string $name Resource name for the location.
* @param array $optParams Optional parameters.
* @return Location
* @throws \Google\Service\Exception
*/
public function get($name, $optParams = [])
{
$params = ['name' => $name];
$params = array_merge($params, $optParams);
return $this->call('get', [$params], Location::class);
}
/**
* Lists information about the supported locations for this service.
* (locations.listProjectsLocations)
*
* @param string $name The resource that owns the locations collection, if
* applicable.
* @param array $optParams Optional parameters.
*
* @opt_param string filter A filter to narrow down results to a preferred
* subset. The filtering language accepts strings like `"displayName=tokyo"`,
* and is documented in more detail in [AIP-160](https://google.aip.dev/160).
* @opt_param int pageSize The maximum number of results to return. If not set,
* the service selects a default.
* @opt_param string pageToken A page token received from the `next_page_token`
* field in the response. Send that page token to receive the subsequent page.
* @return ListLocationsResponse
* @throws \Google\Service\Exception
*/
public function listProjectsLocations($name, $optParams = [])
{
$params = ['name' => $name];
$params = array_merge($params, $optParams);
return $this->call('list', [$params], ListLocationsResponse::class);
}
/**
* ListApiObservationTags lists all extant tags on any observation in the given
* project. (locations.listApiObservationTags)
*
* @param string $parent Required. The parent, which owns this collection of
* tags. Format: projects/{project}/locations/{location}
* @param array $optParams Optional parameters.
*
* @opt_param int pageSize Optional. The maximum number of tags to return. The
* service may return fewer than this value. If unspecified, at most 10 tags
* will be returned. The maximum value is 1000; values above 1000 will be
* coerced to 1000.
* @opt_param string pageToken Optional. A page token, received from a previous
* `ListApiObservationTags` call. Provide this to retrieve the subsequent page.
* When paginating, all other parameters provided to `ListApiObservationTags`
* must match the call that provided the page token.
* @return ListApiObservationTagsResponse
* @throws \Google\Service\Exception
*/
public function listApiObservationTags($parent, $optParams = [])
{
$params = ['parent' => $parent];
$params = array_merge($params, $optParams);
return $this->call('listApiObservationTags', [$params], ListApiObservationTagsResponse::class);
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ProjectsLocations::class, 'Google_Service_APIManagement_Resource_ProjectsLocations');

View File

@ -0,0 +1,162 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement\Resource;
use Google\Service\APIManagement\DisableObservationJobRequest;
use Google\Service\APIManagement\EnableObservationJobRequest;
use Google\Service\APIManagement\ListObservationJobsResponse;
use Google\Service\APIManagement\ObservationJob;
use Google\Service\APIManagement\Operation;
/**
* The "observationJobs" collection of methods.
* Typical usage is:
* <code>
* $apimService = new Google\Service\APIManagement(...);
* $observationJobs = $apimService->projects_locations_observationJobs;
* </code>
*/
class ProjectsLocationsObservationJobs extends \Google\Service\Resource
{
/**
* CreateObservationJob creates a new ObservationJob but does not have any
* effecton its own. It is a configuration that can be used in an Observation
* Job to collect data about existing APIs. (observationJobs.create)
*
* @param string $parent Required. The parent resource where this ObservationJob
* will be created. Format: projects/{project}/locations/{location}
* @param ObservationJob $postBody
* @param array $optParams Optional parameters.
*
* @opt_param string observationJobId Required. The ID to use for the
* Observation Job. This value should be 4-63 characters, and valid characters
* are /a-z-/.
* @opt_param string requestId Optional. An optional request ID to identify
* requests. Specify a unique request ID so that if you must retry your request,
* the server will know to ignore the request if it has already been completed.
* The server will guarantee that for at least 60 minutes since the first
* request. For example, consider a situation where you make an initial request
* and the request times out. If you make the request again with the same
* request ID, the server can check if original operation with the same request
* ID was received, and if so, will ignore the second request. This prevents
* clients from accidentally creating duplicate commitments. The request ID must
* be a valid UUID with the exception that zero UUID is not supported
* (00000000-0000-0000-0000-000000000000).
* @return Operation
* @throws \Google\Service\Exception
*/
public function create($parent, ObservationJob $postBody, $optParams = [])
{
$params = ['parent' => $parent, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('create', [$params], Operation::class);
}
/**
* DeleteObservationJob deletes an ObservationJob. This method will fail if the
* observation job is currently being used by any ObservationSource, even if not
* enabled. (observationJobs.delete)
*
* @param string $name Required. Name of the resource Format:
* projects/{project}/locations/{location}/observationJobs/{observation_job}
* @param array $optParams Optional parameters.
* @return Operation
* @throws \Google\Service\Exception
*/
public function delete($name, $optParams = [])
{
$params = ['name' => $name];
$params = array_merge($params, $optParams);
return $this->call('delete', [$params], Operation::class);
}
/**
* Disables the given ObservationJob. (observationJobs.disable)
*
* @param string $name Required. The name of the ObservationJob to disable.
* Format: projects/{project}/locations/{location}/observationJobs/{job}
* @param DisableObservationJobRequest $postBody
* @param array $optParams Optional parameters.
* @return Operation
* @throws \Google\Service\Exception
*/
public function disable($name, DisableObservationJobRequest $postBody, $optParams = [])
{
$params = ['name' => $name, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('disable', [$params], Operation::class);
}
/**
* Enables the given ObservationJob. (observationJobs.enable)
*
* @param string $name Required. The name of the ObservationJob to enable.
* Format: projects/{project}/locations/{location}/observationJobs/{job}
* @param EnableObservationJobRequest $postBody
* @param array $optParams Optional parameters.
* @return Operation
* @throws \Google\Service\Exception
*/
public function enable($name, EnableObservationJobRequest $postBody, $optParams = [])
{
$params = ['name' => $name, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('enable', [$params], Operation::class);
}
/**
* GetObservationJob retrieves a single ObservationJob by name.
* (observationJobs.get)
*
* @param string $name Required. The name of the ObservationJob to retrieve.
* Format: projects/{project}/locations/{location}/observationJobs/{job}
* @param array $optParams Optional parameters.
* @return ObservationJob
* @throws \Google\Service\Exception
*/
public function get($name, $optParams = [])
{
$params = ['name' => $name];
$params = array_merge($params, $optParams);
return $this->call('get', [$params], ObservationJob::class);
}
/**
* ListObservationJobs gets all ObservationJobs for a given project and
* location. (observationJobs.listProjectsLocationsObservationJobs)
*
* @param string $parent Required. The parent, which owns this collection of
* ObservationJobs. Format: projects/{project}/locations/{location}
* @param array $optParams Optional parameters.
*
* @opt_param int pageSize Optional. The maximum number of ObservationJobs to
* return. The service may return fewer than this value. If unspecified, at most
* 10 ObservationJobs will be returned. The maximum value is 1000; values above
* 1000 will be coerced to 1000.
* @opt_param string pageToken Optional. A page token, received from a previous
* `ListObservationJobs` call. Provide this to retrieve the subsequent page.
* When paginating, all other parameters provided to `ListObservationJobs` must
* match the call that provided the page token.
* @return ListObservationJobsResponse
* @throws \Google\Service\Exception
*/
public function listProjectsLocationsObservationJobs($parent, $optParams = [])
{
$params = ['parent' => $parent];
$params = array_merge($params, $optParams);
return $this->call('list', [$params], ListObservationJobsResponse::class);
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ProjectsLocationsObservationJobs::class, 'Google_Service_APIManagement_Resource_ProjectsLocationsObservationJobs');

View File

@ -0,0 +1,100 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement\Resource;
use Google\Service\APIManagement\ApiObservation;
use Google\Service\APIManagement\BatchEditTagsApiObservationsRequest;
use Google\Service\APIManagement\BatchEditTagsApiObservationsResponse;
use Google\Service\APIManagement\ListApiObservationsResponse;
/**
* The "apiObservations" collection of methods.
* Typical usage is:
* <code>
* $apimService = new Google\Service\APIManagement(...);
* $apiObservations = $apimService->projects_locations_observationJobs_apiObservations;
* </code>
*/
class ProjectsLocationsObservationJobsApiObservations extends \Google\Service\Resource
{
/**
* BatchEditTagsApiObservations adds or removes Tags for ApiObservations.
* (apiObservations.batchEditTags)
*
* @param string $parent Required. The parent resource shared by all
* ApiObservations being edited. Format:
* projects/{project}/locations/{location}/observationJobs/{observation_job}
* @param BatchEditTagsApiObservationsRequest $postBody
* @param array $optParams Optional parameters.
* @return BatchEditTagsApiObservationsResponse
* @throws \Google\Service\Exception
*/
public function batchEditTags($parent, BatchEditTagsApiObservationsRequest $postBody, $optParams = [])
{
$params = ['parent' => $parent, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('batchEditTags', [$params], BatchEditTagsApiObservationsResponse::class);
}
/**
* GetApiObservation retrieves a single ApiObservation by name.
* (apiObservations.get)
*
* @param string $name Required. The name of the ApiObservation to retrieve.
* Format: projects/{project}/locations/{location}/observationJobs/{observation_
* job}/apiObservations/{api_observation}
* @param array $optParams Optional parameters.
* @return ApiObservation
* @throws \Google\Service\Exception
*/
public function get($name, $optParams = [])
{
$params = ['name' => $name];
$params = array_merge($params, $optParams);
return $this->call('get', [$params], ApiObservation::class);
}
/**
* ListApiObservations gets all ApiObservations for a given project and location
* and ObservationJob.
* (apiObservations.listProjectsLocationsObservationJobsApiObservations)
*
* @param string $parent Required. The parent, which owns this collection of
* ApiObservations. Format:
* projects/{project}/locations/{location}/observationJobs/{observation_job}
* @param array $optParams Optional parameters.
*
* @opt_param int pageSize Optional. The maximum number of ApiObservations to
* return. The service may return fewer than this value. If unspecified, at most
* 10 ApiObservations will be returned. The maximum value is 1000; values above
* 1000 will be coerced to 1000.
* @opt_param string pageToken Optional. A page token, received from a previous
* `ListApiObservations` call. Provide this to retrieve the subsequent page.
* When paginating, all other parameters provided to `ListApiObservations` must
* match the call that provided the page token.
* @return ListApiObservationsResponse
* @throws \Google\Service\Exception
*/
public function listProjectsLocationsObservationJobsApiObservations($parent, $optParams = [])
{
$params = ['parent' => $parent];
$params = array_merge($params, $optParams);
return $this->call('list', [$params], ListApiObservationsResponse::class);
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ProjectsLocationsObservationJobsApiObservations::class, 'Google_Service_APIManagement_Resource_ProjectsLocationsObservationJobsApiObservations');

View File

@ -0,0 +1,79 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement\Resource;
use Google\Service\APIManagement\ApiOperation;
use Google\Service\APIManagement\ListApiOperationsResponse;
/**
* The "apiOperations" collection of methods.
* Typical usage is:
* <code>
* $apimService = new Google\Service\APIManagement(...);
* $apiOperations = $apimService->projects_locations_observationJobs_apiObservations_apiOperations;
* </code>
*/
class ProjectsLocationsObservationJobsApiObservationsApiOperations extends \Google\Service\Resource
{
/**
* GetApiOperation retrieves a single ApiOperation by name. (apiOperations.get)
*
* @param string $name Required. The name of the ApiOperation to retrieve.
* Format: projects/{project}/locations/{location}/observationJobs/{observation_
* job}/apiObservations/{api_observation}/apiOperation/{api_operation}
* @param array $optParams Optional parameters.
* @return ApiOperation
* @throws \Google\Service\Exception
*/
public function get($name, $optParams = [])
{
$params = ['name' => $name];
$params = array_merge($params, $optParams);
return $this->call('get', [$params], ApiOperation::class);
}
/**
* ListApiOperations gets all ApiOperations for a given project and location and
* ObservationJob and ApiObservation. (apiOperations.listProjectsLocationsObserv
* ationJobsApiObservationsApiOperations)
*
* @param string $parent Required. The parent, which owns this collection of
* ApiOperations. Format: projects/{project}/locations/{location}/observationJob
* s/{observation_job}/apiObservations/{api_observation}
* @param array $optParams Optional parameters.
*
* @opt_param int pageSize Optional. The maximum number of ApiOperations to
* return. The service may return fewer than this value. If unspecified, at most
* 10 ApiOperations will be returned. The maximum value is 1000; values above
* 1000 will be coerced to 1000.
* @opt_param string pageToken Optional. A page token, received from a previous
* `ListApiApiOperations` call. Provide this to retrieve the subsequent page.
* When paginating, all other parameters provided to `ListApiApiOperations` must
* match the call that provided the page token.
* @return ListApiOperationsResponse
* @throws \Google\Service\Exception
*/
public function listProjectsLocationsObservationJobsApiObservationsApiOperations($parent, $optParams = [])
{
$params = ['parent' => $parent];
$params = array_merge($params, $optParams);
return $this->call('list', [$params], ListApiOperationsResponse::class);
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ProjectsLocationsObservationJobsApiObservationsApiOperations::class, 'Google_Service_APIManagement_Resource_ProjectsLocationsObservationJobsApiObservationsApiOperations');

View File

@ -0,0 +1,128 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement\Resource;
use Google\Service\APIManagement\ListObservationSourcesResponse;
use Google\Service\APIManagement\ObservationSource;
use Google\Service\APIManagement\Operation;
/**
* The "observationSources" collection of methods.
* Typical usage is:
* <code>
* $apimService = new Google\Service\APIManagement(...);
* $observationSources = $apimService->projects_locations_observationSources;
* </code>
*/
class ProjectsLocationsObservationSources extends \Google\Service\Resource
{
/**
* CreateObservationSource creates a new ObservationSource but does not affect
* any deployed infrastructure. It is a configuration that can be used in an
* Observation Job to collect data about APIs running in user's dataplane.
* (observationSources.create)
*
* @param string $parent Required. Value for parent.
* @param ObservationSource $postBody
* @param array $optParams Optional parameters.
*
* @opt_param string observationSourceId Required. The ID to use for the
* Observation Source. This value should be 4-63 characters, and valid
* characters are /a-z-/.
* @opt_param string requestId Optional. An optional request ID to identify
* requests. Specify a unique request ID so that if you must retry your request,
* the server will know to ignore the request if it has already been completed.
* The server will guarantee that for at least 60 minutes since the first
* request. For example, consider a situation where you make an initial request
* and the request times out. If you make the request again with the same
* request ID, the server can check if original operation with the same request
* ID was received, and if so, will ignore the second request. This prevents
* clients from accidentally creating duplicate commitments. The request ID must
* be a valid UUID with the exception that zero UUID is not supported
* (00000000-0000-0000-0000-000000000000).
* @return Operation
* @throws \Google\Service\Exception
*/
public function create($parent, ObservationSource $postBody, $optParams = [])
{
$params = ['parent' => $parent, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('create', [$params], Operation::class);
}
/**
* DeleteObservationSource deletes an observation source. This method will fail
* if the observation source is currently being used by any ObservationJob, even
* if not enabled. (observationSources.delete)
*
* @param string $name Required. Name of the resource Format:
* projects/{project}/locations/{location}/observationSources/{source}
* @param array $optParams Optional parameters.
* @return Operation
* @throws \Google\Service\Exception
*/
public function delete($name, $optParams = [])
{
$params = ['name' => $name];
$params = array_merge($params, $optParams);
return $this->call('delete', [$params], Operation::class);
}
/**
* GetObservationSource retrieves a single ObservationSource by name.
* (observationSources.get)
*
* @param string $name Required. The name of the ObservationSource to retrieve.
* Format: projects/{project}/locations/{location}/observationSources/{source}
* @param array $optParams Optional parameters.
* @return ObservationSource
* @throws \Google\Service\Exception
*/
public function get($name, $optParams = [])
{
$params = ['name' => $name];
$params = array_merge($params, $optParams);
return $this->call('get', [$params], ObservationSource::class);
}
/**
* ListObservationSources gets all ObservationSources for a given project and
* location. (observationSources.listProjectsLocationsObservationSources)
*
* @param string $parent Required. The parent, which owns this collection of
* ObservationSources. Format: projects/{project}/locations/{location}
* @param array $optParams Optional parameters.
*
* @opt_param int pageSize Optional. The maximum number of ObservationSources to
* return. The service may return fewer than this value. If unspecified, at most
* 10 ObservationSources will be returned. The maximum value is 1000; values
* above 1000 will be coerced to 1000.
* @opt_param string pageToken Optional. A page token, received from a previous
* `ListObservationSources` call. Provide this to retrieve the subsequent page.
* When paginating, all other parameters provided to `ListObservationSources`
* must match the call that provided the page token.
* @return ListObservationSourcesResponse
* @throws \Google\Service\Exception
*/
public function listProjectsLocationsObservationSources($parent, $optParams = [])
{
$params = ['parent' => $parent];
$params = array_merge($params, $optParams);
return $this->call('list', [$params], ListObservationSourcesResponse::class);
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ProjectsLocationsObservationSources::class, 'Google_Service_APIManagement_Resource_ProjectsLocationsObservationSources');

View File

@ -0,0 +1,114 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement\Resource;
use Google\Service\APIManagement\ApimEmpty;
use Google\Service\APIManagement\CancelOperationRequest;
use Google\Service\APIManagement\ListOperationsResponse;
use Google\Service\APIManagement\Operation;
/**
* The "operations" collection of methods.
* Typical usage is:
* <code>
* $apimService = new Google\Service\APIManagement(...);
* $operations = $apimService->projects_locations_operations;
* </code>
*/
class ProjectsLocationsOperations extends \Google\Service\Resource
{
/**
* Starts asynchronous cancellation on a long-running operation. The server
* makes a best effort to cancel the operation, but success is not guaranteed.
* If the server doesn't support this method, it returns
* `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or
* other methods to check whether the cancellation succeeded or whether the
* operation completed despite cancellation. On successful cancellation, the
* operation is not deleted; instead, it becomes an operation with an
* Operation.error value with a google.rpc.Status.code of 1, corresponding to
* `Code.CANCELLED`. (operations.cancel)
*
* @param string $name The name of the operation resource to be cancelled.
* @param CancelOperationRequest $postBody
* @param array $optParams Optional parameters.
* @return ApimEmpty
* @throws \Google\Service\Exception
*/
public function cancel($name, CancelOperationRequest $postBody, $optParams = [])
{
$params = ['name' => $name, 'postBody' => $postBody];
$params = array_merge($params, $optParams);
return $this->call('cancel', [$params], ApimEmpty::class);
}
/**
* Deletes a long-running operation. This method indicates that the client is no
* longer interested in the operation result. It does not cancel the operation.
* If the server doesn't support this method, it returns
* `google.rpc.Code.UNIMPLEMENTED`. (operations.delete)
*
* @param string $name The name of the operation resource to be deleted.
* @param array $optParams Optional parameters.
* @return ApimEmpty
* @throws \Google\Service\Exception
*/
public function delete($name, $optParams = [])
{
$params = ['name' => $name];
$params = array_merge($params, $optParams);
return $this->call('delete', [$params], ApimEmpty::class);
}
/**
* Gets the latest state of a long-running operation. Clients can use this
* method to poll the operation result at intervals as recommended by the API
* service. (operations.get)
*
* @param string $name The name of the operation resource.
* @param array $optParams Optional parameters.
* @return Operation
* @throws \Google\Service\Exception
*/
public function get($name, $optParams = [])
{
$params = ['name' => $name];
$params = array_merge($params, $optParams);
return $this->call('get', [$params], Operation::class);
}
/**
* Lists operations that match the specified filter in the request. If the
* server doesn't support this method, it returns `UNIMPLEMENTED`.
* (operations.listProjectsLocationsOperations)
*
* @param string $name The name of the operation's parent resource.
* @param array $optParams Optional parameters.
*
* @opt_param string filter The standard list filter.
* @opt_param int pageSize The standard list page size.
* @opt_param string pageToken The standard list page token.
* @return ListOperationsResponse
* @throws \Google\Service\Exception
*/
public function listProjectsLocationsOperations($name, $optParams = [])
{
$params = ['name' => $name];
$params = array_merge($params, $optParams);
return $this->call('list', [$params], ListOperationsResponse::class);
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ProjectsLocationsOperations::class, 'Google_Service_APIManagement_Resource_ProjectsLocationsOperations');

View File

@ -0,0 +1,81 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement;
class Status extends \Google\Collection
{
protected $collection_key = 'details';
/**
* @var int
*/
public $code;
/**
* @var array[]
*/
public $details;
/**
* @var string
*/
public $message;
/**
* @param int
*/
public function setCode($code)
{
$this->code = $code;
}
/**
* @return int
*/
public function getCode()
{
return $this->code;
}
/**
* @param array[]
*/
public function setDetails($details)
{
$this->details = $details;
}
/**
* @return array[]
*/
public function getDetails()
{
return $this->details;
}
/**
* @param string
*/
public function setMessage($message)
{
$this->message = $message;
}
/**
* @return string
*/
public function getMessage()
{
return $this->message;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Status::class, 'Google_Service_APIManagement_Status');

View File

@ -0,0 +1,62 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\APIManagement;
class TagAction extends \Google\Model
{
/**
* @var string
*/
public $action;
/**
* @var string
*/
public $tag;
/**
* @param string
*/
public function setAction($action)
{
$this->action = $action;
}
/**
* @return string
*/
public function getAction()
{
return $this->action;
}
/**
* @param string
*/
public function setTag($tag)
{
$this->tag = $tag;
}
/**
* @return string
*/
public function getTag()
{
return $this->tag;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(TagAction::class, 'Google_Service_APIManagement_TagAction');

View File

@ -58,6 +58,10 @@ class AccessApprovalSettings extends \Google\Collection
* @var int
*/
public $preferredRequestExpirationDays;
/**
* @var string
*/
public $requestScopeMaxWidthPreference;
/**
* @var bool
*/
@ -203,6 +207,20 @@ class AccessApprovalSettings extends \Google\Collection
{
return $this->preferredRequestExpirationDays;
}
/**
* @param string
*/
public function setRequestScopeMaxWidthPreference($requestScopeMaxWidthPreference)
{
$this->requestScopeMaxWidthPreference = $requestScopeMaxWidthPreference;
}
/**
* @return string
*/
public function getRequestScopeMaxWidthPreference()
{
return $this->requestScopeMaxWidthPreference;
}
/**
* @param bool
*/

View File

@ -31,6 +31,8 @@ class ApprovalRequest extends \Google\Model
* @var string
*/
public $requestTime;
protected $requestedAugmentedInfoType = AugmentedInfo::class;
protected $requestedAugmentedInfoDataType = '';
/**
* @var string
*/
@ -106,6 +108,20 @@ class ApprovalRequest extends \Google\Model
{
return $this->requestTime;
}
/**
* @param AugmentedInfo
*/
public function setRequestedAugmentedInfo(AugmentedInfo $requestedAugmentedInfo)
{
$this->requestedAugmentedInfo = $requestedAugmentedInfo;
}
/**
* @return AugmentedInfo
*/
public function getRequestedAugmentedInfo()
{
return $this->requestedAugmentedInfo;
}
/**
* @param string
*/

View File

@ -0,0 +1,44 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\AccessApproval;
class AugmentedInfo extends \Google\Model
{
/**
* @var string
*/
public $command;
/**
* @param string
*/
public function setCommand($command)
{
$this->command = $command;
}
/**
* @return string
*/
public function getCommand()
{
return $this->command;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(AugmentedInfo::class, 'Google_Service_AccessApproval_AugmentedInfo');

View File

@ -567,6 +567,10 @@ class AccessContextManager extends \Google\Service
'type' => 'string',
'required' => true,
],
'append' => [
'location' => 'query',
'type' => 'boolean',
],
'updateMask' => [
'location' => 'query',
'type' => 'string',

View File

@ -0,0 +1,42 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\AccessContextManager;
class AccessScope extends \Google\Model
{
protected $clientScopeType = ClientScope::class;
protected $clientScopeDataType = '';
/**
* @param ClientScope
*/
public function setClientScope(ClientScope $clientScope)
{
$this->clientScope = $clientScope;
}
/**
* @return ClientScope
*/
public function getClientScope()
{
return $this->clientScope;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(AccessScope::class, 'Google_Service_AccessContextManager_AccessScope');

View File

@ -0,0 +1,61 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\AccessContextManager;
class AccessSettings extends \Google\Collection
{
protected $collection_key = 'accessLevels';
/**
* @var string[]
*/
public $accessLevels;
protected $sessionSettingsType = SessionSettings::class;
protected $sessionSettingsDataType = '';
/**
* @param string[]
*/
public function setAccessLevels($accessLevels)
{
$this->accessLevels = $accessLevels;
}
/**
* @return string[]
*/
public function getAccessLevels()
{
return $this->accessLevels;
}
/**
* @param SessionSettings
*/
public function setSessionSettings(SessionSettings $sessionSettings)
{
$this->sessionSettings = $sessionSettings;
}
/**
* @return SessionSettings
*/
public function getSessionSettings()
{
return $this->sessionSettings;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(AccessSettings::class, 'Google_Service_AccessContextManager_AccessSettings');

View File

@ -0,0 +1,42 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\AccessContextManager;
class ClientScope extends \Google\Model
{
protected $restrictedClientApplicationType = Application::class;
protected $restrictedClientApplicationDataType = '';
/**
* @param Application
*/
public function setRestrictedClientApplication(Application $restrictedClientApplication)
{
$this->restrictedClientApplication = $restrictedClientApplication;
}
/**
* @return Application
*/
public function getRestrictedClientApplication()
{
return $this->restrictedClientApplication;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ClientScope::class, 'Google_Service_AccessContextManager_ClientScope');

View File

@ -23,6 +23,10 @@ class EgressPolicy extends \Google\Model
protected $egressFromDataType = '';
protected $egressToType = EgressTo::class;
protected $egressToDataType = '';
/**
* @var string
*/
public $title;
/**
* @param EgressFrom
@ -52,6 +56,20 @@ class EgressPolicy extends \Google\Model
{
return $this->egressTo;
}
/**
* @param string
*/
public function setTitle($title)
{
$this->title = $title;
}
/**
* @return string
*/
public function getTitle()
{
return $this->title;
}
}
// Adding a class alias for backwards compatibility with the previous class name.

View File

@ -19,7 +19,7 @@ namespace Google\Service\AccessContextManager;
class GcpUserAccessBinding extends \Google\Collection
{
protected $collection_key = 'restrictedClientApplications';
protected $collection_key = 'scopedAccessSettings';
/**
* @var string[]
*/
@ -38,6 +38,10 @@ class GcpUserAccessBinding extends \Google\Collection
public $name;
protected $restrictedClientApplicationsType = Application::class;
protected $restrictedClientApplicationsDataType = 'array';
protected $scopedAccessSettingsType = ScopedAccessSettings::class;
protected $scopedAccessSettingsDataType = 'array';
protected $sessionSettingsType = SessionSettings::class;
protected $sessionSettingsDataType = '';
/**
* @param string[]
@ -109,6 +113,34 @@ class GcpUserAccessBinding extends \Google\Collection
{
return $this->restrictedClientApplications;
}
/**
* @param ScopedAccessSettings[]
*/
public function setScopedAccessSettings($scopedAccessSettings)
{
$this->scopedAccessSettings = $scopedAccessSettings;
}
/**
* @return ScopedAccessSettings[]
*/
public function getScopedAccessSettings()
{
return $this->scopedAccessSettings;
}
/**
* @param SessionSettings
*/
public function setSessionSettings(SessionSettings $sessionSettings)
{
$this->sessionSettings = $sessionSettings;
}
/**
* @return SessionSettings
*/
public function getSessionSettings()
{
return $this->sessionSettings;
}
}
// Adding a class alias for backwards compatibility with the previous class name.

View File

@ -23,6 +23,10 @@ class IngressPolicy extends \Google\Model
protected $ingressFromDataType = '';
protected $ingressToType = IngressTo::class;
protected $ingressToDataType = '';
/**
* @var string
*/
public $title;
/**
* @param IngressFrom
@ -52,6 +56,20 @@ class IngressPolicy extends \Google\Model
{
return $this->ingressTo;
}
/**
* @param string
*/
public function setTitle($title)
{
$this->title = $title;
}
/**
* @return string
*/
public function getTitle()
{
return $this->title;
}
}
// Adding a class alias for backwards compatibility with the previous class name.

View File

@ -0,0 +1,116 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\AccessContextManager;
class ReauthSettings extends \Google\Model
{
/**
* @var string
*/
public $maxInactivity;
/**
* @var string
*/
public $reauthMethod;
/**
* @var string
*/
public $sessionLength;
/**
* @var bool
*/
public $sessionLengthEnabled;
/**
* @var bool
*/
public $useOidcMaxAge;
/**
* @param string
*/
public function setMaxInactivity($maxInactivity)
{
$this->maxInactivity = $maxInactivity;
}
/**
* @return string
*/
public function getMaxInactivity()
{
return $this->maxInactivity;
}
/**
* @param string
*/
public function setReauthMethod($reauthMethod)
{
$this->reauthMethod = $reauthMethod;
}
/**
* @return string
*/
public function getReauthMethod()
{
return $this->reauthMethod;
}
/**
* @param string
*/
public function setSessionLength($sessionLength)
{
$this->sessionLength = $sessionLength;
}
/**
* @return string
*/
public function getSessionLength()
{
return $this->sessionLength;
}
/**
* @param bool
*/
public function setSessionLengthEnabled($sessionLengthEnabled)
{
$this->sessionLengthEnabled = $sessionLengthEnabled;
}
/**
* @return bool
*/
public function getSessionLengthEnabled()
{
return $this->sessionLengthEnabled;
}
/**
* @param bool
*/
public function setUseOidcMaxAge($useOidcMaxAge)
{
$this->useOidcMaxAge = $useOidcMaxAge;
}
/**
* @return bool
*/
public function getUseOidcMaxAge()
{
return $this->useOidcMaxAge;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ReauthSettings::class, 'Google_Service_AccessContextManager_ReauthSettings');

View File

@ -131,8 +131,8 @@ class AccessPolicies extends \Google\Service\Resource
* successful status after the changes to the access policy propagate to long-
* lasting storage. (accessPolicies.patch)
*
* @param string $name Output only. Resource name of the `AccessPolicy`. Format:
* `accessPolicies/{access_policy}`
* @param string $name Output only. Identifier. Resource name of the
* `AccessPolicy`. Format: `accessPolicies/{access_policy}`
* @param AccessPolicy $postBody
* @param array $optParams Optional parameters.
*

View File

@ -123,7 +123,7 @@ class AccessPoliciesAccessLevels extends \Google\Service\Resource
* lasting storage. If access levels contain errors, an error response is
* returned for the first error encountered. (accessLevels.patch)
*
* @param string $name Resource name for the `AccessLevel`. Format:
* @param string $name Identifier. Resource name for the `AccessLevel`. Format:
* `accessPolicies/{access_policy}/accessLevels/{access_level}`. The
* `access_level` component must begin with a letter, followed by alphanumeric
* characters or `_`. Its maximum length is 50 characters. After you create an

View File

@ -116,7 +116,8 @@ class AccessPoliciesAuthorizedOrgsDescs extends \Google\Service\Resource
* `AuthorizedOrgsDesc` can be updated. The name, authorization_type, asset_type
* and authorization_direction cannot be updated. (authorizedOrgsDescs.patch)
*
* @param string $name Resource name for the `AuthorizedOrgsDesc`. Format:
* @param string $name Identifier. Resource name for the `AuthorizedOrgsDesc`.
* Format:
* `accessPolicies/{access_policy}/authorizedOrgsDescs/{authorized_orgs_desc}`.
* The `authorized_orgs_desc` component must begin with a letter, followed by
* alphanumeric characters or `_`. After you create an `AuthorizedOrgsDesc`, you

View File

@ -141,7 +141,8 @@ class AccessPoliciesServicePerimeters extends \Google\Service\Resource
* storage. If a service perimeter contains errors, an error response is
* returned for the first error encountered. (servicePerimeters.patch)
*
* @param string $name Resource name for the `ServicePerimeter`. Format:
* @param string $name Identifier. Resource name for the `ServicePerimeter`.
* Format:
* `accessPolicies/{access_policy}/servicePerimeters/{service_perimeter}`. The
* `service_perimeter` component must begin with a letter, followed by
* alphanumeric characters or `_`. After you create a `ServicePerimeter`, you

View File

@ -40,7 +40,7 @@ class Operations extends \Google\Service\Resource
* other methods to check whether the cancellation succeeded or whether the
* operation completed despite cancellation. On successful cancellation, the
* operation is not deleted; instead, it becomes an operation with an
* Operation.error value with a google.rpc.Status.code of 1, corresponding to
* Operation.error value with a google.rpc.Status.code of `1`, corresponding to
* `Code.CANCELLED`. (operations.cancel)
*
* @param string $name The name of the operation resource to be cancelled.

View File

@ -119,10 +119,21 @@ class OrganizationsGcpUserAccessBindings extends \Google\Service\Resource
* @param GcpUserAccessBinding $postBody
* @param array $optParams Optional parameters.
*
* @opt_param bool append Optional. This field controls whether or not certain
* repeated settings in the update request overwrite or append to existing
* settings on the binding. If true, then append. Otherwise overwrite. So far,
* only scoped_access_settings with reauth_settings supports appending. Global
* access_levels, access_levels in scoped_access_settings,
* dry_run_access_levels, reauth_settings, and session_settings are not
* compatible with append functionality, and the request will return an error if
* append=true when these settings are in the update_mask. The request will also
* return an error if append=true when "scoped_access_settings" is not set in
* the update_mask.
* @opt_param string updateMask Required. Only the fields specified in this mask
* are updated. Because name and group_key cannot be changed, update_mask is
* required and may only contain the following fields: `access_levels`,
* `dry_run_access_levels`. update_mask { paths: "access_levels" }
* `dry_run_access_levels`, `reauth_settings` `session_settings`,
* `scoped_access_settings`. update_mask { paths: "access_levels" }
* @return Operation
* @throws \Google\Service\Exception
*/

View File

@ -0,0 +1,74 @@
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Google\Service\AccessContextManager;
class ScopedAccessSettings extends \Google\Model
{
protected $activeSettingsType = AccessSettings::class;
protected $activeSettingsDataType = '';
protected $dryRunSettingsType = AccessSettings::class;
protected $dryRunSettingsDataType = '';
protected $scopeType = AccessScope::class;
protected $scopeDataType = '';
/**
* @param AccessSettings
*/
public function setActiveSettings(AccessSettings $activeSettings)
{
$this->activeSettings = $activeSettings;
}
/**
* @return AccessSettings
*/
public function getActiveSettings()
{
return $this->activeSettings;
}
/**
* @param AccessSettings
*/
public function setDryRunSettings(AccessSettings $dryRunSettings)
{
$this->dryRunSettings = $dryRunSettings;
}
/**
* @return AccessSettings
*/
public function getDryRunSettings()
{
return $this->dryRunSettings;
}
/**
* @param AccessScope
*/
public function setScope(AccessScope $scope)
{
$this->scope = $scope;
}
/**
* @return AccessScope
*/
public function getScope()
{
return $this->scope;
}
}
// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ScopedAccessSettings::class, 'Google_Service_AccessContextManager_ScopedAccessSettings');

Some files were not shown because too many files have changed in this diff Show More