feat(integrations): resolve payment context from events

This commit is contained in:
2026-09-28 19:14:23 +00:00
parent 7996d53e12
commit 3f9b773367
7 changed files with 173 additions and 42 deletions

View File

@@ -2,7 +2,6 @@
namespace App\Domains\Commerce\Purchase\Controllers;
use App\Shared\Integration\Services\TelepagosIntegrationService;
use App\Domains\Commerce\Purchase\Models\Purchase;
use App\Domains\Commerce\Purchase\Requests\PaymentIntentRequest;
use App\Domains\Commerce\Purchase\Requests\StartCheckoutRequest;
@@ -13,6 +12,7 @@ use App\Domains\Commerce\Purchase\Services\CheckoutService;
use App\Domains\Commerce\Purchase\Services\PurchaseStateGuard;
use App\Domains\Core\Tenant\Models\Tenant;
use App\Http\Controllers\Controller;
use App\Shared\Integration\Services\TelepagosIntegrationService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
@@ -151,11 +151,14 @@ class PurchaseController extends Controller
}
$compra->refresh();
$compra->loadMissing('event');
$totalAmount = (float) $compra->total;
if ($method === 'transfer') {
$telepagosService = new TelepagosIntegrationService;
$telepagosService->forTenant($tenant->codigo);
$compra->event
? $telepagosService->forEvent($compra->event)
: $telepagosService->forTenant($tenant->codigo);
try {
$accountInfo = $telepagosService->getAccountInfo();
@@ -191,7 +194,9 @@ class PurchaseController extends Controller
if ($method === 'qr') {
$telepagosService = new TelepagosIntegrationService;
$telepagosService->forTenant($tenant->codigo);
$compra->event
? $telepagosService->forEvent($compra->event)
: $telepagosService->forTenant($tenant->codigo);
try {
Log::channel('telepagos')->info('Generating Telepagos QR.', [