From 4fe06b8a29cd33289fa21fd25f1c2c40bf54e375 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 7 Feb 2022 19:14:54 +1100 Subject: [PATCH] v5.3.56 --- VERSION.txt | 2 +- app/Jobs/PostMark/ProcessPostmarkWebhook.php | 55 ++++++++++++++++++++ app/Models/SystemLog.php | 1 + config/ninja.php | 4 +- 4 files changed, 59 insertions(+), 3 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index f3a1d04bd3..97e837542e 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -5.3.55 \ No newline at end of file +5.3.56 \ No newline at end of file diff --git a/app/Jobs/PostMark/ProcessPostmarkWebhook.php b/app/Jobs/PostMark/ProcessPostmarkWebhook.php index e344417277..e2f1355f30 100644 --- a/app/Jobs/PostMark/ProcessPostmarkWebhook.php +++ b/app/Jobs/PostMark/ProcessPostmarkWebhook.php @@ -88,6 +88,8 @@ class ProcessPostmarkWebhook implements ShouldQueue return $this->processBounce(); case 'SpamComplaint': return $this->processSpamComplaint(); + case 'Open': + return $this->processOpen(); default: # code... break; @@ -95,6 +97,59 @@ class ProcessPostmarkWebhook implements ShouldQueue } +// { +// "Metadata": { +// "example": "value", +// "example_2": "value" +// }, +// "RecordType": "Open", +// "FirstOpen": true, +// "Client": { +// "Name": "Chrome 35.0.1916.153", +// "Company": "Google", +// "Family": "Chrome" +// }, +// "OS": { +// "Name": "OS X 10.7 Lion", +// "Company": "Apple Computer, Inc.", +// "Family": "OS X 10" +// }, +// "Platform": "WebMail", +// "UserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36", +// "ReadSeconds": 5, +// "Geo": { +// "CountryISOCode": "RS", +// "Country": "Serbia", +// "RegionISOCode": "VO", +// "Region": "Autonomna Pokrajina Vojvodina", +// "City": "Novi Sad", +// "Zip": "21000", +// "Coords": "45.2517,19.8369", +// "IP": "188.2.95.4" +// }, +// "MessageID": "00000000-0000-0000-0000-000000000000", +// "MessageStream": "outbound", +// "ReceivedAt": "2022-02-06T06:37:48Z", +// "Tag": "welcome-email", +// "Recipient": "john@example.com" +// } + + private function processOpen() + { + + $this->invitation->opened_date = now(); + $this->invitation->save(); + + SystemLogger::dispatch($this->request, + SystemLog::CATEGORY_MAIL, + SystemLog::EVENT_MAIL_OPENED, + SystemLog::TYPE_WEBHOOK_RESPONSE, + $this->invitation->contact->client, + $this->invitation->company + ); + + } + // { // "RecordType": "Delivery", // "ServerID": 23, diff --git a/app/Models/SystemLog.php b/app/Models/SystemLog.php index 2565c4d003..95672410ef 100644 --- a/app/Models/SystemLog.php +++ b/app/Models/SystemLog.php @@ -50,6 +50,7 @@ class SystemLog extends Model const EVENT_MAIL_BOUNCED = 32; const EVENT_MAIL_SPAM_COMPLAINT = 33; const EVENT_MAIL_DELIVERY = 34; + const EVENT_MAIL_OPENED = 35; const EVENT_WEBHOOK_RESPONSE = 40; const EVENT_WEBHOOK_SUCCESS = 41; diff --git a/config/ninja.php b/config/ninja.php index 64676a4cc4..74799917a7 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -14,8 +14,8 @@ return [ 'require_https' => env('REQUIRE_HTTPS', true), 'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_domain' => env('APP_DOMAIN', 'invoicing.co'), - 'app_version' => '5.3.55', - 'app_tag' => '5.3.55', + 'app_version' => '5.3.56', + 'app_tag' => '5.3.56', 'minimum_client_version' => '5.0.16', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', ''),