mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
Laravel Vapor - Code sync with Shipping Portal, Version 2 of Commands
This commit is contained in:
@@ -69,6 +69,5 @@ VOUCHERIFY_CLIENT_SECRET_KEY=""
|
||||
VOUCHERIFY_VERSION="v2018-08-01"
|
||||
VOUCHERIFY_URL="https://as1.api.voucherify.io"
|
||||
|
||||
|
||||
LARAVEL_VAPOR_ENABLED=false
|
||||
COMMANDS_V2_ENABLED=false
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Jobs\Commands\V2;
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use App\Classes\Modules\Companies\Services\RemovesCompanyFromSegment;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Models\Wallet;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class AuditAndUpdateWallletBalanceV2CommandJob implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
/** @var RemovesCompanyFromSegment */
|
||||
private $removesCompanyFromSegment;
|
||||
|
||||
/**
|
||||
* AuditAndUpdateWallletBalanceV2CommandJob constructor.
|
||||
* @param RemovesCompanyFromSegment $removesCompanyFromSegment
|
||||
*/
|
||||
public function __construct(RemovesCompanyFromSegment $removesCompanyFromSegment)
|
||||
{
|
||||
$this->removesCompanyFromSegment = $removesCompanyFromSegment;
|
||||
}
|
||||
|
||||
|
||||
public function handle()
|
||||
{
|
||||
Log::info(Carbon::now() . ': Start job - Audit and Update Wallet Balance.');
|
||||
$start = new Carbon();
|
||||
|
||||
$wallets = Wallet::all();
|
||||
|
||||
$i = 0;
|
||||
foreach ($wallets as $wallet) {
|
||||
$topups = 0;
|
||||
$credit = 0;
|
||||
$payments = 0;
|
||||
$debit = 0;
|
||||
|
||||
foreach ($wallet->transactions as $transaction) {
|
||||
if (!in_array((int) $transaction->status, [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])) continue;
|
||||
if ((int) $transaction->type === TransactionType::TOP_UP) {
|
||||
$topups += (float) $transaction->amount;
|
||||
}
|
||||
if ((int) $transaction->type === TransactionType::CREDIT_NOTE) $credit += (float) $transaction->amount;
|
||||
if ((int) $transaction->type === TransactionType::PAYMENT) $payments += (float) $transaction->amount;
|
||||
if ((int) $transaction->type === TransactionType::DEBIT_NOTE) $debit += (float) $transaction->amount;
|
||||
}
|
||||
$auditBalance = ($topups + $credit) - ($payments + $debit);
|
||||
$diffenrence = round((float) $wallet->amount - (($topups + $credit) - ($payments + $debit)), 2);
|
||||
if ((($diffenrence == 0) || ($diffenrence == -0)) and $wallet->amount > -0.01) continue;
|
||||
|
||||
$i++;
|
||||
|
||||
Log::info($i . ". Marking: " . $wallet->owner->reference . "(" . $wallet->id . ")" . PHP_EOL . "Current Balance: " . $wallet->amount . PHP_EOL . "Audit Balance: " . ($auditBalance) . PHP_EOL . "Difference: " . $diffenrence . PHP_EOL);
|
||||
|
||||
Wallet::where('id', $wallet->id)->update(['amount' => $auditBalance]);
|
||||
}
|
||||
|
||||
$end = new Carbon();
|
||||
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
|
||||
Log::info(Carbon::now() . ': End job - Audit and Update Wallet Balance. ElapsedTime: ' . $elapsedTime . '.');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Jobs\Commands\V2;
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\PaymentMethodType;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Models\Transaction;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class DebugBillplzFailedPaymentV2CommandJob implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
|
||||
public function handle()
|
||||
{
|
||||
Log::info(Carbon::now() . ': Start job - Debug Billplz Failed Payment.');
|
||||
$start = new Carbon();
|
||||
|
||||
$transactions = Transaction::where('type', TransactionType::PAYMENT)->where('payment_method', PaymentMethodType::PAYMENT_GATEWAY)->whereNotIn('status', [ApprovalStatus::COMPLETED, ApprovalStatus::APPROVED])->get();
|
||||
|
||||
$i = 0;
|
||||
$totalAmount = 0;
|
||||
foreach ($transactions as $transaction){
|
||||
$response = Http::withBasicAuth(config('billplz.api_key').':', '')->get(config('billplz.base_url').'/api/v3/bills/'.$transaction->payment_reference);
|
||||
|
||||
// dd($response);
|
||||
|
||||
if($response->successful()){
|
||||
$data = $response->json();
|
||||
if($data['paid']){
|
||||
if (!in_array($transaction->status, [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])) {
|
||||
$this->returnLog('Paid transaction', $transaction);
|
||||
}
|
||||
}
|
||||
// else {
|
||||
// $totalAmount += $transaction->amount;
|
||||
// $this->returnLog('Unpaid Transaction', $transaction);
|
||||
// }
|
||||
}else{
|
||||
$this->returnLog('billplz error', $transaction);
|
||||
}
|
||||
}
|
||||
|
||||
$end = new Carbon();
|
||||
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
|
||||
Log::info(Carbon::now() . ': End job - Debug Billplz Failed Payment. ElapsedTime: ' . $elapsedTime . '.');
|
||||
}
|
||||
|
||||
public function returnLog($text, $transaction) {
|
||||
$approvalStatusArray = ApprovalStatus::APPROVAL_STATUS_ID;
|
||||
Log::info($text . ' - id: '. $transaction->id . '. Booking Marking: '. $transaction->owner->marking . ' - Date: '.$transaction->created_at->format('d-m-Y').' - Amount: '. $transaction->amount . '. Current Status: ' . $approvalStatusArray[$transaction->status]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Jobs\Commands\V2;
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class DeleteBulkInvoiceFilesV2CommandJob implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
|
||||
public function handle()
|
||||
{
|
||||
Log::info(Carbon::now() . ': Start job - Delete all the bulk download files.');
|
||||
$start = new Carbon();
|
||||
|
||||
$directories = [
|
||||
storage_path('app/bulk_invoice'),
|
||||
storage_path('app/bulk_whiteform'),
|
||||
];
|
||||
|
||||
foreach ($directories as $directory) {
|
||||
$start = new Carbon();
|
||||
Log::info(Carbon::now() . ' Start cleaning - ' . $directory);
|
||||
|
||||
if (File::isDirectory($directory)) {
|
||||
File::cleanDirectory($directory);
|
||||
Log::info('All files have been deleted.');
|
||||
} else {
|
||||
Log::info('Directory does not exist.');
|
||||
}
|
||||
|
||||
$end = new Carbon();
|
||||
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
|
||||
|
||||
Log::info(Carbon::now() . ' Process ended. ElapsedTime: ' . $elapsedTime);
|
||||
}
|
||||
|
||||
$end = new Carbon();
|
||||
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
|
||||
Log::info(Carbon::now() . ': End job - Delete all the bulk download files. ElapsedTime: ' . $elapsedTime . '.');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Jobs\Commands\V2;
|
||||
|
||||
|
||||
use App\Classes\Modules\Jobs\DataTransferObjects\DeleteOrderV2CommandObject;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Models\Booking;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class DeleteOrderV2CommandJob implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
/** @var DeleteOrderV2CommandObject */
|
||||
private $deleteOrderV2CommandObject;
|
||||
|
||||
/**
|
||||
* DeleteOrderV2CommandJob constructor.
|
||||
* @param DeleteOrderV2CommandObject $deleteOrderV2CommandObject
|
||||
*/
|
||||
public function __construct(DeleteOrderV2CommandObject $deleteOrderV2CommandObject)
|
||||
{
|
||||
$this->deleteOrderV2CommandObject = $deleteOrderV2CommandObject;
|
||||
}
|
||||
|
||||
|
||||
public function handle()
|
||||
{
|
||||
Log::info(Carbon::now() . ': Start job - Change refunded booking status to expired.');
|
||||
$start = new Carbon();
|
||||
|
||||
$bookings_reference = $this->deleteOrderV2CommandObject->getBookingsReference();
|
||||
// $bookings_reference = '28546,38599,44487,71086,70133,58580,42831,96028,41188,33894,95877,86732,31894,50962,44215,92894,40968,30303,89762,74693,45271,27169';
|
||||
$bookings_reference = explode(',', $bookings_reference);
|
||||
|
||||
|
||||
foreach ($bookings_reference as $reference) {
|
||||
$booking = Booking::where('marking', $reference)->first();
|
||||
|
||||
if (!$booking) {
|
||||
$this->logOutput('Booking not found: ' . $reference);
|
||||
} else {
|
||||
$payment = $booking->transactions()
|
||||
->payments()->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])
|
||||
->first();
|
||||
|
||||
$payment->status = ApprovalStatus::EXPIRED;
|
||||
$payment->save();
|
||||
|
||||
$this->logOutput('Booking ' . $reference . ' Payment deleted: ' . $payment->id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$end = new Carbon();
|
||||
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
|
||||
Log::info(Carbon::now() . ': End job - Change refunded booking status to expired. ElapsedTime: ' . $elapsedTime . '.');
|
||||
$this->logOutput('Process ended. ElapsedTime: ' . $elapsedTime);
|
||||
}
|
||||
|
||||
public function logOutput($text) //cief todo: what is the purpose of this?
|
||||
{
|
||||
if (is_array($text)) {
|
||||
$text = implode(', ', $text);
|
||||
}
|
||||
|
||||
Log::info(Carbon::now() . ' : ' . $text);
|
||||
|
||||
$filePath = storage_path('logs/delete-orders.log');
|
||||
$textToAppend = Carbon::now()->format('[Y-m-d H:i:s]') . ' ' . $text . PHP_EOL;
|
||||
file_put_contents($filePath, $textToAppend, FILE_APPEND);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Jobs\Commands\V2;
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\DocumentType;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use ZipArchive;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class EmailDoToVTV2CommandJob implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
|
||||
public function handle()
|
||||
{
|
||||
Log::info(Carbon::now() . ': Start job - Send do to vt nation.');
|
||||
$start = new Carbon();
|
||||
|
||||
Auth::login(User::findOrFail(1));
|
||||
$zip_file = 'do_'.Carbon::yesterday()->format('Y_m_d').'.zip';
|
||||
$attachment = storage_path().'/'.$zip_file;
|
||||
|
||||
$startDate = Carbon::yesterday();
|
||||
$endDate = Carbon::yesterday();
|
||||
|
||||
$zip = new ZipArchive();
|
||||
if ($zip->open($attachment, ZIPARCHIVE::CREATE | ZipArchive::OVERWRITE)) {
|
||||
|
||||
$bookings = \App\Models\Booking::where('status', ApprovalStatus::COMPLETED)->whereDate('updated_at', '>=', $startDate)->whereDate('updated_at', '<=', $endDate)
|
||||
->whereHas('transactions', function ($query){
|
||||
return $query->where('type', TransactionType::PAYMENT)->whereHas('transactions', function ($query){
|
||||
return $query->where('issuer', 2);
|
||||
});
|
||||
})->get();
|
||||
|
||||
if(!count($bookings)){ return; }
|
||||
|
||||
foreach ($bookings as $booking) {
|
||||
$file = $booking->documents()->where('document_type', DocumentType::SUPPLIER_DELIVER_ORDER)->first()->files()->first();
|
||||
$zip->addFile(Storage::disk('documents')->path($file->file->file_info->original->file), $booking->created_at->format('d_m_Y').'_'.$booking->marking.'.pdf');
|
||||
|
||||
}
|
||||
|
||||
$zip->close();
|
||||
|
||||
Mail::raw( "Attention to VT Admin team:\r\n\r\nKindly refer to the attachment for our DAILY DO COMPILATION ".$startDate->format('d-m-Y')." - ".$endDate->format('d-m-Y').".\r\n\r\n**This is an automatically generated email – please do not reply to it. If you have any queries kindly contact our admin team through Wechat.\r\n\r\n\r\nCIEF WORLDWIDE SDN BHD", function($message) use ($attachment, $startDate, $endDate){
|
||||
$message->from('exchange@cief-malaysia.com');
|
||||
$message->to(['vtnation16@gmail.com', 'vtnation@gmail.com', 'atvantic04@gmail.com', 'vtnation2@gmail.com']);
|
||||
$message->cc(['shafiqa_sukeri@cief-malaysia.com', 'frontendcief@gmail.com', 'pm@cief-malaysia.com', 'hasan@cief-malaysia.com', 'shipping_admin@cief-malaysia.com', 'hasanakbar27@gmail.com', 'pmwong2019@gmail.com', 'uldvstar@gmail.com']);
|
||||
$message->subject('CIEF DO COMPILATION '.$startDate->format('d-m-Y').' - '.$endDate->format('d-m-Y'));
|
||||
|
||||
$message->attach($attachment);
|
||||
});
|
||||
|
||||
File::delete($attachment);
|
||||
Log::info('success');
|
||||
|
||||
}
|
||||
|
||||
$end = new Carbon();
|
||||
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
|
||||
Log::info(Carbon::now() . ': End job - Send do to vt nation. ElapsedTime: ' . $elapsedTime . '.');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Jobs\Commands\V2;
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use App\Models\SeasonalSegment;
|
||||
use App\Classes\Modules\Companies\Services\RemovesCompanyFromSegment;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class RemoveSeasonalSegmentCompanyV2CommandJob implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
/** @var RemovesCompanyFromSegment */
|
||||
private $removesCompanyFromSegment;
|
||||
|
||||
/**
|
||||
* RemoveSeasonalSegmentCompanyV2CommandJob constructor.
|
||||
* @param RemovesCompanyFromSegment $removesCompanyFromSegment
|
||||
*/
|
||||
public function __construct(RemovesCompanyFromSegment $removesCompanyFromSegment)
|
||||
{
|
||||
$this->removesCompanyFromSegment = $removesCompanyFromSegment;
|
||||
}
|
||||
|
||||
|
||||
public function handle()
|
||||
{
|
||||
Log::info(Carbon::now() . ': Start job - Perform soft delete on Seasonal Segment Company.');
|
||||
$start = new Carbon();
|
||||
|
||||
$seasonalSegment = SeasonalSegment::where('ending_on', '<=', Carbon::today())->get();
|
||||
|
||||
if (count($seasonalSegment)){
|
||||
foreach ($seasonalSegment as $seasonalSegmentCompany) {
|
||||
$this->removesCompanyFromSegment->execute($seasonalSegmentCompany->company, $seasonalSegmentCompany->segment);
|
||||
$seasonalSegmentCompany->delete();
|
||||
Log::info(Carbon::now() . ' : Deleted id: ' . $seasonalSegmentCompany->id);
|
||||
}
|
||||
}
|
||||
|
||||
$end = new Carbon();
|
||||
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
|
||||
Log::info(Carbon::now() . ': End job - Perform soft delete on Seasonal Segment Company. ElapsedTime: ' . $elapsedTime . '.');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Jobs\DataTransferObjects;
|
||||
|
||||
use App\Classes\General\Interfaces\DataTransferObject;
|
||||
|
||||
class DeleteOrderV2CommandObject implements DataTransferObject
|
||||
{
|
||||
/** @var string */
|
||||
private $bookingsReference;
|
||||
|
||||
|
||||
public function __construct(string $bookingsReference)
|
||||
{
|
||||
$this->bookingsReference = $bookingsReference;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getBookingsReference(): string
|
||||
{
|
||||
return $this->bookingsReference;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\V2;
|
||||
|
||||
use App\Classes\Jobs\Commands\V2\AuditAndUpdateWallletBalanceV2CommandJob;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class AuditAndUpdateWallletBalanceV2Command extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'audit-wallet-balance-command';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Audit and Update Wallet Balance';
|
||||
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
AuditAndUpdateWallletBalanceV2CommandJob::dispatch();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\V2;
|
||||
|
||||
use App\Classes\Jobs\Commands\V2\DebugBillplzFailedPaymentV2CommandJob;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class DebugBillplzFailedPaymentV2Command extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'billplz-failed-payment-debug-command';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Command description';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
DebugBillplzFailedPaymentV2CommandJob::dispatch();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\V2;
|
||||
|
||||
use App\Classes\Jobs\Commands\V2\DeleteBulkInvoiceFilesV2CommandJob;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class DeleteBulkInvoiceFilesV2Command extends Command
|
||||
{
|
||||
protected $signature = 'delete-bulk-download-files-command';
|
||||
|
||||
protected $description = 'Delete all the bulk download files';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function handle()
|
||||
{
|
||||
DeleteBulkInvoiceFilesV2CommandJob::dispatch();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\V2;
|
||||
|
||||
use App\Classes\Jobs\Commands\V2\DeleteOrderV2CommandJob;
|
||||
use App\Classes\Modules\Jobs\DataTransferObjects\DeleteOrderV2CommandObject;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class DeleteOrderV2Command extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'make-refunded-booking-expired-command {bookings_reference}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Change refunded booking status to expired';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$deleteOrderV2CommandObject = new DeleteOrderV2CommandObject(
|
||||
$this->argument('bookings_reference')
|
||||
);
|
||||
DeleteOrderV2CommandJob::dispatch($deleteOrderV2CommandObject);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\V2;
|
||||
|
||||
use App\Classes\Jobs\Commands\V2\EmailDoToVTV2CommandJob;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class EmailDoToVTV2Command extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
|
||||
protected $signature = 'email-do-to-vt-command';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Send do to vt nation';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
EmailDoToVTV2CommandJob::dispatch();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\V2;
|
||||
|
||||
use App\Classes\Jobs\Commands\V2\RemoveSeasonalSegmentCompanyV2CommandJob;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class RemoveSeasonalSegmentCompanyV2Command extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'seasonal-segmant-company-remove-command';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Perform soft delete on Seasonal Segment Company';
|
||||
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
RemoveSeasonalSegmentCompanyV2CommandJob::dispatch();
|
||||
}
|
||||
}
|
||||
@@ -36,6 +36,18 @@ class Kernel extends ConsoleKernel
|
||||
$schedule->command('dummy-command')
|
||||
->everyFiveMinutes()
|
||||
->withoutOverlapping();
|
||||
|
||||
$schedule->command('email-do-to-vt-command')
|
||||
->dailyAt('10:00')
|
||||
->withoutOverlapping();
|
||||
|
||||
$schedule->command('seasonal-segmant-company-remove-command')
|
||||
->dailyAt('01:00')
|
||||
->withoutOverlapping();
|
||||
|
||||
$schedule->command('delete-bulk-download-files-command')
|
||||
->hourly()
|
||||
->withoutOverlapping();
|
||||
}
|
||||
//Commands Version 1: Before Laravel Vapor/AWS
|
||||
else{
|
||||
|
||||
Reference in New Issue
Block a user