From 61ed1ce7edfb40af3874f6c75fedd0fdd8996d55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnas=20Ge=C4=8Das?= <13507001+arnas@users.noreply.github.com> Date: Mon, 26 Aug 2024 10:59:52 +0300 Subject: [PATCH 1/3] Add deprecation --- README.md | 27 ---------------------- omnisend/class-omnisend-core-bootstrap.php | 4 ++-- omnisend/includes/SDK/V1/class-client.php | 2 ++ omnisend/readme.txt | 5 ++-- 4 files changed, 7 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 8142fc5..c35f8db 100644 --- a/README.md +++ b/README.md @@ -41,33 +41,6 @@ This is done by getting an actual client 'integration name' - should be your integration name 'integration version' - should be your integration version -#### Contact Creation - -Here is how you can create a basic client & submit contact. - -```php -$contact = new Contact(); - -$contact->set_email( $email ); -if ( $phone_number != '' ) { - $contact->set_phone( $phone_number ); -} -$contact->set_first_name( $first_name ); -$contact->set_last_name( $last_name ); -$contact->set_birthday( $birthday ); -$contact->set_postal_code( $postal_code ); -$contact->set_address( $address ); -$contact->set_state( $state ); -$contact->set_country( $country ); -$contact->set_city( $city ); -if ( $email_consent ) { - $contact->set_email_consent( 'actual_email_consent_for_gdrp' ); - $contact->set_email_opt_in( 'where user opted to become subscriber' ); -} -$client = \Omnisend\SDK\V1\Omnisend::get_client( 'integration name', 'integration version' ); - -$response = $client->create_contact( $contact ); -``` #### Save and update Contact diff --git a/omnisend/class-omnisend-core-bootstrap.php b/omnisend/class-omnisend-core-bootstrap.php index a5ad998..7b6fffb 100644 --- a/omnisend/class-omnisend-core-bootstrap.php +++ b/omnisend/class-omnisend-core-bootstrap.php @@ -4,7 +4,7 @@ * * Plugin Name: Omnisend Email Marketing * Description: Omnisend main plugin that enables integration with Omnisend. - * Version: 1.4.2 + * Version: 1.5.0 * Author: Omnisend * Author URI: https://www.omnisend.com * Developer: Omnisend @@ -23,7 +23,7 @@ defined( 'ABSPATH' ) || die( 'no direct access' ); -const OMNISEND_CORE_PLUGIN_VERSION = '1.4.2'; +const OMNISEND_CORE_PLUGIN_VERSION = '1.5.0'; const OMNISEND_CORE_SETTINGS_PAGE = 'omnisend'; const OMNISEND_CORE_PLUGIN_NAME = 'Email Marketing by Omnisend'; const OMNISEND_MENU_TITLE = 'Omnisend Email Marketing'; diff --git a/omnisend/includes/SDK/V1/class-client.php b/omnisend/includes/SDK/V1/class-client.php index 65e6ac9..fafacf9 100644 --- a/omnisend/includes/SDK/V1/class-client.php +++ b/omnisend/includes/SDK/V1/class-client.php @@ -21,6 +21,8 @@ interface Client { * @param Contact $contact * * @return CreateContactResponse + * + * @deprecated Use save_contact() instead. */ public function create_contact( $contact ): CreateContactResponse; diff --git a/omnisend/readme.txt b/omnisend/readme.txt index 8aa2cfb..86ac948 100644 --- a/omnisend/readme.txt +++ b/omnisend/readme.txt @@ -5,7 +5,7 @@ Tags: email marketing, marketing, newsletter, sms, form Requires at least: 4.7.0 Tested up to: 6.4 Requires PHP: 7.1 -Stable tag: 1.4.2 +Stable tag: 1.5.0 License: GPLv3 or later URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -121,10 +121,11 @@ You can report security bugs through the Patchstack Vulnerability Disclosure Pro == Changelog == -= 1.4.2 = += 1.5.0 = * Improve SDK client * Added new functionality for save contact and get contact by email +* Deprecate create_contact = 1.4.1 = From c7b4573e66acbcc82b6d1b233941e81d596a93dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnas=20Ge=C4=8Das?= <13507001+arnas@users.noreply.github.com> Date: Mon, 26 Aug 2024 11:28:34 +0300 Subject: [PATCH 2/3] Fix lint --- composer.lock | 147 +++++++++++----------- omnisend/includes/SDK/V1/class-client.php | 1 - tests/Omnisend/SDK/V1/ContactTest.php | 2 +- 3 files changed, 75 insertions(+), 75 deletions(-) diff --git a/composer.lock b/composer.lock index 89bc760..41e452c 100644 --- a/composer.lock +++ b/composer.lock @@ -87,16 +87,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.11.1", + "version": "1.12.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" + "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", - "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", + "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", "shasum": "" }, "require": { @@ -104,11 +104,12 @@ }, "conflict": { "doctrine/collections": "<1.6.8", - "doctrine/common": "<2.13.3 || >=3,<3.2.2" + "doctrine/common": "<2.13.3 || >=3 <3.2.2" }, "require-dev": { "doctrine/collections": "^1.6.8", "doctrine/common": "^2.13.3 || ^3.2.2", + "phpspec/prophecy": "^1.10", "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", @@ -134,7 +135,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" + "source": "https://github.com/myclabs/DeepCopy/tree/1.12.0" }, "funding": [ { @@ -142,20 +143,20 @@ "type": "tidelift" } ], - "time": "2023-03-08T13:26:56+00:00" + "time": "2024-06-12T14:39:25+00:00" }, { "name": "nikic/php-parser", - "version": "v5.0.2", + "version": "v5.1.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13" + "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/139676794dc1e9231bf7bcd123cfc0c99182cb13", - "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/683130c2ff8c2739f4822ff7ac5c873ec529abd1", + "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1", "shasum": "" }, "require": { @@ -166,7 +167,7 @@ }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^9.0" }, "bin": [ "bin/php-parse" @@ -198,9 +199,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.2" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.1.0" }, - "time": "2024-03-05T20:51:40+00:00" + "time": "2024-07-01T20:03:41+00:00" }, { "name": "phar-io/manifest", @@ -400,22 +401,22 @@ }, { "name": "phpcsstandards/phpcsutils", - "version": "1.0.11", + "version": "1.0.12", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHPCSUtils.git", - "reference": "c457da9dabb60eb7106dd5e3c05132b1a6539c6a" + "reference": "87b233b00daf83fb70f40c9a28692be017ea7c6c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/c457da9dabb60eb7106dd5e3c05132b1a6539c6a", - "reference": "c457da9dabb60eb7106dd5e3c05132b1a6539c6a", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/87b233b00daf83fb70f40c9a28692be017ea7c6c", + "reference": "87b233b00daf83fb70f40c9a28692be017ea7c6c", "shasum": "" }, "require": { "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7 || ^1.0", "php": ">=5.4", - "squizlabs/php_codesniffer": "^3.9.0 || 4.0.x-dev@dev" + "squizlabs/php_codesniffer": "^3.10.0 || 4.0.x-dev@dev" }, "require-dev": { "ext-filter": "*", @@ -484,36 +485,36 @@ "type": "open_collective" } ], - "time": "2024-04-24T11:47:18+00:00" + "time": "2024-05-20T13:34:27+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "10.1.14", + "version": "10.1.16", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "e3f51450ebffe8e0efdf7346ae966a656f7d5e5b" + "reference": "7e308268858ed6baedc8704a304727d20bc07c77" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/e3f51450ebffe8e0efdf7346ae966a656f7d5e5b", - "reference": "e3f51450ebffe8e0efdf7346ae966a656f7d5e5b", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/7e308268858ed6baedc8704a304727d20bc07c77", + "reference": "7e308268858ed6baedc8704a304727d20bc07c77", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.18 || ^5.0", + "nikic/php-parser": "^4.19.1 || ^5.1.0", "php": ">=8.1", - "phpunit/php-file-iterator": "^4.0", - "phpunit/php-text-template": "^3.0", - "sebastian/code-unit-reverse-lookup": "^3.0", - "sebastian/complexity": "^3.0", - "sebastian/environment": "^6.0", - "sebastian/lines-of-code": "^2.0", - "sebastian/version": "^4.0", - "theseer/tokenizer": "^1.2.0" + "phpunit/php-file-iterator": "^4.1.0", + "phpunit/php-text-template": "^3.0.1", + "sebastian/code-unit-reverse-lookup": "^3.0.0", + "sebastian/complexity": "^3.2.0", + "sebastian/environment": "^6.1.0", + "sebastian/lines-of-code": "^2.0.2", + "sebastian/version": "^4.0.1", + "theseer/tokenizer": "^1.2.3" }, "require-dev": { "phpunit/phpunit": "^10.1" @@ -525,7 +526,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "10.1-dev" + "dev-main": "10.1.x-dev" } }, "autoload": { @@ -554,7 +555,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.14" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.16" }, "funding": [ { @@ -562,7 +563,7 @@ "type": "github" } ], - "time": "2024-03-12T15:33:41+00:00" + "time": "2024-08-22T04:31:57+00:00" }, { "name": "phpunit/php-file-iterator", @@ -809,16 +810,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.5.20", + "version": "10.5.30", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "547d314dc24ec1e177720d45c6263fb226cc2ae3" + "reference": "b15524febac0153876b4ba9aab3326c2ee94c897" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/547d314dc24ec1e177720d45c6263fb226cc2ae3", - "reference": "547d314dc24ec1e177720d45c6263fb226cc2ae3", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b15524febac0153876b4ba9aab3326c2ee94c897", + "reference": "b15524febac0153876b4ba9aab3326c2ee94c897", "shasum": "" }, "require": { @@ -828,26 +829,26 @@ "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.10.1", - "phar-io/manifest": "^2.0.3", - "phar-io/version": "^3.0.2", + "myclabs/deep-copy": "^1.12.0", + "phar-io/manifest": "^2.0.4", + "phar-io/version": "^3.2.1", "php": ">=8.1", - "phpunit/php-code-coverage": "^10.1.5", - "phpunit/php-file-iterator": "^4.0", - "phpunit/php-invoker": "^4.0", - "phpunit/php-text-template": "^3.0", - "phpunit/php-timer": "^6.0", - "sebastian/cli-parser": "^2.0", - "sebastian/code-unit": "^2.0", - "sebastian/comparator": "^5.0", - "sebastian/diff": "^5.0", - "sebastian/environment": "^6.0", - "sebastian/exporter": "^5.1", - "sebastian/global-state": "^6.0.1", - "sebastian/object-enumerator": "^5.0", - "sebastian/recursion-context": "^5.0", - "sebastian/type": "^4.0", - "sebastian/version": "^4.0" + "phpunit/php-code-coverage": "^10.1.15", + "phpunit/php-file-iterator": "^4.1.0", + "phpunit/php-invoker": "^4.0.0", + "phpunit/php-text-template": "^3.0.1", + "phpunit/php-timer": "^6.0.0", + "sebastian/cli-parser": "^2.0.1", + "sebastian/code-unit": "^2.0.0", + "sebastian/comparator": "^5.0.2", + "sebastian/diff": "^5.1.1", + "sebastian/environment": "^6.1.0", + "sebastian/exporter": "^5.1.2", + "sebastian/global-state": "^6.0.2", + "sebastian/object-enumerator": "^5.0.0", + "sebastian/recursion-context": "^5.0.0", + "sebastian/type": "^4.0.0", + "sebastian/version": "^4.0.1" }, "suggest": { "ext-soap": "To be able to generate mocks based on WSDL files" @@ -890,7 +891,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.20" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.30" }, "funding": [ { @@ -906,7 +907,7 @@ "type": "tidelift" } ], - "time": "2024-04-24T06:32:35+00:00" + "time": "2024-08-13T06:09:37+00:00" }, { "name": "sebastian/cli-parser", @@ -1078,16 +1079,16 @@ }, { "name": "sebastian/comparator", - "version": "5.0.1", + "version": "5.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "2db5010a484d53ebf536087a70b4a5423c102372" + "reference": "2d3e04c3b4c1e84a5e7382221ad8883c8fbc4f53" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2db5010a484d53ebf536087a70b4a5423c102372", - "reference": "2db5010a484d53ebf536087a70b4a5423c102372", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2d3e04c3b4c1e84a5e7382221ad8883c8fbc4f53", + "reference": "2d3e04c3b4c1e84a5e7382221ad8883c8fbc4f53", "shasum": "" }, "require": { @@ -1098,7 +1099,7 @@ "sebastian/exporter": "^5.0" }, "require-dev": { - "phpunit/phpunit": "^10.3" + "phpunit/phpunit": "^10.4" }, "type": "library", "extra": { @@ -1143,7 +1144,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", "security": "https://github.com/sebastianbergmann/comparator/security/policy", - "source": "https://github.com/sebastianbergmann/comparator/tree/5.0.1" + "source": "https://github.com/sebastianbergmann/comparator/tree/5.0.2" }, "funding": [ { @@ -1151,7 +1152,7 @@ "type": "github" } ], - "time": "2023-08-14T13:18:12+00:00" + "time": "2024-08-12T06:03:08+00:00" }, { "name": "sebastian/complexity", @@ -1826,16 +1827,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.9.2", + "version": "3.10.2", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "aac1f6f347a5c5ac6bc98ad395007df00990f480" + "reference": "86e5f5dd9a840c46810ebe5ff1885581c42a3017" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/aac1f6f347a5c5ac6bc98ad395007df00990f480", - "reference": "aac1f6f347a5c5ac6bc98ad395007df00990f480", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/86e5f5dd9a840c46810ebe5ff1885581c42a3017", + "reference": "86e5f5dd9a840c46810ebe5ff1885581c42a3017", "shasum": "" }, "require": { @@ -1902,7 +1903,7 @@ "type": "open_collective" } ], - "time": "2024-04-23T20:25:34+00:00" + "time": "2024-07-21T23:26:44+00:00" }, { "name": "theseer/tokenizer", diff --git a/omnisend/includes/SDK/V1/class-client.php b/omnisend/includes/SDK/V1/class-client.php index fafacf9..20e29c8 100644 --- a/omnisend/includes/SDK/V1/class-client.php +++ b/omnisend/includes/SDK/V1/class-client.php @@ -21,7 +21,6 @@ interface Client { * @param Contact $contact * * @return CreateContactResponse - * * @deprecated Use save_contact() instead. */ public function create_contact( $contact ): CreateContactResponse; diff --git a/tests/Omnisend/SDK/V1/ContactTest.php b/tests/Omnisend/SDK/V1/ContactTest.php index e0d18da..ab36551 100644 --- a/tests/Omnisend/SDK/V1/ContactTest.php +++ b/tests/Omnisend/SDK/V1/ContactTest.php @@ -10,7 +10,7 @@ final class ContactTest extends TestCase public function test_validation(): void { // Test valid contact - $contact_data = ['email' => 'test@example.com']; + $contact_data = ['email' => '@example.com']; $contact = ContactFactory::create_contact($contact_data); $this->assertFalse($contact->validate()->has_errors()); From a92edba1a7fc2e0601e7fceda199bfa9bfee22f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnas=20Ge=C4=8Das?= <13507001+arnas@users.noreply.github.com> Date: Mon, 26 Aug 2024 11:47:01 +0300 Subject: [PATCH 3/3] Update test --- tests/Omnisend/SDK/V1/ContactTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Omnisend/SDK/V1/ContactTest.php b/tests/Omnisend/SDK/V1/ContactTest.php index ab36551..e0d18da 100644 --- a/tests/Omnisend/SDK/V1/ContactTest.php +++ b/tests/Omnisend/SDK/V1/ContactTest.php @@ -10,7 +10,7 @@ final class ContactTest extends TestCase public function test_validation(): void { // Test valid contact - $contact_data = ['email' => '@example.com']; + $contact_data = ['email' => 'test@example.com']; $contact = ContactFactory::create_contact($contact_data); $this->assertFalse($contact->validate()->has_errors());