diff --git a/app/Classes/Jobs/UpdatePerfexCRM.php b/app/Classes/Jobs/UpdatePerfexCRM.php index cbb65228..9f598c34 100644 --- a/app/Classes/Jobs/UpdatePerfexCRM.php +++ b/app/Classes/Jobs/UpdatePerfexCRM.php @@ -45,9 +45,7 @@ class UpdatePerfexCRM implements ShouldQueue public function handle() { //To use invoice as a reference to decide whether more tasks should be created - if($this->transaction != null && $this->transaction->type === TransactionType::PAYMENT){ - $this->updatePerfexCRMObject->setInvoiceId($this->getInvoiceIdOrCreateInvoice()); - } + $this->updatePerfexCRMObject->setInvoiceId($this->getInvoiceIdOrCreateInvoice()); $result = (App()->make(UpdatePerfexCRMProcessor::class))->execute($this->updatePerfexCRMObject); if($this->transaction != null && $this->shouldCreateInvoice){ @@ -63,7 +61,7 @@ class UpdatePerfexCRM implements ShouldQueue } private function getInvoiceIdOrCreateInvoice(){ - if($this->transaction != null){ + if($this->transaction != null && $this->transaction->type !== TransactionType::PURCHASE_ORDER){ $fetchPerfexCRMInvoiceObject = new FetchPerfexCRMInvoiceObject( $this->updatePerfexCRMObject->getContactEmail(), $this->transaction