wip
This commit is contained in:
@@ -550,6 +550,16 @@ function syncSberWithAzatAPI(SberPaymentOrderItem $orderItem): array
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! isset($response['authRefNum'])) {
|
||||||
|
warn('missing-authRefNum', $onlinePaymentResource->orderId);
|
||||||
|
ignoreSberPayment('missing-authRefNum', $orderItem);
|
||||||
|
|
||||||
|
return [
|
||||||
|
'error' => 'authRefNum missing',
|
||||||
|
'type' => 'modal',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
$systemRawResponse = syncWithBankSystem(
|
$systemRawResponse = syncWithBankSystem(
|
||||||
online_payment_order_uuid: $onlinePaymentResource->orderId,
|
online_payment_order_uuid: $onlinePaymentResource->orderId,
|
||||||
bank_unique_code: $sberPaymentOrder->branch->unique_code,
|
bank_unique_code: $sberPaymentOrder->branch->unique_code,
|
||||||
@@ -665,7 +675,7 @@ function syncVisaWithAzatAPI(VisaMasterPaymentOrderItem $orderItem): array
|
|||||||
|
|
||||||
if (! isset($response['authRefNum'])) {
|
if (! isset($response['authRefNum'])) {
|
||||||
warn('missing-authRefNum', $onlinePaymentResource->orderId);
|
warn('missing-authRefNum', $onlinePaymentResource->orderId);
|
||||||
ignorePayment('missing-authRefNum', $orderItem);
|
ignoreVisaPayment('missing-authRefNum', $orderItem);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'error' => 'authRefNum missing',
|
'error' => 'authRefNum missing',
|
||||||
@@ -729,7 +739,7 @@ function warn($message, $content) {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ignorePayment($message, $item) {
|
function ignoreVisaPayment($message, $item) {
|
||||||
DB::table('ignore_visa_payments')->insert([
|
DB::table('ignore_visa_payments')->insert([
|
||||||
'message' => $message,
|
'message' => $message,
|
||||||
'payment_id' => $item->id,
|
'payment_id' => $item->id,
|
||||||
@@ -737,3 +747,12 @@ function ignorePayment($message, $item) {
|
|||||||
'updated_at' => now(),
|
'updated_at' => now(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ignoreSberPayment($message, $item) {
|
||||||
|
DB::table('ignore_sber_payments')->insert([
|
||||||
|
'message' => $message,
|
||||||
|
'payment_id' => $item->id,
|
||||||
|
'created_at' => now(),
|
||||||
|
'updated_at' => now(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|||||||
@@ -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 SendSberToSystem implements ShouldQueue
|
class SendSberToSystem implements ShouldQueue
|
||||||
@@ -34,12 +35,16 @@ class SendSberToSystem implements ShouldQueue
|
|||||||
*/
|
*/
|
||||||
public function handle(): void
|
public function handle(): void
|
||||||
{
|
{
|
||||||
$orderItem = SberPaymentOrderItem::query()
|
$ignore = DB::table('ignore_sber_payments')->pluck('payment_id');
|
||||||
|
|
||||||
|
$orderItems = SberPaymentOrderItem::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')
|
||||||
->first();
|
->whereIntegerNotInRaw('id', $ignore)
|
||||||
|
->limit(2)
|
||||||
|
->get()
|
||||||
|
->each(function ($orderItem) {
|
||||||
if (! $orderItem) {
|
if (! $orderItem) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -52,5 +57,6 @@ class SendSberToSystem implements ShouldQueue
|
|||||||
'orderItem' => $orderItem,
|
'orderItem' => $orderItem,
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
11
app/Models/IgnoreSberPayment.php
Normal file
11
app/Models/IgnoreSberPayment.php
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class IgnoreSberPayment extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
}
|
||||||
@@ -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_sber_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_sber_payments');
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user