File: /var/www/vhost/disk-apps/demo.sports-crowd.com/app/Http/Controllers/MembershipPaymentController.php
<?php
namespace App\Http\Controllers;
use App\Core\Membership\Application\MembershipService;
use App\Core\Payment\PaymentStatusEnum;
use App\Repositories\PaymentTransactionRepository;
class MembershipPaymentController extends Controller implements PaymentTransactionRepository
{
private $membershipService;
public function __construct()
{
$this->membershipService = new MembershipService();
}
public function finishPayment($paymentTransaction)
{
if ($paymentTransaction->state == PaymentStatusEnum::CONFIRMED) {
$this->membershipService->confirmMembershipOrder($paymentTransaction->membership);
try {
$invoice = new CollectionInvoiceController();
$invoice->validateCreditCollectionInvoice($paymentTransaction->gateway_payments_id, $paymentTransaction->reference, $paymentTransaction->gateway_transaction_id, 'membership', $paymentTransaction->membership->price);
// $pay = new LealPayController();
// $pay->validateUserPointsAccumulation($order);
} catch (\Throwable $th) {
$data = [
'membershipPayment' => $paymentTransaction->membership,
'message' => $th->getMessage(),
'getFile' => $th->getFile(),
'getLine' => $th->getLine(),
];
$util = new UtilController;
$util->logFile(json_encode($data));
}
}
}
}