Merge branch 'vapor/production' into dillon/100-cleanup

This commit is contained in:
Dillon Ngo
2025-08-16 10:23:04 +08:00
5 changed files with 105 additions and 7 deletions
@@ -0,0 +1,49 @@
<?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\Transactions\Processors\CreatePaymentTransactionProcessor;
use App\Classes\Modules\Transactions\Processors\ReleaseGoodsToCustomerProcessor;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\PaymentMethodType;
use App\Models\Group;
use App\Models\Transaction;
use Illuminate\Support\Facades\Log;
class OneTimeFixWalletGroupTransactionV2CommandJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function handle()
{
Log::info(Carbon::now() . ': Start job - This is a one time fix of a double charge problem of a group payment through wallet.');
$start = new Carbon();
$invoice_ids = [29223, 29200]; //29223, 29200
$invoices = Transaction::whereIn('id', $invoice_ids)->get();
foreach ($invoices as $invoice) {
if($invoice->status == ApprovalStatus::APPROVED){
$paymentTransaction = (App()->make(CreatePaymentTransactionProcessor::class))->execute($invoice, PaymentMethodType::WALLET, '', false);
if($paymentTransaction && $paymentTransaction->status == ApprovalStatus::APPROVED){
$pL = $invoice->owner;
(App()->make(ReleaseGoodsToCustomerProcessor::class))->execute($pL, $invoice);
}
}
}
$group = Group::where('id', 1377)->first();
$group->status = ApprovalStatus::APPROVED;
$group->save();
$end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
Log::info(Carbon::now() . ': End job - This is a one time fix of a double charge problem of a group payment through wallet. ElapsedTime: ' . $elapsedTime . '.');
}
}
@@ -20,13 +20,12 @@ class OneTimeTransactionFixBillplzFailedCbV2CommandJob implements ShouldQueue
public function handle()
{
Log::info(Carbon::now() . ': Start job - One time fix failled callback from billplz cron ended.');
Log::info(Carbon::now() . ': Start job - One time fix failled callback from billplz.');
$start = new Carbon();
//Transaction fix with this one time fix command: 15205, 16803, 17310, 22008, 6770
//This transaction, 16803 has approve payment but not its owner, shipping invoice
$transactions = Transaction::whereIn('id', [22008, 6770])->get();
Log::info(Carbon::now() . ' : One time fix failled callback from billplz started.');
foreach ($transactions as $transaction){
if($transaction){
@@ -40,6 +39,6 @@ class OneTimeTransactionFixBillplzFailedCbV2CommandJob implements ShouldQueue
$end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
Log::info(Carbon::now() . ': End job - One time fix failled callback from billplz cron ended. ElapsedTime: ' . $elapsedTime . '.');
Log::info(Carbon::now() . ': End job - One time fix failled callback from billplz. ElapsedTime: ' . $elapsedTime . '.');
}
}
@@ -0,0 +1,50 @@
<?php
namespace App\Console\Commands\V2;
use App\Classes\Jobs\Commands\V2\OneTimeFixWalletGroupTransactionV2CommandJob;
use Illuminate\Console\Command;
class OneTimeFixWalletGroupTransactionV2Command extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'one-time-fix-wallet-group-transaction-command';
/**
* The console command description.
*
* @var string
*/
protected $description = 'This is a one time fix of a double charge problem of a group payment through wallet.';
protected $output = null;
protected $outputArray = [];
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
return;
OneTimeFixWalletGroupTransactionV2CommandJob::dispatch();
}
}
@@ -75,9 +75,9 @@
</div>
<div class="row">
<div class="col">
<!-- <div class="btn bg-grey no-border" @click="expanded = !expanded" v-if="['Pending Approval', 'Pending Payment'].includes(invoice_status)">
<div class="btn bg-grey no-border" @click="expanded = !expanded" v-if="['Pending Approval'].includes(invoice_status)">
<i class="fa" :class="{'fa-angle-down': !expanded, 'fa-angle-up': expanded}" ></i>
</div> -->
</div>
<div class="btn bg-grey no-border muted requestModal" v-if="singleInvoice && invoice_status == 'Pending Approval'" data-type="confirmInvoice">
<i class="fa fa-check fs-12"></i>
</div>
@@ -75,9 +75,9 @@
</div>
<div class="row">
<div class="col">
<!-- <div class="btn bg-grey no-border" @click="expanded = !expanded" v-if="['Pending Approval', 'Pending Payment'].includes(invoice_status)">
<div class="btn bg-grey no-border" @click="expanded = !expanded" v-if="['Pending Approval'].includes(invoice_status)">
<i class="fa" :class="{'fa-angle-down': !expanded, 'fa-angle-up': expanded}" ></i>
</div> -->
</div>
<div v-if="!item.shipping_transaction">
<div v-if="item.order">
<div v-if="!item.order.company_module.billingAddress">