File: /var/www/vhost/disk-apps/comfama.sports-crowd.com/app/Http/Controllers/ZonaPagosController.php
<?php
namespace App\Http\Controllers;
use App\Core\Order\Application\OrderService;
use App\Core\Payment\Application\PaymentTransactionService;
use App\Core\Ticket\Application\TicketService;
use App\Http\Controllers\Interfaces\PaymentGatewayControllerInterface;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
class ZonaPagosController extends PaymentGatewayBridgeController implements PaymentGatewayControllerInterface
{
private $util;
private $orderService;
private $ticketService;
private $paymentTransactionService;
public function __construct()
{
$this->util = new UtilController();
$this->orderService = new OrderService();
$this->ticketService = new TicketService();
$this->paymentTransactionService = new PaymentTransactionService();
}
public function payment(Request $request)
{
// no implemented
return;
}
public function webhooksListener(Request $request)
{
// no implemented
$this->util->logFile($request);
$orderPaymentTransaction = $this->orderService->getByPaymentGatewayTxId($request->id_pago);
$ticketPaymentTransaction = $this->ticketService->getByPaymentGatewayTxId($request->id_pago);
$genericPaymentTransaction = $this->paymentTransactionService->getByPaymentGatewayTxId($request->id_pago);
$paymentTransaction = $orderPaymentTransaction ?? $ticketPaymentTransaction ?? $genericPaymentTransaction;
if (!is_null($paymentTransaction)) {
if ($paymentTransaction === $orderPaymentTransaction) {
$this->orderService->validatePayment($paymentTransaction);
}
if ($paymentTransaction === $ticketPaymentTransaction) {
$this->ticketService->validatePayment($paymentTransaction);
}
if ($paymentTransaction === $genericPaymentTransaction) {
$this->paymentTransactionService->validatePayment($paymentTransaction);
}
}
return response('', Response::HTTP_NO_CONTENT);
}
public function getTransactionByReference(Request $request)
{
// no implemented
return;
}
public function validatePayment($transactionId, $reference)
{
// no implemented
return;
}
public function responseTransaction(Request $request)
{
// no implemented
return;
}
private function setTicketAsConfirmed($ticket)
{
// no implemented
return;
}
}