Merge pull request #9923 from turbo124/v5-develop

Purchase Order Accept Webhook
This commit is contained in:
David Bomba 2024-08-21 09:36:52 +10:00 committed by GitHub
commit 827eb8de19
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 86 additions and 78 deletions

View File

@ -11,23 +11,25 @@
namespace App\Http\Controllers\VendorPortal; namespace App\Http\Controllers\VendorPortal;
use App\Events\Misc\InvitationWasViewed; use App\Utils\Ninja;
use App\Events\PurchaseOrder\PurchaseOrderWasAccepted; use App\Models\Webhook;
use App\Events\PurchaseOrder\PurchaseOrderWasViewed; use Illuminate\View\View;
use App\Models\PurchaseOrder;
use App\Utils\Traits\MakesHash;
use App\Utils\Traits\MakesDates;
use App\Jobs\Entity\CreateRawPdf;
use App\Jobs\Util\WebhookHandler;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Http\Requests\VendorPortal\PurchaseOrders\ProcessPurchaseOrdersInBulkRequest; use App\Jobs\Invoice\InjectSignature;
use Illuminate\Support\Facades\Cache;
use Illuminate\Contracts\View\Factory;
use App\Models\PurchaseOrderInvitation;
use App\Events\Misc\InvitationWasViewed;
use App\Events\PurchaseOrder\PurchaseOrderWasViewed;
use App\Events\PurchaseOrder\PurchaseOrderWasAccepted;
use App\Http\Requests\VendorPortal\PurchaseOrders\ShowPurchaseOrderRequest; use App\Http\Requests\VendorPortal\PurchaseOrders\ShowPurchaseOrderRequest;
use App\Http\Requests\VendorPortal\PurchaseOrders\ShowPurchaseOrdersRequest; use App\Http\Requests\VendorPortal\PurchaseOrders\ShowPurchaseOrdersRequest;
use App\Jobs\Entity\CreateRawPdf; use App\Http\Requests\VendorPortal\PurchaseOrders\ProcessPurchaseOrdersInBulkRequest;
use App\Jobs\Invoice\InjectSignature;
use App\Models\PurchaseOrder;
use App\Models\PurchaseOrderInvitation;
use App\Utils\Ninja;
use App\Utils\Traits\MakesDates;
use App\Utils\Traits\MakesHash;
use Illuminate\Contracts\View\Factory;
use Illuminate\Support\Facades\Cache;
use Illuminate\View\View;
class PurchaseOrderController extends Controller class PurchaseOrderController extends Controller
{ {
@ -187,6 +189,9 @@ class PurchaseOrderController extends Controller
} }
event(new PurchaseOrderWasAccepted($purchase_order, auth()->guard('vendor')->user(), $purchase_order->company, Ninja::eventVars())); event(new PurchaseOrderWasAccepted($purchase_order, auth()->guard('vendor')->user(), $purchase_order->company, Ninja::eventVars()));
WebhookHandler::dispatch(Webhook::EVENT_ACCEPTED_PURCHASE_ORDER, $purchase_order, $purchase_order->company, 'vendor')->delay(0);
}); });
if ($purchase_count_query->count() == 1) { if ($purchase_count_query->count() == 1) {

View File

@ -298,7 +298,7 @@ class NinjaMailerJob implements ShouldQueue
/** Force free/trials onto specific mail driver */ /** Force free/trials onto specific mail driver */
if($this->mailer == 'default' && $this->company->account->isNewHostedAccount()) { if($this->nmo->settings->email_sending_method == 'default' && $this->company->account->isNewHostedAccount()) {
$this->mailer = 'mailgun'; $this->mailer = 'mailgun';
$this->setHostedMailgunMailer(); $this->setHostedMailgunMailer();
return $this; return $this;

View File

@ -176,7 +176,10 @@ class Webhook extends BaseModel
public const EVENT_REMIND_QUOTE = 64; public const EVENT_REMIND_QUOTE = 64;
public const EVENT_ACCEPTED_PURCHASE_ORDER = 65;
public static $valid_events = [ public static $valid_events = [
self::EVENT_ACCEPTED_PURCHASE_ORDER,
self::EVENT_REMIND_QUOTE, self::EVENT_REMIND_QUOTE,
self::EVENT_CREATE_PURCHASE_ORDER, self::EVENT_CREATE_PURCHASE_ORDER,
self::EVENT_UPDATE_PURCHASE_ORDER, self::EVENT_UPDATE_PURCHASE_ORDER,

View File

@ -526,7 +526,7 @@ class Email implements ShouldQueue
{ {
/** Force free/trials onto specific mail driver */ /** Force free/trials onto specific mail driver */
if($this->mailer == 'default' && $this->company->account->isNewHostedAccount()) { if($this->email_object->settings->email_sending_method == 'default' && $this->company->account->isNewHostedAccount()) {
$this->mailer = 'mailgun'; $this->mailer = 'mailgun';
$this->setHostedMailgunMailer(); $this->setHostedMailgunMailer();
return $this; return $this;
@ -678,7 +678,6 @@ class Email implements ShouldQueue
} }
} }
/** /**
* Ensure we discard any data that is not required * Ensure we discard any data that is not required
* *

122
composer.lock generated
View File

@ -535,16 +535,16 @@
}, },
{ {
"name": "aws/aws-sdk-php", "name": "aws/aws-sdk-php",
"version": "3.320.1", "version": "3.320.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/aws/aws-sdk-php.git", "url": "https://github.com/aws/aws-sdk-php.git",
"reference": "653549ab0e274747a46a96fd375df642704f21e2" "reference": "e6af3e760864d43a30d8b7deb4f9dc6a49a5f66a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/653549ab0e274747a46a96fd375df642704f21e2", "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/e6af3e760864d43a30d8b7deb4f9dc6a49a5f66a",
"reference": "653549ab0e274747a46a96fd375df642704f21e2", "reference": "e6af3e760864d43a30d8b7deb4f9dc6a49a5f66a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -627,9 +627,9 @@
"support": { "support": {
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
"issues": "https://github.com/aws/aws-sdk-php/issues", "issues": "https://github.com/aws/aws-sdk-php/issues",
"source": "https://github.com/aws/aws-sdk-php/tree/3.320.1" "source": "https://github.com/aws/aws-sdk-php/tree/3.320.4"
}, },
"time": "2024-08-15T18:07:13+00:00" "time": "2024-08-20T18:20:32+00:00"
}, },
{ {
"name": "bacon/bacon-qr-code", "name": "bacon/bacon-qr-code",
@ -2522,16 +2522,16 @@
}, },
{ {
"name": "google/apiclient-services", "name": "google/apiclient-services",
"version": "v0.368.0", "version": "v0.369.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/googleapis/google-api-php-client-services.git", "url": "https://github.com/googleapis/google-api-php-client-services.git",
"reference": "edc08087aa3ca63d3b74f24d59f1d2caab39b5d9" "reference": "002f610e4c3acf0636b4fb1f46314a2097e1c8b4"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/edc08087aa3ca63d3b74f24d59f1d2caab39b5d9", "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/002f610e4c3acf0636b4fb1f46314a2097e1c8b4",
"reference": "edc08087aa3ca63d3b74f24d59f1d2caab39b5d9", "reference": "002f610e4c3acf0636b4fb1f46314a2097e1c8b4",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2560,9 +2560,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/googleapis/google-api-php-client-services/issues", "issues": "https://github.com/googleapis/google-api-php-client-services/issues",
"source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.368.0" "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.369.0"
}, },
"time": "2024-07-11T01:08:44+00:00" "time": "2024-08-14T20:31:16+00:00"
}, },
{ {
"name": "google/auth", "name": "google/auth",
@ -4489,16 +4489,16 @@
}, },
{ {
"name": "laravel/framework", "name": "laravel/framework",
"version": "v11.20.0", "version": "v11.21.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/framework.git", "url": "https://github.com/laravel/framework.git",
"reference": "3cd7593dd9b67002fc416b46616f4d4d1da3e571" "reference": "9d9d36708d56665b12185493f684abce38ad2d30"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/3cd7593dd9b67002fc416b46616f4d4d1da3e571", "url": "https://api.github.com/repos/laravel/framework/zipball/9d9d36708d56665b12185493f684abce38ad2d30",
"reference": "3cd7593dd9b67002fc416b46616f4d4d1da3e571", "reference": "9d9d36708d56665b12185493f684abce38ad2d30",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -4691,7 +4691,7 @@
"issues": "https://github.com/laravel/framework/issues", "issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework" "source": "https://github.com/laravel/framework"
}, },
"time": "2024-08-06T14:39:21+00:00" "time": "2024-08-20T15:00:52+00:00"
}, },
{ {
"name": "laravel/pint", "name": "laravel/pint",
@ -4761,16 +4761,16 @@
}, },
{ {
"name": "laravel/prompts", "name": "laravel/prompts",
"version": "v0.1.24", "version": "v0.1.25",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/prompts.git", "url": "https://github.com/laravel/prompts.git",
"reference": "409b0b4305273472f3754826e68f4edbd0150149" "reference": "7b4029a84c37cb2725fc7f011586e2997040bc95"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/prompts/zipball/409b0b4305273472f3754826e68f4edbd0150149", "url": "https://api.github.com/repos/laravel/prompts/zipball/7b4029a84c37cb2725fc7f011586e2997040bc95",
"reference": "409b0b4305273472f3754826e68f4edbd0150149", "reference": "7b4029a84c37cb2725fc7f011586e2997040bc95",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -4813,9 +4813,9 @@
"description": "Add beautiful and user-friendly forms to your command-line applications.", "description": "Add beautiful and user-friendly forms to your command-line applications.",
"support": { "support": {
"issues": "https://github.com/laravel/prompts/issues", "issues": "https://github.com/laravel/prompts/issues",
"source": "https://github.com/laravel/prompts/tree/v0.1.24" "source": "https://github.com/laravel/prompts/tree/v0.1.25"
}, },
"time": "2024-06-17T13:58:22+00:00" "time": "2024-08-12T22:06:33+00:00"
}, },
{ {
"name": "laravel/serializable-closure", "name": "laravel/serializable-closure",
@ -4880,16 +4880,16 @@
}, },
{ {
"name": "laravel/slack-notification-channel", "name": "laravel/slack-notification-channel",
"version": "v3.3.0", "version": "v3.3.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/slack-notification-channel.git", "url": "https://github.com/laravel/slack-notification-channel.git",
"reference": "8cd988fad1a08ed88dfd852f140477376c60217f" "reference": "fc8f931b9ae868945cf0c39aeda71f1cbe180484"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/slack-notification-channel/zipball/8cd988fad1a08ed88dfd852f140477376c60217f", "url": "https://api.github.com/repos/laravel/slack-notification-channel/zipball/fc8f931b9ae868945cf0c39aeda71f1cbe180484",
"reference": "8cd988fad1a08ed88dfd852f140477376c60217f", "reference": "fc8f931b9ae868945cf0c39aeda71f1cbe180484",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -4939,9 +4939,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/laravel/slack-notification-channel/issues", "issues": "https://github.com/laravel/slack-notification-channel/issues",
"source": "https://github.com/laravel/slack-notification-channel/tree/v3.3.0" "source": "https://github.com/laravel/slack-notification-channel/tree/v3.3.1"
}, },
"time": "2024-07-10T19:39:44+00:00" "time": "2024-08-17T20:57:03+00:00"
}, },
{ {
"name": "laravel/socialite", "name": "laravel/socialite",
@ -5283,16 +5283,16 @@
}, },
{ {
"name": "league/commonmark", "name": "league/commonmark",
"version": "2.5.2", "version": "2.5.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/thephpleague/commonmark.git", "url": "https://github.com/thephpleague/commonmark.git",
"reference": "df09d5b6a4188f8f3c3ab2e43a109076a5eeb767" "reference": "b650144166dfa7703e62a22e493b853b58d874b0"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/thephpleague/commonmark/zipball/df09d5b6a4188f8f3c3ab2e43a109076a5eeb767", "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/b650144166dfa7703e62a22e493b853b58d874b0",
"reference": "df09d5b6a4188f8f3c3ab2e43a109076a5eeb767", "reference": "b650144166dfa7703e62a22e493b853b58d874b0",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -5305,8 +5305,8 @@
}, },
"require-dev": { "require-dev": {
"cebe/markdown": "^1.0", "cebe/markdown": "^1.0",
"commonmark/cmark": "0.31.0", "commonmark/cmark": "0.31.1",
"commonmark/commonmark.js": "0.31.0", "commonmark/commonmark.js": "0.31.1",
"composer/package-versions-deprecated": "^1.8", "composer/package-versions-deprecated": "^1.8",
"embed/embed": "^4.4", "embed/embed": "^4.4",
"erusev/parsedown": "^1.0", "erusev/parsedown": "^1.0",
@ -5385,7 +5385,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-08-14T10:56:57+00:00" "time": "2024-08-16T11:46:16+00:00"
}, },
{ {
"name": "league/config", "name": "league/config",
@ -5948,16 +5948,16 @@
}, },
{ {
"name": "livewire/livewire", "name": "livewire/livewire",
"version": "v3.5.4", "version": "v3.5.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/livewire/livewire.git", "url": "https://github.com/livewire/livewire.git",
"reference": "b158c6386a892efc6c5e4682e682829baac1f933" "reference": "597a2808d8d3001cc3ed5ce89a6ebab00f83b80f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/livewire/livewire/zipball/b158c6386a892efc6c5e4682e682829baac1f933", "url": "https://api.github.com/repos/livewire/livewire/zipball/597a2808d8d3001cc3ed5ce89a6ebab00f83b80f",
"reference": "b158c6386a892efc6c5e4682e682829baac1f933", "reference": "597a2808d8d3001cc3ed5ce89a6ebab00f83b80f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -5965,6 +5965,7 @@
"illuminate/routing": "^10.0|^11.0", "illuminate/routing": "^10.0|^11.0",
"illuminate/support": "^10.0|^11.0", "illuminate/support": "^10.0|^11.0",
"illuminate/validation": "^10.0|^11.0", "illuminate/validation": "^10.0|^11.0",
"laravel/prompts": "^0.1.24",
"league/mime-type-detection": "^1.9", "league/mime-type-detection": "^1.9",
"php": "^8.1", "php": "^8.1",
"symfony/console": "^6.0|^7.0", "symfony/console": "^6.0|^7.0",
@ -5973,7 +5974,6 @@
"require-dev": { "require-dev": {
"calebporzio/sushi": "^2.1", "calebporzio/sushi": "^2.1",
"laravel/framework": "^10.15.0|^11.0", "laravel/framework": "^10.15.0|^11.0",
"laravel/prompts": "^0.1.6",
"mockery/mockery": "^1.3.1", "mockery/mockery": "^1.3.1",
"orchestra/testbench": "^8.21.0|^9.0", "orchestra/testbench": "^8.21.0|^9.0",
"orchestra/testbench-dusk": "^8.24|^9.1", "orchestra/testbench-dusk": "^8.24|^9.1",
@ -6012,7 +6012,7 @@
"description": "A front-end framework for Laravel.", "description": "A front-end framework for Laravel.",
"support": { "support": {
"issues": "https://github.com/livewire/livewire/issues", "issues": "https://github.com/livewire/livewire/issues",
"source": "https://github.com/livewire/livewire/tree/v3.5.4" "source": "https://github.com/livewire/livewire/tree/v3.5.6"
}, },
"funding": [ "funding": [
{ {
@ -6020,7 +6020,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2024-07-15T18:27:32+00:00" "time": "2024-08-19T11:52:18+00:00"
}, },
{ {
"name": "maennchen/zipstream-php", "name": "maennchen/zipstream-php",
@ -6896,16 +6896,16 @@
}, },
{ {
"name": "nesbot/carbon", "name": "nesbot/carbon",
"version": "3.7.0", "version": "3.8.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/briannesbitt/Carbon.git", "url": "https://github.com/briannesbitt/Carbon.git",
"reference": "cb4374784c87d0a0294e8513a52eb63c0aff3139" "reference": "bbd3eef89af8ba66a3aa7952b5439168fbcc529f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/cb4374784c87d0a0294e8513a52eb63c0aff3139", "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/bbd3eef89af8ba66a3aa7952b5439168fbcc529f",
"reference": "cb4374784c87d0a0294e8513a52eb63c0aff3139", "reference": "bbd3eef89af8ba66a3aa7952b5439168fbcc529f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -6998,7 +6998,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-07-16T22:29:20+00:00" "time": "2024-08-19T06:22:39+00:00"
}, },
{ {
"name": "nette/schema", "name": "nette/schema",
@ -15126,26 +15126,26 @@
}, },
{ {
"name": "composer/pcre", "name": "composer/pcre",
"version": "3.2.0", "version": "3.3.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/composer/pcre.git", "url": "https://github.com/composer/pcre.git",
"reference": "ea4ab6f9580a4fd221e0418f2c357cdd39102a90" "reference": "1637e067347a0c40bbb1e3cd786b20dcab556a81"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/composer/pcre/zipball/ea4ab6f9580a4fd221e0418f2c357cdd39102a90", "url": "https://api.github.com/repos/composer/pcre/zipball/1637e067347a0c40bbb1e3cd786b20dcab556a81",
"reference": "ea4ab6f9580a4fd221e0418f2c357cdd39102a90", "reference": "1637e067347a0c40bbb1e3cd786b20dcab556a81",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^7.4 || ^8.0" "php": "^7.4 || ^8.0"
}, },
"conflict": { "conflict": {
"phpstan/phpstan": "<1.11.8" "phpstan/phpstan": "<1.11.10"
}, },
"require-dev": { "require-dev": {
"phpstan/phpstan": "^1.11.8", "phpstan/phpstan": "^1.11.10",
"phpstan/phpstan-strict-rules": "^1.1", "phpstan/phpstan-strict-rules": "^1.1",
"phpunit/phpunit": "^8 || ^9" "phpunit/phpunit": "^8 || ^9"
}, },
@ -15185,7 +15185,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/composer/pcre/issues", "issues": "https://github.com/composer/pcre/issues",
"source": "https://github.com/composer/pcre/tree/3.2.0" "source": "https://github.com/composer/pcre/tree/3.3.0"
}, },
"funding": [ "funding": [
{ {
@ -15201,7 +15201,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-07-25T09:36:02+00:00" "time": "2024-08-19T19:43:53+00:00"
}, },
{ {
"name": "composer/semver", "name": "composer/semver",
@ -16299,16 +16299,16 @@
}, },
{ {
"name": "phpstan/phpstan", "name": "phpstan/phpstan",
"version": "1.11.10", "version": "1.11.11",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan.git", "url": "https://github.com/phpstan/phpstan.git",
"reference": "640410b32995914bde3eed26fa89552f9c2c082f" "reference": "707c2aed5d8d0075666e673a5e71440c1d01a5a3"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/640410b32995914bde3eed26fa89552f9c2c082f", "url": "https://api.github.com/repos/phpstan/phpstan/zipball/707c2aed5d8d0075666e673a5e71440c1d01a5a3",
"reference": "640410b32995914bde3eed26fa89552f9c2c082f", "reference": "707c2aed5d8d0075666e673a5e71440c1d01a5a3",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -16353,7 +16353,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2024-08-08T09:02:50+00:00" "time": "2024-08-19T14:37:29+00:00"
}, },
{ {
"name": "phpunit/php-code-coverage", "name": "phpunit/php-code-coverage",

View File

@ -5315,6 +5315,7 @@ $lang = array(
'payment_balance_on_file' => 'Payment Balance On File', 'payment_balance_on_file' => 'Payment Balance On File',
'ubl_email_attachment_help' => 'For more e-invoice settings please navigate :here', 'ubl_email_attachment_help' => 'For more e-invoice settings please navigate :here',
'stop_task_to_add_task_entry' => 'You need to stop the task before adding a new item.', 'stop_task_to_add_task_entry' => 'You need to stop the task before adding a new item.',
'xml_file' => 'XML File',
); );
return $lang; return $lang;