mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
74 lines
2.0 KiB
PHP
74 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
|
|
use App\Classes\Modules\Billplzs\Processors\CallbackBillplzProcessor;
|
|
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
|
use App\Models\Transaction;
|
|
use Carbon\Carbon;
|
|
use Illuminate\Console\Command;
|
|
|
|
class OneTimeTransactionFixBillplzFailedCallback extends Command
|
|
{
|
|
/**
|
|
* The name and signature of the console command.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $signature = 'one-time-transaction-fix-billplz-failed-callback';
|
|
|
|
/**
|
|
* The console command description.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $description = 'This is a one time fix billplz failed callback for transaction with id 15205';
|
|
|
|
protected $output = null;
|
|
|
|
protected $outputArray = [];
|
|
|
|
/** @var CallbackBillplzProcessor */
|
|
private $callbackBillplzProcessor;
|
|
|
|
/**
|
|
* Create a new command instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct(CallbackBillplzProcessor $callbackBillplzProcessor)
|
|
{
|
|
parent::__construct();
|
|
$this->callbackBillplzProcessor = $callbackBillplzProcessor;
|
|
}
|
|
|
|
/**
|
|
* Execute the console command.
|
|
*
|
|
* @return int
|
|
*/
|
|
public function handle()
|
|
{
|
|
ini_set('memory_limit', '-1');
|
|
|
|
$this->outputArray = [];
|
|
$start = new Carbon();
|
|
|
|
//This transaction, 15205 has approve payment but not its owner, shipping invoice
|
|
$transaction = Transaction::whereIn('id', [15205])->first();
|
|
$this->info(Carbon::now() . ' : One time fix failled callback from billplz for transaction with id 15205 cron started.');
|
|
|
|
if($transaction && $transaction->id == 15205){
|
|
|
|
$status = ApprovalStatus::APPROVED;
|
|
$this->callbackBillplzProcessor->execute($transaction, $status);
|
|
}
|
|
|
|
|
|
$end = new Carbon();
|
|
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
|
|
$this->info(Carbon::now() . ' : One time fix failled callback from billplz for transaction with id 15205 cron ended. ElapsedTime: ' . $elapsedTime);
|
|
}
|
|
}
|