mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
email payment proof
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Jobs;
|
||||
|
||||
use App\Classes\Notifications\PaymentProofUploadedEmail;
|
||||
use App\Models\Booking;
|
||||
use App\Models\User;
|
||||
use App\Models\UserEmailVerification;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class SendUserPaymentProofUploadedEmail implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
|
||||
/** @var User */
|
||||
private $user;
|
||||
|
||||
/** @var Booking */
|
||||
private $booking;
|
||||
|
||||
/**
|
||||
* SendUserVerificationEmail constructor.
|
||||
* @param User $user
|
||||
* @param UserEmailVerification $attempt
|
||||
*/
|
||||
public function __construct(User $user, Booking $booking)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->booking = $booking;
|
||||
}
|
||||
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$this->user->notify(new PaymentProofUploadedEmail($this->user, $this->booking));
|
||||
}
|
||||
}
|
||||
+14
-1
@@ -14,6 +14,7 @@ use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\CompanyType;
|
||||
use App\Classes\ValueObjects\Constants\DocumentType;
|
||||
use App\Classes\Jobs\SendUserPaymentProofUploadedEmail;
|
||||
use App\Models\Company;
|
||||
use App\Models\Document;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
@@ -50,6 +51,9 @@ class CreatePaymentProofDocumentLogic extends AbstractControllerLogic
|
||||
/** @var CreateInvoiceTransactionProcessor */
|
||||
private $createInvoiceTransactionProcessor;
|
||||
|
||||
/** @var SendUserPaymentProofUploadedEmail */
|
||||
private $sendUserPaymentProofUploadedEmail;
|
||||
|
||||
/**
|
||||
* CreatePaymentProofDocumentLogic constructor.
|
||||
* @param FetchesTransaction $fetchesTransaction
|
||||
@@ -58,13 +62,14 @@ class CreatePaymentProofDocumentLogic extends AbstractControllerLogic
|
||||
* @param UpdatesTransactionStatus $updatesTransactionStatus
|
||||
* @param CreateInvoiceTransactionProcessor $createInvoiceTransactionProcessor
|
||||
*/
|
||||
public function __construct(FetchesTransaction $fetchesTransaction, CreatesDocument $createsDocument, CreatesFiles $createsFile, UpdatesTransactionStatus $updatesTransactionStatus, CreateInvoiceTransactionProcessor $createInvoiceTransactionProcessor)
|
||||
public function __construct(FetchesTransaction $fetchesTransaction, CreatesDocument $createsDocument, CreatesFiles $createsFile, UpdatesTransactionStatus $updatesTransactionStatus, CreateInvoiceTransactionProcessor $createInvoiceTransactionProcessor, SendUserPaymentProofUploadedEmail $sendUserPaymentProofUploadedEmail)
|
||||
{
|
||||
$this->fetchesTransaction = $fetchesTransaction;
|
||||
$this->createsDocument = $createsDocument;
|
||||
$this->createsFile = $createsFile;
|
||||
$this->updatesTransactionStatus = $updatesTransactionStatus;
|
||||
$this->createInvoiceTransactionProcessor = $createInvoiceTransactionProcessor;
|
||||
$this->sendUserPaymentProofUploadedEmail = $sendUserPaymentProofUploadedEmail;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,6 +93,14 @@ class CreatePaymentProofDocumentLogic extends AbstractControllerLogic
|
||||
|
||||
$this->createInvoiceTransactionProcessor->execute($transaction->owner->booking);
|
||||
|
||||
// send email to customer
|
||||
// todo: send them the file also
|
||||
// todo: a function to send a proof to the receipiant, they have to give us a email of the receipiant and also need to submiited purchase order
|
||||
$companyEmployee = $transaction->owner->booking->company->employees;
|
||||
foreach ($companyEmployee as $employee) {
|
||||
$this->sendUserPaymentProofUploadedEmail::dispatch($employee, $transaction->owner->booking);
|
||||
}
|
||||
|
||||
return $this->response([]);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Notifications;
|
||||
|
||||
use App\Models\Booking;
|
||||
use App\Models\User;
|
||||
use App\Models\UserEmailVerification;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
|
||||
class PaymentProofUploadedEmail extends AbstractEmail
|
||||
{
|
||||
|
||||
/** @var User */
|
||||
private $user;
|
||||
|
||||
/** @var Booking */
|
||||
private $booking;
|
||||
|
||||
/**
|
||||
* UserVerificationEmail constructor.
|
||||
* @param User $user
|
||||
* @param UserEmailVerification $attempt
|
||||
*/
|
||||
public function __construct(User $user, Booking $booking)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->booking = $booking;
|
||||
}
|
||||
|
||||
|
||||
public function toMail()
|
||||
{
|
||||
return (new MailMessage)
|
||||
->subject('Transfer Completed (REF: ' . $this->booking->marking . ')')
|
||||
->to('edmond.wuiming2021@gmail.com') // testing email
|
||||
// ->attach('/path/to/file') // todo-new: add attachement
|
||||
->view('emails.accounts.payment_proof_email', ['user' => $this->user, 'booking' => $this->booking]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user