This commit is contained in:
2026-03-12 02:09:44 +05:00
parent e98674aa26
commit 2bd2c45ddb
4 changed files with 56 additions and 1 deletions

View File

@@ -664,7 +664,9 @@ function syncVisaWithAzatAPI(VisaMasterPaymentOrderItem $orderItem): array
} }
if (! isset($response['authRefNum'])) { if (! isset($response['authRefNum'])) {
warn('payment missing authRefNum', $onlinePaymentResource->orderId); warn('missing-authRefNum', $onlinePaymentResource->orderId);
ignorePayment('missing-authRefNum', $orderItem);
return [ return [
'error' => 'authRefNum missing', 'error' => 'authRefNum missing',
'type' => 'modal', 'type' => 'modal',
@@ -726,3 +728,12 @@ function warn($message, $content) {
'updated_at' => now(), 'updated_at' => now(),
]); ]);
} }
function ignorePayment($message, $item) {
DB::table('ignore_visa_payments')->insert([
'message' => $message,
'payment_id' => $item->id,
'created_at' => now(),
'updated_at' => now(),
]);
}

View File

@@ -8,6 +8,7 @@ use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
class SendVisaToSystem implements ShouldQueue class SendVisaToSystem implements ShouldQueue
@@ -27,10 +28,13 @@ class SendVisaToSystem implements ShouldQueue
*/ */
public function handle(): void public function handle(): void
{ {
$ignore = DB::table('ignore_visa_payments')->pluck('payment_id');
$orderItems = VisaMasterPaymentOrderItem::query() $orderItems = VisaMasterPaymentOrderItem::query()
->where('paid', true) ->where('paid', true)
->where('synced_with_system', false) ->where('synced_with_system', false)
->whereDate('created_at', '>', '2025-09-05') ->whereDate('created_at', '>', '2025-09-05')
->whereIntegerNotInRaw('id', $ignore)
->limit(2) ->limit(2)
->get() ->get()
->each(function ($orderItem) { ->each(function ($orderItem) {

View File

@@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class IgnoreVisaPayment extends Model
{
use HasFactory;
}

View File

@@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('ignore_visa_payments', function (Blueprint $table) {
$table->id();
$table->string('message')->index();
$table->unsignedBigInteger('payment_id')->index();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('ignore_visa_payments');
}
};