mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-26 16:04:05 +00:00
Merge remote-tracking branch 'origin/development' into development
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Jobs;
|
||||
|
||||
use App\Classes\Notifications\PaymentProofUploadedEmail;
|
||||
use App\Models\Booking;
|
||||
use App\Models\User;
|
||||
use App\Models\File;
|
||||
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;
|
||||
|
||||
/** @var File */
|
||||
private $file;
|
||||
|
||||
/**
|
||||
* SendUserVerificationEmail constructor.
|
||||
* @param User $user
|
||||
* @param UserEmailVerification $attempt
|
||||
*/
|
||||
public function __construct(User $user, Booking $booking, File $file)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->booking = $booking;
|
||||
$this->file = $file;
|
||||
}
|
||||
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$this->user->notify(new PaymentProofUploadedEmail($this->user, $this->booking, $this->file));
|
||||
}
|
||||
}
|
||||
@@ -65,7 +65,7 @@ class AutoPurchaseOrderFillLogic extends AbstractControllerLogic
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$bookings = Booking::where('service_id', '!=', 4)->where(function($query){
|
||||
return $query->whereMonth('created_at', '=', 04)->whereYear('created_at', 2023);
|
||||
return $query->whereMonth('created_at', '=', 03)->whereYear('created_at', 2023);
|
||||
})->whereDoesntHave('transactions', function($q){
|
||||
$q->where('type', TransactionType::PURCHASE_ORDER);
|
||||
$q->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::APPROVED]);
|
||||
|
||||
+16
-2
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,12 +87,21 @@ class CreatePaymentProofDocumentLogic extends AbstractControllerLogic
|
||||
/** @var Document $document */
|
||||
$document = $this->createsDocument->execute($transaction, $object);
|
||||
|
||||
$this->createsFile->execute($document, $object);
|
||||
$file = $this->createsFile->execute($document, $object);
|
||||
|
||||
$this->updatesTransactionStatus->execute($transaction, ApprovalStatus::APPROVED);
|
||||
|
||||
$this->createInvoiceTransactionProcessor->execute($transaction->owner->booking);
|
||||
|
||||
// send email to customer
|
||||
// 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
|
||||
if (app()->environment('production')) {
|
||||
$companyEmployee = $transaction->owner->booking->company->employees;
|
||||
foreach ($companyEmployee as $employee) {
|
||||
$this->sendUserPaymentProofUploadedEmail::dispatch($employee, $transaction->owner->booking, $file[0]);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->response([]);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Notifications;
|
||||
|
||||
use App\Models\Booking;
|
||||
use App\Models\User;
|
||||
use App\Models\File;
|
||||
use App\Models\UserEmailVerification;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
|
||||
class PaymentProofUploadedEmail extends AbstractEmail
|
||||
{
|
||||
|
||||
/** @var User */
|
||||
private $user;
|
||||
|
||||
/** @var Booking */
|
||||
private $booking;
|
||||
|
||||
/** @var File */
|
||||
private $file;
|
||||
|
||||
/**
|
||||
* UserVerificationEmail constructor.
|
||||
* @param User $user
|
||||
* @param UserEmailVerification $attempt
|
||||
*/
|
||||
public function __construct(User $user, Booking $booking, File $file)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->booking = $booking;
|
||||
$this->file = $file;
|
||||
}
|
||||
|
||||
|
||||
public function toMail()
|
||||
{
|
||||
$attachedFile = null;
|
||||
$file_info = $this->file->getFileAttribute($this->file)->file->file_info;
|
||||
foreach ($file_info as $fileCount => $fileVal) {
|
||||
if (isset($fileVal->original)) {
|
||||
$file_path = $fileVal->original->file;
|
||||
$attachedFile = storage_path('app/documents/' . $file_path);
|
||||
}
|
||||
}
|
||||
|
||||
return (new MailMessage)
|
||||
->subject('Transfer Completed (REF: ' . $this->booking->marking . ')')
|
||||
->attach($attachedFile) // todo-new: add attachement
|
||||
->view('emails.accounts.payment_proof_email', ['user' => $this->user, 'booking' => $this->booking]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -27,9 +27,10 @@
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.holder_name">
|
||||
<label>Account Holder Name</label>
|
||||
<label>Account Holder Name / Company Name</label>
|
||||
<input type="text" class="form-control" v-model="parameters.holder_name" :disabled="disabled">
|
||||
</validation-wrapper-component>
|
||||
<span class="text-danger fs-10 m-l-5" v-if="serviceType">{{ serviceType.id != 4 ? '*Please ensure to use the appropriate company name for corporate transfers, instead of personal names.' : ''}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-10">
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
@extends('emails.layout.base')
|
||||
|
||||
@section('content')
|
||||
<h4 style="font-size: 1em;">Dear {{ucwords($user->name)}},</h4>
|
||||
<p style="font-size: 0.9em">Thank you for using CIEF Exchange service!</p>
|
||||
<p style="margin-top: 30px; font-size: 0.8em">We have completed your RMB transfer transaction for the ref. no {{$booking->marking}}. The RMB bank slip has been attached to this email. If you would like to view the transaction, please click on the following link:</p>
|
||||
<div style="margin-top: 20px;">
|
||||
<a href="{{route('booking.details', $booking->marking)}}"><button class="btn all-caps bg-primary no-border text-white pointer" style="font-size: 0.8em" >View</button></a>
|
||||
</div>
|
||||
<!-- todo-new: check if this is needed, confirm on customer support contact information -->
|
||||
<!-- <div class="all-caps hint-text" style="margin-top: 20px;"><small style="font-size: 0.7em">If you have questions, contact us at [customer support contact information]. We truly appreciate your trust in our services and look forward to serving you in the future.</small></div> -->
|
||||
@endsection
|
||||
Reference in New Issue
Block a user