diff --git a/.gitignore b/.gitignore index f8cd337..7323189 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ composer.phar .idea +.scripts +whmcs rsync-dev1.sh rsync-dev2.sh *.zip diff --git a/composer.json b/composer.json index 98a9fc5..7e94b48 100644 --- a/composer.json +++ b/composer.json @@ -1,19 +1,20 @@ { "require": { - "whmcsexpert/whmcsexpert": "^1.1.7", - "plasticbrain/php-flash-messages": "^1", - "guzzlehttp/psr7": "^1.8", + "whmcsexpert/whmcsexpert": "1.1.7", + "plasticbrain/php-flash-messages": "~1", + "guzzlehttp/psr7": "~1.9", "ext-curl": "*", "php": ">=7.4", - "nfe/nfe": "^2.5" + "nfe/nfe": "^2.5", + "ext-json": "*" }, "require-dev": { "phpunit/phpunit": "@stable", - "kint-php/kint": "*", - "tracy/tracy": "2.7.6", - "phpmetrics/phpmetrics": "^2.7", + "kint-php/kint": "~5.0", + "tracy/tracy": "~2.7", + "phpmetrics/phpmetrics": "~2.8", "illuminate/database": "v5.8.36", - "squizlabs/php_codesniffer": "^3.7" + "squizlabs/php_codesniffer": "~3.7" }, "config": { "vendor-dir": "modules/addons/NFEioServiceInvoices/lib/vendor", diff --git a/composer.lock b/composer.lock index 2bccf72..d2e1f59 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9897988dffebd0816f5a06a49ad9ddcf", + "content-hash": "9d3328eb7139b63c91b644b63fb21216", "packages": [ { "name": "guzzlehttp/psr7", - "version": "1.9.0", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "e98e3e6d4f86621a9b75f623996e6bbdeb4b9318" + "reference": "e4490cabc77465aaee90b20cfc9a770f8c04be6b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/e98e3e6d4f86621a9b75f623996e6bbdeb4b9318", - "reference": "e98e3e6d4f86621a9b75f623996e6bbdeb4b9318", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/e4490cabc77465aaee90b20cfc9a770f8c04be6b", + "reference": "e4490cabc77465aaee90b20cfc9a770f8c04be6b", "shasum": "" }, "require": { @@ -36,11 +36,6 @@ "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.9-dev" - } - }, "autoload": { "files": [ "src/functions_include.php" @@ -98,7 +93,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/1.9.0" + "source": "https://github.com/guzzle/psr7/tree/1.9.1" }, "funding": [ { @@ -114,7 +109,7 @@ "type": "tidelift" } ], - "time": "2022-06-20T21:43:03+00:00" + "time": "2023-04-17T16:00:37+00:00" }, { "name": "nfe/nfe", @@ -223,25 +218,25 @@ }, { "name": "psr/http-message", - "version": "1.0.1", + "version": "1.1", "source": { "type": "git", "url": "https://github.com/php-fig/http-message.git", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/cb6ce4845ce34a8ad9e68117c10ee90a29919eba", + "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.1.x-dev" } }, "autoload": { @@ -270,9 +265,9 @@ "response" ], "support": { - "source": "https://github.com/php-fig/http-message/tree/master" + "source": "https://github.com/php-fig/http-message/tree/1.1" }, - "time": "2016-08-06T14:39:51+00:00" + "time": "2023-04-04T09:50:52+00:00" }, { "name": "ralouphie/getallheaders", @@ -364,6 +359,75 @@ } ], "packages-dev": [ + { + "name": "carbonphp/carbon-doctrine-types", + "version": "2.1.0", + "source": { + "type": "git", + "url": "https://github.com/CarbonPHP/carbon-doctrine-types.git", + "reference": "99f76ffa36cce3b70a4a6abce41dba15ca2e84cb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/CarbonPHP/carbon-doctrine-types/zipball/99f76ffa36cce3b70a4a6abce41dba15ca2e84cb", + "reference": "99f76ffa36cce3b70a4a6abce41dba15ca2e84cb", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0" + }, + "conflict": { + "doctrine/dbal": "<3.7.0 || >=4.0.0" + }, + "require-dev": { + "doctrine/dbal": "^3.7.0", + "nesbot/carbon": "^2.71.0 || ^3.0.0", + "phpunit/phpunit": "^10.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Carbon\\Doctrine\\": "src/Carbon/Doctrine/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "KyleKatarn", + "email": "kylekatarnls@gmail.com" + } + ], + "description": "Types to use Carbon in Doctrine", + "keywords": [ + "carbon", + "date", + "datetime", + "doctrine", + "time" + ], + "support": { + "issues": "https://github.com/CarbonPHP/carbon-doctrine-types/issues", + "source": "https://github.com/CarbonPHP/carbon-doctrine-types/tree/2.1.0" + }, + "funding": [ + { + "url": "https://github.com/kylekatarnls", + "type": "github" + }, + { + "url": "https://opencollective.com/Carbon", + "type": "open_collective" + }, + { + "url": "https://tidelift.com/funding/github/packagist/nesbot/carbon", + "type": "tidelift" + } + ], + "time": "2023-12-11T17:09:12+00:00" + }, { "name": "doctrine/inflector", "version": "1.4.4", @@ -758,16 +822,16 @@ }, { "name": "kint-php/kint", - "version": "5.0.5", + "version": "5.1.1", "source": { "type": "git", "url": "https://github.com/kint-php/kint.git", - "reference": "1033fc4a5075e15b9b46be20c246069ab44bc243" + "reference": "8c5ec370c3382ceae0b88e91f9bbb00e6bb4f93b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/kint-php/kint/zipball/1033fc4a5075e15b9b46be20c246069ab44bc243", - "reference": "1033fc4a5075e15b9b46be20c246069ab44bc243", + "url": "https://api.github.com/repos/kint-php/kint/zipball/8c5ec370c3382ceae0b88e91f9bbb00e6bb4f93b", + "reference": "8c5ec370c3382ceae0b88e91f9bbb00e6bb4f93b", "shasum": "" }, "require": { @@ -778,8 +842,8 @@ "phpspec/prophecy-phpunit": "^2", "phpunit/phpunit": "^9", "seld/phar-utils": "^1", - "symfony/finder": "^4.0 || ^5.0 || ^6.0", - "vimeo/psalm": "^5@dev" + "symfony/finder": ">=4.0", + "vimeo/psalm": "^5" }, "suggest": { "kint-php/kint-helpers": "Provides extra helper functions", @@ -817,9 +881,9 @@ ], "support": { "issues": "https://github.com/kint-php/kint/issues", - "source": "https://github.com/kint-php/kint/tree/5.0.5" + "source": "https://github.com/kint-php/kint/tree/5.1.1" }, - "time": "2023-03-08T14:50:41+00:00" + "time": "2024-04-26T14:20:09+00:00" }, { "name": "myclabs/deep-copy", @@ -882,28 +946,33 @@ }, { "name": "nesbot/carbon", - "version": "2.66.0", + "version": "2.72.5", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "496712849902241f04902033b0441b269effe001" + "reference": "afd46589c216118ecd48ff2b95d77596af1e57ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/496712849902241f04902033b0441b269effe001", - "reference": "496712849902241f04902033b0441b269effe001", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/afd46589c216118ecd48ff2b95d77596af1e57ed", + "reference": "afd46589c216118ecd48ff2b95d77596af1e57ed", "shasum": "" }, "require": { + "carbonphp/carbon-doctrine-types": "*", "ext-json": "*", "php": "^7.1.8 || ^8.0", + "psr/clock": "^1.0", "symfony/polyfill-mbstring": "^1.0", "symfony/polyfill-php80": "^1.16", "symfony/translation": "^3.4 || ^4.0 || ^5.0 || ^6.0" }, + "provide": { + "psr/clock-implementation": "1.0" + }, "require-dev": { - "doctrine/dbal": "^2.0 || ^3.1.4", - "doctrine/orm": "^2.7", + "doctrine/dbal": "^2.0 || ^3.1.4 || ^4.0", + "doctrine/orm": "^2.7 || ^3.0", "friendsofphp/php-cs-fixer": "^3.0", "kylekatarnls/multi-tester": "^2.0", "ondrejmirtes/better-reflection": "*", @@ -920,8 +989,8 @@ "type": "library", "extra": { "branch-alias": { - "dev-3.x": "3.x-dev", - "dev-master": "2.x-dev" + "dev-master": "3.x-dev", + "dev-2.x": "2.x-dev" }, "laravel": { "providers": [ @@ -980,25 +1049,25 @@ "type": "tidelift" } ], - "time": "2023-01-29T18:53:47+00:00" + "time": "2024-06-03T19:18:41+00:00" }, { "name": "nikic/php-parser", - "version": "v4.15.4", + "version": "v4.19.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290" + "reference": "4e1b88d21c69391150ace211e9eaf05810858d0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/6bb5176bc4af8bcb7d926f88718db9b96a2d4290", - "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4e1b88d21c69391150ace211e9eaf05810858d0b", + "reference": "4e1b88d21c69391150ace211e9eaf05810858d0b", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": ">=7.0" + "php": ">=7.1" }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", @@ -1034,26 +1103,27 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.4" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.19.1" }, - "time": "2023-03-05T19:49:14+00:00" + "time": "2024-03-17T08:10:35+00:00" }, { "name": "phar-io/manifest", - "version": "2.0.3", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53" + "reference": "54750ef60c58e43759730615a392c31c80e23176" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176", + "reference": "54750ef60c58e43759730615a392c31c80e23176", "shasum": "" }, "require": { "ext-dom": "*", + "ext-libxml": "*", "ext-phar": "*", "ext-xmlwriter": "*", "phar-io/version": "^3.0.1", @@ -1094,9 +1164,15 @@ "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", "support": { "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/2.0.3" + "source": "https://github.com/phar-io/manifest/tree/2.0.4" }, - "time": "2021-07-20T11:28:43+00:00" + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2024-03-03T12:33:53+00:00" }, { "name": "phar-io/version", @@ -1219,23 +1295,23 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.26", + "version": "9.2.31", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "443bc6912c9bd5b409254a40f4b0f4ced7c80ea1" + "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/443bc6912c9bd5b409254a40f4b0f4ced7c80ea1", - "reference": "443bc6912c9bd5b409254a40f4b0f4ced7c80ea1", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/48c34b5d8d983006bd2adc2d0de92963b9155965", + "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.15", + "nikic/php-parser": "^4.18 || ^5.0", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -1284,7 +1360,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.26" + "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.31" }, "funding": [ { @@ -1292,7 +1369,7 @@ "type": "github" } ], - "time": "2023-03-06T12:58:08+00:00" + "time": "2024-03-02T06:37:42+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1537,16 +1614,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.5", + "version": "9.6.19", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "86e761949019ae83f49240b2f2123fb5ab3b2fc5" + "reference": "a1a54a473501ef4cdeaae4e06891674114d79db8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/86e761949019ae83f49240b2f2123fb5ab3b2fc5", - "reference": "86e761949019ae83f49240b2f2123fb5ab3b2fc5", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a1a54a473501ef4cdeaae4e06891674114d79db8", + "reference": "a1a54a473501ef4cdeaae4e06891674114d79db8", "shasum": "" }, "require": { @@ -1561,7 +1638,7 @@ "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.13", + "phpunit/php-code-coverage": "^9.2.28", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", "phpunit/php-text-template": "^2.0.3", @@ -1619,7 +1696,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.5" + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.19" }, "funding": [ { @@ -1635,7 +1713,55 @@ "type": "tidelift" } ], - "time": "2023-03-09T06:34:10+00:00" + "time": "2024-04-05T04:35:58+00:00" + }, + { + "name": "psr/clock", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/clock.git", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Psr\\Clock\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for reading the clock.", + "homepage": "https://github.com/php-fig/clock", + "keywords": [ + "clock", + "now", + "psr", + "psr-20", + "time" + ], + "support": { + "issues": "https://github.com/php-fig/clock/issues", + "source": "https://github.com/php-fig/clock/tree/1.0.0" + }, + "time": "2022-11-25T14:36:26+00:00" }, { "name": "psr/container", @@ -1738,16 +1864,16 @@ }, { "name": "sebastian/cli-parser", - "version": "1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/2b56bea83a09de3ac06bb18b92f068e60cc6f50b", + "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b", "shasum": "" }, "require": { @@ -1782,7 +1908,7 @@ "homepage": "https://github.com/sebastianbergmann/cli-parser", "support": { "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.2" }, "funding": [ { @@ -1790,7 +1916,7 @@ "type": "github" } ], - "time": "2020-09-28T06:08:49+00:00" + "time": "2024-03-02T06:27:43+00:00" }, { "name": "sebastian/code-unit", @@ -1979,20 +2105,20 @@ }, { "name": "sebastian/complexity", - "version": "2.0.2", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" + "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/25f207c40d62b8b7aa32f5ab026c53561964053a", + "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a", "shasum": "" }, "require": { - "nikic/php-parser": "^4.7", + "nikic/php-parser": "^4.18 || ^5.0", "php": ">=7.3" }, "require-dev": { @@ -2024,7 +2150,7 @@ "homepage": "https://github.com/sebastianbergmann/complexity", "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.3" }, "funding": [ { @@ -2032,20 +2158,20 @@ "type": "github" } ], - "time": "2020-10-26T15:52:27+00:00" + "time": "2023-12-22T06:19:30+00:00" }, { "name": "sebastian/diff", - "version": "4.0.4", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc", + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc", "shasum": "" }, "require": { @@ -2090,7 +2216,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.6" }, "funding": [ { @@ -2098,7 +2224,7 @@ "type": "github" } ], - "time": "2020-10-26T13:10:38+00:00" + "time": "2024-03-02T06:30:58+00:00" }, { "name": "sebastian/environment", @@ -2165,16 +2291,16 @@ }, { "name": "sebastian/exporter", - "version": "4.0.5", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" + "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/78c00df8f170e02473b682df15bfcdacc3d32d72", + "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72", "shasum": "" }, "require": { @@ -2230,7 +2356,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.6" }, "funding": [ { @@ -2238,20 +2364,20 @@ "type": "github" } ], - "time": "2022-09-14T06:03:37+00:00" + "time": "2024-03-02T06:33:00+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.5", + "version": "5.0.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" + "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", + "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", "shasum": "" }, "require": { @@ -2294,7 +2420,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.7" }, "funding": [ { @@ -2302,24 +2428,24 @@ "type": "github" } ], - "time": "2022-02-14T08:28:10+00:00" + "time": "2024-03-02T06:35:11+00:00" }, { "name": "sebastian/lines-of-code", - "version": "1.0.3", + "version": "1.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" + "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e1e4a170560925c26d424b6a03aed157e7dcc5c5", + "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5", "shasum": "" }, "require": { - "nikic/php-parser": "^4.6", + "nikic/php-parser": "^4.18 || ^5.0", "php": ">=7.3" }, "require-dev": { @@ -2351,7 +2477,7 @@ "homepage": "https://github.com/sebastianbergmann/lines-of-code", "support": { "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.4" }, "funding": [ { @@ -2359,7 +2485,7 @@ "type": "github" } ], - "time": "2020-11-28T06:42:11+00:00" + "time": "2023-12-22T06:20:34+00:00" }, { "name": "sebastian/object-enumerator", @@ -2538,16 +2664,16 @@ }, { "name": "sebastian/resource-operations", - "version": "3.0.3", + "version": "3.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" + "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/05d5692a7993ecccd56a03e40cd7e5b09b1d404e", + "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e", "shasum": "" }, "require": { @@ -2559,7 +2685,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -2580,8 +2706,7 @@ "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", "support": { - "issues": "https://github.com/sebastianbergmann/resource-operations/issues", - "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" + "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.4" }, "funding": [ { @@ -2589,7 +2714,7 @@ "type": "github" } ], - "time": "2020-09-28T06:45:17+00:00" + "time": "2024-03-14T16:00:52+00:00" }, { "name": "sebastian/type", @@ -2702,16 +2827,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.7.2", + "version": "3.10.1", "source": { "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879" + "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", + "reference": "8f90f7a53ce271935282967f53d0894f8f1ff877" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ed8e00df0a83aa96acf703f8c2979ff33341f879", - "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/8f90f7a53ce271935282967f53d0894f8f1ff877", + "reference": "8f90f7a53ce271935282967f53d0894f8f1ff877", "shasum": "" }, "require": { @@ -2721,11 +2846,11 @@ "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" }, "bin": [ - "bin/phpcs", - "bin/phpcbf" + "bin/phpcbf", + "bin/phpcs" ], "type": "library", "extra": { @@ -2740,35 +2865,58 @@ "authors": [ { "name": "Greg Sherwood", - "role": "lead" + "role": "Former lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "Current lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" } ], "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", "keywords": [ "phpcs", "standards", "static analysis" ], "support": { - "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", - "source": "https://github.com/squizlabs/PHP_CodeSniffer", - "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" + "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", + "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy", + "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki" }, - "time": "2023-02-22T23:07:41+00:00" + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2024-05-22T21:24:41+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v2.5.2", + "version": "v2.5.3", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66" + "reference": "80d075412b557d41002320b96a096ca65aa2c98d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/80d075412b557d41002320b96a096ca65aa2c98d", + "reference": "80d075412b557d41002320b96a096ca65aa2c98d", "shasum": "" }, "require": { @@ -2806,7 +2954,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.3" }, "funding": [ { @@ -2822,20 +2970,20 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2023-01-24T14:02:46+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.27.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" + "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec", + "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec", "shasum": "" }, "require": { @@ -2849,9 +2997,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -2889,7 +3034,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.29.0" }, "funding": [ { @@ -2905,20 +3050,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.27.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" + "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", + "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", "shasum": "" }, "require": { @@ -2926,9 +3071,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -2972,7 +3114,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.29.0" }, "funding": [ { @@ -2988,20 +3130,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/translation", - "version": "v5.4.21", + "version": "v5.4.40", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "6996affeea65705086939894b77110e9a7f80874" + "reference": "bb51d7f183756d1ac03f50ea47dc5726518cc7e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/6996affeea65705086939894b77110e9a7f80874", - "reference": "6996affeea65705086939894b77110e9a7f80874", + "url": "https://api.github.com/repos/symfony/translation/zipball/bb51d7f183756d1ac03f50ea47dc5726518cc7e8", + "reference": "bb51d7f183756d1ac03f50ea47dc5726518cc7e8", "shasum": "" }, "require": { @@ -3069,7 +3211,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v5.4.21" + "source": "https://github.com/symfony/translation/tree/v5.4.40" }, "funding": [ { @@ -3085,20 +3227,20 @@ "type": "tidelift" } ], - "time": "2023-02-21T19:46:44+00:00" + "time": "2024-05-31T14:33:22+00:00" }, { "name": "symfony/translation-contracts", - "version": "v2.5.2", + "version": "v2.5.3", "source": { "type": "git", "url": "https://github.com/symfony/translation-contracts.git", - "reference": "136b19dd05cdf0709db6537d058bcab6dd6e2dbe" + "reference": "b0073a77ac0b7ea55131020e87b1e3af540f4664" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/136b19dd05cdf0709db6537d058bcab6dd6e2dbe", - "reference": "136b19dd05cdf0709db6537d058bcab6dd6e2dbe", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/b0073a77ac0b7ea55131020e87b1e3af540f4664", + "reference": "b0073a77ac0b7ea55131020e87b1e3af540f4664", "shasum": "" }, "require": { @@ -3147,7 +3289,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/translation-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/translation-contracts/tree/v2.5.3" }, "funding": [ { @@ -3163,20 +3305,20 @@ "type": "tidelift" } ], - "time": "2022-06-27T16:58:25+00:00" + "time": "2024-01-23T13:51:25+00:00" }, { "name": "theseer/tokenizer", - "version": "1.2.1", + "version": "1.2.3", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", "shasum": "" }, "require": { @@ -3205,7 +3347,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.1" + "source": "https://github.com/theseer/tokenizer/tree/1.2.3" }, "funding": [ { @@ -3213,26 +3355,26 @@ "type": "github" } ], - "time": "2021-07-28T10:34:58+00:00" + "time": "2024-03-03T12:36:25+00:00" }, { "name": "tracy/tracy", - "version": "v2.7.6", + "version": "v2.9.8", "source": { "type": "git", "url": "https://github.com/nette/tracy.git", - "reference": "7e7e73d52c7e9ff0fd29dbd5b1cfdc03f3947942" + "reference": "d84fb3ca4e9fa5a9352e6d18f0b8cd767f25901e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/tracy/zipball/7e7e73d52c7e9ff0fd29dbd5b1cfdc03f3947942", - "reference": "7e7e73d52c7e9ff0fd29dbd5b1cfdc03f3947942", + "url": "https://api.github.com/repos/nette/tracy/zipball/d84fb3ca4e9fa5a9352e6d18f0b8cd767f25901e", + "reference": "d84fb3ca4e9fa5a9352e6d18f0b8cd767f25901e", "shasum": "" }, "require": { "ext-json": "*", "ext-session": "*", - "php": ">=7.1" + "php": ">=7.2 <8.3" }, "conflict": { "nette/di": "<3.0" @@ -3243,21 +3385,18 @@ "nette/mail": "^3.0", "nette/tester": "^2.2", "nette/utils": "^3.0", - "phpstan/phpstan": "^0.12", - "psr/log": "^1.0" - }, - "suggest": { - "https://nette.org/donate": "Please support Tracy via a donation" + "phpstan/phpstan": "^1.0", + "psr/log": "^1.0 || ^2.0 || ^3.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "2.9-dev" } }, "autoload": { "files": [ - "src/Tracy/shortcuts.php" + "src/Tracy/functions.php" ], "classmap": [ "src" @@ -3277,7 +3416,7 @@ "homepage": "https://nette.org/contributors" } ], - "description": "😎 Tracy: the addictive tool to ease debugging PHP code for cool developers. Friendly design, logging, profiler, advanced features like debugging AJAX calls or CLI support. You will love it.", + "description": "😎 Tracy: the addictive tool to ease debugging PHP code for cool developers. Friendly design, logging, profiler, advanced features like debugging AJAX calls or CLI support. You will love it.", "homepage": "https://tracy.nette.org", "keywords": [ "Xdebug", @@ -3288,9 +3427,9 @@ ], "support": { "issues": "https://github.com/nette/tracy/issues", - "source": "https://github.com/nette/tracy/tree/v2.7.6" + "source": "https://github.com/nette/tracy/tree/v2.9.8" }, - "time": "2020-11-02T17:06:27+00:00" + "time": "2023-09-25T10:36:51+00:00" } ], "aliases": [], @@ -3302,8 +3441,9 @@ "prefer-lowest": false, "platform": { "ext-curl": "*", - "php": ">=5.6" + "php": ">=7.4", + "ext-json": "*" }, "platform-dev": [], - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/modules/addons/NFEioServiceInvoices/callback.php b/modules/addons/NFEioServiceInvoices/callback.php index cb1cc11..fea5d14 100644 --- a/modules/addons/NFEioServiceInvoices/callback.php +++ b/modules/addons/NFEioServiceInvoices/callback.php @@ -9,101 +9,178 @@ use WHMCS\Database\Capsule; use NFEioServiceInvoices\Legacy\Functions; +use NFEioServiceInvoices\Helpers\Validations; + new NFEioServiceInvoices\Loader(); + if ($_SERVER['REQUEST_METHOD'] != 'POST') { // https://developer.mozilla.org/pt-BR/docs/Web/HTTP/Status/405 http_response_code(405); + echo "Method Not Allowed"; exit(); } -$post = json_decode(file_get_contents('php://input'), true); +// workaround para retornar status code 200 quando a requisição conter uma query iniciando em 'echo' (verificacao do webhook) +if (isset($_GET['echo'])) { + http_response_code(200); + echo "ok"; + exit(); +} -if ($post) { - $functions = new Functions(); - //require_once __DIR__ . '/functions.php'; - $params = $functions->gnfe_config(); +// armazena o cabecalho da requisição +$headers = getallheaders(); - $environment = $params['NFEioEnvironment']; +function findSignatureHeader($headers) +{ + // normaliza todos os cabecalhos para lowercase + $headers = array_change_key_case($headers, CASE_LOWER); + // retorna os possiveis cabecalhos de assinatura da requisicao (X-Hub-Signature e X-Nfeio-Signature) + return $headers['x-hub-signature'] ?? $headers['x-nfeio-signature'] ?? null; - $nf_id = $post['id']; - $nf_status = $post['status']; - $nf_flow_status = $post['flowStatus']; - $nf_environment = $post['environment']; +} - // total de notas locais existentes para NF - $totalNfLocal = Capsule::table('mod_nfeio_si_serviceinvoices')->where('nfe_id', '=', $nf_id)->count(); +// cabecalho com a assinatura +$signature = findSignatureHeader($headers); +// corpo da requisição +$body = file_get_contents('php://input'); - //verificar o ambiente - if ($environment == 'on' && $nf_environment == 'Production') { - logModuleCall('NFEioServiceInvoices', 'callback_error_development', 'Ambiente Development ativo mas recebendo notas de Production', $post, $params); - // https://developer.mozilla.org/pt-BR/docs/Web/HTTP/Status/403 - http_response_code(200); - exit(); - } elseif ($environment == '' && $nf_environment == 'Development') { - logModuleCall('NFEioServiceInvoices', 'callback_error_production', 'Ambiente Production ativo mas recebendo notas de Development', $post, $params); - // https://developer.mozilla.org/pt-BR/docs/Web/HTTP/Status/403 - http_response_code(200); - exit(); - } - //fim verificar o ambiente - - //verificar se a nfe existe na tabela - if ($totalNfLocal == 0) { - logModuleCall('NFEioServiceInvoices', 'callback_error', 'Nota Fiscal não existe no banco local', $post); - // https://developer.mozilla.org/pt-BR/docs/Web/HTTP/Status/404 - http_response_code(404); - exit(); - } - //fim verificar se a nfe existe na tabela - - // seleciona as informações da nota local - $nfData = Capsule::table('mod_nfeio_si_serviceinvoices')->where('nfe_id', '=', $post['id']) - ->get( - [ - 'id', - 'invoice_id', - 'user_id', - 'nfe_id', - 'status', - 'services_amount', - 'environment', - 'flow_status', - 'pdf', - 'created_at', - 'updated_at' - ] - ); - - foreach ($nfData as $key => $value) { - $nfe_for_invoice[$key] = json_decode(json_encode($value), true); - } - $nfe = $nfe_for_invoice['0']; - - if ((string) $nfe['nfe_id'] === (string) $post['id'] and $nfe['status'] !== (string) $post['status']) { - $new_nfe = [ - 'invoice_id' => $nfe['invoice_id'], - 'user_id' => $nfe['user_id'], - 'nfe_id' => $nfe['nfe_id'], - 'status' => $post['status'], - 'services_amount' => $nfe['services_amount'], - 'environment' => $nfe['environment'], - 'flow_status' => $post['flowStatus'], - 'pdf' => $nfe['pdf'], - 'created_at' => $nfe['created_at'], - 'updated_at' => date('Y-m-d H:i:s'), - ]; - - try { - $save_nfe = Capsule::table('mod_nfeio_si_serviceinvoices')->where('nfe_id', '=', $post['id'])->update($new_nfe); - logModuleCall('NFEioServiceInvoices', 'callback_success', $post, $save_nfe); - } catch (\Exception $e) { - logModuleCall('NFEioServiceInvoices', 'callback_error', "Erro ao atualizar a nota no banco de dados \n\n Nota: \n {$new_nfe} Callback: \n {$post}", $e->getMessage()); - } - - // garante retorno de cabeçalho na resposta - // https://developer.mozilla.org/pt-BR/docs/Web/HTTP/Status/404 - http_response_code(200); +// se requisicao nao possuir assinatura, retorna erro +if (!$signature) { + logModuleCall('nfeio_serviceinvoices', 'callback_error', 'Assinatura não encontrada', ['headers' => $headers, 'body' => $body]); + // https://developer.mozilla.org/pt-BR/docs/Web/HTTP/Status/403 + http_response_code(403); + exit(); +} + +// separa o algoritmo do hmac da assinatura +$signature = explode('=', $signature); +$signature = $signature[1]; + +// carrega as configurações do módulo +$functions = new Functions(); +$module = $functions->gnfe_config(); + +// segredo do webhook +$secret = $module['webhook_secret']; + +// verifica se a assinatura é válida +$sign_valid = Validations::webhookHashValid($secret, $body, $signature); + +// se a assinatura for inválida, retorna erro +if (!$sign_valid) { + logModuleCall('nfeio_serviceinvoices', 'callback_error', 'Assinatura inválida', [ + 'valid' => $sign_valid, 'headers' => $headers, 'body' => $body + ]); + // https://developer.mozilla.org/pt-BR/docs/Web/HTTP/Status/403 + http_response_code(403); + exit(); +} + +$payload = json_decode($body, true); + +logModuleCall('nfeio_serviceinvoices', 'callback', 'Webhook Raw Payload', ['headers' => $headers, 'body' => $payload]); + +if(!is_array($payload) || ( !isset($payload['id']) && !isset($payload['status']) && !isset($payload['flowStatus']) && !isset($payload['environment']) )){ + logModuleCall('nfeio_serviceinvoices', 'callback_error', 'Payload inválido', ['headers' => $headers, 'body' => $payload]); + // https://developer.mozilla.org/pt-BR/docs/Web/HTTP/Status/400 + http_response_code(400); + exit(); +} + +$environment = $module['NFEioEnvironment']; + +$nf_id = $payload['id']; +$nf_status = $payload['status']; +$nf_flow_status = $payload['flowStatus']; +$nf_flow_message = $payload['flowMessage'] ?? ''; +$nf_environment = $payload['environment']; + +//verificar o ambiente +if ($environment == 'on' && $nf_environment == 'Production') { + logModuleCall('nfeio_serviceinvoices', 'callback_error_development', 'Ambiente Development ativo mas recebendo notas de Production', $payload, $module); + // informa que requisição é inválida + // https://developer.mozilla.org/pt-BR/docs/Web/HTTP/Status/400 + http_response_code(400); + exit(); +} elseif ($environment == '' && $nf_environment == 'Development') { + logModuleCall('nfeio_serviceinvoices', 'callback_error_production', 'Ambiente Production ativo mas recebendo notas de Development', $payload, $module); + // https://developer.mozilla.org/pt-BR/docs/Web/HTTP/Status/400 + http_response_code(400); + exit(); +} +//fim verificar o ambiente + +// total de notas locais existentes para NF +$totalNfLocal = Capsule::table('mod_nfeio_si_serviceinvoices')->where('nfe_id', '=', $nf_id)->count(); + +//verificar se a nfe existe na tabela +if ($totalNfLocal == 0) { + logModuleCall('nfeio_serviceinvoices', 'callback_error', 'Nota Fiscal não existe no banco local', $payload); + + // informa que informação não foi encontrada + // https://developer.mozilla.org/pt-BR/docs/Web/HTTP/Status/404 + http_response_code(404); + exit(); +} +//fim verificar se a nfe existe na tabela + +// seleciona as informações da nota local +$nfData = Capsule::table('mod_nfeio_si_serviceinvoices')->where('nfe_id', '=', $nf_id) + ->get( + [ + 'id', + 'invoice_id', + 'user_id', + 'nfe_id', + 'status', + 'services_amount', + 'environment', + 'flow_status', + 'pdf', + 'created_at', + 'updated_at' + ] + ); + +foreach ($nfData as $key => $value) { + $nfe_for_invoice[$key] = json_decode(json_encode($value), true); +} +$nfe = $nfe_for_invoice['0']; + +if ((string)$nfe['nfe_id'] === (string)$nf_id and $nfe['status'] !== (string)$nf_status) { + $new_nfe = [ + 'invoice_id' => $nfe['invoice_id'], + 'user_id' => $nfe['user_id'], + 'nfe_id' => $nfe['nfe_id'], + 'status' => $nf_status, + 'services_amount' => $nfe['services_amount'], + 'environment' => $nfe['environment'], + 'flow_status' => $nf_flow_status, + 'pdf' => $nfe['pdf'], + 'issue_note_conditions' => $nf_flow_message, // utilizando coluna existente, mas sem uso, para armazenar a mensagem do flow + ]; + + try { + $save_nfe = Capsule::table('mod_nfeio_si_serviceinvoices')->where('nfe_id', '=', $nf_id)->update($new_nfe); + logModuleCall('nfeio_serviceinvoices', 'callback_success', $payload, $save_nfe); + } catch (\Exception $e) { + logModuleCall('nfeio_serviceinvoices', 'callback_error', "Erro ao atualizar a nota no banco de dados \n\n Nota: \n {$new_nfe} Callback: \n {$payload}", $e->getMessage()); + // informa que a requisição falhou + // https://developer.mozilla.org/pt-BR/docs/Web/HTTP/Status/500 + http_response_code(500); } + + // informa que a requisição foi aceita + // https://developer.mozilla.org/pt-BR/docs/Web/HTTP/Status/202 + http_response_code(202); +} else { + logModuleCall('nfeio_serviceinvoices', 'callback', 'Nenhuma informação foi alterada', [ + 'nfe' => $nfe, 'payload' => $payload + ]); + // retorna 200 para informar que a requisição foi recebida + // https://developer.mozilla.org/pt-BR/docs/Web/HTTP/Status/200 + http_response_code(200); + exit(); } diff --git a/modules/addons/NFEioServiceInvoices/lib/Admin/Controller.php b/modules/addons/NFEioServiceInvoices/lib/Admin/Controller.php index a0dcd9d..b42ab4a 100644 --- a/modules/addons/NFEioServiceInvoices/lib/Admin/Controller.php +++ b/modules/addons/NFEioServiceInvoices/lib/Admin/Controller.php @@ -338,11 +338,11 @@ public function legacyFunctions($vars) if ($delete_nfe->message) { $response = $nfe->updateLocalNfeStatus($_REQUEST['gnfe_cancel'], 'Cancelled'); - logModuleCall('nfeioserviceinvoices', 'cancel_nf', $_REQUEST['gnfe_cancel'], "NF API Response: \n {$delete_nfe->message} \n NF LOCAL Response: \n {$response}"); + logModuleCall('nfeio_serviceinvoices', 'cancel_nf', $_REQUEST['gnfe_cancel'], "NF API Response: \n {$delete_nfe->message} \n NF LOCAL Response: \n {$response}"); $msg->warning("Nota fiscal cancelada, mas com aviso: {$delete_nfe->message}", $redirectUrl); } else { - logModuleCall('nfeioserviceinvoices', 'cancel_nf', $_REQUEST['gnfe_cancel'], $delete_nfe); + logModuleCall('nfeio_serviceinvoices', 'cancel_nf', $_REQUEST['gnfe_cancel'], $delete_nfe); $msg->success("Nota fiscal cancelada com sucesso", $redirectUrl); } @@ -477,6 +477,66 @@ public function cancelNf($vars) } } + /** + * Envia a nota fiscal por email ao cliente através da API da NFE.io + * + * @param $params array variáveis do WHMCS + */ + public function emailNf($params) + { + $msg = new FlashMessages(); + $functions = new \NFEioServiceInvoices\Legacy\Functions(); + $get = $_GET; + $nfId = $get['nfe_id']; + $moduleLink = $params['modulelink']; + $moduleAction = 'index'; + $redirectUrl = $moduleLink . '&action=' . $moduleAction; + + if (empty($nfId)) { + $msg->warning("Nenhuma nota fiscal informada.", $redirectUrl); + } + + $response = $functions->gnfe_email_nfe($nfId); + + if (empty($response->message)) { + $msg->success("Nota fiscal enviada por email com sucesso.", $redirectUrl); + } else { + $msg->error($response->message, $redirectUrl); + } + } + + public function updateNfStatus($params) + { + $msg = new FlashMessages(); + $moduleLink = $params['modulelink']; + $nfe = new \NFEioServiceInvoices\NFEio\Nfe(); + $nfeId = $_GET['nfe_id']; + + if (empty($nfeId)) { + $msg->warning("Nenhuma nota fiscal informada.", $moduleLink); + } + + $invoice = $nfe->fetchNf($nfeId); + + if ($invoice['error']) { + $msg->error("Erro ao buscar NF na API: {$invoice['error']}.", $moduleLink); + } + + // recebe os dados da nota fiscal + $invoiceId = $invoice->id; + $invoiceStatus = $invoice->status; + $invoiceFlowStatus = $invoice->flowStatus; + + // atualiza o status da nota fiscal no banco de dados + $result = $nfe->updateLocalNfeStatus($invoiceId, $invoiceStatus, $invoiceFlowStatus); + + if ($result) { + $msg->success("Nota fiscal atualizada com sucesso.", $moduleLink); + } else { + $msg->error("Erro ao atualizar nota fiscal.", $moduleLink); + } + } + /** * Support action. * diff --git a/modules/addons/NFEioServiceInvoices/lib/Configuration.php b/modules/addons/NFEioServiceInvoices/lib/Configuration.php index 4061071..1e4e1b5 100644 --- a/modules/addons/NFEioServiceInvoices/lib/Configuration.php +++ b/modules/addons/NFEioServiceInvoices/lib/Configuration.php @@ -22,7 +22,7 @@ final class Configuration extends \WHMCSExpert\mtLibs\process\AbstractConfigurat private $encryptHash = ''; - public $version = '2.1.8'; + public $version = '2.2.0'; public $tablePrefix = 'mod_nfeio_si_'; @@ -283,5 +283,23 @@ public function upgrade($vars) * @see https://github.com/nfe/whmcs-addon/issues/134 */ } + + /** + * Atualiza as colunas de timestamp para a versão inferior a 2.1.8 + * nas tabelas informadas. + * + * @see https://github.com/nfe/whmcs-addon/issues/156 + */ + if(version_compare($currentlyInstalledVersion, '2.1.8', 'le')) { + + // atualiza o nome da coluna de timestamp para a tabela productcode + \NFEioServiceInvoices\Migrations\Migrations::changeProductCodeTimestampColumnsName(); + + // altera as colunas de timestamp para as tabelas + \NFEioServiceInvoices\Migrations\Migrations::migrateTimestampColumns('mod_nfeio_si_productcode'); + \NFEioServiceInvoices\Migrations\Migrations::migrateTimestampColumns('mod_nfeio_si_serviceinvoices'); + \NFEioServiceInvoices\Migrations\Migrations::migrateTimestampColumns('mod_nfeio_si_aliquots'); + + } } } diff --git a/modules/addons/NFEioServiceInvoices/lib/Helpers/Timestamp.php b/modules/addons/NFEioServiceInvoices/lib/Helpers/Timestamp.php new file mode 100644 index 0000000..7ba4a08 --- /dev/null +++ b/modules/addons/NFEioServiceInvoices/lib/Helpers/Timestamp.php @@ -0,0 +1,17 @@ +webhookComputeHash($algo, $secret, $payload); + $signature = base64_decode($signature); + return hash_equals($hash, $signature); + } + + /** + * Computa o hash usando o algoritmo e segredo especificados. + * + * @param string $algo O algoritmo de hash a ser usado. + * @param string $secret O segredo a ser usado na computação do hash. + * @param mixed $payload O payload a ser usado na computação do hash. + * @param bool $bencode Define se o hash deve ser codificado em base64. + * + * @return string The computed hash. + */ + private function webhookComputeHash(string $algo, string $secret, $payload, bool $bencode = false): string + { + $hex_hash = hash_hmac($algo, $payload, utf8_encode($secret)); + $result = $bencode ? base64_encode(hex2bin($hex_hash)) : hex2bin($hex_hash); + logModuleCall('nfeio_serviceinvoices', 'webhook_hmac', [ + 'algo' => $algo, 'secret' => $secret, 'payload' => $payload + ], $result); + + return $result; + } +} diff --git a/modules/addons/NFEioServiceInvoices/lib/Hooks/AdminInvoicesControlsOutput.php b/modules/addons/NFEioServiceInvoices/lib/Hooks/AdminInvoicesControlsOutput.php index 4a90b2a..d7f5472 100644 --- a/modules/addons/NFEioServiceInvoices/lib/Hooks/AdminInvoicesControlsOutput.php +++ b/modules/addons/NFEioServiceInvoices/lib/Hooks/AdminInvoicesControlsOutput.php @@ -56,18 +56,18 @@ public function run() if ($request === 'reissue') { $result = $nfe->queue($this->invoiceId, true); if ($result['success']) { - $msg->success('Nota adicionada a fila para reemissão.'); + $msg->success('Nota adicionada a fila para reemissão.', $urn . '&nfeioreissue=true'); } else { - $msg->error("Problemas ao tentar reemitir a nota: {$result['message']}"); + $msg->error("Problemas ao tentar reemitir a nota: {$result['message']}", $urn . '&nfeioreissue=true'); } } if ($request === 'cancel') { $result = $nfe->cancelNfSeriesByInvoiceId($this->invoiceId); if ($result['status'] === 'success') { - $msg->info("Nota enviada para cancelamento, por favor aguarde."); + $msg->info("Nota enviada para cancelamento, por favor aguarde.", $urn . '&nfeiocancel=true'); } else { - $msg->warning("Nota fiscal cancelada, mas com aviso: {$result['message']}."); + $msg->warning("Nota fiscal cancelada, mas com aviso: {$result['message']}.", $urn . '&nfeiocancel=true'); } } diff --git a/modules/addons/NFEioServiceInvoices/lib/Hooks/AfterCronJob.php b/modules/addons/NFEioServiceInvoices/lib/Hooks/AfterCronJob.php index 36871cf..a397ddd 100644 --- a/modules/addons/NFEioServiceInvoices/lib/Hooks/AfterCronJob.php +++ b/modules/addons/NFEioServiceInvoices/lib/Hooks/AfterCronJob.php @@ -2,6 +2,7 @@ namespace NFEioServiceInvoices\Hooks; +use NFEioServiceInvoices\Helpers\Timestamp; use WHMCS\Database\Capsule; /** @@ -38,7 +39,7 @@ public function run() $storageKey = $this->config->getStorageKey(); $serviceInvoicesTable = $this->serviceInvoicesRepo->tableName(); $storage = new \WHMCSExpert\Addon\Storage($storageKey); - $dataAtual = date('Y-m-d H:i:s'); + $dataAtual = Timestamp::currentTimestamp(); // caso não exista valor para initial_date inicia define data que garanta a execução da rotina $initialDate = (! empty($storage->get('initial_date'))) ? $storage->get('initial_date') : '1970-01-01 00:00:00'; @@ -47,8 +48,8 @@ public function run() $hasNfWaiting = Capsule::table($serviceInvoicesTable)->whereBetween('created_at', [$initialDate, $dataAtual])->where('status', '=', 'Waiting')->count(); logModuleCall( - 'NFEioServiceInvoices', - 'Hook - AfterCronJob', + 'nfeio_serviceinvoices', + 'hook_aftercronjob', "{$hasNfWaiting} notas a serem geradas", array( [ @@ -74,7 +75,7 @@ public function run() */ } - logModuleCall('NFEioServiceInvoices', 'Hook - AfterCronJob', "{$hasNfWaiting} notas a serem geradas", $queryNf); + logModuleCall('nfeio_serviceinvoices', 'hook_aftercronjob', "{$hasNfWaiting} notas a serem geradas", $queryNf); } } } diff --git a/modules/addons/NFEioServiceInvoices/lib/Hooks/DailyCronJob.php b/modules/addons/NFEioServiceInvoices/lib/Hooks/DailyCronJob.php index cb117cc..dc97857 100644 --- a/modules/addons/NFEioServiceInvoices/lib/Hooks/DailyCronJob.php +++ b/modules/addons/NFEioServiceInvoices/lib/Hooks/DailyCronJob.php @@ -81,7 +81,7 @@ public function run() if (count($invoicesIdToGenerateNF) > 0) { foreach ($invoicesIdToGenerateNF as $invoice) { $queue = $this->nf->queue($invoice); - logModuleCall('NFEioServiceInvoices', 'Hook - DailyCronJob', $invoice, $queue); + logModuleCall('nfeio_serviceinvoices', 'Hook - DailyCronJob', $invoice, $queue); } } } diff --git a/modules/addons/NFEioServiceInvoices/lib/Hooks/InvoiceCreation.php b/modules/addons/NFEioServiceInvoices/lib/Hooks/InvoiceCreation.php index fdb70bc..3a24c79 100644 --- a/modules/addons/NFEioServiceInvoices/lib/Hooks/InvoiceCreation.php +++ b/modules/addons/NFEioServiceInvoices/lib/Hooks/InvoiceCreation.php @@ -54,11 +54,11 @@ public function run() if ($clientIssueCondition == 'seguir configuração do módulo nfe.io' and $moduleIssueCondition == $generateTaxBillWhen and $generateTaxBill) { $queue = $nfe->queue($this->invoiceId); - logModuleCall('NFEioServiceInvoices', __CLASS__ . __FUNCTION__, $data, $queue); + logModuleCall('nfeio_serviceinvoices', 'nf_invoice_creation', $data, $queue); } if ($clientIssueCondition == $generateTaxBillWhen and $generateTaxBill) { $queue = $nfe->queue($this->invoiceId); - logModuleCall('NFEioServiceInvoices', __CLASS__ . __FUNCTION__, $data, $queue); + logModuleCall('nfeio_serviceinvoices', 'nf_invoice_creation', $data, $queue); } } } diff --git a/modules/addons/NFEioServiceInvoices/lib/Hooks/InvoicePaid.php b/modules/addons/NFEioServiceInvoices/lib/Hooks/InvoicePaid.php index 674db8d..ec8fa53 100644 --- a/modules/addons/NFEioServiceInvoices/lib/Hooks/InvoicePaid.php +++ b/modules/addons/NFEioServiceInvoices/lib/Hooks/InvoicePaid.php @@ -46,11 +46,11 @@ public function run() if ($clientIssueCondition == 'seguir configuração do módulo nfe.io' and $moduleIssueCondition == $generateTaxBillWhen and $generateTaxBill) { $queue = $nfe->queue($this->invoiceId); - logModuleCall('NFEioServiceInvoices', __CLASS__ . __FUNCTION__, $data, $queue); + logModuleCall('nfeio_serviceinvoices', 'nf_invoice_paid', $data, $queue); } if ($clientIssueCondition == $generateTaxBillWhen and $generateTaxBill) { $queue = $nfe->queue($this->invoiceId); - logModuleCall('NFEioServiceInvoices', __CLASS__ . __FUNCTION__, $data, $queue); + logModuleCall('nfeio_serviceinvoices', 'nf_invoice_paid', $data, $queue); } } } diff --git a/modules/addons/NFEioServiceInvoices/lib/Legacy/Functions.php b/modules/addons/NFEioServiceInvoices/lib/Legacy/Functions.php index d14bfd7..67d1c0d 100644 --- a/modules/addons/NFEioServiceInvoices/lib/Legacy/Functions.php +++ b/modules/addons/NFEioServiceInvoices/lib/Legacy/Functions.php @@ -2,8 +2,10 @@ namespace NFEioServiceInvoices\Legacy; +use NFEioServiceInvoices\Helpers\Timestamp; use WHMCS\Database\Capsule; use NFEioServiceInvoices\Addon; +use NFEioServiceInvoices\Helpers\Validations; use WHMCSExpert\Addon\Storage; class Functions @@ -29,96 +31,89 @@ function gnfe_config($set = false) } } - function gnfe_customer($user_id, $client) + public function gnfe_customer($user_id, $client): array { //Determine custom fields id - $CPF_id = $this->gnfe_config('cpf_camp'); - $CNPJ_id = $this->gnfe_config('cnpj_camp'); - $insc_municipal_id = $this->gnfe_config('insc_municipal'); + $cpfCustomFieldId = $this->gnfe_config('cpf_camp'); + $cnpjCustomFieldId = $this->gnfe_config('cnpj_camp'); + $inscMunicipalCustomFieldId = $this->gnfe_config('insc_municipal'); + +// $insc_customfield_value = 'NF'; + $inscMunicipalCustomFieldValue = false; + // inicia array de retorno + $result = []; + + /** + * Este bloco de código verifica se os IDs dos campos personalizados para CPF e CNPJ estão definidos. + * Se ambos os IDs dos campos personalizados CPF e CNPJ não estiverem definidos (ou seja, eles são 0), + * ele define uma bandeira de erro e retorna uma mensagem de erro. + * + * @return array Se ocorrer um erro, retorna um array associativo com 'error' definido como true e 'message' + * contendo a mensagem de erro. + */ + if ($cpfCustomFieldId == 0 && $cnpjCustomFieldId == 0) { + $error = true; + $message = 'Campos para CPF e CNPJ não configurados.'; + $result['error'] = $error; + $result['message'] = $message; + return $result; + } - $insc_customfield_value = 'NF'; // insc_municipal - if ($insc_municipal_id != 0) { - foreach (Capsule::table('tblcustomfieldsvalues')->where('fieldid', '=', $insc_municipal_id)->where('relid', '=', $user_id)->get(['value']) as $customfieldvalue) { - $insc_customfield_value = $customfieldvalue->value; + if ($inscMunicipalCustomFieldId != 0) { + foreach (Capsule::table('tblcustomfieldsvalues')->where('fieldid', '=', $inscMunicipalCustomFieldId)->where('relid', '=', $user_id)->get(['value']) as $customfieldvalue) { + $inscMunicipalCustomFieldValue = $customfieldvalue->value; } } // cpf - if ($CPF_id != 0) { - foreach (Capsule::table('tblcustomfieldsvalues')->where('fieldid', '=', $CPF_id)->where('relid', '=', $user_id)->get(['value']) as $customfieldvalue) { - $cpf_customfield_value = preg_replace('/[^0-9]/', '', $customfieldvalue->value); + if ($cpfCustomFieldId != 0) { + foreach (Capsule::table('tblcustomfieldsvalues')->where('fieldid', '=', $cpfCustomFieldId)->where('relid', '=', $user_id)->get(['value']) as $customfieldvalue) { + $cpfCustomFieldValue = $customfieldvalue->value; } } //cnpj - if ($CNPJ_id != 0) { - foreach (Capsule::table('tblcustomfieldsvalues')->where('fieldid', '=', $CNPJ_id)->where('relid', '=', $user_id)->get(['value']) as $customfieldvalue) { - $cnpj_customfield_value = preg_replace('/[^0-9]/', '', $customfieldvalue->value); - } - } - logModuleCall('NFEioServiceInvoices', 'gnfe_customer-cpf', $cpf_customfield_value, '', '', ''); - logModuleCall('NFEioServiceInvoices', 'gnfe_customer-cnpj', $cnpj_customfield_value, '', '', ''); - logModuleCall('NFEioServiceInvoices', 'gnfe_customer-municipal', $insc_customfield_value, '', '', ''); - - // Cliente possui CPF e CNPJ - // CPF com 1 nº a menos, adiciona 0 antes do documento - if (strlen($cpf_customfield_value) === 10) { - $cpf = '0' . $cpf_customfield_value; - } - // CPF com 11 dígitos - elseif (strlen($cpf_customfield_value) === 11) { - $cpf = $cpf_customfield_value; - } - // CNPJ no campo de CPF com um dígito a menos - elseif (strlen($cpf_customfield_value) === 13) { - $cpf = false; - $cnpj = '0' . $cpf_customfield_value; - } - // CNPJ no campo de CPF - elseif (strlen($cpf_customfield_value) === 14) { - $cpf = false; - $cnpj = $cpf_customfield_value; - } - // cadastro não possui CPF - elseif (!$cpf_customfield_value || strlen($cpf_customfield_value) !== 10 || strlen($cpf_customfield_value) !== 11 || strlen($cpf_customfield_value) != 13 || strlen($cpf_customfield_value) !== 14) { - $cpf = false; - } - // CNPJ com 1 nº a menos, adiciona 0 antes do documento - if (strlen($cnpj_customfield_value) === 13) { - $cnpj = '0' . $cnpj_customfield_value; - } - // CNPJ com nº de dígitos correto - elseif (strlen($cnpj_customfield_value) === 14) { - $cnpj = $cnpj_customfield_value; - } - // Cliente não possui CNPJ - elseif (!$cnpj_customfield_value and strlen($cnpj_customfield_value) !== 14 and strlen($cnpj_customfield_value) !== 13 and strlen($cpf_customfield_value) !== 13 and strlen($cpf_customfield_value) !== 14) { - $cnpj = false; - } - if (($cpf and $cnpj) or (!$cpf and $cnpj)) { - $custumer['doc_type'] = 2; - $custumer['document'] = $cnpj; - if ($client->companyname) { - $custumer['name'] = $client->companyname; - } elseif (!$client->companyname) { - $custumer['name'] = $client->firstname . ' ' . $client->lastname; + if ($cnpjCustomFieldId != 0) { + foreach (Capsule::table('tblcustomfieldsvalues')->where('fieldid', '=', $cnpjCustomFieldId)->where('relid', '=', $user_id)->get(['value']) as $customfieldvalue) { + $cnpjCustomFieldValue = $customfieldvalue->value; } - } elseif ($cpf and !$cnpj) { - $custumer['doc_type'] = 1; - $custumer['document'] = $cpf; - $custumer['name'] = $client->firstname . ' ' . $client->lastname; } - if ($insc_customfield_value != 'NF') { - $custumer['insc_municipal'] = $insc_customfield_value; - } - if (!$cpf and !$cnpj) { - $error = 'CPF e/ou CNPJ ausente.'; + + $cpfIsValid = Validations::validateCPF($cpfCustomFieldValue); + $cnpjIsValid = Validations::validateCNPJ($cnpjCustomFieldValue); + + if (!$cpfIsValid && !$cnpjIsValid) { + $error = true; + $message = 'Documento cadastrado não é um CPF ou CNPJ válido.'; + $result['error'] = $error; + $result['message'] = $message; + return $result; } - if (!$error) { - return $custumer; + + $cpf = preg_replace('/[^0-9]/', '', $cpfCustomFieldValue); + $cnpj = preg_replace('/[^0-9]/', '', $cnpjCustomFieldValue); + $inscMunicipal = $inscMunicipalCustomFieldValue && trim($inscMunicipalCustomFieldValue); + + // adiciona a inscricao municipal ao retorno apenas se existir um valor registrado e documento for CNPJ + if ($inscMunicipal && $cnpjIsValid) { + $result['insc_municipal'] = $inscMunicipalCustomFieldValue; } - if ($error) { - return $custumer['error'] = $error; + + if ($cpfIsValid) { + $result['success'] = true; + $result['doc_type'] = 1; + $result['document'] = $cpf; + $result['name'] = $client->firstname . ' ' . $client->lastname; + } elseif ($cnpjIsValid) { + $result['success'] = true; + $result['doc_type'] = 2; + $result['document'] = $cnpj; + $result['name'] = $client->companyname ? $client->companyname : $client->firstname . ' ' . $client->lastname; + } else { + $result['error'] = true; + $result['message'] = 'Documento cadastrado não é um CPF ou CNPJ válido.'; } + + return $result; } function gnfe_customfields() @@ -167,20 +162,34 @@ function gnfe_ibge($zip) { $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, 'https://open.nfe.io/v1/cities/' . $zip . '/postalcode'); - curl_setopt($curl, CURLOPT_TIMEOUT, 30); + curl_setopt($curl, CURLOPT_TIMEOUT, 5); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec($curl); - $err = curl_error($curl); - + $error = curl_error($curl); curl_close($curl); - $city = json_decode(json_encode(json_decode($response))); - if ($city->message || $err) { - logModuleCall('NFEioServiceInvoices', 'gnfe_ibge', $zip, $response, 'ERROR', ''); - return 'ERROR'; + $data = json_decode($response); + $result = []; + + // se curl apresentar erro retorna imediatamente + if ($error) { + $result['error'] = true; + $result['message'] = $error; + return $result; + } + + if ($data->city->code) { + $result['code'] = $data->city->code; + $result['success'] = true; + } else { - return $city->city->code; + $result['error'] = true; + $result['message'] = $data->message; + logModuleCall('nfeio_serviceinvoices', 'ibge_error', $zip, array('response' => $response, 'error' => $error)); + } + + return $result; } function gnfe_queue_nfe($invoice_id, $create_all = false) @@ -200,8 +209,6 @@ function gnfe_queue_nfe($invoice_id, $create_all = false) 'environment' => 'waiting', 'flow_status' => 'waiting', 'pdf' => 'waiting', - 'created_at' => date('Y-m-d H:i:s'), - 'updated_at' => 'waiting', 'rpsSerialNumber' => 'waiting', 'service_code' => $item['code_service'], ]; @@ -217,9 +224,9 @@ function gnfe_queue_nfe($invoice_id, $create_all = false) $mount_item = floatval($item['amount']); $mount = $mountDB + $mount_item; - $update_nfe = Capsule::table($_tableName)->where('id', '=', $service_code_row[0]->id)->update(['services_amount' => $mount]); + Capsule::table($_tableName)->where('id', '=', $service_code_row[0]->id)->update(['services_amount' => $mount]); } else { - $save_nfe = Capsule::table($_tableName)->insert($data); + Capsule::table($_tableName)->insert($data); } } catch (\Exception $e) { return $e->getMessage(); @@ -240,7 +247,7 @@ function gnfe_issue_nfe($postfields) $check_webhook = $this->gnfe_check_webhook($gnfe_webhook_id); if ($check_webhook == null) { - return (object) ['message' => 'Erro ao checar a existência de um webhook já cadastrado']; + return (object)['message' => 'Erro ao checar a existência de um webhook já cadastrado']; } if ($check_webhook == "ERRO 400" || $check_webhook == "ERRO 404") { @@ -248,11 +255,11 @@ function gnfe_issue_nfe($postfields) } } - if ($gnfe_webhook_id and (string) $check_webhook['hooks']['url'] !== (string) $webhook_url) { + if ($gnfe_webhook_id and (string)$check_webhook['hooks']['url'] !== (string)$webhook_url) { $delete_webhook = $this->gnfe_delete_webhook($gnfe_webhook_id); if ($delete_webhook == null) { - return (object) ['message' => 'Erro ao deletar webhook que estava com a url divergente']; + return (object)['message' => 'Erro ao deletar webhook que estava com a url divergente']; } $gnfe_webhook_id = null; @@ -261,10 +268,8 @@ function gnfe_issue_nfe($postfields) if (!$gnfe_webhook_id) { $create_webhook = $this->gnfe_create_webhook($webhook_url); - logModuleCall('NFEioServiceInvoices', 'gnfe_issue_nfe - gnfe_create_webhook', $create_webhook, $webhook_url); - if ($create_webhook == null) { - return (object) ['message' => 'Erro ao criar novo webhook']; + return (object)['message' => 'Erro ao criar novo webhook']; } if ($create_webhook['hooks']['id']) { @@ -281,17 +286,16 @@ function gnfe_issue_nfe($postfields) curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($postfields)); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec($curl); - $err = curl_error($curl); + $error = curl_error($curl); $info = curl_getinfo($curl); curl_close($curl); - $error = $err ? $err : $response; - logModuleCall('NFEioServiceInvoices', 'gnfe_issue_nfe - curl_init', $error, $info, '', ''); - logModuleCall('NFEioServiceInvoices', 'gnfe_issue_nfe - CURLOPT_POSTFIELDS', json_encode($postfields), '', '', ''); - if ($err) { - return (object) ['message' => $err, 'info' => $info]; + if ($error) { + logModuleCall('nfeio_serviceinvoices', 'nf_issue_curl_error', $postfields, ['error' => $error, 'response' => $response, 'info' => $info], '', ''); + return (object)['message' => $error, 'info' => $info]; } else { + logModuleCall('nfeio_serviceinvoices', 'nf_issue_curl_success', $postfields, $response, json_decode($response, true), ''); return json_decode(json_encode(json_decode($response))); } } @@ -308,14 +312,14 @@ function gnfe_get_company_info($set = false) curl_setopt_array( $curl, [ - CURLOPT_URL => 'https://api.nfe.io/v1/companies/' . $this->gnfe_config('company_id'), - CURLOPT_TIMEOUT => 30, - CURLOPT_RETURNTRANSFER => true, - CURLOPT_HTTPHEADER => [ - 'Content-Type: application/json', - 'Accept: application/json', - 'Authorization: ' . $this->gnfe_config('api_key') - ] + CURLOPT_URL => 'https://api.nfe.io/v1/companies/' . $this->gnfe_config('company_id'), + CURLOPT_TIMEOUT => 30, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_HTTPHEADER => [ + 'Content-Type: application/json', + 'Accept: application/json', + 'Authorization: ' . $this->gnfe_config('api_key') + ] ] ); @@ -353,7 +357,7 @@ function gnfe_test_connection() $response = curl_exec($curl); $info = curl_getinfo($curl); $err = curl_error($curl); - logModuleCall('NFEioServiceInvoices', 'gnfe_issue_nfe - curl_init', $err, $info, '', ''); + logModuleCall('nfeio_serviceinvoices', 'test_connection', $info, $response, json_decode($response, true)); curl_close($curl); return $info; @@ -370,6 +374,8 @@ function gnfe_delete_nfe($nf) $response = curl_exec($curl); curl_close($curl); + logModuleCall('nfeio_serviceinvoices', 'delete_nfe', $nf, $response, json_decode($response, true), ''); + return json_decode($response); } @@ -385,6 +391,8 @@ function gnfe_email_nfe($nf) $response = curl_exec($curl); curl_close($curl); + logModuleCall('nfeio_serviceinvoices', 'email_nfe', $nf, $response, json_decode($response, true), ''); + return json_decode($response); } } @@ -428,7 +436,7 @@ function gnfe_xml_nfe($nf) return $result; } - function gnfe_update_nfe($nfe, $user_id, $invoice_id, $pdf, $created_at, $updated_at, $id_gofasnfeio = false) + function gnfe_update_nfe($nfe, $user_id, $invoice_id, $pdf, $id_gofasnfeio = false) { $data = [ 'invoice_id' => $invoice_id, @@ -439,8 +447,6 @@ function gnfe_update_nfe($nfe, $user_id, $invoice_id, $pdf, $created_at, $update 'environment' => $nfe->environment, 'flow_status' => $nfe->flowStatus, 'pdf' => $pdf, - 'created_at' => $created_at, - 'updated_at' => $updated_at, 'rpsSerialNumber' => $nfe->rpsSerialNumber, 'rpsNumber' => $nfe->rpsNumber, ]; @@ -458,6 +464,8 @@ function gnfe_update_nfe($nfe, $user_id, $invoice_id, $pdf, $created_at, $update } $save_nfe = Capsule::table($_tableName)->where($camp, '=', $id)->update($data); + logModuleCall('nfeio_serviceinvoices', 'update_nfe', $data, $save_nfe, '', ''); + return 'success'; } catch (\Exception $e) { return $e->getMessage(); @@ -467,9 +475,9 @@ function gnfe_update_nfe($nfe, $user_id, $invoice_id, $pdf, $created_at, $update /** * Returns the data of a invoice from the local WHMCS database. * - * @var $invoice_id - * @var $values * @return string + * @var $values + * @var $invoice_id */ function gnfe_get_local_nfe($invoice_id, $values) { @@ -499,14 +507,14 @@ function gnfe_check_webhook($id) if ($info['http_code'] == 200) { return json_decode($response, true); } elseif ($info['http_code'] == 400 || $info['http_code'] == 404) { - logModuleCall('NFEioServiceInvoices', 'gnfe_check_webhook', $id, "ERRO " . $info['http_code']); + logModuleCall('nfeio_serviceinvoices', 'webhook_check_error', $id, "ERRO " . $info['http_code']); return "ERRO " . $info['http_code']; } else { - logModuleCall('NFEioServiceInvoices', 'gnfe_check_webhook', $id, $info['http_code']); + logModuleCall('nfeio_serviceinvoices', 'webhook_check_error', $id, $info['http_code']); } } } catch (Exception $ex) { - logModuleCall('NFEioServiceInvoices', 'gnfe_check_webhook', $id, $ex->getMessage()); + logModuleCall('nfeio_serviceinvoices', 'webhook_check_error', $id, $ex->getMessage()); } return null; @@ -520,7 +528,7 @@ function gnfe_create_webhook($url) curl_setopt($curl, CURLOPT_HTTPHEADER, ['Content-Type: application/json', 'Accept: aplication/json', 'Authorization: ' . $this->gnfe_config('api_key')]); curl_setopt($curl, CURLOPT_TIMEOUT, 30); curl_setopt($curl, CURLOPT_POST, 1); - curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode(['url' => $url, 'contentType' => 'application/json', 'secret' => (string)time(), 'events' => ['issue', 'cancel', 'WaitingCalculateTaxes'], 'status' => 'Active', ])); + curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode(['url' => $url, 'contentType' => 'application/json', 'secret' => (string)time(), 'events' => ['issue', 'cancel', 'WaitingCalculateTaxes'], 'status' => 'Active',])); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec($curl); $info = curl_getinfo($curl); @@ -528,13 +536,14 @@ function gnfe_create_webhook($url) if (!curl_errno($curl)) { if ($info['http_code'] == 201) { + logModuleCall('nfeio_serviceinvoices', 'webhook_create', $url, $response); return json_decode($response, true); } else { - logModuleCall('NFEioServiceInvoices', 'gnfe_create_webhook', $url, $info['http_code']); + logModuleCall('nfeio_serviceinvoices', 'webhook_create_error', $url, $info['http_code']); } } } catch (Exception $ex) { - logModuleCall('NFEioServiceInvoices', 'gnfe_create_webhook', $url, $ex->getMessage()); + logModuleCall('nfeio_serviceinvoices', 'webhook_create_error', $url, $ex->getMessage()); } return null; @@ -555,13 +564,14 @@ function gnfe_delete_webhook($id) if (!curl_errno($curl)) { if ($info['http_code'] == 200) { + logModuleCall('nfeio_serviceinvoices', 'webhook_delete_success', $id, $response); return json_decode($response, true); } else { - logModuleCall('NFEioServiceInvoices', 'gnfe_delete_webhook', $id, $info['http_code']); + logModuleCall('nfeio_serviceinvoices', 'webhook_delete_error', $id, $info['http_code']); } } } catch (Exception $ex) { - logModuleCall('NFEioServiceInvoices', 'gnfe_delete_webhook', $id, $ex->getMessage()); + logModuleCall('nfeio_serviceinvoices', 'webhook_delete_error', $id, $ex->getMessage()); } return null; @@ -672,7 +682,10 @@ function update_status_nfe($invoice_id, $status) $_tableName = $serviceInvoicesRepo->tableName(); try { - $return = Capsule::table($_tableName)->where('invoice_id', '=', $invoice_id)->update(['status' => $status]); + $return = Capsule::table($_tableName)->where('invoice_id', '=', $invoice_id)->update([ + 'status' => $status, + 'updated_at' => Timestamp::currentTimestamp(), + ]); return $return; } catch (Exception $e) { return $e->getMessage(); @@ -681,8 +694,8 @@ function update_status_nfe($invoice_id, $status) /** - * @var string $invoiceId vem do arquivo hooks.php. * @return string + * @var string $invoiceId vem do arquivo hooks.php. */ function gnfe_get_client_issue_invoice_cond_from_invoice_id($invoiceId) { @@ -710,8 +723,8 @@ function gnfe_get_client_issue_invoice_cond_from_invoice_id($invoiceId) * Returns a {if $hasAllNfCancelled} - + {/if} {if !$hasAllNfCancelled} - + {/if} @@ -108,6 +139,7 @@ Gerada Em Valor Status + Mensagem Ações @@ -117,12 +149,17 @@ {$nota->created_at|date_format:"%d/%m/%Y"} {$nota->services_amount} {statusLabel data=$nota->status} + +

+ {$nota->issue_note_conditions} +

+
-
+
diff --git a/modules/addons/NFEioServiceInvoices/lib/templates/admin/includes/modalaction.tpl b/modules/addons/NFEioServiceInvoices/lib/templates/admin/includes/modalaction.tpl new file mode 100644 index 0000000..0a7df04 --- /dev/null +++ b/modules/addons/NFEioServiceInvoices/lib/templates/admin/includes/modalaction.tpl @@ -0,0 +1,63 @@ + + + + +{literal} + +{/literal} \ No newline at end of file diff --git a/modules/addons/NFEioServiceInvoices/lib/templates/admin/index.tpl b/modules/addons/NFEioServiceInvoices/lib/templates/admin/index.tpl index 949e538..e08a1a3 100644 --- a/modules/addons/NFEioServiceInvoices/lib/templates/admin/index.tpl +++ b/modules/addons/NFEioServiceInvoices/lib/templates/admin/index.tpl @@ -1,138 +1,225 @@ {include file="includes/menu.tpl"} {function name=statusLabel} - {if $data == 'Waiting'} - Aguardando - {elseif $data == 'Created'} - Criada - {elseif $data == 'Issued'} - Emitida - {elseif $data == 'Cancelled'} - Cancelada - {elseif $data == 'Error'} - Erro - {elseif $data == 'Error_cep'} - CEP do cliente inválido - {elseif $data == 'None'} - Não Disponível - {else} - {$data} - {/if} + {if $data == 'Waiting'} + Aguardando + {elseif $data == 'Created'} + Criada + {elseif $data == 'Issued'} + Emitida + {elseif $data == 'Cancelled'} + Cancelada + {elseif $data == 'Error'} + Erro + {elseif $data == 'Error_cep'} + CEP do cliente inválido + {elseif $data == 'None'} + Não Disponível + {else} + {$data} + {/if} {/function} {*https://nfe.io/docs/https/nfeio/docs/documentacao/nota-fiscal-servico-eletronica/duvidas/como-saber-se-sua-nota-fiscal-de-servico-foi-emitida-pela-api/*} {function name=flowStatus} - {if $data == 'Issued'} - Nota emitida - {elseif $data == 'Cancelled'} - Nota cancelada - {elseif $data == 'waiting'} - Fila de emissão - {elseif $data == 'WaitingCalculateTaxes'} - Calculando impostos da nota - {elseif $data == 'CancelFailed'} - Nota não foi cancelada com sucesso - {elseif $data == 'IssueFailed'} - Emissão da nota sem sucesso - {elseif $data == 'PullFromCityHall'} - PullFromCityHall - {elseif $data == 'WaitingDefineRpsNumber'} - Definindo número de RPS da nota - {elseif $data == 'WaitingSend'} - Nota enviada para emissão na prefeitura e aguardando confirmação de recebimento da mesma - {elseif $data == 'WaitingSendCancel'} - Nota enviada para cancelamento na prefeitura e aguardando confirmação de recebimento da mesma - {elseif $data == 'WaitingReturn'} - Aguardando retorno da prefeitura com confirmação de nota emitida - {elseif $data == 'WaitingDownload'} - Aguardando download do PDF da nota - {elseif $data == 'waiting'} - Aguardando na fila para processamento - {else} - Não disponível - {/if} + {if $data == 'Issued'} + Nota emitida + {elseif $data == 'Cancelled'} + Nota cancelada + {elseif $data == 'waiting'} + Fila de emissão + {elseif $data == 'WaitingCalculateTaxes'} + Calculando impostos da nota + {elseif $data == 'CancelFailed'} + Nota não foi cancelada com sucesso + {elseif $data == 'IssueFailed'} + Erro ao emitir a nota + {elseif $data == 'PullFromCityHall'} + PullFromCityHall + {elseif $data == 'WaitingDefineRpsNumber'} + Definindo número de RPS da nota + {elseif $data == 'WaitingSend'} + Nota enviada para emissão na prefeitura e aguardando confirmação de recebimento da mesma + {elseif $data == 'WaitingSendCancel'} + Nota enviada para cancelamento na prefeitura e aguardando confirmação de recebimento da mesma + {elseif $data == 'WaitingReturn'} + Aguardando retorno da prefeitura com confirmação de nota emitida + {elseif $data == 'WaitingDownload'} + Aguardando download do PDF da nota + {elseif $data == 'waiting'} + Aguardando na fila para processamento + {else} + {$data} + {/if} {/function} {function name=disableButtonAction} - {if $data == 'Cancelled' OR $data == 'Error' OR $data == 'IssueFailed'} - disabled="true" - {/if} + {if $data == 'Cancelled' OR $data == 'Error' OR $data == 'IssueFailed'} + disabled="true" + {/if} {/function} {function name=disableGenerateButtonAction} - {if $data != 'Cancelled'} - disabled="true" - {/if} + {if $data != 'Cancelled'} + disabled="true" + {/if} {/function} {function name=disableCancelButtonAction} - {if $data == 'Cancelled'} - disabled="true" - {/if} + {if $data == 'Cancelled'} + disabled="true" + {/if} {/function} - - + +
-
-
-
-

Notas Fiscais

-
-
+
-
- - - - - - - - - - - - {foreach from=$dtData item=nota } - - - - - - - - - - {/foreach} - -
FaturaNFe.io IDData de CriaçãoClienteValorStatusAções
{$nota->invoice_id}{$nota->nfe_id}{$nota->created_at|date_format:"%d/%m/%Y %H:%M"} - - {$nota->firstname} {$nota->lastname} - {if $nota->companyname} - ({$nota->companyname}) - {/if} - - R${$nota->services_amount}{statusLabel data=$nota->status} - - - - -
-
+
+

Notas Fiscais

+
+
+
+
+ + + + + + + + + + + + {foreach from=$dtData item=nota } + + + + + + + + + + {/foreach} + +
FaturaNFe.io IDData de CriaçãoClienteValorStatusAções
{$nota->invoice_id}{$nota->nfe_id}{$nota->created_at|date_format:"%d/%m/%Y %H:%M"} + + {if $nota->companyname} + ({$nota->companyname}) + {else} + {$nota->firstname} {$nota->lastname} + {/if} + + R${$nota->services_amount} +
+ + {statusLabel data=$nota->status} + +
+ {if $nota->issue_note_conditions} +

{$nota->issue_note_conditions}

+ {/if} + + +
+
+ + + + + + + + + + + + +
+
+
+
+
-
-
+ {literal} - -{/literal} \ No newline at end of file + +{/literal} + +{include file="includes/modalaction.tpl" id="actionConfirmationModal" modulelink=$modulelink} \ No newline at end of file diff --git a/modules/addons/NFEioServiceInvoices/lib/vendor/autoload.php b/modules/addons/NFEioServiceInvoices/lib/vendor/autoload.php index 849a254..de094c9 100644 --- a/modules/addons/NFEioServiceInvoices/lib/vendor/autoload.php +++ b/modules/addons/NFEioServiceInvoices/lib/vendor/autoload.php @@ -22,4 +22,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInitad00b92d12ac29d48d540e2bb75b0034::getLoader(); +return ComposerAutoloaderInit9d3328eb7139b63c91b644b63fb21216::getLoader(); diff --git a/modules/addons/NFEioServiceInvoices/lib/vendor/composer/ClassLoader.php b/modules/addons/NFEioServiceInvoices/lib/vendor/composer/ClassLoader.php index fd56bd7..7824d8f 100644 --- a/modules/addons/NFEioServiceInvoices/lib/vendor/composer/ClassLoader.php +++ b/modules/addons/NFEioServiceInvoices/lib/vendor/composer/ClassLoader.php @@ -45,35 +45,34 @@ class ClassLoader /** @var \Closure(string):void */ private static $includeFile; - /** @var ?string */ + /** @var string|null */ private $vendorDir; // PSR-4 /** - * @var array[] - * @psalm-var array> + * @var array> */ private $prefixLengthsPsr4 = array(); /** - * @var array[] - * @psalm-var array> + * @var array> */ private $prefixDirsPsr4 = array(); /** - * @var array[] - * @psalm-var array + * @var list */ private $fallbackDirsPsr4 = array(); // PSR-0 /** - * @var array[] - * @psalm-var array> + * List of PSR-0 prefixes + * + * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2'))) + * + * @var array>> */ private $prefixesPsr0 = array(); /** - * @var array[] - * @psalm-var array + * @var list */ private $fallbackDirsPsr0 = array(); @@ -81,8 +80,7 @@ class ClassLoader private $useIncludePath = false; /** - * @var string[] - * @psalm-var array + * @var array */ private $classMap = array(); @@ -90,21 +88,20 @@ class ClassLoader private $classMapAuthoritative = false; /** - * @var bool[] - * @psalm-var array + * @var array */ private $missingClasses = array(); - /** @var ?string */ + /** @var string|null */ private $apcuPrefix; /** - * @var self[] + * @var array */ private static $registeredLoaders = array(); /** - * @param ?string $vendorDir + * @param string|null $vendorDir */ public function __construct($vendorDir = null) { @@ -113,7 +110,7 @@ public function __construct($vendorDir = null) } /** - * @return string[] + * @return array> */ public function getPrefixes() { @@ -125,8 +122,7 @@ public function getPrefixes() } /** - * @return array[] - * @psalm-return array> + * @return array> */ public function getPrefixesPsr4() { @@ -134,8 +130,7 @@ public function getPrefixesPsr4() } /** - * @return array[] - * @psalm-return array + * @return list */ public function getFallbackDirs() { @@ -143,8 +138,7 @@ public function getFallbackDirs() } /** - * @return array[] - * @psalm-return array + * @return list */ public function getFallbackDirsPsr4() { @@ -152,8 +146,7 @@ public function getFallbackDirsPsr4() } /** - * @return string[] Array of classname => path - * @psalm-return array + * @return array Array of classname => path */ public function getClassMap() { @@ -161,8 +154,7 @@ public function getClassMap() } /** - * @param string[] $classMap Class to filename map - * @psalm-param array $classMap + * @param array $classMap Class to filename map * * @return void */ @@ -179,24 +171,25 @@ public function addClassMap(array $classMap) * Registers a set of PSR-0 directories for a given prefix, either * appending or prepending to the ones previously set for this prefix. * - * @param string $prefix The prefix - * @param string[]|string $paths The PSR-0 root directories - * @param bool $prepend Whether to prepend the directories + * @param string $prefix The prefix + * @param list|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories * * @return void */ public function add($prefix, $paths, $prepend = false) { + $paths = (array) $paths; if (!$prefix) { if ($prepend) { $this->fallbackDirsPsr0 = array_merge( - (array) $paths, + $paths, $this->fallbackDirsPsr0 ); } else { $this->fallbackDirsPsr0 = array_merge( $this->fallbackDirsPsr0, - (array) $paths + $paths ); } @@ -205,19 +198,19 @@ public function add($prefix, $paths, $prepend = false) $first = $prefix[0]; if (!isset($this->prefixesPsr0[$first][$prefix])) { - $this->prefixesPsr0[$first][$prefix] = (array) $paths; + $this->prefixesPsr0[$first][$prefix] = $paths; return; } if ($prepend) { $this->prefixesPsr0[$first][$prefix] = array_merge( - (array) $paths, + $paths, $this->prefixesPsr0[$first][$prefix] ); } else { $this->prefixesPsr0[$first][$prefix] = array_merge( $this->prefixesPsr0[$first][$prefix], - (array) $paths + $paths ); } } @@ -226,9 +219,9 @@ public function add($prefix, $paths, $prepend = false) * Registers a set of PSR-4 directories for a given namespace, either * appending or prepending to the ones previously set for this namespace. * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param string[]|string $paths The PSR-4 base directories - * @param bool $prepend Whether to prepend the directories + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories * * @throws \InvalidArgumentException * @@ -236,17 +229,18 @@ public function add($prefix, $paths, $prepend = false) */ public function addPsr4($prefix, $paths, $prepend = false) { + $paths = (array) $paths; if (!$prefix) { // Register directories for the root namespace. if ($prepend) { $this->fallbackDirsPsr4 = array_merge( - (array) $paths, + $paths, $this->fallbackDirsPsr4 ); } else { $this->fallbackDirsPsr4 = array_merge( $this->fallbackDirsPsr4, - (array) $paths + $paths ); } } elseif (!isset($this->prefixDirsPsr4[$prefix])) { @@ -256,18 +250,18 @@ public function addPsr4($prefix, $paths, $prepend = false) throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); } $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = (array) $paths; + $this->prefixDirsPsr4[$prefix] = $paths; } elseif ($prepend) { // Prepend directories for an already registered namespace. $this->prefixDirsPsr4[$prefix] = array_merge( - (array) $paths, + $paths, $this->prefixDirsPsr4[$prefix] ); } else { // Append directories for an already registered namespace. $this->prefixDirsPsr4[$prefix] = array_merge( $this->prefixDirsPsr4[$prefix], - (array) $paths + $paths ); } } @@ -276,8 +270,8 @@ public function addPsr4($prefix, $paths, $prepend = false) * Registers a set of PSR-0 directories for a given prefix, * replacing any others previously set for this prefix. * - * @param string $prefix The prefix - * @param string[]|string $paths The PSR-0 base directories + * @param string $prefix The prefix + * @param list|string $paths The PSR-0 base directories * * @return void */ @@ -294,8 +288,8 @@ public function set($prefix, $paths) * Registers a set of PSR-4 directories for a given namespace, * replacing any others previously set for this namespace. * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param string[]|string $paths The PSR-4 base directories + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list|string $paths The PSR-4 base directories * * @throws \InvalidArgumentException * @@ -429,7 +423,8 @@ public function unregister() public function loadClass($class) { if ($file = $this->findFile($class)) { - (self::$includeFile)($file); + $includeFile = self::$includeFile; + $includeFile($file); return true; } @@ -480,9 +475,9 @@ public function findFile($class) } /** - * Returns the currently registered loaders indexed by their corresponding vendor directories. + * Returns the currently registered loaders keyed by their corresponding vendor directories. * - * @return self[] + * @return array */ public static function getRegisteredLoaders() { @@ -560,7 +555,10 @@ private function findFileWithExtension($class, $ext) return false; } - private static function initializeIncludeClosure(): void + /** + * @return void + */ + private static function initializeIncludeClosure() { if (self::$includeFile !== null) { return; @@ -574,8 +572,8 @@ private static function initializeIncludeClosure(): void * @param string $file * @return void */ - self::$includeFile = static function($file) { + self::$includeFile = \Closure::bind(static function($file) { include $file; - }; + }, null, null); } } diff --git a/modules/addons/NFEioServiceInvoices/lib/vendor/composer/InstalledVersions.php b/modules/addons/NFEioServiceInvoices/lib/vendor/composer/InstalledVersions.php index c6b54af..51e734a 100644 --- a/modules/addons/NFEioServiceInvoices/lib/vendor/composer/InstalledVersions.php +++ b/modules/addons/NFEioServiceInvoices/lib/vendor/composer/InstalledVersions.php @@ -98,7 +98,7 @@ public static function isInstalled($packageName, $includeDevRequirements = true) { foreach (self::getInstalled() as $installed) { if (isset($installed['versions'][$packageName])) { - return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']); + return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false; } } @@ -119,7 +119,7 @@ public static function isInstalled($packageName, $includeDevRequirements = true) */ public static function satisfies(VersionParser $parser, $packageName, $constraint) { - $constraint = $parser->parseConstraints($constraint); + $constraint = $parser->parseConstraints((string) $constraint); $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); return $provided->matches($constraint); @@ -328,7 +328,9 @@ private static function getInstalled() if (isset(self::$installedByVendor[$vendorDir])) { $installed[] = self::$installedByVendor[$vendorDir]; } elseif (is_file($vendorDir.'/composer/installed.php')) { - $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; + /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ + $required = require $vendorDir.'/composer/installed.php'; + $installed[] = self::$installedByVendor[$vendorDir] = $required; if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { self::$installed = $installed[count($installed) - 1]; } @@ -340,12 +342,17 @@ private static function getInstalled() // only require the installed.php file if this file is loaded from its dumped location, // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 if (substr(__DIR__, -8, 1) !== 'C') { - self::$installed = require __DIR__ . '/installed.php'; + /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ + $required = require __DIR__ . '/installed.php'; + self::$installed = $required; } else { self::$installed = array(); } } - $installed[] = self::$installed; + + if (self::$installed !== array()) { + $installed[] = self::$installed; + } return $installed; } diff --git a/modules/addons/NFEioServiceInvoices/lib/vendor/composer/autoload_classmap.php b/modules/addons/NFEioServiceInvoices/lib/vendor/composer/autoload_classmap.php index 4e96f91..f665615 100644 --- a/modules/addons/NFEioServiceInvoices/lib/vendor/composer/autoload_classmap.php +++ b/modules/addons/NFEioServiceInvoices/lib/vendor/composer/autoload_classmap.php @@ -44,6 +44,8 @@ 'NFEioServiceInvoices\\Configuration' => $baseDir . '/modules/addons/NFEioServiceInvoices/lib/Configuration.php', 'NFEioServiceInvoices\\CustomFields' => $baseDir . '/modules/addons/NFEioServiceInvoices/lib/CustomFields.php', 'NFEioServiceInvoices\\Helpers\\Invoices' => $baseDir . '/modules/addons/NFEioServiceInvoices/lib/Helpers/Invoices.php', + 'NFEioServiceInvoices\\Helpers\\Timestamp' => $baseDir . '/modules/addons/NFEioServiceInvoices/lib/Helpers/Timestamp.php', + 'NFEioServiceInvoices\\Helpers\\Validations' => $baseDir . '/modules/addons/NFEioServiceInvoices/lib/Helpers/Validations.php', 'NFEioServiceInvoices\\Helpers\\Versions' => $baseDir . '/modules/addons/NFEioServiceInvoices/lib/Helpers/Versions.php', 'NFEioServiceInvoices\\Hooks\\AdminInvoicesControlsOutput' => $baseDir . '/modules/addons/NFEioServiceInvoices/lib/Hooks/AdminInvoicesControlsOutput.php', 'NFEioServiceInvoices\\Hooks\\AfterCronJob' => $baseDir . '/modules/addons/NFEioServiceInvoices/lib/Hooks/AfterCronJob.php', diff --git a/modules/addons/NFEioServiceInvoices/lib/vendor/composer/autoload_real.php b/modules/addons/NFEioServiceInvoices/lib/vendor/composer/autoload_real.php index e637923..1a6ddf8 100644 --- a/modules/addons/NFEioServiceInvoices/lib/vendor/composer/autoload_real.php +++ b/modules/addons/NFEioServiceInvoices/lib/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInitad00b92d12ac29d48d540e2bb75b0034 +class ComposerAutoloaderInit9d3328eb7139b63c91b644b63fb21216 { private static $loader; @@ -24,25 +24,25 @@ public static function getLoader() require __DIR__ . '/platform_check.php'; - spl_autoload_register(array('ComposerAutoloaderInitad00b92d12ac29d48d540e2bb75b0034', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit9d3328eb7139b63c91b644b63fb21216', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); - spl_autoload_unregister(array('ComposerAutoloaderInitad00b92d12ac29d48d540e2bb75b0034', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit9d3328eb7139b63c91b644b63fb21216', 'loadClassLoader')); require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInitad00b92d12ac29d48d540e2bb75b0034::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit9d3328eb7139b63c91b644b63fb21216::getInitializer($loader)); $loader->register(true); - $filesToLoad = \Composer\Autoload\ComposerStaticInitad00b92d12ac29d48d540e2bb75b0034::$files; - $requireFile = static function ($fileIdentifier, $file) { + $filesToLoad = \Composer\Autoload\ComposerStaticInit9d3328eb7139b63c91b644b63fb21216::$files; + $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; require $file; } - }; + }, null, null); foreach ($filesToLoad as $fileIdentifier => $file) { - ($requireFile)($fileIdentifier, $file); + $requireFile($fileIdentifier, $file); } return $loader; diff --git a/modules/addons/NFEioServiceInvoices/lib/vendor/composer/autoload_static.php b/modules/addons/NFEioServiceInvoices/lib/vendor/composer/autoload_static.php index bffd982..711b155 100644 --- a/modules/addons/NFEioServiceInvoices/lib/vendor/composer/autoload_static.php +++ b/modules/addons/NFEioServiceInvoices/lib/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInitad00b92d12ac29d48d540e2bb75b0034 +class ComposerStaticInit9d3328eb7139b63c91b644b63fb21216 { public static $files = array ( '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php', @@ -93,6 +93,8 @@ class ComposerStaticInitad00b92d12ac29d48d540e2bb75b0034 'NFEioServiceInvoices\\Configuration' => __DIR__ . '/../../../../../..' . '/modules/addons/NFEioServiceInvoices/lib/Configuration.php', 'NFEioServiceInvoices\\CustomFields' => __DIR__ . '/../../../../../..' . '/modules/addons/NFEioServiceInvoices/lib/CustomFields.php', 'NFEioServiceInvoices\\Helpers\\Invoices' => __DIR__ . '/../../../../../..' . '/modules/addons/NFEioServiceInvoices/lib/Helpers/Invoices.php', + 'NFEioServiceInvoices\\Helpers\\Timestamp' => __DIR__ . '/../../../../../..' . '/modules/addons/NFEioServiceInvoices/lib/Helpers/Timestamp.php', + 'NFEioServiceInvoices\\Helpers\\Validations' => __DIR__ . '/../../../../../..' . '/modules/addons/NFEioServiceInvoices/lib/Helpers/Validations.php', 'NFEioServiceInvoices\\Helpers\\Versions' => __DIR__ . '/../../../../../..' . '/modules/addons/NFEioServiceInvoices/lib/Helpers/Versions.php', 'NFEioServiceInvoices\\Hooks\\AdminInvoicesControlsOutput' => __DIR__ . '/../../../../../..' . '/modules/addons/NFEioServiceInvoices/lib/Hooks/AdminInvoicesControlsOutput.php', 'NFEioServiceInvoices\\Hooks\\AfterCronJob' => __DIR__ . '/../../../../../..' . '/modules/addons/NFEioServiceInvoices/lib/Hooks/AfterCronJob.php', @@ -161,9 +163,9 @@ class ComposerStaticInitad00b92d12ac29d48d540e2bb75b0034 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInitad00b92d12ac29d48d540e2bb75b0034::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInitad00b92d12ac29d48d540e2bb75b0034::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInitad00b92d12ac29d48d540e2bb75b0034::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit9d3328eb7139b63c91b644b63fb21216::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit9d3328eb7139b63c91b644b63fb21216::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit9d3328eb7139b63c91b644b63fb21216::$classMap; }, null, ClassLoader::class); } diff --git a/modules/addons/NFEioServiceInvoices/lib/vendor/composer/installed.json b/modules/addons/NFEioServiceInvoices/lib/vendor/composer/installed.json index 07c8fbb..e3efd8e 100644 --- a/modules/addons/NFEioServiceInvoices/lib/vendor/composer/installed.json +++ b/modules/addons/NFEioServiceInvoices/lib/vendor/composer/installed.json @@ -2,17 +2,17 @@ "packages": [ { "name": "guzzlehttp/psr7", - "version": "1.9.0", - "version_normalized": "1.9.0.0", + "version": "1.9.1", + "version_normalized": "1.9.1.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "e98e3e6d4f86621a9b75f623996e6bbdeb4b9318" + "reference": "e4490cabc77465aaee90b20cfc9a770f8c04be6b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/e98e3e6d4f86621a9b75f623996e6bbdeb4b9318", - "reference": "e98e3e6d4f86621a9b75f623996e6bbdeb4b9318", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/e4490cabc77465aaee90b20cfc9a770f8c04be6b", + "reference": "e4490cabc77465aaee90b20cfc9a770f8c04be6b", "shasum": "" }, "require": { @@ -30,13 +30,8 @@ "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" }, - "time": "2022-06-20T21:43:03+00:00", + "time": "2023-04-17T16:00:37+00:00", "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.9-dev" - } - }, "installation-source": "dist", "autoload": { "files": [ @@ -95,7 +90,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/1.9.0" + "source": "https://github.com/guzzle/psr7/tree/1.9.1" }, "funding": [ { @@ -226,27 +221,27 @@ }, { "name": "psr/http-message", - "version": "1.0.1", - "version_normalized": "1.0.1.0", + "version": "1.1", + "version_normalized": "1.1.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/http-message.git", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/cb6ce4845ce34a8ad9e68117c10ee90a29919eba", + "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": "^7.2 || ^8.0" }, - "time": "2016-08-06T14:39:51+00:00", + "time": "2023-04-04T09:50:52+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.1.x-dev" } }, "installation-source": "dist", @@ -276,7 +271,7 @@ "response" ], "support": { - "source": "https://github.com/php-fig/http-message/tree/master" + "source": "https://github.com/php-fig/http-message/tree/1.1" }, "install-path": "../psr/http-message" }, diff --git a/modules/addons/NFEioServiceInvoices/lib/vendor/composer/installed.php b/modules/addons/NFEioServiceInvoices/lib/vendor/composer/installed.php index 64b654d..d2a9087 100644 --- a/modules/addons/NFEioServiceInvoices/lib/vendor/composer/installed.php +++ b/modules/addons/NFEioServiceInvoices/lib/vendor/composer/installed.php @@ -1,9 +1,9 @@ array( 'name' => '__root__', - 'pretty_version' => '1.0.0+no-version-set', - 'version' => '1.0.0.0', - 'reference' => NULL, + 'pretty_version' => 'dev-develop', + 'version' => 'dev-develop', + 'reference' => '7427feebf24386200bad5e180c438172e95fbc2a', 'type' => 'library', 'install_path' => __DIR__ . '/../../../../../../', 'aliases' => array(), @@ -11,18 +11,18 @@ ), 'versions' => array( '__root__' => array( - 'pretty_version' => '1.0.0+no-version-set', - 'version' => '1.0.0.0', - 'reference' => NULL, + 'pretty_version' => 'dev-develop', + 'version' => 'dev-develop', + 'reference' => '7427feebf24386200bad5e180c438172e95fbc2a', 'type' => 'library', 'install_path' => __DIR__ . '/../../../../../../', 'aliases' => array(), 'dev_requirement' => false, ), 'guzzlehttp/psr7' => array( - 'pretty_version' => '1.9.0', - 'version' => '1.9.0.0', - 'reference' => 'e98e3e6d4f86621a9b75f623996e6bbdeb4b9318', + 'pretty_version' => '1.9.1', + 'version' => '1.9.1.0', + 'reference' => 'e4490cabc77465aaee90b20cfc9a770f8c04be6b', 'type' => 'library', 'install_path' => __DIR__ . '/../guzzlehttp/psr7', 'aliases' => array(), @@ -47,9 +47,9 @@ 'dev_requirement' => false, ), 'psr/http-message' => array( - 'pretty_version' => '1.0.1', - 'version' => '1.0.1.0', - 'reference' => 'f6561bf28d520154e4b0ec72be95418abe6d9363', + 'pretty_version' => '1.1', + 'version' => '1.1.0.0', + 'reference' => 'cb6ce4845ce34a8ad9e68117c10ee90a29919eba', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/http-message', 'aliases' => array(), diff --git a/modules/addons/NFEioServiceInvoices/lib/vendor/composer/platform_check.php b/modules/addons/NFEioServiceInvoices/lib/vendor/composer/platform_check.php index 8b379f4..580fa96 100644 --- a/modules/addons/NFEioServiceInvoices/lib/vendor/composer/platform_check.php +++ b/modules/addons/NFEioServiceInvoices/lib/vendor/composer/platform_check.php @@ -4,8 +4,8 @@ $issues = array(); -if (!(PHP_VERSION_ID >= 50600)) { - $issues[] = 'Your Composer dependencies require a PHP version ">= 5.6.0". You are running ' . PHP_VERSION . '.'; +if (!(PHP_VERSION_ID >= 70400)) { + $issues[] = 'Your Composer dependencies require a PHP version ">= 7.4.0". You are running ' . PHP_VERSION . '.'; } if ($issues) { diff --git a/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/.github/workflows/ci.yml b/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/.github/workflows/ci.yml index eda7dce..0850470 100644 --- a/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/.github/workflows/ci.yml +++ b/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/.github/workflows/ci.yml @@ -6,7 +6,7 @@ on: jobs: build: name: Build - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 strategy: max-parallel: 10 matrix: @@ -21,11 +21,7 @@ jobs: extensions: mbstring - name: Checkout code - uses: actions/checkout@v2 - - - name: Mimic PHP 8.0 - run: composer config platform.php 8.0.999 - if: matrix.php > 8 + uses: actions/checkout@v3 - name: Install dependencies run: composer update --no-interaction --no-progress diff --git a/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/.github/workflows/integration.yml b/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/.github/workflows/integration.yml index 3c31f9e..a55a256 100644 --- a/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/.github/workflows/integration.yml +++ b/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/.github/workflows/integration.yml @@ -4,14 +4,13 @@ on: pull_request: jobs: - build: name: Test - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 strategy: max-parallel: 10 matrix: - php: ['7.2', '7.3', '7.4', '8.0'] + php: ['7.2', '7.3', '7.4', '8.0', '8.1'] steps: - name: Set up PHP @@ -21,7 +20,7 @@ jobs: coverage: none - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Download dependencies uses: ramsey/composer-install@v1 diff --git a/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/.github/workflows/static.yml b/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/.github/workflows/static.yml index ab4d68b..f00351b 100644 --- a/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/.github/workflows/static.yml +++ b/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/.github/workflows/static.yml @@ -6,11 +6,11 @@ on: jobs: php-cs-fixer: name: PHP-CS-Fixer - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup PHP uses: shivammathur/setup-php@v2 diff --git a/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/CHANGELOG.md b/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/CHANGELOG.md index b4fdf3c..9b2b65c 100644 --- a/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/CHANGELOG.md +++ b/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/CHANGELOG.md @@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +## 1.9.1 - 2023-04-17 + +### Fixed + +- Fixed header validation issue + ## 1.9.0 - 2022-06-20 ### Added diff --git a/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/composer.json b/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/composer.json index 0e36920..2607f22 100644 --- a/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/composer.json +++ b/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/composer.json @@ -61,11 +61,6 @@ "GuzzleHttp\\Tests\\Psr7\\": "tests/" } }, - "extra": { - "branch-alias": { - "dev-master": "1.9-dev" - } - }, "config": { "preferred-install": "dist", "sort-packages": true, diff --git a/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/src/MessageTrait.php b/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/src/MessageTrait.php index 0ac8663..0bbd63e 100644 --- a/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/src/MessageTrait.php +++ b/modules/addons/NFEioServiceInvoices/lib/vendor/guzzlehttp/psr7/src/MessageTrait.php @@ -226,12 +226,9 @@ private function assertHeader($header) throw new \InvalidArgumentException('Header name can not be empty.'); } - if (! preg_match('/^[a-zA-Z0-9\'`#$%&*+.^_|~!-]+$/', $header)) { + if (! preg_match('/^[a-zA-Z0-9\'`#$%&*+.^_|~!-]+$/D', $header)) { throw new \InvalidArgumentException( - sprintf( - '"%s" is not valid header name', - $header - ) + sprintf('"%s" is not valid header name.', $header) ); } } @@ -263,8 +260,10 @@ private function assertValue($value) // Clients must not send a request with line folding and a server sending folded headers is // likely very rare. Line folding is a fairly obscure feature of HTTP/1.1 and thus not accepting // folding is not likely to break any legitimate use case. - if (! preg_match('/^[\x20\x09\x21-\x7E\x80-\xFF]*$/', $value)) { - throw new \InvalidArgumentException(sprintf('"%s" is not valid header value', $value)); + if (! preg_match('/^[\x20\x09\x21-\x7E\x80-\xFF]*$/D', $value)) { + throw new \InvalidArgumentException( + sprintf('"%s" is not valid header value.', $value) + ); } } } diff --git a/modules/addons/NFEioServiceInvoices/lib/vendor/psr/http-message/README.md b/modules/addons/NFEioServiceInvoices/lib/vendor/psr/http-message/README.md index 2818533..2668be6 100644 --- a/modules/addons/NFEioServiceInvoices/lib/vendor/psr/http-message/README.md +++ b/modules/addons/NFEioServiceInvoices/lib/vendor/psr/http-message/README.md @@ -10,4 +10,7 @@ interface that describes a HTTP message. See the specification for more details. Usage ----- -We'll certainly need some stuff in here. \ No newline at end of file +Before reading the usage guide we recommend reading the PSR-7 interfaces method list: + +* [`PSR-7 Interfaces Method List`](docs/PSR7-Interfaces.md) +* [`PSR-7 Usage Guide`](docs/PSR7-Usage.md) \ No newline at end of file diff --git a/modules/addons/NFEioServiceInvoices/lib/vendor/psr/http-message/composer.json b/modules/addons/NFEioServiceInvoices/lib/vendor/psr/http-message/composer.json index b0d2937..56e8c0a 100644 --- a/modules/addons/NFEioServiceInvoices/lib/vendor/psr/http-message/composer.json +++ b/modules/addons/NFEioServiceInvoices/lib/vendor/psr/http-message/composer.json @@ -11,7 +11,7 @@ } ], "require": { - "php": ">=5.3.0" + "php": "^7.2 || ^8.0" }, "autoload": { "psr-4": { @@ -20,7 +20,7 @@ }, "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.1.x-dev" } } } diff --git a/modules/addons/NFEioServiceInvoices/lib/vendor/psr/http-message/src/MessageInterface.php b/modules/addons/NFEioServiceInvoices/lib/vendor/psr/http-message/src/MessageInterface.php index dd46e5e..8cdb4ed 100644 --- a/modules/addons/NFEioServiceInvoices/lib/vendor/psr/http-message/src/MessageInterface.php +++ b/modules/addons/NFEioServiceInvoices/lib/vendor/psr/http-message/src/MessageInterface.php @@ -1,5 +1,7 @@